diff --git a/compiler/rustc_ast/src/ast.rs b/compiler/rustc_ast/src/ast.rs index 20d60887e2d5f..ba3d337fe0173 100644 --- a/compiler/rustc_ast/src/ast.rs +++ b/compiler/rustc_ast/src/ast.rs @@ -550,15 +550,6 @@ pub struct WhereRegionPredicate { pub bounds: GenericBounds, } -/// An equality predicate (unsupported). -/// -/// E.g., `T = int`. -#[derive(Clone, Encodable, Decodable, Debug, Walkable)] -pub struct WhereEqPredicate { - pub lhs_ty: Box, - pub rhs_ty: Box, -} - #[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct Crate { /// Must be equal to `CRATE_NODE_ID` after the crate root is expanded, but may hold diff --git a/compiler/rustc_ast/src/visit.rs b/compiler/rustc_ast/src/visit.rs index 92f418b48bebf..9dc55686c7494 100644 --- a/compiler/rustc_ast/src/visit.rs +++ b/compiler/rustc_ast/src/visit.rs @@ -576,7 +576,6 @@ macro_rules! common_visitor_and_walkers { VisibilityKind, WhereBoundPredicate, WhereClause, - WhereEqPredicate, WhereRegionPredicate, YieldKind, // tidy-alphabetical-end diff --git a/compiler/rustc_attr_parsing/src/attributes/non_exhaustive.rs b/compiler/rustc_attr_parsing/src/attributes/non_exhaustive.rs index c2f8875e440e7..b363675d5932f 100644 --- a/compiler/rustc_attr_parsing/src/attributes/non_exhaustive.rs +++ b/compiler/rustc_attr_parsing/src/attributes/non_exhaustive.rs @@ -23,10 +23,9 @@ impl NoArgsAttributeParser for NonExhaustiveParser { const CREATE: fn(Span) -> AttributeKind = AttributeKind::NonExhaustive; fn finalize_check(cx: &mut FinalizeCheckContext<'_, '_>, attr_span: Span) { - let AstTarget::Struct(_, _, data) = cx.ast_target else { - return; - }; - if let VariantData::Struct { fields, .. } = data + if let AstTarget::Struct(_, _, data) | AstTarget::Variant(rustc_ast::Variant { data, .. }) = + cx.ast_target + && let VariantData::Struct { fields, .. } = data && fields.iter().any(|f| f.default_value().is_some()) { cx.emit_err(NonExhaustiveWithDefaultFieldValues { diff --git a/compiler/rustc_attr_parsing/src/diagnostics.rs b/compiler/rustc_attr_parsing/src/diagnostics.rs index dd668cb8117a4..2bc7548194a02 100644 --- a/compiler/rustc_attr_parsing/src/diagnostics.rs +++ b/compiler/rustc_attr_parsing/src/diagnostics.rs @@ -1281,7 +1281,7 @@ pub(crate) struct DeprecatedAnnotationHasNoEffect { } #[derive(Diagnostic)] -#[diag("`#[non_exhaustive]` can't be used to annotate items with default field values")] +#[diag("`#[non_exhaustive]` can't be used to annotate structs with default field values")] pub(crate) struct NonExhaustiveWithDefaultFieldValues { #[primary_span] pub attr_span: Span, diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index cc4fea22b819a..4ce8f5e793bc9 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -1280,13 +1280,6 @@ impl<'hir> WhereRegionPredicate<'hir> { } } -/// An equality predicate (e.g., `T = int`); currently unsupported. -#[derive(Debug, Clone, Copy, StableHash)] -pub struct WhereEqPredicate<'hir> { - pub lhs_ty: &'hir Ty<'hir>, - pub rhs_ty: &'hir Ty<'hir>, -} - /// HIR node coupled with its parent's id in the same HIR owner. /// /// The parent is trash when the node is a HIR owner. diff --git a/compiler/rustc_hir_analysis/src/check/check.rs b/compiler/rustc_hir_analysis/src/check/check.rs index ea0840ff1e893..495e8e5590eed 100644 --- a/compiler/rustc_hir_analysis/src/check/check.rs +++ b/compiler/rustc_hir_analysis/src/check/check.rs @@ -988,7 +988,11 @@ pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Result<(), tcx.ensure_ok().type_of(def_id); tcx.ensure_ok().clauses_of(def_id); let ty = tcx.type_of(def_id).instantiate_identity(); - let span = tcx.def_span(def_id); + let span = match tcx.hir_node_by_def_id(def_id).alias_ty() { + Some(ty) => ty.span, + _ => tcx.def_span(def_id), + }; + if tcx.type_alias_is_checked(def_id) { res = res.and(enter_wf_checking_ctxt(tcx, def_id, |wfcx| { let item_ty = wfcx.deeply_normalize(span, WellFormedLoc::Ty(def_id), ty); diff --git a/compiler/rustc_hir_analysis/src/diagnostics/wrong_number_of_generic_args.rs b/compiler/rustc_hir_analysis/src/diagnostics/wrong_number_of_generic_args.rs index d76e7d4dc7bf3..a0c4f3f9e559a 100644 --- a/compiler/rustc_hir_analysis/src/diagnostics/wrong_number_of_generic_args.rs +++ b/compiler/rustc_hir_analysis/src/diagnostics/wrong_number_of_generic_args.rs @@ -2,8 +2,10 @@ use GenericArgsInfo::*; use rustc_errors::codes::*; use rustc_errors::{Applicability, Diag, Diagnostic, MultiSpan, pluralize}; use rustc_hir as hir; -use rustc_middle::ty::{self as ty, AssocItem, AssocItems, TyCtxt}; +use rustc_hir::def::DefKind; +use rustc_middle::ty::{self as ty, AssocItem, AssocItems, Ty, TyCtxt}; use rustc_span::def_id::{DefId, LocalDefId}; +use rustc_span::{Symbol, kw}; use tracing::debug; /// Handles the `wrong number of type / lifetime / ... arguments` family of error messages. @@ -442,6 +444,17 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> { &self, num_params_to_take: usize, ) -> String { + self.get_type_or_const_arg_names(num_params_to_take) + .map(|(n, _)| n.to_string()) + .intersperse(", ".to_string()) + .collect() + } + + // Lists type or constant names from the provided parameter names + fn get_type_or_const_arg_names( + &self, + num_params_to_take: usize, + ) -> impl Iterator>)> { let is_in_a_method_call = self .tcx .hir_parent_iter(self.path_segment.hir_id) @@ -458,7 +471,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> { }); let fn_sig = self.tcx.hir_get_if_local(self.def_id).and_then(hir::Node::fn_sig); - let is_used_in_input = |def_id| { + let is_used_in_input = move |def_id| { fn_sig.is_some_and(|fn_sig| { fn_sig.decl.inputs.iter().any(|ty| match ty.kind { hir::TyKind::Path(hir::QPath::Resolved( @@ -474,18 +487,21 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> { .iter() .skip(self.params_offset + self.num_provided_type_or_const_args()) .take(num_params_to_take) - .map(|param| match param.kind { + .map(move |param| match param.kind { // If it's in method call (turbofish), it might be inferred from the expression (e.g. `.collect::>()`) // If it is being inferred from the item's inputs, no need to set it. ty::GenericParamDefKind::Type { .. } if is_in_a_method_call || is_used_in_input(param.def_id) => { - "_" + (kw::Underscore, None) } - _ => param.name.as_str(), + // FIXME: tcx.type_of(param.def_id) for consts + ty::GenericParamDefKind::Const { .. } => ( + param.name, + Some(self.tcx.type_of(param.def_id).instantiate_identity().skip_norm_wip()), + ), + _ => (param.name, None), }) - .intersperse(", ") - .collect() } fn get_unbound_associated_item(&self) -> Vec<&AssocItem> { @@ -715,22 +731,39 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> { let suggested_args = self.get_type_or_const_args_suggestions_from_param_names(num_missing_args); + let arg_names: Vec<_> = self.get_type_or_const_arg_names(num_missing_args).collect(); debug!("suggested_args: {:?}", suggested_args); + let mut impl_sugg = None; + if let DefKind::Impl { .. } = self.tcx.def_kind(self.cx_def_id) { + let mut impl_args = vec![]; + let i = self.tcx.hir_node_by_def_id(self.cx_def_id).expect_item().expect_impl(); + for (arg, const_ty) in arg_names { + if i.generics.get_named(arg).is_none() { + impl_args.push(match const_ty { + Some(ty) => format!("const {arg}: {ty}"), + None => arg.to_string(), + }) + } + } + if !impl_args.is_empty() { + impl_sugg = Some(match i.generics.span_for_param_suggestion() { + Some(span) => (span, format!(", {}", impl_args.join(", "))), + None => (i.generics.span, format!("<{}>", impl_args.join(", "))), + }); + } + } match self.angle_brackets { AngleBrackets::Missing | AngleBrackets::Implied => { let span = self.path_segment.ident.span; // insert a suggestion of the form "Y" - let sugg = format!("<{suggested_args}>"); - debug!("sugg: {:?}", sugg); - - err.span_suggestion_verbose( - span.shrink_to_hi(), - msg, - sugg, - Applicability::HasPlaceholders, - ); + let mut sugg = vec![(span.shrink_to_hi(), format!("<{suggested_args}>"))]; + if let Some(impl_sugg) = impl_sugg { + sugg.insert(0, impl_sugg); + } + debug!(?sugg); + err.multipart_suggestion(msg, sugg, Applicability::HasPlaceholders); } AngleBrackets::Available => { let gen_args_span = self.gen_args.span().unwrap(); @@ -755,10 +788,13 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> { let sugg_suffix = if is_first && !self.gen_args.constraints.is_empty() { ", " } else { "" }; - let sugg = format!("{sugg_prefix}{suggested_args}{sugg_suffix}"); - debug!("sugg: {:?}", sugg); - - err.span_suggestion_verbose(sugg_span, msg, sugg, Applicability::HasPlaceholders); + let mut sugg = + vec![(sugg_span, format!("{sugg_prefix}{suggested_args}{sugg_suffix}"))]; + if let Some(impl_sugg) = impl_sugg { + sugg.insert(0, impl_sugg); + } + debug!(?sugg); + err.multipart_suggestion(msg, sugg, Applicability::HasPlaceholders); } } } diff --git a/compiler/rustc_mir_build/src/builder/mod.rs b/compiler/rustc_mir_build/src/builder/mod.rs index 077cca785a2cc..4e97ddd991e2d 100644 --- a/compiler/rustc_mir_build/src/builder/mod.rs +++ b/compiler/rustc_mir_build/src/builder/mod.rs @@ -396,10 +396,6 @@ struct CFG<'tcx> { basic_blocks: IndexVec>, } -rustc_index::newtype_index! { - struct ScopeId {} -} - #[derive(Debug)] enum NeedsTemporary { /// Use this variant when whatever you are converting with `as_operand` diff --git a/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs b/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs index 10e2ba18f3d7c..86fd7ede4a170 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs @@ -32,8 +32,8 @@ use rustc_middle::ty::print::{ }; use rustc_middle::ty::transmute::{Answer, Reason}; use rustc_middle::ty::{ - self, GenericArgKind, GenericParamDefKind, TraitRef, Ty, TyCtxt, TypeFoldable, TypeFolder, - TypeSuperFoldable, TypeVisitableExt, Unnormalized, Upcast, + self, ConstKind, GenericArgKind, GenericParamDefKind, TraitRef, Ty, TyCtxt, TypeFoldable, + TypeFolder, TypeSuperFoldable, TypeVisitableExt, Unnormalized, Upcast, }; use rustc_span::def_id::CrateNum; use rustc_span::{BytePos, DUMMY_SP, STDLIB_STABLE_CRATES, Span, Symbol, bug, span_bug, sym}; @@ -872,6 +872,22 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { format!("the constant `{ct_str}` is not of type `{expected_ty_str}`"), ); diag.long_ty_path = long_ty_file; + if let ConstKind::Param(param_const) = ct.kind() { + for param in self + .tcx + .generics_of(obligation.cause.body_def_id.to_def_id()) + .own_params + .iter() + { + if let GenericParamDefKind::Const { .. } = param.kind + && param.index == param_const.index + && param.name == param_const.name + { + let span = self.tcx.def_span(param.def_id); + diag.span_label(span, format!("`{}` defined here", param.name)); + } + } + } self.note_type_err( &mut diag, diff --git a/library/alloc/src/vec/mod.rs b/library/alloc/src/vec/mod.rs index b9c28b217694f..99bdeea251bf4 100644 --- a/library/alloc/src/vec/mod.rs +++ b/library/alloc/src/vec/mod.rs @@ -2545,6 +2545,8 @@ impl Vec { /// consider using [`Vec::retain_mut`] instead. However, if no items are removed, then all items /// are left in their original positions. /// + /// Generally, this method is faster than [`Vec::retain_mut`] due to its weak ordering guarantees. + /// /// [`Vec::retain_mut`]: crate::vec::Vec::retain_mut /// /// Time complexity: *O*(*n*) diff --git a/src/doc/reference b/src/doc/reference index 3989fe91f1a60..a2ae66d7037cb 160000 --- a/src/doc/reference +++ b/src/doc/reference @@ -1 +1 @@ -Subproject commit 3989fe91f1a601b51684a582ad17b2503f221787 +Subproject commit a2ae66d7037cbedac68746b9510b24cc34b96d69 diff --git a/src/tools/enzyme b/src/tools/enzyme index 7a55d0364ca1e..ffd1ec24186c9 160000 --- a/src/tools/enzyme +++ b/src/tools/enzyme @@ -1 +1 @@ -Subproject commit 7a55d0364ca1e7cb3c797a9d38a6c52061edf02e +Subproject commit ffd1ec24186c9fd7029c6c9925066a1ae2763d6b diff --git a/tests/ui/associated-inherent-types/issue-109768.stderr b/tests/ui/associated-inherent-types/issue-109768.stderr index 59f8526a73e59..a41eb8ce4bc4d 100644 --- a/tests/ui/associated-inherent-types/issue-109768.stderr +++ b/tests/ui/associated-inherent-types/issue-109768.stderr @@ -17,8 +17,8 @@ LL | struct Local(T, U); | ^^^^^ - - help: add missing generic arguments | -LL | impl Local { - | ++++++ +LL | impl Local { + | +++ ++++++ error[E0658]: inherent associated types are unstable --> $DIR/issue-109768.rs:8:5 diff --git a/tests/ui/associated-types/associated-types-eq-2.stderr b/tests/ui/associated-types/associated-types-eq-2.stderr index fdcfb8cd53f98..8c9d5100bd6a6 100644 --- a/tests/ui/associated-types/associated-types-eq-2.stderr +++ b/tests/ui/associated-types/associated-types-eq-2.stderr @@ -89,8 +89,8 @@ LL | trait Tr2 { | ^^^ -- -- -- help: add missing generic arguments | -LL | impl Tr2 for Bar { - | ++++++++ +LL | impl Tr2 for Bar { + | ++++++++ ++++++++ error[E0229]: associated item constraints are not allowed here --> $DIR/associated-types-eq-2.rs:40:15 @@ -119,8 +119,8 @@ LL | trait Tr2 { | ^^^ -- -- -- help: add missing generic arguments | -LL | impl Tr2 for Qux { - | ++++++++ +LL | impl Tr2 for Qux { + | ++++++++ ++++++++ error[E0229]: associated item constraints are not allowed here --> $DIR/associated-types-eq-2.rs:47:15 @@ -149,8 +149,8 @@ LL | trait Tr2 { | ^^^ -- -- -- help: add missing generic arguments | -LL | impl Tr2 for Bar { - | ++++++++ +LL | impl Tr2 for Bar { + | ++++++++ ++++++++ error[E0229]: associated item constraints are not allowed here --> $DIR/associated-types-eq-2.rs:54:15 @@ -179,8 +179,8 @@ LL | trait Tr2 { | ^^^ -- -- -- help: add missing generic argument | -LL | impl Tr2> for Bar { - | ++++ +LL | impl Tr2> for Bar { + | ++++ ++++ error[E0229]: associated item constraints are not allowed here --> $DIR/associated-types-eq-2.rs:61:20 @@ -225,8 +225,8 @@ LL | trait Tr3 { | ^^^ ------------ -- -- help: add missing generic arguments | -LL | impl Tr3 for Qux { - | ++++++++++ +LL | impl Tr3 for Qux { + | ++++++++++++++++++++++ ++++++++++ error[E0229]: associated item constraints are not allowed here --> $DIR/associated-types-eq-2.rs:84:10 @@ -267,8 +267,8 @@ LL | trait Tr3 { | ^^^ ------------ -- -- help: add missing generic arguments | -LL | impl Tr3<42, T2, T3, T2 = 42, T3 = usize> for Bar { - | ++++++++ +LL | impl Tr3<42, T2, T3, T2 = 42, T3 = usize> for Bar { + | ++++++++ ++++++++ error[E0229]: associated item constraints are not allowed here --> $DIR/associated-types-eq-2.rs:98:14 @@ -295,8 +295,8 @@ LL | trait Tr3 { | ^^^ ------------ -- -- help: add missing generic arguments | -LL | impl Tr3 for Bar { - | ++++++++++ +LL | impl Tr3 for Bar { + | ++++++++++++++++++++++ ++++++++++ error[E0229]: associated item constraints are not allowed here --> $DIR/associated-types-eq-2.rs:106:10 diff --git a/tests/ui/checked-type-aliases/def-site-body-wf.stderr b/tests/ui/checked-type-aliases/def-site-body-wf.stderr index 99ebc95616816..bef47b92e9d17 100644 --- a/tests/ui/checked-type-aliases/def-site-body-wf.stderr +++ b/tests/ui/checked-type-aliases/def-site-body-wf.stderr @@ -20,10 +20,10 @@ note: required by an implicit `Sized` bound in `Vec` --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL error[E0491]: in type `&'static &'a ()`, reference has a longer lifetime than the data it references - --> $DIR/def-site-body-wf.rs:11:1 + --> $DIR/def-site-body-wf.rs:11:15 | LL | type _C<'a> = &'static &'a (); - | ^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^ | = note: the pointer is valid for the static lifetime note: but the referenced data is only valid for the lifetime `'a` as defined here diff --git a/tests/ui/checked-type-aliases/inherent-impls-overflow.current.stderr b/tests/ui/checked-type-aliases/inherent-impls-overflow.current.stderr index a4d208a8fc24c..28a62b39c7fdc 100644 --- a/tests/ui/checked-type-aliases/inherent-impls-overflow.current.stderr +++ b/tests/ui/checked-type-aliases/inherent-impls-overflow.current.stderr @@ -1,8 +1,8 @@ error[E0275]: overflow normalizing the type alias `Loop` - --> $DIR/inherent-impls-overflow.rs:8:1 + --> $DIR/inherent-impls-overflow.rs:8:13 | LL | type Loop = Loop; - | ^^^^^^^^^ + | ^^^^ | = note: in case this is a recursive type alias, consider using a struct, enum, or union instead @@ -15,18 +15,18 @@ LL | impl Loop {} = note: in case this is a recursive type alias, consider using a struct, enum, or union instead error[E0275]: overflow normalizing the type alias `Poly0<(((((((_,),),),),),),)>` - --> $DIR/inherent-impls-overflow.rs:17:1 + --> $DIR/inherent-impls-overflow.rs:17:17 | LL | type Poly0 = Poly1<(T,)>; - | ^^^^^^^^^^^^^ + | ^^^^^^^^^^^ | = note: in case this is a recursive type alias, consider using a struct, enum, or union instead error[E0275]: overflow normalizing the type alias `Poly1<(((((((_,),),),),),),)>` - --> $DIR/inherent-impls-overflow.rs:20:1 + --> $DIR/inherent-impls-overflow.rs:20:17 | LL | type Poly1 = Poly0<(T,)>; - | ^^^^^^^^^^^^^ + | ^^^^^^^^^^^ | = note: in case this is a recursive type alias, consider using a struct, enum, or union instead diff --git a/tests/ui/checked-type-aliases/inherent-impls-overflow.next.stderr b/tests/ui/checked-type-aliases/inherent-impls-overflow.next.stderr index dbd982ea94c36..31875a47a9b7d 100644 --- a/tests/ui/checked-type-aliases/inherent-impls-overflow.next.stderr +++ b/tests/ui/checked-type-aliases/inherent-impls-overflow.next.stderr @@ -1,8 +1,8 @@ error[E0275]: overflow evaluating the requirement `Loop == _` - --> $DIR/inherent-impls-overflow.rs:8:1 + --> $DIR/inherent-impls-overflow.rs:8:13 | LL | type Loop = Loop; - | ^^^^^^^^^ + | ^^^^ error[E0275]: overflow evaluating the requirement `Loop == _` --> $DIR/inherent-impls-overflow.rs:12:1 @@ -17,18 +17,18 @@ LL | impl Loop {} | ^^^^ error[E0275]: overflow evaluating the requirement `Poly1<(T,)> == _` - --> $DIR/inherent-impls-overflow.rs:17:1 + --> $DIR/inherent-impls-overflow.rs:17:17 | LL | type Poly0 = Poly1<(T,)>; - | ^^^^^^^^^^^^^ + | ^^^^^^^^^^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`inherent_impls_overflow`) error[E0275]: overflow evaluating the requirement `Poly0<(T,)> == _` - --> $DIR/inherent-impls-overflow.rs:20:1 + --> $DIR/inherent-impls-overflow.rs:20:17 | LL | type Poly1 = Poly0<(T,)>; - | ^^^^^^^^^^^^^ + | ^^^^^^^^^^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`inherent_impls_overflow`) diff --git a/tests/ui/checked-type-aliases/opaq-ty-collection-infinite-recur.stderr b/tests/ui/checked-type-aliases/opaq-ty-collection-infinite-recur.stderr index e93fcd03a9662..17f57d9778349 100644 --- a/tests/ui/checked-type-aliases/opaq-ty-collection-infinite-recur.stderr +++ b/tests/ui/checked-type-aliases/opaq-ty-collection-infinite-recur.stderr @@ -1,8 +1,8 @@ error[E0275]: overflow normalizing the type alias `Recur` - --> $DIR/opaq-ty-collection-infinite-recur.rs:16:20 + --> $DIR/opaq-ty-collection-infinite-recur.rs:16:33 | LL | struct Hold([(); { type Recur = Recur; 0 }]); - | ^^^^^^^^^^ + | ^^^^^ | = note: in case this is a recursive type alias, consider using a struct, enum, or union instead diff --git a/tests/ui/checked-type-aliases/recursive-type-alias-in-const-projection.stderr b/tests/ui/checked-type-aliases/recursive-type-alias-in-const-projection.stderr index 471fa8eb1fd67..1f21ad286f723 100644 --- a/tests/ui/checked-type-aliases/recursive-type-alias-in-const-projection.stderr +++ b/tests/ui/checked-type-aliases/recursive-type-alias-in-const-projection.stderr @@ -1,8 +1,8 @@ error[E0275]: overflow normalizing the type alias `Arr2` - --> $DIR/recursive-type-alias-in-const-projection.rs:12:1 + --> $DIR/recursive-type-alias-in-const-projection.rs:12:13 | LL | type Arr2 = [usize; ::ASSOC]; - | ^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: in case this is a recursive type alias, consider using a struct, enum, or union instead diff --git a/tests/ui/checked-type-aliases/unconstrained-params-in-impl-due-to-overflow.stderr b/tests/ui/checked-type-aliases/unconstrained-params-in-impl-due-to-overflow.stderr index d8270a0abddcd..bcffa02ddd424 100644 --- a/tests/ui/checked-type-aliases/unconstrained-params-in-impl-due-to-overflow.stderr +++ b/tests/ui/checked-type-aliases/unconstrained-params-in-impl-due-to-overflow.stderr @@ -5,10 +5,10 @@ LL | impl Loop {} | ^ unconstrained type parameter error[E0275]: overflow normalizing the type alias `Loop` - --> $DIR/unconstrained-params-in-impl-due-to-overflow.rs:6:1 + --> $DIR/unconstrained-params-in-impl-due-to-overflow.rs:6:16 | LL | type Loop = Loop; - | ^^^^^^^^^^^^ + | ^^^^^^^ | = note: in case this is a recursive type alias, consider using a struct, enum, or union instead diff --git a/tests/ui/checked-type-aliases/variance-overflow.stderr b/tests/ui/checked-type-aliases/variance-overflow.stderr index 3ea61d9ade9f3..a17d7e7119b60 100644 --- a/tests/ui/checked-type-aliases/variance-overflow.stderr +++ b/tests/ui/checked-type-aliases/variance-overflow.stderr @@ -16,18 +16,18 @@ LL | struct First(Second); = note: in case this is a recursive type alias, consider using a struct, enum, or union instead error[E0275]: overflow normalizing the type alias `Second` - --> $DIR/variance-overflow.rs:19:1 + --> $DIR/variance-overflow.rs:19:15 | LL | type Second = Second; // diverging free alias type - | ^^^^^^^^^^^ + | ^^^^^^ | = note: in case this is a recursive type alias, consider using a struct, enum, or union instead error[E0275]: overflow normalizing the type alias `Diverging<(((((((_,),),),),),),)>` - --> $DIR/variance-overflow.rs:26:1 + --> $DIR/variance-overflow.rs:26:21 | LL | type Diverging = Diverging<(T,)>; - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^ | = note: in case this is a recursive type alias, consider using a struct, enum, or union instead diff --git a/tests/ui/const-generics/associated-const-bindings/mismatched-types-with-generic-in-ace.stderr b/tests/ui/const-generics/associated-const-bindings/mismatched-types-with-generic-in-ace.stderr index 1eaa635e13532..8d49782e9645e 100644 --- a/tests/ui/const-generics/associated-const-bindings/mismatched-types-with-generic-in-ace.stderr +++ b/tests/ui/const-generics/associated-const-bindings/mismatched-types-with-generic-in-ace.stderr @@ -2,7 +2,9 @@ error: the constant `N` is not of type `u32` --> $DIR/mismatched-types-with-generic-in-ace.rs:15:29 | LL | fn bar = { N }>>() {} - | ^^^^^^^^^^^^^^^^ expected `u32`, found `u64` + | ------------ ^^^^^^^^^^^^^^^^ expected `u32`, found `u64` + | | + | `N` defined here | note: required by a const generic parameter in `Foo::ASSOC` --> $DIR/mismatched-types-with-generic-in-ace.rs:8:17 diff --git a/tests/ui/const-generics/associated-const-bindings/wf-mismatch-1.stderr b/tests/ui/const-generics/associated-const-bindings/wf-mismatch-1.stderr index f75f4a08969c8..a378f9bc5de68 100644 --- a/tests/ui/const-generics/associated-const-bindings/wf-mismatch-1.stderr +++ b/tests/ui/const-generics/associated-const-bindings/wf-mismatch-1.stderr @@ -2,7 +2,9 @@ error: the constant `N` is not of type `bool` --> $DIR/wf-mismatch-1.rs:12:34 | LL | fn f(_: impl Trait) {} - | ^^^^^^^^^^ expected `bool`, found `i32` + | ------------ ^^^^^^^^^^ expected `bool`, found `i32` + | | + | `N` defined here | note: required by a const generic parameter in `f` --> $DIR/wf-mismatch-1.rs:12:34 diff --git a/tests/ui/const-generics/associated-const-bindings/wf-mismatch-2.stderr b/tests/ui/const-generics/associated-const-bindings/wf-mismatch-2.stderr index c12b9fe78c049..14de0154a882b 100644 --- a/tests/ui/const-generics/associated-const-bindings/wf-mismatch-2.stderr +++ b/tests/ui/const-generics/associated-const-bindings/wf-mismatch-2.stderr @@ -1,6 +1,8 @@ error: the constant `N` is not of type `bool` --> $DIR/wf-mismatch-2.rs:13:12 | +LL | fn f() { + | ------------ `N` defined here LL | let _: dyn Trait; | ^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `i32` diff --git a/tests/ui/const-generics/bad-subst-const-kind.stderr b/tests/ui/const-generics/bad-subst-const-kind.stderr index b360526964255..e0053a18b0d84 100644 --- a/tests/ui/const-generics/bad-subst-const-kind.stderr +++ b/tests/ui/const-generics/bad-subst-const-kind.stderr @@ -2,7 +2,9 @@ error: the constant `N` is not of type `usize` --> $DIR/bad-subst-const-kind.rs:8:26 | LL | impl Q for [u8; N] { - | ^^^^^^^ expected `usize`, found `u64` + | ------------ ^^^^^^^ expected `usize`, found `u64` + | | + | `N` defined here | = note: the length of array `[u8; N]` must be type `usize` diff --git a/tests/ui/const-generics/check_const_arg_type_in_free_alias.checked.stderr b/tests/ui/const-generics/check_const_arg_type_in_free_alias.checked.stderr index 371657baa5e6f..37aae88388ab0 100644 --- a/tests/ui/const-generics/check_const_arg_type_in_free_alias.checked.stderr +++ b/tests/ui/const-generics/check_const_arg_type_in_free_alias.checked.stderr @@ -1,8 +1,10 @@ error: the constant `B` is not of type `usize` - --> $DIR/check_const_arg_type_in_free_alias.rs:14:1 + --> $DIR/check_const_arg_type_in_free_alias.rs:14:30 | LL | type ArrLen = [(); B]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `bool` + | ------------- ^^^^^^^ expected `usize`, found `bool` + | | + | `B` defined here | = note: the length of array `[(); B]` must be type `usize` @@ -15,10 +17,12 @@ LL | type AnonArrLen = [(); true]; = note: array length can only be `usize` error: the constant `B` is not of type `usize` - --> $DIR/check_const_arg_type_in_free_alias.rs:18:1 + --> $DIR/check_const_arg_type_in_free_alias.rs:18:32 | LL | type ConstArg = Foo; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `bool` + | ------------- ^^^^^^ expected `usize`, found `bool` + | | + | `B` defined here | note: required by a const generic parameter in `Foo` --> $DIR/check_const_arg_type_in_free_alias.rs:12:12 @@ -39,10 +43,12 @@ LL | struct Foo; | ^^^^^^^^^^^^^^ error: the constant `B` is not of type `usize` - --> $DIR/check_const_arg_type_in_free_alias.rs:31:1 + --> $DIR/check_const_arg_type_in_free_alias.rs:31:29 | LL | type Alias = <() as IdentityWithUnused>::This; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `bool` + | ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `bool` + | | + | `B` defined here | note: required for `()` to implement `IdentityWithUnused` --> $DIR/check_const_arg_type_in_free_alias.rs:27:25 @@ -59,10 +65,12 @@ LL | type AnonAlias = <() as IdentityWithUnused>::This; | ^^^^ expected `usize`, found `bool` error: the constant `B` is not of type `usize` - --> $DIR/check_const_arg_type_in_free_alias.rs:37:1 + --> $DIR/check_const_arg_type_in_free_alias.rs:37:31 | LL | type UseFree = Free; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `bool` + | ------------- ^^^^^^^ expected `usize`, found `bool` + | | + | `B` defined here | note: required by a bound on the type alias `Free` --> $DIR/check_const_arg_type_in_free_alias.rs:36:11 @@ -83,10 +91,12 @@ LL | type Free = [(); N]; | ^^^^^^^^^^^^^^ error: the constant `N` is not of type `bool` - --> $DIR/check_const_arg_type_in_free_alias.rs:50:1 + --> $DIR/check_const_arg_type_in_free_alias.rs:50:49 | LL | type UseFreeIndirectlyCorrect = UseFree; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `usize` + | -------------- ^^^^^^^^^^ expected `bool`, found `usize` + | | + | `N` defined here | note: required by a bound on the type alias `UseFree` --> $DIR/check_const_arg_type_in_free_alias.rs:37:14 @@ -107,10 +117,12 @@ LL | type UseFree = Free; | ^^^^^^^^^^^^^ error: the constant `B` is not of type `usize` - --> $DIR/check_const_arg_type_in_free_alias.rs:57:1 + --> $DIR/check_const_arg_type_in_free_alias.rs:57:35 | LL | type IndirectArr = Wrap>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `bool` + | ------------- ^^^^^^^^^^^^^^^^^^^ expected `usize`, found `bool` + | | + | `B` defined here | = note: the length of array `[(); B]` must be type `usize` @@ -123,10 +135,12 @@ LL | type AnonIndirectArr = Wrap>; = note: array length can only be `usize` error: the constant `B` is not of type `usize` - --> $DIR/check_const_arg_type_in_free_alias.rs:61:1 + --> $DIR/check_const_arg_type_in_free_alias.rs:61:40 | LL | type IndirectConstArg = Wrap>>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `bool` + | ------------- ^^^^^^^^^^^^^^^^^^ expected `usize`, found `bool` + | | + | `B` defined here | note: required by a const generic parameter in `Foo` --> $DIR/check_const_arg_type_in_free_alias.rs:12:12 diff --git a/tests/ui/const-generics/check_const_arg_type_in_free_alias.unchecked.stderr b/tests/ui/const-generics/check_const_arg_type_in_free_alias.unchecked.stderr index 2e12050cbd777..f6c8a06c4d416 100644 --- a/tests/ui/const-generics/check_const_arg_type_in_free_alias.unchecked.stderr +++ b/tests/ui/const-generics/check_const_arg_type_in_free_alias.unchecked.stderr @@ -1,16 +1,20 @@ error: the constant `B` is not of type `usize` - --> $DIR/check_const_arg_type_in_free_alias.rs:14:1 + --> $DIR/check_const_arg_type_in_free_alias.rs:14:30 | LL | type ArrLen = [(); B]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `bool` + | ------------- ^^^^^^^ expected `usize`, found `bool` + | | + | `B` defined here | = note: the length of array `[(); B]` must be type `usize` error: the constant `B` is not of type `usize` - --> $DIR/check_const_arg_type_in_free_alias.rs:18:1 + --> $DIR/check_const_arg_type_in_free_alias.rs:18:32 | LL | type ConstArg = Foo; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `bool` + | ------------- ^^^^^^ expected `usize`, found `bool` + | | + | `B` defined here | note: required by a const generic parameter in `Foo` --> $DIR/check_const_arg_type_in_free_alias.rs:12:12 @@ -19,10 +23,12 @@ LL | struct Foo; | ^^^^^^^^^^^^^^ required by this const generic parameter in `Foo` error: the constant `B` is not of type `usize` - --> $DIR/check_const_arg_type_in_free_alias.rs:31:1 + --> $DIR/check_const_arg_type_in_free_alias.rs:31:29 | LL | type Alias = <() as IdentityWithUnused>::This; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `bool` + | ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `bool` + | | + | `B` defined here | note: required by a const generic parameter in `IdentityWithUnused` --> $DIR/check_const_arg_type_in_free_alias.rs:23:26 @@ -31,26 +37,32 @@ LL | trait IdentityWithUnused { | ^^^^^^^^^^^^^^ required by this const generic parameter in `IdentityWithUnused` error: the constant `B` is not of type `usize` - --> $DIR/check_const_arg_type_in_free_alias.rs:37:1 + --> $DIR/check_const_arg_type_in_free_alias.rs:37:31 | LL | type UseFree = Free; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `bool` + | ------------- ^^^^^^^ expected `usize`, found `bool` + | | + | `B` defined here | = note: the length of array `[(); B]` must be type `usize` error: the constant `B` is not of type `usize` - --> $DIR/check_const_arg_type_in_free_alias.rs:57:1 + --> $DIR/check_const_arg_type_in_free_alias.rs:57:35 | LL | type IndirectArr = Wrap>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `bool` + | ------------- ^^^^^^^^^^^^^^^^^^^ expected `usize`, found `bool` + | | + | `B` defined here | = note: the length of array `[(); B]` must be type `usize` error: the constant `B` is not of type `usize` - --> $DIR/check_const_arg_type_in_free_alias.rs:61:1 + --> $DIR/check_const_arg_type_in_free_alias.rs:61:40 | LL | type IndirectConstArg = Wrap>>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `bool` + | ------------- ^^^^^^^^^^^^^^^^^^ expected `usize`, found `bool` + | | + | `B` defined here | note: required by a const generic parameter in `Foo` --> $DIR/check_const_arg_type_in_free_alias.rs:12:12 diff --git a/tests/ui/const-generics/check_const_arg_type_in_trait_object.stderr b/tests/ui/const-generics/check_const_arg_type_in_trait_object.stderr index 4e228f65ab6df..272f5a0dd4541 100644 --- a/tests/ui/const-generics/check_const_arg_type_in_trait_object.stderr +++ b/tests/ui/const-generics/check_const_arg_type_in_trait_object.stderr @@ -7,6 +7,8 @@ LL | anon: &dyn Object, error: the constant `B` is not of type `usize` --> $DIR/check_const_arg_type_in_trait_object.rs:16:12 | +LL | fn arg( + | ------------- `B` defined here LL | param: &dyn Object, | ^^^^^^^^^^^^^^ expected `usize`, found `bool` | @@ -27,6 +29,8 @@ LL | anon: &dyn Object2>, error: the constant `B` is not of type `usize` --> $DIR/check_const_arg_type_in_trait_object.rs:24:12 | +LL | fn indirect( + | ------------- `B` defined here LL | param: &dyn Object2>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `bool` | @@ -36,7 +40,9 @@ error: the constant `B` is not of type `usize` --> $DIR/check_const_arg_type_in_trait_object.rs:33:33 | LL | fn binder(param: &dyn for<'a> Object3<'a, B>) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `bool` + | ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `bool` + | | + | `B` defined here | note: required by a const generic parameter in `Object3` --> $DIR/check_const_arg_type_in_trait_object.rs:11:28 diff --git a/tests/ui/const-generics/defaults/concrete-const-param-type.stderr b/tests/ui/const-generics/defaults/concrete-const-param-type.stderr index 805d5a1e91fb4..71d07980d948d 100644 --- a/tests/ui/const-generics/defaults/concrete-const-param-type.stderr +++ b/tests/ui/const-generics/defaults/concrete-const-param-type.stderr @@ -2,7 +2,9 @@ error: the constant `N` is not of type `u64` --> $DIR/concrete-const-param-type.rs:7:26 | LL | struct Foo; - | ^^^^^^^^^^^^^^^^ expected `u64`, found `u32` + | ------------ ^^^^^^^^^^^^^^^^ expected `u64`, found `u32` + | | + | `N` defined here error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/dyn-trait-ill-typed.stderr b/tests/ui/const-generics/dyn-trait-ill-typed.stderr index 8917b53d4d826..94a6ebc981049 100644 --- a/tests/ui/const-generics/dyn-trait-ill-typed.stderr +++ b/tests/ui/const-generics/dyn-trait-ill-typed.stderr @@ -2,7 +2,9 @@ error: the constant `M` is not of type `usize` --> $DIR/dyn-trait-ill-typed.rs:9:27 | LL | fn foo() -> Box> { - | ^^^^^^^^^^^^^^ expected `usize`, found `u32` + | ------------ ^^^^^^^^^^^^^^ expected `usize`, found `u32` + | | + | `M` defined here | note: required by a const generic parameter in `Tr` --> $DIR/dyn-trait-ill-typed.rs:13:10 diff --git a/tests/ui/const-generics/generic_const_exprs/type_mismatch.stderr b/tests/ui/const-generics/generic_const_exprs/type_mismatch.stderr index 3b4b5798c805e..5d6c06f3474be 100644 --- a/tests/ui/const-generics/generic_const_exprs/type_mismatch.stderr +++ b/tests/ui/const-generics/generic_const_exprs/type_mismatch.stderr @@ -11,7 +11,9 @@ error: the constant `N` is not of type `usize` --> $DIR/type_mismatch.rs:8:26 | LL | impl Q for [u8; N] {} - | ^^^^^^^ expected `usize`, found `u64` + | ------------ ^^^^^^^ expected `usize`, found `u64` + | | + | `N` defined here | = note: the length of array `[u8; N]` must be type `usize` diff --git a/tests/ui/const-generics/impl-block-missing-const-generics.rs b/tests/ui/const-generics/impl-block-missing-const-generics.rs new file mode 100644 index 0000000000000..1f370d9c0136b --- /dev/null +++ b/tests/ui/const-generics/impl-block-missing-const-generics.rs @@ -0,0 +1,75 @@ +// Ensure that `impl` blocks with different mistakes regarding const parameters are properly +// handled. Issue #91119. +mod a { + struct Foo{} + + impl Foo {} //~ ERROR: missing generics for struct `a::Foo` +} + +mod b { + struct Foo{} + + impl Foo {} //~ ERROR: cannot find const `AHA` in this scope +} + +mod c { + struct Foo{} + + impl Foo {} //~ ERROR: type provided when a constant was expected +} + +mod d { + struct Foo{} + + impl Foo<{ AHA }> {} //~ ERROR: cannot find value `AHA` in this scope +} + +mod e { + struct Foo{} + + impl Foo {} //~ ERROR: the constant `AHA` is not of type `usize` +} + +mod f { + struct Foo{} + trait T {} + + impl T for Foo {} //~ ERROR: missing generics for struct `f::Foo` +} + +mod g { + struct Foo {} + trait T {} + + impl T for Foo {} //~ ERROR: missing generics for trait `g::T` +} + +mod h { + struct Foo {} + trait T {} + + impl T for Foo {} //~ ERROR: cannot find type `AHA` in this scope +} + +mod i { + struct Foo {} + trait T {} + + impl T for Foo {} //~ ERROR: type provided when a constant was expected +} + +mod j { + struct Foo {} + trait T {} + + impl T<{ AHA }> for Foo {} //~ ERROR: cannot find value `AHA` in this scope +} + +mod k { + struct Foo {} + trait T {} + + impl T for Foo {} //~ ERROR: the constant `AHA` is not of type `usize` +} + +fn main() {} diff --git a/tests/ui/const-generics/impl-block-missing-const-generics.stderr b/tests/ui/const-generics/impl-block-missing-const-generics.stderr new file mode 100644 index 0000000000000..5b5e93d1229e4 --- /dev/null +++ b/tests/ui/const-generics/impl-block-missing-const-generics.stderr @@ -0,0 +1,151 @@ +error[E0425]: cannot find const `AHA` in this scope + --> $DIR/impl-block-missing-const-generics.rs:12:14 + | +LL | struct Foo{} + | ---------------- corresponding const parameter on the type defined here +LL | +LL | impl Foo {} + | ^^^ not found in this scope + | +help: you might have meant to introduce a const parameter `AHA` on the impl + | +LL | impl Foo {} + | ++++++++++++++++++ + +error[E0425]: cannot find value `AHA` in this scope + --> $DIR/impl-block-missing-const-generics.rs:24:16 + | +LL | impl Foo<{ AHA }> {} + | ^^^ not found in this scope + | +help: you might be missing a const parameter + | +LL | impl Foo<{ AHA }> {} + | +++++++++++++++++++++++ + +error[E0425]: cannot find type `AHA` in this scope + --> $DIR/impl-block-missing-const-generics.rs:51:12 + | +LL | impl T for Foo {} + | ^^^ not found in this scope + | +help: you might be missing a type parameter + | +LL | impl T for Foo {} + | +++++ + +error[E0425]: cannot find value `AHA` in this scope + --> $DIR/impl-block-missing-const-generics.rs:65:14 + | +LL | impl T<{ AHA }> for Foo {} + | ^^^ not found in this scope + | +help: you might be missing a const parameter + | +LL | impl T<{ AHA }> for Foo {} + | +++++++++++++++++++++++ + +error[E0107]: missing generics for struct `a::Foo` + --> $DIR/impl-block-missing-const-generics.rs:6:10 + | +LL | impl Foo {} + | ^^^ expected 1 generic argument + | +note: struct defined here, with 1 generic parameter: `AHA` + --> $DIR/impl-block-missing-const-generics.rs:4:12 + | +LL | struct Foo{} + | ^^^ ---------------- +help: add missing generic argument + | +LL | impl Foo {} + | ++++++++++++++++++ +++++ + +error[E0747]: type provided when a constant was expected + --> $DIR/impl-block-missing-const-generics.rs:18:19 + | +LL | impl Foo {} + | ^^^ + | +help: consider changing this type parameter to a const parameter + | +LL - impl Foo {} +LL + impl Foo {} + | + +error: the constant `AHA` is not of type `usize` + --> $DIR/impl-block-missing-const-generics.rs:30:26 + | +LL | impl Foo {} + | -------------- ^^^^^^^^ expected `usize`, found `u32` + | | + | `AHA` defined here + | +note: required by a const generic parameter in `e::Foo` + --> $DIR/impl-block-missing-const-generics.rs:28:16 + | +LL | struct Foo{} + | ^^^^^^^^^^^^^^^^ required by this const generic parameter in `Foo` + +error[E0107]: missing generics for struct `f::Foo` + --> $DIR/impl-block-missing-const-generics.rs:37:16 + | +LL | impl T for Foo {} + | ^^^ expected 1 generic argument + | +note: struct defined here, with 1 generic parameter: `AHA` + --> $DIR/impl-block-missing-const-generics.rs:34:12 + | +LL | struct Foo{} + | ^^^ ---------------- +help: add missing generic argument + | +LL | impl T for Foo {} + | ++++++++++++++++++ +++++ + +error[E0107]: missing generics for trait `g::T` + --> $DIR/impl-block-missing-const-generics.rs:44:10 + | +LL | impl T for Foo {} + | ^ expected 1 generic argument + | +note: trait defined here, with 1 generic parameter: `AHA` + --> $DIR/impl-block-missing-const-generics.rs:42:11 + | +LL | trait T {} + | ^ ---------------- +help: add missing generic argument + | +LL | impl T for Foo {} + | ++++++++++++++++++ +++++ + +error[E0747]: type provided when a constant was expected + --> $DIR/impl-block-missing-const-generics.rs:58:17 + | +LL | impl T for Foo {} + | ^^^ + | +help: consider changing this type parameter to a const parameter + | +LL - impl T for Foo {} +LL + impl T for Foo {} + | + +error: the constant `AHA` is not of type `usize` + --> $DIR/impl-block-missing-const-generics.rs:72:26 + | +LL | impl T for Foo {} + | -------------- ^^^^^^ expected `usize`, found `u32` + | | + | `AHA` defined here + | +note: required by a const generic parameter in `k::T` + --> $DIR/impl-block-missing-const-generics.rs:70:13 + | +LL | trait T {} + | ^^^^^^^^^^^^^^^^ required by this const generic parameter in `T` + +error: aborting due to 11 previous errors + +Some errors have detailed explanations: E0107, E0425, E0747. +For more information about an error, try `rustc --explain E0107`. diff --git a/tests/ui/const-generics/issues/index_array_bad_type.stderr b/tests/ui/const-generics/issues/index_array_bad_type.stderr index ceea097337764..3c6dd4e456a1b 100644 --- a/tests/ui/const-generics/issues/index_array_bad_type.stderr +++ b/tests/ui/const-generics/issues/index_array_bad_type.stderr @@ -2,7 +2,9 @@ error: the constant `N` is not of type `usize` --> $DIR/index_array_bad_type.rs:1:34 | LL | struct Struct(pub [u8; N]); - | ^^^^^^^ expected `usize`, found `i128` + | ------------- ^^^^^^^ expected `usize`, found `i128` + | | + | `N` defined here | = note: the length of array `[u8; N]` must be type `usize` diff --git a/tests/ui/const-generics/mgca/adt_expr_arg_tuple_expr_fail.stderr b/tests/ui/const-generics/mgca/adt_expr_arg_tuple_expr_fail.stderr index 2e06d4f2ce058..f9284614aaedd 100644 --- a/tests/ui/const-generics/mgca/adt_expr_arg_tuple_expr_fail.stderr +++ b/tests/ui/const-generics/mgca/adt_expr_arg_tuple_expr_fail.stderr @@ -1,12 +1,17 @@ error: the constant `N` is not of type `u32` --> $DIR/adt_expr_arg_tuple_expr_fail.rs:18:21 | +LL | fn generic_caller() { + | -------------- `N` defined here LL | takes_tuple::<{ (N, N2) }>(); | ^^^^^^^ expected `u32`, found `usize` error: the constant `N` is not of type `u32` --> $DIR/adt_expr_arg_tuple_expr_fail.rs:20:21 | +LL | fn generic_caller() { + | -------------- `N` defined here +... LL | takes_tuple::<{ (N, T::ASSOC) }>(); | ^^^^^^^^^^^^^ expected `u32`, found `usize` @@ -19,12 +24,18 @@ LL | takes_tuple::<{ (N, T::ASSOC) }>(); error: the constant `N` is not of type `u32` --> $DIR/adt_expr_arg_tuple_expr_fail.rs:24:28 | +LL | fn generic_caller() { + | -------------- `N` defined here +... LL | takes_nested_tuple::<{ (N, (N, N2)) }>(); | ^^^^^^^^^^^^ expected `u32`, found `usize` error: the constant `N` is not of type `u32` --> $DIR/adt_expr_arg_tuple_expr_fail.rs:26:28 | +LL | fn generic_caller() { + | -------------- `N` defined here +... LL | takes_nested_tuple::<{ (N, (N, T::ASSOC)) }>(); | ^^^^^^^^^^^^^^^^^^ expected `u32`, found `usize` diff --git a/tests/ui/const-generics/mgca/adt_expr_fields_type_check.stderr b/tests/ui/const-generics/mgca/adt_expr_fields_type_check.stderr index dea156db19c14..619c735c64dcc 100644 --- a/tests/ui/const-generics/mgca/adt_expr_fields_type_check.stderr +++ b/tests/ui/const-generics/mgca/adt_expr_fields_type_check.stderr @@ -1,36 +1,52 @@ error: the constant `N` is not of type `u8` --> $DIR/adt_expr_fields_type_check.rs:23:19 | +LL | fn bar() { + | ------------- `N` defined here LL | accepts_1::<{ S1:: { f1: N, f2: N } }>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u8`, found `bool` error: the constant `N` is not of type `isize` --> $DIR/adt_expr_fields_type_check.rs:23:19 | +LL | fn bar() { + | ------------- `N` defined here LL | accepts_1::<{ S1:: { f1: N, f2: N } }>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `isize`, found `bool` error: the constant `N` is not of type `u8` --> $DIR/adt_expr_fields_type_check.rs:26:19 | +LL | fn bar() { + | ------------- `N` defined here +... LL | accepts_2::<{ S2::(N, N) }>(); | ^^^^^^^^^^^^^^ expected `u8`, found `bool` error: the constant `N` is not of type `isize` --> $DIR/adt_expr_fields_type_check.rs:26:19 | +LL | fn bar() { + | ------------- `N` defined here +... LL | accepts_2::<{ S2::(N, N) }>(); | ^^^^^^^^^^^^^^ expected `isize`, found `bool` error: the constant `N` is not of type `u8` --> $DIR/adt_expr_fields_type_check.rs:29:19 | +LL | fn bar() { + | ------------- `N` defined here +... LL | accepts_3::<{ En::Var1::(N, N) }>(); | ^^^^^^^^^^^^^^^^^^^^ expected `u8`, found `bool` error: the constant `N` is not of type `i64` --> $DIR/adt_expr_fields_type_check.rs:31:19 | +LL | fn bar() { + | ------------- `N` defined here +... LL | accepts_3::<{ En::Var2:: { field: N } }>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i64`, found `bool` diff --git a/tests/ui/const-generics/mgca/const-arg-coherence-conflicting-methods.stderr b/tests/ui/const-generics/mgca/const-arg-coherence-conflicting-methods.stderr index c82f8a96167ba..6911933cd005e 100644 --- a/tests/ui/const-generics/mgca/const-arg-coherence-conflicting-methods.stderr +++ b/tests/ui/const-generics/mgca/const-arg-coherence-conflicting-methods.stderr @@ -11,8 +11,8 @@ LL | pub struct A {} | ^ -------------- help: add missing generic argument | -LL | impl A { - | +++ +LL | impl A { + | ++++++++++++++++ +++ error[E0592]: duplicate definitions with name `fun1` --> $DIR/const-arg-coherence-conflicting-methods.rs:11:5 diff --git a/tests/ui/const-generics/transmute-fail.stderr b/tests/ui/const-generics/transmute-fail.stderr index 953119a8c3413..31e4fea37e76b 100644 --- a/tests/ui/const-generics/transmute-fail.stderr +++ b/tests/ui/const-generics/transmute-fail.stderr @@ -2,13 +2,16 @@ error: the constant `W` is not of type `usize` --> $DIR/transmute-fail.rs:16:42 | LL | fn bar(v: [[u32; H]; W]) -> [[u32; W]; H] { - | ^^^^^^^^^^^^^ expected `usize`, found `bool` + | ------------- `W` defined here ^^^^^^^^^^^^^ expected `usize`, found `bool` | = note: the length of array `[[u32; H]; W]` must be type `usize` error: the constant `W` is not of type `usize` --> $DIR/transmute-fail.rs:19:9 | +LL | fn bar(v: [[u32; H]; W]) -> [[u32; W]; H] { + | ------------- `W` defined here +... LL | std::mem::transmute(v) | ^^^^^^^^^^^^^^^^^^^ expected `usize`, found `bool` | diff --git a/tests/ui/const-generics/type-mismatch-in-nested-goal.current.stderr b/tests/ui/const-generics/type-mismatch-in-nested-goal.current.stderr index c6fb07926c802..4202ed35383f6 100644 --- a/tests/ui/const-generics/type-mismatch-in-nested-goal.current.stderr +++ b/tests/ui/const-generics/type-mismatch-in-nested-goal.current.stderr @@ -2,7 +2,7 @@ error: the constant `N` is not of type `bool` --> $DIR/type-mismatch-in-nested-goal.rs:9:50 | LL | fn needs_a(_: [u8; N]) where (): A {} - | ^^^^ expected `bool`, found `usize` + | -------------- `N` defined here ^^^^ expected `bool`, found `usize` | note: required by a const generic parameter in `A` --> $DIR/type-mismatch-in-nested-goal.rs:5:9 diff --git a/tests/ui/const-generics/type-mismatch-in-nested-goal.next.stderr b/tests/ui/const-generics/type-mismatch-in-nested-goal.next.stderr index c6fb07926c802..4202ed35383f6 100644 --- a/tests/ui/const-generics/type-mismatch-in-nested-goal.next.stderr +++ b/tests/ui/const-generics/type-mismatch-in-nested-goal.next.stderr @@ -2,7 +2,7 @@ error: the constant `N` is not of type `bool` --> $DIR/type-mismatch-in-nested-goal.rs:9:50 | LL | fn needs_a(_: [u8; N]) where (): A {} - | ^^^^ expected `bool`, found `usize` + | -------------- `N` defined here ^^^^ expected `bool`, found `usize` | note: required by a const generic parameter in `A` --> $DIR/type-mismatch-in-nested-goal.rs:5:9 diff --git a/tests/ui/const-generics/type_mismatch.stderr b/tests/ui/const-generics/type_mismatch.stderr index bd169ed2ec8f5..ee10c2075c39a 100644 --- a/tests/ui/const-generics/type_mismatch.stderr +++ b/tests/ui/const-generics/type_mismatch.stderr @@ -2,13 +2,17 @@ error: the constant `N` is not of type `usize` --> $DIR/type_mismatch.rs:6:26 | LL | fn bar() -> [u8; N] {} - | ^^^^^^^ expected `usize`, found `u8` + | ----------- ^^^^^^^ expected `usize`, found `u8` + | | + | `N` defined here | = note: the length of array `[u8; N]` must be type `usize` error: the constant `N` is not of type `u8` --> $DIR/type_mismatch.rs:2:11 | +LL | fn foo() -> [u8; N] { + | -------------- `N` defined here LL | bar::() | ^ expected `u8`, found `usize` | diff --git a/tests/ui/consts/bad-array-size-in-type-err.stderr b/tests/ui/consts/bad-array-size-in-type-err.stderr index 13b0b6c4f4a65..a5782306bf610 100644 --- a/tests/ui/consts/bad-array-size-in-type-err.stderr +++ b/tests/ui/consts/bad-array-size-in-type-err.stderr @@ -1,6 +1,8 @@ error: the constant `N` is not of type `usize` --> $DIR/bad-array-size-in-type-err.rs:2:10 | +LL | struct BadArraySize { + | ----------- `N` defined here LL | arr: [i32; N], | ^^^^^^^^ expected `usize`, found `u8` | @@ -10,7 +12,9 @@ error: the constant `N` is not of type `usize` --> $DIR/bad-array-size-in-type-err.rs:19:32 | LL | pub struct Blorb([String; N]); - | ^^^^^^^^^^^ expected `usize`, found `u16` + | ------------ ^^^^^^^^^^^ expected `usize`, found `u16` + | | + | `N` defined here | = note: the length of array `[String; N]` must be type `usize` diff --git a/tests/ui/delegation/ice-issue-150673.stderr b/tests/ui/delegation/ice-issue-150673.stderr index 808e8e84a61e0..0a2992792083a 100644 --- a/tests/ui/delegation/ice-issue-150673.stderr +++ b/tests/ui/delegation/ice-issue-150673.stderr @@ -11,8 +11,8 @@ LL | struct S(T); | ^ - help: add missing generic argument | -LL | impl Trait for S { - | +++ +LL | impl Trait for S { + | +++ +++ error: aborting due to 1 previous error diff --git a/tests/ui/delegation/recursive-delegation-ice-150152.stderr b/tests/ui/delegation/recursive-delegation-ice-150152.stderr index b59b588f4968a..fe887f4af5082 100644 --- a/tests/ui/delegation/recursive-delegation-ice-150152.stderr +++ b/tests/ui/delegation/recursive-delegation-ice-150152.stderr @@ -65,8 +65,8 @@ LL | struct S< S >; | ^ - help: add missing generic argument | -LL | impl Item for S> { - | +++ +LL | impl Item for S> { + | +++ +++ error: aborting due to 6 previous errors diff --git a/tests/ui/generics/impl-block-params-declared-in-wrong-spot-issue-113073.stderr b/tests/ui/generics/impl-block-params-declared-in-wrong-spot-issue-113073.stderr index 33d0c9c970795..253d7c1226a48 100644 --- a/tests/ui/generics/impl-block-params-declared-in-wrong-spot-issue-113073.stderr +++ b/tests/ui/generics/impl-block-params-declared-in-wrong-spot-issue-113073.stderr @@ -84,8 +84,8 @@ LL | trait Bar {} | ^^^ - - help: add missing generic argument | -LL | impl Bar for u8 {} - | +++ +LL | impl Bar for u8 {} + | +++ +++ error[E0229]: associated item constraints are not allowed here --> $DIR/impl-block-params-declared-in-wrong-spot-issue-113073.rs:27:16 diff --git a/tests/ui/infinite/infinite-type-alias-mutual-recursion.feature_new.stderr b/tests/ui/infinite/infinite-type-alias-mutual-recursion.feature_new.stderr index 8375055929ce8..2b3d28cbdcab0 100644 --- a/tests/ui/infinite/infinite-type-alias-mutual-recursion.feature_new.stderr +++ b/tests/ui/infinite/infinite-type-alias-mutual-recursion.feature_new.stderr @@ -1,20 +1,20 @@ error[E0275]: overflow evaluating the requirement `X2 == _` - --> $DIR/infinite-type-alias-mutual-recursion.rs:12:1 + --> $DIR/infinite-type-alias-mutual-recursion.rs:12:11 | LL | type X1 = X2; - | ^^^^^^^ + | ^^ error[E0275]: overflow evaluating the requirement `X3 == _` - --> $DIR/infinite-type-alias-mutual-recursion.rs:16:1 + --> $DIR/infinite-type-alias-mutual-recursion.rs:16:11 | LL | type X2 = X3; - | ^^^^^^^ + | ^^ error[E0275]: overflow evaluating the requirement `X1 == _` - --> $DIR/infinite-type-alias-mutual-recursion.rs:19:1 + --> $DIR/infinite-type-alias-mutual-recursion.rs:19:11 | LL | type X3 = X1; - | ^^^^^^^ + | ^^ error: aborting due to 3 previous errors diff --git a/tests/ui/infinite/infinite-type-alias-mutual-recursion.feature_old.stderr b/tests/ui/infinite/infinite-type-alias-mutual-recursion.feature_old.stderr index c7adc3af02fab..717b13aa1a85a 100644 --- a/tests/ui/infinite/infinite-type-alias-mutual-recursion.feature_old.stderr +++ b/tests/ui/infinite/infinite-type-alias-mutual-recursion.feature_old.stderr @@ -1,24 +1,24 @@ error[E0275]: overflow normalizing the type alias `X2` - --> $DIR/infinite-type-alias-mutual-recursion.rs:12:1 + --> $DIR/infinite-type-alias-mutual-recursion.rs:12:11 | LL | type X1 = X2; - | ^^^^^^^ + | ^^ | = note: in case this is a recursive type alias, consider using a struct, enum, or union instead error[E0275]: overflow normalizing the type alias `X3` - --> $DIR/infinite-type-alias-mutual-recursion.rs:16:1 + --> $DIR/infinite-type-alias-mutual-recursion.rs:16:11 | LL | type X2 = X3; - | ^^^^^^^ + | ^^ | = note: in case this is a recursive type alias, consider using a struct, enum, or union instead error[E0275]: overflow normalizing the type alias `X1` - --> $DIR/infinite-type-alias-mutual-recursion.rs:19:1 + --> $DIR/infinite-type-alias-mutual-recursion.rs:19:11 | LL | type X3 = X1; - | ^^^^^^^ + | ^^ | = note: in case this is a recursive type alias, consider using a struct, enum, or union instead diff --git a/tests/ui/infinite/infinite-vec-type-recursion.feature.stderr b/tests/ui/infinite/infinite-vec-type-recursion.feature.stderr index 3e07a46ea2684..5c8d50341c164 100644 --- a/tests/ui/infinite/infinite-vec-type-recursion.feature.stderr +++ b/tests/ui/infinite/infinite-vec-type-recursion.feature.stderr @@ -1,8 +1,8 @@ error[E0275]: overflow normalizing the type alias `X` - --> $DIR/infinite-vec-type-recursion.rs:6:1 + --> $DIR/infinite-vec-type-recursion.rs:6:10 | LL | type X = Vec; - | ^^^^^^ + | ^^^^^^ | = note: in case this is a recursive type alias, consider using a struct, enum, or union instead diff --git a/tests/ui/reborrow/invalid-coerce-shared-next-solver.stderr b/tests/ui/reborrow/invalid-coerce-shared-next-solver.stderr index cec4602ecc37f..e6be2b474573c 100644 --- a/tests/ui/reborrow/invalid-coerce-shared-next-solver.stderr +++ b/tests/ui/reborrow/invalid-coerce-shared-next-solver.stderr @@ -28,8 +28,8 @@ LL | impl<'a, T> CoerceShared for CustomMut<'reborrow, T> {} | help: add missing generic argument | -LL | impl<'a, T> CoerceShared for CustomMut<'reborrow, T> {} - | ++++++++ +LL | impl<'a, T, Target> CoerceShared for CustomMut<'reborrow, T> {} + | ++++++++ ++++++++ error[E0377]: the trait `CoerceShared` may only be implemented for a coercion between structures --> $DIR/invalid-coerce-shared-next-solver.rs:11:1 diff --git a/tests/ui/reborrow/invalid-reborrow-impl-phantom-data-wrong-generics.stderr b/tests/ui/reborrow/invalid-reborrow-impl-phantom-data-wrong-generics.stderr index 9f9bd5008c81e..eafb7341ea712 100644 --- a/tests/ui/reborrow/invalid-reborrow-impl-phantom-data-wrong-generics.stderr +++ b/tests/ui/reborrow/invalid-reborrow-impl-phantom-data-wrong-generics.stderr @@ -14,8 +14,8 @@ LL | impl<'a> Reborrow for PhantomData<'a> {} | help: add missing generic argument | -LL | impl<'a> Reborrow for PhantomData<'a, T> {} - | +++ +LL | impl<'a, T> Reborrow for PhantomData<'a, T> {} + | +++ +++ error: implementing `Reborrow` requires exactly one lifetime argument in the reborrowed type --> $DIR/invalid-reborrow-impl-phantom-data-wrong-generics.rs:9:1 diff --git a/tests/ui/specialization/default-proj-ty-as-type-of-const-issue-125757.stderr b/tests/ui/specialization/default-proj-ty-as-type-of-const-issue-125757.stderr index 8df76b296acd6..12008e0c1bc16 100644 --- a/tests/ui/specialization/default-proj-ty-as-type-of-const-issue-125757.stderr +++ b/tests/ui/specialization/default-proj-ty-as-type-of-const-issue-125757.stderr @@ -10,7 +10,9 @@ error: the constant `C` is not of type `::Type` --> $DIR/default-proj-ty-as-type-of-const-issue-125757.rs:15:22 | LL | impl Wrapper {} - | ^^^^^^^^^^ expected associated type, found `usize` + | -------------- ^^^^^^^^^^ expected associated type, found `usize` + | | + | `C` defined here | = help: consider constraining the associated type `::Type` to `usize` = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html diff --git a/tests/ui/structs/default-field-values-non_exhaustive.rs b/tests/ui/structs/default-field-values-non_exhaustive.rs index 0ad2b0766a772..32631de4e359f 100644 --- a/tests/ui/structs/default-field-values-non_exhaustive.rs +++ b/tests/ui/structs/default-field-values-non_exhaustive.rs @@ -1,18 +1,29 @@ #![feature(default_field_values)] #[derive(Default)] -#[non_exhaustive] //~ ERROR `#[non_exhaustive]` can't be used to annotate items with default field values -struct Foo { - x: i32 = 42 + 3, +#[non_exhaustive] +//~^ ERROR `#[non_exhaustive]` can't be used to annotate structs with default field values +struct Struct { + field: i32 = 42 + 3, +} + +enum Enum { + #[non_exhaustive] + //~^ ERROR `#[non_exhaustive]` can't be used to annotate structs with default field values + Variant { + field: i32 = 24, + } } #[derive(Default)] -enum Bar { +enum EnumWithDefault { #[non_exhaustive] + //~^ ERROR `#[non_exhaustive]` can't be used to annotate structs with default field values #[default] - Baz { //~ ERROR default variant must be exhaustive - x: i32 = 42 + 3, + Variant { //~ ERROR default variant must be exhaustive + field: i32 = 42 + 3, } } + fn main () {} diff --git a/tests/ui/structs/default-field-values-non_exhaustive.stderr b/tests/ui/structs/default-field-values-non_exhaustive.stderr index 13013bebe83d9..c7736f5bbafbf 100644 --- a/tests/ui/structs/default-field-values-non_exhaustive.stderr +++ b/tests/ui/structs/default-field-values-non_exhaustive.stderr @@ -1,23 +1,46 @@ error: default variant must be exhaustive - --> $DIR/default-field-values-non_exhaustive.rs:13:5 + --> $DIR/default-field-values-non_exhaustive.rs:23:5 | LL | #[non_exhaustive] | ----------------- declared `#[non_exhaustive]` here -LL | #[default] -LL | Baz { - | ^^^ +... +LL | Variant { + | ^^^^^^^ | = help: consider a manual implementation of `Default` -error: `#[non_exhaustive]` can't be used to annotate items with default field values +error: `#[non_exhaustive]` can't be used to annotate structs with default field values --> $DIR/default-field-values-non_exhaustive.rs:4:1 | LL | #[non_exhaustive] | ^^^^^^^^^^^^^^^^^ -LL | / struct Foo { -LL | | x: i32 = 42 + 3, +LL | +LL | / struct Struct { +LL | | field: i32 = 42 + 3, LL | | } | |_- this struct has default field values -error: aborting due to 2 previous errors +error: `#[non_exhaustive]` can't be used to annotate structs with default field values + --> $DIR/default-field-values-non_exhaustive.rs:11:5 + | +LL | #[non_exhaustive] + | ^^^^^^^^^^^^^^^^^ +LL | +LL | / Variant { +LL | | field: i32 = 24, +LL | | } + | |_____- this struct has default field values + +error: `#[non_exhaustive]` can't be used to annotate structs with default field values + --> $DIR/default-field-values-non_exhaustive.rs:20:5 + | +LL | #[non_exhaustive] + | ^^^^^^^^^^^^^^^^^ +... +LL | / Variant { +LL | | field: i32 = 42 + 3, +LL | | } + | |_____- this struct has default field values + +error: aborting due to 4 previous errors diff --git a/tests/ui/traits/associated_type_bound/assoc-type-bounds-with-the-same-name-with-lacking-generic-arg-148121.stderr b/tests/ui/traits/associated_type_bound/assoc-type-bounds-with-the-same-name-with-lacking-generic-arg-148121.stderr index 5a7969193b553..f6ed222512d17 100644 --- a/tests/ui/traits/associated_type_bound/assoc-type-bounds-with-the-same-name-with-lacking-generic-arg-148121.stderr +++ b/tests/ui/traits/associated_type_bound/assoc-type-bounds-with-the-same-name-with-lacking-generic-arg-148121.stderr @@ -11,8 +11,8 @@ LL | pub trait Super { | ^^^^^ - help: add missing generic argument | -LL | impl A for dyn Super {} - | ++ +LL | impl A for dyn Super {} + | +++ ++ error[E0107]: trait takes 1 generic argument but 0 generic arguments were supplied --> $DIR/assoc-type-bounds-with-the-same-name-with-lacking-generic-arg-148121.rs:14:16 @@ -27,8 +27,8 @@ LL | pub trait Zelf: Super {} | ^^^^ - help: add missing generic argument | -LL | impl A for dyn Zelf {} - | ++ +LL | impl A for dyn Zelf {} + | +++ ++ error: aborting due to 2 previous errors diff --git a/tests/ui/traits/next-solver/issue-118950-root-region.stderr b/tests/ui/traits/next-solver/issue-118950-root-region.stderr index eac8b6e11bf1b..37086347bbae1 100644 --- a/tests/ui/traits/next-solver/issue-118950-root-region.stderr +++ b/tests/ui/traits/next-solver/issue-118950-root-region.stderr @@ -5,10 +5,10 @@ LL | impl Overlap fn(Assoc<'a, T>)> for T where Missing: Overlap { | ^^^^^^^ not found in this scope error[E0277]: the trait bound `*const T: ToUnit<'a>` is not satisfied - --> $DIR/issue-118950-root-region.rs:13:1 + --> $DIR/issue-118950-root-region.rs:13:21 | LL | type Assoc<'a, T> = <*const T as ToUnit<'a>>::Unit; - | ^^^^^^^^^^^^^^^^^ the trait `ToUnit<'a>` is not implemented for `*const T` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `ToUnit<'a>` is not implemented for `*const T` | help: this trait has no implementations, consider adding one --> $DIR/issue-118950-root-region.rs:7:1 diff --git a/tests/ui/traits/next-solver/normalize/checked-alias-variant-pattern-unsized-arg-issue-152990.stderr b/tests/ui/traits/next-solver/normalize/checked-alias-variant-pattern-unsized-arg-issue-152990.stderr index e44b35692ea8c..efc6fc0ef2462 100644 --- a/tests/ui/traits/next-solver/normalize/checked-alias-variant-pattern-unsized-arg-issue-152990.stderr +++ b/tests/ui/traits/next-solver/normalize/checked-alias-variant-pattern-unsized-arg-issue-152990.stderr @@ -1,8 +1,8 @@ error[E0277]: the size for values of type `(dyn Fn() + 'static)` cannot be known at compilation time - --> $DIR/checked-alias-variant-pattern-unsized-arg-issue-152990.rs:11:1 + --> $DIR/checked-alias-variant-pattern-unsized-arg-issue-152990.rs:11:18 | LL | type Supertype = Foo; - | ^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | ^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `(dyn Fn() + 'static)` note: required by an implicit `Sized` bound in `Foo` diff --git a/tests/ui/transmutability/malformed-program-gracefulness/wrong-adt-assume.stderr b/tests/ui/transmutability/malformed-program-gracefulness/wrong-adt-assume.stderr index cae700ecfdc77..b4ad88289fd85 100644 --- a/tests/ui/transmutability/malformed-program-gracefulness/wrong-adt-assume.stderr +++ b/tests/ui/transmutability/malformed-program-gracefulness/wrong-adt-assume.stderr @@ -1,6 +1,9 @@ error: the constant `ASSUME` is not of type `Assume` --> $DIR/wrong-adt-assume.rs:14:9 | +LL | fn foo() + | ----------------------- `ASSUME` defined here +LL | where LL | u8: TransmuteFrom, | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Assume`, found `NotAssume` | diff --git a/tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.current.stderr b/tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.current.stderr index 92ad83c330000..b6657de919090 100644 --- a/tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.current.stderr +++ b/tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.current.stderr @@ -8,7 +8,9 @@ error: the constant `N` is not of type `usize` --> $DIR/const-in-impl-fn-return-type.rs:12:32 | LL | fn func() -> [(); N]; - | ^^^^^^^ expected `usize`, found `u32` + | ------------ ^^^^^^^ expected `usize`, found `u32` + | | + | `N` defined here | = note: the length of array `[(); N]` must be type `usize` diff --git a/tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.next.stderr b/tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.next.stderr index 92ad83c330000..b6657de919090 100644 --- a/tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.next.stderr +++ b/tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.next.stderr @@ -8,7 +8,9 @@ error: the constant `N` is not of type `usize` --> $DIR/const-in-impl-fn-return-type.rs:12:32 | LL | fn func() -> [(); N]; - | ^^^^^^^ expected `usize`, found `u32` + | ------------ ^^^^^^^ expected `usize`, found `u32` + | | + | `N` defined here | = note: the length of array `[(); N]` must be type `usize` diff --git a/tests/ui/wf/wf-dyn-in-hrtb-bound-const-mismatch.stderr b/tests/ui/wf/wf-dyn-in-hrtb-bound-const-mismatch.stderr index 317fbb5dcafe1..c3fb2e6fd84f1 100644 --- a/tests/ui/wf/wf-dyn-in-hrtb-bound-const-mismatch.stderr +++ b/tests/ui/wf/wf-dyn-in-hrtb-bound-const-mismatch.stderr @@ -2,7 +2,9 @@ error: the constant `B` is not of type `usize` --> $DIR/wf-dyn-in-hrtb-bound-const-mismatch.rs:16:30 | LL | fn nested(_f: &dyn for<'a> Fn(&'a (), &'a dyn HasConst<'a, B>)) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `bool` + | ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `bool` + | | + | `B` defined here | note: required by a const generic parameter in `HasConst` --> $DIR/wf-dyn-in-hrtb-bound-const-mismatch.rs:14:20