Skip to content

Commit 9597666

Browse files
committed
Auto merge of rust-lang#132538 - GuillaumeGomez:rollup-nz2v8uj, r=GuillaumeGomez
Rollup of 8 pull requests Successful merges: - rust-lang#132153 (Stabilise `const_char_encode_utf16`.) - rust-lang#132419 (PassWrapper: adapt for llvm/llvm-project@b01e2a8b5620466c3b) - rust-lang#132437 (coverage: Regression test for inlining into an uninstrumented crate) - rust-lang#132458 (get rid of a whole bunch of unnecessary rustc_const_unstable attributes) - rust-lang#132520 (NFC add known bug nr to test) - rust-lang#132522 (make codegen help output more consistent) - rust-lang#132523 (Added regression test for generics index out of bounds) - rust-lang#132528 (Use `*_opt` typeck results fns to not ICE in fallback suggestion) Failed merges: - rust-lang#132511 (stabilize const_arguments_as_str) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 00ed73c + 943e855 commit 9597666

32 files changed

+114
-117
lines changed

compiler/rustc_hir_typeck/src/fallback.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ impl<'tcx> Visitor<'tcx> for AnnotateUnitFallbackVisitor<'_, 'tcx> {
643643
fn visit_ty(&mut self, hir_ty: &'tcx hir::Ty<'tcx>) -> Self::Result {
644644
// Try to replace `_` with `()`.
645645
if let hir::TyKind::Infer = hir_ty.kind
646-
&& let ty = self.fcx.typeck_results.borrow().node_type(hir_ty.hir_id)
646+
&& let Some(ty) = self.fcx.typeck_results.borrow().node_type_opt(hir_ty.hir_id)
647647
&& let Some(vid) = self.fcx.root_vid(ty)
648648
&& self.reachable_vids.contains(&vid)
649649
{
@@ -680,7 +680,8 @@ impl<'tcx> Visitor<'tcx> for AnnotateUnitFallbackVisitor<'_, 'tcx> {
680680
if let hir::ExprKind::Path(hir::QPath::Resolved(None, path)) = expr.kind
681681
&& let Res::Def(DefKind::AssocFn, def_id) = path.res
682682
&& self.fcx.tcx.trait_of_item(def_id).is_some()
683-
&& let self_ty = self.fcx.typeck_results.borrow().node_args(expr.hir_id).type_at(0)
683+
&& let Some(args) = self.fcx.typeck_results.borrow().node_args_opt(expr.hir_id)
684+
&& let self_ty = args.type_at(0)
684685
&& let Some(vid) = self.fcx.root_vid(self_ty)
685686
&& self.reachable_vids.contains(&vid)
686687
&& let [.., trait_segment, _method_segment] = path.segments
@@ -701,7 +702,7 @@ impl<'tcx> Visitor<'tcx> for AnnotateUnitFallbackVisitor<'_, 'tcx> {
701702
fn visit_local(&mut self, local: &'tcx hir::LetStmt<'tcx>) -> Self::Result {
702703
// For a local, try suggest annotating the type if it's missing.
703704
if let None = local.ty
704-
&& let ty = self.fcx.typeck_results.borrow().node_type(local.hir_id)
705+
&& let Some(ty) = self.fcx.typeck_results.borrow().node_type_opt(local.hir_id)
705706
&& let Some(vid) = self.fcx.root_vid(ty)
706707
&& self.reachable_vids.contains(&vid)
707708
{

compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -825,9 +825,9 @@ extern "C" LLVMRustResult LLVMRustOptimize(
825825
!NoPrepopulatePasses) {
826826
PipelineStartEPCallbacks.push_back(
827827
[](ModulePassManager &MPM, OptimizationLevel Level) {
828-
MPM.addPass(LowerTypeTestsPass(/*ExportSummary=*/nullptr,
829-
/*ImportSummary=*/nullptr,
830-
/*DropTypeTests=*/false));
828+
MPM.addPass(LowerTypeTestsPass(
829+
/*ExportSummary=*/nullptr,
830+
/*ImportSummary=*/nullptr));
831831
});
832832
}
833833

compiler/rustc_session/src/options.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1585,7 +1585,7 @@ options! {
15851585
link_dead_code: Option<bool> = (None, parse_opt_bool, [TRACKED],
15861586
"keep dead code at link time (useful for code coverage) (default: no)"),
15871587
link_self_contained: LinkSelfContained = (LinkSelfContained::default(), parse_link_self_contained, [UNTRACKED],
1588-
"control whether to link Rust provided C objects/libraries or rely
1588+
"control whether to link Rust provided C objects/libraries or rely \
15891589
on a C toolchain or linker installed in the system"),
15901590
linker: Option<PathBuf> = (None, parse_opt_pathbuf, [UNTRACKED],
15911591
"system linker to link outputs with"),

library/core/src/array/iter.rs

-2
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ impl<T, const N: usize> IntoIter<T, N> {
136136
/// assert_eq!(r.collect::<Vec<_>>(), vec![10, 11, 12, 13, 14, 15]);
137137
/// ```
138138
#[unstable(feature = "array_into_iter_constructors", issue = "91583")]
139-
#[rustc_const_unstable(feature = "const_array_into_iter_constructors", issue = "91583")]
140139
pub const unsafe fn new_unchecked(
141140
buffer: [MaybeUninit<T>; N],
142141
initialized: Range<usize>,
@@ -199,7 +198,6 @@ impl<T, const N: usize> IntoIter<T, N> {
199198
/// assert_eq!(get_bytes(false).collect::<Vec<_>>(), vec![]);
200199
/// ```
201200
#[unstable(feature = "array_into_iter_constructors", issue = "91583")]
202-
#[rustc_const_unstable(feature = "const_array_into_iter_constructors", issue = "91583")]
203201
pub const fn empty() -> Self {
204202
let buffer = [const { MaybeUninit::uninit() }; N];
205203
let initialized = 0..0;

library/core/src/char/methods.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ impl char {
711711
/// '𝕊'.encode_utf16(&mut b);
712712
/// ```
713713
#[stable(feature = "unicode_encode_char", since = "1.15.0")]
714-
#[rustc_const_unstable(feature = "const_char_encode_utf16", issue = "130660")]
714+
#[rustc_const_stable(feature = "const_char_encode_utf16", since = "CURRENT_RUSTC_VERSION")]
715715
#[inline]
716716
pub const fn encode_utf16(self, dst: &mut [u16]) -> &mut [u16] {
717717
encode_utf16_raw(self as u32, dst)
@@ -1515,7 +1515,6 @@ impl char {
15151515
/// ```
15161516
#[must_use]
15171517
#[unstable(feature = "is_ascii_octdigit", issue = "101288")]
1518-
#[rustc_const_unstable(feature = "is_ascii_octdigit", issue = "101288")]
15191518
#[inline]
15201519
pub const fn is_ascii_octdigit(&self) -> bool {
15211520
matches!(*self, '0'..='7')
@@ -1823,9 +1822,10 @@ pub const fn encode_utf8_raw(code: u32, dst: &mut [u8]) -> &mut [u8] {
18231822
/// Panics if the buffer is not large enough.
18241823
/// A buffer of length 2 is large enough to encode any `char`.
18251824
#[unstable(feature = "char_internals", reason = "exposed only for libstd", issue = "none")]
1826-
#[rustc_const_unstable(feature = "const_char_encode_utf16", issue = "130660")]
1825+
#[rustc_const_stable(feature = "const_char_encode_utf16", since = "CURRENT_RUSTC_VERSION")]
18271826
#[doc(hidden)]
18281827
#[inline]
1828+
#[rustc_allow_const_fn_unstable(const_eval_select)]
18291829
pub const fn encode_utf16_raw(mut code: u32, dst: &mut [u16]) -> &mut [u16] {
18301830
const fn panic_at_const(_code: u32, _len: usize, _dst_len: usize) {
18311831
// Note that we cannot format in constant expressions.

library/core/src/lib.rs

-6
Original file line numberDiff line numberDiff line change
@@ -115,17 +115,13 @@
115115
#![feature(const_align_offset)]
116116
#![feature(const_alloc_layout)]
117117
#![feature(const_arguments_as_str)]
118-
#![feature(const_array_into_iter_constructors)]
119-
#![feature(const_bigint_helper_methods)]
120118
#![feature(const_black_box)]
121-
#![feature(const_char_encode_utf16)]
122119
#![feature(const_eval_select)]
123120
#![feature(const_exact_div)]
124121
#![feature(const_float_methods)]
125122
#![feature(const_hash)]
126123
#![feature(const_heap)]
127124
#![feature(const_nonnull_new)]
128-
#![feature(const_num_midpoint)]
129125
#![feature(const_option_ext)]
130126
#![feature(const_pin_2)]
131127
#![feature(const_pointer_is_aligned)]
@@ -135,7 +131,6 @@
135131
#![feature(const_size_of_val)]
136132
#![feature(const_size_of_val_raw)]
137133
#![feature(const_sockaddr_setters)]
138-
#![feature(const_strict_overflow_ops)]
139134
#![feature(const_swap)]
140135
#![feature(const_try)]
141136
#![feature(const_type_id)]
@@ -167,7 +162,6 @@
167162
#![feature(unchecked_neg)]
168163
#![feature(unchecked_shifts)]
169164
#![feature(utf16_extra)]
170-
#![feature(utf16_extra_const)]
171165
#![feature(variant_count)]
172166
// tidy-alphabetical-end
173167
//

library/core/src/mem/maybe_uninit.rs

-6
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,6 @@ impl<T> MaybeUninit<T> {
338338
/// let data = read(&mut buf);
339339
/// ```
340340
#[unstable(feature = "maybe_uninit_uninit_array", issue = "96097")]
341-
#[rustc_const_unstable(feature = "const_maybe_uninit_uninit_array", issue = "96097")]
342341
#[must_use]
343342
#[inline(always)]
344343
pub const fn uninit_array<const N: usize>() -> [Self; N] {
@@ -946,7 +945,6 @@ impl<T> MaybeUninit<T> {
946945
/// assert_eq!(array, [0, 1, 2]);
947946
/// ```
948947
#[unstable(feature = "maybe_uninit_array_assume_init", issue = "96097")]
949-
#[rustc_const_unstable(feature = "const_maybe_uninit_array_assume_init", issue = "96097")]
950948
#[inline(always)]
951949
#[track_caller]
952950
pub const unsafe fn array_assume_init<const N: usize>(array: [Self; N]) -> [T; N] {
@@ -973,7 +971,6 @@ impl<T> MaybeUninit<T> {
973971
///
974972
/// [`assume_init_ref`]: MaybeUninit::assume_init_ref
975973
#[unstable(feature = "maybe_uninit_slice", issue = "63569")]
976-
#[rustc_const_unstable(feature = "maybe_uninit_slice", issue = "63569")]
977974
#[inline(always)]
978975
pub const unsafe fn slice_assume_init_ref(slice: &[Self]) -> &[T] {
979976
// SAFETY: casting `slice` to a `*const [T]` is safe since the caller guarantees that
@@ -995,7 +992,6 @@ impl<T> MaybeUninit<T> {
995992
///
996993
/// [`assume_init_mut`]: MaybeUninit::assume_init_mut
997994
#[unstable(feature = "maybe_uninit_slice", issue = "63569")]
998-
#[rustc_const_unstable(feature = "maybe_uninit_slice", issue = "63569")]
999995
#[inline(always)]
1000996
pub const unsafe fn slice_assume_init_mut(slice: &mut [Self]) -> &mut [T] {
1001997
// SAFETY: similar to safety notes for `slice_get_ref`, but we have a
@@ -1005,15 +1001,13 @@ impl<T> MaybeUninit<T> {
10051001

10061002
/// Gets a pointer to the first element of the array.
10071003
#[unstable(feature = "maybe_uninit_slice", issue = "63569")]
1008-
#[rustc_const_unstable(feature = "maybe_uninit_slice", issue = "63569")]
10091004
#[inline(always)]
10101005
pub const fn slice_as_ptr(this: &[MaybeUninit<T>]) -> *const T {
10111006
this.as_ptr() as *const T
10121007
}
10131008

10141009
/// Gets a mutable pointer to the first element of the array.
10151010
#[unstable(feature = "maybe_uninit_slice", issue = "63569")]
1016-
#[rustc_const_unstable(feature = "maybe_uninit_slice", issue = "63569")]
10171011
#[inline(always)]
10181012
pub const fn slice_as_mut_ptr(this: &mut [MaybeUninit<T>]) -> *mut T {
10191013
this.as_mut_ptr() as *mut T

library/core/src/net/ip_addr.rs

-1
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,6 @@ impl IpAddr {
373373
/// assert_eq!(IpAddr::V6(Ipv6Addr::new(0x2001, 0x2, 0, 0, 0, 0, 0, 0)).is_benchmarking(), true);
374374
/// ```
375375
#[unstable(feature = "ip", issue = "27709")]
376-
#[rustc_const_unstable(feature = "const_ipv4", issue = "76205")]
377376
#[must_use]
378377
#[inline]
379378
pub const fn is_benchmarking(&self) -> bool {

library/core/src/num/f32.rs

-2
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,6 @@ impl f32 {
748748
/// [`MAX`]: Self::MAX
749749
#[inline]
750750
#[unstable(feature = "float_next_up_down", issue = "91399")]
751-
#[rustc_const_unstable(feature = "float_next_up_down", issue = "91399")]
752751
pub const fn next_up(self) -> Self {
753752
// Some targets violate Rust's assumption of IEEE semantics, e.g. by flushing
754753
// denormals to zero. This is in general unsound and unsupported, but here
@@ -797,7 +796,6 @@ impl f32 {
797796
/// [`MAX`]: Self::MAX
798797
#[inline]
799798
#[unstable(feature = "float_next_up_down", issue = "91399")]
800-
#[rustc_const_unstable(feature = "float_next_up_down", issue = "91399")]
801799
pub const fn next_down(self) -> Self {
802800
// Some targets violate Rust's assumption of IEEE semantics, e.g. by flushing
803801
// denormals to zero. This is in general unsound and unsupported, but here

library/core/src/num/f64.rs

-2
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,6 @@ impl f64 {
765765
/// [`MAX`]: Self::MAX
766766
#[inline]
767767
#[unstable(feature = "float_next_up_down", issue = "91399")]
768-
#[rustc_const_unstable(feature = "float_next_up_down", issue = "91399")]
769768
pub const fn next_up(self) -> Self {
770769
// Some targets violate Rust's assumption of IEEE semantics, e.g. by flushing
771770
// denormals to zero. This is in general unsound and unsupported, but here
@@ -814,7 +813,6 @@ impl f64 {
814813
/// [`MAX`]: Self::MAX
815814
#[inline]
816815
#[unstable(feature = "float_next_up_down", issue = "91399")]
817-
#[rustc_const_unstable(feature = "float_next_up_down", issue = "91399")]
818816
pub const fn next_down(self) -> Self {
819817
// Some targets violate Rust's assumption of IEEE semantics, e.g. by flushing
820818
// denormals to zero. This is in general unsound and unsupported, but here

library/core/src/num/int_macros.rs

-18
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,6 @@ macro_rules! int_impl {
477477
#[doc = concat!("let _ = (", stringify!($SelfT), "::MAX - 2).strict_add(3);")]
478478
/// ```
479479
#[unstable(feature = "strict_overflow_ops", issue = "118260")]
480-
#[rustc_const_unstable(feature = "const_strict_overflow_ops", issue = "118260")]
481480
#[must_use = "this returns the result of the operation, \
482481
without modifying the original"]
483482
#[inline]
@@ -573,7 +572,6 @@ macro_rules! int_impl {
573572
#[doc = concat!("let _ = (", stringify!($SelfT), "::MAX - 2).strict_add_unsigned(3);")]
574573
/// ```
575574
#[unstable(feature = "strict_overflow_ops", issue = "118260")]
576-
#[rustc_const_unstable(feature = "const_strict_overflow_ops", issue = "118260")]
577575
#[must_use = "this returns the result of the operation, \
578576
without modifying the original"]
579577
#[inline]
@@ -629,7 +627,6 @@ macro_rules! int_impl {
629627
#[doc = concat!("let _ = (", stringify!($SelfT), "::MIN + 2).strict_sub(3);")]
630628
/// ```
631629
#[unstable(feature = "strict_overflow_ops", issue = "118260")]
632-
#[rustc_const_unstable(feature = "const_strict_overflow_ops", issue = "118260")]
633630
#[must_use = "this returns the result of the operation, \
634631
without modifying the original"]
635632
#[inline]
@@ -725,7 +722,6 @@ macro_rules! int_impl {
725722
#[doc = concat!("let _ = (", stringify!($SelfT), "::MIN + 2).strict_sub_unsigned(3);")]
726723
/// ```
727724
#[unstable(feature = "strict_overflow_ops", issue = "118260")]
728-
#[rustc_const_unstable(feature = "const_strict_overflow_ops", issue = "118260")]
729725
#[must_use = "this returns the result of the operation, \
730726
without modifying the original"]
731727
#[inline]
@@ -781,7 +777,6 @@ macro_rules! int_impl {
781777
#[doc = concat!("let _ = ", stringify!($SelfT), "::MAX.strict_mul(2);")]
782778
/// ```
783779
#[unstable(feature = "strict_overflow_ops", issue = "118260")]
784-
#[rustc_const_unstable(feature = "const_strict_overflow_ops", issue = "118260")]
785780
#[must_use = "this returns the result of the operation, \
786781
without modifying the original"]
787782
#[inline]
@@ -895,7 +890,6 @@ macro_rules! int_impl {
895890
#[doc = concat!("let _ = (1", stringify!($SelfT), ").strict_div(0);")]
896891
/// ```
897892
#[unstable(feature = "strict_overflow_ops", issue = "118260")]
898-
#[rustc_const_unstable(feature = "const_strict_overflow_ops", issue = "118260")]
899893
#[must_use = "this returns the result of the operation, \
900894
without modifying the original"]
901895
#[inline]
@@ -969,7 +963,6 @@ macro_rules! int_impl {
969963
#[doc = concat!("let _ = (1", stringify!($SelfT), ").strict_div_euclid(0);")]
970964
/// ```
971965
#[unstable(feature = "strict_overflow_ops", issue = "118260")]
972-
#[rustc_const_unstable(feature = "const_strict_overflow_ops", issue = "118260")]
973966
#[must_use = "this returns the result of the operation, \
974967
without modifying the original"]
975968
#[inline]
@@ -1042,7 +1035,6 @@ macro_rules! int_impl {
10421035
#[doc = concat!("let _ = ", stringify!($SelfT), "::MIN.strict_rem(-1);")]
10431036
/// ```
10441037
#[unstable(feature = "strict_overflow_ops", issue = "118260")]
1045-
#[rustc_const_unstable(feature = "const_strict_overflow_ops", issue = "118260")]
10461038
#[must_use = "this returns the result of the operation, \
10471039
without modifying the original"]
10481040
#[inline]
@@ -1115,7 +1107,6 @@ macro_rules! int_impl {
11151107
#[doc = concat!("let _ = ", stringify!($SelfT), "::MIN.strict_rem_euclid(-1);")]
11161108
/// ```
11171109
#[unstable(feature = "strict_overflow_ops", issue = "118260")]
1118-
#[rustc_const_unstable(feature = "const_strict_overflow_ops", issue = "118260")]
11191110
#[must_use = "this returns the result of the operation, \
11201111
without modifying the original"]
11211112
#[inline]
@@ -1203,7 +1194,6 @@ macro_rules! int_impl {
12031194
#[doc = concat!("let _ = ", stringify!($SelfT), "::MIN.strict_neg();")]
12041195
///
12051196
#[unstable(feature = "strict_overflow_ops", issue = "118260")]
1206-
#[rustc_const_unstable(feature = "const_strict_overflow_ops", issue = "118260")]
12071197
#[must_use = "this returns the result of the operation, \
12081198
without modifying the original"]
12091199
#[inline]
@@ -1266,7 +1256,6 @@ macro_rules! int_impl {
12661256
#[doc = concat!("let _ = 0x1", stringify!($SelfT), ".strict_shl(129);")]
12671257
/// ```
12681258
#[unstable(feature = "strict_overflow_ops", issue = "118260")]
1269-
#[rustc_const_unstable(feature = "const_strict_overflow_ops", issue = "118260")]
12701259
#[must_use = "this returns the result of the operation, \
12711260
without modifying the original"]
12721261
#[inline]
@@ -1325,7 +1314,6 @@ macro_rules! int_impl {
13251314
#[doc = concat!("assert_eq!(0x1", stringify!($SelfT), ".unbounded_shl(129), 0);")]
13261315
/// ```
13271316
#[unstable(feature = "unbounded_shifts", issue = "129375")]
1328-
#[rustc_const_unstable(feature = "const_unbounded_shifts", issue = "129375")]
13291317
#[must_use = "this returns the result of the operation, \
13301318
without modifying the original"]
13311319
#[inline]
@@ -1391,7 +1379,6 @@ macro_rules! int_impl {
13911379
#[doc = concat!("let _ = 0x10", stringify!($SelfT), ".strict_shr(128);")]
13921380
/// ```
13931381
#[unstable(feature = "strict_overflow_ops", issue = "118260")]
1394-
#[rustc_const_unstable(feature = "const_strict_overflow_ops", issue = "118260")]
13951382
#[must_use = "this returns the result of the operation, \
13961383
without modifying the original"]
13971384
#[inline]
@@ -1452,7 +1439,6 @@ macro_rules! int_impl {
14521439
#[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN.unbounded_shr(129), -1);")]
14531440
/// ```
14541441
#[unstable(feature = "unbounded_shifts", issue = "129375")]
1455-
#[rustc_const_unstable(feature = "const_unbounded_shifts", issue = "129375")]
14561442
#[must_use = "this returns the result of the operation, \
14571443
without modifying the original"]
14581444
#[inline]
@@ -1519,7 +1505,6 @@ macro_rules! int_impl {
15191505
#[doc = concat!("let _ = ", stringify!($SelfT), "::MIN.strict_abs();")]
15201506
/// ```
15211507
#[unstable(feature = "strict_overflow_ops", issue = "118260")]
1522-
#[rustc_const_unstable(feature = "const_strict_overflow_ops", issue = "118260")]
15231508
#[must_use = "this returns the result of the operation, \
15241509
without modifying the original"]
15251510
#[inline]
@@ -1594,7 +1579,6 @@ macro_rules! int_impl {
15941579
#[doc = concat!("let _ = ", stringify!($SelfT), "::MAX.strict_pow(2);")]
15951580
/// ```
15961581
#[unstable(feature = "strict_overflow_ops", issue = "118260")]
1597-
#[rustc_const_unstable(feature = "const_strict_overflow_ops", issue = "118260")]
15981582
#[must_use = "this returns the result of the operation, \
15991583
without modifying the original"]
16001584
#[inline]
@@ -2368,7 +2352,6 @@ macro_rules! int_impl {
23682352
/// assert_eq!((sum1, sum0), (6, 8));
23692353
/// ```
23702354
#[unstable(feature = "bigint_helper_methods", issue = "85532")]
2371-
#[rustc_const_unstable(feature = "const_bigint_helper_methods", issue = "85532")]
23722355
#[must_use = "this returns the result of the operation, \
23732356
without modifying the original"]
23742357
#[inline]
@@ -2476,7 +2459,6 @@ macro_rules! int_impl {
24762459
#[doc = concat!("assert_eq!((diff1, diff0), (10, ", stringify!($UnsignedT), "::MAX));")]
24772460
/// ```
24782461
#[unstable(feature = "bigint_helper_methods", issue = "85532")]
2479-
#[rustc_const_unstable(feature = "const_bigint_helper_methods", issue = "85532")]
24802462
#[must_use = "this returns the result of the operation, \
24812463
without modifying the original"]
24822464
#[inline]

0 commit comments

Comments
 (0)