diff --git a/compiler/rustc_attr_parsing/src/attributes/traits.rs b/compiler/rustc_attr_parsing/src/attributes/traits.rs index 54a95ffd0ea33..e3f5f30dd4e86 100644 --- a/compiler/rustc_attr_parsing/src/attributes/traits.rs +++ b/compiler/rustc_attr_parsing/src/attributes/traits.rs @@ -4,8 +4,8 @@ use super::prelude::*; use crate::attributes::{NoArgsAttributeParser, OnDuplicate, SingleAttributeParser}; use crate::context::{AcceptContext, Stage}; use crate::parser::ArgParser; +use crate::target_checking::AllowedTargets; use crate::target_checking::Policy::{Allow, Warn}; -use crate::target_checking::{ALL_TARGETS, AllowedTargets}; pub(crate) struct RustcSkipDuringMethodDispatchParser; impl SingleAttributeParser for RustcSkipDuringMethodDispatchParser { @@ -141,11 +141,3 @@ impl NoArgsAttributeParser for FundamentalParser { AllowedTargets::AllowList(&[Allow(Target::Struct), Allow(Target::Trait)]); const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::Fundamental; } - -pub(crate) struct PointeeParser; -impl NoArgsAttributeParser for PointeeParser { - const PATH: &[Symbol] = &[sym::pointee]; - const ON_DUPLICATE: OnDuplicate = OnDuplicate::Error; - const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(ALL_TARGETS); //FIXME Still checked fully in `check_attr.rs` - const CREATE: fn(Span) -> AttributeKind = AttributeKind::Pointee; -} diff --git a/compiler/rustc_attr_parsing/src/context.rs b/compiler/rustc_attr_parsing/src/context.rs index 51345162ee071..3f722bef5bf35 100644 --- a/compiler/rustc_attr_parsing/src/context.rs +++ b/compiler/rustc_attr_parsing/src/context.rs @@ -269,7 +269,6 @@ attribute_parsers!( Single>, Single>, Single>, - Single>, Single>, Single>, Single>, diff --git a/compiler/rustc_hir/src/attrs/data_structures.rs b/compiler/rustc_hir/src/attrs/data_structures.rs index 67bf1c9b91d06..f4bb5c0c3819e 100644 --- a/compiler/rustc_hir/src/attrs/data_structures.rs +++ b/compiler/rustc_hir/src/attrs/data_structures.rs @@ -1233,9 +1233,6 @@ pub enum AttributeKind { /// Represents `#[pin_v2]` PinV2(Span), - /// Represents `#[pointee]` - Pointee(Span), - /// Represents `#[prelude_import]` PreludeImport, diff --git a/compiler/rustc_hir/src/attrs/encode_cross_crate.rs b/compiler/rustc_hir/src/attrs/encode_cross_crate.rs index dace9756dc393..239c9d0ca530b 100644 --- a/compiler/rustc_hir/src/attrs/encode_cross_crate.rs +++ b/compiler/rustc_hir/src/attrs/encode_cross_crate.rs @@ -86,7 +86,6 @@ impl AttributeKind { Path(..) => No, PatternComplexityLimit { .. } => No, PinV2(..) => Yes, - Pointee(..) => No, PreludeImport => No, ProcMacro(..) => No, ProcMacroAttribute(..) => No, diff --git a/compiler/rustc_hir_analysis/src/check/wfcheck.rs b/compiler/rustc_hir_analysis/src/check/wfcheck.rs index d5f17a5cbb75b..460a9d776530e 100644 --- a/compiler/rustc_hir_analysis/src/check/wfcheck.rs +++ b/compiler/rustc_hir_analysis/src/check/wfcheck.rs @@ -904,7 +904,7 @@ fn check_param_wf(tcx: TyCtxt<'_>, param: &ty::GenericParamDef) -> Result<(), Er ) => None, Err(ConstParamTyImplementationError::UnsizedConstParamsFeatureRequired) => { Some(vec![ - (adt_const_params_feature_string, sym::adt_const_params), + (adt_const_params_feature_string, sym::min_adt_const_params), ( " references to implement the `ConstParamTy` trait".into(), sym::unsized_const_params, @@ -931,11 +931,13 @@ fn check_param_wf(tcx: TyCtxt<'_>, param: &ty::GenericParamDef) -> Result<(), Er ty_is_local(ty).then_some(vec![( adt_const_params_feature_string, - sym::adt_const_params, + sym::min_adt_const_params, )]) } // Implements `ConstParamTy`, suggest adding the feature to enable. - Ok(..) => Some(vec![(adt_const_params_feature_string, sym::adt_const_params)]), + Ok(..) => { + Some(vec![(adt_const_params_feature_string, sym::min_adt_const_params)]) + } }; if let Some(features) = may_suggest_feature { tcx.disabled_nightly_features(&mut diag, features); diff --git a/compiler/rustc_hir_typeck/src/method/probe.rs b/compiler/rustc_hir_typeck/src/method/probe.rs index 6cfa6e8d75175..3a5461b3ce344 100644 --- a/compiler/rustc_hir_typeck/src/method/probe.rs +++ b/compiler/rustc_hir_typeck/src/method/probe.rs @@ -2377,8 +2377,8 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> { continue; } - // This pick is not a supertrait of the `child_pick`. - // Check if it's a subtrait of the `child_pick`, instead. + // This candidate is not a supertrait of the `child_trait`. + // Check if it's a subtrait of the `child_trait`, instead. // If it is, then it must have been a subtrait of every // other pick we've eliminated at this point. It will // take over at this point. @@ -2392,7 +2392,8 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> { continue; } - // `child_pick` is not a supertrait of this pick. + // Neither `child_trait` or the current candidate are + // supertraits of each other. // Don't bail here, since we may be comparing two supertraits // of a common subtrait. These two supertraits won't be related // at all, but we will pick them up next round when we find their diff --git a/compiler/rustc_metadata/src/errors.rs b/compiler/rustc_metadata/src/errors.rs index a6f35a179d703..259b4f82593e5 100644 --- a/compiler/rustc_metadata/src/errors.rs +++ b/compiler/rustc_metadata/src/errors.rs @@ -233,16 +233,6 @@ pub struct ConflictingAllocErrorHandler { )] pub struct GlobalAllocRequired; -#[derive(Diagnostic)] -#[diag( - "the crate `{$crate_name}` cannot depend on a crate that needs {$needs_crate_name}, but it depends on `{$deps_crate_name}`" -)] -pub struct NoTransitiveNeedsDep<'a> { - pub crate_name: Symbol, - pub needs_crate_name: &'a str, - pub deps_crate_name: Symbol, -} - #[derive(Diagnostic)] #[diag("failed to write {$filename}: {$err}")] pub struct FailedWriteError { diff --git a/compiler/rustc_middle/src/error.rs b/compiler/rustc_middle/src/error.rs index 44ac747726a61..0f66faa83d0b3 100644 --- a/compiler/rustc_middle/src/error.rs +++ b/compiler/rustc_middle/src/error.rs @@ -36,21 +36,6 @@ pub(crate) struct OpaqueHiddenTypeMismatch<'tcx> { pub sub: TypeMismatchReason, } -#[derive(Diagnostic)] -#[diag("we don't support unions yet: '{$ty_name}'")] -pub struct UnsupportedUnion { - pub ty_name: String, -} - -// FIXME(autodiff): I should get used somewhere -#[derive(Diagnostic)] -#[diag("reading from a `Duplicated` const {$ty} is unsafe")] -pub struct AutodiffUnsafeInnerConstRef<'tcx> { - #[primary_span] - pub span: Span, - pub ty: Ty<'tcx>, -} - #[derive(Subdiagnostic)] pub enum TypeMismatchReason { #[label("this expression supplies two conflicting concrete types for the same opaque type")] diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs index c7a3ee456f88d..6ee8db1703b8e 100644 --- a/compiler/rustc_passes/src/check_attr.rs +++ b/compiler/rustc_passes/src/check_attr.rs @@ -281,7 +281,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> { | AttributeKind::Path(..) | AttributeKind::PatternComplexityLimit { .. } | AttributeKind::PinV2(..) - | AttributeKind::Pointee(..) | AttributeKind::PreludeImport | AttributeKind::ProfilerRuntime | AttributeKind::RecursionLimit { .. } diff --git a/compiler/rustc_trait_selection/src/errors.rs b/compiler/rustc_trait_selection/src/errors.rs index a8e742f4c4c0d..1edb3f172149f 100644 --- a/compiler/rustc_trait_selection/src/errors.rs +++ b/compiler/rustc_trait_selection/src/errors.rs @@ -28,15 +28,6 @@ pub struct UnableToConstructConstantValue<'a> { pub unevaluated: ty::UnevaluatedConst<'a>, } -#[derive(Diagnostic)] -#[diag("this attribute must have a value", code = E0232)] -#[note("e.g. `#[rustc_on_unimplemented(message=\"foo\")]`")] -pub struct NoValueInOnUnimplemented { - #[primary_span] - #[label("expected value here")] - pub span: Span, -} - pub struct NegativePositiveConflict<'tcx> { pub impl_span: Span, pub trait_desc: ty::TraitRef<'tcx>, @@ -1201,60 +1192,6 @@ pub struct TraitImplDiff { pub found: String, } -pub struct DynTraitConstraintSuggestion { - pub span: Span, - pub ident: Ident, -} - -impl Subdiagnostic for DynTraitConstraintSuggestion { - fn add_to_diag(self, diag: &mut Diag<'_, G>) { - let mut multi_span: MultiSpan = vec![self.span].into(); - multi_span.push_span_label( - self.span, - msg!("this has an implicit `'static` lifetime requirement"), - ); - multi_span.push_span_label( - self.ident.span, - msg!("calling this method introduces the `impl`'s `'static` requirement"), - ); - let msg = msg!("the used `impl` has a `'static` requirement"); - diag.span_note(multi_span, msg); - let msg = msg!("consider relaxing the implicit `'static` requirement"); - diag.span_suggestion_verbose( - self.span.shrink_to_hi(), - msg, - " + '_", - Applicability::MaybeIncorrect, - ); - } -} - -pub struct ReqIntroducedLocations { - pub span: MultiSpan, - pub spans: Vec, - pub fn_decl_span: Span, - pub cause_span: Span, - pub add_label: bool, -} - -impl Subdiagnostic for ReqIntroducedLocations { - fn add_to_diag(mut self, diag: &mut Diag<'_, G>) { - for sp in self.spans { - self.span.push_span_label(sp, msg!("`'static` requirement introduced here")); - } - - if self.add_label { - self.span.push_span_label( - self.fn_decl_span, - msg!("requirement introduced by this return type"), - ); - } - self.span.push_span_label(self.cause_span, msg!("because of this returned expression")); - let msg = msg!("\"`'static` lifetime requirement introduced by the return type"); - diag.span_note(self.span, msg); - } -} - #[derive(Diagnostic)] #[diag("{$has_param_name -> [true] `{$param_name}` diff --git a/library/core/src/char/methods.rs b/library/core/src/char/methods.rs index ce33fd1d8f9df..6f6557510243d 100644 --- a/library/core/src/char/methods.rs +++ b/library/core/src/char/methods.rs @@ -1932,6 +1932,9 @@ impl char { /// U+0020 SPACE, U+0009 HORIZONTAL TAB, U+000A LINE FEED, /// U+000C FORM FEED, or U+000D CARRIAGE RETURN. /// + /// **Warning:** Because the list above excludes U+000B VERTICAL TAB, + /// `c.is_ascii_whitespace()` is **not** equivalent to `c.is_ascii() && c.is_whitespace()`. + /// /// Rust uses the WhatWG Infra Standard's [definition of ASCII /// whitespace][infra-aw]. There are several other definitions in /// wide use. For instance, [the POSIX locale][pct] includes diff --git a/library/core/src/marker.rs b/library/core/src/marker.rs index 11c3c6fe19ab9..9597e2fab49ce 100644 --- a/library/core/src/marker.rs +++ b/library/core/src/marker.rs @@ -1095,9 +1095,13 @@ pub macro ConstParamTy($item:item) { /* compiler built-in */ } +// For `adt_const_params` to be recognized as a feature +#[unstable(feature = "adt_const_params", issue = "95174")] +const _: () = (); + // FIXME(adt_const_params): handle `ty::FnDef`/`ty::Closure` marker_impls! { - #[unstable(feature = "adt_const_params", issue = "95174")] + #[unstable(feature = "min_adt_const_params", issue = "154042")] ConstParamTy_ for usize, u8, u16, u32, u64, u128, isize, i8, i16, i32, i64, i128, diff --git a/library/core/src/num/mod.rs b/library/core/src/num/mod.rs index 5ba3695bc45c9..e305cff311897 100644 --- a/library/core/src/num/mod.rs +++ b/library/core/src/num/mod.rs @@ -1065,6 +1065,9 @@ impl u8 { /// U+0020 SPACE, U+0009 HORIZONTAL TAB, U+000A LINE FEED, /// U+000C FORM FEED, or U+000D CARRIAGE RETURN. /// + /// **Warning:** Because the list above excludes U+000B VERTICAL TAB, + /// `b.is_ascii_whitespace()` is **not** equivalent to `char::from(b).is_whitespace()`. + /// /// Rust uses the WhatWG Infra Standard's [definition of ASCII /// whitespace][infra-aw]. There are several other definitions in /// wide use. For instance, [the POSIX locale][pct] includes diff --git a/library/core/src/slice/ascii.rs b/library/core/src/slice/ascii.rs index edf058c96a522..9db07d8abbbef 100644 --- a/library/core/src/slice/ascii.rs +++ b/library/core/src/slice/ascii.rs @@ -222,7 +222,11 @@ impl [u8] { /// Returns a byte slice with leading ASCII whitespace bytes removed. /// /// 'Whitespace' refers to the definition used by - /// [`u8::is_ascii_whitespace`]. + /// [`u8::is_ascii_whitespace`]. Importantly, this definition excludes + /// the `\0x0B` byte even though it has the Unicode [`White_Space`] property + /// and is removed by [`str::trim_start`]. + /// + /// [`White_Space`]: https://www.unicode.org/reports/tr44/#White_Space /// /// # Examples /// @@ -251,7 +255,11 @@ impl [u8] { /// Returns a byte slice with trailing ASCII whitespace bytes removed. /// /// 'Whitespace' refers to the definition used by - /// [`u8::is_ascii_whitespace`]. + /// [`u8::is_ascii_whitespace`]. Importantly, this definition excludes + /// the `\0x0B` byte even though it has the Unicode [`White_Space`] property + /// and is removed by [`str::trim_end`]. + /// + /// [`White_Space`]: https://www.unicode.org/reports/tr44/#White_Space /// /// # Examples /// @@ -281,7 +289,11 @@ impl [u8] { /// removed. /// /// 'Whitespace' refers to the definition used by - /// [`u8::is_ascii_whitespace`]. + /// [`u8::is_ascii_whitespace`]. Importantly, this definition excludes + /// the `\0x0B` byte even though it has the Unicode [`White_Space`] property + /// and is removed by [`str::trim`]. + /// + /// [`White_Space`]: https://www.unicode.org/reports/tr44/#White_Space /// /// # Examples /// diff --git a/library/core/src/str/mod.rs b/library/core/src/str/mod.rs index 1a4493de30a1f..73fb4c6b2c875 100644 --- a/library/core/src/str/mod.rs +++ b/library/core/src/str/mod.rs @@ -1202,6 +1202,9 @@ impl str { /// /// This uses the same definition as [`char::is_ascii_whitespace`]. /// To split by Unicode `Whitespace` instead, use [`split_whitespace`]. + /// Note that because of this difference in definition, even if `s.is_ascii()` + /// is `true`, `s.split_ascii_whitespace()` behavior will differ from `s.split_whitespace()` + /// if `s` contains U+000B VERTICAL TAB. /// /// [`split_whitespace`]: str::split_whitespace /// @@ -2896,9 +2899,12 @@ impl str { /// Returns a string slice with leading ASCII whitespace removed. /// /// 'Whitespace' refers to the definition used by - /// [`u8::is_ascii_whitespace`]. + /// [`u8::is_ascii_whitespace`]. Importantly, this definition excludes + /// the U+000B code point even though it has the Unicode [`White_Space`] property + /// and is removed by [`str::trim_start`]. /// /// [`u8::is_ascii_whitespace`]: u8::is_ascii_whitespace + /// [`White_Space`]: https://www.unicode.org/reports/tr44/#White_Space /// /// # Examples /// @@ -2921,9 +2927,12 @@ impl str { /// Returns a string slice with trailing ASCII whitespace removed. /// /// 'Whitespace' refers to the definition used by - /// [`u8::is_ascii_whitespace`]. + /// [`u8::is_ascii_whitespace`]. Importantly, this definition excludes + /// the U+000B code point even though it has the Unicode [`White_Space`] property + /// and is removed by [`str::trim_end`]. /// /// [`u8::is_ascii_whitespace`]: u8::is_ascii_whitespace + /// [`White_Space`]: https://www.unicode.org/reports/tr44/#White_Space /// /// # Examples /// @@ -2947,9 +2956,12 @@ impl str { /// removed. /// /// 'Whitespace' refers to the definition used by - /// [`u8::is_ascii_whitespace`]. + /// [`u8::is_ascii_whitespace`]. Importantly, this definition excludes + /// the U+000B code point even though it has the Unicode [`White_Space`] property + /// and is removed by [`str::trim`]. /// /// [`u8::is_ascii_whitespace`]: u8::is_ascii_whitespace + /// [`White_Space`]: https://www.unicode.org/reports/tr44/#White_Space /// /// # Examples /// diff --git a/library/core/src/tuple.rs b/library/core/src/tuple.rs index 58f81372aff75..187e201c3cea6 100644 --- a/library/core/src/tuple.rs +++ b/library/core/src/tuple.rs @@ -47,8 +47,7 @@ macro_rules! tuple_impls { maybe_tuple_doc! { $($T)+ @ - #[unstable(feature = "adt_const_params", issue = "95174")] - #[unstable_feature_bound(unsized_const_params)] + #[unstable(feature = "min_adt_const_params", issue = "154042")] impl<$($T: ConstParamTy_),+> ConstParamTy_ for ($($T,)+) {} } diff --git a/library/std/src/io/buffered/bufreader/buffer.rs b/library/std/src/io/buffered/bufreader/buffer.rs index 6982000c4a021..314f39225e659 100644 --- a/library/std/src/io/buffered/bufreader/buffer.rs +++ b/library/std/src/io/buffered/bufreader/buffer.rs @@ -21,11 +21,11 @@ pub struct Buffer { // Each call to `fill_buf` sets `filled` to indicate how many bytes at the start of `buf` are // initialized with bytes from a read. filled: usize, - // This is the max number of bytes returned across all `fill_buf` calls. We track this so that we - // can accurately tell `read_buf` how many bytes of buf are initialized, to bypass as much of its - // defensive initialization as possible. Note that while this often the same as `filled`, it - // doesn't need to be. Calls to `fill_buf` are not required to actually fill the buffer, and - // omitting this is a huge perf regression for `Read` impls that do not. + // Whether `buf` has been fully initialized. We track this so that we can accurately tell + // `read_buf` how many bytes of buf are initialized, to bypass as much of its defensive + // initialization as possible. Note that while this often the same as `filled`, it doesn't need + // to be. Calls to `fill_buf` are not required to actually fill the buffer, and omitting this + // is a huge perf regression for `Read` impls that do not. initialized: bool, } @@ -112,6 +112,9 @@ impl Buffer { let mut buf = BorrowedBuf::from(&mut self.buf[self.filled..]); if self.initialized { + // SAFETY: `self.initialized` is only set after `self.buf` was + // fully initialized, and once `self.buf` is fully initialized + // no part will become uninitialized. unsafe { buf.set_init() }; } @@ -138,9 +141,11 @@ impl Buffer { debug_assert!(self.pos == self.filled); let mut buf = BorrowedBuf::from(&mut *self.buf); - // SAFETY: `self.filled` bytes will always have been initialized. if self.initialized { + // SAFETY: `self.initialized` is only set after `self.buf` was + // fully initialized, and once `self.buf` is fully initialized + // no part will become uninitialized. unsafe { buf.set_init() }; } diff --git a/library/std/src/io/mod.rs b/library/std/src/io/mod.rs index e449545ce17a1..1166ba8baf430 100644 --- a/library/std/src/io/mod.rs +++ b/library/std/src/io/mod.rs @@ -3087,8 +3087,9 @@ impl Read for Take { let mut sliced_buf: BorrowedBuf<'_> = ibuf.into(); - // SAFETY: extra_init bytes of ibuf are known to be initialized if is_init { + // SAFETY: `sliced_buf` is a subslice of `buf`, so if `buf` was initialized then + // `sliced_buf` is. unsafe { sliced_buf.set_init() }; } diff --git a/library/std/src/process.rs b/library/std/src/process.rs index 321b68b3225ad..02fe515ac32c4 100644 --- a/library/std/src/process.rs +++ b/library/std/src/process.rs @@ -617,21 +617,50 @@ impl Command { /// Builder methods are provided to change these defaults and /// otherwise configure the process. /// - /// If `program` is not an absolute path, the `PATH` will be searched in - /// an OS-defined way. - /// - /// The search path to be used may be controlled by setting the - /// `PATH` environment variable on the Command, - /// but this has some implementation limitations on Windows - /// (see issue #37519). + /// If `program` is not an absolute path, the `PATH` environment variable + /// will be searched in an OS-defined way. /// /// # Platform-specific behavior /// - /// Note on Windows: For executable files with the .exe extension, - /// it can be omitted when specifying the program for this Command. - /// However, if the file has a different extension, - /// a filename including the extension needs to be provided, - /// otherwise the file won't be found. + /// The details below describe the current behavior, but these details + /// may change in future versions of Rust. + /// + /// On Unix, the `PATH` searched comes from the child's environment: + /// + /// - If the environment is unmodified, the child inherits the parent's + /// `PATH` and that is what is searched. + /// - If `PATH` is explicitly set via [`env`], that new value is searched. + /// - If [`env_clear`] or [`env_remove`] removes `PATH` without a + /// replacement, `execvp` falls back to an OS-defined default (typically + /// `/bin:/usr/bin`), **not** the parent's `PATH`. This may fail to find + /// programs that rely on the parent's `PATH`. + /// + /// To avoid surprises, use an absolute path or explicitly set `PATH` on + /// the `Command` when modifying the child's environment. + /// + /// On Windows, Rust resolves the executable path before spawning, rather + /// than passing the name to `CreateProcessW` for resolution. When + /// `program` is not an absolute path, the following locations are searched + /// in order: + /// + /// 1. The child's `PATH`, if explicitly set via [`env`]. + /// 2. The directory of the current executable. + /// 3. The system directory (`GetSystemDirectoryW`). + /// 4. The Windows directory (`GetWindowsDirectoryW`). + /// 5. The parent process's `PATH`. + /// + /// Note: when `PATH` is cleared via [`env_clear`] or [`env_remove`] on + /// Windows, step 1 is skipped but the parent process's `PATH` is still + /// searched at step 5, unlike on Unix. + /// + /// For executable files, the `.exe` extension may be omitted. Files with + /// other extensions must include the extension, otherwise they will not be + /// found. Note that this behavior has some known limitations + /// (see issue #37519). + /// + /// [`env`]: Self::env + /// [`env_remove`]: Self::env_remove + /// [`env_clear`]: Self::env_clear /// /// # Examples /// diff --git a/src/librustdoc/clean/cfg.rs b/src/librustdoc/clean/cfg.rs index d3422a93075b8..631a3b47b5574 100644 --- a/src/librustdoc/clean/cfg.rs +++ b/src/librustdoc/clean/cfg.rs @@ -552,15 +552,15 @@ fn human_readable_target_arch(os: Symbol) -> Option<&'static str> { Some(match arch { // tidy-alphabetical-start AArch64 => "AArch64", - AmdGpu => "AMG GPU", + AmdGpu => "AMD GPU", Arm => "ARM", Arm64EC => "ARM64EC", Avr => "AVR", Bpf => "BPF", CSky => "C-SKY", Hexagon => "Hexagon", - LoongArch32 => "LoongArch64", - LoongArch64 => "LoongArch32", + LoongArch32 => "LoongArch32", + LoongArch64 => "LoongArch64", M68k => "Motorola 680x0", Mips => "MIPS", Mips32r6 => "MIPS release 6", diff --git a/tests/rustdoc-html/doc-cfg/all-targets.rs b/tests/rustdoc-html/doc-cfg/all-targets.rs index 4db41e1f83448..048d0d4c73d2b 100644 --- a/tests/rustdoc-html/doc-cfg/all-targets.rs +++ b/tests/rustdoc-html/doc-cfg/all-targets.rs @@ -32,8 +32,8 @@ pub fn foo() {} //@ has all_targets/fn.bar.html \ // '//*[@id="main-content"]/*[@class="item-info"]/*[@class="stab portability"]' \ -// 'Available on AArch64 or AMG GPU or ARM or ARM64EC or AVR or BPF or C-SKY or \ -// Hexagon or LoongArch64 or LoongArch32 or Motorola 680x0 or MIPS or MIPS release \ +// 'Available on AArch64 or AMD GPU or ARM or ARM64EC or AVR or BPF or C-SKY or \ +// Hexagon or LoongArch32 or LoongArch64 or Motorola 680x0 or MIPS or MIPS release \ // 6 or MIPS-64 or MIPS-64 release 6 or MSP430 or NVidia GPU or PowerPC or \ // PowerPC64 or RISC-V RV32 or RISC-V RV64 or s390x or SPARC or SPARC-64 or SPIR-V \ // or WebAssembly or WebAssembly or x86 or x86-64 or Xtensa or \ diff --git a/tests/ui/const-generics/adt_const_params/suggest_feature_only_when_possible.rs b/tests/ui/const-generics/adt_const_params/suggest_feature_only_when_possible.rs index 33988bc067850..f9898e26a8bbb 100644 --- a/tests/ui/const-generics/adt_const_params/suggest_feature_only_when_possible.rs +++ b/tests/ui/const-generics/adt_const_params/suggest_feature_only_when_possible.rs @@ -5,9 +5,9 @@ // Can never be used as const generics. fn uwu_0() {} //~^ ERROR: forbidden as the type of a const generic -//~| HELP: add `#![feature(adt_const_params)]` -//~| HELP: add `#![feature(adt_const_params)]` -//~| HELP: add `#![feature(adt_const_params)]` +//~| HELP: add `#![feature(min_adt_const_params)]` +//~| HELP: add `#![feature(min_adt_const_params)]` +//~| HELP: add `#![feature(min_adt_const_params)]` //~| HELP: add `#![feature(unsized_const_params)]` //~| HELP: add `#![feature(unsized_const_params)]` diff --git a/tests/ui/const-generics/adt_const_params/suggest_feature_only_when_possible.stderr b/tests/ui/const-generics/adt_const_params/suggest_feature_only_when_possible.stderr index 8c54aef36cac0..2f9f2af38217c 100644 --- a/tests/ui/const-generics/adt_const_params/suggest_feature_only_when_possible.stderr +++ b/tests/ui/const-generics/adt_const_params/suggest_feature_only_when_possible.stderr @@ -13,9 +13,9 @@ LL | fn owo_0() {} | ^^^^^^^^^^^^ | = note: the only supported types are integers, `bool`, and `char` -help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types | -LL + #![feature(adt_const_params)] +LL + #![feature(min_adt_const_params)] | help: add `#![feature(unsized_const_params)]` to the crate attributes to enable references to implement the `ConstParamTy` trait | @@ -29,9 +29,9 @@ LL | fn meow_0() {} | ^^^^ | = note: the only supported types are integers, `bool`, and `char` -help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types | -LL + #![feature(adt_const_params)] +LL + #![feature(min_adt_const_params)] | error: `&'static Meow` is forbidden as the type of a const generic parameter @@ -41,9 +41,9 @@ LL | fn meow_1() {} | ^^^^^^^^^^^^^ | = note: the only supported types are integers, `bool`, and `char` -help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types | -LL + #![feature(adt_const_params)] +LL + #![feature(min_adt_const_params)] | help: add `#![feature(unsized_const_params)]` to the crate attributes to enable references to implement the `ConstParamTy` trait | diff --git a/tests/ui/const-generics/adt_const_params/tuple-wihtout-unsized_const_params-gate.rs b/tests/ui/const-generics/adt_const_params/tuple-wihtout-unsized_const_params-gate.rs new file mode 100644 index 0000000000000..9fd584b109744 --- /dev/null +++ b/tests/ui/const-generics/adt_const_params/tuple-wihtout-unsized_const_params-gate.rs @@ -0,0 +1,14 @@ +//! Ensure we allow tuples behind `min_adt_const_params` +//@check-pass +#![feature(min_adt_const_params)] +#![allow(dead_code)] + +use std::marker::ConstParamTy; + +fn foo() {} +fn foo2() {} + +#[derive(PartialEq, Eq, ConstParamTy)] +struct Something(i8, i16, i32); + +fn main() {} diff --git a/tests/ui/const-generics/const-param-type-depends-on-const-param.min.stderr b/tests/ui/const-generics/const-param-type-depends-on-const-param.min.stderr index 44fcf9a13b12d..3a5419588cae9 100644 --- a/tests/ui/const-generics/const-param-type-depends-on-const-param.min.stderr +++ b/tests/ui/const-generics/const-param-type-depends-on-const-param.min.stderr @@ -17,9 +17,9 @@ LL | pub struct Dependent([(); N]); | ^^^^^^^ | = note: the only supported types are integers, `bool`, and `char` -help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types | -LL + #![feature(adt_const_params)] +LL + #![feature(min_adt_const_params)] | error: `[u8; N]` is forbidden as the type of a const generic parameter @@ -29,9 +29,9 @@ LL | pub struct SelfDependent; | ^^^^^^^ | = note: the only supported types are integers, `bool`, and `char` -help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types | -LL + #![feature(adt_const_params)] +LL + #![feature(min_adt_const_params)] | error: aborting due to 4 previous errors diff --git a/tests/ui/const-generics/generic_const_exprs/array-size-in-generic-struct-param.min.stderr b/tests/ui/const-generics/generic_const_exprs/array-size-in-generic-struct-param.min.stderr index 1f93c4f89098d..3b65a1b82fdf4 100644 --- a/tests/ui/const-generics/generic_const_exprs/array-size-in-generic-struct-param.min.stderr +++ b/tests/ui/const-generics/generic_const_exprs/array-size-in-generic-struct-param.min.stderr @@ -23,9 +23,9 @@ LL | struct B { | ^^^^^^ | = note: the only supported types are integers, `bool`, and `char` -help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types | -LL + #![feature(adt_const_params)] +LL + #![feature(min_adt_const_params)] | error: aborting due to 3 previous errors diff --git a/tests/ui/const-generics/generic_const_exprs/error_in_ty.stderr b/tests/ui/const-generics/generic_const_exprs/error_in_ty.stderr index e10ea5a44b263..6c017c8cc6ba9 100644 --- a/tests/ui/const-generics/generic_const_exprs/error_in_ty.stderr +++ b/tests/ui/const-generics/generic_const_exprs/error_in_ty.stderr @@ -19,9 +19,9 @@ LL | pub struct A {} | ^^^^^^^^^^ | = note: the only supported types are integers, `bool`, and `char` -help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types | -LL + #![feature(adt_const_params)] +LL + #![feature(min_adt_const_params)] | error[E0308]: mismatched types diff --git a/tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.stderr b/tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.stderr index 4fab35591ef43..022074181cecd 100644 --- a/tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.stderr +++ b/tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.stderr @@ -82,9 +82,9 @@ LL | pub struct v17 { | ^^^ | = note: the only supported types are integers, `bool`, and `char` -help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types | -LL + #![feature(adt_const_params)] +LL + #![feature(min_adt_const_params)] | error[E0425]: cannot find function `v6` in this scope diff --git a/tests/ui/const-generics/intrinsics-type_name-as-const-argument.min.stderr b/tests/ui/const-generics/intrinsics-type_name-as-const-argument.min.stderr index 506f7d05fa63a..324738e44629e 100644 --- a/tests/ui/const-generics/intrinsics-type_name-as-const-argument.min.stderr +++ b/tests/ui/const-generics/intrinsics-type_name-as-const-argument.min.stderr @@ -14,9 +14,9 @@ LL | trait Trait {} | ^^^^^^^^^^^^ | = note: the only supported types are integers, `bool`, and `char` -help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types | -LL + #![feature(adt_const_params)] +LL + #![feature(min_adt_const_params)] | help: add `#![feature(unsized_const_params)]` to the crate attributes to enable references to implement the `ConstParamTy` trait | diff --git a/tests/ui/const-generics/issues/issue-62878.min.stderr b/tests/ui/const-generics/issues/issue-62878.min.stderr index d7ca0e1e2db59..754e76269bdb8 100644 --- a/tests/ui/const-generics/issues/issue-62878.min.stderr +++ b/tests/ui/const-generics/issues/issue-62878.min.stderr @@ -11,9 +11,9 @@ LL | fn foo() {} | ^^^^^^^ | = note: the only supported types are integers, `bool`, and `char` -help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types | -LL + #![feature(adt_const_params)] +LL + #![feature(min_adt_const_params)] | error: aborting due to 2 previous errors diff --git a/tests/ui/const-generics/issues/issue-63322-forbid-dyn.min.stderr b/tests/ui/const-generics/issues/issue-63322-forbid-dyn.min.stderr index f14485a4976e7..aee5bb9653317 100644 --- a/tests/ui/const-generics/issues/issue-63322-forbid-dyn.min.stderr +++ b/tests/ui/const-generics/issues/issue-63322-forbid-dyn.min.stderr @@ -5,9 +5,9 @@ LL | fn test() { | ^^^^^^^^^^^^^^ | = note: the only supported types are integers, `bool`, and `char` -help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types | -LL + #![feature(adt_const_params)] +LL + #![feature(min_adt_const_params)] | help: add `#![feature(unsized_const_params)]` to the crate attributes to enable references to implement the `ConstParamTy` trait | diff --git a/tests/ui/const-generics/issues/issue-68366.full.stderr b/tests/ui/const-generics/issues/issue-68366.full.stderr index caed3c1bf3f7d..02c34b8256d6d 100644 --- a/tests/ui/const-generics/issues/issue-68366.full.stderr +++ b/tests/ui/const-generics/issues/issue-68366.full.stderr @@ -5,9 +5,9 @@ LL | struct Collatz>; | ^^^^^^^^^^^^^ | = note: the only supported types are integers, `bool`, and `char` -help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types | -LL + #![feature(adt_const_params)] +LL + #![feature(min_adt_const_params)] | error[E0207]: the const parameter `N` is not constrained by the impl trait, self type, or predicates diff --git a/tests/ui/const-generics/issues/issue-68366.min.stderr b/tests/ui/const-generics/issues/issue-68366.min.stderr index 4d721e958cbc7..4b544c49af8c1 100644 --- a/tests/ui/const-generics/issues/issue-68366.min.stderr +++ b/tests/ui/const-generics/issues/issue-68366.min.stderr @@ -14,9 +14,9 @@ LL | struct Collatz>; | ^^^^^^^^^^^^^ | = note: the only supported types are integers, `bool`, and `char` -help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types | -LL + #![feature(adt_const_params)] +LL + #![feature(min_adt_const_params)] | error[E0207]: the const parameter `N` is not constrained by the impl trait, self type, or predicates diff --git a/tests/ui/const-generics/issues/issue-68615-adt.min.stderr b/tests/ui/const-generics/issues/issue-68615-adt.min.stderr index d25b34435ede8..ace0cf2411955 100644 --- a/tests/ui/const-generics/issues/issue-68615-adt.min.stderr +++ b/tests/ui/const-generics/issues/issue-68615-adt.min.stderr @@ -5,9 +5,9 @@ LL | struct Const {} | ^^^^^^^^^^ | = note: the only supported types are integers, `bool`, and `char` -help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types | -LL + #![feature(adt_const_params)] +LL + #![feature(min_adt_const_params)] | error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/issues/issue-68615-array.min.stderr b/tests/ui/const-generics/issues/issue-68615-array.min.stderr index 60cbc9b4eab14..a0139845eaa15 100644 --- a/tests/ui/const-generics/issues/issue-68615-array.min.stderr +++ b/tests/ui/const-generics/issues/issue-68615-array.min.stderr @@ -5,9 +5,9 @@ LL | struct Foo {} | ^^^^^^^^^^ | = note: the only supported types are integers, `bool`, and `char` -help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types | -LL + #![feature(adt_const_params)] +LL + #![feature(min_adt_const_params)] | error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/issues/issue-71169.min.stderr b/tests/ui/const-generics/issues/issue-71169.min.stderr index c04a710eee9c7..13adc4b627a0f 100644 --- a/tests/ui/const-generics/issues/issue-71169.min.stderr +++ b/tests/ui/const-generics/issues/issue-71169.min.stderr @@ -11,9 +11,9 @@ LL | fn foo() {} | ^^^^^^^^^ | = note: the only supported types are integers, `bool`, and `char` -help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types | -LL + #![feature(adt_const_params)] +LL + #![feature(min_adt_const_params)] | error: aborting due to 2 previous errors diff --git a/tests/ui/const-generics/issues/issue-73491.min.stderr b/tests/ui/const-generics/issues/issue-73491.min.stderr index 2cdbeea2fd6e5..292836a370a5e 100644 --- a/tests/ui/const-generics/issues/issue-73491.min.stderr +++ b/tests/ui/const-generics/issues/issue-73491.min.stderr @@ -5,9 +5,9 @@ LL | fn hoge() {} | ^^^^^^^^^^ | = note: the only supported types are integers, `bool`, and `char` -help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types | -LL + #![feature(adt_const_params)] +LL + #![feature(min_adt_const_params)] | error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/issues/issue-73727-static-reference-array-const-param.min.stderr b/tests/ui/const-generics/issues/issue-73727-static-reference-array-const-param.min.stderr index 256636c0628cd..21328eb16f2a2 100644 --- a/tests/ui/const-generics/issues/issue-73727-static-reference-array-const-param.min.stderr +++ b/tests/ui/const-generics/issues/issue-73727-static-reference-array-const-param.min.stderr @@ -5,9 +5,9 @@ LL | fn a() {} | ^^^^^^^^^^^^^^ | = note: the only supported types are integers, `bool`, and `char` -help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types | -LL + #![feature(adt_const_params)] +LL + #![feature(min_adt_const_params)] | help: add `#![feature(unsized_const_params)]` to the crate attributes to enable references to implement the `ConstParamTy` trait | diff --git a/tests/ui/const-generics/issues/issue-74101.min.stderr b/tests/ui/const-generics/issues/issue-74101.min.stderr index 65fb51d7df99f..f8195c2ba9523 100644 --- a/tests/ui/const-generics/issues/issue-74101.min.stderr +++ b/tests/ui/const-generics/issues/issue-74101.min.stderr @@ -5,9 +5,9 @@ LL | fn test() {} | ^^^^^^^^^^^ | = note: the only supported types are integers, `bool`, and `char` -help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types | -LL + #![feature(adt_const_params)] +LL + #![feature(min_adt_const_params)] | error: `[u8; 1 + 2]` is forbidden as the type of a const generic parameter @@ -17,9 +17,9 @@ LL | struct Foo; | ^^^^^^^^^^^ | = note: the only supported types are integers, `bool`, and `char` -help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types | -LL + #![feature(adt_const_params)] +LL + #![feature(min_adt_const_params)] | error: aborting due to 2 previous errors diff --git a/tests/ui/const-generics/issues/issue-74255.min.stderr b/tests/ui/const-generics/issues/issue-74255.min.stderr index 3b30227a9a673..945f34c47d01f 100644 --- a/tests/ui/const-generics/issues/issue-74255.min.stderr +++ b/tests/ui/const-generics/issues/issue-74255.min.stderr @@ -5,9 +5,9 @@ LL | fn ice_struct_fn() {} | ^^^^^^^ | = note: the only supported types are integers, `bool`, and `char` -help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types | -LL + #![feature(adt_const_params)] +LL + #![feature(min_adt_const_params)] | error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/issues/issue-74950.min.stderr b/tests/ui/const-generics/issues/issue-74950.min.stderr index 22537af786b14..b5a8db4936b3e 100644 --- a/tests/ui/const-generics/issues/issue-74950.min.stderr +++ b/tests/ui/const-generics/issues/issue-74950.min.stderr @@ -5,9 +5,9 @@ LL | struct Outer; | ^^^^^ | = note: the only supported types are integers, `bool`, and `char` -help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types | -LL + #![feature(adt_const_params)] +LL + #![feature(min_adt_const_params)] | error: `Inner` is forbidden as the type of a const generic parameter @@ -18,9 +18,9 @@ LL | struct Outer; | = note: the only supported types are integers, `bool`, and `char` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types | -LL + #![feature(adt_const_params)] +LL + #![feature(min_adt_const_params)] | error: `Inner` is forbidden as the type of a const generic parameter @@ -31,9 +31,9 @@ LL | struct Outer; | = note: the only supported types are integers, `bool`, and `char` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types | -LL + #![feature(adt_const_params)] +LL + #![feature(min_adt_const_params)] | error: `Inner` is forbidden as the type of a const generic parameter @@ -44,9 +44,9 @@ LL | struct Outer; | = note: the only supported types are integers, `bool`, and `char` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types | -LL + #![feature(adt_const_params)] +LL + #![feature(min_adt_const_params)] | error: aborting due to 4 previous errors diff --git a/tests/ui/const-generics/issues/issue-75047.min.stderr b/tests/ui/const-generics/issues/issue-75047.min.stderr index d78ab6718201a..2b17dbf9003d3 100644 --- a/tests/ui/const-generics/issues/issue-75047.min.stderr +++ b/tests/ui/const-generics/issues/issue-75047.min.stderr @@ -5,9 +5,9 @@ LL | struct Foo::value()]>; | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: the only supported types are integers, `bool`, and `char` -help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types | -LL + #![feature(adt_const_params)] +LL + #![feature(min_adt_const_params)] | error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/min_const_generics/complex-types.stderr b/tests/ui/const-generics/min_const_generics/complex-types.stderr index bca68982c399d..3233da6382381 100644 --- a/tests/ui/const-generics/min_const_generics/complex-types.stderr +++ b/tests/ui/const-generics/min_const_generics/complex-types.stderr @@ -5,9 +5,9 @@ LL | struct Foo; | ^^^^^^^ | = note: the only supported types are integers, `bool`, and `char` -help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types | -LL + #![feature(adt_const_params)] +LL + #![feature(min_adt_const_params)] | error: `()` is forbidden as the type of a const generic parameter @@ -17,9 +17,9 @@ LL | struct Bar; | ^^ | = note: the only supported types are integers, `bool`, and `char` -help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types | -LL + #![feature(adt_const_params)] +LL + #![feature(min_adt_const_params)] | error: `No` is forbidden as the type of a const generic parameter @@ -29,9 +29,9 @@ LL | struct Fez; | ^^ | = note: the only supported types are integers, `bool`, and `char` -help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types | -LL + #![feature(adt_const_params)] +LL + #![feature(min_adt_const_params)] | error: `&'static u8` is forbidden as the type of a const generic parameter @@ -41,9 +41,9 @@ LL | struct Faz; | ^^^^^^^^^^^ | = note: the only supported types are integers, `bool`, and `char` -help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types | -LL + #![feature(adt_const_params)] +LL + #![feature(min_adt_const_params)] | help: add `#![feature(unsized_const_params)]` to the crate attributes to enable references to implement the `ConstParamTy` trait | @@ -65,9 +65,9 @@ LL | enum Goo { A, B } | ^^ | = note: the only supported types are integers, `bool`, and `char` -help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types | -LL + #![feature(adt_const_params)] +LL + #![feature(min_adt_const_params)] | error: `()` is forbidden as the type of a const generic parameter @@ -77,9 +77,9 @@ LL | union Boo { a: () } | ^^ | = note: the only supported types are integers, `bool`, and `char` -help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types | -LL + #![feature(adt_const_params)] +LL + #![feature(min_adt_const_params)] | error: aborting due to 7 previous errors diff --git a/tests/ui/const-generics/nested-type.min.stderr b/tests/ui/const-generics/nested-type.min.stderr index 8282acd4ea7b1..ff15612140902 100644 --- a/tests/ui/const-generics/nested-type.min.stderr +++ b/tests/ui/const-generics/nested-type.min.stderr @@ -29,9 +29,9 @@ LL | | }]>; | |__^ | = note: the only supported types are integers, `bool`, and `char` -help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types | -LL + #![feature(adt_const_params)] +LL + #![feature(min_adt_const_params)] | error: aborting due to 2 previous errors diff --git a/tests/ui/const-generics/slice-const-param-mismatch.min.stderr b/tests/ui/const-generics/slice-const-param-mismatch.min.stderr index 594f8b9b79a33..8e167d369756e 100644 --- a/tests/ui/const-generics/slice-const-param-mismatch.min.stderr +++ b/tests/ui/const-generics/slice-const-param-mismatch.min.stderr @@ -5,9 +5,9 @@ LL | struct ConstString; | ^^^^^^^^^^^^ | = note: the only supported types are integers, `bool`, and `char` -help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types | -LL + #![feature(adt_const_params)] +LL + #![feature(min_adt_const_params)] | help: add `#![feature(unsized_const_params)]` to the crate attributes to enable references to implement the `ConstParamTy` trait | @@ -21,9 +21,9 @@ LL | struct ConstBytes; | ^^^^^^^^^^^^^ | = note: the only supported types are integers, `bool`, and `char` -help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types | -LL + #![feature(adt_const_params)] +LL + #![feature(min_adt_const_params)] | help: add `#![feature(unsized_const_params)]` to the crate attributes to enable references to implement the `ConstParamTy` trait | diff --git a/tests/ui/const-generics/std/const-generics-range.min.stderr b/tests/ui/const-generics/std/const-generics-range.min.stderr index 43a57c880d5d8..f302085254c64 100644 --- a/tests/ui/const-generics/std/const-generics-range.min.stderr +++ b/tests/ui/const-generics/std/const-generics-range.min.stderr @@ -5,9 +5,9 @@ LL | struct _Range>; | ^^^^^^^^^^^^^^^^^^^^^^ | = note: the only supported types are integers, `bool`, and `char` -help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types | -LL + #![feature(adt_const_params)] +LL + #![feature(min_adt_const_params)] | error: `std::ops::RangeFrom` is forbidden as the type of a const generic parameter @@ -17,9 +17,9 @@ LL | struct _RangeFrom>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: the only supported types are integers, `bool`, and `char` -help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types | -LL + #![feature(adt_const_params)] +LL + #![feature(min_adt_const_params)] | error: `RangeFull` is forbidden as the type of a const generic parameter @@ -29,9 +29,9 @@ LL | struct _RangeFull; | ^^^^^^^^^^^^^^^^^^^ | = note: the only supported types are integers, `bool`, and `char` -help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types | -LL + #![feature(adt_const_params)] +LL + #![feature(min_adt_const_params)] | error: `std::ops::RangeInclusive` is forbidden as the type of a const generic parameter @@ -41,9 +41,9 @@ LL | struct _RangeInclusive>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: the only supported types are integers, `bool`, and `char` -help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types | -LL + #![feature(adt_const_params)] +LL + #![feature(min_adt_const_params)] | error: `RangeTo` is forbidden as the type of a const generic parameter @@ -53,9 +53,9 @@ LL | struct _RangeTo>; | ^^^^^^^^^^^^^^^^^^^^^^^^ | = note: the only supported types are integers, `bool`, and `char` -help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types | -LL + #![feature(adt_const_params)] +LL + #![feature(min_adt_const_params)] | error: `std::ops::RangeToInclusive` is forbidden as the type of a const generic parameter @@ -65,9 +65,9 @@ LL | struct _RangeToInclusive>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: the only supported types are integers, `bool`, and `char` -help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types | -LL + #![feature(adt_const_params)] +LL + #![feature(min_adt_const_params)] | error: aborting due to 6 previous errors diff --git a/tests/ui/const-generics/transmute-const-param-static-reference.min.stderr b/tests/ui/const-generics/transmute-const-param-static-reference.min.stderr index 911afa3391d16..b8876b33295c3 100644 --- a/tests/ui/const-generics/transmute-const-param-static-reference.min.stderr +++ b/tests/ui/const-generics/transmute-const-param-static-reference.min.stderr @@ -5,9 +5,9 @@ LL | struct Const; | ^^^^^^^^^^^ | = note: the only supported types are integers, `bool`, and `char` -help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types | -LL + #![feature(adt_const_params)] +LL + #![feature(min_adt_const_params)] | help: add `#![feature(unsized_const_params)]` to the crate attributes to enable references to implement the `ConstParamTy` trait | diff --git a/tests/ui/const-generics/type-dependent/issue-71348.min.stderr b/tests/ui/const-generics/type-dependent/issue-71348.min.stderr index c491469bcbd2d..1555049b877f0 100644 --- a/tests/ui/const-generics/type-dependent/issue-71348.min.stderr +++ b/tests/ui/const-generics/type-dependent/issue-71348.min.stderr @@ -5,9 +5,9 @@ LL | trait Get<'a, const N: &'static str> { | ^^^^^^^^^^^^ | = note: the only supported types are integers, `bool`, and `char` -help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types | -LL + #![feature(adt_const_params)] +LL + #![feature(min_adt_const_params)] | help: add `#![feature(unsized_const_params)]` to the crate attributes to enable references to implement the `ConstParamTy` trait | @@ -21,9 +21,9 @@ LL | fn ask<'a, const N: &'static str>(&'a self) -> &'a >::Ta | ^^^^^^^^^^^^ | = note: the only supported types are integers, `bool`, and `char` -help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types | -LL + #![feature(adt_const_params)] +LL + #![feature(min_adt_const_params)] | help: add `#![feature(unsized_const_params)]` to the crate attributes to enable references to implement the `ConstParamTy` trait | diff --git a/tests/ui/explicit-tail-calls/support/bystack.rs b/tests/ui/explicit-tail-calls/support/bystack.rs index ad1e0827f9f05..0f10fe3d172ec 100644 --- a/tests/ui/explicit-tail-calls/support/bystack.rs +++ b/tests/ui/explicit-tail-calls/support/bystack.rs @@ -36,9 +36,11 @@ //@ revisions: loongarch32 //@[loongarch32] compile-flags: --target loongarch32-unknown-none //@[loongarch32] needs-llvm-components: loongarch +//@[loongarch32] ignore-llvm-version: 23 //@ revisions: loongarch64 //@[loongarch64] compile-flags: --target loongarch64-unknown-linux-gnu //@[loongarch64] needs-llvm-components: loongarch +//@[loongarch64] ignore-llvm-version: 23 //@ revisions: bpf //@[bpf] compile-flags: --target bpfeb-unknown-none //@[bpf] needs-llvm-components: bpf diff --git a/tests/ui/explicit-tail-calls/support/byval.rs b/tests/ui/explicit-tail-calls/support/byval.rs index 965c63c8688a8..be11741fd0165 100644 --- a/tests/ui/explicit-tail-calls/support/byval.rs +++ b/tests/ui/explicit-tail-calls/support/byval.rs @@ -36,9 +36,11 @@ //@ revisions: loongarch32 //@[loongarch32] compile-flags: --target loongarch32-unknown-none //@[loongarch32] needs-llvm-components: loongarch +//@[loongarch32] ignore-llvm-version: 23 //@ revisions: loongarch64 //@[loongarch64] compile-flags: --target loongarch64-unknown-linux-gnu //@[loongarch64] needs-llvm-components: loongarch +//@[loongarch64] ignore-llvm-version: 23 //@ revisions: bpf //@[bpf] compile-flags: --target bpfeb-unknown-none //@[bpf] needs-llvm-components: bpf diff --git a/tests/ui/feature-gates/feature-gate-adt_const_params.stderr b/tests/ui/feature-gates/feature-gate-adt_const_params.stderr index 7ea91a8f4c2bf..607e7869c7892 100644 --- a/tests/ui/feature-gates/feature-gate-adt_const_params.stderr +++ b/tests/ui/feature-gates/feature-gate-adt_const_params.stderr @@ -5,9 +5,9 @@ LL | struct Foo; | ^^^ | = note: the only supported types are integers, `bool`, and `char` -help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types | -LL + #![feature(adt_const_params)] +LL + #![feature(min_adt_const_params)] | error: aborting due to 1 previous error diff --git a/tests/ui/feature-gates/feature-gate-generic-const-parameter-types.normal.stderr b/tests/ui/feature-gates/feature-gate-generic-const-parameter-types.normal.stderr index 1377f845d1640..48b3c43c30a0e 100644 --- a/tests/ui/feature-gates/feature-gate-generic-const-parameter-types.normal.stderr +++ b/tests/ui/feature-gates/feature-gate-generic-const-parameter-types.normal.stderr @@ -11,9 +11,9 @@ LL | struct MyADT; | ^^^^^^^^^ | = note: the only supported types are integers, `bool`, and `char` -help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types | -LL + #![feature(adt_const_params)] +LL + #![feature(min_adt_const_params)] | error: aborting due to 2 previous errors diff --git a/tests/ui/feature-gates/feature-gate-unsized-const-params.rs b/tests/ui/feature-gates/feature-gate-unsized-const-params.rs index d088d382377cf..c38aa3ea4f75a 100644 --- a/tests/ui/feature-gates/feature-gate-unsized-const-params.rs +++ b/tests/ui/feature-gates/feature-gate-unsized-const-params.rs @@ -1,6 +1,6 @@ struct Foo; //~^ ERROR: `[u8]` is forbidden as the type of a const generic parameter -//~| HELP: add `#![feature(adt_const_params)]` to the crate +//~| HELP: add `#![feature(min_adt_const_params)]` to the crate //~| HELP: add `#![feature(unsized_const_params)]` to the crate fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-unsized-const-params.stderr b/tests/ui/feature-gates/feature-gate-unsized-const-params.stderr index 85ca2f59cb639..90906058dfe68 100644 --- a/tests/ui/feature-gates/feature-gate-unsized-const-params.stderr +++ b/tests/ui/feature-gates/feature-gate-unsized-const-params.stderr @@ -5,9 +5,9 @@ LL | struct Foo; | ^^^^ | = note: the only supported types are integers, `bool`, and `char` -help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types | -LL + #![feature(adt_const_params)] +LL + #![feature(min_adt_const_params)] | help: add `#![feature(unsized_const_params)]` to the crate attributes to enable references to implement the `ConstParamTy` trait | diff --git a/tests/ui/impl-trait/rpit/precise-capture-155151.current.stderr b/tests/ui/impl-trait/rpit/precise-capture-155151.current.stderr new file mode 100644 index 0000000000000..39efb77067e77 --- /dev/null +++ b/tests/ui/impl-trait/rpit/precise-capture-155151.current.stderr @@ -0,0 +1,12 @@ +error[E0381]: used binding `x` isn't initialized + --> $DIR/precise-capture-155151.rs:19:22 + | +LL | let Foo { x } = foo; + | - binding declared here but left uninitialized +... +LL | let _y = x; + | ^ `x` used here but it isn't initialized + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0381`. diff --git a/tests/ui/impl-trait/rpit/precise-capture-155151.rs b/tests/ui/impl-trait/rpit/precise-capture-155151.rs new file mode 100644 index 0000000000000..b01f1098c6c2d --- /dev/null +++ b/tests/ui/impl-trait/rpit/precise-capture-155151.rs @@ -0,0 +1,24 @@ +#![crate_type = "rlib"] +//@ revisions: current next +//@ edition: 2021 +//@[current] known-bug: #155151 +//@[current] check-fail +//@[next] compile-flags: -Znext-solver +//@[next] check-pass + +pub fn wut() -> impl Sized { + struct Foo { x: u32 } + + if false { + // `foo` has an opaque type, but this function knows that it's `Foo`. + let foo = wut(); + let _closure = move || { + let Foo { x } = foo; + // `x` should have been captured, but under old-solver the compiler + // thinks it's uninitialized here. + let _y = x; + }; + } + + Foo { x: 7 } +} diff --git a/tests/ui/lexer/unicode-pattern-white-space.rs b/tests/ui/lexer/unicode-pattern-white-space.rs new file mode 100644 index 0000000000000..7d72f604153bd --- /dev/null +++ b/tests/ui/lexer/unicode-pattern-white-space.rs @@ -0,0 +1,12 @@ +//@ run-pass +// Test that the Rust lexer accepts vertical tab (\x0B) as valid whitespace +// between tokens. Vertical tab is part of Unicode Pattern_White_Space, which +// the Rust language specification uses to define whitespace tokens. +// See: https://unicode.org/reports/tr31/#Pattern_White_Space +// +// The space between "let" and "_" below is a vertical tab character (\x0B), +// not a regular space. + +fn main() { + let _ = 1; +} diff --git a/tests/ui/methods/supertrait-shadowing/assoc-const.rs b/tests/ui/methods/supertrait-shadowing/assoc-const.rs index a542ce7d326d1..01d045b9fb74f 100644 --- a/tests/ui/methods/supertrait-shadowing/assoc-const.rs +++ b/tests/ui/methods/supertrait-shadowing/assoc-const.rs @@ -1,5 +1,4 @@ //@ run-pass -//@ check-run-results #![feature(supertrait_item_shadowing)] #![allow(dead_code)] @@ -19,5 +18,5 @@ impl B for T { } fn main() { - println!("{}", i32::CONST); + assert_eq!(i32::CONST, 2) } diff --git a/tests/ui/methods/supertrait-shadowing/assoc-const.run.stdout b/tests/ui/methods/supertrait-shadowing/assoc-const.run.stdout deleted file mode 100644 index 0cfbf08886fca..0000000000000 --- a/tests/ui/methods/supertrait-shadowing/assoc-const.run.stdout +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/tests/ui/methods/supertrait-shadowing/auxiliary/shadowed_stability.rs b/tests/ui/methods/supertrait-shadowing/auxiliary/shadowed_stability.rs new file mode 100644 index 0000000000000..6371b3225a881 --- /dev/null +++ b/tests/ui/methods/supertrait-shadowing/auxiliary/shadowed_stability.rs @@ -0,0 +1,22 @@ +#![feature(staged_api)] +#![stable(feature = "main", since = "1.0.0")] + +#[stable(feature = "main", since = "1.0.0")] +pub trait A { + #[stable(feature = "main", since = "1.0.0")] + fn hello(&self) -> &'static str { + "A" + } +} +#[stable(feature = "main", since = "1.0.0")] +impl A for T {} + +#[stable(feature = "main", since = "1.0.0")] +pub trait B: A { + #[unstable(feature = "downstream", issue = "none")] + fn hello(&self) -> &'static str { + "B" + } +} +#[stable(feature = "main", since = "1.0.0")] +impl B for T {} diff --git a/tests/ui/methods/supertrait-shadowing/common-ancestor-2.rs b/tests/ui/methods/supertrait-shadowing/common-ancestor-2.rs index 525844983f510..ce56c25df19ea 100644 --- a/tests/ui/methods/supertrait-shadowing/common-ancestor-2.rs +++ b/tests/ui/methods/supertrait-shadowing/common-ancestor-2.rs @@ -1,5 +1,4 @@ //@ run-pass -//@ check-run-results #![feature(supertrait_item_shadowing)] #![warn(resolving_to_items_shadowing_supertrait_items)] @@ -7,28 +6,28 @@ #![allow(dead_code)] trait A { - fn hello(&self) { - println!("A"); + fn hello(&self) -> &'static str { + "A" } } impl A for T {} trait B { - fn hello(&self) { - println!("B"); + fn hello(&self) -> &'static str { + "B" } } impl B for T {} trait C: A + B { - fn hello(&self) { + fn hello(&self) -> &'static str { //~^ WARN trait item `hello` from `C` shadows identically named item - println!("C"); + "C" } } impl C for T {} fn main() { - ().hello(); + assert_eq!(().hello(), "C"); //~^ WARN trait item `hello` from `C` shadows identically named item from supertrait } diff --git a/tests/ui/methods/supertrait-shadowing/common-ancestor-2.run.stdout b/tests/ui/methods/supertrait-shadowing/common-ancestor-2.run.stdout deleted file mode 100644 index 3cc58df837521..0000000000000 --- a/tests/ui/methods/supertrait-shadowing/common-ancestor-2.run.stdout +++ /dev/null @@ -1 +0,0 @@ -C diff --git a/tests/ui/methods/supertrait-shadowing/common-ancestor-2.stderr b/tests/ui/methods/supertrait-shadowing/common-ancestor-2.stderr index 392489c6734a1..b0f61b46b6911 100644 --- a/tests/ui/methods/supertrait-shadowing/common-ancestor-2.stderr +++ b/tests/ui/methods/supertrait-shadowing/common-ancestor-2.stderr @@ -1,44 +1,44 @@ warning: trait item `hello` from `C` shadows identically named item from supertrait - --> $DIR/common-ancestor-2.rs:24:5 + --> $DIR/common-ancestor-2.rs:23:5 | -LL | fn hello(&self) { - | ^^^^^^^^^^^^^^^ +LL | fn hello(&self) -> &'static str { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: items from several supertraits are shadowed: `B` and `A` - --> $DIR/common-ancestor-2.rs:10:5 + --> $DIR/common-ancestor-2.rs:9:5 | -LL | fn hello(&self) { - | ^^^^^^^^^^^^^^^ +LL | fn hello(&self) -> &'static str { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... -LL | fn hello(&self) { - | ^^^^^^^^^^^^^^^ +LL | fn hello(&self) -> &'static str { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: the lint level is defined here - --> $DIR/common-ancestor-2.rs:6:9 + --> $DIR/common-ancestor-2.rs:5:9 | LL | #![warn(shadowing_supertrait_items)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: trait item `hello` from `C` shadows identically named item from supertrait - --> $DIR/common-ancestor-2.rs:32:8 + --> $DIR/common-ancestor-2.rs:31:19 | -LL | ().hello(); - | ^^^^^ +LL | assert_eq!(().hello(), "C"); + | ^^^^^ | note: item from `C` shadows a supertrait item - --> $DIR/common-ancestor-2.rs:24:5 + --> $DIR/common-ancestor-2.rs:23:5 | -LL | fn hello(&self) { - | ^^^^^^^^^^^^^^^ +LL | fn hello(&self) -> &'static str { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: items from several supertraits are shadowed: `A` and `B` - --> $DIR/common-ancestor-2.rs:10:5 + --> $DIR/common-ancestor-2.rs:9:5 | -LL | fn hello(&self) { - | ^^^^^^^^^^^^^^^ +LL | fn hello(&self) -> &'static str { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... -LL | fn hello(&self) { - | ^^^^^^^^^^^^^^^ +LL | fn hello(&self) -> &'static str { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: the lint level is defined here - --> $DIR/common-ancestor-2.rs:5:9 + --> $DIR/common-ancestor-2.rs:4:9 | LL | #![warn(resolving_to_items_shadowing_supertrait_items)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/methods/supertrait-shadowing/common-ancestor-3.rs b/tests/ui/methods/supertrait-shadowing/common-ancestor-3.rs index d647c07d966d3..b29f3c8d014ec 100644 --- a/tests/ui/methods/supertrait-shadowing/common-ancestor-3.rs +++ b/tests/ui/methods/supertrait-shadowing/common-ancestor-3.rs @@ -1,5 +1,4 @@ //@ run-pass -//@ check-run-results #![feature(supertrait_item_shadowing)] #![warn(resolving_to_items_shadowing_supertrait_items)] @@ -7,23 +6,23 @@ #![allow(dead_code)] trait A { - fn hello(&self) { - println!("A"); + fn hello(&self) -> &'static str { + "A" } } impl A for T {} trait B { - fn hello(&self) { - println!("B"); + fn hello(&self) -> &'static str { + "B" } } impl B for T {} trait C: A + B { - fn hello(&self) { + fn hello(&self) -> &'static str { //~^ WARN trait item `hello` from `C` shadows identically named item - println!("C"); + "C" } } impl C for T {} @@ -31,14 +30,14 @@ impl C for T {} // `D` extends `C` which extends `B` and `A` trait D: C { - fn hello(&self) { + fn hello(&self) -> &'static str { //~^ WARN trait item `hello` from `D` shadows identically named item - println!("D"); + "D" } } impl D for T {} fn main() { - ().hello(); + assert_eq!(().hello(), "D"); //~^ WARN trait item `hello` from `D` shadows identically named item from supertrait } diff --git a/tests/ui/methods/supertrait-shadowing/common-ancestor-3.run.stdout b/tests/ui/methods/supertrait-shadowing/common-ancestor-3.run.stdout deleted file mode 100644 index 178481050188c..0000000000000 --- a/tests/ui/methods/supertrait-shadowing/common-ancestor-3.run.stdout +++ /dev/null @@ -1 +0,0 @@ -D diff --git a/tests/ui/methods/supertrait-shadowing/common-ancestor-3.stderr b/tests/ui/methods/supertrait-shadowing/common-ancestor-3.stderr index fc0a22a9cf330..28fe7f72f94c3 100644 --- a/tests/ui/methods/supertrait-shadowing/common-ancestor-3.stderr +++ b/tests/ui/methods/supertrait-shadowing/common-ancestor-3.stderr @@ -1,65 +1,65 @@ warning: trait item `hello` from `C` shadows identically named item from supertrait - --> $DIR/common-ancestor-3.rs:24:5 + --> $DIR/common-ancestor-3.rs:23:5 | -LL | fn hello(&self) { - | ^^^^^^^^^^^^^^^ +LL | fn hello(&self) -> &'static str { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: items from several supertraits are shadowed: `B` and `A` - --> $DIR/common-ancestor-3.rs:10:5 + --> $DIR/common-ancestor-3.rs:9:5 | -LL | fn hello(&self) { - | ^^^^^^^^^^^^^^^ +LL | fn hello(&self) -> &'static str { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... -LL | fn hello(&self) { - | ^^^^^^^^^^^^^^^ +LL | fn hello(&self) -> &'static str { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: the lint level is defined here - --> $DIR/common-ancestor-3.rs:6:9 + --> $DIR/common-ancestor-3.rs:5:9 | LL | #![warn(shadowing_supertrait_items)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: trait item `hello` from `D` shadows identically named item from supertrait - --> $DIR/common-ancestor-3.rs:34:5 + --> $DIR/common-ancestor-3.rs:33:5 | -LL | fn hello(&self) { - | ^^^^^^^^^^^^^^^ +LL | fn hello(&self) -> &'static str { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: items from several supertraits are shadowed: `C`, `B`, and `A` - --> $DIR/common-ancestor-3.rs:10:5 + --> $DIR/common-ancestor-3.rs:9:5 | -LL | fn hello(&self) { - | ^^^^^^^^^^^^^^^ +LL | fn hello(&self) -> &'static str { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... -LL | fn hello(&self) { - | ^^^^^^^^^^^^^^^ +LL | fn hello(&self) -> &'static str { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... -LL | fn hello(&self) { - | ^^^^^^^^^^^^^^^ +LL | fn hello(&self) -> &'static str { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: trait item `hello` from `D` shadows identically named item from supertrait - --> $DIR/common-ancestor-3.rs:42:8 + --> $DIR/common-ancestor-3.rs:41:19 | -LL | ().hello(); - | ^^^^^ +LL | assert_eq!(().hello(), "D"); + | ^^^^^ | note: item from `D` shadows a supertrait item - --> $DIR/common-ancestor-3.rs:34:5 + --> $DIR/common-ancestor-3.rs:33:5 | -LL | fn hello(&self) { - | ^^^^^^^^^^^^^^^ +LL | fn hello(&self) -> &'static str { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: items from several supertraits are shadowed: `A`, `B`, and `C` - --> $DIR/common-ancestor-3.rs:10:5 + --> $DIR/common-ancestor-3.rs:9:5 | -LL | fn hello(&self) { - | ^^^^^^^^^^^^^^^ +LL | fn hello(&self) -> &'static str { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... -LL | fn hello(&self) { - | ^^^^^^^^^^^^^^^ +LL | fn hello(&self) -> &'static str { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... -LL | fn hello(&self) { - | ^^^^^^^^^^^^^^^ +LL | fn hello(&self) -> &'static str { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: the lint level is defined here - --> $DIR/common-ancestor-3.rs:5:9 + --> $DIR/common-ancestor-3.rs:4:9 | LL | #![warn(resolving_to_items_shadowing_supertrait_items)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/methods/supertrait-shadowing/common-ancestor.rs b/tests/ui/methods/supertrait-shadowing/common-ancestor.rs index eeda26c4bd7e0..b288d6e22b8c3 100644 --- a/tests/ui/methods/supertrait-shadowing/common-ancestor.rs +++ b/tests/ui/methods/supertrait-shadowing/common-ancestor.rs @@ -1,5 +1,4 @@ //@ run-pass -//@ check-run-results #![feature(supertrait_item_shadowing)] #![warn(resolving_to_items_shadowing_supertrait_items)] @@ -7,21 +6,21 @@ #![allow(dead_code)] trait A { - fn hello(&self) { - println!("A"); + fn hello(&self) -> &'static str { + "A" } } impl A for T {} trait B: A { - fn hello(&self) { + fn hello(&self) -> &'static str { //~^ WARN trait item `hello` from `B` shadows identically named item - println!("B"); + "B" } } impl B for T {} fn main() { - ().hello(); + assert_eq!(().hello(), "B"); //~^ WARN trait item `hello` from `B` shadows identically named item from supertrait } diff --git a/tests/ui/methods/supertrait-shadowing/common-ancestor.run.stdout b/tests/ui/methods/supertrait-shadowing/common-ancestor.run.stdout deleted file mode 100644 index 223b7836fb19f..0000000000000 --- a/tests/ui/methods/supertrait-shadowing/common-ancestor.run.stdout +++ /dev/null @@ -1 +0,0 @@ -B diff --git a/tests/ui/methods/supertrait-shadowing/common-ancestor.stderr b/tests/ui/methods/supertrait-shadowing/common-ancestor.stderr index be67fdf456b88..9afedeab5e2c2 100644 --- a/tests/ui/methods/supertrait-shadowing/common-ancestor.stderr +++ b/tests/ui/methods/supertrait-shadowing/common-ancestor.stderr @@ -1,38 +1,38 @@ warning: trait item `hello` from `B` shadows identically named item from supertrait - --> $DIR/common-ancestor.rs:17:5 + --> $DIR/common-ancestor.rs:16:5 | -LL | fn hello(&self) { - | ^^^^^^^^^^^^^^^ +LL | fn hello(&self) -> &'static str { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: item from `A` is shadowed by a subtrait item - --> $DIR/common-ancestor.rs:10:5 + --> $DIR/common-ancestor.rs:9:5 | -LL | fn hello(&self) { - | ^^^^^^^^^^^^^^^ +LL | fn hello(&self) -> &'static str { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: the lint level is defined here - --> $DIR/common-ancestor.rs:6:9 + --> $DIR/common-ancestor.rs:5:9 | LL | #![warn(shadowing_supertrait_items)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: trait item `hello` from `B` shadows identically named item from supertrait - --> $DIR/common-ancestor.rs:25:8 + --> $DIR/common-ancestor.rs:24:19 | -LL | ().hello(); - | ^^^^^ +LL | assert_eq!(().hello(), "B"); + | ^^^^^ | note: item from `B` shadows a supertrait item - --> $DIR/common-ancestor.rs:17:5 + --> $DIR/common-ancestor.rs:16:5 | -LL | fn hello(&self) { - | ^^^^^^^^^^^^^^^ +LL | fn hello(&self) -> &'static str { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: item from `A` is shadowed by a subtrait item - --> $DIR/common-ancestor.rs:10:5 + --> $DIR/common-ancestor.rs:9:5 | -LL | fn hello(&self) { - | ^^^^^^^^^^^^^^^ +LL | fn hello(&self) -> &'static str { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: the lint level is defined here - --> $DIR/common-ancestor.rs:5:9 + --> $DIR/common-ancestor.rs:4:9 | LL | #![warn(resolving_to_items_shadowing_supertrait_items)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/methods/supertrait-shadowing/no-common-ancestor-2.rs b/tests/ui/methods/supertrait-shadowing/no-common-ancestor-2.rs index 2834ca31b7140..b49476c7a4f68 100644 --- a/tests/ui/methods/supertrait-shadowing/no-common-ancestor-2.rs +++ b/tests/ui/methods/supertrait-shadowing/no-common-ancestor-2.rs @@ -1,22 +1,22 @@ #![feature(supertrait_item_shadowing)] trait A { - fn hello(&self) { - println!("A"); + fn hello(&self) -> &'static str { + "A" } } impl A for T {} trait B { - fn hello(&self) { - println!("B"); + fn hello(&self) -> &'static str { + "B" } } impl B for T {} trait C: A + B { - fn hello(&self) { - println!("C"); + fn hello(&self) -> &'static str { + "C" } } impl C for T {} @@ -25,8 +25,8 @@ impl C for T {} // we have no obvious lower bound. trait D: B { - fn hello(&self) { - println!("D"); + fn hello(&self) -> &'static str { + "D" } } impl D for T {} diff --git a/tests/ui/methods/supertrait-shadowing/no-common-ancestor-2.stderr b/tests/ui/methods/supertrait-shadowing/no-common-ancestor-2.stderr index 231cb9b1cb2bc..745f61d00d660 100644 --- a/tests/ui/methods/supertrait-shadowing/no-common-ancestor-2.stderr +++ b/tests/ui/methods/supertrait-shadowing/no-common-ancestor-2.stderr @@ -7,23 +7,23 @@ LL | ().hello(); note: candidate #1 is defined in an impl of the trait `A` for the type `T` --> $DIR/no-common-ancestor-2.rs:4:5 | -LL | fn hello(&self) { - | ^^^^^^^^^^^^^^^ +LL | fn hello(&self) -> &'static str { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: candidate #2 is defined in an impl of the trait `B` for the type `T` --> $DIR/no-common-ancestor-2.rs:11:5 | -LL | fn hello(&self) { - | ^^^^^^^^^^^^^^^ +LL | fn hello(&self) -> &'static str { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: candidate #3 is defined in an impl of the trait `C` for the type `T` --> $DIR/no-common-ancestor-2.rs:18:5 | -LL | fn hello(&self) { - | ^^^^^^^^^^^^^^^ +LL | fn hello(&self) -> &'static str { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: candidate #4 is defined in an impl of the trait `D` for the type `T` --> $DIR/no-common-ancestor-2.rs:28:5 | -LL | fn hello(&self) { - | ^^^^^^^^^^^^^^^ +LL | fn hello(&self) -> &'static str { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: disambiguate the method for candidate #1 | LL - ().hello(); diff --git a/tests/ui/methods/supertrait-shadowing/no-common-ancestor.rs b/tests/ui/methods/supertrait-shadowing/no-common-ancestor.rs index 7323439d5884f..03c822eb7375e 100644 --- a/tests/ui/methods/supertrait-shadowing/no-common-ancestor.rs +++ b/tests/ui/methods/supertrait-shadowing/no-common-ancestor.rs @@ -1,15 +1,15 @@ #![feature(supertrait_item_shadowing)] trait A { - fn hello(&self) { - println!("A"); + fn hello(&self) -> &'static str { + "A" } } impl A for T {} trait B { - fn hello(&self) { - println!("B"); + fn hello(&self) -> &'static str { + "B" } } impl B for T {} diff --git a/tests/ui/methods/supertrait-shadowing/no-common-ancestor.stderr b/tests/ui/methods/supertrait-shadowing/no-common-ancestor.stderr index 4e83f60c76514..29cf7ff1dbb11 100644 --- a/tests/ui/methods/supertrait-shadowing/no-common-ancestor.stderr +++ b/tests/ui/methods/supertrait-shadowing/no-common-ancestor.stderr @@ -7,13 +7,13 @@ LL | ().hello(); note: candidate #1 is defined in an impl of the trait `A` for the type `T` --> $DIR/no-common-ancestor.rs:4:5 | -LL | fn hello(&self) { - | ^^^^^^^^^^^^^^^ +LL | fn hello(&self) -> &'static str { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: candidate #2 is defined in an impl of the trait `B` for the type `T` --> $DIR/no-common-ancestor.rs:11:5 | -LL | fn hello(&self) { - | ^^^^^^^^^^^^^^^ +LL | fn hello(&self) -> &'static str { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: disambiguate the method for candidate #1 | LL - ().hello(); diff --git a/tests/ui/methods/supertrait-shadowing/out-of-scope.rs b/tests/ui/methods/supertrait-shadowing/out-of-scope.rs index 8e0f5ba978e3a..4112634399b78 100644 --- a/tests/ui/methods/supertrait-shadowing/out-of-scope.rs +++ b/tests/ui/methods/supertrait-shadowing/out-of-scope.rs @@ -1,24 +1,23 @@ //@ run-pass -//@ check-run-results #![allow(dead_code)] mod out_of_scope { pub trait Subtrait: super::Supertrait { - fn hello(&self) { - println!("subtrait"); + fn hello(&self) -> &'static str { + "subtrait" } } impl Subtrait for T {} } trait Supertrait { - fn hello(&self) { - println!("supertrait"); + fn hello(&self) -> &'static str { + "supertrait" } } impl Supertrait for T {} fn main() { - ().hello(); + assert_eq!(().hello(), "supertrait"); } diff --git a/tests/ui/methods/supertrait-shadowing/out-of-scope.run.stdout b/tests/ui/methods/supertrait-shadowing/out-of-scope.run.stdout deleted file mode 100644 index 1019e5f354346..0000000000000 --- a/tests/ui/methods/supertrait-shadowing/out-of-scope.run.stdout +++ /dev/null @@ -1 +0,0 @@ -supertrait diff --git a/tests/ui/methods/supertrait-shadowing/trivially-false-subtrait.rs b/tests/ui/methods/supertrait-shadowing/trivially-false-subtrait.rs index e44c7c18083d0..b0cb8b2ac7b32 100644 --- a/tests/ui/methods/supertrait-shadowing/trivially-false-subtrait.rs +++ b/tests/ui/methods/supertrait-shadowing/trivially-false-subtrait.rs @@ -1,20 +1,23 @@ -//@ check-pass +//@ run-pass // Make sure we don't prefer a subtrait that we would've otherwise eliminated // in `consider_probe` during method probing. -#![feature(supertrait_item_shadowing)] #![allow(dead_code)] struct W(T); trait Upstream { - fn hello(&self) {} + fn hello(&self) -> &'static str { + "upstream" + } } impl Upstream for T {} trait Downstream: Upstream { - fn hello(&self) {} + fn hello(&self) -> &'static str { + "downstream" + } } impl Downstream for W where T: Foo {} @@ -22,5 +25,5 @@ trait Foo {} fn main() { let x = W(1i32); - x.hello(); + assert_eq!(x.hello(), "upstream"); } diff --git a/tests/ui/methods/supertrait-shadowing/type-dependent.rs b/tests/ui/methods/supertrait-shadowing/type-dependent.rs index 3af884fd52dcd..4a5af1d598812 100644 --- a/tests/ui/methods/supertrait-shadowing/type-dependent.rs +++ b/tests/ui/methods/supertrait-shadowing/type-dependent.rs @@ -1,5 +1,4 @@ //@ run-pass -//@ check-run-results // Makes sure we can shadow with type-dependent method syntax. @@ -7,23 +6,23 @@ #![allow(dead_code)] trait A { - fn hello() { - println!("A"); + fn hello() -> &'static str { + "A" } } impl A for T {} trait B: A { - fn hello() { - println!("B"); + fn hello() -> &'static str { + "B" } } impl B for T {} -fn foo() { - T::hello(); +fn foo() -> &'static str { + T::hello() } fn main() { - foo::<()>(); + assert_eq!(foo::<()>(), "B"); } diff --git a/tests/ui/methods/supertrait-shadowing/type-dependent.run.stdout b/tests/ui/methods/supertrait-shadowing/type-dependent.run.stdout deleted file mode 100644 index 223b7836fb19f..0000000000000 --- a/tests/ui/methods/supertrait-shadowing/type-dependent.run.stdout +++ /dev/null @@ -1 +0,0 @@ -B diff --git a/tests/ui/methods/supertrait-shadowing/unstable.off_normal.stderr b/tests/ui/methods/supertrait-shadowing/unstable.off_normal.stderr new file mode 100644 index 0000000000000..b8725ebdb4c1c --- /dev/null +++ b/tests/ui/methods/supertrait-shadowing/unstable.off_normal.stderr @@ -0,0 +1,17 @@ +warning: a method with this name may be added to the standard library in the future + --> $DIR/unstable.rs:26:19 + | +LL | assert_eq!(().hello(), "A"); + | ^^^^^ + | + = help: call with fully qualified syntax `shadowed_stability::A::hello(...)` to keep using the current method + = warning: once this associated item is added to the standard library, the ambiguity may cause an error or change in behavior! + = note: for more information, see issue #48919 + = note: `#[warn(unstable_name_collisions)]` (part of `#[warn(future_incompatible)]`) on by default +help: add `#![feature(downstream)]` to the crate attributes to enable `shadowed_stability::B::hello` + | +LL + #![feature(downstream)] + | + +warning: 1 warning emitted + diff --git a/tests/ui/methods/supertrait-shadowing/unstable.off_shadowing.stderr b/tests/ui/methods/supertrait-shadowing/unstable.off_shadowing.stderr new file mode 100644 index 0000000000000..b8725ebdb4c1c --- /dev/null +++ b/tests/ui/methods/supertrait-shadowing/unstable.off_shadowing.stderr @@ -0,0 +1,17 @@ +warning: a method with this name may be added to the standard library in the future + --> $DIR/unstable.rs:26:19 + | +LL | assert_eq!(().hello(), "A"); + | ^^^^^ + | + = help: call with fully qualified syntax `shadowed_stability::A::hello(...)` to keep using the current method + = warning: once this associated item is added to the standard library, the ambiguity may cause an error or change in behavior! + = note: for more information, see issue #48919 + = note: `#[warn(unstable_name_collisions)]` (part of `#[warn(future_incompatible)]`) on by default +help: add `#![feature(downstream)]` to the crate attributes to enable `shadowed_stability::B::hello` + | +LL + #![feature(downstream)] + | + +warning: 1 warning emitted + diff --git a/tests/ui/methods/supertrait-shadowing/unstable.on_normal.stderr b/tests/ui/methods/supertrait-shadowing/unstable.on_normal.stderr new file mode 100644 index 0000000000000..a0d8ff08d7c0a --- /dev/null +++ b/tests/ui/methods/supertrait-shadowing/unstable.on_normal.stderr @@ -0,0 +1,22 @@ +error[E0034]: multiple applicable items in scope + --> $DIR/unstable.rs:30:19 + | +LL | assert_eq!(().hello(), "B"); + | ^^^^^ multiple `hello` found + | + = note: candidate #1 is defined in an impl of the trait `shadowed_stability::A` for the type `T` + = note: candidate #2 is defined in an impl of the trait `shadowed_stability::B` for the type `T` +help: disambiguate the method for candidate #1 + | +LL - assert_eq!(().hello(), "B"); +LL + assert_eq!(shadowed_stability::A::hello(&()), "B"); + | +help: disambiguate the method for candidate #2 + | +LL - assert_eq!(().hello(), "B"); +LL + assert_eq!(shadowed_stability::B::hello(&()), "B"); + | + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0034`. diff --git a/tests/ui/methods/supertrait-shadowing/unstable.rs b/tests/ui/methods/supertrait-shadowing/unstable.rs new file mode 100644 index 0000000000000..dbf0d0c89bd25 --- /dev/null +++ b/tests/ui/methods/supertrait-shadowing/unstable.rs @@ -0,0 +1,32 @@ +// This tests the interaction of feature staging and supertrait item shadowing. +// When a feature is *off*, then we should not consider unstable methods for probing. +// When a feature is *on*, then we follow the normal supertrait item shadowing rules: +// - When supertrait item shadowing is disabled, this is a clash. +// - When supertrait item shadowing is enabled, we pick subtraits. + +//@ aux-build: shadowed_stability.rs +//@ revisions: off_normal on_normal off_shadowing on_shadowing +//@[off_normal] run-pass +//@[on_normal] check-fail +//@[off_shadowing] run-pass +//@[on_shadowing] run-pass +//@ check-run-results + +#![allow(dead_code, unused_features, unused_imports)] +#![cfg_attr(on_shadowing, feature(downstream))] +#![cfg_attr(on_normal, feature(downstream))] +#![cfg_attr(off_shadowing, feature(supertrait_item_shadowing))] +#![cfg_attr(on_shadowing, feature(supertrait_item_shadowing))] + +extern crate shadowed_stability; +use shadowed_stability::*; + +fn main() { + #[cfg(any(off_normal, off_shadowing))] + assert_eq!(().hello(), "A"); + //[off_normal,off_shadowing]~^ WARN a method with this name may be added + //[off_normal,off_shadowing]~| WARN once this associated item is added + #[cfg(any(on_normal, on_shadowing))] + assert_eq!(().hello(), "B"); + //[on_normal]~^ ERROR multiple applicable items in scope +} diff --git a/tests/ui/traits/const-traits/mismatched_generic_args.stderr b/tests/ui/traits/const-traits/mismatched_generic_args.stderr index 3094cb5013308..7dfbe75099470 100644 --- a/tests/ui/traits/const-traits/mismatched_generic_args.stderr +++ b/tests/ui/traits/const-traits/mismatched_generic_args.stderr @@ -20,9 +20,9 @@ LL | pub struct Quantity(S); | ^^^^^^^^^ | = note: the only supported types are integers, `bool`, and `char` -help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types | -LL + #![feature(adt_const_params)] +LL + #![feature(min_adt_const_params)] | error[E0107]: trait takes at most 1 generic argument but 2 generic arguments were supplied @@ -38,9 +38,9 @@ LL | impl Add for Quantity(x: Quantity) -> Quantity { | ^^^^^^^^^ | = note: the only supported types are integers, `bool`, and `char` -help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types | -LL + #![feature(adt_const_params)] +LL + #![feature(min_adt_const_params)] | error: aborting due to 5 previous errors diff --git a/tests/ui/type-alias-impl-trait/precise-capture-155151.current.stderr b/tests/ui/type-alias-impl-trait/precise-capture-155151.current.stderr new file mode 100644 index 0000000000000..972bf142db671 --- /dev/null +++ b/tests/ui/type-alias-impl-trait/precise-capture-155151.current.stderr @@ -0,0 +1,12 @@ +error[E0381]: used binding `x` isn't initialized + --> $DIR/precise-capture-155151.rs:20:18 + | +LL | let Foo { x } = foo; + | - binding declared here but left uninitialized +... +LL | let _y = x; + | ^ `x` used here but it isn't initialized + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0381`. diff --git a/tests/ui/type-alias-impl-trait/precise-capture-155151.rs b/tests/ui/type-alias-impl-trait/precise-capture-155151.rs new file mode 100644 index 0000000000000..b470c9373e93a --- /dev/null +++ b/tests/ui/type-alias-impl-trait/precise-capture-155151.rs @@ -0,0 +1,22 @@ +#![feature(type_alias_impl_trait)] +//@ revisions: current next +//@ edition: 2021 +//@[current] known-bug: #155151 +//@[current] check-fail +//@[next] compile-flags: -Znext-solver +//@[next] check-pass + +fn main() { + struct Foo { x: u32 } + + type T = impl Sized; + // `foo` has an opaque type, but this function knows that it's `Foo`. + let foo: T = Foo { x: 7 }; + + let _closure = move || { + let Foo { x } = foo; + // `x` should have been captured, but under old-solver the compiler + // thinks it's uninitialized here. + let _y = x; + }; +} diff --git a/tests/ui/typeck/ice-unexpected-region-123863.stderr b/tests/ui/typeck/ice-unexpected-region-123863.stderr index e5050b4d3167a..c529fe750890d 100644 --- a/tests/ui/typeck/ice-unexpected-region-123863.stderr +++ b/tests/ui/typeck/ice-unexpected-region-123863.stderr @@ -5,9 +5,9 @@ LL | const fn concat_strs() -> &'static str { | ^^^^^^^^^^^^ | = note: the only supported types are integers, `bool`, and `char` -help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types | -LL + #![feature(adt_const_params)] +LL + #![feature(min_adt_const_params)] | help: add `#![feature(unsized_const_params)]` to the crate attributes to enable references to implement the `ConstParamTy` trait | @@ -21,9 +21,9 @@ LL | struct Inner; | ^^^^^^^^^^^^ | = note: the only supported types are integers, `bool`, and `char` -help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types +help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types | -LL + #![feature(adt_const_params)] +LL + #![feature(min_adt_const_params)] | help: add `#![feature(unsized_const_params)]` to the crate attributes to enable references to implement the `ConstParamTy` trait | diff --git a/triagebot.toml b/triagebot.toml index 7708bdbceffcb..b0bf55a9248f4 100644 --- a/triagebot.toml +++ b/triagebot.toml @@ -1479,7 +1479,6 @@ libs = [ "@jhpratt", "@tgross35", "@thomcc", - "@ibraheemdev", "@joboet", ] infra-ci = [