diff --git a/compiler/rustc_const_eval/src/interpret/intrinsics.rs b/compiler/rustc_const_eval/src/interpret/intrinsics.rs index 5e7bbc0113271..9bbb42eb01961 100644 --- a/compiler/rustc_const_eval/src/interpret/intrinsics.rs +++ b/compiler/rustc_const_eval/src/interpret/intrinsics.rs @@ -419,48 +419,33 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { sym::simd_insert => { let index = u64::from(self.read_scalar(&args[1])?.to_u32()?); let elem = &args[2]; - let input = &args[0]; - let (len, e_ty) = input.layout.ty.simd_size_and_type(*self.tcx); + let (input, input_len) = self.operand_to_simd(&args[0])?; + let (dest, dest_len) = self.place_to_simd(dest)?; + assert_eq!(input_len, dest_len, "Return vector length must match input length"); assert!( - index < len, - "Index `{}` must be in bounds of vector type `{}`: `[0, {})`", + index < dest_len, + "Index `{}` must be in bounds of vector with length {}`", index, - e_ty, - len - ); - assert_eq!( - input.layout, dest.layout, - "Return type `{}` must match vector type `{}`", - dest.layout.ty, input.layout.ty - ); - assert_eq!( - elem.layout.ty, e_ty, - "Scalar element type `{}` must match vector element type `{}`", - elem.layout.ty, e_ty + dest_len ); - for i in 0..len { - let place = self.place_index(dest, i)?; - let value = if i == index { *elem } else { self.operand_index(input, i)? }; - self.copy_op(&value, &place)?; + for i in 0..dest_len { + let place = self.mplace_index(&dest, i)?; + let value = + if i == index { *elem } else { self.mplace_index(&input, i)?.into() }; + self.copy_op(&value, &place.into())?; } } sym::simd_extract => { let index = u64::from(self.read_scalar(&args[1])?.to_u32()?); - let (len, e_ty) = args[0].layout.ty.simd_size_and_type(*self.tcx); + let (input, input_len) = self.operand_to_simd(&args[0])?; assert!( - index < len, - "index `{}` is out-of-bounds of vector type `{}` with length `{}`", + index < input_len, + "index `{}` must be in bounds of vector with length `{}`", index, - e_ty, - len - ); - assert_eq!( - e_ty, dest.layout.ty, - "Return type `{}` must match vector element type `{}`", - dest.layout.ty, e_ty + input_len ); - self.copy_op(&self.operand_index(&args[0], index)?, dest)?; + self.copy_op(&self.mplace_index(&input, index)?.into(), dest)?; } sym::likely | sym::unlikely | sym::black_box => { // These just return their argument diff --git a/compiler/rustc_const_eval/src/interpret/operand.rs b/compiler/rustc_const_eval/src/interpret/operand.rs index b6682b13ed216..de9e94ce2ac0c 100644 --- a/compiler/rustc_const_eval/src/interpret/operand.rs +++ b/compiler/rustc_const_eval/src/interpret/operand.rs @@ -437,6 +437,18 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { }) } + /// Converts a repr(simd) operand into an operand where `place_index` accesses the SIMD elements. + /// Also returns the number of elements. + pub fn operand_to_simd( + &self, + base: &OpTy<'tcx, M::PointerTag>, + ) -> InterpResult<'tcx, (MPlaceTy<'tcx, M::PointerTag>, u64)> { + // Basically we just transmute this place into an array following simd_size_and_type. + // This only works in memory, but repr(simd) types should never be immediates anyway. + assert!(base.layout.ty.is_simd()); + self.mplace_to_simd(&base.assert_mem_place()) + } + /// Read from a local. Will not actually access the local if reading from a ZST. /// Will not access memory, instead an indirect `Operand` is returned. /// diff --git a/compiler/rustc_const_eval/src/interpret/place.rs b/compiler/rustc_const_eval/src/interpret/place.rs index d425b84bdaf26..d7f2853fc86f5 100644 --- a/compiler/rustc_const_eval/src/interpret/place.rs +++ b/compiler/rustc_const_eval/src/interpret/place.rs @@ -200,7 +200,7 @@ impl<'tcx, Tag: Provenance> MPlaceTy<'tcx, Tag> { } } else { // Go through the layout. There are lots of types that support a length, - // e.g., SIMD types. + // e.g., SIMD types. (But not all repr(simd) types even have FieldsShape::Array!) match self.layout.fields { FieldsShape::Array { count, .. } => Ok(count), _ => bug!("len not supported on sized type {:?}", self.layout.ty), @@ -533,6 +533,22 @@ where }) } + /// Converts a repr(simd) place into a place where `place_index` accesses the SIMD elements. + /// Also returns the number of elements. + pub fn mplace_to_simd( + &self, + base: &MPlaceTy<'tcx, M::PointerTag>, + ) -> InterpResult<'tcx, (MPlaceTy<'tcx, M::PointerTag>, u64)> { + // Basically we just transmute this place into an array following simd_size_and_type. + // (Transmuting is okay since this is an in-memory place. We also double-check the size + // stays the same.) + let (len, e_ty) = base.layout.ty.simd_size_and_type(*self.tcx); + let array = self.tcx.mk_array(e_ty, len); + let layout = self.layout_of(array)?; + assert_eq!(layout.size, base.layout.size); + Ok((MPlaceTy { layout, ..*base }, len)) + } + /// Gets the place of a field inside the place, and also the field's type. /// Just a convenience function, but used quite a bit. /// This is the only projection that might have a side-effect: We cannot project @@ -594,6 +610,16 @@ where }) } + /// Converts a repr(simd) place into a place where `place_index` accesses the SIMD elements. + /// Also returns the number of elements. + pub fn place_to_simd( + &mut self, + base: &PlaceTy<'tcx, M::PointerTag>, + ) -> InterpResult<'tcx, (MPlaceTy<'tcx, M::PointerTag>, u64)> { + let mplace = self.force_allocation(base)?; + self.mplace_to_simd(&mplace) + } + /// Computes a place. You should only use this if you intend to write into this /// place; for reading, a more efficient alternative is `eval_place_for_read`. pub fn eval_place( diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index e16ff97412291..6b79962ddd609 100644 --- a/compiler/rustc_errors/src/emitter.rs +++ b/compiler/rustc_errors/src/emitter.rs @@ -1266,22 +1266,37 @@ impl EmitterWriter { } self.msg_to_buffer(&mut buffer, msg, max_line_num_len, "note", None); } else { + let mut label_width = 0; // The failure note level itself does not provide any useful diagnostic information if *level != Level::FailureNote { buffer.append(0, level.to_str(), Style::Level(*level)); + label_width += level.to_str().len(); } // only render error codes, not lint codes if let Some(DiagnosticId::Error(ref code)) = *code { buffer.append(0, "[", Style::Level(*level)); buffer.append(0, &code, Style::Level(*level)); buffer.append(0, "]", Style::Level(*level)); + label_width += 2 + code.len(); } let header_style = if is_secondary { Style::HeaderMsg } else { Style::MainHeaderMsg }; if *level != Level::FailureNote { buffer.append(0, ": ", header_style); + label_width += 2; } for &(ref text, _) in msg.iter() { - buffer.append(0, &replace_tabs(text), header_style); + // Account for newlines to align output to its label. + for (line, text) in replace_tabs(text).lines().enumerate() { + buffer.append( + 0 + line, + &format!( + "{}{}", + if line == 0 { String::new() } else { " ".repeat(label_width) }, + text + ), + header_style, + ); + } } } diff --git a/compiler/rustc_feature/src/builtin_attrs.rs b/compiler/rustc_feature/src/builtin_attrs.rs index 74a637fde33fc..f25b2d8f566c0 100644 --- a/compiler/rustc_feature/src/builtin_attrs.rs +++ b/compiler/rustc_feature/src/builtin_attrs.rs @@ -1,5 +1,6 @@ //! Built-in attributes and `cfg` flag gating. +use AttributeDuplicates::*; use AttributeGate::*; use AttributeType::*; @@ -88,11 +89,66 @@ impl AttributeGate { /// Only top-level shape (`#[attr]` vs `#[attr(...)]` vs `#[attr = ...]`) is considered now. #[derive(Clone, Copy, Default)] pub struct AttributeTemplate { + /// If `true`, the attribute is allowed to be a bare word like `#[test]`. pub word: bool, + /// If `Some`, the attribute is allowed to take a list of items like `#[allow(..)]`. pub list: Option<&'static str>, + /// If `Some`, the attribute is allowed to be a name/value pair where the + /// value is a string, like `#[must_use = "reason"]`. pub name_value_str: Option<&'static str>, } +/// How to handle multiple duplicate attributes on the same item. +#[derive(Clone, Copy, Default)] +pub enum AttributeDuplicates { + /// Duplicates of this attribute are allowed. + /// + /// This should only be used with attributes where duplicates have semantic + /// meaning, or some kind of "additive" behavior. For example, `#[warn(..)]` + /// can be specified multiple times, and it combines all the entries. Or use + /// this if there is validation done elsewhere. + #[default] + DuplicatesOk, + /// Duplicates after the first attribute will be an unused_attribute warning. + /// + /// This is usually used for "word" attributes, where they are used as a + /// boolean marker, like `#[used]`. It is not necessarily wrong that there + /// are duplicates, but the others should probably be removed. + WarnFollowing, + /// Same as `WarnFollowing`, but only issues warnings for word-style attributes. + /// + /// This is only for special cases, for example multiple `#[macro_use]` can + /// be warned, but multiple `#[macro_use(...)]` should not because the list + /// form has different meaning from the word form. + WarnFollowingWordOnly, + /// Duplicates after the first attribute will be an error. + /// + /// This should be used where duplicates would be ignored, but carry extra + /// meaning that could cause confusion. For example, `#[stable(since="1.0")] + /// #[stable(since="2.0")]`, which version should be used for `stable`? + ErrorFollowing, + /// Duplicates preceding the last instance of the attribute will be an error. + /// + /// This is the same as `ErrorFollowing`, except the last attribute is the + /// one that is "used". This is typically used in cases like codegen + /// attributes which usually only honor the last attribute. + ErrorPreceding, + /// Duplicates after the first attribute will be an unused_attribute warning + /// with a note that this will be an error in the future. + /// + /// This should be used for attributes that should be `ErrorFollowing`, but + /// because older versions of rustc silently accepted (and ignored) the + /// attributes, this is used to transition. + FutureWarnFollowing, + /// Duplicates preceding the last instance of the attribute will be a + /// warning, with a note that this will be an error in the future. + /// + /// This is the same as `FutureWarnFollowing`, except the last attribute is + /// the one that is "used". Ideally these can eventually migrate to + /// `ErrorPreceding`. + FutureWarnPreceding, +} + /// A convenience macro for constructing attribute templates. /// E.g., `template!(Word, List: "description")` means that the attribute /// supports forms `#[attr]` and `#[attr(description)]`. @@ -114,36 +170,45 @@ macro_rules! template { } macro_rules! ungated { - ($attr:ident, $typ:expr, $tpl:expr $(,)?) => { - BuiltinAttribute { name: sym::$attr, type_: $typ, template: $tpl, gate: Ungated } + ($attr:ident, $typ:expr, $tpl:expr, $duplicates:expr $(,)?) => { + BuiltinAttribute { + name: sym::$attr, + type_: $typ, + template: $tpl, + gate: Ungated, + duplicates: $duplicates, + } }; } macro_rules! gated { - ($attr:ident, $typ:expr, $tpl:expr, $gate:ident, $msg:expr $(,)?) => { + ($attr:ident, $typ:expr, $tpl:expr, $duplicates:expr, $gate:ident, $msg:expr $(,)?) => { BuiltinAttribute { name: sym::$attr, type_: $typ, template: $tpl, + duplicates: $duplicates, gate: Gated(Stability::Unstable, sym::$gate, $msg, cfg_fn!($gate)), } }; - ($attr:ident, $typ:expr, $tpl:expr, $msg:expr $(,)?) => { + ($attr:ident, $typ:expr, $tpl:expr, $duplicates:expr, $msg:expr $(,)?) => { BuiltinAttribute { name: sym::$attr, type_: $typ, template: $tpl, + duplicates: $duplicates, gate: Gated(Stability::Unstable, sym::$attr, $msg, cfg_fn!($attr)), } }; } macro_rules! rustc_attr { - (TEST, $attr:ident, $typ:expr, $tpl:expr $(,)?) => { + (TEST, $attr:ident, $typ:expr, $tpl:expr, $duplicate:expr $(,)?) => { rustc_attr!( $attr, $typ, $tpl, + $duplicate, concat!( "the `#[", stringify!($attr), @@ -152,11 +217,12 @@ macro_rules! rustc_attr { ), ) }; - ($attr:ident, $typ:expr, $tpl:expr, $msg:expr $(,)?) => { + ($attr:ident, $typ:expr, $tpl:expr, $duplicates:expr, $msg:expr $(,)?) => { BuiltinAttribute { name: sym::$attr, type_: $typ, template: $tpl, + duplicates: $duplicates, gate: Gated(Stability::Unstable, sym::rustc_attrs, $msg, cfg_fn!(rustc_attrs)), } }; @@ -175,6 +241,7 @@ pub struct BuiltinAttribute { pub name: Symbol, pub type_: AttributeType, pub template: AttributeTemplate, + pub duplicates: AttributeDuplicates, pub gate: AttributeGate, } @@ -186,42 +253,48 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ // ========================================================================== // Conditional compilation: - ungated!(cfg, Normal, template!(List: "predicate")), - ungated!(cfg_attr, Normal, template!(List: "predicate, attr1, attr2, ...")), + ungated!(cfg, Normal, template!(List: "predicate"), DuplicatesOk), + ungated!(cfg_attr, Normal, template!(List: "predicate, attr1, attr2, ..."), DuplicatesOk), // Testing: - ungated!(ignore, Normal, template!(Word, NameValueStr: "reason")), + ungated!(ignore, Normal, template!(Word, NameValueStr: "reason"), WarnFollowing), ungated!( should_panic, Normal, - template!(Word, List: r#"expected = "reason"#, NameValueStr: "reason"), + template!(Word, List: r#"expected = "reason"#, NameValueStr: "reason"), FutureWarnFollowing, ), // FIXME(Centril): This can be used on stable but shouldn't. - ungated!(reexport_test_harness_main, CrateLevel, template!(NameValueStr: "name")), + ungated!(reexport_test_harness_main, CrateLevel, template!(NameValueStr: "name"), ErrorFollowing), // Macros: - ungated!(automatically_derived, Normal, template!(Word)), - // FIXME(#14407) - ungated!(macro_use, Normal, template!(Word, List: "name1, name2, ...")), - ungated!(macro_escape, Normal, template!(Word)), // Deprecated synonym for `macro_use`. - ungated!(macro_export, Normal, template!(Word, List: "local_inner_macros")), - ungated!(proc_macro, Normal, template!(Word)), + ungated!(automatically_derived, Normal, template!(Word), WarnFollowing), + ungated!(macro_use, Normal, template!(Word, List: "name1, name2, ..."), WarnFollowingWordOnly), + ungated!(macro_escape, Normal, template!(Word), WarnFollowing), // Deprecated synonym for `macro_use`. + ungated!(macro_export, Normal, template!(Word, List: "local_inner_macros"), WarnFollowing), + ungated!(proc_macro, Normal, template!(Word), ErrorFollowing), ungated!( proc_macro_derive, Normal, - template!(List: "TraitName, /*opt*/ attributes(name1, name2, ...)"), + template!(List: "TraitName, /*opt*/ attributes(name1, name2, ...)"), ErrorFollowing, ), - ungated!(proc_macro_attribute, Normal, template!(Word)), + ungated!(proc_macro_attribute, Normal, template!(Word), ErrorFollowing), // Lints: - ungated!(warn, Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#)), - ungated!(allow, Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#)), - ungated!(forbid, Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#)), - ungated!(deny, Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#)), - ungated!(must_use, Normal, template!(Word, NameValueStr: "reason")), + ungated!( + warn, Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#), DuplicatesOk + ), + ungated!( + allow, Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#), DuplicatesOk + ), + ungated!( + forbid, Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#), DuplicatesOk + ), + ungated!( + deny, Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#), DuplicatesOk + ), + ungated!(must_use, Normal, template!(Word, NameValueStr: "reason"), FutureWarnFollowing), gated!( - must_not_suspend, Normal, template!(Word, NameValueStr: "reason"), must_not_suspend, - experimental!(must_not_suspend) + must_not_suspend, Normal, template!(Word, NameValueStr: "reason"), WarnFollowing, + must_not_suspend, experimental!(must_not_suspend) ), - // FIXME(#14407) ungated!( deprecated, Normal, template!( @@ -229,78 +302,86 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ List: r#"/*opt*/ since = "version", /*opt*/ note = "reason""#, NameValueStr: "reason" ), + // This has special duplicate handling in E0550 to handle duplicates with rustc_deprecated + DuplicatesOk ), // Crate properties: - ungated!(crate_name, CrateLevel, template!(NameValueStr: "name")), - ungated!(crate_type, CrateLevel, template!(NameValueStr: "bin|lib|...")), - ungated!(crate_id, CrateLevel, template!(NameValueStr: "ignored")), + ungated!(crate_name, CrateLevel, template!(NameValueStr: "name"), FutureWarnFollowing), + ungated!(crate_type, CrateLevel, template!(NameValueStr: "bin|lib|..."), FutureWarnFollowing), + // crate_id is deprecated + ungated!(crate_id, CrateLevel, template!(NameValueStr: "ignored"), FutureWarnFollowing), // ABI, linking, symbols, and FFI ungated!( link, Normal, template!(List: r#"name = "...", /*opt*/ kind = "dylib|static|...", /*opt*/ wasm_import_module = "...""#), + DuplicatesOk, ), - ungated!(link_name, Normal, template!(NameValueStr: "name")), - ungated!(no_link, Normal, template!(Word)), - ungated!(repr, Normal, template!(List: "C")), - ungated!(export_name, Normal, template!(NameValueStr: "name")), - ungated!(link_section, Normal, template!(NameValueStr: "name")), - ungated!(no_mangle, Normal, template!(Word)), - ungated!(used, Normal, template!(Word)), + ungated!(link_name, Normal, template!(NameValueStr: "name"), FutureWarnPreceding), + ungated!(no_link, Normal, template!(Word), WarnFollowing), + ungated!(repr, Normal, template!(List: "C"), DuplicatesOk), + ungated!(export_name, Normal, template!(NameValueStr: "name"), FutureWarnPreceding), + ungated!(link_section, Normal, template!(NameValueStr: "name"), FutureWarnPreceding), + ungated!(no_mangle, Normal, template!(Word), WarnFollowing), + ungated!(used, Normal, template!(Word), WarnFollowing), // Limits: - ungated!(recursion_limit, CrateLevel, template!(NameValueStr: "N")), - ungated!(type_length_limit, CrateLevel, template!(NameValueStr: "N")), + ungated!(recursion_limit, CrateLevel, template!(NameValueStr: "N"), FutureWarnFollowing), + ungated!(type_length_limit, CrateLevel, template!(NameValueStr: "N"), FutureWarnFollowing), gated!( - const_eval_limit, CrateLevel, template!(NameValueStr: "N"), const_eval_limit, - experimental!(const_eval_limit) + const_eval_limit, CrateLevel, template!(NameValueStr: "N"), ErrorFollowing, + const_eval_limit, experimental!(const_eval_limit) ), gated!( - move_size_limit, CrateLevel, template!(NameValueStr: "N"), large_assignments, - experimental!(move_size_limit) + move_size_limit, CrateLevel, template!(NameValueStr: "N"), ErrorFollowing, + large_assignments, experimental!(move_size_limit) ), // Entry point: - ungated!(main, Normal, template!(Word)), - ungated!(start, Normal, template!(Word)), - ungated!(no_start, CrateLevel, template!(Word)), - ungated!(no_main, CrateLevel, template!(Word)), + ungated!(main, Normal, template!(Word), WarnFollowing), + ungated!(start, Normal, template!(Word), WarnFollowing), + ungated!(no_start, CrateLevel, template!(Word), WarnFollowing), + ungated!(no_main, CrateLevel, template!(Word), WarnFollowing), // Modules, prelude, and resolution: - ungated!(path, Normal, template!(NameValueStr: "file")), - ungated!(no_std, CrateLevel, template!(Word)), - ungated!(no_implicit_prelude, Normal, template!(Word)), - ungated!(non_exhaustive, Normal, template!(Word)), + ungated!(path, Normal, template!(NameValueStr: "file"), FutureWarnFollowing), + ungated!(no_std, CrateLevel, template!(Word), WarnFollowing), + ungated!(no_implicit_prelude, Normal, template!(Word), WarnFollowing), + ungated!(non_exhaustive, Normal, template!(Word), WarnFollowing), // Runtime - ungated!(windows_subsystem, Normal, template!(NameValueStr: "windows|console")), - ungated!(panic_handler, Normal, template!(Word)), // RFC 2070 + ungated!( + windows_subsystem, Normal, + template!(NameValueStr: "windows|console"), FutureWarnFollowing + ), + ungated!(panic_handler, Normal, template!(Word), WarnFollowing), // RFC 2070 // Code generation: - ungated!(inline, Normal, template!(Word, List: "always|never")), - ungated!(cold, Normal, template!(Word)), - ungated!(no_builtins, Normal, template!(Word)), - ungated!(target_feature, Normal, template!(List: r#"enable = "name""#)), - ungated!(track_caller, Normal, template!(Word)), + ungated!(inline, Normal, template!(Word, List: "always|never"), FutureWarnFollowing), + ungated!(cold, Normal, template!(Word), WarnFollowing), + ungated!(no_builtins, Normal, template!(Word), WarnFollowing), + ungated!(target_feature, Normal, template!(List: r#"enable = "name""#), DuplicatesOk), + ungated!(track_caller, Normal, template!(Word), WarnFollowing), gated!( no_sanitize, Normal, - template!(List: "address, memory, thread"), + template!(List: "address, memory, thread"), DuplicatesOk, experimental!(no_sanitize) ), - gated!(no_coverage, Normal, template!(Word), experimental!(no_coverage)), + gated!(no_coverage, Normal, template!(Word), WarnFollowing, experimental!(no_coverage)), - // FIXME: #14408 assume docs are used since rustdoc looks at them. - ungated!(doc, Normal, template!(List: "hidden|inline|...", NameValueStr: "string")), + ungated!( + doc, Normal, template!(List: "hidden|inline|...", NameValueStr: "string"), DuplicatesOk + ), // ========================================================================== // Unstable attributes: // ========================================================================== // Linking: - gated!(naked, Normal, template!(Word), naked_functions, experimental!(naked)), + gated!(naked, Normal, template!(Word), WarnFollowing, naked_functions, experimental!(naked)), gated!( - link_ordinal, Normal, template!(List: "ordinal"), raw_dylib, + link_ordinal, Normal, template!(List: "ordinal"), ErrorPreceding, raw_dylib, experimental!(link_ordinal) ), @@ -309,6 +390,7 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ name: sym::plugin, type_: CrateLevel, template: template!(List: "name"), + duplicates: DuplicatesOk, gate: Gated( Stability::Deprecated( "https://github.com/rust-lang/rust/pull/64675", @@ -321,42 +403,52 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ }, // Testing: - gated!(allow_fail, Normal, template!(Word), experimental!(allow_fail)), + gated!(allow_fail, Normal, template!(Word), WarnFollowing, experimental!(allow_fail)), gated!( - test_runner, CrateLevel, template!(List: "path"), custom_test_frameworks, + test_runner, CrateLevel, template!(List: "path"), ErrorFollowing, custom_test_frameworks, "custom test frameworks are an unstable feature", ), // RFC #1268 - gated!(marker, Normal, template!(Word), marker_trait_attr, experimental!(marker)), gated!( - thread_local, Normal, template!(Word), + marker, Normal, template!(Word), WarnFollowing, marker_trait_attr, experimental!(marker) + ), + gated!( + thread_local, Normal, template!(Word), WarnFollowing, "`#[thread_local]` is an experimental feature, and does not currently handle destructors", ), - gated!(no_core, CrateLevel, template!(Word), experimental!(no_core)), + gated!(no_core, CrateLevel, template!(Word), WarnFollowing, experimental!(no_core)), // RFC 2412 gated!( - optimize, Normal, template!(List: "size|speed"), optimize_attribute, + optimize, Normal, template!(List: "size|speed"), ErrorPreceding, optimize_attribute, experimental!(optimize), ), // RFC 2867 - gated!(instruction_set, Normal, template!(List: "set"), isa_attribute, experimental!(instruction_set)), + gated!( + instruction_set, Normal, template!(List: "set"), ErrorPreceding, + isa_attribute, experimental!(instruction_set) + ), - gated!(ffi_returns_twice, Normal, template!(Word), experimental!(ffi_returns_twice)), - gated!(ffi_pure, Normal, template!(Word), experimental!(ffi_pure)), - gated!(ffi_const, Normal, template!(Word), experimental!(ffi_const)), gated!( - register_attr, CrateLevel, template!(List: "attr1, attr2, ..."), + ffi_returns_twice, Normal, template!(Word), WarnFollowing, experimental!(ffi_returns_twice) + ), + gated!(ffi_pure, Normal, template!(Word), WarnFollowing, experimental!(ffi_pure)), + gated!(ffi_const, Normal, template!(Word), WarnFollowing, experimental!(ffi_const)), + gated!( + register_attr, CrateLevel, template!(List: "attr1, attr2, ..."), DuplicatesOk, experimental!(register_attr), ), gated!( - register_tool, CrateLevel, template!(List: "tool1, tool2, ..."), + register_tool, CrateLevel, template!(List: "tool1, tool2, ..."), DuplicatesOk, experimental!(register_tool), ), - gated!(cmse_nonsecure_entry, Normal, template!(Word), experimental!(cmse_nonsecure_entry)), + gated!( + cmse_nonsecure_entry, Normal, template!(Word), WarnFollowing, + experimental!(cmse_nonsecure_entry) + ), // RFC 2632 gated!( - default_method_body_is_const, Normal, template!(Word), const_trait_impl, + default_method_body_is_const, Normal, template!(Word), WarnFollowing, const_trait_impl, "`default_method_body_is_const` is a temporary placeholder for declaring default bodies \ as `const`, which may be removed or renamed in the future." ), @@ -365,34 +457,33 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ // Internal attributes: Stability, deprecation, and unsafe: // ========================================================================== - ungated!(feature, CrateLevel, template!(List: "name1, name1, ...")), - // FIXME(#14407) -- only looked at on-demand so we can't - // guarantee they'll have already been checked. + ungated!(feature, CrateLevel, template!(List: "name1, name1, ..."), DuplicatesOk), + // DuplicatesOk since it has its own validation ungated!( rustc_deprecated, Normal, - template!(List: r#"since = "version", reason = "...""#) + template!(List: r#"since = "version", reason = "...""#), DuplicatesOk // See E0550 + ), + // DuplicatesOk since it has its own validation + ungated!( + stable, Normal, template!(List: r#"feature = "name", since = "version""#), DuplicatesOk ), - // FIXME(#14407) - ungated!(stable, Normal, template!(List: r#"feature = "name", since = "version""#)), - // FIXME(#14407) ungated!( unstable, Normal, - template!(List: r#"feature = "name", reason = "...", issue = "N""#), + template!(List: r#"feature = "name", reason = "...", issue = "N""#), DuplicatesOk, ), - // FIXME(#14407) - ungated!(rustc_const_unstable, Normal, template!(List: r#"feature = "name""#)), - // FIXME(#14407) - ungated!(rustc_const_stable, Normal, template!(List: r#"feature = "name""#)), + ungated!(rustc_const_unstable, Normal, template!(List: r#"feature = "name""#), DuplicatesOk), + ungated!(rustc_const_stable, Normal, template!(List: r#"feature = "name""#), DuplicatesOk), gated!( - allow_internal_unstable, Normal, template!(Word, List: "feat1, feat2, ..."), + allow_internal_unstable, Normal, template!(Word, List: "feat1, feat2, ..."), DuplicatesOk, "allow_internal_unstable side-steps feature gating and stability checks", ), gated!( - rustc_allow_const_fn_unstable, Normal, template!(Word, List: "feat1, feat2, ..."), + rustc_allow_const_fn_unstable, Normal, + template!(Word, List: "feat1, feat2, ..."), DuplicatesOk, "rustc_allow_const_fn_unstable side-steps feature gating and stability checks" ), gated!( - allow_internal_unsafe, Normal, template!(Word), + allow_internal_unsafe, Normal, template!(Word), WarnFollowing, "allow_internal_unsafe side-steps the unsafe_code lint", ), @@ -400,9 +491,9 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ // Internal attributes: Type system related: // ========================================================================== - gated!(fundamental, Normal, template!(Word), experimental!(fundamental)), + gated!(fundamental, Normal, template!(Word), WarnFollowing, experimental!(fundamental)), gated!( - may_dangle, Normal, template!(Word), dropck_eyepatch, + may_dangle, Normal, template!(Word), WarnFollowing, dropck_eyepatch, "`may_dangle` has unstable semantics and may be removed in the future", ), @@ -410,26 +501,32 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ // Internal attributes: Runtime related: // ========================================================================== - rustc_attr!(rustc_allocator, Normal, template!(Word), IMPL_DETAIL), - rustc_attr!(rustc_allocator_nounwind, Normal, template!(Word), IMPL_DETAIL), - gated!(alloc_error_handler, Normal, template!(Word), experimental!(alloc_error_handler)), + rustc_attr!(rustc_allocator, Normal, template!(Word), WarnFollowing, IMPL_DETAIL), + rustc_attr!(rustc_allocator_nounwind, Normal, template!(Word), WarnFollowing, IMPL_DETAIL), + gated!( + alloc_error_handler, Normal, template!(Word), WarnFollowing, + experimental!(alloc_error_handler) + ), gated!( - default_lib_allocator, Normal, template!(Word), allocator_internals, + default_lib_allocator, Normal, template!(Word), WarnFollowing, allocator_internals, experimental!(default_lib_allocator), ), gated!( - needs_allocator, Normal, template!(Word), allocator_internals, + needs_allocator, Normal, template!(Word), WarnFollowing, allocator_internals, experimental!(needs_allocator), ), - gated!(panic_runtime, Normal, template!(Word), experimental!(panic_runtime)), - gated!(needs_panic_runtime, Normal, template!(Word), experimental!(needs_panic_runtime)), + gated!(panic_runtime, Normal, template!(Word), WarnFollowing, experimental!(panic_runtime)), gated!( - compiler_builtins, Normal, template!(Word), + needs_panic_runtime, Normal, template!(Word), WarnFollowing, + experimental!(needs_panic_runtime) + ), + gated!( + compiler_builtins, Normal, template!(Word), WarnFollowing, "the `#[compiler_builtins]` attribute is used to identify the `compiler_builtins` crate \ which contains compiler-rt intrinsics and will never be stable", ), gated!( - profiler_runtime, Normal, template!(Word), + profiler_runtime, Normal, template!(Word), WarnFollowing, "the `#[profiler_runtime]` attribute is used to identify the `profiler_builtins` crate \ which contains the profiler runtime and will never be stable", ), @@ -439,10 +536,12 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ // ========================================================================== gated!( - linkage, Normal, template!(NameValueStr: "external|internal|..."), + linkage, Normal, template!(NameValueStr: "external|internal|..."), ErrorPreceding, "the `linkage` attribute is experimental and not portable across platforms", ), - rustc_attr!(rustc_std_internal_symbol, Normal, template!(Word), INTERNAL_UNSTABLE), + rustc_attr!( + rustc_std_internal_symbol, Normal, template!(Word), WarnFollowing, INTERNAL_UNSTABLE + ), // ========================================================================== // Internal attributes, Macro related: @@ -450,13 +549,13 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ rustc_attr!( rustc_builtin_macro, Normal, - template!(Word, List: "name, /*opt*/ attributes(name1, name2, ...)"), + template!(Word, List: "name, /*opt*/ attributes(name1, name2, ...)"), ErrorFollowing, IMPL_DETAIL, ), - rustc_attr!(rustc_proc_macro_decls, Normal, template!(Word), INTERNAL_UNSTABLE), + rustc_attr!(rustc_proc_macro_decls, Normal, template!(Word), WarnFollowing, INTERNAL_UNSTABLE), rustc_attr!( rustc_macro_transparency, Normal, - template!(NameValueStr: "transparent|semitransparent|opaque"), + template!(NameValueStr: "transparent|semitransparent|opaque"), ErrorFollowing, "used internally for testing macro hygiene", ), @@ -470,39 +569,49 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ List: r#"/*opt*/ message = "...", /*opt*/ label = "...", /*opt*/ note = "...""#, NameValueStr: "message" ), + ErrorFollowing, INTERNAL_UNSTABLE ), // Enumerates "identity-like" conversion methods to suggest on type mismatch. - rustc_attr!(rustc_conversion_suggestion, Normal, template!(Word), INTERNAL_UNSTABLE), + rustc_attr!( + rustc_conversion_suggestion, Normal, template!(Word), WarnFollowing, INTERNAL_UNSTABLE + ), // Prevents field reads in the marked trait or method to be considered // during dead code analysis. - rustc_attr!(rustc_trivial_field_reads, Normal, template!(Word), INTERNAL_UNSTABLE), + rustc_attr!( + rustc_trivial_field_reads, Normal, template!(Word), WarnFollowing, INTERNAL_UNSTABLE + ), // ========================================================================== // Internal attributes, Const related: // ========================================================================== - rustc_attr!(rustc_promotable, Normal, template!(Word), IMPL_DETAIL), - rustc_attr!(rustc_legacy_const_generics, Normal, template!(List: "N"), INTERNAL_UNSTABLE), + rustc_attr!(rustc_promotable, Normal, template!(Word), WarnFollowing, IMPL_DETAIL), + rustc_attr!( + rustc_legacy_const_generics, Normal, template!(List: "N"), ErrorFollowing, + INTERNAL_UNSTABLE + ), // Do not const-check this function's body. It will always get replaced during CTFE. - rustc_attr!(rustc_do_not_const_check, Normal, template!(Word), INTERNAL_UNSTABLE), + rustc_attr!( + rustc_do_not_const_check, Normal, template!(Word), WarnFollowing, INTERNAL_UNSTABLE + ), // ========================================================================== // Internal attributes, Layout related: // ========================================================================== rustc_attr!( - rustc_layout_scalar_valid_range_start, Normal, template!(List: "value"), + rustc_layout_scalar_valid_range_start, Normal, template!(List: "value"), ErrorFollowing, "the `#[rustc_layout_scalar_valid_range_start]` attribute is just used to enable \ niche optimizations in libcore and will never be stable", ), rustc_attr!( - rustc_layout_scalar_valid_range_end, Normal, template!(List: "value"), + rustc_layout_scalar_valid_range_end, Normal, template!(List: "value"), ErrorFollowing, "the `#[rustc_layout_scalar_valid_range_end]` attribute is just used to enable \ niche optimizations in libcore and will never be stable", ), rustc_attr!( - rustc_nonnull_optimization_guaranteed, Normal, template!(Word), + rustc_nonnull_optimization_guaranteed, Normal, template!(Word), WarnFollowing, "the `#[rustc_nonnull_optimization_guaranteed]` attribute is just used to enable \ niche optimizations in libcore and will never be stable", ), @@ -511,13 +620,14 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ // Internal attributes, Misc: // ========================================================================== gated!( - lang, Normal, template!(NameValueStr: "name"), lang_items, + lang, Normal, template!(NameValueStr: "name"), DuplicatesOk, lang_items, "language items are subject to change", ), BuiltinAttribute { name: sym::rustc_diagnostic_item, type_: Normal, template: template!(NameValueStr: "name"), + duplicates: ErrorFollowing, gate: Gated( Stability::Unstable, sym::rustc_attrs, @@ -527,41 +637,43 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ }, gated!( // Used in resolve: - prelude_import, Normal, template!(Word), + prelude_import, Normal, template!(Word), WarnFollowing, "`#[prelude_import]` is for use by rustc only", ), gated!( - rustc_paren_sugar, Normal, template!(Word), unboxed_closures, + rustc_paren_sugar, Normal, template!(Word), WarnFollowing, unboxed_closures, "unboxed_closures are still evolving", ), rustc_attr!( - rustc_inherit_overflow_checks, Normal, template!(Word), + rustc_inherit_overflow_checks, Normal, template!(Word), WarnFollowing, "the `#[rustc_inherit_overflow_checks]` attribute is just used to control \ overflow checking behavior of several libcore functions that are inlined \ across crates and will never be stable", ), - rustc_attr!(rustc_reservation_impl, Normal, template!(NameValueStr: "reservation message"), - "the `#[rustc_reservation_impl]` attribute is internally used \ - for reserving for `for From for T` impl" + rustc_attr!( + rustc_reservation_impl, Normal, + template!(NameValueStr: "reservation message"), ErrorFollowing, + "the `#[rustc_reservation_impl]` attribute is internally used \ + for reserving for `for From for T` impl" ), rustc_attr!( - rustc_test_marker, Normal, template!(Word), + rustc_test_marker, Normal, template!(Word), WarnFollowing, "the `#[rustc_test_marker]` attribute is used internally to track tests", ), rustc_attr!( - rustc_unsafe_specialization_marker, Normal, template!(Word), + rustc_unsafe_specialization_marker, Normal, template!(Word), WarnFollowing, "the `#[rustc_unsafe_specialization_marker]` attribute is used to check specializations" ), rustc_attr!( - rustc_specialization_trait, Normal, template!(Word), + rustc_specialization_trait, Normal, template!(Word), WarnFollowing, "the `#[rustc_specialization_trait]` attribute is used to check specializations" ), rustc_attr!( - rustc_main, Normal, template!(Word), + rustc_main, Normal, template!(Word), WarnFollowing, "the `#[rustc_main]` attribute is used internally to specify test entry point function", ), rustc_attr!( - rustc_skip_array_during_method_dispatch, Normal, template!(Word), + rustc_skip_array_during_method_dispatch, Normal, template!(Word), WarnFollowing, "the `#[rustc_skip_array_during_method_dispatch]` attribute is used to exclude a trait \ from method dispatch when the receiver is an array, for compatibility in editions < 2021." ), @@ -570,48 +682,53 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ // Internal attributes, Testing: // ========================================================================== - rustc_attr!(TEST, rustc_outlives, Normal, template!(Word)), - rustc_attr!(TEST, rustc_capture_analysis, Normal, template!(Word)), - rustc_attr!(TEST, rustc_insignificant_dtor, Normal, template!(Word)), - rustc_attr!(TEST, rustc_strict_coherence, Normal, template!(Word)), - rustc_attr!(TEST, rustc_variance, Normal, template!(Word)), - rustc_attr!(TEST, rustc_layout, Normal, template!(List: "field1, field2, ...")), - rustc_attr!(TEST, rustc_regions, Normal, template!(Word)), + rustc_attr!(TEST, rustc_outlives, Normal, template!(Word), WarnFollowing), + rustc_attr!(TEST, rustc_capture_analysis, Normal, template!(Word), WarnFollowing), + rustc_attr!(TEST, rustc_insignificant_dtor, Normal, template!(Word), WarnFollowing), + rustc_attr!(TEST, rustc_strict_coherence, Normal, template!(Word), WarnFollowing), + rustc_attr!(TEST, rustc_variance, Normal, template!(Word), WarnFollowing), + rustc_attr!(TEST, rustc_layout, Normal, template!(List: "field1, field2, ..."), WarnFollowing), + rustc_attr!(TEST, rustc_regions, Normal, template!(Word), WarnFollowing), rustc_attr!( TEST, rustc_error, Normal, - template!(Word, List: "delay_span_bug_from_inside_query") + template!(Word, List: "delay_span_bug_from_inside_query"), WarnFollowingWordOnly + ), + rustc_attr!(TEST, rustc_dump_user_substs, Normal, template!(Word), WarnFollowing), + rustc_attr!(TEST, rustc_evaluate_where_clauses, Normal, template!(Word), WarnFollowing), + rustc_attr!( + TEST, rustc_if_this_changed, Normal, template!(Word, List: "DepNode"), DuplicatesOk + ), + rustc_attr!( + TEST, rustc_then_this_would_need, Normal, template!(List: "DepNode"), DuplicatesOk ), - rustc_attr!(TEST, rustc_dump_user_substs, Normal, template!(Word)), - rustc_attr!(TEST, rustc_evaluate_where_clauses, Normal, template!(Word)), - rustc_attr!(TEST, rustc_if_this_changed, Normal, template!(Word, List: "DepNode")), - rustc_attr!(TEST, rustc_then_this_would_need, Normal, template!(List: "DepNode")), rustc_attr!( TEST, rustc_clean, Normal, template!(List: r#"cfg = "...", /*opt*/ label = "...", /*opt*/ except = "...""#), + DuplicatesOk, ), rustc_attr!( TEST, rustc_partition_reused, Normal, - template!(List: r#"cfg = "...", module = "...""#), + template!(List: r#"cfg = "...", module = "...""#), DuplicatesOk, ), rustc_attr!( TEST, rustc_partition_codegened, Normal, - template!(List: r#"cfg = "...", module = "...""#), + template!(List: r#"cfg = "...", module = "...""#), DuplicatesOk, ), rustc_attr!( TEST, rustc_expected_cgu_reuse, Normal, - template!(List: r#"cfg = "...", module = "...", kind = "...""#), - ), - rustc_attr!(TEST, rustc_symbol_name, Normal, template!(Word)), - rustc_attr!(TEST, rustc_polymorphize_error, Normal, template!(Word)), - rustc_attr!(TEST, rustc_def_path, Normal, template!(Word)), - rustc_attr!(TEST, rustc_mir, Normal, template!(List: "arg1, arg2, ...")), - rustc_attr!(TEST, rustc_dump_program_clauses, Normal, template!(Word)), - rustc_attr!(TEST, rustc_dump_env_program_clauses, Normal, template!(Word)), - rustc_attr!(TEST, rustc_object_lifetime_default, Normal, template!(Word)), - rustc_attr!(TEST, rustc_dump_vtable, Normal, template!(Word)), - rustc_attr!(TEST, rustc_dummy, Normal, template!(Word /* doesn't matter*/)), + template!(List: r#"cfg = "...", module = "...", kind = "...""#), DuplicatesOk, + ), + rustc_attr!(TEST, rustc_symbol_name, Normal, template!(Word), WarnFollowing), + rustc_attr!(TEST, rustc_polymorphize_error, Normal, template!(Word), WarnFollowing), + rustc_attr!(TEST, rustc_def_path, Normal, template!(Word), WarnFollowing), + rustc_attr!(TEST, rustc_mir, Normal, template!(List: "arg1, arg2, ..."), DuplicatesOk), + rustc_attr!(TEST, rustc_dump_program_clauses, Normal, template!(Word), WarnFollowing), + rustc_attr!(TEST, rustc_dump_env_program_clauses, Normal, template!(Word), WarnFollowing), + rustc_attr!(TEST, rustc_object_lifetime_default, Normal, template!(Word), WarnFollowing), + rustc_attr!(TEST, rustc_dump_vtable, Normal, template!(Word), WarnFollowing), + rustc_attr!(TEST, rustc_dummy, Normal, template!(Word /* doesn't matter*/), DuplicatesOk), gated!( - omit_gdb_pretty_printer_section, Normal, template!(Word), + omit_gdb_pretty_printer_section, Normal, template!(Word), WarnFollowing, "the `#[omit_gdb_pretty_printer_section]` attribute is just used for the Rust test suite", ), ]; diff --git a/compiler/rustc_feature/src/lib.rs b/compiler/rustc_feature/src/lib.rs index b25aab21e491a..bfc537cfae2cb 100644 --- a/compiler/rustc_feature/src/lib.rs +++ b/compiler/rustc_feature/src/lib.rs @@ -11,6 +11,7 @@ //! even if it is stabilized or removed, *do not remove it*. Instead, move the //! symbol to the `accepted` or `removed` modules respectively. +#![feature(derive_default_enum)] #![feature(once_cell)] mod accepted; @@ -146,6 +147,7 @@ pub fn find_feature_issue(feature: Symbol, issue: GateIssue) -> Option InferCtxt<'a, 'tcx> { None }, self.tcx.generics_of(owner.to_def_id()), + hir.span(hir_id), ) }); + + let span = match generics { + // This is to get around the trait identity obligation, that has a `DUMMY_SP` as signal + // for other diagnostics, so we need to recover it here. + Some((_, _, node)) if span.is_dummy() => node, + _ => span, + }; + let type_param_span = match (generics, bound_kind) { - (Some((_, ref generics)), GenericKind::Param(ref param)) => { + (Some((_, ref generics, _)), GenericKind::Param(ref param)) => { // Account for the case where `param` corresponds to `Self`, // which doesn't have the expected type argument. if !(generics.has_self && param.index == 0) { @@ -2153,7 +2162,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { }; let new_lt = generics .as_ref() - .and_then(|(parent_g, g)| { + .and_then(|(parent_g, g, _)| { let mut possible = (b'a'..=b'z').map(|c| format!("'{}", c as char)); let mut lts_names = g .params @@ -2175,7 +2184,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { .unwrap_or("'lt".to_string()); let add_lt_sugg = generics .as_ref() - .and_then(|(_, g)| g.params.first()) + .and_then(|(_, g, _)| g.params.first()) .and_then(|param| param.def_id.as_local()) .map(|def_id| { ( diff --git a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs index c6ccd9b60a9c4..2aaebed28ced7 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs @@ -192,14 +192,16 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { ObligationCauseCode::MatchImpl(parent, ..) => &parent.code, _ => &cause.code, }; - if let ObligationCauseCode::ItemObligation(item_def_id) = *code { + if let (ObligationCauseCode::ItemObligation(item_def_id), None) = + (code, override_error_code) + { // Same case of `impl Foo for dyn Bar { fn qux(&self) {} }` introducing a `'static` // lifetime as above, but called using a fully-qualified path to the method: // `Foo::qux(bar)`. let mut v = TraitObjectVisitor(FxHashSet::default()); v.visit_ty(param.param_ty); if let Some((ident, self_ty)) = - self.get_impl_ident_and_self_ty_from_trait(item_def_id, &v.0) + self.get_impl_ident_and_self_ty_from_trait(*item_def_id, &v.0) { if self.suggest_constrain_dyn_trait_in_impl(&mut err, &v.0, ident, self_ty) { override_error_code = Some(ident); diff --git a/compiler/rustc_middle/src/ty/sty.rs b/compiler/rustc_middle/src/ty/sty.rs index 610f9bd8f82d7..c79e25f4781c8 100644 --- a/compiler/rustc_middle/src/ty/sty.rs +++ b/compiler/rustc_middle/src/ty/sty.rs @@ -1805,10 +1805,13 @@ impl<'tcx> TyS<'tcx> { pub fn simd_size_and_type(&self, tcx: TyCtxt<'tcx>) -> (u64, Ty<'tcx>) { match self.kind() { Adt(def, substs) => { + assert!(def.repr.simd(), "`simd_size_and_type` called on non-SIMD type"); let variant = def.non_enum_variant(); let f0_ty = variant.fields[0].ty(tcx, substs); match f0_ty.kind() { + // If the first field is an array, we assume it is the only field and its + // elements are the SIMD components. Array(f0_elem_ty, f0_len) => { // FIXME(repr_simd): https://github.com/rust-lang/rust/pull/78863#discussion_r522784112 // The way we evaluate the `N` in `[T; N]` here only works since we use @@ -1816,6 +1819,8 @@ impl<'tcx> TyS<'tcx> { // if we use it in generic code. See the `simd-array-trait` ui test. (f0_len.eval_usize(tcx, ParamEnv::empty()) as u64, f0_elem_ty) } + // Otherwise, the fields of this Adt are the SIMD components (and we assume they + // all have the same type). _ => (variant.fields.len() as u64, f0_ty), } } diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs index 6ff2259dc5b0a..2def57cf02a61 100644 --- a/compiler/rustc_passes/src/check_attr.rs +++ b/compiler/rustc_passes/src/check_attr.rs @@ -9,9 +9,9 @@ use rustc_middle::ty::query::Providers; use rustc_middle::ty::TyCtxt; use rustc_ast::{ast, AttrStyle, Attribute, Lit, LitKind, NestedMetaItem}; -use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_data_structures::fx::FxHashMap; use rustc_errors::{pluralize, struct_span_err, Applicability}; -use rustc_feature::{AttributeType, BuiltinAttribute, BUILTIN_ATTRIBUTE_MAP}; +use rustc_feature::{AttributeDuplicates, AttributeType, BuiltinAttribute, BUILTIN_ATTRIBUTE_MAP}; use rustc_hir as hir; use rustc_hir::def_id::LocalDefId; use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor}; @@ -23,6 +23,7 @@ use rustc_session::lint::builtin::{ use rustc_session::parse::feature_err; use rustc_span::symbol::{sym, Symbol}; use rustc_span::{MultiSpan, Span, DUMMY_SP}; +use std::collections::hash_map::Entry; pub(crate) fn target_from_impl_item<'tcx>( tcx: TyCtxt<'tcx>, @@ -69,7 +70,7 @@ impl CheckAttrVisitor<'tcx> { let mut doc_aliases = FxHashMap::default(); let mut is_valid = true; let mut specified_inline = None; - let mut seen = FxHashSet::default(); + let mut seen = FxHashMap::default(); let attrs = self.tcx.hir().attrs(hir_id); for attr in attrs { let attr_is_valid = match attr.name_or_empty() { @@ -148,6 +149,8 @@ impl CheckAttrVisitor<'tcx> { _ => {} } + let builtin = attr.ident().and_then(|ident| BUILTIN_ATTRIBUTE_MAP.get(&ident.name)); + if hir_id != CRATE_HIR_ID { if let Some(BuiltinAttribute { type_: AttributeType::CrateLevel, .. }) = attr.ident().and_then(|ident| BUILTIN_ATTRIBUTE_MAP.get(&ident.name)) @@ -165,21 +168,37 @@ impl CheckAttrVisitor<'tcx> { } } - // Duplicate attributes - match attr.name_or_empty() { - name @ sym::macro_use => { - let args = attr.meta_item_list().unwrap_or_else(Vec::new); - let args: Vec<_> = args.iter().map(|arg| arg.name_or_empty()).collect(); - if !seen.insert((name, args)) { - self.tcx.struct_span_lint_hir( - UNUSED_ATTRIBUTES, - hir_id, + if let Some(BuiltinAttribute { duplicates, .. }) = builtin { + check_duplicates(self.tcx, attr, hir_id, *duplicates, &mut seen); + } + + // Warn on useless empty attributes. + if matches!( + attr.name_or_empty(), + sym::macro_use + | sym::allow + | sym::warn + | sym::deny + | sym::forbid + | sym::feature + | sym::repr + | sym::target_feature + ) && attr.meta_item_list().map_or(false, |list| list.is_empty()) + { + self.tcx.struct_span_lint_hir(UNUSED_ATTRIBUTES, hir_id, attr.span, |lint| { + lint.build("unused attribute") + .span_suggestion( attr.span, - |lint| lint.build("unused attribute").emit(), - ); - } - } - _ => {} + "remove this attribute", + String::new(), + Applicability::MachineApplicable, + ) + .note(&format!( + "attribute `{}` with an empty list has no effect", + attr.name_or_empty() + )) + .emit(); + }); } } @@ -1990,3 +2009,77 @@ fn check_mod_attrs(tcx: TyCtxt<'_>, module_def_id: LocalDefId) { pub(crate) fn provide(providers: &mut Providers) { *providers = Providers { check_mod_attrs, ..*providers }; } + +fn check_duplicates( + tcx: TyCtxt<'_>, + attr: &Attribute, + hir_id: HirId, + duplicates: AttributeDuplicates, + seen: &mut FxHashMap, +) { + use AttributeDuplicates::*; + if matches!(duplicates, WarnFollowingWordOnly) && !attr.is_word() { + return; + } + match duplicates { + DuplicatesOk => {} + WarnFollowing | FutureWarnFollowing | WarnFollowingWordOnly | FutureWarnPreceding => { + match seen.entry(attr.name_or_empty()) { + Entry::Occupied(mut entry) => { + let (this, other) = if matches!(duplicates, FutureWarnPreceding) { + let to_remove = entry.insert(attr.span); + (to_remove, attr.span) + } else { + (attr.span, *entry.get()) + }; + tcx.struct_span_lint_hir(UNUSED_ATTRIBUTES, hir_id, this, |lint| { + let mut db = lint.build("unused attribute"); + db.span_note(other, "attribute also specified here").span_suggestion( + this, + "remove this attribute", + String::new(), + Applicability::MachineApplicable, + ); + if matches!(duplicates, FutureWarnFollowing | FutureWarnPreceding) { + db.warn( + "this was previously accepted by the compiler but is \ + being phased out; it will become a hard error in \ + a future release!", + ); + } + db.emit(); + }); + } + Entry::Vacant(entry) => { + entry.insert(attr.span); + } + } + } + ErrorFollowing | ErrorPreceding => match seen.entry(attr.name_or_empty()) { + Entry::Occupied(mut entry) => { + let (this, other) = if matches!(duplicates, ErrorPreceding) { + let to_remove = entry.insert(attr.span); + (to_remove, attr.span) + } else { + (attr.span, *entry.get()) + }; + tcx.sess + .struct_span_err( + this, + &format!("multiple `{}` attributes", attr.name_or_empty()), + ) + .span_note(other, "attribute also specified here") + .span_suggestion( + this, + "remove this attribute", + String::new(), + Applicability::MachineApplicable, + ) + .emit(); + } + Entry::Vacant(entry) => { + entry.insert(attr.span); + } + }, + } +} diff --git a/compiler/rustc_span/src/source_map.rs b/compiler/rustc_span/src/source_map.rs index 74958c4984962..7414d201f511d 100644 --- a/compiler/rustc_span/src/source_map.rs +++ b/compiler/rustc_span/src/source_map.rs @@ -593,14 +593,19 @@ impl SourceMap { } pub fn span_to_margin(&self, sp: Span) -> Option { - match self.span_to_prev_source(sp) { - Err(_) => None, - Ok(source) => { - let last_line = source.rsplit_once('\n').unwrap_or(("", &source)).1; + Some(self.indentation_before(sp)?.len()) + } - Some(last_line.len() - last_line.trim_start().len()) - } - } + pub fn indentation_before(&self, sp: Span) -> Option { + self.span_to_source(sp, |src, start_index, _| { + let before = &src[..start_index]; + let last_line = before.rsplit_once('\n').map_or(before, |(_, last)| last); + Ok(last_line + .split_once(|c: char| !c.is_whitespace()) + .map_or(last_line, |(indent, _)| indent) + .to_string()) + }) + .ok() } /// Returns the source snippet as `String` before the given `Span`. diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs index 1ff31ff04a2b6..d5c7cf711169b 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs @@ -1958,15 +1958,9 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { region, object_ty, )); } - ObligationCauseCode::ItemObligation(item_def_id) => { - let item_name = tcx.def_path_str(item_def_id); - let msg = format!("required by `{}`", item_name); - let sp = tcx - .hir() - .span_if_local(item_def_id) - .unwrap_or_else(|| tcx.def_span(item_def_id)); - let sp = tcx.sess.source_map().guess_head_span(sp); - err.span_note(sp, &msg); + ObligationCauseCode::ItemObligation(_item_def_id) => { + // We hold the `DefId` of the item introducing the obligation, but displaying it + // doesn't add user usable information. It always point at an associated item. } ObligationCauseCode::BindingObligation(item_def_id, span) => { let item_name = tcx.def_path_str(item_def_id); diff --git a/compiler/rustc_trait_selection/src/traits/util.rs b/compiler/rustc_trait_selection/src/traits/util.rs index ed49abbbedc92..6d2323abba465 100644 --- a/compiler/rustc_trait_selection/src/traits/util.rs +++ b/compiler/rustc_trait_selection/src/traits/util.rs @@ -9,7 +9,9 @@ use rustc_middle::ty::subst::{GenericArg, Subst, SubstsRef}; use rustc_middle::ty::{self, ToPredicate, Ty, TyCtxt, TypeFoldable, WithConstness}; use super::{Normalized, Obligation, ObligationCause, PredicateObligation, SelectionContext}; -pub use rustc_infer::traits::util::*; +pub use rustc_infer::traits::{self, util::*}; + +use std::iter; /////////////////////////////////////////////////////////////////////////// // `TraitAliasExpander` iterator @@ -229,11 +231,16 @@ pub fn predicates_for_generics<'tcx>( ) -> impl Iterator> { debug!("predicates_for_generics(generic_bounds={:?})", generic_bounds); - generic_bounds.predicates.into_iter().map(move |predicate| Obligation { - cause: cause.clone(), - recursion_depth, - param_env, - predicate, + iter::zip(generic_bounds.predicates, generic_bounds.spans).map(move |(predicate, span)| { + let cause = match cause.code { + traits::ItemObligation(def_id) if !span.is_dummy() => traits::ObligationCause::new( + cause.span, + cause.body_id, + traits::BindingObligation(def_id, span), + ), + _ => cause.clone(), + }; + Obligation { cause, recursion_depth, param_env, predicate } }) } diff --git a/compiler/rustc_trait_selection/src/traits/wf.rs b/compiler/rustc_trait_selection/src/traits/wf.rs index cb47ba9c360da..2a66684e2a2a0 100644 --- a/compiler/rustc_trait_selection/src/traits/wf.rs +++ b/compiler/rustc_trait_selection/src/traits/wf.rs @@ -709,7 +709,12 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> { iter::zip(iter::zip(predicates.predicates, predicates.spans), origins.into_iter().rev()) .map(|((pred, span), origin_def_id)| { - let cause = self.cause(traits::BindingObligation(origin_def_id, span)); + let code = if span.is_dummy() { + traits::MiscObligation + } else { + traits::BindingObligation(origin_def_id, span) + }; + let cause = self.cause(code); traits::Obligation::with_depth(cause, self.recursion_depth, self.param_env, pred) }) .filter(|pred| !pred.has_escaping_bound_vars()) diff --git a/compiler/rustc_typeck/src/check/compare_method.rs b/compiler/rustc_typeck/src/check/compare_method.rs index ef7c70960151d..4d4662f73a955 100644 --- a/compiler/rustc_typeck/src/check/compare_method.rs +++ b/compiler/rustc_typeck/src/check/compare_method.rs @@ -210,12 +210,8 @@ fn compare_predicate_entailment<'tcx>( let normalize_cause = traits::ObligationCause::misc(impl_m_span, impl_m_hir_id); let param_env = ty::ParamEnv::new(tcx.intern_predicates(&hybrid_preds.predicates), Reveal::UserFacing); - let param_env = traits::normalize_param_env_or_error( - tcx, - impl_m.def_id, - param_env, - normalize_cause.clone(), - ); + let param_env = + traits::normalize_param_env_or_error(tcx, impl_m.def_id, param_env, normalize_cause); tcx.infer_ctxt().enter(|infcx| { let inh = Inherited::new(infcx, impl_m.def_id.expect_local()); @@ -226,12 +222,15 @@ fn compare_predicate_entailment<'tcx>( let mut selcx = traits::SelectionContext::new(&infcx); let impl_m_own_bounds = impl_m_predicates.instantiate_own(tcx, impl_to_placeholder_substs); - for predicate in impl_m_own_bounds.predicates { + for (predicate, span) in iter::zip(impl_m_own_bounds.predicates, impl_m_own_bounds.spans) { + let normalize_cause = traits::ObligationCause::misc(span, impl_m_hir_id); let traits::Normalized { value: predicate, obligations } = - traits::normalize(&mut selcx, param_env, normalize_cause.clone(), predicate); + traits::normalize(&mut selcx, param_env, normalize_cause, predicate); inh.register_predicates(obligations); - inh.register_predicate(traits::Obligation::new(cause.clone(), param_env, predicate)); + let mut cause = cause.clone(); + cause.make_mut().span = span; + inh.register_predicate(traits::Obligation::new(cause, param_env, predicate)); } // We now need to check that the signature of the impl method is @@ -280,6 +279,12 @@ fn compare_predicate_entailment<'tcx>( let sub_result = infcx.at(&cause, param_env).sup(trait_fty, impl_fty).map( |InferOk { obligations, .. }| { + // FIXME: We'd want to keep more accurate spans than "the method signature" when + // processing the comparison between the trait and impl fn, but we sadly lose them + // and point at the whole signature when a trait bound or specific input or output + // type would be more appropriate. In other places we have a `Vec` + // corresponding to their `Vec`, but we don't have that here. + // Fixing this would improve the output of test `issue-83765.rs`. inh.register_predicates(obligations); }, ); @@ -1385,12 +1390,13 @@ pub fn check_type_bounds<'tcx>( let impl_ty_hir_id = tcx.hir().local_def_id_to_hir_id(impl_ty.def_id.expect_local()); let normalize_cause = traits::ObligationCause::misc(impl_ty_span, impl_ty_hir_id); - let mk_cause = |span| { - ObligationCause::new( - impl_ty_span, - impl_ty_hir_id, - ObligationCauseCode::BindingObligation(trait_ty.def_id, span), - ) + let mk_cause = |span: Span| { + let code = if span.is_dummy() { + traits::MiscObligation + } else { + traits::BindingObligation(trait_ty.def_id, span) + }; + ObligationCause::new(impl_ty_span, impl_ty_hir_id, code) }; let obligations = tcx diff --git a/compiler/rustc_typeck/src/check/demand.rs b/compiler/rustc_typeck/src/check/demand.rs index 9bbe525914728..ece2d7b4f3793 100644 --- a/compiler/rustc_typeck/src/check/demand.rs +++ b/compiler/rustc_typeck/src/check/demand.rs @@ -199,7 +199,50 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { return; } - let mut compatible_variants = expected_adt + // If the expression is of type () and it's the return expression of a block, + // we suggest adding a separate return expression instead. + // (To avoid things like suggesting `Ok(while .. { .. })`.) + if expr_ty.is_unit() { + if let Some(hir::Node::Block(&hir::Block { + span: block_span, expr: Some(e), .. + })) = self.tcx.hir().find(self.tcx.hir().get_parent_node(expr.hir_id)) + { + if e.hir_id == expr.hir_id { + if let Some(span) = expr.span.find_ancestor_inside(block_span) { + let return_suggestions = + if self.tcx.is_diagnostic_item(sym::Result, expected_adt.did) { + vec!["Ok(())".to_string()] + } else if self.tcx.is_diagnostic_item(sym::Option, expected_adt.did) + { + vec!["None".to_string(), "Some(())".to_string()] + } else { + return; + }; + if let Some(indent) = + self.tcx.sess.source_map().indentation_before(span.shrink_to_lo()) + { + // Add a semicolon, except after `}`. + let semicolon = + match self.tcx.sess.source_map().span_to_snippet(span) { + Ok(s) if s.ends_with('}') => "", + _ => ";", + }; + err.span_suggestions( + span.shrink_to_hi(), + "try adding an expression at the end of the block", + return_suggestions + .into_iter() + .map(|r| format!("{}\n{}{}", semicolon, indent, r)), + Applicability::MaybeIncorrect, + ); + } + return; + } + } + } + } + + let compatible_variants: Vec = expected_adt .variants .iter() .filter(|variant| variant.fields.len() == 1) @@ -220,19 +263,33 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { None } }) - .peekable(); + .collect(); - if compatible_variants.peek().is_some() { - if let Ok(expr_text) = self.tcx.sess.source_map().span_to_snippet(expr.span) { - let suggestions = compatible_variants.map(|v| format!("{}({})", v, expr_text)); - let msg = "try using a variant of the expected enum"; - err.span_suggestions( - expr.span, - msg, - suggestions, - Applicability::MaybeIncorrect, - ); - } + if let [variant] = &compatible_variants[..] { + // Just a single matching variant. + err.multipart_suggestion( + &format!("try wrapping the expression in `{}`", variant), + vec![ + (expr.span.shrink_to_lo(), format!("{}(", variant)), + (expr.span.shrink_to_hi(), ")".to_string()), + ], + Applicability::MaybeIncorrect, + ); + } else if compatible_variants.len() > 1 { + // More than one matching variant. + err.multipart_suggestions( + &format!( + "try wrapping the expression in a variant of `{}`", + self.tcx.def_path_str(expected_adt.did) + ), + compatible_variants.into_iter().map(|variant| { + vec![ + (expr.span.shrink_to_lo(), format!("{}(", variant)), + (expr.span.shrink_to_hi(), ")".to_string()), + ] + }), + Applicability::MaybeIncorrect, + ); } } } diff --git a/compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs b/compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs index aae59eee99142..142a0a8fc2501 100644 --- a/compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs +++ b/compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs @@ -586,38 +586,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } } - /// Given a fully substituted set of bounds (`generic_bounds`), and the values with which each - /// type/region parameter was instantiated (`substs`), creates and registers suitable - /// trait/region obligations. - /// - /// For example, if there is a function: - /// - /// ``` - /// fn foo<'a,T:'a>(...) - /// ``` - /// - /// and a reference: - /// - /// ``` - /// let f = foo; - /// ``` - /// - /// Then we will create a fresh region variable `'$0` and a fresh type variable `$1` for `'a` - /// and `T`. This routine will add a region obligation `$1:'$0` and register it locally. - pub fn add_obligations_for_parameters( - &self, - cause: traits::ObligationCause<'tcx>, - predicates: ty::InstantiatedPredicates<'tcx>, - ) { - assert!(!predicates.has_escaping_bound_vars()); - - debug!("add_obligations_for_parameters(predicates={:?})", predicates); - - for obligation in traits::predicates_for_generics(cause, self.param_env, predicates) { - self.register_predicate(obligation); - } - } - // FIXME(arielb1): use this instead of field.ty everywhere // Only for fields! Returns for methods> // Indifferent to privacy flags @@ -1522,20 +1490,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { /// Add all the obligations that are required, substituting and normalized appropriately. #[tracing::instrument(level = "debug", skip(self, span, def_id, substs))] - fn add_required_obligations(&self, span: Span, def_id: DefId, substs: &SubstsRef<'tcx>) { - let (bounds, spans) = self.instantiate_bounds(span, def_id, &substs); + crate fn add_required_obligations(&self, span: Span, def_id: DefId, substs: &SubstsRef<'tcx>) { + let (bounds, _) = self.instantiate_bounds(span, def_id, &substs); - for (i, mut obligation) in traits::predicates_for_generics( + for obligation in traits::predicates_for_generics( traits::ObligationCause::new(span, self.body_id, traits::ItemObligation(def_id)), self.param_env, bounds, - ) - .enumerate() - { - // This makes the error point at the bound, but we want to point at the argument - if let Some(span) = spans.get(i) { - obligation.cause.make_mut().code = traits::BindingObligation(def_id, *span); - } + ) { self.register_predicate(obligation); } } diff --git a/compiler/rustc_typeck/src/check/fn_ctxt/checks.rs b/compiler/rustc_typeck/src/check/fn_ctxt/checks.rs index 7d9483201f6a5..a119a6838b8d2 100644 --- a/compiler/rustc_typeck/src/check/fn_ctxt/checks.rs +++ b/compiler/rustc_typeck/src/check/fn_ctxt/checks.rs @@ -509,10 +509,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { self.write_user_type_annotation_from_substs(hir_id, did, substs, None); // Check bounds on type arguments used in the path. - let (bounds, _) = self.instantiate_bounds(path_span, did, substs); - let cause = - traits::ObligationCause::new(path_span, self.body_id, traits::ItemObligation(did)); - self.add_obligations_for_parameters(cause, bounds); + self.add_required_obligations(path_span, did, substs); Some((variant, ty)) } else { diff --git a/compiler/rustc_typeck/src/check/method/confirm.rs b/compiler/rustc_typeck/src/check/method/confirm.rs index e7e4e72f6c1d9..dabfe92190b33 100644 --- a/compiler/rustc_typeck/src/check/method/confirm.rs +++ b/compiler/rustc_typeck/src/check/method/confirm.rs @@ -120,7 +120,12 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> { // We won't add these if we encountered an illegal sized bound, so that we can use // a custom error in that case. if illegal_sized_bound.is_none() { - self.add_obligations(self.tcx.mk_fn_ptr(method_sig), all_substs, method_predicates); + self.add_obligations( + self.tcx.mk_fn_ptr(method_sig), + all_substs, + method_predicates, + pick.item.def_id, + ); } // Create the final `MethodCallee`. @@ -471,16 +476,23 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> { fty: Ty<'tcx>, all_substs: SubstsRef<'tcx>, method_predicates: ty::InstantiatedPredicates<'tcx>, + def_id: DefId, ) { debug!( - "add_obligations: fty={:?} all_substs={:?} method_predicates={:?}", - fty, all_substs, method_predicates + "add_obligations: fty={:?} all_substs={:?} method_predicates={:?} def_id={:?}", + fty, all_substs, method_predicates, def_id ); - self.add_obligations_for_parameters( - traits::ObligationCause::misc(self.span, self.body_id), + // FIXME: could replace with the following, but we already calculated `method_predicates`, + // so we just call `predicates_for_generics` directly to avoid redoing work. + // `self.add_required_obligations(self.span, def_id, &all_substs);` + for obligation in traits::predicates_for_generics( + traits::ObligationCause::new(self.span, self.body_id, traits::ItemObligation(def_id)), + self.param_env, method_predicates, - ); + ) { + self.register_predicate(obligation); + } // this is a projection from a trait reference, so we have to // make sure that the trait reference inputs are well-formed. diff --git a/compiler/rustc_typeck/src/check/method/mod.rs b/compiler/rustc_typeck/src/check/method/mod.rs index f0f2470e80a8c..dbc1d4ec19377 100644 --- a/compiler/rustc_typeck/src/check/method/mod.rs +++ b/compiler/rustc_typeck/src/check/method/mod.rs @@ -12,6 +12,7 @@ pub use self::CandidateSource::*; pub use self::MethodError::*; use crate::check::FnCtxt; +use crate::ObligationCause; use rustc_data_structures::sync::Lrc; use rustc_errors::{Applicability, DiagnosticBuilder}; use rustc_hir as hir; @@ -71,7 +72,8 @@ pub enum MethodError<'tcx> { #[derive(Debug)] pub struct NoMatchData<'tcx> { pub static_candidates: Vec, - pub unsatisfied_predicates: Vec<(ty::Predicate<'tcx>, Option>)>, + pub unsatisfied_predicates: + Vec<(ty::Predicate<'tcx>, Option>, Option>)>, pub out_of_scope_traits: Vec, pub lev_candidate: Option, pub mode: probe::Mode, @@ -80,7 +82,11 @@ pub struct NoMatchData<'tcx> { impl<'tcx> NoMatchData<'tcx> { pub fn new( static_candidates: Vec, - unsatisfied_predicates: Vec<(ty::Predicate<'tcx>, Option>)>, + unsatisfied_predicates: Vec<( + ty::Predicate<'tcx>, + Option>, + Option>, + )>, out_of_scope_traits: Vec, lev_candidate: Option, mode: probe::Mode, diff --git a/compiler/rustc_typeck/src/check/method/probe.rs b/compiler/rustc_typeck/src/check/method/probe.rs index 95fe6c9b93c40..9fd7e8c4daa20 100644 --- a/compiler/rustc_typeck/src/check/method/probe.rs +++ b/compiler/rustc_typeck/src/check/method/probe.rs @@ -78,7 +78,8 @@ struct ProbeContext<'a, 'tcx> { /// Collects near misses when trait bounds for type parameters are unsatisfied and is only used /// for error reporting - unsatisfied_predicates: Vec<(ty::Predicate<'tcx>, Option>)>, + unsatisfied_predicates: + Vec<(ty::Predicate<'tcx>, Option>, Option>)>, is_suggestion: IsSuggestion, @@ -1351,6 +1352,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> { possibly_unsatisfied_predicates: &mut Vec<( ty::Predicate<'tcx>, Option>, + Option>, )>, unstable_candidates: Option<&mut Vec<(Candidate<'tcx>, Symbol)>>, ) -> Option> @@ -1497,6 +1499,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> { possibly_unsatisfied_predicates: &mut Vec<( ty::Predicate<'tcx>, Option>, + Option>, )>, ) -> ProbeResult { debug!("consider_probe: self_ty={:?} probe={:?}", self_ty, probe); @@ -1508,8 +1511,8 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> { .sup(probe.xform_self_ty, self_ty) { Ok(InferOk { obligations, value: () }) => obligations, - Err(_) => { - debug!("--> cannot relate self-types"); + Err(err) => { + debug!("--> cannot relate self-types {:?}", err); return ProbeResult::NoMatch; } }; @@ -1558,7 +1561,11 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> { let o = self.resolve_vars_if_possible(o); if !self.predicate_may_hold(&o) { result = ProbeResult::NoMatch; - possibly_unsatisfied_predicates.push((o.predicate, None)); + possibly_unsatisfied_predicates.push(( + o.predicate, + None, + Some(o.cause), + )); } } } @@ -1604,8 +1611,11 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> { } else { Some(predicate) }; - possibly_unsatisfied_predicates - .push((nested_predicate, p)); + possibly_unsatisfied_predicates.push(( + nested_predicate, + p, + Some(obligation.cause.clone()), + )); } } } @@ -1613,7 +1623,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> { // Some nested subobligation of this predicate // failed. let predicate = self.resolve_vars_if_possible(predicate); - possibly_unsatisfied_predicates.push((predicate, None)); + possibly_unsatisfied_predicates.push((predicate, None, None)); } } false @@ -1632,7 +1642,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> { let o = self.resolve_vars_if_possible(o); if !self.predicate_may_hold(&o) { result = ProbeResult::NoMatch; - possibly_unsatisfied_predicates.push((o.predicate, None)); + possibly_unsatisfied_predicates.push((o.predicate, None, Some(o.cause))); } } diff --git a/compiler/rustc_typeck/src/check/method/suggest.rs b/compiler/rustc_typeck/src/check/method/suggest.rs index 6411c062feaf6..ca174ed5e8497 100644 --- a/compiler/rustc_typeck/src/check/method/suggest.rs +++ b/compiler/rustc_typeck/src/check/method/suggest.rs @@ -17,7 +17,9 @@ use rustc_span::lev_distance; use rustc_span::symbol::{kw, sym, Ident}; use rustc_span::{source_map, FileName, MultiSpan, Span, Symbol}; use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt; -use rustc_trait_selection::traits::{FulfillmentError, Obligation}; +use rustc_trait_selection::traits::{ + FulfillmentError, Obligation, ObligationCause, ObligationCauseCode, +}; use std::cmp::Ordering; use std::iter; @@ -702,27 +704,39 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { if let (ty::Param(_), ty::PredicateKind::Trait(p)) = (self_ty.kind(), parent_pred.kind().skip_binder()) { - if let ty::Adt(def, _) = p.trait_ref.self_ty().kind() { - let node = def.did.as_local().map(|def_id| { + let node = match p.trait_ref.self_ty().kind() { + ty::Param(_) => { + // Account for `fn` items like in `issue-35677.rs` to + // suggest restricting its type params. + let did = self.tcx.hir().body_owner_def_id(hir::BodyId { + hir_id: self.body_id, + }); + Some( + self.tcx + .hir() + .get(self.tcx.hir().local_def_id_to_hir_id(did)), + ) + } + ty::Adt(def, _) => def.did.as_local().map(|def_id| { self.tcx .hir() .get(self.tcx.hir().local_def_id_to_hir_id(def_id)) - }); - if let Some(hir::Node::Item(hir::Item { kind, .. })) = node { - if let Some(g) = kind.generics() { - let key = match g.where_clause.predicates { - [.., pred] => (pred.span().shrink_to_hi(), false), - [] => ( - g.where_clause - .span_for_predicates_or_empty_place(), - true, - ), - }; - type_params - .entry(key) - .or_insert_with(FxHashSet::default) - .insert(obligation.to_owned()); - } + }), + _ => None, + }; + if let Some(hir::Node::Item(hir::Item { kind, .. })) = node { + if let Some(g) = kind.generics() { + let key = match g.where_clause.predicates { + [.., pred] => (pred.span().shrink_to_hi(), false), + [] => ( + g.where_clause.span_for_predicates_or_empty_place(), + true, + ), + }; + type_params + .entry(key) + .or_insert_with(FxHashSet::default) + .insert(obligation.to_owned()); } } } @@ -791,22 +805,109 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { _ => None, } }; + + // Find all the requirements that come from a local `impl` block. + let mut skip_list: FxHashSet<_> = Default::default(); + let mut spanned_predicates: FxHashMap = Default::default(); + for (data, p, parent_p) in unsatisfied_predicates + .iter() + .filter_map(|(p, parent, c)| c.as_ref().map(|c| (p, parent, c))) + .filter_map(|(p, parent, c)| match c.code { + ObligationCauseCode::ImplDerivedObligation(ref data) => { + Some((data, p, parent)) + } + _ => None, + }) + { + let parent_trait_ref = data.parent_trait_ref; + let parent_def_id = parent_trait_ref.def_id(); + let path = parent_trait_ref.print_only_trait_path(); + let tr_self_ty = parent_trait_ref.skip_binder().self_ty(); + let mut candidates = vec![]; + self.tcx.for_each_relevant_impl( + parent_def_id, + parent_trait_ref.self_ty().skip_binder(), + |impl_def_id| match self.tcx.hir().get_if_local(impl_def_id) { + Some(Node::Item(hir::Item { + kind: hir::ItemKind::Impl(hir::Impl { .. }), + .. + })) => { + candidates.push(impl_def_id); + } + _ => {} + }, + ); + if let [def_id] = &candidates[..] { + match self.tcx.hir().get_if_local(*def_id) { + Some(Node::Item(hir::Item { + kind: hir::ItemKind::Impl(hir::Impl { of_trait, self_ty, .. }), + .. + })) => { + if let Some(pred) = parent_p { + // Done to add the "doesn't satisfy" `span_label`. + let _ = format_pred(*pred); + } + skip_list.insert(p); + let mut spans = Vec::with_capacity(2); + if let Some(trait_ref) = of_trait { + spans.push(trait_ref.path.span); + } + spans.push(self_ty.span); + let entry = spanned_predicates.entry(spans.into()); + entry + .or_insert_with(|| (path, tr_self_ty, Vec::new())) + .2 + .push(p); + } + _ => {} + } + } + } + for (span, (path, self_ty, preds)) in spanned_predicates { + err.span_note( + span, + &format!( + "the following trait bounds were not satisfied because of the \ + requirements of the implementation of `{}` for `{}`:\n{}", + path, + self_ty, + preds + .into_iter() + // .map(|pred| format!("{:?}", pred)) + .filter_map(|pred| format_pred(*pred)) + .map(|(p, _)| format!("`{}`", p)) + .collect::>() + .join("\n"), + ), + ); + } + + // The requirements that didn't have an `impl` span to show. let mut bound_list = unsatisfied_predicates .iter() - .filter_map(|(pred, parent_pred)| { - format_pred(*pred).map(|(p, self_ty)| match parent_pred { - None => format!("`{}`", &p), - Some(parent_pred) => match format_pred(*parent_pred) { + .filter(|(pred, _, _parent_pred)| !skip_list.contains(&pred)) + .filter_map(|(pred, parent_pred, _cause)| { + format_pred(*pred).map(|(p, self_ty)| { + collect_type_param_suggestions(self_ty, pred, &p); + match parent_pred { None => format!("`{}`", &p), - Some((parent_p, _)) => { - collect_type_param_suggestions(self_ty, parent_pred, &p); - format!("`{}`\nwhich is required by `{}`", p, parent_p) - } - }, + Some(parent_pred) => match format_pred(*parent_pred) { + None => format!("`{}`", &p), + Some((parent_p, _)) => { + collect_type_param_suggestions( + self_ty, + parent_pred, + &p, + ); + format!("`{}`\nwhich is required by `{}`", p, parent_p) + } + }, + } }) }) .enumerate() .collect::>(); + for ((span, empty_where), obligations) in type_params.into_iter() { restrict_type_params = true; // #74886: Sort here so that the output is always the same. @@ -836,7 +937,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { for (span, msg) in bound_spans.into_iter() { err.span_label(span, &msg); } - if !bound_list.is_empty() { + if !bound_list.is_empty() || !skip_list.is_empty() { let bound_list = bound_list .into_iter() .map(|(_, path)| path) @@ -846,9 +947,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { err.set_primary_message(&format!( "the {item_kind} `{item_name}` exists for {actual_prefix} `{ty_str}`, but its trait bounds were not satisfied" )); - err.note(&format!( - "the following trait bounds were not satisfied:\n{bound_list}" - )); + if !bound_list.is_empty() { + err.note(&format!( + "the following trait bounds were not satisfied:\n{bound_list}" + )); + } self.suggest_derive(&mut err, &unsatisfied_predicates); unsatisfied_bounds = true; @@ -1062,18 +1165,25 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { err.span_note(spans, &msg); } - let preds: Vec<_> = errors.iter().map(|e| (e.obligation.predicate, None)).collect(); + let preds: Vec<_> = errors + .iter() + .map(|e| (e.obligation.predicate, None, Some(e.obligation.cause.clone()))) + .collect(); self.suggest_derive(err, &preds); } fn suggest_derive( &self, err: &mut DiagnosticBuilder<'_>, - unsatisfied_predicates: &Vec<(ty::Predicate<'tcx>, Option>)>, + unsatisfied_predicates: &Vec<( + ty::Predicate<'tcx>, + Option>, + Option>, + )>, ) { let mut derives = Vec::<(String, Span, String)>::new(); let mut traits = Vec::::new(); - for (pred, _) in unsatisfied_predicates { + for (pred, _, _) in unsatisfied_predicates { let trait_pred = match pred.kind().skip_binder() { ty::PredicateKind::Trait(trait_pred) => trait_pred, _ => continue, @@ -1264,7 +1374,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { item_name: Ident, source: SelfSource<'tcx>, valid_out_of_scope_traits: Vec, - unsatisfied_predicates: &[(ty::Predicate<'tcx>, Option>)], + unsatisfied_predicates: &[( + ty::Predicate<'tcx>, + Option>, + Option>, + )], unsatisfied_bounds: bool, ) { let mut alt_rcvr_sugg = false; @@ -1380,7 +1494,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // this isn't perfect (that is, there are cases when // implementing a trait would be legal but is rejected // here). - unsatisfied_predicates.iter().all(|(p, _)| { + unsatisfied_predicates.iter().all(|(p, _, _)| { match p.kind().skip_binder() { // Hide traits if they are present in predicates as they can be fixed without // having to implement them. diff --git a/compiler/rustc_typeck/src/collect.rs b/compiler/rustc_typeck/src/collect.rs index 209690ec5fc9a..498c9f7c64ef6 100644 --- a/compiler/rustc_typeck/src/collect.rs +++ b/compiler/rustc_typeck/src/collect.rs @@ -1990,16 +1990,12 @@ fn predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericPredicates<'_> { // prove that the trait applies to the types that were // used, and adding the predicate into this list ensures // that this is done. - let mut span = tcx.def_span(def_id); - if tcx.sess.source_map().is_local_span(span) { - // `guess_head_span` reads the actual source file from - // disk to try to determine the 'head' snippet of the span. - // Don't do this for a span that comes from a file outside - // of our crate, since this would make our query output - // (and overall crate metadata) dependent on the - // *current* state of an external file. - span = tcx.sess.source_map().guess_head_span(span); - } + // + // We use a DUMMY_SP here as a way to signal trait bounds that come + // from the trait itself that *shouldn't* be shown as the source of + // an obligation and instead be skipped. Otherwise we'd use + // `tcx.def_span(def_id);` + let span = rustc_span::DUMMY_SP; result.predicates = tcx.arena.alloc_from_iter(result.predicates.iter().copied().chain(std::iter::once(( ty::TraitRef::identity(tcx, def_id).without_const().to_predicate(tcx), diff --git a/src/librustdoc/html/render/print_item.rs b/src/librustdoc/html/render/print_item.rs index 7ef773fe5ff29..049d17a4b477a 100644 --- a/src/librustdoc/html/render/print_item.rs +++ b/src/librustdoc/html/render/print_item.rs @@ -1080,7 +1080,7 @@ fn item_enum(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, e: &clean::Enum cx.derive_id(format!("{}.{}", ItemType::Variant, variant.name.as_ref().unwrap())); write!( w, - "
\ + "

\ \ {name}", id = id, @@ -1093,9 +1093,7 @@ fn item_enum(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, e: &clean::Enum } w.write_str(""); render_stability_since(w, variant, it, cx.tcx()); - w.write_str("

"); - document(w, cx, variant, Some(it), HeadingOffset::H3); - document_non_exhaustive(w, variant); + w.write_str(""); use crate::clean::Variant; if let Some((extra, fields)) = match *variant.kind { @@ -1109,12 +1107,8 @@ fn item_enum(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, e: &clean::Enum variant.name.as_ref().unwrap() )); write!(w, "
", id = variant_id); - write!( - w, - "

{extra}Fields of {name}

", - extra = extra, - name = variant.name.as_ref().unwrap(), - ); + write!(w, "

{extra}Fields

", extra = extra,); + document_non_exhaustive(w, variant); for field in fields { match *field.kind { clean::StrippedItem(box clean::StructFieldItem(_)) => {} @@ -1126,7 +1120,8 @@ fn item_enum(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, e: &clean::Enum )); write!( w, - "\ + "
\ + \ \ {f}: {t}\ ", @@ -1134,13 +1129,16 @@ fn item_enum(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, e: &clean::Enum f = field.name.as_ref().unwrap(), t = ty.print(cx) ); - document(w, cx, field, Some(variant), HeadingOffset::H4); + document(w, cx, field, Some(variant), HeadingOffset::H5); + write!(w, "
"); } _ => unreachable!(), } } - w.write_str("
"); + w.write_str(""); } + + document(w, cx, variant, Some(it), HeadingOffset::H4); } } let def_id = it.def_id.expect_def_id(); diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index 89a763ef6d707..cb1df15bbb152 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -1102,25 +1102,28 @@ a.test-arrow:hover{ margin-right: 5px; } -.sub-variant, .sub-variant > h3 { - margin-top: 0px !important; - padding-top: 1px; +h3.variant { + font-weight: 600; + font-size: 1.1em; + margin-bottom: 10px; + border-bottom: none; } -#main .sub-variant > h3 { - font-size: 15px; - margin-left: 25px; - margin-bottom: 5px; +.sub-variant h4 { + font-size: 1em; + font-weight: 400; + border-bottom: none; + margin-top: 0; + margin-bottom: 0; } -.sub-variant > div { - margin-left: 20px; - margin-bottom: 10px; +.sub-variant { + margin-left: 24px; + margin-bottom: 40px; } -.sub-variant > div > span { - display: block; - position: relative; +.sub-variant > .sub-variant-field { + margin-left: 24px; } .toggle-label { diff --git a/src/test/incremental/hashes/trait_defs.rs b/src/test/incremental/hashes/trait_defs.rs index 9cbd110d68aab..b72ec404f672a 100644 --- a/src/test/incremental/hashes/trait_defs.rs +++ b/src/test/incremental/hashes/trait_defs.rs @@ -33,7 +33,7 @@ trait TraitVisibility { } #[cfg(not(any(cfail1,cfail4)))] #[rustc_clean(except="hir_owner", cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_clean(except="hir_owner,predicates_of", cfg="cfail5")] +#[rustc_clean(except="hir_owner", cfg="cfail5")] #[rustc_clean(cfg="cfail6")] pub trait TraitVisibility { } @@ -46,7 +46,7 @@ trait TraitUnsafety { } #[cfg(not(any(cfail1,cfail4)))] #[rustc_clean(except="hir_owner", cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_clean(except="hir_owner,predicates_of", cfg="cfail5")] +#[rustc_clean(except="hir_owner", cfg="cfail5")] #[rustc_clean(cfg="cfail6")] unsafe trait TraitUnsafety { } @@ -60,7 +60,7 @@ trait TraitAddMethod { #[cfg(not(any(cfail1,cfail4)))] #[rustc_clean(except="hir_owner,associated_item_def_ids", cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_clean(except="hir_owner,associated_item_def_ids,predicates_of", cfg="cfail5")] +#[rustc_clean(except="hir_owner,associated_item_def_ids", cfg="cfail5")] #[rustc_clean(cfg="cfail6")] pub trait TraitAddMethod { fn method(); diff --git a/src/test/rustdoc-gui/headings.goml b/src/test/rustdoc-gui/headings.goml index bdf17ec457057..87c512468e05f 100644 --- a/src/test/rustdoc-gui/headings.goml +++ b/src/test/rustdoc-gui/headings.goml @@ -1,4 +1,4 @@ -// This test check that headers (a) have the correct heading level, (b) are the right size, +// This test checks that headers (a) have the correct heading level, (b) are the right size, // and (c) have the correct underlining (or absence of underlining). // The sizes may change as design changes, but try to make sure a lower header is never bigger than // its parent headers. Also make sure lower headers don't have underlines when their parents lack @@ -67,25 +67,25 @@ assert-css: ("h4#top-doc-prose-sub-sub-heading", {"border-bottom-width": "1px"}) assert-css: ("h2#variants", {"font-size": "22.4px"}) assert-css: ("h2#variants", {"border-bottom-width": "1px"}) -assert-css: ("h3#none-prose-title", {"font-size": "20.8px"}) -assert-css: ("h3#none-prose-title", {"border-bottom-width": "0px"}) -assert-css: ("h4#none-prose-sub-heading", {"font-size": "16px"}) -assert-css: ("h4#none-prose-sub-heading", {"border-bottom-width": "0px"}) - -assert-css: ("h3#wrapped-prose-title", {"font-size": "20.8px"}) -assert-css: ("h3#wrapped-prose-title", {"border-bottom-width": "0px"}) -assert-css: ("h4#wrapped-prose-sub-heading", {"font-size": "16px"}) -assert-css: ("h4#wrapped-prose-sub-heading", {"border-bottom-width": "0px"}) - -assert-css: ("h4#wrapped0-prose-title", {"font-size": "16px"}) -assert-css: ("h4#wrapped0-prose-title", {"border-bottom-width": "0px"}) -assert-css: ("h5#wrapped0-prose-sub-heading", {"font-size": "16px"}) -assert-css: ("h5#wrapped0-prose-sub-heading", {"border-bottom-width": "0px"}) - -assert-css: ("h4#structy-prose-title", {"font-size": "16px"}) -assert-css: ("h4#structy-prose-title", {"border-bottom-width": "0px"}) -assert-css: ("h5#structy-prose-sub-heading", {"font-size": "16px"}) -assert-css: ("h5#structy-prose-sub-heading", {"border-bottom-width": "0px"}) +assert-css: ("h4#none-prose-title", {"font-size": "16px"}) +assert-css: ("h4#none-prose-title", {"border-bottom-width": "0px"}) +assert-css: ("h5#none-prose-sub-heading", {"font-size": "16px"}) +assert-css: ("h5#none-prose-sub-heading", {"border-bottom-width": "0px"}) + +assert-css: ("h4#wrapped-prose-title", {"font-size": "16px"}) +assert-css: ("h4#wrapped-prose-title", {"border-bottom-width": "0px"}) +assert-css: ("h5#wrapped-prose-sub-heading", {"font-size": "16px"}) +assert-css: ("h5#wrapped-prose-sub-heading", {"border-bottom-width": "0px"}) + +assert-css: ("h5#wrapped0-prose-title", {"font-size": "16px"}) +assert-css: ("h5#wrapped0-prose-title", {"border-bottom-width": "0px"}) +assert-css: ("h6#wrapped0-prose-sub-heading", {"font-size": "15.2px"}) +assert-css: ("h6#wrapped0-prose-sub-heading", {"border-bottom-width": "0px"}) + +assert-css: ("h5#structy-prose-title", {"font-size": "16px"}) +assert-css: ("h5#structy-prose-title", {"border-bottom-width": "0px"}) +assert-css: ("h6#structy-prose-sub-heading", {"font-size": "15.2px"}) +assert-css: ("h6#structy-prose-sub-heading", {"border-bottom-width": "0px"}) assert-css: ("h2#implementations", {"font-size": "22.4px"}) assert-css: ("h2#implementations", {"border-bottom-width": "1px"}) diff --git a/src/test/rustdoc/enum-headings.rs b/src/test/rustdoc/enum-headings.rs new file mode 100644 index 0000000000000..2e5c34391c4af --- /dev/null +++ b/src/test/rustdoc/enum-headings.rs @@ -0,0 +1,40 @@ +#![crate_name = "foo"] +// @has foo/enum.Token.html +/// A token! +/// # First +/// Some following text... +// @has - '//h2[@id="first"]' "First" +pub enum Token { + /// A declaration! + /// # Variant-First + /// Some following text... + // @has - '//h4[@id="variant-first"]' "Variant-First" + Declaration { + /// A version! + /// # Variant-Field-First + /// Some following text... + // @has - '//h5[@id="variant-field-first"]' "Variant-Field-First" + version: String, + }, + /// A Zoople! + /// # Variant-First + Zoople( + // @has - '//h5[@id="variant-tuple-field-first"]' "Variant-Tuple-Field-First" + /// Zoople's first variant! + /// # Variant-Tuple-Field-First + /// Some following text... + usize, + ), + /// Unfinished business! + /// # Non-Exhaustive-First + /// Some following text... + // @has - '//h4[@id="non-exhaustive-first"]' "Non-Exhaustive-First" + #[non_exhaustive] + Unfinished { + /// This is x. + /// # X-First + /// Some following text... + // @has - '//h5[@id="x-first"]' "X-First" + x: usize, + }, +} diff --git a/src/test/rustdoc/tuple-struct-fields-doc.rs b/src/test/rustdoc/tuple-struct-fields-doc.rs index f3d8e39ea2d26..139c5b4391ab7 100644 --- a/src/test/rustdoc/tuple-struct-fields-doc.rs +++ b/src/test/rustdoc/tuple-struct-fields-doc.rs @@ -20,10 +20,10 @@ pub struct Foo( // @has foo/enum.Bar.html // @has - '//pre[@class="rust enum"]' 'BarVariant(String),' -// @matches - '//*[@id="variant.BarVariant.fields"]/h3' '^Tuple Fields of BarVariant$' +// @matches - '//*[@id="variant.BarVariant.fields"]/h4' '^Tuple Fields$' // @has - '//*[@id="variant.BarVariant.field.0"]' '0: String' // @has - '//*[@id="variant.BarVariant.fields"]//*[@class="docblock"]' 'Hello docs' -// @matches - '//*[@id="variant.FooVariant.fields"]/h3' '^Fields of FooVariant$' +// @matches - '//*[@id="variant.FooVariant.fields"]/h4' '^Fields$' pub enum Bar { BarVariant( /// Hello docs diff --git a/src/test/ui/allocator/not-an-allocator.stderr b/src/test/ui/allocator/not-an-allocator.stderr index 628b48a45d76d..e7a9ce94af4d9 100644 --- a/src/test/ui/allocator/not-an-allocator.stderr +++ b/src/test/ui/allocator/not-an-allocator.stderr @@ -6,11 +6,6 @@ LL | #[global_allocator] LL | static A: usize = 0; | ^^^^^^^^^^^^^^^^^^^^ the trait `GlobalAlloc` is not implemented for `usize` | -note: required by `std::alloc::GlobalAlloc::alloc` - --> $SRC_DIR/core/src/alloc/global.rs:LL:COL - | -LL | unsafe fn alloc(&self, layout: Layout) -> *mut u8; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the attribute macro `global_allocator` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `usize: GlobalAlloc` is not satisfied @@ -21,11 +16,6 @@ LL | #[global_allocator] LL | static A: usize = 0; | ^^^^^^^^^^^^^^^^^^^^ the trait `GlobalAlloc` is not implemented for `usize` | -note: required by `std::alloc::GlobalAlloc::dealloc` - --> $SRC_DIR/core/src/alloc/global.rs:LL:COL - | -LL | unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the attribute macro `global_allocator` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `usize: GlobalAlloc` is not satisfied @@ -36,11 +26,6 @@ LL | #[global_allocator] LL | static A: usize = 0; | ^^^^^^^^^^^^^^^^^^^^ the trait `GlobalAlloc` is not implemented for `usize` | -note: required by `std::alloc::GlobalAlloc::realloc` - --> $SRC_DIR/core/src/alloc/global.rs:LL:COL - | -LL | unsafe fn realloc(&self, ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8 { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the attribute macro `global_allocator` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `usize: GlobalAlloc` is not satisfied @@ -51,11 +36,6 @@ LL | #[global_allocator] LL | static A: usize = 0; | ^^^^^^^^^^^^^^^^^^^^ the trait `GlobalAlloc` is not implemented for `usize` | -note: required by `std::alloc::GlobalAlloc::alloc_zeroed` - --> $SRC_DIR/core/src/alloc/global.rs:LL:COL - | -LL | unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8 { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the attribute macro `global_allocator` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 4 previous errors diff --git a/src/test/ui/associated-consts/associated-const-array-len.stderr b/src/test/ui/associated-consts/associated-const-array-len.stderr index ff56d112c8184..86c62e7b7f12f 100644 --- a/src/test/ui/associated-consts/associated-const-array-len.stderr +++ b/src/test/ui/associated-consts/associated-const-array-len.stderr @@ -3,12 +3,6 @@ error[E0277]: the trait bound `i32: Foo` is not satisfied | LL | const X: [i32; ::ID] = [0, 1, 2]; | ^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `i32` - | -note: required by `Foo::ID` - --> $DIR/associated-const-array-len.rs:2:5 - | -LL | const ID: usize; - | ^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/associated-consts/issue-63496.stderr b/src/test/ui/associated-consts/issue-63496.stderr index cea56cd5946c9..db39fd762c307 100644 --- a/src/test/ui/associated-consts/issue-63496.stderr +++ b/src/test/ui/associated-consts/issue-63496.stderr @@ -9,11 +9,6 @@ LL | fn f() -> ([u8; A::C], [u8; A::C]); | = note: cannot satisfy `_: A` = note: associated constants cannot be accessed directly on a `trait`, they can only be accessed through a specific `impl` -note: required by `A::C` - --> $DIR/issue-63496.rs:2:5 - | -LL | const C: usize; - | ^^^^^^^^^^^^^^^ error[E0283]: type annotations needed --> $DIR/issue-63496.rs:4:33 @@ -26,11 +21,6 @@ LL | fn f() -> ([u8; A::C], [u8; A::C]); | = note: cannot satisfy `_: A` = note: associated constants cannot be accessed directly on a `trait`, they can only be accessed through a specific `impl` -note: required by `A::C` - --> $DIR/issue-63496.rs:2:5 - | -LL | const C: usize; - | ^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/associated-item/issue-48027.stderr b/src/test/ui/associated-item/issue-48027.stderr index 7b158f1d75474..9ae25a8c22220 100644 --- a/src/test/ui/associated-item/issue-48027.stderr +++ b/src/test/ui/associated-item/issue-48027.stderr @@ -9,11 +9,6 @@ LL | fn return_n(&self) -> [u8; Bar::X]; | = note: cannot satisfy `_: Bar` = note: associated constants cannot be accessed directly on a `trait`, they can only be accessed through a specific `impl` -note: required by `Bar::X` - --> $DIR/issue-48027.rs:2:5 - | -LL | const X: usize; - | ^^^^^^^^^^^^^^^ error[E0038]: the trait `Bar` cannot be made into an object --> $DIR/issue-48027.rs:6:6 diff --git a/src/test/ui/associated-type-bounds/bad-bounds-on-assoc-in-trait.stderr b/src/test/ui/associated-type-bounds/bad-bounds-on-assoc-in-trait.stderr index 57aacf67e05fd..4ecae471ec2da 100644 --- a/src/test/ui/associated-type-bounds/bad-bounds-on-assoc-in-trait.stderr +++ b/src/test/ui/associated-type-bounds/bad-bounds-on-assoc-in-trait.stderr @@ -5,13 +5,6 @@ LL | type C: Clone + Iterator Lam<&'a u8 | ^^^^ `<::C as Iterator>::Item` cannot be sent between threads safely | = help: the trait `Send` is not implemented for `<::C as Iterator>::Item` -note: required by a bound in `Send` - --> $SRC_DIR/core/src/marker.rs:LL:COL - | -LL | / pub unsafe auto trait Send { -LL | | // empty. -LL | | } - | |_^ required by this bound in `Send` help: consider further restricting the associated type | LL | trait Case1 where <::C as Iterator>::Item: Send { @@ -24,17 +17,6 @@ LL | type C: Clone + Iterator Lam<&'a u8 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `<::C as Iterator>::Item` is not an iterator | = help: the trait `Iterator` is not implemented for `<::C as Iterator>::Item` -note: required by a bound in `Iterator` - --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL - | -LL | / pub trait Iterator { -LL | | /// The type of the elements being iterated over. -LL | | #[stable(feature = "rust1", since = "1.0.0")] -LL | | type Item; -... | -LL | | } -LL | | } - | |_^ required by this bound in `Iterator` help: consider further restricting the associated type | LL | trait Case1 where <::C as Iterator>::Item: Iterator { @@ -47,17 +29,6 @@ LL | type C: Clone + Iterator Lam<&'a u8 | ^^^^ `<::C as Iterator>::Item` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `<::C as Iterator>::Item` -note: required by a bound in `Sync` - --> $SRC_DIR/core/src/marker.rs:LL:COL - | -LL | / pub unsafe auto trait Sync { -LL | | // FIXME(estebank): once support to add notes in `rustc_on_unimplemented` -LL | | // lands in beta, and it has been extended to check whether a closure is -LL | | // anywhere in the requirement chain, extend it as such (#48534): -... | -LL | | // Empty -LL | | } - | |_^ required by this bound in `Sync` help: consider further restricting the associated type | LL | trait Case1 where <::C as Iterator>::Item: Sync { diff --git a/src/test/ui/associated-type-bounds/bounds-on-assoc-in-trait.stderr b/src/test/ui/associated-type-bounds/bounds-on-assoc-in-trait.stderr index 4da5a2cbd41a6..4e2313bd4e4a9 100644 --- a/src/test/ui/associated-type-bounds/bounds-on-assoc-in-trait.stderr +++ b/src/test/ui/associated-type-bounds/bounds-on-assoc-in-trait.stderr @@ -5,17 +5,6 @@ LL | type A: Iterator; | ^^^^^ `<::A as Iterator>::Item` cannot be formatted using `{:?}` because it doesn't implement `Debug` | = help: the trait `Debug` is not implemented for `<::A as Iterator>::Item` -note: required by a bound in `Debug` - --> $SRC_DIR/core/src/fmt/mod.rs:LL:COL - | -LL | / pub trait Debug { -LL | | /// Formats the value using the given formatter. -LL | | /// -LL | | /// # Examples -... | -LL | | fn fmt(&self, f: &mut Formatter<'_>) -> Result; -LL | | } - | |_^ required by this bound in `Debug` help: consider further restricting the associated type | LL | trait Case1 where <::A as Iterator>::Item: Debug { @@ -27,17 +16,6 @@ error[E0277]: the trait bound `<::Out as Baz>::Assoc: Default` is n LL | pub trait Foo { type Out: Baz; } | ^^^^^^^ the trait `Default` is not implemented for `<::Out as Baz>::Assoc` | -note: required by a bound in `Default` - --> $SRC_DIR/core/src/default.rs:LL:COL - | -LL | / pub trait Default: Sized { -LL | | /// Returns the "default value" for a type. -LL | | /// -LL | | /// Default values are often some kind of initial value, identity value, or anything else that -... | -LL | | fn default() -> Self; -LL | | } - | |_^ required by this bound in `Default` help: consider further restricting the associated type | LL | pub trait Foo where <::Out as Baz>::Assoc: Default { type Out: Baz; } diff --git a/src/test/ui/associated-types/associated-types-bound-failure.stderr b/src/test/ui/associated-types/associated-types-bound-failure.stderr index e66c6b35ca1ee..3eda22796e099 100644 --- a/src/test/ui/associated-types/associated-types-bound-failure.stderr +++ b/src/test/ui/associated-types/associated-types-bound-failure.stderr @@ -6,11 +6,6 @@ LL | ToInt::to_int(&g.get()) | | | required by a bound introduced by this call | -note: required by `ToInt::to_int` - --> $DIR/associated-types-bound-failure.rs:6:5 - | -LL | fn to_int(&self) -> isize; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider further restricting the associated type | LL | where G : GetToInt, ::R: ToInt diff --git a/src/test/ui/associated-types/associated-types-for-unimpl-trait.stderr b/src/test/ui/associated-types/associated-types-for-unimpl-trait.stderr index 92c963a9ef9f2..6552c8be78089 100644 --- a/src/test/ui/associated-types/associated-types-for-unimpl-trait.stderr +++ b/src/test/ui/associated-types/associated-types-for-unimpl-trait.stderr @@ -4,11 +4,6 @@ error[E0277]: the trait bound `Self: Get` is not satisfied LL | fn uhoh(&self, foo: U, bar: ::Value) {} | ^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `Self` | -note: required by a bound in `Get` - --> $DIR/associated-types-for-unimpl-trait.rs:4:1 - | -LL | trait Get { - | ^^^^^^^^^ required by this bound in `Get` help: consider further restricting `Self` | LL | fn uhoh(&self, foo: U, bar: ::Value) where Self: Get {} diff --git a/src/test/ui/associated-types/associated-types-no-suitable-bound.stderr b/src/test/ui/associated-types/associated-types-no-suitable-bound.stderr index 509d548c69df0..b2ee1b5e6d045 100644 --- a/src/test/ui/associated-types/associated-types-no-suitable-bound.stderr +++ b/src/test/ui/associated-types/associated-types-no-suitable-bound.stderr @@ -4,11 +4,6 @@ error[E0277]: the trait bound `T: Get` is not satisfied LL | fn uhoh(foo: ::Value) {} | ^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `T` | -note: required by a bound in `Get` - --> $DIR/associated-types-no-suitable-bound.rs:1:1 - | -LL | trait Get { - | ^^^^^^^^^ required by this bound in `Get` help: consider restricting type parameter `T` | LL | fn uhoh(foo: ::Value) {} diff --git a/src/test/ui/associated-types/associated-types-no-suitable-supertrait-2.stderr b/src/test/ui/associated-types/associated-types-no-suitable-supertrait-2.stderr index 1cb9ac8fdefc1..2e40dbd065d3e 100644 --- a/src/test/ui/associated-types/associated-types-no-suitable-supertrait-2.stderr +++ b/src/test/ui/associated-types/associated-types-no-suitable-supertrait-2.stderr @@ -4,11 +4,6 @@ error[E0277]: the trait bound `Self: Get` is not satisfied LL | fn uhoh(&self, foo: U, bar: ::Value) {} | ^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `Self` | -note: required by a bound in `Get` - --> $DIR/associated-types-no-suitable-supertrait-2.rs:12:1 - | -LL | trait Get { - | ^^^^^^^^^ required by this bound in `Get` help: consider further restricting `Self` | LL | fn uhoh(&self, foo: U, bar: ::Value) where Self: Get {} diff --git a/src/test/ui/associated-types/associated-types-no-suitable-supertrait.stderr b/src/test/ui/associated-types/associated-types-no-suitable-supertrait.stderr index e3185fbe9392e..da79c7ac77f9d 100644 --- a/src/test/ui/associated-types/associated-types-no-suitable-supertrait.stderr +++ b/src/test/ui/associated-types/associated-types-no-suitable-supertrait.stderr @@ -4,11 +4,6 @@ error[E0277]: the trait bound `Self: Get` is not satisfied LL | fn uhoh(&self, foo: U, bar: ::Value) {} | ^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `Self` | -note: required by a bound in `Get` - --> $DIR/associated-types-no-suitable-supertrait.rs:12:1 - | -LL | trait Get { - | ^^^^^^^^^ required by this bound in `Get` help: consider further restricting `Self` | LL | fn uhoh(&self, foo: U, bar: ::Value) where Self: Get {} @@ -19,12 +14,6 @@ error[E0277]: the trait bound `(T, U): Get` is not satisfied | LL | fn uhoh(&self, foo: U, bar: <(T, U) as Get>::Value) {} | ^^^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `(T, U)` - | -note: required by a bound in `Get` - --> $DIR/associated-types-no-suitable-supertrait.rs:12:1 - | -LL | trait Get { - | ^^^^^^^^^ required by this bound in `Get` error: aborting due to 2 previous errors diff --git a/src/test/ui/associated-types/associated-types-projection-to-unrelated-trait-in-method-without-default.stderr b/src/test/ui/associated-types/associated-types-projection-to-unrelated-trait-in-method-without-default.stderr index 09ec0e116175d..2e67c21940fc7 100644 --- a/src/test/ui/associated-types/associated-types-projection-to-unrelated-trait-in-method-without-default.stderr +++ b/src/test/ui/associated-types/associated-types-projection-to-unrelated-trait-in-method-without-default.stderr @@ -4,11 +4,6 @@ error[E0277]: the trait bound `Self: Get` is not satisfied LL | fn okay(&self, foo: U, bar: ::Value); | ^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `Self` | -note: required by a bound in `Get` - --> $DIR/associated-types-projection-to-unrelated-trait-in-method-without-default.rs:5:1 - | -LL | trait Get { - | ^^^^^^^^^ required by this bound in `Get` help: consider further restricting `Self` | LL | fn okay(&self, foo: U, bar: ::Value) where Self: Get; diff --git a/src/test/ui/associated-types/associated-types-unconstrained.stderr b/src/test/ui/associated-types/associated-types-unconstrained.stderr index 5f4b65bd131ee..60ec23cf655ab 100644 --- a/src/test/ui/associated-types/associated-types-unconstrained.stderr +++ b/src/test/ui/associated-types/associated-types-unconstrained.stderr @@ -5,11 +5,6 @@ LL | let x: isize = Foo::bar(); | ^^^^^^^^ cannot infer type | = note: cannot satisfy `_: Foo` -note: required by `Foo::bar` - --> $DIR/associated-types-unconstrained.rs:5:5 - | -LL | fn bar() -> isize; - | ^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/associated-types/issue-44153.stderr b/src/test/ui/associated-types/issue-44153.stderr index 7bf36d5e91515..54f6556c083fd 100644 --- a/src/test/ui/associated-types/issue-44153.stderr +++ b/src/test/ui/associated-types/issue-44153.stderr @@ -9,11 +9,6 @@ note: required because of the requirements on the impl of `Visit` for `()` | LL | impl<'a> Visit for () where | ^^^^^ ^^ -note: required by `Visit::visit` - --> $DIR/issue-44153.rs:6:5 - | -LL | fn visit() {} - | ^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/substs-ppaux.normal.stderr b/src/test/ui/associated-types/substs-ppaux.normal.stderr similarity index 94% rename from src/test/ui/substs-ppaux.normal.stderr rename to src/test/ui/associated-types/substs-ppaux.normal.stderr index 97caa833d2f58..085c56870b365 100644 --- a/src/test/ui/substs-ppaux.normal.stderr +++ b/src/test/ui/associated-types/substs-ppaux.normal.stderr @@ -82,11 +82,6 @@ note: required because of the requirements on the impl of `Foo<'_, '_, u8>` for | LL | impl<'a,'b,T,S> Foo<'a, 'b, S> for T {} | ^^^^^^^^^^^^^^ ^ -note: required by a bound in `Foo::bar` - --> $DIR/substs-ppaux.rs:7:30 - | -LL | fn bar<'a, T>() where T: 'a {} - | ^^ required by this bound in `Foo::bar` error: aborting due to 5 previous errors diff --git a/src/test/ui/substs-ppaux.rs b/src/test/ui/associated-types/substs-ppaux.rs similarity index 100% rename from src/test/ui/substs-ppaux.rs rename to src/test/ui/associated-types/substs-ppaux.rs diff --git a/src/test/ui/substs-ppaux.verbose.stderr b/src/test/ui/associated-types/substs-ppaux.verbose.stderr similarity index 94% rename from src/test/ui/substs-ppaux.verbose.stderr rename to src/test/ui/associated-types/substs-ppaux.verbose.stderr index 5829073c265bd..b831f3b7a76d2 100644 --- a/src/test/ui/substs-ppaux.verbose.stderr +++ b/src/test/ui/associated-types/substs-ppaux.verbose.stderr @@ -82,11 +82,6 @@ note: required because of the requirements on the impl of `Foo<'_#0r, '_#1r, u8> | LL | impl<'a,'b,T,S> Foo<'a, 'b, S> for T {} | ^^^^^^^^^^^^^^ ^ -note: required by a bound in `Foo::bar` - --> $DIR/substs-ppaux.rs:7:30 - | -LL | fn bar<'a, T>() where T: 'a {} - | ^^ required by this bound in `Foo::bar` error: aborting due to 5 previous errors diff --git a/src/test/ui/async-await/issue-61076.rs b/src/test/ui/async-await/issue-61076.rs index 220f0774e2d54..fcf688f889f9c 100644 --- a/src/test/ui/async-await/issue-61076.rs +++ b/src/test/ui/async-await/issue-61076.rs @@ -42,12 +42,10 @@ async fn bar() -> Result<(), ()> { foo()?; //~ ERROR the `?` operator can only be applied to values that implement `Try` //~^ NOTE the `?` operator cannot be applied to type `impl Future` //~| HELP the trait `Try` is not implemented for `impl Future` - //~| NOTE required by `branch` //~| HELP consider `await`ing on the `Future` //~| NOTE in this expansion of desugaring of operator `?` //~| NOTE in this expansion of desugaring of operator `?` //~| NOTE in this expansion of desugaring of operator `?` - //~| NOTE in this expansion of desugaring of operator `?` Ok(()) } @@ -67,12 +65,10 @@ async fn baz() -> Result<(), ()> { t?; //~ ERROR the `?` operator can only be applied to values that implement `Try` //~^ NOTE the `?` operator cannot be applied to type `T` //~| HELP the trait `Try` is not implemented for `T` - //~| NOTE required by `branch` //~| HELP consider `await`ing on the `Future` //~| NOTE in this expansion of desugaring of operator `?` //~| NOTE in this expansion of desugaring of operator `?` //~| NOTE in this expansion of desugaring of operator `?` - //~| NOTE in this expansion of desugaring of operator `?` let _: i32 = tuple().0; //~ ERROR no field `0` diff --git a/src/test/ui/async-await/issue-61076.stderr b/src/test/ui/async-await/issue-61076.stderr index 60b5bfa53d77f..7eb2709b93aee 100644 --- a/src/test/ui/async-await/issue-61076.stderr +++ b/src/test/ui/async-await/issue-61076.stderr @@ -5,35 +5,25 @@ LL | foo()?; | ^^^^^^ the `?` operator cannot be applied to type `impl Future` | = help: the trait `Try` is not implemented for `impl Future` -note: required by `branch` - --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL - | -LL | fn branch(self) -> ControlFlow; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider `await`ing on the `Future` | LL | foo().await?; | ++++++ error[E0277]: the `?` operator can only be applied to values that implement `Try` - --> $DIR/issue-61076.rs:67:5 + --> $DIR/issue-61076.rs:65:5 | LL | t?; | ^^ the `?` operator cannot be applied to type `T` | = help: the trait `Try` is not implemented for `T` -note: required by `branch` - --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL - | -LL | fn branch(self) -> ControlFlow; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider `await`ing on the `Future` | LL | t.await?; | ++++++ error[E0609]: no field `0` on type `impl Future` - --> $DIR/issue-61076.rs:78:26 + --> $DIR/issue-61076.rs:74:26 | LL | let _: i32 = tuple().0; | ^ field not available in `impl Future`, but it is available in its `Output` @@ -44,7 +34,7 @@ LL | let _: i32 = tuple().await.0; | ++++++ error[E0609]: no field `a` on type `impl Future` - --> $DIR/issue-61076.rs:82:28 + --> $DIR/issue-61076.rs:78:28 | LL | let _: i32 = struct_().a; | ^ field not available in `impl Future`, but it is available in its `Output` @@ -55,7 +45,7 @@ LL | let _: i32 = struct_().await.a; | ++++++ error[E0599]: no method named `method` found for opaque type `impl Future` in the current scope - --> $DIR/issue-61076.rs:86:15 + --> $DIR/issue-61076.rs:82:15 | LL | struct_().method(); | ^^^^^^ method not found in `impl Future` @@ -66,13 +56,13 @@ LL | struct_().await.method(); | ++++++ error[E0308]: mismatched types - --> $DIR/issue-61076.rs:94:9 + --> $DIR/issue-61076.rs:90:9 | LL | Tuple(_) => {} | ^^^^^^^^ expected opaque type, found struct `Tuple` | note: while checking the return type of the `async fn` - --> $DIR/issue-61076.rs:58:21 + --> $DIR/issue-61076.rs:56:21 | LL | async fn tuple() -> Tuple { | ^^^^^ checked the `Output` of this `async fn`, expected opaque type diff --git a/src/test/ui/async-await/issue-70594.stderr b/src/test/ui/async-await/issue-70594.stderr index e20e2e8f6ba38..eb24040404b90 100644 --- a/src/test/ui/async-await/issue-70594.stderr +++ b/src/test/ui/async-await/issue-70594.stderr @@ -25,11 +25,6 @@ LL | [1; ().await]; | ^^^^^^^^ `()` is not a future | = help: the trait `Future` is not implemented for `()` -note: required by `poll` - --> $SRC_DIR/core/src/future/future.rs:LL:COL - | -LL | fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/async-await/issue-84841.stderr b/src/test/ui/async-await/issue-84841.stderr index e28ba74eb6339..ef5d95e67005a 100644 --- a/src/test/ui/async-await/issue-84841.stderr +++ b/src/test/ui/async-await/issue-84841.stderr @@ -5,11 +5,6 @@ LL | test()?; | ^^^^^^^ the `?` operator cannot be applied to type `impl Future` | = help: the trait `Try` is not implemented for `impl Future` -note: required by `branch` - --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL - | -LL | fn branch(self) -> ControlFlow; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the `?` operator can only be used in an async function that returns `Result` or `Option` (or another type that implements `FromResidual`) --> $DIR/issue-84841.rs:9:11 @@ -25,11 +20,6 @@ LL | | } | |_- this function should return `Result` or `Option` to accept `?` | = help: the trait `FromResidual<_>` is not implemented for `()` -note: required by `from_residual` - --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL - | -LL | fn from_residual(residual: R) -> Self; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/async-await/issues/issue-62009-1.stderr b/src/test/ui/async-await/issues/issue-62009-1.stderr index 946b8d19e6936..e2ea72a1e6178 100644 --- a/src/test/ui/async-await/issues/issue-62009-1.stderr +++ b/src/test/ui/async-await/issues/issue-62009-1.stderr @@ -34,11 +34,6 @@ LL | (|_| 2333).await; | ^^^^^^^^^^^^^^^^ `[closure@$DIR/issue-62009-1.rs:12:5: 12:15]` is not a future | = help: the trait `Future` is not implemented for `[closure@$DIR/issue-62009-1.rs:12:5: 12:15]` -note: required by `poll` - --> $SRC_DIR/core/src/future/future.rs:LL:COL - | -LL | fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/async-await/pin-needed-to-poll-2.stderr b/src/test/ui/async-await/pin-needed-to-poll-2.stderr index b63ea106d9026..83d1a02c876b1 100644 --- a/src/test/ui/async-await/pin-needed-to-poll-2.stderr +++ b/src/test/ui/async-await/pin-needed-to-poll-2.stderr @@ -12,11 +12,11 @@ note: required because it appears within the type `Sleep` | LL | struct Sleep(std::marker::PhantomPinned); | ^^^^^ -note: required by `Pin::

::new` +note: required by a bound in `Pin::

::new` --> $SRC_DIR/core/src/pin.rs:LL:COL | -LL | pub const fn new(pointer: P) -> Pin

{ - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | impl> Pin

{ + | ^^^^^ required by this bound in `Pin::

::new` error: aborting due to previous error diff --git a/src/test/ui/async-await/try-on-option-in-async.stderr b/src/test/ui/async-await/try-on-option-in-async.stderr index e8bb4aca9a9c9..a55850d76c3d8 100644 --- a/src/test/ui/async-await/try-on-option-in-async.stderr +++ b/src/test/ui/async-await/try-on-option-in-async.stderr @@ -11,11 +11,6 @@ LL | | } | |_____- this function should return `Result` or `Option` to accept `?` | = help: the trait `FromResidual>` is not implemented for `{integer}` -note: required by `from_residual` - --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL - | -LL | fn from_residual(residual: R) -> Self; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the `?` operator can only be used in an async closure that returns `Result` or `Option` (or another type that implements `FromResidual`) --> $DIR/try-on-option-in-async.rs:17:10 @@ -30,11 +25,6 @@ LL | | }; | |_____- this function should return `Result` or `Option` to accept `?` | = help: the trait `FromResidual>` is not implemented for `u32` -note: required by `from_residual` - --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL - | -LL | fn from_residual(residual: R) -> Self; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the `?` operator can only be used in an async function that returns `Result` or `Option` (or another type that implements `FromResidual`) --> $DIR/try-on-option-in-async.rs:26:6 @@ -49,11 +39,6 @@ LL | | } | |_- this function should return `Result` or `Option` to accept `?` | = help: the trait `FromResidual>` is not implemented for `u32` -note: required by `from_residual` - --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL - | -LL | fn from_residual(residual: R) -> Self; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/attributes/key-value-expansion.stderr b/src/test/ui/attributes/key-value-expansion.stderr index e59216fe90270..878afb39214ad 100644 --- a/src/test/ui/attributes/key-value-expansion.stderr +++ b/src/test/ui/attributes/key-value-expansion.stderr @@ -16,15 +16,15 @@ LL | bug!(); = note: this error originates in the macro `bug` (in Nightly builds, run with -Z macro-backtrace for more info) error: unexpected token: `{ - let res = - ::alloc::fmt::format(::core::fmt::Arguments::new_v1(&[""], - &match (&"u8",) { - _args => - [::core::fmt::ArgumentV1::new(_args.0, - ::core::fmt::Display::fmt)], - })); - res -}.as_str()` + let res = + ::alloc::fmt::format(::core::fmt::Arguments::new_v1(&[""], + &match (&"u8",) { + _args => + [::core::fmt::ArgumentV1::new(_args.0, + ::core::fmt::Display::fmt)], + })); + res + }.as_str()` --> $DIR/key-value-expansion.rs:48:23 | LL | doc_comment! {format!("{coor}", coor = stringify!($t1)).as_str()} diff --git a/src/test/ui/borrowck/regions-bound-missing-bound-in-impl.stderr b/src/test/ui/borrowck/regions-bound-missing-bound-in-impl.stderr index 536fd43ef75e8..1e3b071ef9292 100644 --- a/src/test/ui/borrowck/regions-bound-missing-bound-in-impl.stderr +++ b/src/test/ui/borrowck/regions-bound-missing-bound-in-impl.stderr @@ -64,13 +64,13 @@ LL | fn wrong_bound2(self, b: Inv, c: Inv, d: Inv) { | ^ lifetimes do not match method in trait error[E0276]: impl has stricter requirements than trait - --> $DIR/regions-bound-missing-bound-in-impl.rs:49:5 + --> $DIR/regions-bound-missing-bound-in-impl.rs:49:26 | LL | fn another_bound<'x: 'a>(self, x: Inv<'x>, y: Inv<'t>); | ------------------------------------------------------- definition of `another_bound` from trait ... LL | fn another_bound<'x: 't>(self, x: Inv<'x>, y: Inv<'t>) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `'x: 't` + | ^^ impl has extra requirement `'x: 't` error: aborting due to 6 previous errors diff --git a/src/test/ui/box/into-boxed-slice-fail.stderr b/src/test/ui/box/into-boxed-slice-fail.stderr index 2f1dec9d2090c..de654fdc1a4b5 100644 --- a/src/test/ui/box/into-boxed-slice-fail.stderr +++ b/src/test/ui/box/into-boxed-slice-fail.stderr @@ -7,11 +7,11 @@ LL | let _ = Box::into_boxed_slice(boxed_slice); | required by a bound introduced by this call | = help: the trait `Sized` is not implemented for `[u8]` -note: required by `Box::::into_boxed_slice` +note: required by a bound in `Box::::into_boxed_slice` --> $SRC_DIR/alloc/src/boxed.rs:LL:COL | -LL | pub fn into_boxed_slice(boxed: Self) -> Box<[T], A> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | impl Box { + | ^ required by this bound in `Box::::into_boxed_slice` error[E0277]: the size for values of type `[u8]` cannot be known at compilation time --> $DIR/into-boxed-slice-fail.rs:7:13 @@ -31,11 +31,11 @@ LL | let _ = Box::into_boxed_slice(boxed_trait); | required by a bound introduced by this call | = help: the trait `Sized` is not implemented for `dyn Debug` -note: required by `Box::::into_boxed_slice` +note: required by a bound in `Box::::into_boxed_slice` --> $SRC_DIR/alloc/src/boxed.rs:LL:COL | -LL | pub fn into_boxed_slice(boxed: Self) -> Box<[T], A> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | impl Box { + | ^ required by this bound in `Box::::into_boxed_slice` error[E0277]: the size for values of type `dyn Debug` cannot be known at compilation time --> $DIR/into-boxed-slice-fail.rs:11:13 diff --git a/src/test/ui/chalkify/type_wf.stderr b/src/test/ui/chalkify/type_wf.stderr index ebd885a7d323f..57902efa2015c 100644 --- a/src/test/ui/chalkify/type_wf.stderr +++ b/src/test/ui/chalkify/type_wf.stderr @@ -7,11 +7,11 @@ LL | let s = S { = help: the following implementations were found: as Foo> -note: required by `S` - --> $DIR/type_wf.rs:6:1 +note: required by a bound in `S` + --> $DIR/type_wf.rs:6:13 | LL | struct S { - | ^^^^^^^^^^^^^^^^ + | ^^^ required by this bound in `S` error: aborting due to previous error diff --git a/src/test/ui/closures/closure-expected.stderr b/src/test/ui/closures/closure-expected.stderr index d4f230780436e..8b38d5ff4592c 100644 --- a/src/test/ui/closures/closure-expected.stderr +++ b/src/test/ui/closures/closure-expected.stderr @@ -8,6 +8,11 @@ LL | let y = x.or_else(4); | = help: the trait `FnOnce<()>` is not implemented for `{integer}` = note: wrap the `{integer}` in a closure with no arguments: `|| { /* code */ }` +note: required by a bound in `Option::::or_else` + --> $SRC_DIR/core/src/option.rs:LL:COL + | +LL | pub fn or_else Option>(self, f: F) -> Option { + | ^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Option::::or_else` error: aborting due to previous error diff --git a/src/test/ui/closures/coerce-unsafe-to-closure.stderr b/src/test/ui/closures/coerce-unsafe-to-closure.stderr index 4a47e0549155f..24db272534730 100644 --- a/src/test/ui/closures/coerce-unsafe-to-closure.stderr +++ b/src/test/ui/closures/coerce-unsafe-to-closure.stderr @@ -7,6 +7,11 @@ LL | let x: Option<&[u8]> = Some("foo").map(std::mem::transmute); | required by a bound introduced by this call | = help: the trait `FnOnce<(&str,)>` is not implemented for `unsafe extern "rust-intrinsic" fn(_) -> _ {transmute::<_, _>}` +note: required by a bound in `Option::::map` + --> $SRC_DIR/core/src/option.rs:LL:COL + | +LL | pub fn map U>(self, f: F) -> Option { + | ^^^^^^^^^^^^^^ required by this bound in `Option::::map` error: aborting due to previous error diff --git a/src/test/ui/cmse-nonsecure/cmse-nonsecure-call/params-on-stack.stderr b/src/test/ui/cmse-nonsecure/cmse-nonsecure-call/params-on-stack.stderr index c90641840755d..37230078781ed 100644 --- a/src/test/ui/cmse-nonsecure/cmse-nonsecure-call/params-on-stack.stderr +++ b/src/test/ui/cmse-nonsecure/cmse-nonsecure-call/params-on-stack.stderr @@ -1,5 +1,4 @@ error: :0:0: in function test i32 (i32, i32, i32, i32, i32): call to non-secure function would require passing arguments on stack - error: aborting due to previous error diff --git a/src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/params-on-stack.stderr b/src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/params-on-stack.stderr index d9956acbe7577..1054c26651270 100644 --- a/src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/params-on-stack.stderr +++ b/src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/params-on-stack.stderr @@ -1,5 +1,4 @@ error: :0:0: in function entry_function i32 (i32, i32, i32, i32, i32): secure entry function requires arguments on stack - error: aborting due to previous error diff --git a/src/test/ui/coherence/coherence-overlap-trait-alias.stderr b/src/test/ui/coherence/coherence-overlap-trait-alias.stderr index affc58b84d46d..5b389f24bf151 100644 --- a/src/test/ui/coherence/coherence-overlap-trait-alias.stderr +++ b/src/test/ui/coherence/coherence-overlap-trait-alias.stderr @@ -12,11 +12,6 @@ LL | impl C for T {} LL | #[rustc_strict_coherence] LL | impl C for u32 {} | ^^^^^^^^^^^^^^ -note: required by a bound in `C` - --> $DIR/coherence-overlap-trait-alias.rs:11:1 - | -LL | trait C {} - | ^^^^^^^ required by this bound in `C` error: aborting due to previous error diff --git a/src/test/ui/compare-method/proj-outlives-region.stderr b/src/test/ui/compare-method/proj-outlives-region.stderr index e5f5c5ed20d55..797a8167931f8 100644 --- a/src/test/ui/compare-method/proj-outlives-region.stderr +++ b/src/test/ui/compare-method/proj-outlives-region.stderr @@ -1,11 +1,11 @@ error[E0276]: impl has stricter requirements than trait - --> $DIR/proj-outlives-region.rs:9:5 + --> $DIR/proj-outlives-region.rs:9:23 | LL | fn foo() where T: 'a; | --------------------- definition of `foo` from trait ... LL | fn foo() where U: 'a { } - | ^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `U: 'a` + | ^^ impl has extra requirement `U: 'a` error: aborting due to previous error diff --git a/src/test/ui/compare-method/region-extra-2.stderr b/src/test/ui/compare-method/region-extra-2.stderr index 420d99c15ec99..f01d7f4710c38 100644 --- a/src/test/ui/compare-method/region-extra-2.stderr +++ b/src/test/ui/compare-method/region-extra-2.stderr @@ -1,11 +1,11 @@ error[E0276]: impl has stricter requirements than trait - --> $DIR/region-extra-2.rs:9:5 + --> $DIR/region-extra-2.rs:9:53 | LL | fn renew<'b: 'a>(self) -> &'b mut [T]; | -------------------------------------- definition of `renew` from trait ... LL | fn renew<'b: 'a>(self) -> &'b mut [T] where 'a: 'b { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `'a: 'b` + | ^^ impl has extra requirement `'a: 'b` error: aborting due to previous error diff --git a/src/test/ui/compare-method/region-extra.stderr b/src/test/ui/compare-method/region-extra.stderr index 5a584c7d6ed9f..4a3af65e9042b 100644 --- a/src/test/ui/compare-method/region-extra.stderr +++ b/src/test/ui/compare-method/region-extra.stderr @@ -1,11 +1,11 @@ error[E0276]: impl has stricter requirements than trait - --> $DIR/region-extra.rs:9:5 + --> $DIR/region-extra.rs:9:24 | LL | fn foo(); | --------- definition of `foo` from trait ... LL | fn foo() where 'a: 'b { } - | ^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `'a: 'b` + | ^^ impl has extra requirement `'a: 'b` error: aborting due to previous error diff --git a/src/test/ui/compare-method/region-unrelated.stderr b/src/test/ui/compare-method/region-unrelated.stderr index fd3576ddcf1b5..f7ae6f94438e2 100644 --- a/src/test/ui/compare-method/region-unrelated.stderr +++ b/src/test/ui/compare-method/region-unrelated.stderr @@ -1,11 +1,11 @@ error[E0276]: impl has stricter requirements than trait - --> $DIR/region-unrelated.rs:9:5 + --> $DIR/region-unrelated.rs:9:23 | LL | fn foo() where T: 'a; | --------------------- definition of `foo` from trait ... LL | fn foo() where V: 'a { } - | ^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `V: 'a` + | ^^ impl has extra requirement `V: 'a` error: aborting due to previous error diff --git a/src/test/ui/compare-method/trait-bound-on-type-parameter.stderr b/src/test/ui/compare-method/trait-bound-on-type-parameter.stderr index 83a2ae6068109..ce6885c1541f7 100644 --- a/src/test/ui/compare-method/trait-bound-on-type-parameter.stderr +++ b/src/test/ui/compare-method/trait-bound-on-type-parameter.stderr @@ -1,11 +1,11 @@ error[E0276]: impl has stricter requirements than trait - --> $DIR/trait-bound-on-type-parameter.rs:15:5 + --> $DIR/trait-bound-on-type-parameter.rs:15:13 | LL | fn b(&self, x: C) -> C; | ---------------------------- definition of `b` from trait ... LL | fn b(&self, _x: F) -> F { panic!() } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `F: Sync` + | ^^^^ impl has extra requirement `F: Sync` error: aborting due to previous error diff --git a/src/test/ui/compare-method/traits-misc-mismatch-1.stderr b/src/test/ui/compare-method/traits-misc-mismatch-1.stderr index da94fc658410a..805c04536cac7 100644 --- a/src/test/ui/compare-method/traits-misc-mismatch-1.stderr +++ b/src/test/ui/compare-method/traits-misc-mismatch-1.stderr @@ -1,65 +1,65 @@ error[E0276]: impl has stricter requirements than trait - --> $DIR/traits-misc-mismatch-1.rs:27:5 + --> $DIR/traits-misc-mismatch-1.rs:27:26 | LL | fn test_error1_fn(&self); | -------------------------------- definition of `test_error1_fn` from trait ... LL | fn test_error1_fn(&self) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: Ord` + | ^^^ impl has extra requirement `T: Ord` error[E0276]: impl has stricter requirements than trait - --> $DIR/traits-misc-mismatch-1.rs:31:5 + --> $DIR/traits-misc-mismatch-1.rs:31:31 | LL | fn test_error2_fn(&self); | -------------------------------------- definition of `test_error2_fn` from trait ... LL | fn test_error2_fn(&self) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: B` + | ^ impl has extra requirement `T: B` error[E0276]: impl has stricter requirements than trait - --> $DIR/traits-misc-mismatch-1.rs:35:5 + --> $DIR/traits-misc-mismatch-1.rs:35:26 | LL | fn test_error3_fn(&self); | -------------------------------------- definition of `test_error3_fn` from trait ... LL | fn test_error3_fn(&self) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: B` + | ^ impl has extra requirement `T: B` error[E0276]: impl has stricter requirements than trait - --> $DIR/traits-misc-mismatch-1.rs:45:5 + --> $DIR/traits-misc-mismatch-1.rs:45:26 | LL | fn test_error5_fn(&self); | ------------------------------- definition of `test_error5_fn` from trait ... LL | fn test_error5_fn(&self) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: B` + | ^ impl has extra requirement `T: B` error[E0276]: impl has stricter requirements than trait - --> $DIR/traits-misc-mismatch-1.rs:51:5 + --> $DIR/traits-misc-mismatch-1.rs:51:30 | LL | fn test_error7_fn(&self); | ------------------------------- definition of `test_error7_fn` from trait ... LL | fn test_error7_fn(&self) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: Eq` + | ^^ impl has extra requirement `T: Eq` error[E0276]: impl has stricter requirements than trait - --> $DIR/traits-misc-mismatch-1.rs:54:5 + --> $DIR/traits-misc-mismatch-1.rs:54:26 | LL | fn test_error8_fn(&self); | ------------------------------- definition of `test_error8_fn` from trait ... LL | fn test_error8_fn(&self) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: C` + | ^ impl has extra requirement `T: C` error[E0276]: impl has stricter requirements than trait - --> $DIR/traits-misc-mismatch-1.rs:67:5 + --> $DIR/traits-misc-mismatch-1.rs:67:18 | LL | fn method>(&self); | ---------------------------------- definition of `method` from trait ... LL | fn method>(&self) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `G: Getter` + | ^^^^^^^^^^^^^ impl has extra requirement `G: Getter` error: aborting due to 7 previous errors diff --git a/src/test/ui/compare-method/traits-misc-mismatch-2.stderr b/src/test/ui/compare-method/traits-misc-mismatch-2.stderr index acf94ad32b1df..36bb764d40eb4 100644 --- a/src/test/ui/compare-method/traits-misc-mismatch-2.stderr +++ b/src/test/ui/compare-method/traits-misc-mismatch-2.stderr @@ -1,11 +1,11 @@ error[E0276]: impl has stricter requirements than trait - --> $DIR/traits-misc-mismatch-2.rs:13:5 + --> $DIR/traits-misc-mismatch-2.rs:13:18 | LL | fn zip>(self, other: U) -> ZipIterator; | ------------------------------------------------------------------ definition of `zip` from trait ... LL | fn zip>(self, other: U) -> ZipIterator { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `U: Iterator` + | ^^^^^^^^^^^ impl has extra requirement `U: Iterator` error: aborting due to previous error diff --git a/src/test/ui/const-generics/defaults/wfness.stderr b/src/test/ui/const-generics/defaults/wfness.stderr index 9826af8802a27..2d400f9bbf521 100644 --- a/src/test/ui/const-generics/defaults/wfness.stderr +++ b/src/test/ui/const-generics/defaults/wfness.stderr @@ -12,11 +12,6 @@ LL | struct WhereClause where (): Trait; | = help: the following implementations were found: <() as Trait<3_u8>> -note: required by `WhereClause` - --> $DIR/wfness.rs:8:1 - | -LL | struct WhereClause where (): Trait; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `(): Trait<1_u8>` is not satisfied --> $DIR/wfness.rs:16:13 diff --git a/src/test/ui/const-generics/dont-evaluate-array-len-on-err-1.stderr b/src/test/ui/const-generics/dont-evaluate-array-len-on-err-1.stderr index 09986f623fc4b..68ce61bd4a374 100644 --- a/src/test/ui/const-generics/dont-evaluate-array-len-on-err-1.stderr +++ b/src/test/ui/const-generics/dont-evaluate-array-len-on-err-1.stderr @@ -3,12 +3,6 @@ error[E0277]: the trait bound `[Adt; _]: Foo` is not satisfied | LL | <[Adt; std::mem::size_of::()] as Foo>::bar() | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `[Adt; _]` - | -note: required by `Foo::bar` - --> $DIR/dont-evaluate-array-len-on-err-1.rs:19:5 - | -LL | fn bar() {} - | ^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/const-generics/exhaustive-value.stderr b/src/test/ui/const-generics/exhaustive-value.stderr index 0c6aced4bc22b..1a8f4abf52aa3 100644 --- a/src/test/ui/const-generics/exhaustive-value.stderr +++ b/src/test/ui/const-generics/exhaustive-value.stderr @@ -10,11 +10,6 @@ LL | <() as Foo>::test() <() as Foo<101_u8>> <() as Foo<102_u8>> and 252 others -note: required by `Foo::test` - --> $DIR/exhaustive-value.rs:2:5 - | -LL | fn test() {} - | ^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-72787.min.stderr b/src/test/ui/const-generics/generic_const_exprs/issue-72787.min.stderr index 3c7a740e8434a..02dce4f7a97e8 100644 --- a/src/test/ui/const-generics/generic_const_exprs/issue-72787.min.stderr +++ b/src/test/ui/const-generics/generic_const_exprs/issue-72787.min.stderr @@ -41,11 +41,6 @@ LL | IsLessOrEqual: True, | ^^^^ cannot infer type for struct `IsLessOrEqual` | = note: cannot satisfy `IsLessOrEqual: True` -note: required by a bound in `True` - --> $DIR/issue-72787.rs:8:1 - | -LL | pub trait True {} - | ^^^^^^^^^^^^^^ required by this bound in `True` error[E0283]: type annotations needed --> $DIR/issue-72787.rs:21:26 @@ -54,11 +49,6 @@ LL | IsLessOrEqual: True, | ^^^^ cannot infer type for struct `IsLessOrEqual` | = note: cannot satisfy `IsLessOrEqual: True` -note: required by a bound in `True` - --> $DIR/issue-72787.rs:8:1 - | -LL | pub trait True {} - | ^^^^^^^^^^^^^^ required by this bound in `True` error: aborting due to 6 previous errors diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-83765.stderr b/src/test/ui/const-generics/generic_const_exprs/issue-83765.stderr index ef785bf07ebbf..0332e82fe0727 100644 --- a/src/test/ui/const-generics/generic_const_exprs/issue-83765.stderr +++ b/src/test/ui/const-generics/generic_const_exprs/issue-83765.stderr @@ -14,6 +14,11 @@ LL | self.reference.size() | ^^^^ | = help: try adding a `where` bound using this expression: `where [(); Self::DIM]:` +note: required by a bound in `TensorSize::size` + --> $DIR/issue-83765.rs:9:31 + | +LL | fn size(&self) -> [usize; Self::DIM]; + | ^^^^^^^^^ required by this bound in `TensorSize::size` error[E0308]: mismatched types --> $DIR/issue-83765.rs:32:9 diff --git a/src/test/ui/const-generics/occurs-check/unused-substs-1.stderr b/src/test/ui/const-generics/occurs-check/unused-substs-1.stderr index 382dd0ee5a64e..486a298a9ffe5 100644 --- a/src/test/ui/const-generics/occurs-check/unused-substs-1.stderr +++ b/src/test/ui/const-generics/occurs-check/unused-substs-1.stderr @@ -6,13 +6,11 @@ LL | let _ = A; | = help: the following implementations were found: as Bar> -note: required by `A` - --> $DIR/unused-substs-1.rs:7:1 +note: required by a bound in `A` + --> $DIR/unused-substs-1.rs:9:11 | -LL | / struct A -LL | | where -LL | | A: Bar; - | |_________________^ +LL | A: Bar; + | ^^^^^^ required by this bound in `A` error: aborting due to previous error diff --git a/src/test/ui/consts/const-eval/simd/insert_extract.rs b/src/test/ui/consts/const-eval/simd/insert_extract.rs index cae8fcf1068ad..a1d6c5e51b498 100644 --- a/src/test/ui/consts/const-eval/simd/insert_extract.rs +++ b/src/test/ui/consts/const-eval/simd/insert_extract.rs @@ -7,7 +7,9 @@ #[repr(simd)] struct i8x1(i8); #[repr(simd)] struct u16x2(u16, u16); -#[repr(simd)] struct f32x4(f32, f32, f32, f32); +// Make some of them array types to ensure those also work. +#[repr(simd)] struct i8x1_arr([i8; 1]); +#[repr(simd)] struct f32x4([f32; 4]); extern "platform-intrinsic" { #[rustc_const_stable(feature = "foo", since = "1.3.37")] @@ -25,6 +27,14 @@ fn main() { assert_eq!(X0, 42); assert_eq!(Y0, 42); } + { + const U: i8x1_arr = i8x1_arr([13]); + const V: i8x1_arr = unsafe { simd_insert(U, 0_u32, 42_i8) }; + const X0: i8 = V.0[0]; + const Y0: i8 = unsafe { simd_extract(V, 0) }; + assert_eq!(X0, 42); + assert_eq!(Y0, 42); + } { const U: u16x2 = u16x2(13, 14); const V: u16x2 = unsafe { simd_insert(U, 1_u32, 42_u16) }; @@ -38,12 +48,12 @@ fn main() { assert_eq!(Y1, 42); } { - const U: f32x4 = f32x4(13., 14., 15., 16.); + const U: f32x4 = f32x4([13., 14., 15., 16.]); const V: f32x4 = unsafe { simd_insert(U, 1_u32, 42_f32) }; - const X0: f32 = V.0; - const X1: f32 = V.1; - const X2: f32 = V.2; - const X3: f32 = V.3; + const X0: f32 = V.0[0]; + const X1: f32 = V.0[1]; + const X2: f32 = V.0[2]; + const X3: f32 = V.0[3]; const Y0: f32 = unsafe { simd_extract(V, 0) }; const Y1: f32 = unsafe { simd_extract(V, 1) }; const Y2: f32 = unsafe { simd_extract(V, 2) }; diff --git a/src/test/ui/derives/derive-assoc-type-not-impl.stderr b/src/test/ui/derives/derive-assoc-type-not-impl.stderr index 1080f947732e4..45a906a39475b 100644 --- a/src/test/ui/derives/derive-assoc-type-not-impl.stderr +++ b/src/test/ui/derives/derive-assoc-type-not-impl.stderr @@ -13,12 +13,16 @@ LL | struct NotClone; LL | Bar:: { x: 1 }.clone(); | ^^^^^ method cannot be called on `Bar` due to unsatisfied trait bounds | - = note: the following trait bounds were not satisfied: - `NotClone: Clone` - which is required by `Bar: Clone` +note: the following trait bounds were not satisfied because of the requirements of the implementation of `Clone` for `_`: + `NotClone: Clone` + --> $DIR/derive-assoc-type-not-impl.rs:6:10 + | +LL | #[derive(Clone)] + | ^^^^^ = help: items from traits can only be used if the trait is implemented and in scope = note: the following trait defines an item `clone`, perhaps you need to implement it: candidate #1: `Clone` + = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `NotClone` with `#[derive(Clone)]` | LL | #[derive(Clone)] diff --git a/src/test/ui/derives/derives-span-Clone-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-Clone-enum-struct-variant.stderr index c5bc50e407b25..cc874576cb7b9 100644 --- a/src/test/ui/derives/derives-span-Clone-enum-struct-variant.stderr +++ b/src/test/ui/derives/derives-span-Clone-enum-struct-variant.stderr @@ -7,11 +7,6 @@ LL | #[derive(Clone)] LL | x: Error | ^^^^^^^^ the trait `Clone` is not implemented for `Error` | -note: required by `clone` - --> $SRC_DIR/core/src/clone.rs:LL:COL - | -LL | fn clone(&self) -> Self; - | ^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/derives/derives-span-Clone-enum.stderr b/src/test/ui/derives/derives-span-Clone-enum.stderr index a6dc818eb6fe4..a4870635de870 100644 --- a/src/test/ui/derives/derives-span-Clone-enum.stderr +++ b/src/test/ui/derives/derives-span-Clone-enum.stderr @@ -7,11 +7,6 @@ LL | #[derive(Clone)] LL | Error | ^^^^^ the trait `Clone` is not implemented for `Error` | -note: required by `clone` - --> $SRC_DIR/core/src/clone.rs:LL:COL - | -LL | fn clone(&self) -> Self; - | ^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/derives/derives-span-Clone-struct.stderr b/src/test/ui/derives/derives-span-Clone-struct.stderr index cf7b9ec276e25..4507eeccc3aee 100644 --- a/src/test/ui/derives/derives-span-Clone-struct.stderr +++ b/src/test/ui/derives/derives-span-Clone-struct.stderr @@ -7,11 +7,6 @@ LL | struct Struct { LL | x: Error | ^^^^^^^^ the trait `Clone` is not implemented for `Error` | -note: required by `clone` - --> $SRC_DIR/core/src/clone.rs:LL:COL - | -LL | fn clone(&self) -> Self; - | ^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/derives/derives-span-Clone-tuple-struct.stderr b/src/test/ui/derives/derives-span-Clone-tuple-struct.stderr index 80733d62730d7..a79be7f574d6f 100644 --- a/src/test/ui/derives/derives-span-Clone-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-Clone-tuple-struct.stderr @@ -7,11 +7,6 @@ LL | struct Struct( LL | Error | ^^^^^ the trait `Clone` is not implemented for `Error` | -note: required by `clone` - --> $SRC_DIR/core/src/clone.rs:LL:COL - | -LL | fn clone(&self) -> Self; - | ^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/derives/derives-span-Default-struct.stderr b/src/test/ui/derives/derives-span-Default-struct.stderr index c60b6ac456ebf..dd2cfaf89bb8f 100644 --- a/src/test/ui/derives/derives-span-Default-struct.stderr +++ b/src/test/ui/derives/derives-span-Default-struct.stderr @@ -7,11 +7,6 @@ LL | struct Struct { LL | x: Error | ^^^^^^^^ the trait `Default` is not implemented for `Error` | -note: required by `std::default::Default::default` - --> $SRC_DIR/core/src/default.rs:LL:COL - | -LL | fn default() -> Self; - | ^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/derives/derives-span-Default-tuple-struct.stderr b/src/test/ui/derives/derives-span-Default-tuple-struct.stderr index ed342f539da03..0674d635d3d0e 100644 --- a/src/test/ui/derives/derives-span-Default-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-Default-tuple-struct.stderr @@ -7,11 +7,6 @@ LL | struct Struct( LL | Error | ^^^^^ the trait `Default` is not implemented for `Error` | -note: required by `std::default::Default::default` - --> $SRC_DIR/core/src/default.rs:LL:COL - | -LL | fn default() -> Self; - | ^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/derives/derives-span-Hash-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-Hash-enum-struct-variant.stderr index 47c7f1c2c3340..7f24be959f019 100644 --- a/src/test/ui/derives/derives-span-Hash-enum-struct-variant.stderr +++ b/src/test/ui/derives/derives-span-Hash-enum-struct-variant.stderr @@ -7,11 +7,6 @@ LL | #[derive(Hash)] LL | x: Error | ^^^^^^^^ the trait `Hash` is not implemented for `Error` | -note: required by a bound in `std::hash::Hash::hash` - --> $SRC_DIR/core/src/hash/mod.rs:LL:COL - | -LL | fn hash(&self, state: &mut H); - | ^ required by this bound in `std::hash::Hash::hash` = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/derives/derives-span-Hash-enum.stderr b/src/test/ui/derives/derives-span-Hash-enum.stderr index 92f084b58e35b..ae2921a16b315 100644 --- a/src/test/ui/derives/derives-span-Hash-enum.stderr +++ b/src/test/ui/derives/derives-span-Hash-enum.stderr @@ -7,11 +7,6 @@ LL | #[derive(Hash)] LL | Error | ^^^^^ the trait `Hash` is not implemented for `Error` | -note: required by a bound in `std::hash::Hash::hash` - --> $SRC_DIR/core/src/hash/mod.rs:LL:COL - | -LL | fn hash(&self, state: &mut H); - | ^ required by this bound in `std::hash::Hash::hash` = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/derives/derives-span-Hash-struct.stderr b/src/test/ui/derives/derives-span-Hash-struct.stderr index c57cebe04ebcb..37b3af702a0c1 100644 --- a/src/test/ui/derives/derives-span-Hash-struct.stderr +++ b/src/test/ui/derives/derives-span-Hash-struct.stderr @@ -7,11 +7,6 @@ LL | struct Struct { LL | x: Error | ^^^^^^^^ the trait `Hash` is not implemented for `Error` | -note: required by a bound in `std::hash::Hash::hash` - --> $SRC_DIR/core/src/hash/mod.rs:LL:COL - | -LL | fn hash(&self, state: &mut H); - | ^ required by this bound in `std::hash::Hash::hash` = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/derives/derives-span-Hash-tuple-struct.stderr b/src/test/ui/derives/derives-span-Hash-tuple-struct.stderr index 200937f0c9fc3..18624667d25ee 100644 --- a/src/test/ui/derives/derives-span-Hash-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-Hash-tuple-struct.stderr @@ -7,11 +7,6 @@ LL | struct Struct( LL | Error | ^^^^^ the trait `Hash` is not implemented for `Error` | -note: required by a bound in `std::hash::Hash::hash` - --> $SRC_DIR/core/src/hash/mod.rs:LL:COL - | -LL | fn hash(&self, state: &mut H); - | ^ required by this bound in `std::hash::Hash::hash` = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/derives/derives-span-Ord-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-Ord-enum-struct-variant.stderr index 1e1cd715e6479..b52c5a0d6a504 100644 --- a/src/test/ui/derives/derives-span-Ord-enum-struct-variant.stderr +++ b/src/test/ui/derives/derives-span-Ord-enum-struct-variant.stderr @@ -7,11 +7,6 @@ LL | #[derive(Ord,Eq,PartialOrd,PartialEq)] LL | x: Error | ^^^^^^^^ the trait `Ord` is not implemented for `Error` | -note: required by `std::cmp::Ord::cmp` - --> $SRC_DIR/core/src/cmp.rs:LL:COL - | -LL | fn cmp(&self, other: &Self) -> Ordering; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/derives/derives-span-Ord-enum.stderr b/src/test/ui/derives/derives-span-Ord-enum.stderr index 43abe9a954738..2ea0496ea0db7 100644 --- a/src/test/ui/derives/derives-span-Ord-enum.stderr +++ b/src/test/ui/derives/derives-span-Ord-enum.stderr @@ -7,11 +7,6 @@ LL | #[derive(Ord,Eq,PartialOrd,PartialEq)] LL | Error | ^^^^^ the trait `Ord` is not implemented for `Error` | -note: required by `std::cmp::Ord::cmp` - --> $SRC_DIR/core/src/cmp.rs:LL:COL - | -LL | fn cmp(&self, other: &Self) -> Ordering; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/derives/derives-span-Ord-struct.stderr b/src/test/ui/derives/derives-span-Ord-struct.stderr index 44f6bab08c127..52cf0cf8cd75d 100644 --- a/src/test/ui/derives/derives-span-Ord-struct.stderr +++ b/src/test/ui/derives/derives-span-Ord-struct.stderr @@ -7,11 +7,6 @@ LL | struct Struct { LL | x: Error | ^^^^^^^^ the trait `Ord` is not implemented for `Error` | -note: required by `std::cmp::Ord::cmp` - --> $SRC_DIR/core/src/cmp.rs:LL:COL - | -LL | fn cmp(&self, other: &Self) -> Ordering; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/derives/derives-span-Ord-tuple-struct.stderr b/src/test/ui/derives/derives-span-Ord-tuple-struct.stderr index e604018245ae3..ecdf8d8cb5931 100644 --- a/src/test/ui/derives/derives-span-Ord-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-Ord-tuple-struct.stderr @@ -7,11 +7,6 @@ LL | struct Struct( LL | Error | ^^^^^ the trait `Ord` is not implemented for `Error` | -note: required by `std::cmp::Ord::cmp` - --> $SRC_DIR/core/src/cmp.rs:LL:COL - | -LL | fn cmp(&self, other: &Self) -> Ordering; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/derives/derives-span-PartialOrd-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-PartialOrd-enum-struct-variant.stderr index 9a716048e26aa..fc8eb1ebfd3e2 100644 --- a/src/test/ui/derives/derives-span-PartialOrd-enum-struct-variant.stderr +++ b/src/test/ui/derives/derives-span-PartialOrd-enum-struct-variant.stderr @@ -8,11 +8,6 @@ LL | x: Error | ^^^^^^^^ no implementation for `Error < Error` and `Error > Error` | = help: the trait `PartialOrd` is not implemented for `Error` -note: required by `std::cmp::PartialOrd::partial_cmp` - --> $SRC_DIR/core/src/cmp.rs:LL:COL - | -LL | fn partial_cmp(&self, other: &Rhs) -> Option; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/derives/derives-span-PartialOrd-enum.stderr b/src/test/ui/derives/derives-span-PartialOrd-enum.stderr index c726d33eab013..38053495a0572 100644 --- a/src/test/ui/derives/derives-span-PartialOrd-enum.stderr +++ b/src/test/ui/derives/derives-span-PartialOrd-enum.stderr @@ -8,11 +8,6 @@ LL | Error | ^^^^^ no implementation for `Error < Error` and `Error > Error` | = help: the trait `PartialOrd` is not implemented for `Error` -note: required by `std::cmp::PartialOrd::partial_cmp` - --> $SRC_DIR/core/src/cmp.rs:LL:COL - | -LL | fn partial_cmp(&self, other: &Rhs) -> Option; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/derives/derives-span-PartialOrd-struct.stderr b/src/test/ui/derives/derives-span-PartialOrd-struct.stderr index a56c163ca788a..1c07b98f983de 100644 --- a/src/test/ui/derives/derives-span-PartialOrd-struct.stderr +++ b/src/test/ui/derives/derives-span-PartialOrd-struct.stderr @@ -8,11 +8,6 @@ LL | x: Error | ^^^^^^^^ no implementation for `Error < Error` and `Error > Error` | = help: the trait `PartialOrd` is not implemented for `Error` -note: required by `std::cmp::PartialOrd::partial_cmp` - --> $SRC_DIR/core/src/cmp.rs:LL:COL - | -LL | fn partial_cmp(&self, other: &Rhs) -> Option; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/derives/derives-span-PartialOrd-tuple-struct.stderr b/src/test/ui/derives/derives-span-PartialOrd-tuple-struct.stderr index 7a0a52e582444..bf01252b07b8d 100644 --- a/src/test/ui/derives/derives-span-PartialOrd-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-PartialOrd-tuple-struct.stderr @@ -8,11 +8,6 @@ LL | Error | ^^^^^ no implementation for `Error < Error` and `Error > Error` | = help: the trait `PartialOrd` is not implemented for `Error` -note: required by `std::cmp::PartialOrd::partial_cmp` - --> $SRC_DIR/core/src/cmp.rs:LL:COL - | -LL | fn partial_cmp(&self, other: &Rhs) -> Option; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/derives/deriving-no-inner-impl-error-message.stderr b/src/test/ui/derives/deriving-no-inner-impl-error-message.stderr index e322db97fab49..d64b4509b260b 100644 --- a/src/test/ui/derives/deriving-no-inner-impl-error-message.stderr +++ b/src/test/ui/derives/deriving-no-inner-impl-error-message.stderr @@ -47,11 +47,6 @@ LL | struct C { LL | x: NoCloneOrEq | ^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `NoCloneOrEq` | -note: required by `clone` - --> $SRC_DIR/core/src/clone.rs:LL:COL - | -LL | fn clone(&self) -> Self; - | ^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 3 previous errors diff --git a/src/test/ui/did_you_mean/compatible-variants.rs b/src/test/ui/did_you_mean/compatible-variants.rs new file mode 100644 index 0000000000000..fb6b6a5673d90 --- /dev/null +++ b/src/test/ui/did_you_mean/compatible-variants.rs @@ -0,0 +1,43 @@ +enum Hey { + A(A), + B(B), +} + +fn f() {} + +fn a() -> Option<()> { + while false { + //~^ ERROR mismatched types + f(); + } + //~^ HELP try adding an expression +} + +fn b() -> Result<(), ()> { + f() + //~^ ERROR mismatched types + //~| HELP try adding an expression +} + +fn main() { + let _: Option<()> = while false {}; + //~^ ERROR mismatched types + //~| HELP try wrapping + let _: Option<()> = { + while false {} + //~^ ERROR mismatched types + //~| HELP try adding an expression + }; + let _: Result = 1; + //~^ ERROR mismatched types + //~| HELP try wrapping + let _: Option = 1; + //~^ ERROR mismatched types + //~| HELP try wrapping + let _: Hey = 1; + //~^ ERROR mismatched types + //~| HELP try wrapping + let _: Hey = false; + //~^ ERROR mismatched types + //~| HELP try wrapping +} diff --git a/src/test/ui/did_you_mean/compatible-variants.stderr b/src/test/ui/did_you_mean/compatible-variants.stderr new file mode 100644 index 0000000000000..e77949687fcb2 --- /dev/null +++ b/src/test/ui/did_you_mean/compatible-variants.stderr @@ -0,0 +1,137 @@ +error[E0308]: mismatched types + --> $DIR/compatible-variants.rs:9:5 + | +LL | fn a() -> Option<()> { + | ---------- expected `Option<()>` because of return type +LL | / while false { +LL | | +LL | | f(); +LL | | } + | |_____^ expected enum `Option`, found `()` + | + = note: expected enum `Option<()>` + found unit type `()` +help: try adding an expression at the end of the block + | +LL ~ } +LL + None + | +LL ~ } +LL + Some(()) + | + +error[E0308]: mismatched types + --> $DIR/compatible-variants.rs:17:5 + | +LL | fn b() -> Result<(), ()> { + | -------------- expected `Result<(), ()>` because of return type +LL | f() + | ^^^ expected enum `Result`, found `()` + | + = note: expected enum `Result<(), ()>` + found unit type `()` +help: try adding an expression at the end of the block + | +LL ~ f(); +LL + Ok(()) + | + +error[E0308]: mismatched types + --> $DIR/compatible-variants.rs:23:25 + | +LL | let _: Option<()> = while false {}; + | ---------- ^^^^^^^^^^^^^^ expected enum `Option`, found `()` + | | + | expected due to this + | + = note: expected enum `Option<()>` + found unit type `()` +help: try wrapping the expression in `Some` + | +LL | let _: Option<()> = Some(while false {}); + | +++++ + + +error[E0308]: mismatched types + --> $DIR/compatible-variants.rs:27:9 + | +LL | while false {} + | ^^^^^^^^^^^^^^ expected enum `Option`, found `()` + | + = note: expected enum `Option<()>` + found unit type `()` +help: try adding an expression at the end of the block + | +LL ~ while false {} +LL + None + | +LL ~ while false {} +LL + Some(()) + | + +error[E0308]: mismatched types + --> $DIR/compatible-variants.rs:31:31 + | +LL | let _: Result = 1; + | ---------------- ^ expected enum `Result`, found integer + | | + | expected due to this + | + = note: expected enum `Result` + found type `{integer}` +help: try wrapping the expression in a variant of `Result` + | +LL | let _: Result = Ok(1); + | +++ + +LL | let _: Result = Err(1); + | ++++ + + +error[E0308]: mismatched types + --> $DIR/compatible-variants.rs:34:26 + | +LL | let _: Option = 1; + | ----------- ^ expected enum `Option`, found integer + | | + | expected due to this + | + = note: expected enum `Option` + found type `{integer}` +help: try wrapping the expression in `Some` + | +LL | let _: Option = Some(1); + | +++++ + + +error[E0308]: mismatched types + --> $DIR/compatible-variants.rs:37:28 + | +LL | let _: Hey = 1; + | ------------- ^ expected enum `Hey`, found integer + | | + | expected due to this + | + = note: expected enum `Hey` + found type `{integer}` +help: try wrapping the expression in a variant of `Hey` + | +LL | let _: Hey = Hey::A(1); + | +++++++ + +LL | let _: Hey = Hey::B(1); + | +++++++ + + +error[E0308]: mismatched types + --> $DIR/compatible-variants.rs:40:29 + | +LL | let _: Hey = false; + | -------------- ^^^^^ expected enum `Hey`, found `bool` + | | + | expected due to this + | + = note: expected enum `Hey` + found type `bool` +help: try wrapping the expression in `Hey::B` + | +LL | let _: Hey = Hey::B(false); + | +++++++ + + +error: aborting due to 8 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.stderr b/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.stderr index c7458916c5364..5381a717dc3cf 100644 --- a/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.stderr +++ b/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.stderr @@ -12,11 +12,6 @@ LL | Foo::::bar(&1i8); > > > -note: required by `Foo::bar` - --> $DIR/issue-39802-show-5-trait-impls.rs:2:5 - | -LL | fn bar(&self){} - | ^^^^^^^^^^^^^ error[E0277]: the trait bound `u8: Foo` is not satisfied --> $DIR/issue-39802-show-5-trait-impls.rs:25:21 @@ -31,11 +26,6 @@ LL | Foo::::bar(&1u8); > > > -note: required by `Foo::bar` - --> $DIR/issue-39802-show-5-trait-impls.rs:2:5 - | -LL | fn bar(&self){} - | ^^^^^^^^^^^^^ error[E0277]: the trait bound `bool: Foo` is not satisfied --> $DIR/issue-39802-show-5-trait-impls.rs:26:21 @@ -51,11 +41,6 @@ LL | Foo::::bar(&true); > > and 2 others -note: required by `Foo::bar` - --> $DIR/issue-39802-show-5-trait-impls.rs:2:5 - | -LL | fn bar(&self){} - | ^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/did_you_mean/issue-42764.rs b/src/test/ui/did_you_mean/issue-42764.rs index 700f8128a939a..6da640b2b7c76 100644 --- a/src/test/ui/did_you_mean/issue-42764.rs +++ b/src/test/ui/did_you_mean/issue-42764.rs @@ -10,7 +10,7 @@ fn main() { let n: usize = 42; this_function_expects_a_double_option(n); //~^ ERROR mismatched types - //~| HELP try using a variant of the expected enum + //~| HELP try wrapping the expression in a variant of `DoubleOption` } diff --git a/src/test/ui/did_you_mean/issue-42764.stderr b/src/test/ui/did_you_mean/issue-42764.stderr index bc8a93757a599..dbe46704b9320 100644 --- a/src/test/ui/did_you_mean/issue-42764.stderr +++ b/src/test/ui/did_you_mean/issue-42764.stderr @@ -6,12 +6,12 @@ LL | this_function_expects_a_double_option(n); | = note: expected enum `DoubleOption<_>` found type `usize` -help: try using a variant of the expected enum +help: try wrapping the expression in a variant of `DoubleOption` | -LL | this_function_expects_a_double_option(DoubleOption::AlternativeSome(n)); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ LL | this_function_expects_a_double_option(DoubleOption::FirstSome(n)); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ++++++++++++++++++++++++ + +LL | this_function_expects_a_double_option(DoubleOption::AlternativeSome(n)); + | ++++++++++++++++++++++++++++++ + error[E0308]: mismatched types --> $DIR/issue-42764.rs:27:33 diff --git a/src/test/ui/empty/empty-attributes.rs b/src/test/ui/empty/empty-attributes.rs new file mode 100644 index 0000000000000..7e9b05587b075 --- /dev/null +++ b/src/test/ui/empty/empty-attributes.rs @@ -0,0 +1,14 @@ +#![deny(unused_attributes)] +#![allow()] //~ ERROR unused attribute +#![warn()] //~ ERROR unused attribute +#![deny()] //~ ERROR unused attribute +#![forbid()] //~ ERROR unused attribute +#![feature()] //~ ERROR unused attribute + +#[repr()] //~ ERROR unused attribute +pub struct S; + +#[target_feature()] //~ ERROR unused attribute +pub unsafe fn foo() {} + +fn main() {} diff --git a/src/test/ui/empty/empty-attributes.stderr b/src/test/ui/empty/empty-attributes.stderr new file mode 100644 index 0000000000000..e0798e4f0c69f --- /dev/null +++ b/src/test/ui/empty/empty-attributes.stderr @@ -0,0 +1,63 @@ +error: unused attribute + --> $DIR/empty-attributes.rs:8:1 + | +LL | #[repr()] + | ^^^^^^^^^ help: remove this attribute + | +note: the lint level is defined here + --> $DIR/empty-attributes.rs:1:9 + | +LL | #![deny(unused_attributes)] + | ^^^^^^^^^^^^^^^^^ + = note: attribute `repr` with an empty list has no effect + +error: unused attribute + --> $DIR/empty-attributes.rs:11:1 + | +LL | #[target_feature()] + | ^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | + = note: attribute `target_feature` with an empty list has no effect + +error: unused attribute + --> $DIR/empty-attributes.rs:2:1 + | +LL | #![allow()] + | ^^^^^^^^^^^ help: remove this attribute + | + = note: attribute `allow` with an empty list has no effect + +error: unused attribute + --> $DIR/empty-attributes.rs:3:1 + | +LL | #![warn()] + | ^^^^^^^^^^ help: remove this attribute + | + = note: attribute `warn` with an empty list has no effect + +error: unused attribute + --> $DIR/empty-attributes.rs:4:1 + | +LL | #![deny()] + | ^^^^^^^^^^ help: remove this attribute + | + = note: attribute `deny` with an empty list has no effect + +error: unused attribute + --> $DIR/empty-attributes.rs:5:1 + | +LL | #![forbid()] + | ^^^^^^^^^^^^ help: remove this attribute + | + = note: attribute `forbid` with an empty list has no effect + +error: unused attribute + --> $DIR/empty-attributes.rs:6:1 + | +LL | #![feature()] + | ^^^^^^^^^^^^^ help: remove this attribute + | + = note: attribute `feature` with an empty list has no effect + +error: aborting due to 7 previous errors + diff --git a/src/test/ui/error-codes/E0275.stderr b/src/test/ui/error-codes/E0275.stderr index e13f0961a18cf..dfffbb182ad31 100644 --- a/src/test/ui/error-codes/E0275.stderr +++ b/src/test/ui/error-codes/E0275.stderr @@ -12,11 +12,6 @@ LL | impl Foo for T where Bar: Foo {} | ^^^ ^ = note: 127 redundant requirements hidden = note: required because of the requirements on the impl of `Foo` for `Bar` -note: required by a bound in `Foo` - --> $DIR/E0275.rs:1:1 - | -LL | trait Foo {} - | ^^^^^^^^^ required by this bound in `Foo` error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0276.stderr b/src/test/ui/error-codes/E0276.stderr index 8857e1646eee0..1013f041bbe3c 100644 --- a/src/test/ui/error-codes/E0276.stderr +++ b/src/test/ui/error-codes/E0276.stderr @@ -1,11 +1,11 @@ error[E0276]: impl has stricter requirements than trait - --> $DIR/E0276.rs:6:5 + --> $DIR/E0276.rs:6:30 | LL | fn foo(x: T); | ---------------- definition of `foo` from trait ... LL | fn foo(x: T) where T: Copy {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: Copy` + | ^^^^ impl has extra requirement `T: Copy` error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0283.stderr b/src/test/ui/error-codes/E0283.stderr index 95437bf11adec..7dcfe96b35c9a 100644 --- a/src/test/ui/error-codes/E0283.stderr +++ b/src/test/ui/error-codes/E0283.stderr @@ -5,11 +5,6 @@ LL | let cont: u32 = Generator::create(); | ^^^^^^^^^^^^^^^^^ cannot infer type | = note: cannot satisfy `_: Generator` -note: required by `Generator::create` - --> $DIR/E0283.rs:2:5 - | -LL | fn create() -> u32; - | ^^^^^^^^^^^^^^^^^^^ error[E0283]: type annotations needed --> $DIR/E0283.rs:35:24 diff --git a/src/test/ui/expr/malformed_closure/ruby_style_closure.stderr b/src/test/ui/expr/malformed_closure/ruby_style_closure.stderr index 14d28b59648c1..53924e24e4638 100644 --- a/src/test/ui/expr/malformed_closure/ruby_style_closure.stderr +++ b/src/test/ui/expr/malformed_closure/ruby_style_closure.stderr @@ -20,6 +20,11 @@ LL | | }); | |_____^ expected an `FnOnce<({integer},)>` closure, found `Option<_>` | = help: the trait `FnOnce<({integer},)>` is not implemented for `Option<_>` +note: required by a bound in `Option::::and_then` + --> $SRC_DIR/core/src/option.rs:LL:COL + | +LL | pub fn and_then Option>(self, f: F) -> Option { + | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Option::::and_then` error: aborting due to 2 previous errors diff --git a/src/test/ui/feature-gates/feature-gate-associated_type_bounds.stderr b/src/test/ui/feature-gates/feature-gate-associated_type_bounds.stderr index 8df5fbcc7eba2..8c5d72d7efefb 100644 --- a/src/test/ui/feature-gates/feature-gate-associated_type_bounds.stderr +++ b/src/test/ui/feature-gates/feature-gate-associated_type_bounds.stderr @@ -139,13 +139,6 @@ error[E0277]: the trait bound `<::A as Iterator>::Item: Copy` is n LL | type A: Iterator; | ^^^^ the trait `Copy` is not implemented for `<::A as Iterator>::Item` | -note: required by a bound in `Copy` - --> $SRC_DIR/core/src/marker.rs:LL:COL - | -LL | / pub trait Copy: Clone { -LL | | // Empty. -LL | | } - | |_^ required by this bound in `Copy` help: consider further restricting the associated type | LL | trait _Tr3 where <::A as Iterator>::Item: Copy { diff --git a/src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.rs b/src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.rs index 44abe160f8716..1fe133ac2bc98 100644 --- a/src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.rs +++ b/src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.rs @@ -134,4 +134,27 @@ mod start { //~^ ERROR: `start` attribute can only be used on functions } +#[repr(C)] +//~^ ERROR: attribute should be applied to a struct, enum, or union +mod repr { +//~^ NOTE not a struct, enum, or union + mod inner { #![repr(C)] } + //~^ ERROR: attribute should be applied to a struct, enum, or union + //~| NOTE not a struct, enum, or union + + #[repr(C)] fn f() { } + //~^ ERROR: attribute should be applied to a struct, enum, or union + //~| NOTE not a struct, enum, or union + + struct S; + + #[repr(C)] type T = S; + //~^ ERROR: attribute should be applied to a struct, enum, or union + //~| NOTE not a struct, enum, or union + + #[repr(C)] impl S { } + //~^ ERROR: attribute should be applied to a struct, enum, or union + //~| NOTE not a struct, enum, or union +} + fn main() {} diff --git a/src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.stderr b/src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.stderr index aed1312155db5..9e2e2d4137d25 100644 --- a/src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.stderr +++ b/src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.stderr @@ -91,6 +91,21 @@ LL | | } LL | | } | |_- not a free function, impl method or static +error[E0517]: attribute should be applied to a struct, enum, or union + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:137:8 + | +LL | #[repr(C)] + | ^ +LL | +LL | / mod repr { +LL | | +LL | | mod inner { #![repr(C)] } +LL | | +... | +LL | | +LL | | } + | |_- not a struct, enum, or union + error: attribute should be applied to an `extern crate` item --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:25:1 | @@ -235,7 +250,31 @@ error: attribute should be applied to a free function, impl method or static LL | #[export_name = "2200"] fn bar() {} | ^^^^^^^^^^^^^^^^^^^^^^^ ----------- not a free function, impl method or static -error: aborting due to 34 previous errors +error[E0517]: attribute should be applied to a struct, enum, or union + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:141:25 + | +LL | mod inner { #![repr(C)] } + | --------------------^---- not a struct, enum, or union + +error[E0517]: attribute should be applied to a struct, enum, or union + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:145:12 + | +LL | #[repr(C)] fn f() { } + | ^ ---------- not a struct, enum, or union + +error[E0517]: attribute should be applied to a struct, enum, or union + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:151:12 + | +LL | #[repr(C)] type T = S; + | ^ ----------- not a struct, enum, or union + +error[E0517]: attribute should be applied to a struct, enum, or union + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:155:12 + | +LL | #[repr(C)] impl S { } + | ^ ---------- not a struct, enum, or union + +error: aborting due to 39 previous errors -Some errors have detailed explanations: E0518, E0658. -For more information about an error, try `rustc --explain E0518`. +Some errors have detailed explanations: E0517, E0518, E0658. +For more information about an error, try `rustc --explain E0517`. diff --git a/src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs.rs b/src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs.rs index 97fa775967da4..1ddf8508cc8cc 100644 --- a/src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs.rs +++ b/src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs.rs @@ -245,19 +245,6 @@ mod bench { impl S { } } -#[repr()] -mod repr { - mod inner { #![repr()] } - - #[repr()] fn f() { } - - struct S; - - #[repr()] type T = S; - - #[repr()] impl S { } -} - #[path = "3800"] mod path { mod inner { #![path="3800"] } diff --git a/src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr b/src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr index 214584f47e9ba..b98374bfa80cc 100644 --- a/src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr +++ b/src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr @@ -173,7 +173,7 @@ LL | #[deny(x5100)] impl S { } | ^^^^^ warning: `#[macro_escape]` is a deprecated synonym for `#[macro_use]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:412:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:399:17 | LL | mod inner { #![macro_escape] } | ^^^^^^^^^^^^^^^^ @@ -181,7 +181,7 @@ LL | mod inner { #![macro_escape] } = help: try an outer attribute: `#[macro_use]` warning: `#[macro_escape]` is a deprecated synonym for `#[macro_use]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:409:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:396:1 | LL | #[macro_escape] | ^^^^^^^^^^^^^^^ @@ -213,13 +213,13 @@ LL | #![warn(unused_attributes, unknown_lints)] | ^^^^^^^^^^^^^^^^^ warning: `#[automatically_derived]` only has an effect on items - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:278:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:265:1 | LL | #[automatically_derived] | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: attribute should be applied to a free function, impl method or static - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:296:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:283:1 | LL | #[no_mangle] | ^^^^^^^^^^^^ @@ -236,31 +236,31 @@ LL | | } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[should_panic]` only has an effect on functions - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:336:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:323:1 | LL | #[should_panic] | ^^^^^^^^^^^^^^^ warning: `#[ignore]` only has an effect on functions - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:354:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:341:1 | LL | #[ignore] | ^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:389:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:376:1 | LL | #[reexport_test_harness_main = "2900"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:429:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:416:1 | LL | #[no_std] | ^^^^^^^^^ warning: attribute should be applied to a function - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:465:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:452:1 | LL | #[cold] | ^^^^^^^ @@ -277,7 +277,7 @@ LL | | } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: attribute should be applied to a foreign function or static - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:494:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:481:1 | LL | #[link_name = "1900"] | ^^^^^^^^^^^^^^^^^^^^^ @@ -294,7 +294,7 @@ LL | | } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: attribute should be applied to a function or static - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:533:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:520:1 | LL | #[link_section = "1800"] | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -311,37 +311,37 @@ LL | | } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:624:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:611:1 | LL | #[crate_name = "0900"] | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:643:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:630:1 | LL | #[crate_type = "0800"] | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:662:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:649:1 | LL | #[feature(x0600)] | ^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:682:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:669:1 | LL | #[no_main] | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:714:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:701:1 | LL | #[recursion_limit="0200"] | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:733:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:720:1 | LL | #[type_length_limit="0100"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -443,55 +443,55 @@ LL | #[macro_export] impl S { } | ^^^^^^^^^^^^^^^ warning: `#[path]` only has an effect on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:265:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:252:5 | LL | #[path = "3800"] fn f() { } | ^^^^^^^^^^^^^^^^ warning: `#[path]` only has an effect on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:268:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:255:5 | LL | #[path = "3800"] struct S; | ^^^^^^^^^^^^^^^^ warning: `#[path]` only has an effect on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:271:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:258:5 | LL | #[path = "3800"] type T = S; | ^^^^^^^^^^^^^^^^ warning: `#[path]` only has an effect on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:274:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:261:5 | LL | #[path = "3800"] impl S { } | ^^^^^^^^^^^^^^^^ warning: `#[automatically_derived]` only has an effect on items - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:281:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:268:17 | LL | mod inner { #![automatically_derived] } | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: `#[automatically_derived]` only has an effect on items - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:284:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:271:5 | LL | #[automatically_derived] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: `#[automatically_derived]` only has an effect on items - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:287:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:274:5 | LL | #[automatically_derived] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: `#[automatically_derived]` only has an effect on items - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:290:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:277:5 | LL | #[automatically_derived] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: attribute should be applied to a free function, impl method or static - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:301:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:288:17 | LL | mod inner { #![no_mangle] } | ------------^^^^^^^^^^^^^-- not a free function, impl method or static @@ -499,7 +499,7 @@ LL | mod inner { #![no_mangle] } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: attribute should be applied to a free function, impl method or static - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:308:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:295:5 | LL | #[no_mangle] struct S; | ^^^^^^^^^^^^ --------- not a free function, impl method or static @@ -507,7 +507,7 @@ LL | #[no_mangle] struct S; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: attribute should be applied to a free function, impl method or static - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:313:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:300:5 | LL | #[no_mangle] type T = S; | ^^^^^^^^^^^^ ----------- not a free function, impl method or static @@ -515,7 +515,7 @@ LL | #[no_mangle] type T = S; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: attribute should be applied to a free function, impl method or static - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:318:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:305:5 | LL | #[no_mangle] impl S { } | ^^^^^^^^^^^^ ---------- not a free function, impl method or static @@ -523,7 +523,7 @@ LL | #[no_mangle] impl S { } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: attribute should be applied to a free function, impl method or static - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:324:9 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:311:9 | LL | #[no_mangle] fn foo(); | ^^^^^^^^^^^^ --------- not a free function, impl method or static @@ -531,7 +531,7 @@ LL | #[no_mangle] fn foo(); = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: attribute should be applied to a free function, impl method or static - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:329:9 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:316:9 | LL | #[no_mangle] fn bar() {} | ^^^^^^^^^^^^ ----------- not a free function, impl method or static @@ -539,163 +539,163 @@ LL | #[no_mangle] fn bar() {} = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[should_panic]` only has an effect on functions - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:339:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:326:17 | LL | mod inner { #![should_panic] } | ^^^^^^^^^^^^^^^^ warning: `#[should_panic]` only has an effect on functions - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:344:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:331:5 | LL | #[should_panic] struct S; | ^^^^^^^^^^^^^^^ warning: `#[should_panic]` only has an effect on functions - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:347:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:334:5 | LL | #[should_panic] type T = S; | ^^^^^^^^^^^^^^^ warning: `#[should_panic]` only has an effect on functions - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:350:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:337:5 | LL | #[should_panic] impl S { } | ^^^^^^^^^^^^^^^ warning: `#[ignore]` only has an effect on functions - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:357:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:344:17 | LL | mod inner { #![ignore] } | ^^^^^^^^^^ warning: `#[ignore]` only has an effect on functions - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:362:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:349:5 | LL | #[ignore] struct S; | ^^^^^^^^^ warning: `#[ignore]` only has an effect on functions - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:365:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:352:5 | LL | #[ignore] type T = S; | ^^^^^^^^^ warning: `#[ignore]` only has an effect on functions - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:368:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:355:5 | LL | #[ignore] impl S { } | ^^^^^^^^^ warning: `#[no_implicit_prelude]` only has an effect on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:376:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:363:5 | LL | #[no_implicit_prelude] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: `#[no_implicit_prelude]` only has an effect on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:379:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:366:5 | LL | #[no_implicit_prelude] struct S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: `#[no_implicit_prelude]` only has an effect on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:382:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:369:5 | LL | #[no_implicit_prelude] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: `#[no_implicit_prelude]` only has an effect on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:385:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:372:5 | LL | #[no_implicit_prelude] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:392:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:379:17 | LL | mod inner { #![reexport_test_harness_main="2900"] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:395:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:382:5 | LL | #[reexport_test_harness_main = "2900"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:398:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:385:5 | LL | #[reexport_test_harness_main = "2900"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:401:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:388:5 | LL | #[reexport_test_harness_main = "2900"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:404:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:391:5 | LL | #[reexport_test_harness_main = "2900"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: `#[macro_escape]` only has an effect on `extern crate` and modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:416:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:403:5 | LL | #[macro_escape] fn f() { } | ^^^^^^^^^^^^^^^ warning: `#[macro_escape]` only has an effect on `extern crate` and modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:419:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:406:5 | LL | #[macro_escape] struct S; | ^^^^^^^^^^^^^^^ warning: `#[macro_escape]` only has an effect on `extern crate` and modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:422:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:409:5 | LL | #[macro_escape] type T = S; | ^^^^^^^^^^^^^^^ warning: `#[macro_escape]` only has an effect on `extern crate` and modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:425:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:412:5 | LL | #[macro_escape] impl S { } | ^^^^^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:432:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:419:17 | LL | mod inner { #![no_std] } | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:435:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:422:5 | LL | #[no_std] fn f() { } | ^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:438:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:425:5 | LL | #[no_std] struct S; | ^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:441:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:428:5 | LL | #[no_std] type T = S; | ^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:444:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:431:5 | LL | #[no_std] impl S { } | ^^^^^^^^^ warning: attribute should be applied to a function - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:471:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:458:17 | LL | mod inner { #![cold] } | ------------^^^^^^^^-- not a function @@ -703,7 +703,7 @@ LL | mod inner { #![cold] } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: attribute should be applied to a function - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:478:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:465:5 | LL | #[cold] struct S; | ^^^^^^^ --------- not a function @@ -711,7 +711,7 @@ LL | #[cold] struct S; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: attribute should be applied to a function - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:483:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:470:5 | LL | #[cold] type T = S; | ^^^^^^^ ----------- not a function @@ -719,7 +719,7 @@ LL | #[cold] type T = S; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: attribute should be applied to a function - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:488:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:475:5 | LL | #[cold] impl S { } | ^^^^^^^ ---------- not a function @@ -727,7 +727,7 @@ LL | #[cold] impl S { } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: attribute should be applied to a foreign function or static - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:500:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:487:5 | LL | #[link_name = "1900"] | ^^^^^^^^^^^^^^^^^^^^^ @@ -737,13 +737,13 @@ LL | extern "C" { } | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! help: try `#[link(name = "1900")]` instead - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:500:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:487:5 | LL | #[link_name = "1900"] | ^^^^^^^^^^^^^^^^^^^^^ warning: attribute should be applied to a foreign function or static - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:507:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:494:17 | LL | mod inner { #![link_name="1900"] } | ------------^^^^^^^^^^^^^^^^^^^^-- not a foreign function or static @@ -751,7 +751,7 @@ LL | mod inner { #![link_name="1900"] } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: attribute should be applied to a foreign function or static - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:512:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:499:5 | LL | #[link_name = "1900"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^ ---------- not a foreign function or static @@ -759,7 +759,7 @@ LL | #[link_name = "1900"] fn f() { } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: attribute should be applied to a foreign function or static - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:517:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:504:5 | LL | #[link_name = "1900"] struct S; | ^^^^^^^^^^^^^^^^^^^^^ --------- not a foreign function or static @@ -767,7 +767,7 @@ LL | #[link_name = "1900"] struct S; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: attribute should be applied to a foreign function or static - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:522:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:509:5 | LL | #[link_name = "1900"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^ ----------- not a foreign function or static @@ -775,7 +775,7 @@ LL | #[link_name = "1900"] type T = S; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: attribute should be applied to a foreign function or static - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:527:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:514:5 | LL | #[link_name = "1900"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^ ---------- not a foreign function or static @@ -783,7 +783,7 @@ LL | #[link_name = "1900"] impl S { } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: attribute should be applied to a function or static - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:539:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:526:17 | LL | mod inner { #![link_section="1800"] } | ------------^^^^^^^^^^^^^^^^^^^^^^^-- not a function or static @@ -791,7 +791,7 @@ LL | mod inner { #![link_section="1800"] } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: attribute should be applied to a function or static - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:546:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:533:5 | LL | #[link_section = "1800"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^ --------- not a function or static @@ -799,7 +799,7 @@ LL | #[link_section = "1800"] struct S; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: attribute should be applied to a function or static - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:551:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:538:5 | LL | #[link_section = "1800"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^ ----------- not a function or static @@ -807,7 +807,7 @@ LL | #[link_section = "1800"] type T = S; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: attribute should be applied to a function or static - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:556:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:543:5 | LL | #[link_section = "1800"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^ ---------- not a function or static @@ -815,181 +815,181 @@ LL | #[link_section = "1800"] impl S { } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:627:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:614:17 | LL | mod inner { #![crate_name="0900"] } | ^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:630:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:617:5 | LL | #[crate_name = "0900"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:633:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:620:5 | LL | #[crate_name = "0900"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:636:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:623:5 | LL | #[crate_name = "0900"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:639:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:626:5 | LL | #[crate_name = "0900"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:646:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:633:17 | LL | mod inner { #![crate_type="0800"] } | ^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:649:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:636:5 | LL | #[crate_type = "0800"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:652:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:639:5 | LL | #[crate_type = "0800"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:655:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:642:5 | LL | #[crate_type = "0800"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:658:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:645:5 | LL | #[crate_type = "0800"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:665:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:652:17 | LL | mod inner { #![feature(x0600)] } | ^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:668:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:655:5 | LL | #[feature(x0600)] fn f() { } | ^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:671:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:658:5 | LL | #[feature(x0600)] struct S; | ^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:674:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:661:5 | LL | #[feature(x0600)] type T = S; | ^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:677:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:664:5 | LL | #[feature(x0600)] impl S { } | ^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:685:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:672:17 | LL | mod inner { #![no_main] } | ^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:688:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:675:5 | LL | #[no_main] fn f() { } | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:691:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:678:5 | LL | #[no_main] struct S; | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:694:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:681:5 | LL | #[no_main] type T = S; | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:697:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:684:5 | LL | #[no_main] impl S { } | ^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:717:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:704:17 | LL | mod inner { #![recursion_limit="0200"] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:720:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:707:5 | LL | #[recursion_limit="0200"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:723:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:710:5 | LL | #[recursion_limit="0200"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:726:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:713:5 | LL | #[recursion_limit="0200"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:729:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:716:5 | LL | #[recursion_limit="0200"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:736:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:723:17 | LL | mod inner { #![type_length_limit="0100"] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:739:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:726:5 | LL | #[type_length_limit="0100"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:742:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:729:5 | LL | #[type_length_limit="0100"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:745:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:732:5 | LL | #[type_length_limit="0100"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:748:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:735:5 | LL | #[type_length_limit="0100"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/fmt/ifmt-unimpl.stderr b/src/test/ui/fmt/ifmt-unimpl.stderr index 0a68c24b6067c..bee165437cb15 100644 --- a/src/test/ui/fmt/ifmt-unimpl.stderr +++ b/src/test/ui/fmt/ifmt-unimpl.stderr @@ -5,11 +5,6 @@ LL | format!("{:X}", "3"); | ^^^ the trait `UpperHex` is not implemented for `str` | = note: required because of the requirements on the impl of `UpperHex` for `&str` -note: required by `std::fmt::UpperHex::fmt` - --> $SRC_DIR/core/src/fmt/mod.rs:LL:COL - | -LL | fn fmt(&self, f: &mut Formatter<'_>) -> Result; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the macro `$crate::__export::format_args` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/for/for-c-in-str.rs b/src/test/ui/for/for-c-in-str.rs index 97a4ea53af583..86a1c1a34e930 100644 --- a/src/test/ui/for/for-c-in-str.rs +++ b/src/test/ui/for/for-c-in-str.rs @@ -6,8 +6,6 @@ fn main() { //~| NOTE `&str` is not an iterator //~| HELP the trait `Iterator` is not implemented for `&str` //~| NOTE required because of the requirements on the impl of `IntoIterator` for `&str` - //~| NOTE required by `into_iter` - //~| NOTE in this expansion of desugaring of `for` loop //~| NOTE in this expansion of desugaring of `for` loop //~| NOTE in this expansion of desugaring of `for` loop //~| NOTE in this expansion of desugaring of `for` loop diff --git a/src/test/ui/for/for-c-in-str.stderr b/src/test/ui/for/for-c-in-str.stderr index 7eac8c9c5a8df..07ddc8ea78f39 100644 --- a/src/test/ui/for/for-c-in-str.stderr +++ b/src/test/ui/for/for-c-in-str.stderr @@ -6,11 +6,6 @@ LL | for c in "asdf" { | = help: the trait `Iterator` is not implemented for `&str` = note: required because of the requirements on the impl of `IntoIterator` for `&str` -note: required by `into_iter` - --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/for/for-loop-bogosity.stderr b/src/test/ui/for/for-loop-bogosity.stderr index 288243325c48c..0bdd75b3555be 100644 --- a/src/test/ui/for/for-loop-bogosity.stderr +++ b/src/test/ui/for/for-loop-bogosity.stderr @@ -6,11 +6,6 @@ LL | for x in bogus { | = help: the trait `Iterator` is not implemented for `MyStruct` = note: required because of the requirements on the impl of `IntoIterator` for `MyStruct` -note: required by `into_iter` - --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/fully-qualified-type/fully-qualified-type-name1.stderr b/src/test/ui/fully-qualified-type/fully-qualified-type-name1.stderr index b5018b47b7bf7..03fb299b39cd2 100644 --- a/src/test/ui/fully-qualified-type/fully-qualified-type-name1.stderr +++ b/src/test/ui/fully-qualified-type/fully-qualified-type-name1.stderr @@ -2,13 +2,14 @@ error[E0308]: mismatched types --> $DIR/fully-qualified-type-name1.rs:5:9 | LL | x = 5; - | ^ - | | - | expected enum `Option`, found integer - | help: try using a variant of the expected enum: `Some(5)` + | ^ expected enum `Option`, found integer | = note: expected enum `Option` found type `{integer}` +help: try wrapping the expression in `Some` + | +LL | x = Some(5); + | +++++ + error: aborting due to previous error diff --git a/src/test/ui/fully-qualified-type/fully-qualified-type-name4.stderr b/src/test/ui/fully-qualified-type/fully-qualified-type-name4.stderr index b9574e3975816..778b13f24cf56 100644 --- a/src/test/ui/fully-qualified-type/fully-qualified-type-name4.stderr +++ b/src/test/ui/fully-qualified-type/fully-qualified-type-name4.stderr @@ -4,13 +4,14 @@ error[E0308]: mismatched types LL | fn bar(x: usize) -> Option { | ------------- expected `Option` because of return type LL | return x; - | ^ - | | - | expected enum `Option`, found `usize` - | help: try using a variant of the expected enum: `Some(x)` + | ^ expected enum `Option`, found `usize` | = note: expected enum `Option` found type `usize` +help: try wrapping the expression in `Some` + | +LL | return Some(x); + | +++++ + error: aborting due to previous error diff --git a/src/test/ui/generator/yield-outside-generator-issue-78653.stderr b/src/test/ui/generator/yield-outside-generator-issue-78653.stderr index dff743bc35b2d..ee1afbe5b5843 100644 --- a/src/test/ui/generator/yield-outside-generator-issue-78653.stderr +++ b/src/test/ui/generator/yield-outside-generator-issue-78653.stderr @@ -13,11 +13,6 @@ LL | yield || for i in 0 { } = help: the trait `Iterator` is not implemented for `{integer}` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` = note: required because of the requirements on the impl of `IntoIterator` for `{integer}` -note: required by `into_iter` - --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/generic-associated-types/impl_bounds.stderr b/src/test/ui/generic-associated-types/impl_bounds.stderr index f47b5f81e25b2..1c8a1f09af5a3 100644 --- a/src/test/ui/generic-associated-types/impl_bounds.stderr +++ b/src/test/ui/generic-associated-types/impl_bounds.stderr @@ -59,10 +59,10 @@ LL | impl Foo for Fooy { | +++++++++++++++++++ error[E0277]: the trait bound `T: Copy` is not satisfied - --> $DIR/impl_bounds.rs:22:5 + --> $DIR/impl_bounds.rs:22:24 | LL | fn d() where Self: Copy {} - | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `T` + | ^^^^ the trait `Copy` is not implemented for `T` | note: required because of the requirements on the impl of `Copy` for `Fooy` --> $DIR/impl_bounds.rs:11:10 diff --git a/src/test/ui/generic-associated-types/issue-86483.stderr b/src/test/ui/generic-associated-types/issue-86483.stderr index d6978794e1e95..2f29cd5d9e900 100644 --- a/src/test/ui/generic-associated-types/issue-86483.stderr +++ b/src/test/ui/generic-associated-types/issue-86483.stderr @@ -11,8 +11,9 @@ LL | | { ... | LL | | LL | | } - | |_^ ...so that the type `T` will meet its required lifetime bounds... + | |_^ | + = note: ...so that the type `T` will meet its required lifetime bounds... note: ...that is required by this bound --> $DIR/issue-86483.rs:7:16 | diff --git a/src/test/ui/generic-associated-types/method-unsatified-assoc-type-predicate.rs b/src/test/ui/generic-associated-types/method-unsatified-assoc-type-predicate.rs index 6db249221b849..8b6f7c41a7c66 100644 --- a/src/test/ui/generic-associated-types/method-unsatified-assoc-type-predicate.rs +++ b/src/test/ui/generic-associated-types/method-unsatified-assoc-type-predicate.rs @@ -12,6 +12,7 @@ trait M { } impl = i32>> M for T {} +//~^ NOTE the following trait bounds were not satisfied struct S; //~^ NOTE method `f` not found for this @@ -26,7 +27,6 @@ fn f(a: S) { a.f(); //~^ ERROR the method `f` exists for struct `S`, but its trait bounds were not satisfied //~| NOTE method cannot be called on `S` due to unsatisfied trait bounds - //~| NOTE the following trait bounds were not satisfied: } fn main() {} diff --git a/src/test/ui/generic-associated-types/method-unsatified-assoc-type-predicate.stderr b/src/test/ui/generic-associated-types/method-unsatified-assoc-type-predicate.stderr index 8af9fbed872e1..3eeb9540e7351 100644 --- a/src/test/ui/generic-associated-types/method-unsatified-assoc-type-predicate.stderr +++ b/src/test/ui/generic-associated-types/method-unsatified-assoc-type-predicate.stderr @@ -1,5 +1,5 @@ error[E0599]: the method `f` exists for struct `S`, but its trait bounds were not satisfied - --> $DIR/method-unsatified-assoc-type-predicate.rs:26:7 + --> $DIR/method-unsatified-assoc-type-predicate.rs:27:7 | LL | struct S; | --------- @@ -11,9 +11,12 @@ LL | struct S; LL | a.f(); | ^ method cannot be called on `S` due to unsatisfied trait bounds | - = note: the following trait bounds were not satisfied: - `::Y = i32` - which is required by `S: M` +note: the following trait bounds were not satisfied because of the requirements of the implementation of `M` for `_`: + `::Y = i32` + --> $DIR/method-unsatified-assoc-type-predicate.rs:14:26 + | +LL | impl = i32>> M for T {} + | ^ ^ error: aborting due to previous error diff --git a/src/test/ui/hrtb/issue-30786.migrate.stderr b/src/test/ui/hrtb/issue-30786.migrate.stderr index a769872d83a52..a497c6257dab6 100644 --- a/src/test/ui/hrtb/issue-30786.migrate.stderr +++ b/src/test/ui/hrtb/issue-30786.migrate.stderr @@ -10,13 +10,14 @@ LL | pub struct Map { LL | let filter = map.filterx(|x: &_| true); | ^^^^^^^ method cannot be called on `Map` due to unsatisfied trait bounds | - = note: the following trait bounds were not satisfied: - `&'a mut Map: Stream` - which is required by `Map: StreamExt` - `&'a mut &Map: Stream` - which is required by `&Map: StreamExt` - `&'a mut &mut Map: Stream` - which is required by `&mut Map: StreamExt` +note: the following trait bounds were not satisfied because of the requirements of the implementation of `StreamExt` for `_`: + `&'a mut Map: Stream` + `&'a mut &Map: Stream` + `&'a mut &mut Map: Stream` + --> $DIR/issue-30786.rs:106:9 + | +LL | impl StreamExt for T where for<'a> &'a mut T: Stream {} + | ^^^^^^^^^ ^ error[E0599]: the method `countx` exists for struct `Filter fn(&'r u64) -> &'r u64 {identity::}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>`, but its trait bounds were not satisfied --> $DIR/issue-30786.rs:141:24 @@ -30,13 +31,14 @@ LL | pub struct Filter { LL | let count = filter.countx(); | ^^^^^^ method cannot be called on `Filter fn(&'r u64) -> &'r u64 {identity::}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>` due to unsatisfied trait bounds | - = note: the following trait bounds were not satisfied: - `&'a mut Filter fn(&'r u64) -> &'r u64 {identity::}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>: Stream` - which is required by `Filter fn(&'r u64) -> &'r u64 {identity::}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>: StreamExt` - `&'a mut &Filter fn(&'r u64) -> &'r u64 {identity::}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>: Stream` - which is required by `&Filter fn(&'r u64) -> &'r u64 {identity::}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>: StreamExt` - `&'a mut &mut Filter fn(&'r u64) -> &'r u64 {identity::}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>: Stream` - which is required by `&mut Filter fn(&'r u64) -> &'r u64 {identity::}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>: StreamExt` +note: the following trait bounds were not satisfied because of the requirements of the implementation of `StreamExt` for `_`: + `&'a mut Filter fn(&'r u64) -> &'r u64 {identity::}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>: Stream` + `&'a mut &Filter fn(&'r u64) -> &'r u64 {identity::}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>: Stream` + `&'a mut &mut Filter fn(&'r u64) -> &'r u64 {identity::}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>: Stream` + --> $DIR/issue-30786.rs:106:9 + | +LL | impl StreamExt for T where for<'a> &'a mut T: Stream {} + | ^^^^^^^^^ ^ error: aborting due to 2 previous errors diff --git a/src/test/ui/hrtb/issue-30786.nll.stderr b/src/test/ui/hrtb/issue-30786.nll.stderr index a769872d83a52..a497c6257dab6 100644 --- a/src/test/ui/hrtb/issue-30786.nll.stderr +++ b/src/test/ui/hrtb/issue-30786.nll.stderr @@ -10,13 +10,14 @@ LL | pub struct Map { LL | let filter = map.filterx(|x: &_| true); | ^^^^^^^ method cannot be called on `Map` due to unsatisfied trait bounds | - = note: the following trait bounds were not satisfied: - `&'a mut Map: Stream` - which is required by `Map: StreamExt` - `&'a mut &Map: Stream` - which is required by `&Map: StreamExt` - `&'a mut &mut Map: Stream` - which is required by `&mut Map: StreamExt` +note: the following trait bounds were not satisfied because of the requirements of the implementation of `StreamExt` for `_`: + `&'a mut Map: Stream` + `&'a mut &Map: Stream` + `&'a mut &mut Map: Stream` + --> $DIR/issue-30786.rs:106:9 + | +LL | impl StreamExt for T where for<'a> &'a mut T: Stream {} + | ^^^^^^^^^ ^ error[E0599]: the method `countx` exists for struct `Filter fn(&'r u64) -> &'r u64 {identity::}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>`, but its trait bounds were not satisfied --> $DIR/issue-30786.rs:141:24 @@ -30,13 +31,14 @@ LL | pub struct Filter { LL | let count = filter.countx(); | ^^^^^^ method cannot be called on `Filter fn(&'r u64) -> &'r u64 {identity::}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>` due to unsatisfied trait bounds | - = note: the following trait bounds were not satisfied: - `&'a mut Filter fn(&'r u64) -> &'r u64 {identity::}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>: Stream` - which is required by `Filter fn(&'r u64) -> &'r u64 {identity::}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>: StreamExt` - `&'a mut &Filter fn(&'r u64) -> &'r u64 {identity::}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>: Stream` - which is required by `&Filter fn(&'r u64) -> &'r u64 {identity::}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>: StreamExt` - `&'a mut &mut Filter fn(&'r u64) -> &'r u64 {identity::}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>: Stream` - which is required by `&mut Filter fn(&'r u64) -> &'r u64 {identity::}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>: StreamExt` +note: the following trait bounds were not satisfied because of the requirements of the implementation of `StreamExt` for `_`: + `&'a mut Filter fn(&'r u64) -> &'r u64 {identity::}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>: Stream` + `&'a mut &Filter fn(&'r u64) -> &'r u64 {identity::}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>: Stream` + `&'a mut &mut Filter fn(&'r u64) -> &'r u64 {identity::}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>: Stream` + --> $DIR/issue-30786.rs:106:9 + | +LL | impl StreamExt for T where for<'a> &'a mut T: Stream {} + | ^^^^^^^^^ ^ error: aborting due to 2 previous errors diff --git a/src/test/ui/hrtb/issue-62203-hrtb-ice.stderr b/src/test/ui/hrtb/issue-62203-hrtb-ice.stderr index 4c5c59c22099a..5db17cb1bf4ec 100644 --- a/src/test/ui/hrtb/issue-62203-hrtb-ice.stderr +++ b/src/test/ui/hrtb/issue-62203-hrtb-ice.stderr @@ -2,12 +2,20 @@ error[E0271]: type mismatch resolving `for<'r> $DIR/issue-62203-hrtb-ice.rs:38:19 | LL | let v = Unit2.m( - | ^ expected struct `Unit4`, found associated type + | ^ expected associated type, found struct `Unit4` | - = note: expected struct `Unit4` - found associated type `<_ as Ty<'_>>::V` - = help: consider constraining the associated type `<_ as Ty<'_>>::V` to `Unit4` + = note: expected associated type `<_ as Ty<'_>>::V` + found struct `Unit4` + = help: consider constraining the associated type `<_ as Ty<'_>>::V` to `Unit4` or calling a method that returns `<_ as Ty<'_>>::V` = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html +note: required by a bound in `T1::m` + --> $DIR/issue-62203-hrtb-ice.rs:27:51 + | +LL | fn m<'a, B: Ty<'a>, F>(&self, f: F) -> Unit1 + | - required by a bound in this +LL | where +LL | F: for<'r> T0<'r, (>::V,), O = >::V>, + | ^^^^^^^^^^^^^^^^^^^^ required by this bound in `T1::m` error[E0271]: type mismatch resolving `for<'r> <[closure@$DIR/issue-62203-hrtb-ice.rs:42:17: 42:39] as FnOnce<((&'r u8,),)>>::Output == Unit3` --> $DIR/issue-62203-hrtb-ice.rs:40:9 @@ -19,13 +27,21 @@ LL | / L { LL | | LL | | f : |x| { drop(x); Unit4 } LL | | }); - | |_________^ expected struct `Unit4`, found struct `Unit3` + | |_________^ expected struct `Unit3`, found struct `Unit4` | note: required because of the requirements on the impl of `for<'r> T0<'r, (&'r u8,)>` for `L<[closure@$DIR/issue-62203-hrtb-ice.rs:42:17: 42:39]>` --> $DIR/issue-62203-hrtb-ice.rs:17:16 | LL | impl<'a, A, T> T0<'a, A> for L | ^^^^^^^^^ ^^^^ +note: required by a bound in `T1::m` + --> $DIR/issue-62203-hrtb-ice.rs:27:12 + | +LL | fn m<'a, B: Ty<'a>, F>(&self, f: F) -> Unit1 + | - required by a bound in this +LL | where +LL | F: for<'r> T0<'r, (>::V,), O = >::V>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `T1::m` error: aborting due to 2 previous errors diff --git a/src/test/ui/impl-trait/issue-55872-1.stderr b/src/test/ui/impl-trait/issue-55872-1.stderr index e772445a56c9a..2d1142fd0c52c 100644 --- a/src/test/ui/impl-trait/issue-55872-1.stderr +++ b/src/test/ui/impl-trait/issue-55872-1.stderr @@ -1,11 +1,11 @@ error[E0276]: impl has stricter requirements than trait - --> $DIR/issue-55872-1.rs:12:5 + --> $DIR/issue-55872-1.rs:12:15 | LL | fn foo() -> Self::E; | ----------------------- definition of `foo` from trait ... LL | fn foo() -> Self::E { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: Default` + | ^^^^^^^ impl has extra requirement `T: Default` error[E0277]: the trait bound `S: Copy` is not satisfied in `(S, T)` --> $DIR/issue-55872-1.rs:12:29 diff --git a/src/test/ui/inference/issue-71732.stderr b/src/test/ui/inference/issue-71732.stderr index 739847c5cd540..0369196c9108e 100644 --- a/src/test/ui/inference/issue-71732.stderr +++ b/src/test/ui/inference/issue-71732.stderr @@ -10,6 +10,15 @@ LL | .get(&"key".into()) - impl Borrow for String; - impl Borrow for T where T: ?Sized; +note: required by a bound in `HashMap::::get` + --> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL + | +LL | K: Borrow, + | ^^^^^^^^^ required by this bound in `HashMap::::get` +help: consider specifying the type argument in the function call + | +LL | .get::(&"key".into()) + | +++++ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-14853.stderr b/src/test/ui/issues/issue-14853.stderr index 6fc1055049261..2adcf55eca97f 100644 --- a/src/test/ui/issues/issue-14853.stderr +++ b/src/test/ui/issues/issue-14853.stderr @@ -1,11 +1,11 @@ error[E0276]: impl has stricter requirements than trait - --> $DIR/issue-14853.rs:12:5 + --> $DIR/issue-14853.rs:12:15 | LL | fn yay(_: Option, thing: &[T]); | ----------------------------------------------- definition of `yay` from trait ... LL | fn yay(_:Option, thing: &[T]) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: Str` + | ^^^ impl has extra requirement `T: Str` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-17651.stderr b/src/test/ui/issues/issue-17651.stderr index 214477f6c60ef..efaaeeda2fab6 100644 --- a/src/test/ui/issues/issue-17651.stderr +++ b/src/test/ui/issues/issue-17651.stderr @@ -7,11 +7,11 @@ LL | (|| Box::new(*(&[0][..])))(); | required by a bound introduced by this call | = help: the trait `Sized` is not implemented for `[{integer}]` -note: required by `Box::::new` +note: required by a bound in `Box::::new` --> $SRC_DIR/alloc/src/boxed.rs:LL:COL | -LL | pub fn new(x: T) -> Self { - | ^^^^^^^^^^^^^^^^^^^^^^^^ +LL | impl Box { + | ^ required by this bound in `Box::::new` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-18611.stderr b/src/test/ui/issues/issue-18611.stderr index b702196abdf94..bd18d46223e69 100644 --- a/src/test/ui/issues/issue-18611.stderr +++ b/src/test/ui/issues/issue-18611.stderr @@ -3,12 +3,6 @@ error[E0277]: the trait bound `isize: HasState` is not satisfied | LL | fn add_state(op: ::State) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `HasState` is not implemented for `isize` - | -note: required by a bound in `HasState` - --> $DIR/issue-18611.rs:5:1 - | -LL | trait HasState { - | ^^^^^^^^^^^^^^ required by this bound in `HasState` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-18937.rs b/src/test/ui/issues/issue-18937.rs index ab4c9c736d896..af85e5b2b02ab 100644 --- a/src/test/ui/issues/issue-18937.rs +++ b/src/test/ui/issues/issue-18937.rs @@ -16,8 +16,8 @@ trait A<'a> { } impl<'a> A<'a> for B { - fn foo(&mut self, f: F) //~ ERROR impl has stricter - where F: fmt::Debug + 'static, + fn foo(&mut self, f: F) + where F: fmt::Debug + 'static, //~ ERROR impl has stricter { self.list.push(Box::new(f)); } diff --git a/src/test/ui/issues/issue-18937.stderr b/src/test/ui/issues/issue-18937.stderr index ac302caecc335..5e2ba0ef4fc5a 100644 --- a/src/test/ui/issues/issue-18937.stderr +++ b/src/test/ui/issues/issue-18937.stderr @@ -1,17 +1,13 @@ error[E0276]: impl has stricter requirements than trait - --> $DIR/issue-18937.rs:19:5 + --> $DIR/issue-18937.rs:20:31 | LL | / fn foo(&mut self, f: F) LL | | where F: fmt::Debug + 'a, LL | | Self: Sized; | |__________________________- definition of `foo` from trait ... -LL | / fn foo(&mut self, f: F) -LL | | where F: fmt::Debug + 'static, -LL | | { -LL | | self.list.push(Box::new(f)); -LL | | } - | |_____^ impl has extra requirement `F: 'static` +LL | where F: fmt::Debug + 'static, + | ^^^^^^^ impl has extra requirement `F: 'static` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-20162.stderr b/src/test/ui/issues/issue-20162.stderr index ef1eb2ea6c02c..6848c3f0d8a54 100644 --- a/src/test/ui/issues/issue-20162.stderr +++ b/src/test/ui/issues/issue-20162.stderr @@ -3,6 +3,12 @@ error[E0277]: the trait bound `X: Ord` is not satisfied | LL | b.sort(); | ^^^^ the trait `Ord` is not implemented for `X` + | +note: required by a bound in `slice::::sort` + --> $SRC_DIR/alloc/src/slice.rs:LL:COL + | +LL | T: Ord, + | ^^^ required by this bound in `slice::::sort` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-20413.stderr b/src/test/ui/issues/issue-20413.stderr index 9135c5ac36af5..2935214140419 100644 --- a/src/test/ui/issues/issue-20413.stderr +++ b/src/test/ui/issues/issue-20413.stderr @@ -21,11 +21,6 @@ LL | impl Foo for T where NoData: Foo { | ^^^ ^ = note: 127 redundant requirements hidden = note: required because of the requirements on the impl of `Foo` for `NoData` -note: required by a bound in `Foo` - --> $DIR/issue-20413.rs:1:1 - | -LL | trait Foo { - | ^^^^^^^^^ required by this bound in `Foo` error[E0275]: overflow evaluating the requirement `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Foo` --> $DIR/issue-20413.rs:8:36 @@ -41,11 +36,6 @@ LL | impl Foo for T where NoData: Foo { | ^^^ ^ = note: 127 redundant requirements hidden = note: required because of the requirements on the impl of `Foo` for `NoData` -note: required by a bound in `Foo` - --> $DIR/issue-20413.rs:1:1 - | -LL | trait Foo { - | ^^^^^^^^^ required by this bound in `Foo` error[E0275]: overflow evaluating the requirement `EvenLessData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Baz` --> $DIR/issue-20413.rs:28:42 @@ -66,11 +56,6 @@ LL | impl Baz for T where AlmostNoData: Bar { | ^^^ ^ = note: 126 redundant requirements hidden = note: required because of the requirements on the impl of `Baz` for `EvenLessData` -note: required by a bound in `Baz` - --> $DIR/issue-20413.rs:20:1 - | -LL | trait Baz { - | ^^^^^^^^^ required by this bound in `Baz` error[E0275]: overflow evaluating the requirement `EvenLessData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Baz` --> $DIR/issue-20413.rs:28:42 @@ -91,11 +76,6 @@ LL | impl Baz for T where AlmostNoData: Bar { | ^^^ ^ = note: 126 redundant requirements hidden = note: required because of the requirements on the impl of `Baz` for `EvenLessData` -note: required by a bound in `Baz` - --> $DIR/issue-20413.rs:20:1 - | -LL | trait Baz { - | ^^^^^^^^^ required by this bound in `Baz` error[E0275]: overflow evaluating the requirement `AlmostNoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Bar` --> $DIR/issue-20413.rs:36:42 @@ -116,11 +96,6 @@ LL | impl Bar for T where EvenLessData: Baz { | ^^^ ^ = note: 126 redundant requirements hidden = note: required because of the requirements on the impl of `Bar` for `AlmostNoData` -note: required by a bound in `Bar` - --> $DIR/issue-20413.rs:16:1 - | -LL | trait Bar { - | ^^^^^^^^^ required by this bound in `Bar` error[E0275]: overflow evaluating the requirement `AlmostNoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Bar` --> $DIR/issue-20413.rs:36:42 @@ -141,11 +116,6 @@ LL | impl Bar for T where EvenLessData: Baz { | ^^^ ^ = note: 126 redundant requirements hidden = note: required because of the requirements on the impl of `Bar` for `AlmostNoData` -note: required by a bound in `Bar` - --> $DIR/issue-20413.rs:16:1 - | -LL | trait Bar { - | ^^^^^^^^^ required by this bound in `Bar` error: aborting due to 7 previous errors diff --git a/src/test/ui/issues/issue-20605.stderr b/src/test/ui/issues/issue-20605.stderr index 5a67aead75a73..41eefe3f8e9b5 100644 --- a/src/test/ui/issues/issue-20605.stderr +++ b/src/test/ui/issues/issue-20605.stderr @@ -6,11 +6,6 @@ LL | for item in *things { *item = 0 } | = note: the trait bound `dyn Iterator: IntoIterator` is not satisfied = note: required because of the requirements on the impl of `IntoIterator` for `dyn Iterator` -note: required by `into_iter` - --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider mutably borrowing here | LL | for item in &mut *things { *item = 0 } diff --git a/src/test/ui/issues/issue-21160.stderr b/src/test/ui/issues/issue-21160.stderr index 92742b50619e0..300c1272ef6c0 100644 --- a/src/test/ui/issues/issue-21160.stderr +++ b/src/test/ui/issues/issue-21160.stderr @@ -6,11 +6,6 @@ LL | #[derive(Hash)] LL | struct Foo(Bar); | ^^^ the trait `Hash` is not implemented for `Bar` | -note: required by a bound in `std::hash::Hash::hash` - --> $SRC_DIR/core/src/hash/mod.rs:LL:COL - | -LL | fn hash(&self, state: &mut H); - | ^ required by this bound in `std::hash::Hash::hash` = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/issues/issue-21974.stderr b/src/test/ui/issues/issue-21974.stderr index 3b6663513bb5f..dfabde9abc978 100644 --- a/src/test/ui/issues/issue-21974.stderr +++ b/src/test/ui/issues/issue-21974.stderr @@ -5,11 +5,6 @@ LL | where &'a T : Foo, | ^^^ cannot infer type for reference `&'a T` | = note: cannot satisfy `&'a T: Foo` -note: required by a bound in `Foo` - --> $DIR/issue-21974.rs:6:1 - | -LL | trait Foo { - | ^^^^^^^^^ required by this bound in `Foo` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-23966.stderr b/src/test/ui/issues/issue-23966.stderr index 9c87ee6104a0d..ae8233d5c76e6 100644 --- a/src/test/ui/issues/issue-23966.stderr +++ b/src/test/ui/issues/issue-23966.stderr @@ -7,6 +7,11 @@ LL | "".chars().fold(|_, _| (), ()); | required by a bound introduced by this call | = help: the trait `FnMut<(_, char)>` is not implemented for `()` +note: required by a bound in `fold` + --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + | +LL | F: FnMut(B, Self::Item) -> B, + | ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `fold` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-24424.stderr b/src/test/ui/issues/issue-24424.stderr index 4896006b645da..fa59da852f901 100644 --- a/src/test/ui/issues/issue-24424.stderr +++ b/src/test/ui/issues/issue-24424.stderr @@ -5,11 +5,6 @@ LL | impl <'l0, 'l1, T0> Trait1<'l0, T0> for bool where T0 : Trait0<'l0>, T0 : T | ^^^^^^^^^^^ cannot infer type for type parameter `T0` | = note: cannot satisfy `T0: Trait0<'l0>` -note: required by a bound in `Trait0` - --> $DIR/issue-24424.rs:2:1 - | -LL | trait Trait0<'l0> {} - | ^^^^^^^^^^^^^^^^^ required by this bound in `Trait0` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-28098.stderr b/src/test/ui/issues/issue-28098.stderr index 6a74f4ed489a1..3beb9929244bf 100644 --- a/src/test/ui/issues/issue-28098.stderr +++ b/src/test/ui/issues/issue-28098.stderr @@ -7,11 +7,6 @@ LL | let _ = Iterator::next(&mut ()); | required by a bound introduced by this call | = help: the trait `Iterator` is not implemented for `()` -note: required by `std::iter::Iterator::next` - --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL - | -LL | fn next(&mut self) -> Option; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: `bool` is not an iterator --> $DIR/issue-28098.rs:6:14 @@ -21,11 +16,6 @@ LL | for _ in false {} | = help: the trait `Iterator` is not implemented for `bool` = note: required because of the requirements on the impl of `IntoIterator` for `bool` -note: required by `into_iter` - --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: `()` is not an iterator --> $DIR/issue-28098.rs:9:28 @@ -36,11 +26,6 @@ LL | let _ = Iterator::next(&mut ()); | required by a bound introduced by this call | = help: the trait `Iterator` is not implemented for `()` -note: required by `std::iter::Iterator::next` - --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL - | -LL | fn next(&mut self) -> Option; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: `()` is not an iterator --> $DIR/issue-28098.rs:2:13 @@ -59,11 +44,6 @@ LL | let _ = Iterator::next(&mut ()); | required by a bound introduced by this call | = help: the trait `Iterator` is not implemented for `()` -note: required by `std::iter::Iterator::next` - --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL - | -LL | fn next(&mut self) -> Option; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: `()` is not an iterator --> $DIR/issue-28098.rs:22:28 @@ -74,11 +54,6 @@ LL | let _ = Iterator::next(&mut ()); | required by a bound introduced by this call | = help: the trait `Iterator` is not implemented for `()` -note: required by `std::iter::Iterator::next` - --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL - | -LL | fn next(&mut self) -> Option; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: `bool` is not an iterator --> $DIR/issue-28098.rs:25:14 @@ -88,11 +63,6 @@ LL | for _ in false {} | = help: the trait `Iterator` is not implemented for `bool` = note: required because of the requirements on the impl of `IntoIterator` for `bool` -note: required by `into_iter` - --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: `()` is not an iterator --> $DIR/issue-28098.rs:18:13 diff --git a/src/test/ui/issues/issue-29147.stderr b/src/test/ui/issues/issue-29147.stderr index 3b011f58b259d..5570e887edce5 100644 --- a/src/test/ui/issues/issue-29147.stderr +++ b/src/test/ui/issues/issue-29147.stderr @@ -11,11 +11,6 @@ LL | impl Foo for S5 { fn xxx(&self) {} } | ^^^^^^^^^^^^^^^^^^^^ LL | impl Foo for S5 { fn xxx(&self) {} } | ^^^^^^^^^^^^^^^^^^^^ -note: required by `Foo::xxx` - --> $DIR/issue-29147.rs:10:13 - | -LL | trait Foo { fn xxx(&self); } - | ^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-31173.rs b/src/test/ui/issues/issue-31173.rs index 40475426cff7a..48061ae54ae20 100644 --- a/src/test/ui/issues/issue-31173.rs +++ b/src/test/ui/issues/issue-31173.rs @@ -9,8 +9,6 @@ pub fn get_tok(it: &mut IntoIter) { }) .cloned() //~^ ERROR type mismatch resolving - //~| expected type `u8` - //~| found reference `&_` .collect(); //~ ERROR the method } diff --git a/src/test/ui/issues/issue-31173.stderr b/src/test/ui/issues/issue-31173.stderr index 8b7871ce31186..982b6118ce659 100644 --- a/src/test/ui/issues/issue-31173.stderr +++ b/src/test/ui/issues/issue-31173.stderr @@ -2,13 +2,18 @@ error[E0271]: type mismatch resolving `, [ --> $DIR/issue-31173.rs:10:10 | LL | .cloned() - | ^^^^^^ expected `u8`, found reference + | ^^^^^^ expected reference, found `u8` | - = note: expected type `u8` - found reference `&_` + = note: expected reference `&_` + found type `u8` +note: required by a bound in `cloned` + --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + | +LL | Self: Sized + Iterator, + | ^^^^^^^^^^^^ required by this bound in `cloned` error[E0599]: the method `collect` exists for struct `Cloned, [closure@$DIR/issue-31173.rs:6:39: 9:6]>>`, but its trait bounds were not satisfied - --> $DIR/issue-31173.rs:14:10 + --> $DIR/issue-31173.rs:12:10 | LL | .collect(); | ^^^^^^^ method cannot be called on `Cloned, [closure@$DIR/issue-31173.rs:6:39: 9:6]>>` due to unsatisfied trait bounds diff --git a/src/test/ui/issues/issue-32709.stderr b/src/test/ui/issues/issue-32709.stderr index bc7eb0688ee84..b4c3f148e32b5 100644 --- a/src/test/ui/issues/issue-32709.stderr +++ b/src/test/ui/issues/issue-32709.stderr @@ -8,11 +8,6 @@ LL | Err(5)?; | = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait = note: required because of the requirements on the impl of `FromResidual>` for `Result` -note: required by `from_residual` - --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL - | -LL | fn from_residual(residual: R) -> Self; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-33941.stderr b/src/test/ui/issues/issue-33941.stderr index d588214f5077c..e7263148205d5 100644 --- a/src/test/ui/issues/issue-33941.stderr +++ b/src/test/ui/issues/issue-33941.stderr @@ -2,10 +2,15 @@ error[E0271]: type mismatch resolving ` $DIR/issue-33941.rs:4:36 | LL | for _ in HashMap::new().iter().cloned() {} - | ^^^^^^ expected tuple, found reference + | ^^^^^^ expected reference, found tuple | - = note: expected tuple `(&_, &_)` - found reference `&_` + = note: expected reference `&_` + found tuple `(&_, &_)` +note: required by a bound in `cloned` + --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + | +LL | Self: Sized + Iterator, + | ^^^^^^^^^^^^ required by this bound in `cloned` error[E0271]: type mismatch resolving ` as Iterator>::Item == &_` --> $DIR/issue-33941.rs:4:14 @@ -17,11 +22,6 @@ LL | for _ in HashMap::new().iter().cloned() {} found tuple `(&_, &_)` = note: required because of the requirements on the impl of `Iterator` for `Cloned>` = note: required because of the requirements on the impl of `IntoIterator` for `Cloned>` -note: required by `into_iter` - --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0271]: type mismatch resolving ` as Iterator>::Item == &_` --> $DIR/issue-33941.rs:4:14 @@ -32,11 +32,6 @@ LL | for _ in HashMap::new().iter().cloned() {} = note: expected reference `&_` found tuple `(&_, &_)` = note: required because of the requirements on the impl of `Iterator` for `Cloned>` -note: required by `std::iter::Iterator::next` - --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL - | -LL | fn next(&mut self) -> Option; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/issues/issue-34229.stderr b/src/test/ui/issues/issue-34229.stderr index fba75de8cc052..71e02f2fd86cc 100644 --- a/src/test/ui/issues/issue-34229.stderr +++ b/src/test/ui/issues/issue-34229.stderr @@ -7,11 +7,6 @@ LL | #[derive(PartialEq, PartialOrd)] struct Nope(Comparable); | in this derive macro expansion | = help: the trait `PartialOrd` is not implemented for `Comparable` -note: required by `std::cmp::PartialOrd::partial_cmp` - --> $SRC_DIR/core/src/cmp.rs:LL:COL - | -LL | fn partial_cmp(&self, other: &Rhs) -> Option; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/issues/issue-34334.stderr b/src/test/ui/issues/issue-34334.stderr index acb44ce2c3545..49d6709a86017 100644 --- a/src/test/ui/issues/issue-34334.stderr +++ b/src/test/ui/issues/issue-34334.stderr @@ -14,6 +14,11 @@ LL | let sr2: Vec<(u32, _, _)> = sr.iter().map(|(faction, th_sender, th_rece | ^^^^^^^ value of type `Vec<(u32, _, _)>` cannot be built from `std::iter::Iterator` | = help: the trait `FromIterator<()>` is not implemented for `Vec<(u32, _, _)>` +note: required by a bound in `collect` + --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + | +LL | fn collect>(self) -> B + | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `collect` error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-39970.stderr b/src/test/ui/issues/issue-39970.stderr index f609e47e818d4..ffcac1f470571 100644 --- a/src/test/ui/issues/issue-39970.stderr +++ b/src/test/ui/issues/issue-39970.stderr @@ -9,11 +9,6 @@ note: required because of the requirements on the impl of `Visit` for `()` | LL | impl Visit for () where | ^^^^^ ^^ -note: required by `Visit::visit` - --> $DIR/issue-39970.rs:6:5 - | -LL | fn visit() {} - | ^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-47706-trait.stderr b/src/test/ui/issues/issue-47706-trait.stderr index 2e542644b70d4..eb0c80f8f0d1e 100644 --- a/src/test/ui/issues/issue-47706-trait.stderr +++ b/src/test/ui/issues/issue-47706-trait.stderr @@ -7,6 +7,12 @@ LL | None::<()>.map(Self::f); | --- ^^^^^^^ expected function that takes a single 0-tuple as argument | | | required by a bound introduced by this call + | +note: required by a bound in `Option::::map` + --> $SRC_DIR/core/src/option.rs:LL:COL + | +LL | pub fn map U>(self, f: F) -> Option { + | ^^^^^^^^^^^^^^ required by this bound in `Option::::map` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-47706.stderr b/src/test/ui/issues/issue-47706.stderr index acf7626c634e3..237b2b9e79859 100644 --- a/src/test/ui/issues/issue-47706.stderr +++ b/src/test/ui/issues/issue-47706.stderr @@ -8,6 +8,12 @@ LL | self.foo.map(Foo::new) | --- ^^^^^^^^ expected function that takes 1 argument | | | required by a bound introduced by this call + | +note: required by a bound in `Option::::map` + --> $SRC_DIR/core/src/option.rs:LL:COL + | +LL | pub fn map U>(self, f: F) -> Option { + | ^^^^^^^^^^^^^^ required by this bound in `Option::::map` error[E0593]: function is expected to take 0 arguments, but it takes 1 argument --> $DIR/issue-47706.rs:27:9 diff --git a/src/test/ui/issues/issue-51632-try-desugar-incompatible-types.stderr b/src/test/ui/issues/issue-51632-try-desugar-incompatible-types.stderr index 0f61e03c3b58f..15d2ef3fce8da 100644 --- a/src/test/ui/issues/issue-51632-try-desugar-incompatible-types.stderr +++ b/src/test/ui/issues/issue-51632-try-desugar-incompatible-types.stderr @@ -12,10 +12,10 @@ help: try removing this `?` LL - missing_discourses()? LL + missing_discourses() | -help: try using a variant of the expected enum +help: try wrapping the expression in `Ok` | LL | Ok(missing_discourses()?) - | + | +++ + error: aborting due to previous error diff --git a/src/test/ui/issues/issue-54954.stderr b/src/test/ui/issues/issue-54954.stderr index df76a985559d0..efe2ef504a2ba 100644 --- a/src/test/ui/issues/issue-54954.stderr +++ b/src/test/ui/issues/issue-54954.stderr @@ -11,11 +11,6 @@ LL | const ARR_LEN: usize = Tt::const_val::<[i8; 123]>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type | = note: cannot satisfy `_: Tt` -note: required by a bound in `Tt::const_val` - --> $DIR/issue-54954.rs:5:24 - | -LL | const fn const_val() -> usize { - | ^ required by this bound in `Tt::const_val` error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-58022.stderr b/src/test/ui/issues/issue-58022.stderr index a1715bd99e094..0128b70e21643 100644 --- a/src/test/ui/issues/issue-58022.stderr +++ b/src/test/ui/issues/issue-58022.stderr @@ -15,11 +15,6 @@ LL | fn new(slice: &[u8; Foo::SIZE]) -> Self; | = note: cannot satisfy `_: Foo` = note: associated constants cannot be accessed directly on a `trait`, they can only be accessed through a specific `impl` -note: required by `Foo::SIZE` - --> $DIR/issue-58022.rs:2:5 - | -LL | const SIZE: usize; - | ^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-66353.stderr b/src/test/ui/issues/issue-66353.stderr index 282e236d3d021..3356180974f88 100644 --- a/src/test/ui/issues/issue-66353.stderr +++ b/src/test/ui/issues/issue-66353.stderr @@ -11,12 +11,6 @@ LL | _Func::< <() as _A>::AssocT >::func(()); | ----------------------------------- ^^ the trait `_Func<_>` is not implemented for `()` | | | required by a bound introduced by this call - | -note: required by `_Func::func` - --> $DIR/issue-66353.rs:4:5 - | -LL | fn func(_: Self); - | ^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-66923-show-error-for-correct-call.stderr b/src/test/ui/issues/issue-66923-show-error-for-correct-call.stderr index a08531000bc64..6a96709cbacdb 100644 --- a/src/test/ui/issues/issue-66923-show-error-for-correct-call.stderr +++ b/src/test/ui/issues/issue-66923-show-error-for-correct-call.stderr @@ -5,6 +5,11 @@ LL | let x2: Vec = x1.into_iter().collect(); | ^^^^^^^ value of type `Vec` cannot be built from `std::iter::Iterator` | = help: the trait `FromIterator<&f64>` is not implemented for `Vec` +note: required by a bound in `collect` + --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + | +LL | fn collect>(self) -> B + | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `collect` error[E0277]: a value of type `Vec` cannot be built from an iterator over elements of type `&f64` --> $DIR/issue-66923-show-error-for-correct-call.rs:12:29 @@ -13,6 +18,11 @@ LL | let x3 = x1.into_iter().collect::>(); | ^^^^^^^ value of type `Vec` cannot be built from `std::iter::Iterator` | = help: the trait `FromIterator<&f64>` is not implemented for `Vec` +note: required by a bound in `collect` + --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + | +LL | fn collect>(self) -> B + | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `collect` error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-69683.stderr b/src/test/ui/issues/issue-69683.stderr index ecf78e48e0e2a..b53923eec1d88 100644 --- a/src/test/ui/issues/issue-69683.stderr +++ b/src/test/ui/issues/issue-69683.stderr @@ -18,6 +18,14 @@ LL | impl Element<()> for T { ... LL | impl, S> Element<[S; 3]> for T { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: required by a bound in `Foo::foo` + --> $DIR/issue-69683.rs:15:9 + | +LL | u8: Element, + | ^^^^^^^^^^ required by this bound in `Foo::foo` +LL | { +LL | fn foo(self, x: >::Array); + | --- required by a bound in this error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-72690.stderr b/src/test/ui/issues/issue-72690.stderr index 1747ca5bb04b8..629ccea2577bd 100644 --- a/src/test/ui/issues/issue-72690.stderr +++ b/src/test/ui/issues/issue-72690.stderr @@ -7,11 +7,6 @@ LL | String::from("x".as_ref()); = note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate: - impl<> From<&String> for String; - impl<> From<&str> for String; -note: required by `from` - --> $SRC_DIR/core/src/convert/mod.rs:LL:COL - | -LL | fn from(_: T) -> Self; - | ^^^^^^^^^^^^^^^^^^^^^^ error[E0283]: type annotations needed --> $DIR/issue-72690.rs:7:22 @@ -43,11 +38,6 @@ LL | |x| String::from("x".as_ref()); = note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate: - impl<> From<&String> for String; - impl<> From<&str> for String; -note: required by `from` - --> $SRC_DIR/core/src/convert/mod.rs:LL:COL - | -LL | fn from(_: T) -> Self; - | ^^^^^^^^^^^^^^^^^^^^^^ error[E0283]: type annotations needed --> $DIR/issue-72690.rs:12:26 @@ -87,11 +77,6 @@ LL | String::from("x".as_ref()); = note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate: - impl<> From<&String> for String; - impl<> From<&str> for String; -note: required by `from` - --> $SRC_DIR/core/src/convert/mod.rs:LL:COL - | -LL | fn from(_: T) -> Self; - | ^^^^^^^^^^^^^^^^^^^^^^ error[E0283]: type annotations needed --> $DIR/issue-72690.rs:22:22 @@ -117,11 +102,6 @@ LL | String::from("x".as_ref()); = note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate: - impl<> From<&String> for String; - impl<> From<&str> for String; -note: required by `from` - --> $SRC_DIR/core/src/convert/mod.rs:LL:COL - | -LL | fn from(_: T) -> Self; - | ^^^^^^^^^^^^^^^^^^^^^^ error[E0283]: type annotations needed --> $DIR/issue-72690.rs:29:22 @@ -147,11 +127,6 @@ LL | String::from("x".as_ref()); = note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate: - impl<> From<&String> for String; - impl<> From<&str> for String; -note: required by `from` - --> $SRC_DIR/core/src/convert/mod.rs:LL:COL - | -LL | fn from(_: T) -> Self; - | ^^^^^^^^^^^^^^^^^^^^^^ error[E0283]: type annotations needed --> $DIR/issue-72690.rs:38:22 @@ -177,11 +152,6 @@ LL | String::from("x".as_ref()); = note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate: - impl<> From<&String> for String; - impl<> From<&str> for String; -note: required by `from` - --> $SRC_DIR/core/src/convert/mod.rs:LL:COL - | -LL | fn from(_: T) -> Self; - | ^^^^^^^^^^^^^^^^^^^^^^ error[E0283]: type annotations needed --> $DIR/issue-72690.rs:47:22 @@ -207,11 +177,6 @@ LL | String::from("x".as_ref()); = note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate: - impl<> From<&String> for String; - impl<> From<&str> for String; -note: required by `from` - --> $SRC_DIR/core/src/convert/mod.rs:LL:COL - | -LL | fn from(_: T) -> Self; - | ^^^^^^^^^^^^^^^^^^^^^^ error[E0283]: type annotations needed --> $DIR/issue-72690.rs:54:22 @@ -237,11 +202,6 @@ LL | String::from("x".as_ref()); = note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate: - impl<> From<&String> for String; - impl<> From<&str> for String; -note: required by `from` - --> $SRC_DIR/core/src/convert/mod.rs:LL:COL - | -LL | fn from(_: T) -> Self; - | ^^^^^^^^^^^^^^^^^^^^^^ error[E0283]: type annotations needed --> $DIR/issue-72690.rs:63:22 diff --git a/src/test/ui/iterators/integral.stderr b/src/test/ui/iterators/integral.stderr index 60b2cbfdf4592..5e2744bab95c1 100644 --- a/src/test/ui/iterators/integral.stderr +++ b/src/test/ui/iterators/integral.stderr @@ -7,11 +7,6 @@ LL | for _ in 42 {} = help: the trait `Iterator` is not implemented for `{integer}` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` = note: required because of the requirements on the impl of `IntoIterator` for `{integer}` -note: required by `into_iter` - --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: `u8` is not an iterator --> $DIR/integral.rs:4:14 @@ -22,11 +17,6 @@ LL | for _ in 42 as u8 {} = help: the trait `Iterator` is not implemented for `u8` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` = note: required because of the requirements on the impl of `IntoIterator` for `u8` -note: required by `into_iter` - --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: `i8` is not an iterator --> $DIR/integral.rs:6:14 @@ -37,11 +27,6 @@ LL | for _ in 42 as i8 {} = help: the trait `Iterator` is not implemented for `i8` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` = note: required because of the requirements on the impl of `IntoIterator` for `i8` -note: required by `into_iter` - --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: `u16` is not an iterator --> $DIR/integral.rs:8:14 @@ -52,11 +37,6 @@ LL | for _ in 42 as u16 {} = help: the trait `Iterator` is not implemented for `u16` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` = note: required because of the requirements on the impl of `IntoIterator` for `u16` -note: required by `into_iter` - --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: `i16` is not an iterator --> $DIR/integral.rs:10:14 @@ -67,11 +47,6 @@ LL | for _ in 42 as i16 {} = help: the trait `Iterator` is not implemented for `i16` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` = note: required because of the requirements on the impl of `IntoIterator` for `i16` -note: required by `into_iter` - --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: `u32` is not an iterator --> $DIR/integral.rs:12:14 @@ -82,11 +57,6 @@ LL | for _ in 42 as u32 {} = help: the trait `Iterator` is not implemented for `u32` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` = note: required because of the requirements on the impl of `IntoIterator` for `u32` -note: required by `into_iter` - --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: `i32` is not an iterator --> $DIR/integral.rs:14:14 @@ -97,11 +67,6 @@ LL | for _ in 42 as i32 {} = help: the trait `Iterator` is not implemented for `i32` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` = note: required because of the requirements on the impl of `IntoIterator` for `i32` -note: required by `into_iter` - --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: `u64` is not an iterator --> $DIR/integral.rs:16:14 @@ -112,11 +77,6 @@ LL | for _ in 42 as u64 {} = help: the trait `Iterator` is not implemented for `u64` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` = note: required because of the requirements on the impl of `IntoIterator` for `u64` -note: required by `into_iter` - --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: `i64` is not an iterator --> $DIR/integral.rs:18:14 @@ -127,11 +87,6 @@ LL | for _ in 42 as i64 {} = help: the trait `Iterator` is not implemented for `i64` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` = note: required because of the requirements on the impl of `IntoIterator` for `i64` -note: required by `into_iter` - --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: `usize` is not an iterator --> $DIR/integral.rs:20:14 @@ -142,11 +97,6 @@ LL | for _ in 42 as usize {} = help: the trait `Iterator` is not implemented for `usize` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` = note: required because of the requirements on the impl of `IntoIterator` for `usize` -note: required by `into_iter` - --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: `isize` is not an iterator --> $DIR/integral.rs:22:14 @@ -157,11 +107,6 @@ LL | for _ in 42 as isize {} = help: the trait `Iterator` is not implemented for `isize` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` = note: required because of the requirements on the impl of `IntoIterator` for `isize` -note: required by `into_iter` - --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: `{float}` is not an iterator --> $DIR/integral.rs:24:14 @@ -171,11 +116,6 @@ LL | for _ in 42.0 {} | = help: the trait `Iterator` is not implemented for `{float}` = note: required because of the requirements on the impl of `IntoIterator` for `{float}` -note: required by `into_iter` - --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 12 previous errors diff --git a/src/test/ui/iterators/ranges.stderr b/src/test/ui/iterators/ranges.stderr index fdc33862c0aba..440a8960a4ca3 100644 --- a/src/test/ui/iterators/ranges.stderr +++ b/src/test/ui/iterators/ranges.stderr @@ -7,11 +7,6 @@ LL | for _ in ..10 {} = help: the trait `Iterator` is not implemented for `RangeTo<{integer}>` = note: `..end` is a `RangeTo`, which cannot be iterated on; you might have meant to have a bounded `Range`: `0..end` = note: required because of the requirements on the impl of `IntoIterator` for `RangeTo<{integer}>` -note: required by `into_iter` - --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: `RangeToInclusive<{integer}>` is not an iterator --> $DIR/ranges.rs:4:14 @@ -22,11 +17,6 @@ LL | for _ in ..=10 {} = help: the trait `Iterator` is not implemented for `RangeToInclusive<{integer}>` = note: `..=end` is a `RangeToInclusive`, which cannot be iterated on; you might have meant to have a bounded `RangeInclusive`: `0..=end` = note: required because of the requirements on the impl of `IntoIterator` for `RangeToInclusive<{integer}>` -note: required by `into_iter` - --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/iterators/string.stderr b/src/test/ui/iterators/string.stderr index f7089be277296..d9c40fe1ba6a4 100644 --- a/src/test/ui/iterators/string.stderr +++ b/src/test/ui/iterators/string.stderr @@ -6,11 +6,6 @@ LL | for _ in "".to_owned() {} | = help: the trait `Iterator` is not implemented for `String` = note: required because of the requirements on the impl of `IntoIterator` for `String` -note: required by `into_iter` - --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: `&str` is not an iterator --> $DIR/string.rs:4:14 @@ -20,11 +15,6 @@ LL | for _ in "" {} | = help: the trait `Iterator` is not implemented for `&str` = note: required because of the requirements on the impl of `IntoIterator` for `&str` -note: required by `into_iter` - --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/layout/debug.stderr b/src/test/ui/layout/debug.stderr index 1a371c6b17000..418f780d62c97 100644 --- a/src/test/ui/layout/debug.stderr +++ b/src/test/ui/layout/debug.stderr @@ -1,345 +1,345 @@ error: layout_of(E) = Layout { - fields: Arbitrary { - offsets: [ - Size { - raw: 0, - }, - ], - memory_index: [ - 0, - ], - }, - variants: Multiple { - tag: Scalar { - value: Int( - I32, - false, - ), - valid_range: 0..=0, - }, - tag_encoding: Direct, - tag_field: 0, - variants: [ - Layout { - fields: Arbitrary { - offsets: [], - memory_index: [], - }, - variants: Single { - index: 0, - }, - abi: Aggregate { - sized: true, - }, - largest_niche: None, - align: AbiAndPrefAlign { - abi: Align { - pow2: 0, - }, - pref: $PREF_ALIGN, - }, - size: Size { - raw: 4, - }, - }, - Layout { - fields: Arbitrary { - offsets: [ - Size { - raw: 4, - }, - Size { - raw: 4, - }, - Size { - raw: 8, - }, - ], - memory_index: [ - 0, - 1, - 2, - ], - }, - variants: Single { - index: 1, - }, - abi: Uninhabited, - largest_niche: None, - align: AbiAndPrefAlign { - abi: Align { - pow2: 2, - }, - pref: $PREF_ALIGN, - }, - size: Size { - raw: 12, - }, - }, - ], - }, - abi: Aggregate { - sized: true, - }, - largest_niche: Some( - Niche { - offset: Size { - raw: 0, - }, - scalar: Scalar { - value: Int( - I32, - false, - ), - valid_range: 0..=0, - }, - }, - ), - align: AbiAndPrefAlign { - abi: Align { - pow2: 2, - }, - pref: $PREF_ALIGN, - }, - size: Size { - raw: 12, - }, -} + fields: Arbitrary { + offsets: [ + Size { + raw: 0, + }, + ], + memory_index: [ + 0, + ], + }, + variants: Multiple { + tag: Scalar { + value: Int( + I32, + false, + ), + valid_range: 0..=0, + }, + tag_encoding: Direct, + tag_field: 0, + variants: [ + Layout { + fields: Arbitrary { + offsets: [], + memory_index: [], + }, + variants: Single { + index: 0, + }, + abi: Aggregate { + sized: true, + }, + largest_niche: None, + align: AbiAndPrefAlign { + abi: Align { + pow2: 0, + }, + pref: $PREF_ALIGN, + }, + size: Size { + raw: 4, + }, + }, + Layout { + fields: Arbitrary { + offsets: [ + Size { + raw: 4, + }, + Size { + raw: 4, + }, + Size { + raw: 8, + }, + ], + memory_index: [ + 0, + 1, + 2, + ], + }, + variants: Single { + index: 1, + }, + abi: Uninhabited, + largest_niche: None, + align: AbiAndPrefAlign { + abi: Align { + pow2: 2, + }, + pref: $PREF_ALIGN, + }, + size: Size { + raw: 12, + }, + }, + ], + }, + abi: Aggregate { + sized: true, + }, + largest_niche: Some( + Niche { + offset: Size { + raw: 0, + }, + scalar: Scalar { + value: Int( + I32, + false, + ), + valid_range: 0..=0, + }, + }, + ), + align: AbiAndPrefAlign { + abi: Align { + pow2: 2, + }, + pref: $PREF_ALIGN, + }, + size: Size { + raw: 12, + }, + } --> $DIR/debug.rs:6:1 | LL | enum E { Foo, Bar(!, i32, i32) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: layout_of(S) = Layout { - fields: Arbitrary { - offsets: [ - Size { - raw: 0, - }, - Size { - raw: 0, - }, - Size { - raw: 4, - }, - ], - memory_index: [ - 1, - 0, - 2, - ], - }, - variants: Single { - index: 0, - }, - abi: ScalarPair( - Scalar { - value: Int( - I32, - true, - ), - valid_range: 0..=4294967295, - }, - Scalar { - value: Int( - I32, - true, - ), - valid_range: 0..=4294967295, - }, - ), - largest_niche: None, - align: AbiAndPrefAlign { - abi: Align { - pow2: 2, - }, - pref: $PREF_ALIGN, - }, - size: Size { - raw: 8, - }, -} + fields: Arbitrary { + offsets: [ + Size { + raw: 0, + }, + Size { + raw: 0, + }, + Size { + raw: 4, + }, + ], + memory_index: [ + 1, + 0, + 2, + ], + }, + variants: Single { + index: 0, + }, + abi: ScalarPair( + Scalar { + value: Int( + I32, + true, + ), + valid_range: 0..=4294967295, + }, + Scalar { + value: Int( + I32, + true, + ), + valid_range: 0..=4294967295, + }, + ), + largest_niche: None, + align: AbiAndPrefAlign { + abi: Align { + pow2: 2, + }, + pref: $PREF_ALIGN, + }, + size: Size { + raw: 8, + }, + } --> $DIR/debug.rs:9:1 | LL | struct S { f1: i32, f2: (), f3: i32 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: layout_of(U) = Layout { - fields: Union( - 2, - ), - variants: Single { - index: 0, - }, - abi: Aggregate { - sized: true, - }, - largest_niche: None, - align: AbiAndPrefAlign { - abi: Align { - pow2: 2, - }, - pref: $PREF_ALIGN, - }, - size: Size { - raw: 8, - }, -} + fields: Union( + 2, + ), + variants: Single { + index: 0, + }, + abi: Aggregate { + sized: true, + }, + largest_niche: None, + align: AbiAndPrefAlign { + abi: Align { + pow2: 2, + }, + pref: $PREF_ALIGN, + }, + size: Size { + raw: 8, + }, + } --> $DIR/debug.rs:12:1 | LL | union U { f1: (i32, i32), f3: i32 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: layout_of(std::result::Result) = Layout { - fields: Arbitrary { - offsets: [ - Size { - raw: 0, - }, - ], - memory_index: [ - 0, - ], - }, - variants: Multiple { - tag: Scalar { - value: Int( - I32, - false, - ), - valid_range: 0..=1, - }, - tag_encoding: Direct, - tag_field: 0, - variants: [ - Layout { - fields: Arbitrary { - offsets: [ - Size { - raw: 4, - }, - ], - memory_index: [ - 0, - ], - }, - variants: Single { - index: 0, - }, - abi: Aggregate { - sized: true, - }, - largest_niche: None, - align: AbiAndPrefAlign { - abi: Align { - pow2: 2, - }, - pref: $PREF_ALIGN, - }, - size: Size { - raw: 8, - }, - }, - Layout { - fields: Arbitrary { - offsets: [ - Size { - raw: 4, - }, - ], - memory_index: [ - 0, - ], - }, - variants: Single { - index: 1, - }, - abi: Aggregate { - sized: true, - }, - largest_niche: None, - align: AbiAndPrefAlign { - abi: Align { - pow2: 2, - }, - pref: $PREF_ALIGN, - }, - size: Size { - raw: 8, - }, - }, - ], - }, - abi: ScalarPair( - Scalar { - value: Int( - I32, - false, - ), - valid_range: 0..=1, - }, - Scalar { - value: Int( - I32, - true, - ), - valid_range: 0..=4294967295, - }, - ), - largest_niche: Some( - Niche { - offset: Size { - raw: 0, - }, - scalar: Scalar { - value: Int( - I32, - false, - ), - valid_range: 0..=1, - }, - }, - ), - align: AbiAndPrefAlign { - abi: Align { - pow2: 2, - }, - pref: $PREF_ALIGN, - }, - size: Size { - raw: 8, - }, -} + fields: Arbitrary { + offsets: [ + Size { + raw: 0, + }, + ], + memory_index: [ + 0, + ], + }, + variants: Multiple { + tag: Scalar { + value: Int( + I32, + false, + ), + valid_range: 0..=1, + }, + tag_encoding: Direct, + tag_field: 0, + variants: [ + Layout { + fields: Arbitrary { + offsets: [ + Size { + raw: 4, + }, + ], + memory_index: [ + 0, + ], + }, + variants: Single { + index: 0, + }, + abi: Aggregate { + sized: true, + }, + largest_niche: None, + align: AbiAndPrefAlign { + abi: Align { + pow2: 2, + }, + pref: $PREF_ALIGN, + }, + size: Size { + raw: 8, + }, + }, + Layout { + fields: Arbitrary { + offsets: [ + Size { + raw: 4, + }, + ], + memory_index: [ + 0, + ], + }, + variants: Single { + index: 1, + }, + abi: Aggregate { + sized: true, + }, + largest_niche: None, + align: AbiAndPrefAlign { + abi: Align { + pow2: 2, + }, + pref: $PREF_ALIGN, + }, + size: Size { + raw: 8, + }, + }, + ], + }, + abi: ScalarPair( + Scalar { + value: Int( + I32, + false, + ), + valid_range: 0..=1, + }, + Scalar { + value: Int( + I32, + true, + ), + valid_range: 0..=4294967295, + }, + ), + largest_niche: Some( + Niche { + offset: Size { + raw: 0, + }, + scalar: Scalar { + value: Int( + I32, + false, + ), + valid_range: 0..=1, + }, + }, + ), + align: AbiAndPrefAlign { + abi: Align { + pow2: 2, + }, + pref: $PREF_ALIGN, + }, + size: Size { + raw: 8, + }, + } --> $DIR/debug.rs:15:1 | LL | type Test = Result; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: layout_of(i32) = Layout { - fields: Primitive, - variants: Single { - index: 0, - }, - abi: Scalar( - Scalar { - value: Int( - I32, - true, - ), - valid_range: 0..=4294967295, - }, - ), - largest_niche: None, - align: AbiAndPrefAlign { - abi: Align { - pow2: 2, - }, - pref: $PREF_ALIGN, - }, - size: Size { - raw: 4, - }, -} + fields: Primitive, + variants: Single { + index: 0, + }, + abi: Scalar( + Scalar { + value: Int( + I32, + true, + ), + valid_range: 0..=4294967295, + }, + ), + largest_niche: None, + align: AbiAndPrefAlign { + abi: Align { + pow2: 2, + }, + pref: $PREF_ALIGN, + }, + size: Size { + raw: 4, + }, + } --> $DIR/debug.rs:18:1 | LL | type T = impl std::fmt::Debug; diff --git a/src/test/ui/layout/hexagon-enum.stderr b/src/test/ui/layout/hexagon-enum.stderr index d4676a5afb25e..39b23cb4b572e 100644 --- a/src/test/ui/layout/hexagon-enum.stderr +++ b/src/test/ui/layout/hexagon-enum.stderr @@ -1,438 +1,438 @@ error: layout_of(A) = Layout { - fields: Arbitrary { - offsets: [ - Size { - raw: 0, - }, - ], - memory_index: [ - 0, - ], - }, - variants: Multiple { - tag: Scalar { - value: Int( - I8, - false, - ), - valid_range: 0..=0, - }, - tag_encoding: Direct, - tag_field: 0, - variants: [ - Layout { - fields: Arbitrary { - offsets: [], - memory_index: [], - }, - variants: Single { - index: 0, - }, - abi: Aggregate { - sized: true, - }, - largest_niche: None, - align: AbiAndPrefAlign { - abi: Align { - pow2: 0, - }, - pref: Align { - pow2: 0, - }, - }, - size: Size { - raw: 1, - }, - }, - ], - }, - abi: Scalar( - Scalar { - value: Int( - I8, - false, - ), - valid_range: 0..=0, - }, - ), - largest_niche: Some( - Niche { - offset: Size { - raw: 0, - }, - scalar: Scalar { - value: Int( - I8, - false, - ), - valid_range: 0..=0, - }, - }, - ), - align: AbiAndPrefAlign { - abi: Align { - pow2: 0, - }, - pref: Align { - pow2: 0, - }, - }, - size: Size { - raw: 1, - }, -} + fields: Arbitrary { + offsets: [ + Size { + raw: 0, + }, + ], + memory_index: [ + 0, + ], + }, + variants: Multiple { + tag: Scalar { + value: Int( + I8, + false, + ), + valid_range: 0..=0, + }, + tag_encoding: Direct, + tag_field: 0, + variants: [ + Layout { + fields: Arbitrary { + offsets: [], + memory_index: [], + }, + variants: Single { + index: 0, + }, + abi: Aggregate { + sized: true, + }, + largest_niche: None, + align: AbiAndPrefAlign { + abi: Align { + pow2: 0, + }, + pref: Align { + pow2: 0, + }, + }, + size: Size { + raw: 1, + }, + }, + ], + }, + abi: Scalar( + Scalar { + value: Int( + I8, + false, + ), + valid_range: 0..=0, + }, + ), + largest_niche: Some( + Niche { + offset: Size { + raw: 0, + }, + scalar: Scalar { + value: Int( + I8, + false, + ), + valid_range: 0..=0, + }, + }, + ), + align: AbiAndPrefAlign { + abi: Align { + pow2: 0, + }, + pref: Align { + pow2: 0, + }, + }, + size: Size { + raw: 1, + }, + } --> $DIR/hexagon-enum.rs:16:1 | LL | enum A { Apple } | ^^^^^^^^^^^^^^^^ error: layout_of(B) = Layout { - fields: Arbitrary { - offsets: [ - Size { - raw: 0, - }, - ], - memory_index: [ - 0, - ], - }, - variants: Multiple { - tag: Scalar { - value: Int( - I8, - false, - ), - valid_range: 255..=255, - }, - tag_encoding: Direct, - tag_field: 0, - variants: [ - Layout { - fields: Arbitrary { - offsets: [], - memory_index: [], - }, - variants: Single { - index: 0, - }, - abi: Aggregate { - sized: true, - }, - largest_niche: None, - align: AbiAndPrefAlign { - abi: Align { - pow2: 0, - }, - pref: Align { - pow2: 0, - }, - }, - size: Size { - raw: 1, - }, - }, - ], - }, - abi: Scalar( - Scalar { - value: Int( - I8, - false, - ), - valid_range: 255..=255, - }, - ), - largest_niche: Some( - Niche { - offset: Size { - raw: 0, - }, - scalar: Scalar { - value: Int( - I8, - false, - ), - valid_range: 255..=255, - }, - }, - ), - align: AbiAndPrefAlign { - abi: Align { - pow2: 0, - }, - pref: Align { - pow2: 0, - }, - }, - size: Size { - raw: 1, - }, -} + fields: Arbitrary { + offsets: [ + Size { + raw: 0, + }, + ], + memory_index: [ + 0, + ], + }, + variants: Multiple { + tag: Scalar { + value: Int( + I8, + false, + ), + valid_range: 255..=255, + }, + tag_encoding: Direct, + tag_field: 0, + variants: [ + Layout { + fields: Arbitrary { + offsets: [], + memory_index: [], + }, + variants: Single { + index: 0, + }, + abi: Aggregate { + sized: true, + }, + largest_niche: None, + align: AbiAndPrefAlign { + abi: Align { + pow2: 0, + }, + pref: Align { + pow2: 0, + }, + }, + size: Size { + raw: 1, + }, + }, + ], + }, + abi: Scalar( + Scalar { + value: Int( + I8, + false, + ), + valid_range: 255..=255, + }, + ), + largest_niche: Some( + Niche { + offset: Size { + raw: 0, + }, + scalar: Scalar { + value: Int( + I8, + false, + ), + valid_range: 255..=255, + }, + }, + ), + align: AbiAndPrefAlign { + abi: Align { + pow2: 0, + }, + pref: Align { + pow2: 0, + }, + }, + size: Size { + raw: 1, + }, + } --> $DIR/hexagon-enum.rs:20:1 | LL | enum B { Banana = 255, } | ^^^^^^^^^^^^^^^^^^^^^^^^ error: layout_of(C) = Layout { - fields: Arbitrary { - offsets: [ - Size { - raw: 0, - }, - ], - memory_index: [ - 0, - ], - }, - variants: Multiple { - tag: Scalar { - value: Int( - I16, - false, - ), - valid_range: 256..=256, - }, - tag_encoding: Direct, - tag_field: 0, - variants: [ - Layout { - fields: Arbitrary { - offsets: [], - memory_index: [], - }, - variants: Single { - index: 0, - }, - abi: Aggregate { - sized: true, - }, - largest_niche: None, - align: AbiAndPrefAlign { - abi: Align { - pow2: 1, - }, - pref: Align { - pow2: 1, - }, - }, - size: Size { - raw: 2, - }, - }, - ], - }, - abi: Scalar( - Scalar { - value: Int( - I16, - false, - ), - valid_range: 256..=256, - }, - ), - largest_niche: Some( - Niche { - offset: Size { - raw: 0, - }, - scalar: Scalar { - value: Int( - I16, - false, - ), - valid_range: 256..=256, - }, - }, - ), - align: AbiAndPrefAlign { - abi: Align { - pow2: 1, - }, - pref: Align { - pow2: 1, - }, - }, - size: Size { - raw: 2, - }, -} + fields: Arbitrary { + offsets: [ + Size { + raw: 0, + }, + ], + memory_index: [ + 0, + ], + }, + variants: Multiple { + tag: Scalar { + value: Int( + I16, + false, + ), + valid_range: 256..=256, + }, + tag_encoding: Direct, + tag_field: 0, + variants: [ + Layout { + fields: Arbitrary { + offsets: [], + memory_index: [], + }, + variants: Single { + index: 0, + }, + abi: Aggregate { + sized: true, + }, + largest_niche: None, + align: AbiAndPrefAlign { + abi: Align { + pow2: 1, + }, + pref: Align { + pow2: 1, + }, + }, + size: Size { + raw: 2, + }, + }, + ], + }, + abi: Scalar( + Scalar { + value: Int( + I16, + false, + ), + valid_range: 256..=256, + }, + ), + largest_niche: Some( + Niche { + offset: Size { + raw: 0, + }, + scalar: Scalar { + value: Int( + I16, + false, + ), + valid_range: 256..=256, + }, + }, + ), + align: AbiAndPrefAlign { + abi: Align { + pow2: 1, + }, + pref: Align { + pow2: 1, + }, + }, + size: Size { + raw: 2, + }, + } --> $DIR/hexagon-enum.rs:24:1 | LL | enum C { Chaenomeles = 256, } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: layout_of(P) = Layout { - fields: Arbitrary { - offsets: [ - Size { - raw: 0, - }, - ], - memory_index: [ - 0, - ], - }, - variants: Multiple { - tag: Scalar { - value: Int( - I32, - false, - ), - valid_range: 268435456..=268435456, - }, - tag_encoding: Direct, - tag_field: 0, - variants: [ - Layout { - fields: Arbitrary { - offsets: [], - memory_index: [], - }, - variants: Single { - index: 0, - }, - abi: Aggregate { - sized: true, - }, - largest_niche: None, - align: AbiAndPrefAlign { - abi: Align { - pow2: 2, - }, - pref: Align { - pow2: 2, - }, - }, - size: Size { - raw: 4, - }, - }, - ], - }, - abi: Scalar( - Scalar { - value: Int( - I32, - false, - ), - valid_range: 268435456..=268435456, - }, - ), - largest_niche: Some( - Niche { - offset: Size { - raw: 0, - }, - scalar: Scalar { - value: Int( - I32, - false, - ), - valid_range: 268435456..=268435456, - }, - }, - ), - align: AbiAndPrefAlign { - abi: Align { - pow2: 2, - }, - pref: Align { - pow2: 2, - }, - }, - size: Size { - raw: 4, - }, -} + fields: Arbitrary { + offsets: [ + Size { + raw: 0, + }, + ], + memory_index: [ + 0, + ], + }, + variants: Multiple { + tag: Scalar { + value: Int( + I32, + false, + ), + valid_range: 268435456..=268435456, + }, + tag_encoding: Direct, + tag_field: 0, + variants: [ + Layout { + fields: Arbitrary { + offsets: [], + memory_index: [], + }, + variants: Single { + index: 0, + }, + abi: Aggregate { + sized: true, + }, + largest_niche: None, + align: AbiAndPrefAlign { + abi: Align { + pow2: 2, + }, + pref: Align { + pow2: 2, + }, + }, + size: Size { + raw: 4, + }, + }, + ], + }, + abi: Scalar( + Scalar { + value: Int( + I32, + false, + ), + valid_range: 268435456..=268435456, + }, + ), + largest_niche: Some( + Niche { + offset: Size { + raw: 0, + }, + scalar: Scalar { + value: Int( + I32, + false, + ), + valid_range: 268435456..=268435456, + }, + }, + ), + align: AbiAndPrefAlign { + abi: Align { + pow2: 2, + }, + pref: Align { + pow2: 2, + }, + }, + size: Size { + raw: 4, + }, + } --> $DIR/hexagon-enum.rs:28:1 | LL | enum P { Peach = 0x1000_0000isize, } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: layout_of(T) = Layout { - fields: Arbitrary { - offsets: [ - Size { - raw: 0, - }, - ], - memory_index: [ - 0, - ], - }, - variants: Multiple { - tag: Scalar { - value: Int( - I32, - true, - ), - valid_range: 2164260864..=2164260864, - }, - tag_encoding: Direct, - tag_field: 0, - variants: [ - Layout { - fields: Arbitrary { - offsets: [], - memory_index: [], - }, - variants: Single { - index: 0, - }, - abi: Aggregate { - sized: true, - }, - largest_niche: None, - align: AbiAndPrefAlign { - abi: Align { - pow2: 2, - }, - pref: Align { - pow2: 2, - }, - }, - size: Size { - raw: 4, - }, - }, - ], - }, - abi: Scalar( - Scalar { - value: Int( - I32, - true, - ), - valid_range: 2164260864..=2164260864, - }, - ), - largest_niche: Some( - Niche { - offset: Size { - raw: 0, - }, - scalar: Scalar { - value: Int( - I32, - true, - ), - valid_range: 2164260864..=2164260864, - }, - }, - ), - align: AbiAndPrefAlign { - abi: Align { - pow2: 2, - }, - pref: Align { - pow2: 2, - }, - }, - size: Size { - raw: 4, - }, -} + fields: Arbitrary { + offsets: [ + Size { + raw: 0, + }, + ], + memory_index: [ + 0, + ], + }, + variants: Multiple { + tag: Scalar { + value: Int( + I32, + true, + ), + valid_range: 2164260864..=2164260864, + }, + tag_encoding: Direct, + tag_field: 0, + variants: [ + Layout { + fields: Arbitrary { + offsets: [], + memory_index: [], + }, + variants: Single { + index: 0, + }, + abi: Aggregate { + sized: true, + }, + largest_niche: None, + align: AbiAndPrefAlign { + abi: Align { + pow2: 2, + }, + pref: Align { + pow2: 2, + }, + }, + size: Size { + raw: 4, + }, + }, + ], + }, + abi: Scalar( + Scalar { + value: Int( + I32, + true, + ), + valid_range: 2164260864..=2164260864, + }, + ), + largest_niche: Some( + Niche { + offset: Size { + raw: 0, + }, + scalar: Scalar { + value: Int( + I32, + true, + ), + valid_range: 2164260864..=2164260864, + }, + }, + ), + align: AbiAndPrefAlign { + abi: Align { + pow2: 2, + }, + pref: Align { + pow2: 2, + }, + }, + size: Size { + raw: 4, + }, + } --> $DIR/hexagon-enum.rs:34:1 | LL | enum T { Tangerine = TANGERINE as isize } diff --git a/src/test/ui/layout/thumb-enum.stderr b/src/test/ui/layout/thumb-enum.stderr index 898a61b904db5..144ab02792e50 100644 --- a/src/test/ui/layout/thumb-enum.stderr +++ b/src/test/ui/layout/thumb-enum.stderr @@ -1,438 +1,438 @@ error: layout_of(A) = Layout { - fields: Arbitrary { - offsets: [ - Size { - raw: 0, - }, - ], - memory_index: [ - 0, - ], - }, - variants: Multiple { - tag: Scalar { - value: Int( - I8, - false, - ), - valid_range: 0..=0, - }, - tag_encoding: Direct, - tag_field: 0, - variants: [ - Layout { - fields: Arbitrary { - offsets: [], - memory_index: [], - }, - variants: Single { - index: 0, - }, - abi: Aggregate { - sized: true, - }, - largest_niche: None, - align: AbiAndPrefAlign { - abi: Align { - pow2: 0, - }, - pref: Align { - pow2: 2, - }, - }, - size: Size { - raw: 1, - }, - }, - ], - }, - abi: Scalar( - Scalar { - value: Int( - I8, - false, - ), - valid_range: 0..=0, - }, - ), - largest_niche: Some( - Niche { - offset: Size { - raw: 0, - }, - scalar: Scalar { - value: Int( - I8, - false, - ), - valid_range: 0..=0, - }, - }, - ), - align: AbiAndPrefAlign { - abi: Align { - pow2: 0, - }, - pref: Align { - pow2: 2, - }, - }, - size: Size { - raw: 1, - }, -} + fields: Arbitrary { + offsets: [ + Size { + raw: 0, + }, + ], + memory_index: [ + 0, + ], + }, + variants: Multiple { + tag: Scalar { + value: Int( + I8, + false, + ), + valid_range: 0..=0, + }, + tag_encoding: Direct, + tag_field: 0, + variants: [ + Layout { + fields: Arbitrary { + offsets: [], + memory_index: [], + }, + variants: Single { + index: 0, + }, + abi: Aggregate { + sized: true, + }, + largest_niche: None, + align: AbiAndPrefAlign { + abi: Align { + pow2: 0, + }, + pref: Align { + pow2: 2, + }, + }, + size: Size { + raw: 1, + }, + }, + ], + }, + abi: Scalar( + Scalar { + value: Int( + I8, + false, + ), + valid_range: 0..=0, + }, + ), + largest_niche: Some( + Niche { + offset: Size { + raw: 0, + }, + scalar: Scalar { + value: Int( + I8, + false, + ), + valid_range: 0..=0, + }, + }, + ), + align: AbiAndPrefAlign { + abi: Align { + pow2: 0, + }, + pref: Align { + pow2: 2, + }, + }, + size: Size { + raw: 1, + }, + } --> $DIR/thumb-enum.rs:16:1 | LL | enum A { Apple } | ^^^^^^^^^^^^^^^^ error: layout_of(B) = Layout { - fields: Arbitrary { - offsets: [ - Size { - raw: 0, - }, - ], - memory_index: [ - 0, - ], - }, - variants: Multiple { - tag: Scalar { - value: Int( - I8, - false, - ), - valid_range: 255..=255, - }, - tag_encoding: Direct, - tag_field: 0, - variants: [ - Layout { - fields: Arbitrary { - offsets: [], - memory_index: [], - }, - variants: Single { - index: 0, - }, - abi: Aggregate { - sized: true, - }, - largest_niche: None, - align: AbiAndPrefAlign { - abi: Align { - pow2: 0, - }, - pref: Align { - pow2: 2, - }, - }, - size: Size { - raw: 1, - }, - }, - ], - }, - abi: Scalar( - Scalar { - value: Int( - I8, - false, - ), - valid_range: 255..=255, - }, - ), - largest_niche: Some( - Niche { - offset: Size { - raw: 0, - }, - scalar: Scalar { - value: Int( - I8, - false, - ), - valid_range: 255..=255, - }, - }, - ), - align: AbiAndPrefAlign { - abi: Align { - pow2: 0, - }, - pref: Align { - pow2: 2, - }, - }, - size: Size { - raw: 1, - }, -} + fields: Arbitrary { + offsets: [ + Size { + raw: 0, + }, + ], + memory_index: [ + 0, + ], + }, + variants: Multiple { + tag: Scalar { + value: Int( + I8, + false, + ), + valid_range: 255..=255, + }, + tag_encoding: Direct, + tag_field: 0, + variants: [ + Layout { + fields: Arbitrary { + offsets: [], + memory_index: [], + }, + variants: Single { + index: 0, + }, + abi: Aggregate { + sized: true, + }, + largest_niche: None, + align: AbiAndPrefAlign { + abi: Align { + pow2: 0, + }, + pref: Align { + pow2: 2, + }, + }, + size: Size { + raw: 1, + }, + }, + ], + }, + abi: Scalar( + Scalar { + value: Int( + I8, + false, + ), + valid_range: 255..=255, + }, + ), + largest_niche: Some( + Niche { + offset: Size { + raw: 0, + }, + scalar: Scalar { + value: Int( + I8, + false, + ), + valid_range: 255..=255, + }, + }, + ), + align: AbiAndPrefAlign { + abi: Align { + pow2: 0, + }, + pref: Align { + pow2: 2, + }, + }, + size: Size { + raw: 1, + }, + } --> $DIR/thumb-enum.rs:20:1 | LL | enum B { Banana = 255, } | ^^^^^^^^^^^^^^^^^^^^^^^^ error: layout_of(C) = Layout { - fields: Arbitrary { - offsets: [ - Size { - raw: 0, - }, - ], - memory_index: [ - 0, - ], - }, - variants: Multiple { - tag: Scalar { - value: Int( - I16, - false, - ), - valid_range: 256..=256, - }, - tag_encoding: Direct, - tag_field: 0, - variants: [ - Layout { - fields: Arbitrary { - offsets: [], - memory_index: [], - }, - variants: Single { - index: 0, - }, - abi: Aggregate { - sized: true, - }, - largest_niche: None, - align: AbiAndPrefAlign { - abi: Align { - pow2: 1, - }, - pref: Align { - pow2: 2, - }, - }, - size: Size { - raw: 2, - }, - }, - ], - }, - abi: Scalar( - Scalar { - value: Int( - I16, - false, - ), - valid_range: 256..=256, - }, - ), - largest_niche: Some( - Niche { - offset: Size { - raw: 0, - }, - scalar: Scalar { - value: Int( - I16, - false, - ), - valid_range: 256..=256, - }, - }, - ), - align: AbiAndPrefAlign { - abi: Align { - pow2: 1, - }, - pref: Align { - pow2: 2, - }, - }, - size: Size { - raw: 2, - }, -} + fields: Arbitrary { + offsets: [ + Size { + raw: 0, + }, + ], + memory_index: [ + 0, + ], + }, + variants: Multiple { + tag: Scalar { + value: Int( + I16, + false, + ), + valid_range: 256..=256, + }, + tag_encoding: Direct, + tag_field: 0, + variants: [ + Layout { + fields: Arbitrary { + offsets: [], + memory_index: [], + }, + variants: Single { + index: 0, + }, + abi: Aggregate { + sized: true, + }, + largest_niche: None, + align: AbiAndPrefAlign { + abi: Align { + pow2: 1, + }, + pref: Align { + pow2: 2, + }, + }, + size: Size { + raw: 2, + }, + }, + ], + }, + abi: Scalar( + Scalar { + value: Int( + I16, + false, + ), + valid_range: 256..=256, + }, + ), + largest_niche: Some( + Niche { + offset: Size { + raw: 0, + }, + scalar: Scalar { + value: Int( + I16, + false, + ), + valid_range: 256..=256, + }, + }, + ), + align: AbiAndPrefAlign { + abi: Align { + pow2: 1, + }, + pref: Align { + pow2: 2, + }, + }, + size: Size { + raw: 2, + }, + } --> $DIR/thumb-enum.rs:24:1 | LL | enum C { Chaenomeles = 256, } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: layout_of(P) = Layout { - fields: Arbitrary { - offsets: [ - Size { - raw: 0, - }, - ], - memory_index: [ - 0, - ], - }, - variants: Multiple { - tag: Scalar { - value: Int( - I32, - false, - ), - valid_range: 268435456..=268435456, - }, - tag_encoding: Direct, - tag_field: 0, - variants: [ - Layout { - fields: Arbitrary { - offsets: [], - memory_index: [], - }, - variants: Single { - index: 0, - }, - abi: Aggregate { - sized: true, - }, - largest_niche: None, - align: AbiAndPrefAlign { - abi: Align { - pow2: 2, - }, - pref: Align { - pow2: 2, - }, - }, - size: Size { - raw: 4, - }, - }, - ], - }, - abi: Scalar( - Scalar { - value: Int( - I32, - false, - ), - valid_range: 268435456..=268435456, - }, - ), - largest_niche: Some( - Niche { - offset: Size { - raw: 0, - }, - scalar: Scalar { - value: Int( - I32, - false, - ), - valid_range: 268435456..=268435456, - }, - }, - ), - align: AbiAndPrefAlign { - abi: Align { - pow2: 2, - }, - pref: Align { - pow2: 2, - }, - }, - size: Size { - raw: 4, - }, -} + fields: Arbitrary { + offsets: [ + Size { + raw: 0, + }, + ], + memory_index: [ + 0, + ], + }, + variants: Multiple { + tag: Scalar { + value: Int( + I32, + false, + ), + valid_range: 268435456..=268435456, + }, + tag_encoding: Direct, + tag_field: 0, + variants: [ + Layout { + fields: Arbitrary { + offsets: [], + memory_index: [], + }, + variants: Single { + index: 0, + }, + abi: Aggregate { + sized: true, + }, + largest_niche: None, + align: AbiAndPrefAlign { + abi: Align { + pow2: 2, + }, + pref: Align { + pow2: 2, + }, + }, + size: Size { + raw: 4, + }, + }, + ], + }, + abi: Scalar( + Scalar { + value: Int( + I32, + false, + ), + valid_range: 268435456..=268435456, + }, + ), + largest_niche: Some( + Niche { + offset: Size { + raw: 0, + }, + scalar: Scalar { + value: Int( + I32, + false, + ), + valid_range: 268435456..=268435456, + }, + }, + ), + align: AbiAndPrefAlign { + abi: Align { + pow2: 2, + }, + pref: Align { + pow2: 2, + }, + }, + size: Size { + raw: 4, + }, + } --> $DIR/thumb-enum.rs:28:1 | LL | enum P { Peach = 0x1000_0000isize, } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: layout_of(T) = Layout { - fields: Arbitrary { - offsets: [ - Size { - raw: 0, - }, - ], - memory_index: [ - 0, - ], - }, - variants: Multiple { - tag: Scalar { - value: Int( - I32, - true, - ), - valid_range: 2164260864..=2164260864, - }, - tag_encoding: Direct, - tag_field: 0, - variants: [ - Layout { - fields: Arbitrary { - offsets: [], - memory_index: [], - }, - variants: Single { - index: 0, - }, - abi: Aggregate { - sized: true, - }, - largest_niche: None, - align: AbiAndPrefAlign { - abi: Align { - pow2: 2, - }, - pref: Align { - pow2: 2, - }, - }, - size: Size { - raw: 4, - }, - }, - ], - }, - abi: Scalar( - Scalar { - value: Int( - I32, - true, - ), - valid_range: 2164260864..=2164260864, - }, - ), - largest_niche: Some( - Niche { - offset: Size { - raw: 0, - }, - scalar: Scalar { - value: Int( - I32, - true, - ), - valid_range: 2164260864..=2164260864, - }, - }, - ), - align: AbiAndPrefAlign { - abi: Align { - pow2: 2, - }, - pref: Align { - pow2: 2, - }, - }, - size: Size { - raw: 4, - }, -} + fields: Arbitrary { + offsets: [ + Size { + raw: 0, + }, + ], + memory_index: [ + 0, + ], + }, + variants: Multiple { + tag: Scalar { + value: Int( + I32, + true, + ), + valid_range: 2164260864..=2164260864, + }, + tag_encoding: Direct, + tag_field: 0, + variants: [ + Layout { + fields: Arbitrary { + offsets: [], + memory_index: [], + }, + variants: Single { + index: 0, + }, + abi: Aggregate { + sized: true, + }, + largest_niche: None, + align: AbiAndPrefAlign { + abi: Align { + pow2: 2, + }, + pref: Align { + pow2: 2, + }, + }, + size: Size { + raw: 4, + }, + }, + ], + }, + abi: Scalar( + Scalar { + value: Int( + I32, + true, + ), + valid_range: 2164260864..=2164260864, + }, + ), + largest_niche: Some( + Niche { + offset: Size { + raw: 0, + }, + scalar: Scalar { + value: Int( + I32, + true, + ), + valid_range: 2164260864..=2164260864, + }, + }, + ), + align: AbiAndPrefAlign { + abi: Align { + pow2: 2, + }, + pref: Align { + pow2: 2, + }, + }, + size: Size { + raw: 4, + }, + } --> $DIR/thumb-enum.rs:34:1 | LL | enum T { Tangerine = TANGERINE as isize } diff --git a/src/test/ui/lifetimes/issue-34979.stderr b/src/test/ui/lifetimes/issue-34979.stderr index b76d71a3d43c4..1b97f8d818a45 100644 --- a/src/test/ui/lifetimes/issue-34979.stderr +++ b/src/test/ui/lifetimes/issue-34979.stderr @@ -5,11 +5,6 @@ LL | &'a (): Foo, | ^^^ cannot infer type for reference `&'a ()` | = note: cannot satisfy `&'a (): Foo` -note: required by a bound in `Foo` - --> $DIR/issue-34979.rs:1:1 - | -LL | trait Foo {} - | ^^^^^^^^^ required by this bound in `Foo` error: aborting due to previous error diff --git a/src/test/ui/lint/unused/unused-attr-duplicate.rs b/src/test/ui/lint/unused/unused-attr-duplicate.rs new file mode 100644 index 0000000000000..074d5a92ad620 --- /dev/null +++ b/src/test/ui/lint/unused/unused-attr-duplicate.rs @@ -0,0 +1,108 @@ +// Tests for repeating attribute warnings. +// aux-build:lint_unused_extern_crate.rs +// compile-flags:--test +// Not tested due to extra requirements: +// - panic_handler: needs extra setup +// - target_feature: platform-specific +// - link_section: platform-specific +// - proc_macro, proc_macro_derive, proc_macro_attribute: needs to be a +// proc-macro, and have special handling for mixing. +// - unstable attributes (not going to bother) +// - no_main: extra setup +#![deny(unused_attributes)] +#![crate_name = "unused_attr_duplicate"] +#![crate_name = "unused_attr_duplicate2"] //~ ERROR unused attribute +//~^ WARN this was previously accepted +#![crate_type = "bin"] +#![crate_type = "rlib"] //~ ERROR unused attribute +//~^ WARN this was previously accepted +#![recursion_limit = "128"] +#![recursion_limit = "256"] //~ ERROR unused attribute +//~^ WARN this was previously accepted +#![type_length_limit = "1048576"] +#![type_length_limit = "1"] //~ ERROR unused attribute +//~^ WARN this was previously accepted +#![no_std] +#![no_std] //~ ERROR unused attribute +#![no_implicit_prelude] +#![no_implicit_prelude] //~ ERROR unused attribute +#![windows_subsystem = "console"] +#![windows_subsystem = "windows"] //~ ERROR unused attribute +//~^ WARN this was previously accepted +#![no_builtins] +#![no_builtins] //~ ERROR unused attribute + +#[no_link] +#[no_link] //~ ERROR unused attribute +extern crate lint_unused_extern_crate; + +#[macro_use] +#[macro_use] //~ ERROR unused attribute +pub mod m { + #[macro_export] + #[macro_export] //~ ERROR unused attribute + macro_rules! foo { + () => {}; + } +} + +#[path = "auxiliary/lint_unused_extern_crate.rs"] +#[path = "bar.rs"] //~ ERROR unused attribute +//~^ WARN this was previously accepted +pub mod from_path; + +#[test] +#[ignore] +#[ignore = "some text"] //~ ERROR unused attribute +#[should_panic] +#[should_panic(expected = "values don't match")] //~ ERROR unused attribute +//~^ WARN this was previously accepted +fn t1() {} + +#[must_use] +#[must_use = "some message"] //~ ERROR unused attribute +//~^ WARN this was previously accepted +// No warnings for #[repr], would require more logic. +#[repr(C)] +#[repr(C)] +#[non_exhaustive] +#[non_exhaustive] //~ ERROR unused attribute +pub struct X; + +#[automatically_derived] +#[automatically_derived] //~ ERROR unused attribute +impl X {} + +#[inline(always)] +#[inline(never)] //~ ERROR unused attribute +//~^ WARN this was previously accepted +#[cold] +#[cold] //~ ERROR unused attribute +#[track_caller] +#[track_caller] //~ ERROR unused attribute +pub fn xyz() {} + +// No warnings for #[link], would require more logic. +#[link(name = "rust_test_helpers", kind = "static")] +#[link(name = "rust_test_helpers", kind = "static")] +extern "C" { + #[link_name = "this_does_not_exist"] //~ ERROR unused attribute + //~^ WARN this was previously accepted + #[link_name = "rust_dbg_extern_identity_u32"] + pub fn name_in_rust(v: u32) -> u32; +} + +#[export_name = "exported_symbol_name"] //~ ERROR unused attribute +//~^ WARN this was previously accepted +#[export_name = "exported_symbol_name2"] +pub fn export_test() {} + +#[no_mangle] +#[no_mangle] //~ ERROR unused attribute +pub fn no_mangle_test() {} + +#[used] +#[used] //~ ERROR unused attribute +static FOO: u32 = 0; + +fn main() {} diff --git a/src/test/ui/lint/unused/unused-attr-duplicate.stderr b/src/test/ui/lint/unused/unused-attr-duplicate.stderr new file mode 100644 index 0000000000000..d4305add0aa4f --- /dev/null +++ b/src/test/ui/lint/unused/unused-attr-duplicate.stderr @@ -0,0 +1,306 @@ +error: unused attribute + --> $DIR/unused-attr-duplicate.rs:36:1 + | +LL | #[no_link] + | ^^^^^^^^^^ help: remove this attribute + | +note: the lint level is defined here + --> $DIR/unused-attr-duplicate.rs:12:9 + | +LL | #![deny(unused_attributes)] + | ^^^^^^^^^^^^^^^^^ +note: attribute also specified here + --> $DIR/unused-attr-duplicate.rs:35:1 + | +LL | #[no_link] + | ^^^^^^^^^^ + +error: unused attribute + --> $DIR/unused-attr-duplicate.rs:40:1 + | +LL | #[macro_use] + | ^^^^^^^^^^^^ help: remove this attribute + | +note: attribute also specified here + --> $DIR/unused-attr-duplicate.rs:39:1 + | +LL | #[macro_use] + | ^^^^^^^^^^^^ + +error: unused attribute + --> $DIR/unused-attr-duplicate.rs:50:1 + | +LL | #[path = "bar.rs"] + | ^^^^^^^^^^^^^^^^^^ help: remove this attribute + | +note: attribute also specified here + --> $DIR/unused-attr-duplicate.rs:49:1 + | +LL | #[path = "auxiliary/lint_unused_extern_crate.rs"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + +error: unused attribute + --> $DIR/unused-attr-duplicate.rs:56:1 + | +LL | #[ignore = "some text"] + | ^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | +note: attribute also specified here + --> $DIR/unused-attr-duplicate.rs:55:1 + | +LL | #[ignore] + | ^^^^^^^^^ + +error: unused attribute + --> $DIR/unused-attr-duplicate.rs:58:1 + | +LL | #[should_panic(expected = "values don't match")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | +note: attribute also specified here + --> $DIR/unused-attr-duplicate.rs:57:1 + | +LL | #[should_panic] + | ^^^^^^^^^^^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + +error: unused attribute + --> $DIR/unused-attr-duplicate.rs:63:1 + | +LL | #[must_use = "some message"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | +note: attribute also specified here + --> $DIR/unused-attr-duplicate.rs:62:1 + | +LL | #[must_use] + | ^^^^^^^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + +error: unused attribute + --> $DIR/unused-attr-duplicate.rs:69:1 + | +LL | #[non_exhaustive] + | ^^^^^^^^^^^^^^^^^ help: remove this attribute + | +note: attribute also specified here + --> $DIR/unused-attr-duplicate.rs:68:1 + | +LL | #[non_exhaustive] + | ^^^^^^^^^^^^^^^^^ + +error: unused attribute + --> $DIR/unused-attr-duplicate.rs:73:1 + | +LL | #[automatically_derived] + | ^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | +note: attribute also specified here + --> $DIR/unused-attr-duplicate.rs:72:1 + | +LL | #[automatically_derived] + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +error: unused attribute + --> $DIR/unused-attr-duplicate.rs:77:1 + | +LL | #[inline(never)] + | ^^^^^^^^^^^^^^^^ help: remove this attribute + | +note: attribute also specified here + --> $DIR/unused-attr-duplicate.rs:76:1 + | +LL | #[inline(always)] + | ^^^^^^^^^^^^^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + +error: unused attribute + --> $DIR/unused-attr-duplicate.rs:80:1 + | +LL | #[cold] + | ^^^^^^^ help: remove this attribute + | +note: attribute also specified here + --> $DIR/unused-attr-duplicate.rs:79:1 + | +LL | #[cold] + | ^^^^^^^ + +error: unused attribute + --> $DIR/unused-attr-duplicate.rs:82:1 + | +LL | #[track_caller] + | ^^^^^^^^^^^^^^^ help: remove this attribute + | +note: attribute also specified here + --> $DIR/unused-attr-duplicate.rs:81:1 + | +LL | #[track_caller] + | ^^^^^^^^^^^^^^^ + +error: unused attribute + --> $DIR/unused-attr-duplicate.rs:95:1 + | +LL | #[export_name = "exported_symbol_name"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | +note: attribute also specified here + --> $DIR/unused-attr-duplicate.rs:97:1 + | +LL | #[export_name = "exported_symbol_name2"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + +error: unused attribute + --> $DIR/unused-attr-duplicate.rs:101:1 + | +LL | #[no_mangle] + | ^^^^^^^^^^^^ help: remove this attribute + | +note: attribute also specified here + --> $DIR/unused-attr-duplicate.rs:100:1 + | +LL | #[no_mangle] + | ^^^^^^^^^^^^ + +error: unused attribute + --> $DIR/unused-attr-duplicate.rs:105:1 + | +LL | #[used] + | ^^^^^^^ help: remove this attribute + | +note: attribute also specified here + --> $DIR/unused-attr-duplicate.rs:104:1 + | +LL | #[used] + | ^^^^^^^ + +error: unused attribute + --> $DIR/unused-attr-duplicate.rs:89:5 + | +LL | #[link_name = "this_does_not_exist"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | +note: attribute also specified here + --> $DIR/unused-attr-duplicate.rs:91:5 + | +LL | #[link_name = "rust_dbg_extern_identity_u32"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + +error: unused attribute + --> $DIR/unused-attr-duplicate.rs:14:1 + | +LL | #![crate_name = "unused_attr_duplicate2"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | +note: attribute also specified here + --> $DIR/unused-attr-duplicate.rs:13:1 + | +LL | #![crate_name = "unused_attr_duplicate"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + +error: unused attribute + --> $DIR/unused-attr-duplicate.rs:17:1 + | +LL | #![crate_type = "rlib"] + | ^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | +note: attribute also specified here + --> $DIR/unused-attr-duplicate.rs:16:1 + | +LL | #![crate_type = "bin"] + | ^^^^^^^^^^^^^^^^^^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + +error: unused attribute + --> $DIR/unused-attr-duplicate.rs:20:1 + | +LL | #![recursion_limit = "256"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | +note: attribute also specified here + --> $DIR/unused-attr-duplicate.rs:19:1 + | +LL | #![recursion_limit = "128"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + +error: unused attribute + --> $DIR/unused-attr-duplicate.rs:23:1 + | +LL | #![type_length_limit = "1"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | +note: attribute also specified here + --> $DIR/unused-attr-duplicate.rs:22:1 + | +LL | #![type_length_limit = "1048576"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + +error: unused attribute + --> $DIR/unused-attr-duplicate.rs:26:1 + | +LL | #![no_std] + | ^^^^^^^^^^ help: remove this attribute + | +note: attribute also specified here + --> $DIR/unused-attr-duplicate.rs:25:1 + | +LL | #![no_std] + | ^^^^^^^^^^ + +error: unused attribute + --> $DIR/unused-attr-duplicate.rs:28:1 + | +LL | #![no_implicit_prelude] + | ^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | +note: attribute also specified here + --> $DIR/unused-attr-duplicate.rs:27:1 + | +LL | #![no_implicit_prelude] + | ^^^^^^^^^^^^^^^^^^^^^^^ + +error: unused attribute + --> $DIR/unused-attr-duplicate.rs:30:1 + | +LL | #![windows_subsystem = "windows"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | +note: attribute also specified here + --> $DIR/unused-attr-duplicate.rs:29:1 + | +LL | #![windows_subsystem = "console"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + +error: unused attribute + --> $DIR/unused-attr-duplicate.rs:33:1 + | +LL | #![no_builtins] + | ^^^^^^^^^^^^^^^ help: remove this attribute + | +note: attribute also specified here + --> $DIR/unused-attr-duplicate.rs:32:1 + | +LL | #![no_builtins] + | ^^^^^^^^^^^^^^^ + +error: unused attribute + --> $DIR/unused-attr-duplicate.rs:43:5 + | +LL | #[macro_export] + | ^^^^^^^^^^^^^^^ help: remove this attribute + | +note: attribute also specified here + --> $DIR/unused-attr-duplicate.rs:42:5 + | +LL | #[macro_export] + | ^^^^^^^^^^^^^^^ + +error: aborting due to 24 previous errors + diff --git a/src/test/ui/macros/macro-use-all-and-none.stderr b/src/test/ui/macros/macro-use-all-and-none.stderr index bdee5f4d872a8..6de7ffb2f635b 100644 --- a/src/test/ui/macros/macro-use-all-and-none.stderr +++ b/src/test/ui/macros/macro-use-all-and-none.stderr @@ -2,13 +2,14 @@ warning: unused attribute --> $DIR/macro-use-all-and-none.rs:7:1 | LL | #[macro_use()] - | ^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^ help: remove this attribute | note: the lint level is defined here --> $DIR/macro-use-all-and-none.rs:4:9 | LL | #![warn(unused_attributes)] | ^^^^^^^^^^^^^^^^^ + = note: attribute `macro_use` with an empty list has no effect warning: 1 warning emitted diff --git a/src/test/ui/marker_trait_attr/region-overlap.stderr b/src/test/ui/marker_trait_attr/region-overlap.stderr index c1cc6cdaf53fa..2eeab801e3d9c 100644 --- a/src/test/ui/marker_trait_attr/region-overlap.stderr +++ b/src/test/ui/marker_trait_attr/region-overlap.stderr @@ -11,11 +11,6 @@ LL | impl<'a> A for (&'static (), &'a ()) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ LL | impl<'a> A for (&'a (), &'static ()) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: required by a bound in `A` - --> $DIR/region-overlap.rs:4:1 - | -LL | trait A {} - | ^^^^^^^ required by this bound in `A` error[E0283]: type annotations needed --> $DIR/region-overlap.rs:6:10 @@ -30,11 +25,6 @@ LL | impl<'a> A for (&'static (), &'a ()) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ LL | impl<'a> A for (&'a (), &'static ()) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: required by a bound in `A` - --> $DIR/region-overlap.rs:4:1 - | -LL | trait A {} - | ^^^^^^^ required by this bound in `A` error: aborting due to 2 previous errors diff --git a/src/test/ui/mismatched_types/abridged.stderr b/src/test/ui/mismatched_types/abridged.stderr index db4e8589291b7..ff1a836c9aec0 100644 --- a/src/test/ui/mismatched_types/abridged.stderr +++ b/src/test/ui/mismatched_types/abridged.stderr @@ -26,13 +26,14 @@ error[E0308]: mismatched types LL | fn b() -> Option { | ----------- expected `Option` because of return type LL | Foo { bar: 1 } - | ^^^^^^^^^^^^^^ - | | - | expected enum `Option`, found struct `Foo` - | help: try using a variant of the expected enum: `Some(Foo { bar: 1 })` + | ^^^^^^^^^^^^^^ expected enum `Option`, found struct `Foo` | = note: expected enum `Option` found struct `Foo` +help: try wrapping the expression in `Some` + | +LL | Some(Foo { bar: 1 }) + | +++++ + error[E0308]: mismatched types --> $DIR/abridged.rs:28:5 @@ -40,13 +41,14 @@ error[E0308]: mismatched types LL | fn c() -> Result { | ---------------- expected `Result` because of return type LL | Foo { bar: 1 } - | ^^^^^^^^^^^^^^ - | | - | expected enum `Result`, found struct `Foo` - | help: try using a variant of the expected enum: `Ok(Foo { bar: 1 })` + | ^^^^^^^^^^^^^^ expected enum `Result`, found struct `Foo` | = note: expected enum `Result` found struct `Foo` +help: try wrapping the expression in `Ok` + | +LL | Ok(Foo { bar: 1 }) + | +++ + error[E0308]: mismatched types --> $DIR/abridged.rs:39:5 diff --git a/src/test/ui/mismatched_types/closure-arg-count.stderr b/src/test/ui/mismatched_types/closure-arg-count.stderr index e8fcf80e940d2..fed47e0f17471 100644 --- a/src/test/ui/mismatched_types/closure-arg-count.stderr +++ b/src/test/ui/mismatched_types/closure-arg-count.stderr @@ -125,6 +125,12 @@ LL | let _it = vec![1, 2, 3].into_iter().enumerate().map(foo); ... LL | fn foo() {} | -------- takes 0 arguments + | +note: required by a bound in `map` + --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + | +LL | F: FnMut(Self::Item) -> B, + | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map` error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 3 distinct arguments --> $DIR/closure-arg-count.rs:27:57 @@ -135,6 +141,12 @@ LL | let _it = vec![1, 2, 3].into_iter().enumerate().map(bar); | --- ^^^ expected closure that takes a single 2-tuple as argument | | | required by a bound introduced by this call + | +note: required by a bound in `map` + --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + | +LL | F: FnMut(Self::Item) -> B, + | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map` error[E0593]: function is expected to take a single 2-tuple as argument, but it takes 2 distinct arguments --> $DIR/closure-arg-count.rs:29:57 @@ -146,6 +158,12 @@ LL | let _it = vec![1, 2, 3].into_iter().enumerate().map(qux); ... LL | fn qux(x: usize, y: usize) {} | -------------------------- takes 2 distinct arguments + | +note: required by a bound in `map` + --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + | +LL | F: FnMut(Self::Item) -> B, + | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map` error[E0593]: function is expected to take 1 argument, but it takes 2 arguments --> $DIR/closure-arg-count.rs:32:45 @@ -154,6 +172,12 @@ LL | let _it = vec![1, 2, 3].into_iter().map(usize::checked_add); | --- ^^^^^^^^^^^^^^^^^^ expected function that takes 1 argument | | | required by a bound introduced by this call + | +note: required by a bound in `map` + --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + | +LL | F: FnMut(Self::Item) -> B, + | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map` error[E0593]: function is expected to take 0 arguments, but it takes 1 argument --> $DIR/closure-arg-count.rs:35:10 diff --git a/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr b/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr index 0ec282dac45e2..f34ac35c75713 100644 --- a/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr +++ b/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr @@ -5,6 +5,12 @@ LL | a.iter().map(|_: (u32, u32)| 45); | ^^^ ------------------ found signature of `fn((u32, u32)) -> _` | | | expected signature of `fn(&(u32, u32)) -> _` + | +note: required by a bound in `map` + --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + | +LL | F: FnMut(Self::Item) -> B, + | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map` error[E0631]: type mismatch in closure arguments --> $DIR/closure-arg-type-mismatch.rs:4:14 @@ -13,6 +19,12 @@ LL | a.iter().map(|_: &(u16, u16)| 45); | ^^^ ------------------- found signature of `for<'r> fn(&'r (u16, u16)) -> _` | | | expected signature of `fn(&(u32, u32)) -> _` + | +note: required by a bound in `map` + --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + | +LL | F: FnMut(Self::Item) -> B, + | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map` error[E0631]: type mismatch in closure arguments --> $DIR/closure-arg-type-mismatch.rs:5:14 @@ -21,6 +33,12 @@ LL | a.iter().map(|_: (u16, u16)| 45); | ^^^ ------------------ found signature of `fn((u16, u16)) -> _` | | | expected signature of `fn(&(u32, u32)) -> _` + | +note: required by a bound in `map` + --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + | +LL | F: FnMut(Self::Item) -> B, + | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map` error[E0308]: mismatched types --> $DIR/closure-arg-type-mismatch.rs:10:5 diff --git a/src/test/ui/mismatched_types/issue-36053-2.stderr b/src/test/ui/mismatched_types/issue-36053-2.stderr index 67e8ee2283689..a8bcdf5efe91e 100644 --- a/src/test/ui/mismatched_types/issue-36053-2.stderr +++ b/src/test/ui/mismatched_types/issue-36053-2.stderr @@ -5,6 +5,12 @@ LL | once::<&str>("str").fuse().filter(|a: &str| true).count(); | ^^^^^^ -------------- found signature of `for<'r> fn(&'r str) -> _` | | | expected signature of `for<'r> fn(&'r &str) -> _` + | +note: required by a bound in `filter` + --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + | +LL | P: FnMut(&Self::Item) -> bool, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `filter` error[E0599]: the method `count` exists for struct `Filter>, [closure@$DIR/issue-36053-2.rs:7:39: 7:53]>`, but its trait bounds were not satisfied --> $DIR/issue-36053-2.rs:7:55 diff --git a/src/test/ui/issues/auxiliary/issue-69725.rs b/src/test/ui/missing-trait-bounds/auxiliary/issue-69725.rs similarity index 100% rename from src/test/ui/issues/auxiliary/issue-69725.rs rename to src/test/ui/missing-trait-bounds/auxiliary/issue-69725.rs diff --git a/src/test/ui/missing-trait-bounds/issue-35677.fixed b/src/test/ui/missing-trait-bounds/issue-35677.fixed new file mode 100644 index 0000000000000..08174d8d8d53a --- /dev/null +++ b/src/test/ui/missing-trait-bounds/issue-35677.fixed @@ -0,0 +1,11 @@ +// run-rustfix +#![allow(dead_code)] +use std::collections::HashSet; +use std::hash::Hash; + +fn is_subset(this: &HashSet, other: &HashSet) -> bool where T: Eq, T: Hash { + this.is_subset(other) + //~^ ERROR the method +} + +fn main() {} diff --git a/src/test/ui/issues/issue-35677.rs b/src/test/ui/missing-trait-bounds/issue-35677.rs similarity index 74% rename from src/test/ui/issues/issue-35677.rs rename to src/test/ui/missing-trait-bounds/issue-35677.rs index 15d139790625e..2cb394386b8aa 100644 --- a/src/test/ui/issues/issue-35677.rs +++ b/src/test/ui/missing-trait-bounds/issue-35677.rs @@ -1,4 +1,7 @@ +// run-rustfix +#![allow(dead_code)] use std::collections::HashSet; +use std::hash::Hash; fn is_subset(this: &HashSet, other: &HashSet) -> bool { this.is_subset(other) diff --git a/src/test/ui/issues/issue-35677.stderr b/src/test/ui/missing-trait-bounds/issue-35677.stderr similarity index 61% rename from src/test/ui/issues/issue-35677.stderr rename to src/test/ui/missing-trait-bounds/issue-35677.stderr index ab59e5d1acf6a..a2201b946a6f0 100644 --- a/src/test/ui/issues/issue-35677.stderr +++ b/src/test/ui/missing-trait-bounds/issue-35677.stderr @@ -1,5 +1,5 @@ error[E0599]: the method `is_subset` exists for reference `&HashSet`, but its trait bounds were not satisfied - --> $DIR/issue-35677.rs:4:10 + --> $DIR/issue-35677.rs:7:10 | LL | this.is_subset(other) | ^^^^^^^^^ method cannot be called on `&HashSet` due to unsatisfied trait bounds @@ -7,6 +7,10 @@ LL | this.is_subset(other) = note: the following trait bounds were not satisfied: `T: Eq` `T: Hash` +help: consider restricting the type parameters to satisfy the trait bounds + | +LL | fn is_subset(this: &HashSet, other: &HashSet) -> bool where T: Eq, T: Hash { + | ++++++++++++++++++++ error: aborting due to previous error diff --git a/src/test/ui/missing-trait-bounds/issue-69725.fixed b/src/test/ui/missing-trait-bounds/issue-69725.fixed new file mode 100644 index 0000000000000..d57badcfd8cf8 --- /dev/null +++ b/src/test/ui/missing-trait-bounds/issue-69725.fixed @@ -0,0 +1,13 @@ +// run-rustfix +// aux-build:issue-69725.rs +#![allow(dead_code)] + +extern crate issue_69725; +use issue_69725::Struct; + +fn crash() where A: Clone { + let _ = Struct::::new().clone(); + //~^ ERROR: the method +} + +fn main() {} diff --git a/src/test/ui/issues/issue-69725.rs b/src/test/ui/missing-trait-bounds/issue-69725.rs similarity index 83% rename from src/test/ui/issues/issue-69725.rs rename to src/test/ui/missing-trait-bounds/issue-69725.rs index 7c77293945eb7..9c88969c5cff8 100644 --- a/src/test/ui/issues/issue-69725.rs +++ b/src/test/ui/missing-trait-bounds/issue-69725.rs @@ -1,4 +1,6 @@ +// run-rustfix // aux-build:issue-69725.rs +#![allow(dead_code)] extern crate issue_69725; use issue_69725::Struct; diff --git a/src/test/ui/issues/issue-69725.stderr b/src/test/ui/missing-trait-bounds/issue-69725.stderr similarity index 78% rename from src/test/ui/issues/issue-69725.stderr rename to src/test/ui/missing-trait-bounds/issue-69725.stderr index b1ba89f6cbecf..6395bca300c92 100644 --- a/src/test/ui/issues/issue-69725.stderr +++ b/src/test/ui/missing-trait-bounds/issue-69725.stderr @@ -1,5 +1,5 @@ error[E0599]: the method `clone` exists for struct `Struct`, but its trait bounds were not satisfied - --> $DIR/issue-69725.rs:7:32 + --> $DIR/issue-69725.rs:9:32 | LL | let _ = Struct::::new().clone(); | ^^^^^ method cannot be called on `Struct` due to unsatisfied trait bounds @@ -12,6 +12,10 @@ LL | pub struct Struct(A); = note: the following trait bounds were not satisfied: `A: Clone` which is required by `Struct: Clone` +help: consider restricting the type parameter to satisfy the trait bound + | +LL | fn crash() where A: Clone { + | ++++++++++++++ error: aborting due to previous error diff --git a/src/test/ui/suggestions/missing-trait-bound-for-op.fixed b/src/test/ui/missing-trait-bounds/missing-trait-bound-for-op.fixed similarity index 100% rename from src/test/ui/suggestions/missing-trait-bound-for-op.fixed rename to src/test/ui/missing-trait-bounds/missing-trait-bound-for-op.fixed diff --git a/src/test/ui/suggestions/missing-trait-bound-for-op.rs b/src/test/ui/missing-trait-bounds/missing-trait-bound-for-op.rs similarity index 100% rename from src/test/ui/suggestions/missing-trait-bound-for-op.rs rename to src/test/ui/missing-trait-bounds/missing-trait-bound-for-op.rs diff --git a/src/test/ui/suggestions/missing-trait-bound-for-op.stderr b/src/test/ui/missing-trait-bounds/missing-trait-bound-for-op.stderr similarity index 100% rename from src/test/ui/suggestions/missing-trait-bound-for-op.stderr rename to src/test/ui/missing-trait-bounds/missing-trait-bound-for-op.stderr diff --git a/src/test/ui/suggestions/missing-trait-bounds-for-method-call.rs b/src/test/ui/missing-trait-bounds/missing-trait-bounds-for-method-call.rs similarity index 100% rename from src/test/ui/suggestions/missing-trait-bounds-for-method-call.rs rename to src/test/ui/missing-trait-bounds/missing-trait-bounds-for-method-call.rs diff --git a/src/test/ui/suggestions/missing-trait-bounds-for-method-call.stderr b/src/test/ui/missing-trait-bounds/missing-trait-bounds-for-method-call.stderr similarity index 100% rename from src/test/ui/suggestions/missing-trait-bounds-for-method-call.stderr rename to src/test/ui/missing-trait-bounds/missing-trait-bounds-for-method-call.stderr diff --git a/src/test/ui/never_type/never-value-fallback-issue-66757.nofallback.stderr b/src/test/ui/never_type/never-value-fallback-issue-66757.nofallback.stderr index 614cdff1f8022..a14253e384a3a 100644 --- a/src/test/ui/never_type/never-value-fallback-issue-66757.nofallback.stderr +++ b/src/test/ui/never_type/never-value-fallback-issue-66757.nofallback.stderr @@ -6,11 +6,6 @@ LL | >::from(never); | = help: the following implementations were found: > -note: required by `from` - --> $SRC_DIR/core/src/convert/mod.rs:LL:COL - | -LL | fn from(_: T) -> Self; - | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/on-unimplemented/multiple-impls.stderr b/src/test/ui/on-unimplemented/multiple-impls.stderr index a3658f2242606..76aa128e242f9 100644 --- a/src/test/ui/on-unimplemented/multiple-impls.stderr +++ b/src/test/ui/on-unimplemented/multiple-impls.stderr @@ -7,11 +7,6 @@ LL | Index::index(&[] as &[i32], 2u32); | required by a bound introduced by this call | = help: the trait `Index` is not implemented for `[i32]` -note: required by `Index::index` - --> $DIR/multiple-impls.rs:12:5 - | -LL | fn index(&self, index: Idx) -> &Self::Output; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `[i32]: Index>` is not satisfied --> $DIR/multiple-impls.rs:36:18 @@ -22,11 +17,6 @@ LL | Index::index(&[] as &[i32], Foo(2u32)); | required by a bound introduced by this call | = help: the trait `Index>` is not implemented for `[i32]` -note: required by `Index::index` - --> $DIR/multiple-impls.rs:12:5 - | -LL | fn index(&self, index: Idx) -> &Self::Output; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `[i32]: Index>` is not satisfied --> $DIR/multiple-impls.rs:39:18 @@ -37,11 +27,6 @@ LL | Index::index(&[] as &[i32], Bar(2u32)); | required by a bound introduced by this call | = help: the trait `Index>` is not implemented for `[i32]` -note: required by `Index::index` - --> $DIR/multiple-impls.rs:12:5 - | -LL | fn index(&self, index: Idx) -> &Self::Output; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `[i32]: Index` is not satisfied --> $DIR/multiple-impls.rs:33:5 diff --git a/src/test/ui/on-unimplemented/on-impl.stderr b/src/test/ui/on-unimplemented/on-impl.stderr index 18eca06ba6981..940763fae51b8 100644 --- a/src/test/ui/on-unimplemented/on-impl.stderr +++ b/src/test/ui/on-unimplemented/on-impl.stderr @@ -7,11 +7,6 @@ LL | Index::::index(&[1, 2, 3] as &[i32], 2u32); | required by a bound introduced by this call | = help: the trait `Index` is not implemented for `[i32]` -note: required by `Index::index` - --> $DIR/on-impl.rs:9:5 - | -LL | fn index(&self, index: Idx) -> &Self::Output; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `[i32]: Index` is not satisfied --> $DIR/on-impl.rs:22:5 diff --git a/src/test/ui/parser/struct-literal-in-for.stderr b/src/test/ui/parser/struct-literal-in-for.stderr index feabd8f5813b8..4b191710c393a 100644 --- a/src/test/ui/parser/struct-literal-in-for.stderr +++ b/src/test/ui/parser/struct-literal-in-for.stderr @@ -25,11 +25,6 @@ LL | | }.hi() { | = help: the trait `Iterator` is not implemented for `bool` = note: required because of the requirements on the impl of `IntoIterator` for `bool` -note: required by `into_iter` - --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/pattern/pat-type-err-let-stmt.stderr b/src/test/ui/pattern/pat-type-err-let-stmt.stderr index 4b4fb08928327..090bd67117eab 100644 --- a/src/test/ui/pattern/pat-type-err-let-stmt.stderr +++ b/src/test/ui/pattern/pat-type-err-let-stmt.stderr @@ -2,14 +2,16 @@ error[E0308]: mismatched types --> $DIR/pat-type-err-let-stmt.rs:6:29 | LL | let Ok(0): Option = 42u8; - | ---------- ^^^^ - | | | - | | expected enum `Option`, found `u8` - | | help: try using a variant of the expected enum: `Some(42u8)` + | ---------- ^^^^ expected enum `Option`, found `u8` + | | | expected due to this | = note: expected enum `Option` found type `u8` +help: try wrapping the expression in `Some` + | +LL | let Ok(0): Option = Some(42u8); + | +++++ + error[E0308]: mismatched types --> $DIR/pat-type-err-let-stmt.rs:6:9 diff --git a/src/test/ui/range/range-1.stderr b/src/test/ui/range/range-1.stderr index ff494d7d4b806..2ce4e1553d28e 100644 --- a/src/test/ui/range/range-1.stderr +++ b/src/test/ui/range/range-1.stderr @@ -12,11 +12,6 @@ LL | for i in false..true {} | = note: required because of the requirements on the impl of `Iterator` for `std::ops::Range` = note: required because of the requirements on the impl of `IntoIterator` for `std::ops::Range` -note: required by `into_iter` - --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the size for values of type `[{integer}]` cannot be known at compilation time --> $DIR/range-1.rs:14:17 diff --git a/src/test/ui/range/range_traits-1.stderr b/src/test/ui/range/range_traits-1.stderr index 34c59fcb318a9..617afc995305e 100644 --- a/src/test/ui/range/range_traits-1.stderr +++ b/src/test/ui/range/range_traits-1.stderr @@ -8,11 +8,6 @@ LL | a: Range, | ^^^^^^^^^^^^^^^ no implementation for `std::ops::Range < std::ops::Range` and `std::ops::Range > std::ops::Range` | = help: the trait `PartialOrd` is not implemented for `std::ops::Range` -note: required by `std::cmp::PartialOrd::partial_cmp` - --> $SRC_DIR/core/src/cmp.rs:LL:COL - | -LL | fn partial_cmp(&self, other: &Rhs) -> Option; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: can't compare `std::ops::RangeTo` with `std::ops::RangeTo` @@ -25,11 +20,6 @@ LL | b: RangeTo, | ^^^^^^^^^^^^^^^^^ no implementation for `std::ops::RangeTo < std::ops::RangeTo` and `std::ops::RangeTo > std::ops::RangeTo` | = help: the trait `PartialOrd` is not implemented for `std::ops::RangeTo` -note: required by `std::cmp::PartialOrd::partial_cmp` - --> $SRC_DIR/core/src/cmp.rs:LL:COL - | -LL | fn partial_cmp(&self, other: &Rhs) -> Option; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: can't compare `std::ops::RangeFrom` with `std::ops::RangeFrom` @@ -42,11 +32,6 @@ LL | c: RangeFrom, | ^^^^^^^^^^^^^^^^^^^ no implementation for `std::ops::RangeFrom < std::ops::RangeFrom` and `std::ops::RangeFrom > std::ops::RangeFrom` | = help: the trait `PartialOrd` is not implemented for `std::ops::RangeFrom` -note: required by `std::cmp::PartialOrd::partial_cmp` - --> $SRC_DIR/core/src/cmp.rs:LL:COL - | -LL | fn partial_cmp(&self, other: &Rhs) -> Option; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: can't compare `std::ops::RangeFull` with `std::ops::RangeFull` @@ -59,11 +44,6 @@ LL | d: RangeFull, | ^^^^^^^^^^^^ no implementation for `std::ops::RangeFull < std::ops::RangeFull` and `std::ops::RangeFull > std::ops::RangeFull` | = help: the trait `PartialOrd` is not implemented for `std::ops::RangeFull` -note: required by `std::cmp::PartialOrd::partial_cmp` - --> $SRC_DIR/core/src/cmp.rs:LL:COL - | -LL | fn partial_cmp(&self, other: &Rhs) -> Option; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: can't compare `std::ops::RangeInclusive` with `std::ops::RangeInclusive` @@ -76,11 +56,6 @@ LL | e: RangeInclusive, | ^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `std::ops::RangeInclusive < std::ops::RangeInclusive` and `std::ops::RangeInclusive > std::ops::RangeInclusive` | = help: the trait `PartialOrd` is not implemented for `std::ops::RangeInclusive` -note: required by `std::cmp::PartialOrd::partial_cmp` - --> $SRC_DIR/core/src/cmp.rs:LL:COL - | -LL | fn partial_cmp(&self, other: &Rhs) -> Option; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: can't compare `std::ops::RangeToInclusive` with `std::ops::RangeToInclusive` @@ -93,11 +68,6 @@ LL | f: RangeToInclusive, | ^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `std::ops::RangeToInclusive < std::ops::RangeToInclusive` and `std::ops::RangeToInclusive > std::ops::RangeToInclusive` | = help: the trait `PartialOrd` is not implemented for `std::ops::RangeToInclusive` -note: required by `std::cmp::PartialOrd::partial_cmp` - --> $SRC_DIR/core/src/cmp.rs:LL:COL - | -LL | fn partial_cmp(&self, other: &Rhs) -> Option; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `std::ops::Range: Ord` is not satisfied @@ -109,11 +79,6 @@ LL | struct AllTheRanges { LL | a: Range, | ^^^^^^^^^^^^^^^ the trait `Ord` is not implemented for `std::ops::Range` | -note: required by `std::cmp::Ord::cmp` - --> $SRC_DIR/core/src/cmp.rs:LL:COL - | -LL | fn cmp(&self, other: &Self) -> Ordering; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `std::ops::RangeTo: Ord` is not satisfied @@ -125,11 +90,6 @@ LL | #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] LL | b: RangeTo, | ^^^^^^^^^^^^^^^^^ the trait `Ord` is not implemented for `std::ops::RangeTo` | -note: required by `std::cmp::Ord::cmp` - --> $SRC_DIR/core/src/cmp.rs:LL:COL - | -LL | fn cmp(&self, other: &Self) -> Ordering; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `std::ops::RangeFrom: Ord` is not satisfied @@ -141,11 +101,6 @@ LL | #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] LL | c: RangeFrom, | ^^^^^^^^^^^^^^^^^^^ the trait `Ord` is not implemented for `std::ops::RangeFrom` | -note: required by `std::cmp::Ord::cmp` - --> $SRC_DIR/core/src/cmp.rs:LL:COL - | -LL | fn cmp(&self, other: &Self) -> Ordering; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `std::ops::RangeFull: Ord` is not satisfied @@ -157,11 +112,6 @@ LL | #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] LL | d: RangeFull, | ^^^^^^^^^^^^ the trait `Ord` is not implemented for `std::ops::RangeFull` | -note: required by `std::cmp::Ord::cmp` - --> $SRC_DIR/core/src/cmp.rs:LL:COL - | -LL | fn cmp(&self, other: &Self) -> Ordering; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `std::ops::RangeInclusive: Ord` is not satisfied @@ -173,11 +123,6 @@ LL | #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] LL | e: RangeInclusive, | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Ord` is not implemented for `std::ops::RangeInclusive` | -note: required by `std::cmp::Ord::cmp` - --> $SRC_DIR/core/src/cmp.rs:LL:COL - | -LL | fn cmp(&self, other: &Self) -> Ordering; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `std::ops::RangeToInclusive: Ord` is not satisfied @@ -189,11 +134,6 @@ LL | #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] LL | f: RangeToInclusive, | ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Ord` is not implemented for `std::ops::RangeToInclusive` | -note: required by `std::cmp::Ord::cmp` - --> $SRC_DIR/core/src/cmp.rs:LL:COL - | -LL | fn cmp(&self, other: &Self) -> Ordering; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 12 previous errors diff --git a/src/test/ui/regions/regions-bounded-method-type-parameters.stderr b/src/test/ui/regions/regions-bounded-method-type-parameters.stderr index 66b61b1349d2b..318e9d006a148 100644 --- a/src/test/ui/regions/regions-bounded-method-type-parameters.stderr +++ b/src/test/ui/regions/regions-bounded-method-type-parameters.stderr @@ -4,7 +4,11 @@ error[E0477]: the type `&'a isize` does not fulfill the required lifetime LL | Foo.some_method::<&'a isize>(); | ^^^^^^^^^^^ | - = note: type must satisfy the static lifetime +note: type must satisfy the static lifetime as required by this binding + --> $DIR/regions-bounded-method-type-parameters.rs:8:22 + | +LL | fn some_method(self) { } + | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/regions/regions-close-object-into-object-5.stderr b/src/test/ui/regions/regions-close-object-into-object-5.stderr index 83f8d20b9e1de..512a7ab35fbfd 100644 --- a/src/test/ui/regions/regions-close-object-into-object-5.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-5.stderr @@ -29,7 +29,13 @@ LL | fn f<'a, T, U>(v: Box + 'static>) -> Box { | - help: consider adding an explicit lifetime bound...: `T: 'static` LL | // oh dear! LL | Box::new(B(&*v)) as Box - | ^ ...so that the type `T` will meet its required lifetime bounds + | ^ ...so that the type `T` will meet its required lifetime bounds... + | +note: ...that is required by this bound + --> $DIR/regions-close-object-into-object-5.rs:9:17 + | +LL | struct B<'a, T: 'a>(&'a (A + 'a)); + | ^^ error[E0310]: the parameter type `T` may not live long enough --> $DIR/regions-close-object-into-object-5.rs:17:14 diff --git a/src/test/ui/rfc-2497-if-let-chains/disallowed-positions.stderr b/src/test/ui/rfc-2497-if-let-chains/disallowed-positions.stderr index 513b473c4de43..3fc5cb1b07973 100644 --- a/src/test/ui/rfc-2497-if-let-chains/disallowed-positions.stderr +++ b/src/test/ui/rfc-2497-if-let-chains/disallowed-positions.stderr @@ -544,11 +544,6 @@ LL | if (let 0 = 0)? {} | ^^^^^^^^^^^^ the `?` operator cannot be applied to type `bool` | = help: the trait `Try` is not implemented for `bool` -note: required by `branch` - --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL - | -LL | fn branch(self) -> ControlFlow; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`) --> $DIR/disallowed-positions.rs:44:19 @@ -566,11 +561,6 @@ LL | | } | |_- this function should return `Result` or `Option` to accept `?` | = help: the trait `FromResidual<_>` is not implemented for `()` -note: required by `from_residual` - --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL - | -LL | fn from_residual(residual: R) -> Self; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0308]: mismatched types --> $DIR/disallowed-positions.rs:54:8 @@ -710,11 +700,6 @@ LL | if let 0 = 0? {} | ^^ the `?` operator cannot be applied to type `{integer}` | = help: the trait `Try` is not implemented for `{integer}` -note: required by `branch` - --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL - | -LL | fn branch(self) -> ControlFlow; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0308]: mismatched types --> $DIR/disallowed-positions.rs:94:11 @@ -747,11 +732,6 @@ LL | while (let 0 = 0)? {} | ^^^^^^^^^^^^ the `?` operator cannot be applied to type `bool` | = help: the trait `Try` is not implemented for `bool` -note: required by `branch` - --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL - | -LL | fn branch(self) -> ControlFlow; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`) --> $DIR/disallowed-positions.rs:108:22 @@ -769,11 +749,6 @@ LL | | } | |_- this function should return `Result` or `Option` to accept `?` | = help: the trait `FromResidual<_>` is not implemented for `()` -note: required by `from_residual` - --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL - | -LL | fn from_residual(residual: R) -> Self; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0308]: mismatched types --> $DIR/disallowed-positions.rs:118:11 @@ -913,11 +888,6 @@ LL | while let 0 = 0? {} | ^^ the `?` operator cannot be applied to type `{integer}` | = help: the trait `Try` is not implemented for `{integer}` -note: required by `branch` - --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL - | -LL | fn branch(self) -> ControlFlow; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0614]: type `bool` cannot be dereferenced --> $DIR/disallowed-positions.rs:171:5 @@ -938,11 +908,6 @@ LL | (let 0 = 0)?; | ^^^^^^^^^^^^ the `?` operator cannot be applied to type `bool` | = help: the trait `Try` is not implemented for `bool` -note: required by `branch` - --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL - | -LL | fn branch(self) -> ControlFlow; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`) --> $DIR/disallowed-positions.rs:181:16 @@ -960,11 +925,6 @@ LL | | } | |_- this function should return `Result` or `Option` to accept `?` | = help: the trait `FromResidual<_>` is not implemented for `()` -note: required by `from_residual` - --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL - | -LL | fn from_residual(residual: R) -> Self; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0308]: mismatched types --> $DIR/disallowed-positions.rs:196:10 @@ -993,11 +953,6 @@ LL | let 0 = 0?; | ^^ the `?` operator cannot be applied to type `{integer}` | = help: the trait `Try` is not implemented for `{integer}` -note: required by `branch` - --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL - | -LL | fn branch(self) -> ControlFlow; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 103 previous errors; 1 warning emitted diff --git a/src/test/ui/rfc-2632-const-trait-impl/const-and-non-const-impl.stderr b/src/test/ui/rfc-2632-const-trait-impl/const-and-non-const-impl.stderr index 785095c29ae4e..154a6a35a44ef 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/const-and-non-const-impl.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/const-and-non-const-impl.stderr @@ -31,17 +31,6 @@ note: multiple `impl`s satisfying `i32: Add` found LL | impl const std::ops::Add for i32 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: and another `impl` found in the `core` crate: `impl Add for i32;` -note: required by a bound in `Add` - --> $SRC_DIR/core/src/ops/arith.rs:LL:COL - | -LL | / pub trait Add { -LL | | /// The resulting type after applying the `+` operator. -LL | | #[stable(feature = "rust1", since = "1.0.0")] -LL | | type Output; -... | -LL | | fn add(self, rhs: Rhs) -> Self::Output; -LL | | } - | |_^ required by this bound in `Add` error[E0283]: type annotations needed --> $DIR/const-and-non-const-impl.rs:14:6 @@ -57,17 +46,6 @@ LL | impl std::ops::Add for Int { ... LL | impl const std::ops::Add for Int { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: required by a bound in `Add` - --> $SRC_DIR/core/src/ops/arith.rs:LL:COL - | -LL | / pub trait Add { -LL | | /// The resulting type after applying the `+` operator. -LL | | #[stable(feature = "rust1", since = "1.0.0")] -LL | | type Output; -... | -LL | | fn add(self, rhs: Rhs) -> Self::Output; -LL | | } - | |_^ required by this bound in `Add` error[E0283]: type annotations needed --> $DIR/const-and-non-const-impl.rs:22:12 @@ -83,17 +61,6 @@ LL | impl std::ops::Add for Int { ... LL | impl const std::ops::Add for Int { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: required by a bound in `Add` - --> $SRC_DIR/core/src/ops/arith.rs:LL:COL - | -LL | / pub trait Add { -LL | | /// The resulting type after applying the `+` operator. -LL | | #[stable(feature = "rust1", since = "1.0.0")] -LL | | type Output; -... | -LL | | fn add(self, rhs: Rhs) -> Self::Output; -LL | | } - | |_^ required by this bound in `Add` error: aborting due to 5 previous errors diff --git a/src/test/ui/rfc-2632-const-trait-impl/const-drop-fail.precise.stderr b/src/test/ui/rfc-2632-const-trait-impl/const-drop-fail.precise.stderr index efe46d7e81d3d..04c21101e758b 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/const-drop-fail.precise.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/const-drop-fail.precise.stderr @@ -42,11 +42,11 @@ error[E0277]: the trait bound `NonTrivialDrop: A` is not satisfied LL | ConstDropImplWithBounds::(PhantomData), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `A` is not implemented for `NonTrivialDrop` | -note: required by `ConstDropImplWithBounds` - --> $DIR/const-drop-fail.rs:27:1 +note: required by a bound in `ConstDropImplWithBounds` + --> $DIR/const-drop-fail.rs:27:35 | LL | struct ConstDropImplWithBounds(PhantomData); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^ required by this bound in `ConstDropImplWithBounds` error[E0277]: the trait bound `NonTrivialDrop: A` is not satisfied --> $DIR/const-drop-fail.rs:49:5 diff --git a/src/test/ui/rfc-2632-const-trait-impl/const-drop-fail.stock.stderr b/src/test/ui/rfc-2632-const-trait-impl/const-drop-fail.stock.stderr index efe46d7e81d3d..04c21101e758b 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/const-drop-fail.stock.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/const-drop-fail.stock.stderr @@ -42,11 +42,11 @@ error[E0277]: the trait bound `NonTrivialDrop: A` is not satisfied LL | ConstDropImplWithBounds::(PhantomData), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `A` is not implemented for `NonTrivialDrop` | -note: required by `ConstDropImplWithBounds` - --> $DIR/const-drop-fail.rs:27:1 +note: required by a bound in `ConstDropImplWithBounds` + --> $DIR/const-drop-fail.rs:27:35 | LL | struct ConstDropImplWithBounds(PhantomData); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^ required by this bound in `ConstDropImplWithBounds` error[E0277]: the trait bound `NonTrivialDrop: A` is not satisfied --> $DIR/const-drop-fail.rs:49:5 diff --git a/src/test/ui/rfc-2632-const-trait-impl/trait-where-clause.stderr b/src/test/ui/rfc-2632-const-trait-impl/trait-where-clause.stderr index fffb91f98700b..08d91d7daf85b 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/trait-where-clause.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/trait-where-clause.stderr @@ -4,11 +4,11 @@ error[E0277]: the trait bound `T: Bar` is not satisfied LL | T::b(); | ^^^^ the trait `Bar` is not implemented for `T` | -note: required by `Foo::b` - --> $DIR/trait-where-clause.rs:8:5 +note: required by a bound in `Foo::b` + --> $DIR/trait-where-clause.rs:8:24 | LL | fn b() where Self: ~const Bar; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^ required by this bound in `Foo::b` help: consider further restricting this bound | LL | const fn test1() { @@ -20,11 +20,11 @@ error[E0277]: the trait bound `T: Bar` is not satisfied LL | T::c::(); | ^^^^^^^^^ the trait `Bar` is not implemented for `T` | -note: required by `Foo::c` - --> $DIR/trait-where-clause.rs:9:5 +note: required by a bound in `Foo::c` + --> $DIR/trait-where-clause.rs:9:13 | LL | fn c(); - | ^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^ required by this bound in `Foo::c` help: consider further restricting this bound | LL | const fn test1() { @@ -36,11 +36,11 @@ error[E0277]: the trait bound `T: Bar` is not satisfied LL | T::b(); | ^^^^ the trait `Bar` is not implemented for `T` | -note: required by `Foo::b` - --> $DIR/trait-where-clause.rs:8:5 +note: required by a bound in `Foo::b` + --> $DIR/trait-where-clause.rs:8:24 | LL | fn b() where Self: ~const Bar; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^ required by this bound in `Foo::b` help: consider further restricting this bound | LL | fn test3() { @@ -52,11 +52,11 @@ error[E0277]: the trait bound `T: Bar` is not satisfied LL | T::c::(); | ^^^^^^^^^ the trait `Bar` is not implemented for `T` | -note: required by `Foo::c` - --> $DIR/trait-where-clause.rs:9:5 +note: required by a bound in `Foo::c` + --> $DIR/trait-where-clause.rs:9:13 | LL | fn c(); - | ^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^ required by this bound in `Foo::c` help: consider further restricting this bound | LL | fn test3() { diff --git a/src/test/ui/span/issue-29595.stderr b/src/test/ui/span/issue-29595.stderr index 24dfdf8ebc299..92445e4073130 100644 --- a/src/test/ui/span/issue-29595.stderr +++ b/src/test/ui/span/issue-29595.stderr @@ -3,12 +3,6 @@ error[E0277]: the trait bound `u8: Tr` is not satisfied | LL | let a: u8 = Tr::C; | ^^^^^ the trait `Tr` is not implemented for `u8` - | -note: required by `Tr::C` - --> $DIR/issue-29595.rs:2:5 - | -LL | const C: Self; - | ^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/specialization/defaultimpl/specialization-trait-not-implemented.stderr b/src/test/ui/specialization/defaultimpl/specialization-trait-not-implemented.stderr index ce981bc00982a..81e2a9a1ffcc7 100644 --- a/src/test/ui/specialization/defaultimpl/specialization-trait-not-implemented.stderr +++ b/src/test/ui/specialization/defaultimpl/specialization-trait-not-implemented.stderr @@ -20,8 +20,12 @@ LL | struct MyStruct; LL | println!("{}", MyStruct.foo_one()); | ^^^^^^^ method cannot be called on `MyStruct` due to unsatisfied trait bounds | - = note: the following trait bounds were not satisfied: - `MyStruct: Foo` +note: the following trait bounds were not satisfied because of the requirements of the implementation of `Foo` for `_`: + `MyStruct: Foo` + --> $DIR/specialization-trait-not-implemented.rs:14:17 + | +LL | default impl Foo for T { + | ^^^ ^ note: the following trait must be implemented --> $DIR/specialization-trait-not-implemented.rs:7:1 | diff --git a/src/test/ui/str/str-idx.stderr b/src/test/ui/str/str-idx.stderr index 47bd6f6bfa73d..9c3c3646139dc 100644 --- a/src/test/ui/str/str-idx.stderr +++ b/src/test/ui/str/str-idx.stderr @@ -20,6 +20,11 @@ LL | let _ = s.get(4); = help: the trait `SliceIndex` is not implemented for `{integer}` = note: you can use `.chars().nth()` or `.bytes().nth()` for more information, see chapter 8 in The Book: +note: required by a bound in `core::str::::get` + --> $SRC_DIR/core/src/str/mod.rs:LL:COL + | +LL | pub fn get>(&self, i: I) -> Option<&I::Output> { + | ^^^^^^^^^^^^^^^ required by this bound in `core::str::::get` error[E0277]: the type `str` cannot be indexed by `{integer}` --> $DIR/str-idx.rs:5:29 @@ -32,6 +37,11 @@ LL | let _ = s.get_unchecked(4); = help: the trait `SliceIndex` is not implemented for `{integer}` = note: you can use `.chars().nth()` or `.bytes().nth()` for more information, see chapter 8 in The Book: +note: required by a bound in `core::str::::get_unchecked` + --> $SRC_DIR/core/src/str/mod.rs:LL:COL + | +LL | pub unsafe fn get_unchecked>(&self, i: I) -> &I::Output { + | ^^^^^^^^^^^^^^^ required by this bound in `core::str::::get_unchecked` error[E0277]: the type `str` cannot be indexed by `char` --> $DIR/str-idx.rs:6:17 diff --git a/src/test/ui/str/str-mut-idx.stderr b/src/test/ui/str/str-mut-idx.stderr index ab647c75cf120..2559ee9eb49b2 100644 --- a/src/test/ui/str/str-mut-idx.stderr +++ b/src/test/ui/str/str-mut-idx.stderr @@ -44,6 +44,11 @@ LL | s.get_mut(1); = help: the trait `SliceIndex` is not implemented for `{integer}` = note: you can use `.chars().nth()` or `.bytes().nth()` for more information, see chapter 8 in The Book: +note: required by a bound in `core::str::::get_mut` + --> $SRC_DIR/core/src/str/mod.rs:LL:COL + | +LL | pub fn get_mut>(&mut self, i: I) -> Option<&mut I::Output> { + | ^^^^^^^^^^^^^^^ required by this bound in `core::str::::get_mut` error[E0277]: the type `str` cannot be indexed by `{integer}` --> $DIR/str-mut-idx.rs:11:25 @@ -56,6 +61,11 @@ LL | s.get_unchecked_mut(1); = help: the trait `SliceIndex` is not implemented for `{integer}` = note: you can use `.chars().nth()` or `.bytes().nth()` for more information, see chapter 8 in The Book: +note: required by a bound in `core::str::::get_unchecked_mut` + --> $SRC_DIR/core/src/str/mod.rs:LL:COL + | +LL | pub unsafe fn get_unchecked_mut>(&mut self, i: I) -> &mut I::Output { + | ^^^^^^^^^^^^^^^ required by this bound in `core::str::::get_unchecked_mut` error[E0277]: the type `str` cannot be indexed by `char` --> $DIR/str-mut-idx.rs:13:5 diff --git a/src/test/ui/structs/struct-path-alias-bounds.stderr b/src/test/ui/structs/struct-path-alias-bounds.stderr index e0a22c2df1aca..7a80e7270ba36 100644 --- a/src/test/ui/structs/struct-path-alias-bounds.stderr +++ b/src/test/ui/structs/struct-path-alias-bounds.stderr @@ -4,11 +4,11 @@ error[E0277]: the trait bound `NoClone: Clone` is not satisfied LL | let s = A { a: NoClone }; | ^ the trait `Clone` is not implemented for `NoClone` | -note: required by `S` - --> $DIR/struct-path-alias-bounds.rs:3:1 +note: required by a bound in `S` + --> $DIR/struct-path-alias-bounds.rs:3:13 | LL | struct S { a: T } - | ^^^^^^^^^^^^^^^^^^ + | ^^^^^ required by this bound in `S` error: aborting due to previous error diff --git a/src/test/ui/suggestions/boxed-variant-field.rs b/src/test/ui/suggestions/boxed-variant-field.rs index d8f7fac151356..9b9e70a675fb1 100644 --- a/src/test/ui/suggestions/boxed-variant-field.rs +++ b/src/test/ui/suggestions/boxed-variant-field.rs @@ -9,7 +9,7 @@ fn foo(x: Ty) -> Ty { Ty::List(elem) => foo(elem), //~^ ERROR mismatched types //~| HELP try dereferencing the `Box` - //~| HELP try using a variant of the expected enum + //~| HELP try wrapping } } diff --git a/src/test/ui/suggestions/boxed-variant-field.stderr b/src/test/ui/suggestions/boxed-variant-field.stderr index d4ccb2ca490bc..e865b993a4c17 100644 --- a/src/test/ui/suggestions/boxed-variant-field.stderr +++ b/src/test/ui/suggestions/boxed-variant-field.stderr @@ -10,10 +10,10 @@ help: try dereferencing the `Box` | LL | Ty::List(elem) => foo(*elem), | + -help: try using a variant of the expected enum +help: try wrapping the expression in `Ty::List` | LL | Ty::List(elem) => foo(Ty::List(elem)), - | ~~~~~~~~~~~~~~ + | +++++++++ + error: aborting due to previous error diff --git a/src/test/ui/suggestions/expected-boxed-future-isnt-pinned.stderr b/src/test/ui/suggestions/expected-boxed-future-isnt-pinned.stderr index aa3175dae2e66..7ef4895249cec 100644 --- a/src/test/ui/suggestions/expected-boxed-future-isnt-pinned.stderr +++ b/src/test/ui/suggestions/expected-boxed-future-isnt-pinned.stderr @@ -46,11 +46,11 @@ LL | Pin::new(x) | ^^^^^^^^ the trait `Unpin` is not implemented for `dyn Future + Send` | = note: consider using `Box::pin` -note: required by `Pin::

::new` +note: required by a bound in `Pin::

::new` --> $SRC_DIR/core/src/pin.rs:LL:COL | -LL | pub const fn new(pointer: P) -> Pin

{ - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | impl> Pin

{ + | ^^^^^ required by this bound in `Pin::

::new` error[E0277]: `dyn Future + Send` cannot be unpinned --> $DIR/expected-boxed-future-isnt-pinned.rs:24:5 @@ -59,11 +59,11 @@ LL | Pin::new(Box::new(x)) | ^^^^^^^^ the trait `Unpin` is not implemented for `dyn Future + Send` | = note: consider using `Box::pin` -note: required by `Pin::

::new` +note: required by a bound in `Pin::

::new` --> $SRC_DIR/core/src/pin.rs:LL:COL | -LL | pub const fn new(pointer: P) -> Pin

{ - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | impl> Pin

{ + | ^^^^^ required by this bound in `Pin::

::new` error[E0308]: mismatched types --> $DIR/expected-boxed-future-isnt-pinned.rs:28:5 diff --git a/src/test/ui/suggestions/issue-62843.stderr b/src/test/ui/suggestions/issue-62843.stderr index 29ba39cbe109c..bc1c69406d139 100644 --- a/src/test/ui/suggestions/issue-62843.stderr +++ b/src/test/ui/suggestions/issue-62843.stderr @@ -8,6 +8,11 @@ LL | println!("{:?}", line.find(pattern)); | = note: the trait bound `String: Pattern<'_>` is not satisfied = note: required because of the requirements on the impl of `Pattern<'_>` for `String` +note: required by a bound in `core::str::::find` + --> $SRC_DIR/core/src/str/mod.rs:LL:COL + | +LL | pub fn find<'a, P: Pattern<'a>>(&'a self, pat: P) -> Option { + | ^^^^^^^^^^^ required by this bound in `core::str::::find` help: consider borrowing here | LL | println!("{:?}", line.find(&pattern)); diff --git a/src/test/ui/suggestions/issue-72766.stderr b/src/test/ui/suggestions/issue-72766.stderr index 43ba35d0205bd..2c82c898cda33 100644 --- a/src/test/ui/suggestions/issue-72766.stderr +++ b/src/test/ui/suggestions/issue-72766.stderr @@ -5,11 +5,6 @@ LL | SadGirl {}.call()?; | ^^^^^^^^^^^^^^^^^^ the `?` operator cannot be applied to type `impl Future` | = help: the trait `Try` is not implemented for `impl Future` -note: required by `branch` - --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL - | -LL | fn branch(self) -> ControlFlow; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider `await`ing on the `Future` | LL | SadGirl {}.call().await?; diff --git a/src/test/ui/suggestions/issue-84973.stderr b/src/test/ui/suggestions/issue-84973.stderr index 16a28c73aa724..24c989ec3e86d 100644 --- a/src/test/ui/suggestions/issue-84973.stderr +++ b/src/test/ui/suggestions/issue-84973.stderr @@ -6,11 +6,14 @@ LL | let o = Other::new(f); | | | required by a bound introduced by this call | -note: required by `Other::<'a, G>::new` - --> $DIR/issue-84973.rs:27:5 +note: required by a bound in `Other::<'a, G>::new` + --> $DIR/issue-84973.rs:25:8 | +LL | G: SomeTrait, + | ^^^^^^^^^ required by this bound in `Other::<'a, G>::new` +LL | { LL | pub fn new(g: G) -> Self { - | ^^^^^^^^^^^^^^^^^^^^^^^^ + | --- required by a bound in this help: consider borrowing here | LL | let o = Other::new(&f); diff --git a/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.stderr b/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.stderr index 0cf0074dc3d25..adb928aa8a376 100644 --- a/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.stderr +++ b/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.stderr @@ -11,11 +11,16 @@ note: the parameter type `T` must be valid for the anonymous lifetime defined he | LL | fn func(foo: &Foo, t: T) { | ^^^ -note: ...so that the type `[closure@$DIR/missing-lifetimes-in-signature-2.rs:20:13: 23:6]` will meet its required lifetime bounds +note: ...so that the type `[closure@$DIR/missing-lifetimes-in-signature-2.rs:20:13: 23:6]` will meet its required lifetime bounds... --> $DIR/missing-lifetimes-in-signature-2.rs:20:9 | LL | foo.bar(move |_| { | ^^^ +note: ...that is required by this bound + --> $DIR/missing-lifetimes-in-signature-2.rs:11:12 + | +LL | F: 'a, + | ^^ error: aborting due to previous error diff --git a/src/test/ui/suggestions/mut-borrow-needed-by-trait.stderr b/src/test/ui/suggestions/mut-borrow-needed-by-trait.stderr index e6a2231390076..d121932c842e3 100644 --- a/src/test/ui/suggestions/mut-borrow-needed-by-trait.stderr +++ b/src/test/ui/suggestions/mut-borrow-needed-by-trait.stderr @@ -7,11 +7,11 @@ LL | let fp = BufWriter::new(fp); | required by a bound introduced by this call | = note: `std::io::Write` is implemented for `&mut dyn std::io::Write`, but not for `&dyn std::io::Write` -note: required by `BufWriter::::new` +note: required by a bound in `BufWriter::::new` --> $SRC_DIR/std/src/io/buffered/bufwriter.rs:LL:COL | -LL | pub fn new(inner: W) -> BufWriter { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | impl BufWriter { + | ^^^^^ required by this bound in `BufWriter::::new` error[E0277]: the trait bound `&dyn std::io::Write: std::io::Write` is not satisfied --> $DIR/mut-borrow-needed-by-trait.rs:17:14 diff --git a/src/test/ui/suggestions/slice-issue-87994.stderr b/src/test/ui/suggestions/slice-issue-87994.stderr index 0275fd475d8c6..fd2a44f9a82ba 100644 --- a/src/test/ui/suggestions/slice-issue-87994.stderr +++ b/src/test/ui/suggestions/slice-issue-87994.stderr @@ -6,11 +6,6 @@ LL | for _ in v[1..] { | = note: the trait bound `[i32]: IntoIterator` is not satisfied = note: required because of the requirements on the impl of `IntoIterator` for `[i32]` -note: required by `into_iter` - --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider borrowing here | LL | for _ in &v[1..] { @@ -26,11 +21,6 @@ LL | for _ in v[1..] { | = note: the trait bound `[i32]: IntoIterator` is not satisfied = note: required because of the requirements on the impl of `IntoIterator` for `[i32]` -note: required by `into_iter` - --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider borrowing here | LL | for _ in &v[1..] { @@ -46,11 +36,6 @@ LL | for i2 in v2[1..] { | = note: the trait bound `[K]: IntoIterator` is not satisfied = note: required because of the requirements on the impl of `IntoIterator` for `[K]` -note: required by `into_iter` - --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider borrowing here | LL | for i2 in &v2[1..] { @@ -66,11 +51,6 @@ LL | for i2 in v2[1..] { | = note: the trait bound `[K]: IntoIterator` is not satisfied = note: required because of the requirements on the impl of `IntoIterator` for `[K]` -note: required by `into_iter` - --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider borrowing here | LL | for i2 in &v2[1..] { diff --git a/src/test/ui/suggestions/suggest-change-mut.stderr b/src/test/ui/suggestions/suggest-change-mut.stderr index 8dfab8dfa17e5..2fa69cd5a2c8d 100644 --- a/src/test/ui/suggestions/suggest-change-mut.stderr +++ b/src/test/ui/suggestions/suggest-change-mut.stderr @@ -6,11 +6,11 @@ LL | let mut stream_reader = BufReader::new(&stream); | | | required by a bound introduced by this call | -note: required by `BufReader::::new` +note: required by a bound in `BufReader::::new` --> $SRC_DIR/std/src/io/buffered/bufreader.rs:LL:COL | -LL | pub fn new(inner: R) -> BufReader { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | impl BufReader { + | ^^^^ required by this bound in `BufReader::::new` help: consider removing the leading `&`-reference | LL - let mut stream_reader = BufReader::new(&stream); diff --git a/src/test/ui/suggestions/suggest-full-enum-variant-for-local-module.stderr b/src/test/ui/suggestions/suggest-full-enum-variant-for-local-module.stderr index 22a0ce1e91d72..9b6dba7e9e75b 100644 --- a/src/test/ui/suggestions/suggest-full-enum-variant-for-local-module.stderr +++ b/src/test/ui/suggestions/suggest-full-enum-variant-for-local-module.stderr @@ -2,14 +2,16 @@ error[E0308]: mismatched types --> $DIR/suggest-full-enum-variant-for-local-module.rs:9:28 | LL | let _: option::O<()> = (); - | ------------- ^^ - | | | - | | expected enum `O`, found `()` - | | help: try using a variant of the expected enum: `option::O::Some(())` + | ------------- ^^ expected enum `O`, found `()` + | | | expected due to this | = note: expected enum `O<()>` found unit type `()` +help: try wrapping the expression in `option::O::Some` + | +LL | let _: option::O<()> = option::O::Some(()); + | ++++++++++++++++ + error: aborting due to previous error diff --git a/src/test/ui/suggestions/suggest-remove-refs-1.stderr b/src/test/ui/suggestions/suggest-remove-refs-1.stderr index a5c01484d424c..1083b2f971311 100644 --- a/src/test/ui/suggestions/suggest-remove-refs-1.stderr +++ b/src/test/ui/suggestions/suggest-remove-refs-1.stderr @@ -9,11 +9,6 @@ LL | for (i, _) in &v.iter().enumerate() { | = help: the trait `Iterator` is not implemented for `&Enumerate>` = note: required because of the requirements on the impl of `IntoIterator` for `&Enumerate>` -note: required by `into_iter` - --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/suggestions/suggest-remove-refs-2.stderr b/src/test/ui/suggestions/suggest-remove-refs-2.stderr index b128590f9d0e7..197b19a1bffc2 100644 --- a/src/test/ui/suggestions/suggest-remove-refs-2.stderr +++ b/src/test/ui/suggestions/suggest-remove-refs-2.stderr @@ -9,11 +9,6 @@ LL | for (i, _) in & & & & &v.iter().enumerate() { | = help: the trait `Iterator` is not implemented for `&&&&&Enumerate>` = note: required because of the requirements on the impl of `IntoIterator` for `&&&&&Enumerate>` -note: required by `into_iter` - --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/suggestions/suggest-remove-refs-3.stderr b/src/test/ui/suggestions/suggest-remove-refs-3.stderr index 1c32a33e3712f..bb0cceac1db7b 100644 --- a/src/test/ui/suggestions/suggest-remove-refs-3.stderr +++ b/src/test/ui/suggestions/suggest-remove-refs-3.stderr @@ -13,11 +13,6 @@ LL | | .enumerate() { | = help: the trait `Iterator` is not implemented for `&&&&&Enumerate>` = note: required because of the requirements on the impl of `IntoIterator` for `&&&&&Enumerate>` -note: required by `into_iter` - --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/traits/bad-method-typaram-kind.stderr b/src/test/ui/traits/bad-method-typaram-kind.stderr index 1e9d151629f2f..8befa4c5f738b 100644 --- a/src/test/ui/traits/bad-method-typaram-kind.stderr +++ b/src/test/ui/traits/bad-method-typaram-kind.stderr @@ -4,6 +4,11 @@ error[E0277]: `T` cannot be sent between threads safely LL | 1.bar::(); | ^^^ `T` cannot be sent between threads safely | +note: required by a bound in `Bar::bar` + --> $DIR/bad-method-typaram-kind.rs:6:14 + | +LL | fn bar(&self); + | ^^^^ required by this bound in `Bar::bar` help: consider further restricting this bound | LL | fn foo() { diff --git a/src/test/ui/traits/bad-sized.stderr b/src/test/ui/traits/bad-sized.stderr index 5421e71509f3a..6f9113fff5161 100644 --- a/src/test/ui/traits/bad-sized.stderr +++ b/src/test/ui/traits/bad-sized.stderr @@ -29,11 +29,11 @@ LL | let x: Vec = Vec::new(); | ^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `dyn Trait` -note: required by `Vec::::new` +note: required by a bound in `Vec::::new` --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL | -LL | pub const fn new() -> Self { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | impl Vec { + | ^ required by this bound in `Vec::::new` error[E0277]: the size for values of type `dyn Trait` cannot be known at compilation time --> $DIR/bad-sized.rs:4:37 diff --git a/src/test/ui/traits/bound/on-structs-and-enums-locals.stderr b/src/test/ui/traits/bound/on-structs-and-enums-locals.stderr index cd33e18cfb695..c9068a270020d 100644 --- a/src/test/ui/traits/bound/on-structs-and-enums-locals.stderr +++ b/src/test/ui/traits/bound/on-structs-and-enums-locals.stderr @@ -16,11 +16,11 @@ error[E0277]: the trait bound `{integer}: Trait` is not satisfied LL | let foo = Foo { | ^^^ the trait `Trait` is not implemented for `{integer}` | -note: required by `Foo` - --> $DIR/on-structs-and-enums-locals.rs:5:1 +note: required by a bound in `Foo` + --> $DIR/on-structs-and-enums-locals.rs:5:14 | LL | struct Foo { - | ^^^^^^^^^^^^^^^^^^^ + | ^^^^^ required by this bound in `Foo` error: aborting due to 2 previous errors diff --git a/src/test/ui/traits/bound/on-structs-and-enums-xc1.stderr b/src/test/ui/traits/bound/on-structs-and-enums-xc1.stderr index 0f25c8856882c..f4cc64af94f37 100644 --- a/src/test/ui/traits/bound/on-structs-and-enums-xc1.stderr +++ b/src/test/ui/traits/bound/on-structs-and-enums-xc1.stderr @@ -16,11 +16,11 @@ error[E0277]: the trait bound `{integer}: Trait` is not satisfied LL | let foo = Foo { | ^^^ the trait `Trait` is not implemented for `{integer}` | -note: required by `Foo` - --> $DIR/auxiliary/on_structs_and_enums_xc.rs:5:1 +note: required by a bound in `Foo` + --> $DIR/auxiliary/on_structs_and_enums_xc.rs:5:18 | LL | pub struct Foo { - | ^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^ required by this bound in `Foo` error: aborting due to 2 previous errors diff --git a/src/test/ui/traits/inheritance/repeated-supertrait-ambig.stderr b/src/test/ui/traits/inheritance/repeated-supertrait-ambig.stderr index fa8799bf7d8a1..2bff84363e9e5 100644 --- a/src/test/ui/traits/inheritance/repeated-supertrait-ambig.stderr +++ b/src/test/ui/traits/inheritance/repeated-supertrait-ambig.stderr @@ -20,12 +20,6 @@ error[E0277]: the trait bound `dyn CompareToInts: CompareTo` is not satisfi | LL | ::same_as(c, 22) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `CompareTo` is not implemented for `dyn CompareToInts` - | -note: required by `CompareTo::same_as` - --> $DIR/repeated-supertrait-ambig.rs:9:5 - | -LL | fn same_as(&self, t: T) -> bool; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `C: CompareTo` is not satisfied --> $DIR/repeated-supertrait-ambig.rs:38:5 @@ -33,11 +27,6 @@ error[E0277]: the trait bound `C: CompareTo` is not satisfied LL | CompareTo::same_as(c, 22) | ^^^^^^^^^^^^^^^^^^ the trait `CompareTo` is not implemented for `C` | -note: required by `CompareTo::same_as` - --> $DIR/repeated-supertrait-ambig.rs:9:5 - | -LL | fn same_as(&self, t: T) -> bool; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider further restricting this bound | LL | fn with_ufcs2>(c: &C) -> bool { diff --git a/src/test/ui/traits/issue-71136.stderr b/src/test/ui/traits/issue-71136.stderr index d1e8affd065f9..45b1e1095c7d8 100644 --- a/src/test/ui/traits/issue-71136.stderr +++ b/src/test/ui/traits/issue-71136.stderr @@ -8,11 +8,6 @@ LL | the_foos: Vec, | ^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `Foo` | = note: required because of the requirements on the impl of `Clone` for `Vec` -note: required by `clone` - --> $SRC_DIR/core/src/clone.rs:LL:COL - | -LL | fn clone(&self) -> Self; - | ^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/traits/issue-77982.stderr b/src/test/ui/traits/issue-77982.stderr index e868756504f19..3c4a5d95c137e 100644 --- a/src/test/ui/traits/issue-77982.stderr +++ b/src/test/ui/traits/issue-77982.stderr @@ -10,6 +10,15 @@ LL | opts.get(opt.as_ref()); - impl Borrow for String; - impl Borrow for T where T: ?Sized; +note: required by a bound in `HashMap::::get` + --> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL + | +LL | K: Borrow, + | ^^^^^^^^^ required by this bound in `HashMap::::get` +help: consider specifying the type argument in the function call + | +LL | opts.get::(opt.as_ref()); + | +++++ error[E0283]: type annotations needed --> $DIR/issue-77982.rs:8:18 @@ -50,11 +59,6 @@ LL | let ips: Vec<_> = (0..100_000).map(|_| u32::from(0u32.into())).collect( - impl From for u32; - impl From for u32; and 3 more -note: required by `from` - --> $SRC_DIR/core/src/convert/mod.rs:LL:COL - | -LL | fn from(_: T) -> Self; - | ^^^^^^^^^^^^^^^^^^^^^^ error[E0283]: type annotations needed for `Box` --> $DIR/issue-77982.rs:36:16 diff --git a/src/test/ui/traits/issue-79458.stderr b/src/test/ui/traits/issue-79458.stderr index 2f5b4ad0e62c8..3e83db142e087 100644 --- a/src/test/ui/traits/issue-79458.stderr +++ b/src/test/ui/traits/issue-79458.stderr @@ -10,11 +10,6 @@ LL | bar: &'a mut T = help: the following implementations were found: <&T as Clone> = note: `Clone` is implemented for `&T`, but not for `&mut T` -note: required by `clone` - --> $SRC_DIR/core/src/clone.rs:LL:COL - | -LL | fn clone(&self) -> Self; - | ^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/traits/issue-85735.stderr b/src/test/ui/traits/issue-85735.stderr index 1f81fa72547df..33b12ef09ec26 100644 --- a/src/test/ui/traits/issue-85735.stderr +++ b/src/test/ui/traits/issue-85735.stderr @@ -5,15 +5,6 @@ LL | T: FnMut(&'a ()), | ^^^^^^^^^^^^^ cannot infer type for type parameter `T` | = note: cannot satisfy `T: FnMut<(&'a (),)>` -note: required by a bound in `FnMut` - --> $SRC_DIR/core/src/ops/function.rs:LL:COL - | -LL | / pub trait FnMut: FnOnce { -LL | | /// Performs the call operation. -LL | | #[unstable(feature = "fn_traits", issue = "29625")] -LL | | extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output; -LL | | } - | |_^ required by this bound in `FnMut` error: aborting due to previous error diff --git a/src/test/ui/traits/negative-impls/negated-auto-traits-error.stderr b/src/test/ui/traits/negative-impls/negated-auto-traits-error.stderr index 1ab130e0ab143..c5d4ccc2fcd91 100644 --- a/src/test/ui/traits/negative-impls/negated-auto-traits-error.stderr +++ b/src/test/ui/traits/negative-impls/negated-auto-traits-error.stderr @@ -7,11 +7,11 @@ LL | Outer(TestType); | required by a bound introduced by this call | = help: the trait `Send` is not implemented for `dummy::TestType` -note: required by `Outer` - --> $DIR/negated-auto-traits-error.rs:10:1 +note: required by a bound in `Outer` + --> $DIR/negated-auto-traits-error.rs:10:17 | LL | struct Outer(T); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^ required by this bound in `Outer` error[E0277]: `dummy::TestType` cannot be sent between threads safely --> $DIR/negated-auto-traits-error.rs:23:5 diff --git a/src/test/ui/traits/reservation-impl/no-use.stderr b/src/test/ui/traits/reservation-impl/no-use.stderr index e7d1ee616b34f..3d5bf3448bd5d 100644 --- a/src/test/ui/traits/reservation-impl/no-use.stderr +++ b/src/test/ui/traits/reservation-impl/no-use.stderr @@ -8,11 +8,6 @@ LL | <() as MyTrait>::foo(&()); | = help: the following implementations were found: <() as MyTrait> -note: required by `MyTrait::foo` - --> $DIR/no-use.rs:5:17 - | -LL | trait MyTrait { fn foo(&self); } - | ^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/traits/static-method-generic-inference.stderr b/src/test/ui/traits/static-method-generic-inference.stderr index c8c804a9013bf..1a0bcf00a673a 100644 --- a/src/test/ui/traits/static-method-generic-inference.stderr +++ b/src/test/ui/traits/static-method-generic-inference.stderr @@ -5,11 +5,6 @@ LL | let _f: base::Foo = base::HasNew::new(); | ^^^^^^^^^^^^^^^^^ cannot infer type | = note: cannot satisfy `_: HasNew` -note: required by `HasNew::new` - --> $DIR/static-method-generic-inference.rs:8:9 - | -LL | fn new() -> T; - | ^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/traits/suggest-where-clause.stderr b/src/test/ui/traits/suggest-where-clause.stderr index d955cb06a1d50..e2cdd368888a8 100644 --- a/src/test/ui/traits/suggest-where-clause.stderr +++ b/src/test/ui/traits/suggest-where-clause.stderr @@ -49,11 +49,6 @@ error[E0277]: the trait bound `u64: From` is not satisfied LL | >::from; | ^^^^^^^^^^^^^^^^^^^^^^ the trait `From` is not implemented for `u64` | -note: required by `from` - --> $SRC_DIR/core/src/convert/mod.rs:LL:COL - | -LL | fn from(_: T) -> Self; - | ^^^^^^^^^^^^^^^^^^^^^^ help: consider introducing a `where` bound, but there might be an alternative better way to express this requirement | LL | fn check() where u64: From { @@ -65,11 +60,6 @@ error[E0277]: the trait bound `u64: From<::Item>` is not satisfie LL | ::Item>>::from; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `From<::Item>` is not implemented for `u64` | -note: required by `from` - --> $SRC_DIR/core/src/convert/mod.rs:LL:COL - | -LL | fn from(_: T) -> Self; - | ^^^^^^^^^^^^^^^^^^^^^^ help: consider introducing a `where` bound, but there might be an alternative better way to express this requirement | LL | fn check() where u64: From<::Item> { @@ -80,12 +70,6 @@ error[E0277]: the trait bound `Misc<_>: From` is not satisfied | LL | as From>::from; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `From` is not implemented for `Misc<_>` - | -note: required by `from` - --> $SRC_DIR/core/src/convert/mod.rs:LL:COL - | -LL | fn from(_: T) -> Self; - | ^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the size for values of type `[T]` cannot be known at compilation time --> $DIR/suggest-where-clause.rs:28:20 diff --git a/src/test/ui/traits/vtable-res-trait-param.stderr b/src/test/ui/traits/vtable-res-trait-param.stderr index c5fff622b6b23..2b3e3de9b1ab4 100644 --- a/src/test/ui/traits/vtable-res-trait-param.stderr +++ b/src/test/ui/traits/vtable-res-trait-param.stderr @@ -5,6 +5,12 @@ LL | b.gimme_an_a(y) | ---------- ^ the trait `TraitA` is not implemented for `{integer}` | | | required by a bound introduced by this call + | +note: required by a bound in `TraitB::gimme_an_a` + --> $DIR/vtable-res-trait-param.rs:6:21 + | +LL | fn gimme_an_a(&self, a: A) -> isize; + | ^^^^^^ required by this bound in `TraitB::gimme_an_a` error: aborting due to previous error diff --git a/src/test/ui/traits/vtable/vtable-diamond.stderr b/src/test/ui/traits/vtable/vtable-diamond.stderr index f2b64fac3b75e..f71bed84d5627 100644 --- a/src/test/ui/traits/vtable/vtable-diamond.stderr +++ b/src/test/ui/traits/vtable/vtable-diamond.stderr @@ -1,13 +1,13 @@ error: vtable entries for ``: [ - MetadataDropInPlace, - MetadataSize, - MetadataAlign, - Method(::foo_a), - Method(::foo_b), - Method(::foo_c), - TraitVPtr(), - Method(::foo_d), -] + MetadataDropInPlace, + MetadataSize, + MetadataAlign, + Method(::foo_a), + Method(::foo_b), + Method(::foo_c), + TraitVPtr(), + Method(::foo_d), + ] --> $DIR/vtable-diamond.rs:21:1 | LL | / trait D: B + C { @@ -17,12 +17,12 @@ LL | | } | |_^ error: vtable entries for ``: [ - MetadataDropInPlace, - MetadataSize, - MetadataAlign, - Method(::foo_a), - Method(::foo_c), -] + MetadataDropInPlace, + MetadataSize, + MetadataAlign, + Method(::foo_a), + Method(::foo_c), + ] --> $DIR/vtable-diamond.rs:15:1 | LL | / trait C: A { diff --git a/src/test/ui/traits/vtable/vtable-multi-level.stderr b/src/test/ui/traits/vtable/vtable-multi-level.stderr index 742b88ea8a9c9..915fd701b0336 100644 --- a/src/test/ui/traits/vtable/vtable-multi-level.stderr +++ b/src/test/ui/traits/vtable/vtable-multi-level.stderr @@ -1,34 +1,34 @@ error: vtable entries for ``: [ - MetadataDropInPlace, - MetadataSize, - MetadataAlign, - Method(::foo_a), - Method(::foo_b), - TraitVPtr(), - Method(::foo_c), - Method(::foo_d), - TraitVPtr(), - Method(::foo_e), - TraitVPtr(), - Method(::foo_f), - TraitVPtr(), - Method(::foo_g), - Method(::foo_h), - TraitVPtr(), - Method(::foo_i), - TraitVPtr(), - Method(::foo_j), - TraitVPtr(), - Method(::foo_k), - TraitVPtr(), - Method(::foo_l), - TraitVPtr(), - Method(::foo_m), - TraitVPtr(), - Method(::foo_n), - TraitVPtr(), - Method(::foo_o), -] + MetadataDropInPlace, + MetadataSize, + MetadataAlign, + Method(::foo_a), + Method(::foo_b), + TraitVPtr(), + Method(::foo_c), + Method(::foo_d), + TraitVPtr(), + Method(::foo_e), + TraitVPtr(), + Method(::foo_f), + TraitVPtr(), + Method(::foo_g), + Method(::foo_h), + TraitVPtr(), + Method(::foo_i), + TraitVPtr(), + Method(::foo_j), + TraitVPtr(), + Method(::foo_k), + TraitVPtr(), + Method(::foo_l), + TraitVPtr(), + Method(::foo_m), + TraitVPtr(), + Method(::foo_n), + TraitVPtr(), + Method(::foo_o), + ] --> $DIR/vtable-multi-level.rs:95:1 | LL | / trait O: G + N { @@ -38,11 +38,11 @@ LL | | } | |_^ error: vtable entries for ``: [ - MetadataDropInPlace, - MetadataSize, - MetadataAlign, - Method(::foo_b), -] + MetadataDropInPlace, + MetadataSize, + MetadataAlign, + Method(::foo_b), + ] --> $DIR/vtable-multi-level.rs:19:1 | LL | / trait B { @@ -52,11 +52,11 @@ LL | | } | |_^ error: vtable entries for ``: [ - MetadataDropInPlace, - MetadataSize, - MetadataAlign, - Method(::foo_d), -] + MetadataDropInPlace, + MetadataSize, + MetadataAlign, + Method(::foo_d), + ] --> $DIR/vtable-multi-level.rs:30:1 | LL | / trait D { @@ -66,11 +66,11 @@ LL | | } | |_^ error: vtable entries for ``: [ - MetadataDropInPlace, - MetadataSize, - MetadataAlign, - Method(::foo_e), -] + MetadataDropInPlace, + MetadataSize, + MetadataAlign, + Method(::foo_e), + ] --> $DIR/vtable-multi-level.rs:36:1 | LL | / trait E { @@ -80,14 +80,14 @@ LL | | } | |_^ error: vtable entries for ``: [ - MetadataDropInPlace, - MetadataSize, - MetadataAlign, - Method(::foo_d), - Method(::foo_e), - TraitVPtr(), - Method(::foo_f), -] + MetadataDropInPlace, + MetadataSize, + MetadataAlign, + Method(::foo_d), + Method(::foo_e), + TraitVPtr(), + Method(::foo_f), + ] --> $DIR/vtable-multi-level.rs:42:1 | LL | / trait F: D + E { @@ -97,11 +97,11 @@ LL | | } | |_^ error: vtable entries for ``: [ - MetadataDropInPlace, - MetadataSize, - MetadataAlign, - Method(::foo_h), -] + MetadataDropInPlace, + MetadataSize, + MetadataAlign, + Method(::foo_h), + ] --> $DIR/vtable-multi-level.rs:53:1 | LL | / trait H { @@ -111,11 +111,11 @@ LL | | } | |_^ error: vtable entries for ``: [ - MetadataDropInPlace, - MetadataSize, - MetadataAlign, - Method(::foo_i), -] + MetadataDropInPlace, + MetadataSize, + MetadataAlign, + Method(::foo_i), + ] --> $DIR/vtable-multi-level.rs:59:1 | LL | / trait I { @@ -125,14 +125,14 @@ LL | | } | |_^ error: vtable entries for ``: [ - MetadataDropInPlace, - MetadataSize, - MetadataAlign, - Method(::foo_h), - Method(::foo_i), - TraitVPtr(), - Method(::foo_j), -] + MetadataDropInPlace, + MetadataSize, + MetadataAlign, + Method(::foo_h), + Method(::foo_i), + TraitVPtr(), + Method(::foo_j), + ] --> $DIR/vtable-multi-level.rs:65:1 | LL | / trait J: H + I { @@ -142,11 +142,11 @@ LL | | } | |_^ error: vtable entries for ``: [ - MetadataDropInPlace, - MetadataSize, - MetadataAlign, - Method(::foo_k), -] + MetadataDropInPlace, + MetadataSize, + MetadataAlign, + Method(::foo_k), + ] --> $DIR/vtable-multi-level.rs:71:1 | LL | / trait K { @@ -156,11 +156,11 @@ LL | | } | |_^ error: vtable entries for ``: [ - MetadataDropInPlace, - MetadataSize, - MetadataAlign, - Method(::foo_l), -] + MetadataDropInPlace, + MetadataSize, + MetadataAlign, + Method(::foo_l), + ] --> $DIR/vtable-multi-level.rs:77:1 | LL | / trait L { @@ -170,14 +170,14 @@ LL | | } | |_^ error: vtable entries for ``: [ - MetadataDropInPlace, - MetadataSize, - MetadataAlign, - Method(::foo_k), - Method(::foo_l), - TraitVPtr(), - Method(::foo_m), -] + MetadataDropInPlace, + MetadataSize, + MetadataAlign, + Method(::foo_k), + Method(::foo_l), + TraitVPtr(), + Method(::foo_m), + ] --> $DIR/vtable-multi-level.rs:83:1 | LL | / trait M: K + L { @@ -187,21 +187,21 @@ LL | | } | |_^ error: vtable entries for ``: [ - MetadataDropInPlace, - MetadataSize, - MetadataAlign, - Method(::foo_h), - Method(::foo_i), - TraitVPtr(), - Method(::foo_j), - Method(::foo_k), - TraitVPtr(), - Method(::foo_l), - TraitVPtr(), - Method(::foo_m), - TraitVPtr(), - Method(::foo_n), -] + MetadataDropInPlace, + MetadataSize, + MetadataAlign, + Method(::foo_h), + Method(::foo_i), + TraitVPtr(), + Method(::foo_j), + Method(::foo_k), + TraitVPtr(), + Method(::foo_l), + TraitVPtr(), + Method(::foo_m), + TraitVPtr(), + Method(::foo_n), + ] --> $DIR/vtable-multi-level.rs:89:1 | LL | / trait N: J + M { diff --git a/src/test/ui/traits/vtable/vtable-multiple.stderr b/src/test/ui/traits/vtable/vtable-multiple.stderr index f25ac76fbe069..f1c8947f9069f 100644 --- a/src/test/ui/traits/vtable/vtable-multiple.stderr +++ b/src/test/ui/traits/vtable/vtable-multiple.stderr @@ -1,12 +1,12 @@ error: vtable entries for ``: [ - MetadataDropInPlace, - MetadataSize, - MetadataAlign, - Method(::foo_a), - Method(::foo_b), - TraitVPtr(), - Method(::foo_c), -] + MetadataDropInPlace, + MetadataSize, + MetadataAlign, + Method(::foo_a), + Method(::foo_b), + TraitVPtr(), + Method(::foo_c), + ] --> $DIR/vtable-multiple.rs:16:1 | LL | / trait C: A + B { @@ -16,11 +16,11 @@ LL | | } | |_^ error: vtable entries for ``: [ - MetadataDropInPlace, - MetadataSize, - MetadataAlign, - Method(::foo_b), -] + MetadataDropInPlace, + MetadataSize, + MetadataAlign, + Method(::foo_b), + ] --> $DIR/vtable-multiple.rs:10:1 | LL | / trait B { diff --git a/src/test/ui/traits/vtable/vtable-non-object-safe.stderr b/src/test/ui/traits/vtable/vtable-non-object-safe.stderr index 34fe910525be1..bbfbde222f334 100644 --- a/src/test/ui/traits/vtable/vtable-non-object-safe.stderr +++ b/src/test/ui/traits/vtable/vtable-non-object-safe.stderr @@ -1,12 +1,12 @@ error: vtable entries for ` as A>`: [ - MetadataDropInPlace, - MetadataSize, - MetadataAlign, - Method( as Iterator>::next), - Method( as Iterator>::size_hint), - Method( as Iterator>::advance_by), - Method( as Iterator>::nth), -] + MetadataDropInPlace, + MetadataSize, + MetadataAlign, + Method( as Iterator>::next), + Method( as Iterator>::size_hint), + Method( as Iterator>::advance_by), + Method( as Iterator>::nth), + ] --> $DIR/vtable-non-object-safe.rs:8:1 | LL | trait A: Iterator {} diff --git a/src/test/ui/traits/vtable/vtable-vacant.stderr b/src/test/ui/traits/vtable/vtable-vacant.stderr index e3b75e7cf33f3..c8cf58399723c 100644 --- a/src/test/ui/traits/vtable/vtable-vacant.stderr +++ b/src/test/ui/traits/vtable/vtable-vacant.stderr @@ -1,12 +1,12 @@ error: vtable entries for ``: [ - MetadataDropInPlace, - MetadataSize, - MetadataAlign, - Method(::foo_a1), - Vacant, - Method(::foo_b1), - Vacant, -] + MetadataDropInPlace, + MetadataSize, + MetadataAlign, + Method(::foo_a1), + Vacant, + Method(::foo_b1), + Vacant, + ] --> $DIR/vtable-vacant.rs:15:1 | LL | / trait B: A { diff --git a/src/test/ui/trivial-bounds/trivial-bounds-leak.stderr b/src/test/ui/trivial-bounds/trivial-bounds-leak.stderr index d9e0d21541ede..02c5d5d248403 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-leak.stderr +++ b/src/test/ui/trivial-bounds/trivial-bounds-leak.stderr @@ -27,12 +27,6 @@ LL | Foo::test(&4i32); | --------- ^^^^^ the trait `Foo` is not implemented for `i32` | | | required by a bound introduced by this call - | -note: required by `Foo::test` - --> $DIR/trivial-bounds-leak.rs:5:5 - | -LL | fn test(&self); - | ^^^^^^^^^^^^^^^ error[E0277]: the trait bound `i32: Foo` is not satisfied --> $DIR/trivial-bounds-leak.rs:26:22 diff --git a/src/test/ui/try-block/try-block-bad-type.stderr b/src/test/ui/try-block/try-block-bad-type.stderr index fce8dbab4856c..cf3a07808de68 100644 --- a/src/test/ui/try-block/try-block-bad-type.stderr +++ b/src/test/ui/try-block/try-block-bad-type.stderr @@ -8,11 +8,6 @@ LL | Err("")?; = help: the following implementations were found: > = note: required because of the requirements on the impl of `FromResidual>` for `Result` -note: required by `from_residual` - --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL - | -LL | fn from_residual(residual: R) -> Self; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0271]: type mismatch resolving ` as Try>::Output == &str` --> $DIR/try-block-bad-type.rs:12:9 @@ -33,11 +28,6 @@ LL | let res: () = try { }; | ^ could not wrap the final value of the block as `()` doesn't implement `Try` | = help: the trait `Try` is not implemented for `()` -note: required by `from_output` - --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL - | -LL | fn from_output(output: Self::Output) -> Self; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: a `try` block must return `Result` or `Option` (or another type that implements `Try`) --> $DIR/try-block-bad-type.rs:20:26 @@ -46,11 +36,6 @@ LL | let res: i32 = try { 5 }; | ^ could not wrap the final value of the block as `i32` doesn't implement `Try` | = help: the trait `Try` is not implemented for `i32` -note: required by `from_output` - --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL - | -LL | fn from_output(output: Self::Output) -> Self; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 5 previous errors diff --git a/src/test/ui/try-block/try-block-in-while.stderr b/src/test/ui/try-block/try-block-in-while.stderr index 4270df5b4063c..62cc26dd4010d 100644 --- a/src/test/ui/try-block/try-block-in-while.stderr +++ b/src/test/ui/try-block/try-block-in-while.stderr @@ -5,11 +5,6 @@ LL | while try { false } {} | ^^^^^ could not wrap the final value of the block as `bool` doesn't implement `Try` | = help: the trait `Try` is not implemented for `bool` -note: required by `from_output` - --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL - | -LL | fn from_output(output: Self::Output) -> Self; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/try-trait/bad-interconversion.stderr b/src/test/ui/try-trait/bad-interconversion.stderr index 5cecf9128bb2c..80c5e6f529cd6 100644 --- a/src/test/ui/try-trait/bad-interconversion.stderr +++ b/src/test/ui/try-trait/bad-interconversion.stderr @@ -11,11 +11,6 @@ LL | Ok(Err(123_i32)?) > > = note: required because of the requirements on the impl of `FromResidual>` for `Result` -note: required by `from_residual` - --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL - | -LL | fn from_residual(residual: R) -> Self; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the `?` operator can only be used on `Result`s, not `Option`s, in a function that returns `Result` --> $DIR/bad-interconversion.rs:11:12 @@ -29,11 +24,6 @@ LL | | } | |_- this function returns a `Result` | = help: the trait `FromResidual>` is not implemented for `Result` -note: required by `from_residual` - --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL - | -LL | fn from_residual(residual: R) -> Self; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the `?` operator can only be used on `Result`s in a function that returns `Result` --> $DIR/bad-interconversion.rs:17:31 @@ -46,11 +36,6 @@ LL | | } | |_- this function returns a `Result` | = help: the trait `FromResidual>` is not implemented for `Result` -note: required by `from_residual` - --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL - | -LL | fn from_residual(residual: R) -> Self; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the `?` operator can only be used on `Option`s, not `Result`s, in a function that returns `Option` --> $DIR/bad-interconversion.rs:22:22 @@ -63,11 +48,6 @@ LL | | } | |_- this function returns an `Option` | = help: the trait `FromResidual>` is not implemented for `Option` -note: required by `from_residual` - --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL - | -LL | fn from_residual(residual: R) -> Self; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the `?` operator can only be used on `Option`s in a function that returns `Option` --> $DIR/bad-interconversion.rs:27:33 @@ -80,11 +60,6 @@ LL | | } | |_- this function returns an `Option` | = help: the trait `FromResidual>` is not implemented for `Option` -note: required by `from_residual` - --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL - | -LL | fn from_residual(residual: R) -> Self; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the `?` operator can only be used on `ControlFlow`s in a function that returns `ControlFlow` --> $DIR/bad-interconversion.rs:32:39 @@ -97,11 +72,6 @@ LL | | } | |_- this function returns a `ControlFlow` | = help: the trait `FromResidual>` is not implemented for `ControlFlow` -note: required by `from_residual` - --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL - | -LL | fn from_residual(residual: R) -> Self; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the `?` operator can only be used on `ControlFlow`s in a function that returns `ControlFlow` --> $DIR/bad-interconversion.rs:37:12 @@ -115,11 +85,6 @@ LL | | } | |_- this function returns a `ControlFlow` | = help: the trait `FromResidual>` is not implemented for `ControlFlow` -note: required by `from_residual` - --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL - | -LL | fn from_residual(residual: R) -> Self; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the `?` operator in a function that returns `ControlFlow` can only be used on other `ControlFlow`s (with the same Break type) --> $DIR/bad-interconversion.rs:43:29 @@ -134,11 +99,6 @@ LL | | } | = help: the trait `FromResidual>` is not implemented for `ControlFlow` = note: unlike `Result`, there's no `From`-conversion performed for `ControlFlow` -note: required by `from_residual` - --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL - | -LL | fn from_residual(residual: R) -> Self; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 8 previous errors diff --git a/src/test/ui/try-trait/option-to-result.stderr b/src/test/ui/try-trait/option-to-result.stderr index f89813e729fad..aadfbf61f28f8 100644 --- a/src/test/ui/try-trait/option-to-result.stderr +++ b/src/test/ui/try-trait/option-to-result.stderr @@ -10,11 +10,6 @@ LL | | } | |_- this function returns a `Result` | = help: the trait `FromResidual>` is not implemented for `Result<(), ()>` -note: required by `from_residual` - --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL - | -LL | fn from_residual(residual: R) -> Self; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the `?` operator can only be used on `Option`s, not `Result`s, in a function that returns `Option` --> $DIR/option-to-result.rs:11:6 @@ -28,11 +23,6 @@ LL | | } | |_- this function returns an `Option` | = help: the trait `FromResidual>` is not implemented for `Option` -note: required by `from_residual` - --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL - | -LL | fn from_residual(residual: R) -> Self; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/try-trait/try-on-option-diagnostics.stderr b/src/test/ui/try-trait/try-on-option-diagnostics.stderr index bb65aae561f97..a6badd1903885 100644 --- a/src/test/ui/try-trait/try-on-option-diagnostics.stderr +++ b/src/test/ui/try-trait/try-on-option-diagnostics.stderr @@ -10,11 +10,6 @@ LL | | } | |_- this function should return `Result` or `Option` to accept `?` | = help: the trait `FromResidual>` is not implemented for `u32` -note: required by `from_residual` - --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL - | -LL | fn from_residual(residual: R) -> Self; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the `?` operator can only be used in a closure that returns `Result` or `Option` (or another type that implements `FromResidual`) --> $DIR/try-on-option-diagnostics.rs:14:10 @@ -29,11 +24,6 @@ LL | | }; | |_____- this function should return `Result` or `Option` to accept `?` | = help: the trait `FromResidual>` is not implemented for `{integer}` -note: required by `from_residual` - --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL - | -LL | fn from_residual(residual: R) -> Self; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the `?` operator can only be used in a method that returns `Result` or `Option` (or another type that implements `FromResidual`) --> $DIR/try-on-option-diagnostics.rs:26:14 @@ -46,11 +36,6 @@ LL | | } | |_________- this function should return `Result` or `Option` to accept `?` | = help: the trait `FromResidual>` is not implemented for `()` -note: required by `from_residual` - --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL - | -LL | fn from_residual(residual: R) -> Self; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the `?` operator can only be used in a trait method that returns `Result` or `Option` (or another type that implements `FromResidual`) --> $DIR/try-on-option-diagnostics.rs:39:14 @@ -63,11 +48,6 @@ LL | | } | |_________- this function should return `Result` or `Option` to accept `?` | = help: the trait `FromResidual>` is not implemented for `()` -note: required by `from_residual` - --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL - | -LL | fn from_residual(residual: R) -> Self; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/try-trait/try-on-option.stderr b/src/test/ui/try-trait/try-on-option.stderr index b522dd5709b29..27e33bc022efb 100644 --- a/src/test/ui/try-trait/try-on-option.stderr +++ b/src/test/ui/try-trait/try-on-option.stderr @@ -10,11 +10,6 @@ LL | | } | |_- this function returns a `Result` | = help: the trait `FromResidual>` is not implemented for `Result` -note: required by `from_residual` - --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL - | -LL | fn from_residual(residual: R) -> Self; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`) --> $DIR/try-on-option.rs:13:6 @@ -28,11 +23,6 @@ LL | | } | |_- this function should return `Result` or `Option` to accept `?` | = help: the trait `FromResidual>` is not implemented for `u32` -note: required by `from_residual` - --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL - | -LL | fn from_residual(residual: R) -> Self; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/try-trait/try-operator-on-main.stderr b/src/test/ui/try-trait/try-operator-on-main.stderr index d669124e9f112..ad55f40b5b638 100644 --- a/src/test/ui/try-trait/try-operator-on-main.stderr +++ b/src/test/ui/try-trait/try-operator-on-main.stderr @@ -12,11 +12,6 @@ LL | | } | |_- this function should return `Result` or `Option` to accept `?` | = help: the trait `FromResidual>` is not implemented for `()` -note: required by `from_residual` - --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL - | -LL | fn from_residual(residual: R) -> Self; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the `?` operator can only be applied to values that implement `Try` --> $DIR/try-operator-on-main.rs:10:5 @@ -25,11 +20,6 @@ LL | ()?; | ^^^ the `?` operator cannot be applied to type `()` | = help: the trait `Try` is not implemented for `()` -note: required by `branch` - --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL - | -LL | fn branch(self) -> ControlFlow; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`) --> $DIR/try-operator-on-main.rs:10:7 @@ -47,11 +37,6 @@ LL | | } | |_- this function should return `Result` or `Option` to accept `?` | = help: the trait `FromResidual<_>` is not implemented for `()` -note: required by `from_residual` - --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL - | -LL | fn from_residual(residual: R) -> Self; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `(): Try` is not satisfied --> $DIR/try-operator-on-main.rs:14:25 @@ -72,11 +57,6 @@ LL | ()?; | ^^^ the `?` operator cannot be applied to type `()` | = help: the trait `Try` is not implemented for `()` -note: required by `branch` - --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL - | -LL | fn branch(self) -> ControlFlow; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 5 previous errors diff --git a/src/test/ui/type/type-check-defaults.stderr b/src/test/ui/type/type-check-defaults.stderr index f8dbd66c1c7ac..2a61547997b63 100644 --- a/src/test/ui/type/type-check-defaults.stderr +++ b/src/test/ui/type/type-check-defaults.stderr @@ -29,36 +29,18 @@ error[E0277]: the trait bound `String: Copy` is not satisfied | LL | struct Bounds(T); | ^^^^ the trait `Copy` is not implemented for `String` - | -note: required by `Bounds` - --> $DIR/type-check-defaults.rs:11:1 - | -LL | struct Bounds(T); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `String: Copy` is not satisfied --> $DIR/type-check-defaults.rs:14:42 | LL | struct WhereClause(T) where T: Copy; | ^^^^ the trait `Copy` is not implemented for `String` - | -note: required by `WhereClause` - --> $DIR/type-check-defaults.rs:14:1 - | -LL | struct WhereClause(T) where T: Copy; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `String: Copy` is not satisfied --> $DIR/type-check-defaults.rs:17:20 | LL | trait TraitBound {} | ^^^^ the trait `Copy` is not implemented for `String` - | -note: required by `TraitBound` - --> $DIR/type-check-defaults.rs:17:1 - | -LL | trait TraitBound {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `T: Copy` is not satisfied --> $DIR/type-check-defaults.rs:21:25 @@ -83,11 +65,6 @@ LL | trait ProjectionPred> where T::Item : Add {} | ^^^^^^^ no implementation for `i32 + u8` | = help: the trait `Add` is not implemented for `i32` -note: required by `ProjectionPred` - --> $DIR/type-check-defaults.rs:24:1 - | -LL | trait ProjectionPred> where T::Item : Add {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 7 previous errors diff --git a/src/test/ui/type/type-check/issue-40294.stderr b/src/test/ui/type/type-check/issue-40294.stderr index 9ca07eaba838a..6d1e490bcf330 100644 --- a/src/test/ui/type/type-check/issue-40294.stderr +++ b/src/test/ui/type/type-check/issue-40294.stderr @@ -5,11 +5,6 @@ LL | where &'a T : Foo, | ^^^ cannot infer type for reference `&'a T` | = note: cannot satisfy `&'a T: Foo` -note: required by a bound in `Foo` - --> $DIR/issue-40294.rs:1:1 - | -LL | trait Foo: Sized { - | ^^^^^^^^^^^^^^^^ required by this bound in `Foo` error: aborting due to previous error diff --git a/src/test/ui/type/type-params-in-different-spaces-2.stderr b/src/test/ui/type/type-params-in-different-spaces-2.stderr index 368adb456d61a..53610985f31da 100644 --- a/src/test/ui/type/type-params-in-different-spaces-2.stderr +++ b/src/test/ui/type/type-params-in-different-spaces-2.stderr @@ -4,11 +4,6 @@ error[E0277]: the trait bound `Self: Tr` is not satisfied LL | Tr::op(u) | ^^^^^^ the trait `Tr` is not implemented for `Self` | -note: required by `Tr::op` - --> $DIR/type-params-in-different-spaces-2.rs:5:5 - | -LL | fn op(_: T) -> Self; - | ^^^^^^^^^^^^^^^^^^^^ help: consider further restricting `Self` | LL | fn test(u: U) -> Self where Self: Tr { @@ -20,11 +15,6 @@ error[E0277]: the trait bound `Self: Tr` is not satisfied LL | Tr::op(u) | ^^^^^^ the trait `Tr` is not implemented for `Self` | -note: required by `Tr::op` - --> $DIR/type-params-in-different-spaces-2.rs:5:5 - | -LL | fn op(_: T) -> Self; - | ^^^^^^^^^^^^^^^^^^^^ help: consider further restricting `Self` | LL | fn test(u: U) -> Self where Self: Tr { diff --git a/src/test/ui/typeck/issue-46112.stderr b/src/test/ui/typeck/issue-46112.stderr index ec05fbe580ede..39bff88e7f81a 100644 --- a/src/test/ui/typeck/issue-46112.stderr +++ b/src/test/ui/typeck/issue-46112.stderr @@ -2,13 +2,14 @@ error[E0308]: mismatched types --> $DIR/issue-46112.rs:9:21 | LL | fn main() { test(Ok(())); } - | ^^ - | | - | expected enum `Option`, found `()` - | help: try using a variant of the expected enum: `Some(())` + | ^^ expected enum `Option`, found `()` | = note: expected enum `Option<()>` found unit type `()` +help: try wrapping the expression in `Some` + | +LL | fn main() { test(Ok(Some(()))); } + | +++++ + error: aborting due to previous error diff --git a/src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr b/src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr index 23b9157375657..d0bc432a1cd18 100644 --- a/src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr +++ b/src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr @@ -5,11 +5,6 @@ LL | >::add(1, 2); | ^^^^^^^^^^^^^^^^^^^^^^ no implementation for `i32 + u32` | = help: the trait `Add` is not implemented for `i32` -note: required by `add` - --> $SRC_DIR/core/src/ops/arith.rs:LL:COL - | -LL | fn add(self, rhs: Rhs) -> Self::Output; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0308]: mismatched types --> $DIR/ufcs-qpath-self-mismatch.rs:6:28 diff --git a/src/test/ui/unevaluated_fixed_size_array_len.stderr b/src/test/ui/unevaluated_fixed_size_array_len.stderr index be6ed8d56232e..03932d5ed0347 100644 --- a/src/test/ui/unevaluated_fixed_size_array_len.stderr +++ b/src/test/ui/unevaluated_fixed_size_array_len.stderr @@ -6,11 +6,6 @@ LL | <[(); 0] as Foo>::foo() | = help: the following implementations were found: <[(); 1] as Foo> -note: required by `Foo::foo` - --> $DIR/unevaluated_fixed_size_array_len.rs:4:5 - | -LL | fn foo(); - | ^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/union/union-generic.mirunsafeck.stderr b/src/test/ui/union/union-generic.mirunsafeck.stderr index cd8577818647a..a4f0c400d7310 100644 --- a/src/test/ui/union/union-generic.mirunsafeck.stderr +++ b/src/test/ui/union/union-generic.mirunsafeck.stderr @@ -4,11 +4,11 @@ error[E0277]: the trait bound `Rc: Copy` is not satisfied LL | let u = U { a: Rc::new(0u32) }; | ^ the trait `Copy` is not implemented for `Rc` | -note: required by `U` - --> $DIR/union-generic.rs:6:1 +note: required by a bound in `U` + --> $DIR/union-generic.rs:6:12 | LL | union U { - | ^^^^^^^^^^^^^^^^ + | ^^^^ required by this bound in `U` error[E0277]: the trait bound `Rc: Copy` is not satisfied --> $DIR/union-generic.rs:13:13 @@ -16,11 +16,11 @@ error[E0277]: the trait bound `Rc: Copy` is not satisfied LL | let u = U::> { a: Default::default() }; | ^^^^^^^^^^^^ the trait `Copy` is not implemented for `Rc` | -note: required by `U` - --> $DIR/union-generic.rs:6:1 +note: required by a bound in `U` + --> $DIR/union-generic.rs:6:12 | LL | union U { - | ^^^^^^^^^^^^^^^^ + | ^^^^ required by this bound in `U` error: aborting due to 2 previous errors diff --git a/src/test/ui/union/union-generic.thirunsafeck.stderr b/src/test/ui/union/union-generic.thirunsafeck.stderr index cd8577818647a..a4f0c400d7310 100644 --- a/src/test/ui/union/union-generic.thirunsafeck.stderr +++ b/src/test/ui/union/union-generic.thirunsafeck.stderr @@ -4,11 +4,11 @@ error[E0277]: the trait bound `Rc: Copy` is not satisfied LL | let u = U { a: Rc::new(0u32) }; | ^ the trait `Copy` is not implemented for `Rc` | -note: required by `U` - --> $DIR/union-generic.rs:6:1 +note: required by a bound in `U` + --> $DIR/union-generic.rs:6:12 | LL | union U { - | ^^^^^^^^^^^^^^^^ + | ^^^^ required by this bound in `U` error[E0277]: the trait bound `Rc: Copy` is not satisfied --> $DIR/union-generic.rs:13:13 @@ -16,11 +16,11 @@ error[E0277]: the trait bound `Rc: Copy` is not satisfied LL | let u = U::> { a: Default::default() }; | ^^^^^^^^^^^^ the trait `Copy` is not implemented for `Rc` | -note: required by `U` - --> $DIR/union-generic.rs:6:1 +note: required by a bound in `U` + --> $DIR/union-generic.rs:6:12 | LL | union U { - | ^^^^^^^^^^^^^^^^ + | ^^^^ required by this bound in `U` error: aborting due to 2 previous errors diff --git a/src/test/ui/unsized/issue-71659.stderr b/src/test/ui/unsized/issue-71659.stderr index be2df8c85e1af..d7b95f55769fd 100644 --- a/src/test/ui/unsized/issue-71659.stderr +++ b/src/test/ui/unsized/issue-71659.stderr @@ -3,6 +3,15 @@ error[E0277]: the trait bound `dyn Foo: CastTo<[i32]>` is not satisfied | LL | let x = x.cast::<[i32]>(); | ^^^^ the trait `CastTo<[i32]>` is not implemented for `dyn Foo` + | +note: required by a bound in `Cast::cast` + --> $DIR/issue-71659.rs:19:15 + | +LL | fn cast(&self) -> &T + | ---- required by a bound in this +LL | where +LL | Self: CastTo, + | ^^^^^^^^^ required by this bound in `Cast::cast` error: aborting due to previous error diff --git a/src/test/ui/wf/wf-foreign-fn-decl-ret.stderr b/src/test/ui/wf/wf-foreign-fn-decl-ret.stderr index 66bfdbc596266..b03023b5fd14f 100644 --- a/src/test/ui/wf/wf-foreign-fn-decl-ret.stderr +++ b/src/test/ui/wf/wf-foreign-fn-decl-ret.stderr @@ -3,12 +3,6 @@ error[E0277]: the trait bound `(): Foo` is not satisfied | LL | pub fn lint_me() -> <() as Foo>::Assoc; | ^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `()` - | -note: required by a bound in `Foo` - --> $DIR/wf-foreign-fn-decl-ret.rs:6:1 - | -LL | pub trait Foo { - | ^^^^^^^^^^^^^ required by this bound in `Foo` error[E0277]: the trait bound `u32: Unsatisfied` is not satisfied --> $DIR/wf-foreign-fn-decl-ret.rs:14:32 diff --git a/src/test/ui/where-clauses/where-clause-method-substituion.stderr b/src/test/ui/where-clauses/where-clause-method-substituion.stderr index cb381d2d9fe71..f431deee73f9a 100644 --- a/src/test/ui/where-clauses/where-clause-method-substituion.stderr +++ b/src/test/ui/where-clauses/where-clause-method-substituion.stderr @@ -3,6 +3,12 @@ error[E0277]: the trait bound `X: Foo` is not satisfied | LL | 1.method::(); | ^^^^^^ the trait `Foo` is not implemented for `X` + | +note: required by a bound in `Bar::method` + --> $DIR/where-clause-method-substituion.rs:6:34 + | +LL | fn method(&self) where A: Foo; + | ^^^^^^ required by this bound in `Bar::method` error: aborting due to previous error diff --git a/src/test/ui/where-clauses/where-clauses-method-unsatisfied.stderr b/src/test/ui/where-clauses/where-clauses-method-unsatisfied.stderr index 3223dca3cddbf..3a4cbb62d5597 100644 --- a/src/test/ui/where-clauses/where-clauses-method-unsatisfied.stderr +++ b/src/test/ui/where-clauses/where-clauses-method-unsatisfied.stderr @@ -5,6 +5,12 @@ LL | x.equals(&x); | ------ ^^ the trait `Eq` is not implemented for `Bar` | | | required by a bound introduced by this call + | +note: required by a bound in `Foo::::equals` + --> $DIR/where-clauses-method-unsatisfied.rs:11:52 + | +LL | fn equals(&self, u: &Foo) -> bool where T : Eq { + | ^^ required by this bound in `Foo::::equals` error: aborting due to previous error