diff --git a/compiler/rustc_trait_selection/src/traits/coherence.rs b/compiler/rustc_trait_selection/src/traits/coherence.rs index 292787d4dbb24..07c8d227ae4f6 100644 --- a/compiler/rustc_trait_selection/src/traits/coherence.rs +++ b/compiler/rustc_trait_selection/src/traits/coherence.rs @@ -24,7 +24,7 @@ use rustc_middle::traits::specialization_graph::OverlapMode; use rustc_middle::ty::fast_reject::{DeepRejectCtxt, TreatParams}; use rustc_middle::ty::subst::Subst; use rustc_middle::ty::visit::TypeVisitable; -use rustc_middle::ty::{self, ImplSubject, Ty, TyCtxt, TypeVisitor}; +use rustc_middle::ty::{self, ImplSubject, Ty, TyCtxt, TypeFlags, TypeVisitor}; use rustc_span::symbol::sym; use rustc_span::DUMMY_SP; use std::fmt::Debug; @@ -461,7 +461,7 @@ pub fn trait_ref_is_local_or_fundamental<'tcx>( pub enum OrphanCheckErr<'tcx> { NonLocalInputType(Vec<(Ty<'tcx>, bool /* Is this the first input type? */)>), - UncoveredTy(Ty<'tcx>, Option>), + UncoveredTy(Ty<'tcx>, usize, Option>), } /// Checks the coherence orphan rules. `impl_def_id` should be the @@ -588,21 +588,28 @@ fn orphan_check_trait_ref<'tcx>( } let mut checker = OrphanChecker::new(tcx, in_crate); - match trait_ref.visit_with(&mut checker) { - ControlFlow::Continue(()) => Err(OrphanCheckErr::NonLocalInputType(checker.non_local_tys)), - ControlFlow::Break(OrphanCheckEarlyExit::ParamTy(ty)) => { - // Does there exist some local type after the `ParamTy`. - checker.search_first_local_ty = true; - if let Some(OrphanCheckEarlyExit::LocalTy(local_ty)) = - trait_ref.visit_with(&mut checker).break_value() - { - Err(OrphanCheckErr::UncoveredTy(ty, Some(local_ty))) - } else { - Err(OrphanCheckErr::UncoveredTy(ty, None)) + for (idx, arg) in trait_ref.substs.types().enumerate() { + match checker.visit_ty(arg) { + ControlFlow::Continue(()) => continue, + ControlFlow::Break(OrphanCheckEarlyExit::ParamTy(ty)) => { + // Does there exist some local type after the `ParamTy`. + checker.search_first_local_ty = true; + + if let Some(OrphanCheckEarlyExit::LocalTy(local_ty)) = + trait_ref.visit_with(&mut checker).break_value() + { + return Err(OrphanCheckErr::UncoveredTy(ty, idx, Some(local_ty))); + } else { + return Err(OrphanCheckErr::UncoveredTy(ty, idx, None)); + } } + ControlFlow::Break(OrphanCheckEarlyExit::LocalTy(_)) => return Ok(()), } - ControlFlow::Break(OrphanCheckEarlyExit::LocalTy(_)) => Ok(()), } + + // If no early break occured, means we didn't find a local type + // and should return Err + return Err(OrphanCheckErr::NonLocalInputType(checker.non_local_tys)); } struct OrphanChecker<'tcx> { @@ -631,7 +638,8 @@ impl<'tcx> OrphanChecker<'tcx> { ControlFlow::CONTINUE } - fn found_param_ty(&mut self, t: Ty<'tcx>) -> ControlFlow> { + #[instrument(skip(self), level = "debug")] + fn found_uncovered_ty(&mut self, t: Ty<'tcx>) -> ControlFlow> { if self.search_first_local_ty { ControlFlow::CONTINUE } else { @@ -672,10 +680,17 @@ impl<'tcx> TypeVisitor<'tcx> for OrphanChecker<'tcx> { | ty::Slice(..) | ty::RawPtr(..) | ty::Never - | ty::Tuple(..) - | ty::Projection(..) => self.found_non_local_ty(ty), + | ty::Tuple(..) => self.found_non_local_ty(ty), + + ty::Param(..) => self.found_uncovered_ty(ty), - ty::Param(..) => self.found_param_ty(ty), + ty::Projection(proj) => { + if proj.has_type_flags(TypeFlags::HAS_TY_PARAM) { + self.found_uncovered_ty(ty) + } else { + ControlFlow::CONTINUE + } + } ty::Placeholder(..) | ty::Bound(..) | ty::Infer(..) => match self.in_crate { InCrate::Local => self.found_non_local_ty(ty), diff --git a/compiler/rustc_typeck/src/coherence/orphan.rs b/compiler/rustc_typeck/src/coherence/orphan.rs index 1608550aa6ae4..eded331f628c7 100644 --- a/compiler/rustc_typeck/src/coherence/orphan.rs +++ b/compiler/rustc_typeck/src/coherence/orphan.rs @@ -111,7 +111,7 @@ fn do_orphan_check_impl<'tcx>( tr.path.span, trait_ref.self_ty(), impl_.self_ty.span, - &impl_.generics, + &impl_.of_trait.as_ref().unwrap().path.segments.last().unwrap().args().args, err, )?, } @@ -212,7 +212,7 @@ fn emit_orphan_check_error<'tcx>( trait_span: Span, self_ty: Ty<'tcx>, self_ty_span: Span, - generics: &hir::Generics<'tcx>, + generics: &[rustc_hir::GenericArg<'tcx>], err: traits::OrphanCheckErr<'tcx>, ) -> Result { Err(match err { @@ -275,37 +275,59 @@ fn emit_orphan_check_error<'tcx>( err.note("define and implement a trait or new type instead"); err.emit() } - traits::OrphanCheckErr::UncoveredTy(param_ty, local_type) => { - let mut sp = sp; - for param in generics.params { - if param.name.ident().to_string() == param_ty.to_string() { - sp = param.span; + traits::OrphanCheckErr::UncoveredTy(param_ty, idx, local_type) => { + let sp; + let mut param_ty_in_fundamental_ty = false; + + match idx { + 0 => { + sp = self_ty_span; + match *self_ty.kind() { + ty::Ref(..) => { + param_ty_in_fundamental_ty = true; + } + ty::Adt(def, _) => { + param_ty_in_fundamental_ty = def.is_fundamental(); + } + _ => (), + } } + _ => sp = generics[idx - 1].span(), } + let message = match *param_ty.kind() { + ty::Projection(..) => "associated type", + _ => "type parameter", + }; + + let fundamental_ty_msg = + if param_ty_in_fundamental_ty { "as argument to a fundamental type " } else { "" }; + match local_type { Some(local_type) => struct_span_err!( tcx.sess, sp, E0210, - "type parameter `{}` must be covered by another type \ + "{} `{}` {}must be covered by another type \ when it appears before the first local type (`{}`)", + message, param_ty, + fundamental_ty_msg, local_type ) .span_label( sp, format!( - "type parameter `{}` must be covered by another type \ - when it appears before the first local type (`{}`)", - param_ty, local_type + "{} `{}` {}must be covered by another type \ + when it appears before the first local type (`{}`)", + message, param_ty, fundamental_ty_msg, local_type ), ) .note( "implementing a foreign trait is only possible if at \ least one of the types for which it is implemented is local, \ - and no uncovered type parameters appear before that first \ - local type", + and no uncovered type parameters or associated types appear \ + before that first local type", ) .note( "in this case, 'before' refers to the following order: \ @@ -313,21 +335,24 @@ fn emit_orphan_check_error<'tcx>( where `T0` is the first and `Tn` is the last", ) .emit(), + None => struct_span_err!( tcx.sess, sp, E0210, - "type parameter `{}` must be used as the type parameter for some \ + "{} `{}` {}must be used as the type parameter for some \ local type (e.g., `MyStruct<{}>`)", + message, param_ty, + fundamental_ty_msg, param_ty ) .span_label( sp, format!( - "type parameter `{}` must be used as the type parameter for some \ - local type", - param_ty, + "{} `{}` {}must be used as the type parameter for some \ + local type", + message, param_ty, fundamental_ty_msg ), ) .note( diff --git a/src/test/ui/coherence/auxiliary/coherence_projection_assoc.rs b/src/test/ui/coherence/auxiliary/coherence_projection_assoc.rs new file mode 100644 index 0000000000000..5213dfd273132 --- /dev/null +++ b/src/test/ui/coherence/auxiliary/coherence_projection_assoc.rs @@ -0,0 +1,3 @@ +pub trait Foreign { + type Assoc; +} diff --git a/src/test/ui/coherence/coherence-all-remote.stderr b/src/test/ui/coherence/coherence-all-remote.stderr index 7eca417533954..38241a6ae9660 100644 --- a/src/test/ui/coherence/coherence-all-remote.stderr +++ b/src/test/ui/coherence/coherence-all-remote.stderr @@ -1,8 +1,8 @@ error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/coherence-all-remote.rs:6:6 + --> $DIR/coherence-all-remote.rs:6:17 | LL | impl Remote1 for isize { } - | ^ type parameter `T` must be used as the type parameter for some local type + | ^ type parameter `T` must be used as the type parameter for some local type | = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local = note: only traits defined in the current crate can be implemented for a type parameter diff --git a/src/test/ui/coherence/coherence-bigint-param.stderr b/src/test/ui/coherence/coherence-bigint-param.stderr index e8d74c917e465..9943958b2d24d 100644 --- a/src/test/ui/coherence/coherence-bigint-param.stderr +++ b/src/test/ui/coherence/coherence-bigint-param.stderr @@ -1,10 +1,10 @@ error[E0210]: type parameter `T` must be covered by another type when it appears before the first local type (`BigInt`) - --> $DIR/coherence-bigint-param.rs:8:6 + --> $DIR/coherence-bigint-param.rs:8:29 | LL | impl Remote1 for T { } - | ^ type parameter `T` must be covered by another type when it appears before the first local type (`BigInt`) + | ^ type parameter `T` must be covered by another type when it appears before the first local type (`BigInt`) | - = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local, and no uncovered type parameters appear before that first local type + = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local, and no uncovered type parameters or associated types appear before that first local type = note: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last error: aborting due to previous error diff --git a/src/test/ui/coherence/coherence-cross-crate-conflict.stderr b/src/test/ui/coherence/coherence-cross-crate-conflict.stderr index 3d253d56a4565..f008b9b21e7ef 100644 --- a/src/test/ui/coherence/coherence-cross-crate-conflict.stderr +++ b/src/test/ui/coherence/coherence-cross-crate-conflict.stderr @@ -1,8 +1,8 @@ error[E0210]: type parameter `A` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/coherence-cross-crate-conflict.rs:9:6 + --> $DIR/coherence-cross-crate-conflict.rs:9:17 | LL | impl Foo for A { - | ^ type parameter `A` must be used as the type parameter for some local type + | ^ type parameter `A` must be used as the type parameter for some local type | = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local = note: only traits defined in the current crate can be implemented for a type parameter diff --git a/src/test/ui/coherence/coherence-lone-type-parameter.stderr b/src/test/ui/coherence/coherence-lone-type-parameter.stderr index ef5b088365381..d0f4731a21836 100644 --- a/src/test/ui/coherence/coherence-lone-type-parameter.stderr +++ b/src/test/ui/coherence/coherence-lone-type-parameter.stderr @@ -1,8 +1,8 @@ error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/coherence-lone-type-parameter.rs:6:6 + --> $DIR/coherence-lone-type-parameter.rs:6:20 | LL | impl Remote for T { } - | ^ type parameter `T` must be used as the type parameter for some local type + | ^ type parameter `T` must be used as the type parameter for some local type | = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local = note: only traits defined in the current crate can be implemented for a type parameter diff --git a/src/test/ui/coherence/coherence-projection-uncovered-ty-2.rs b/src/test/ui/coherence/coherence-projection-uncovered-ty-2.rs new file mode 100644 index 0000000000000..2bd7165d95be8 --- /dev/null +++ b/src/test/ui/coherence/coherence-projection-uncovered-ty-2.rs @@ -0,0 +1,24 @@ +// Here we expect that orphan rule is violated +// because T is an uncovered parameter appearing +// before the first local (Issue #99554) + +// aux-build:coherence_projection_assoc.rs + +extern crate coherence_projection_assoc as lib; +use lib::Foreign; + +trait Id { + type Assoc; +} + +impl Id for T { + type Assoc = T; +} + +pub struct B; +impl Foreign for > as Id>::Assoc { + //~^ ERROR E0210 + type Assoc = usize; +} + +fn main() {} diff --git a/src/test/ui/coherence/coherence-projection-uncovered-ty-2.stderr b/src/test/ui/coherence/coherence-projection-uncovered-ty-2.stderr new file mode 100644 index 0000000000000..4a631b7de01bb --- /dev/null +++ b/src/test/ui/coherence/coherence-projection-uncovered-ty-2.stderr @@ -0,0 +1,12 @@ +error[E0210]: associated type `> as Id>::Assoc` must be covered by another type when it appears before the first local type (`B`) + --> $DIR/coherence-projection-uncovered-ty-2.rs:19:27 + | +LL | impl Foreign for > as Id>::Assoc { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ associated type `> as Id>::Assoc` must be covered by another type when it appears before the first local type (`B`) + | + = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local, and no uncovered type parameters or associated types appear before that first local type + = note: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0210`. diff --git a/src/test/ui/coherence/coherence-projection-uncovered-ty-3.rs b/src/test/ui/coherence/coherence-projection-uncovered-ty-3.rs new file mode 100644 index 0000000000000..a2efb04fcf29f --- /dev/null +++ b/src/test/ui/coherence/coherence-projection-uncovered-ty-3.rs @@ -0,0 +1,20 @@ +// aux-build:coherence_projection_assoc.rs + +extern crate coherence_projection_assoc as lib; +use lib::Foreign; + +trait Id { + type Assoc; +} + +impl Id for T { + type Assoc = T; +} + +pub struct Local(T); +impl Foreign<::Assoc, Local> for () { + //~^ ERROR E0210 + type Assoc = usize; +} + +fn main() {} diff --git a/src/test/ui/coherence/coherence-projection-uncovered-ty-3.stderr b/src/test/ui/coherence/coherence-projection-uncovered-ty-3.stderr new file mode 100644 index 0000000000000..ea0f98513d1c9 --- /dev/null +++ b/src/test/ui/coherence/coherence-projection-uncovered-ty-3.stderr @@ -0,0 +1,12 @@ +error[E0210]: associated type `::Assoc` must be covered by another type when it appears before the first local type (`Local`) + --> $DIR/coherence-projection-uncovered-ty-3.rs:15:17 + | +LL | impl Foreign<::Assoc, Local> for () { + | ^^^^^^^^^^^^^^^^ associated type `::Assoc` must be covered by another type when it appears before the first local type (`Local`) + | + = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local, and no uncovered type parameters or associated types appear before that first local type + = note: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0210`. diff --git a/src/test/ui/coherence/coherence-projection-uncovered-ty-4.rs b/src/test/ui/coherence/coherence-projection-uncovered-ty-4.rs new file mode 100644 index 0000000000000..9d17af5eadb48 --- /dev/null +++ b/src/test/ui/coherence/coherence-projection-uncovered-ty-4.rs @@ -0,0 +1,19 @@ +// aux-build:coherence_projection_assoc.rs + +extern crate coherence_projection_assoc as lib; +use lib::Foreign; + +trait Id { + type Assoc; +} + +impl Id for T { + type Assoc = T; +} + +impl Foreign<(), Vec> for ::Assoc { +//~^ ERROR E0210 + type Assoc = usize; +} + +fn main() {} diff --git a/src/test/ui/coherence/coherence-projection-uncovered-ty-4.stderr b/src/test/ui/coherence/coherence-projection-uncovered-ty-4.stderr new file mode 100644 index 0000000000000..280cb0f026252 --- /dev/null +++ b/src/test/ui/coherence/coherence-projection-uncovered-ty-4.stderr @@ -0,0 +1,12 @@ +error[E0210]: associated type `::Assoc` must be used as the type parameter for some local type (e.g., `MyStruct<::Assoc>`) + --> $DIR/coherence-projection-uncovered-ty-4.rs:14:33 + | +LL | impl Foreign<(), Vec> for ::Assoc { + | ^^^^^^^^^^^^^^^^ associated type `::Assoc` must be used as the type parameter for some local type + | + = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local + = note: only traits defined in the current crate can be implemented for a type parameter + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0210`. diff --git a/src/test/ui/coherence/coherence-projection-uncovered-ty.rs b/src/test/ui/coherence/coherence-projection-uncovered-ty.rs new file mode 100644 index 0000000000000..35686f560cc28 --- /dev/null +++ b/src/test/ui/coherence/coherence-projection-uncovered-ty.rs @@ -0,0 +1,24 @@ +// Here we expect that orphan rule is violated +// because T is an uncovered parameter appearing +// before the first local (Issue #99554) + +// aux-build:coherence_projection_assoc.rs + +extern crate coherence_projection_assoc as lib; +use lib::Foreign; + +trait Id { + type Assoc; +} + +impl Id for T { + type Assoc = T; +} + +pub struct B; +impl Foreign for ::Assoc { +//~^ ERROR E0210 + type Assoc = usize; +} + +fn main() {} diff --git a/src/test/ui/coherence/coherence-projection-uncovered-ty.stderr b/src/test/ui/coherence/coherence-projection-uncovered-ty.stderr new file mode 100644 index 0000000000000..5729d36e5474f --- /dev/null +++ b/src/test/ui/coherence/coherence-projection-uncovered-ty.stderr @@ -0,0 +1,12 @@ +error[E0210]: associated type `::Assoc` must be covered by another type when it appears before the first local type (`B`) + --> $DIR/coherence-projection-uncovered-ty.rs:19:27 + | +LL | impl Foreign for ::Assoc { + | ^^^^^^^^^^^^^^^^ associated type `::Assoc` must be covered by another type when it appears before the first local type (`B`) + | + = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local, and no uncovered type parameters or associated types appear before that first local type + = note: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0210`. diff --git a/src/test/ui/coherence/impl[t]-foreign-for-fundamental[t].rs b/src/test/ui/coherence/impl[t]-foreign-for-fundamental[t].rs index 6f5605a21938e..144a3a3ada74f 100644 --- a/src/test/ui/coherence/impl[t]-foreign-for-fundamental[t].rs +++ b/src/test/ui/coherence/impl[t]-foreign-for-fundamental[t].rs @@ -8,7 +8,7 @@ use std::rc::Rc; struct Local; impl Remote for Box { - //~^ ERROR type parameter `T` must be used as the type parameter for + //~^ ERROR type parameter `T` as argument to a fundamental type must be used as the type parameter for // | some local type (e.g., `MyStruct`) } diff --git a/src/test/ui/coherence/impl[t]-foreign-for-fundamental[t].stderr b/src/test/ui/coherence/impl[t]-foreign-for-fundamental[t].stderr index 249a5c44c79cd..3b468c9cd9472 100644 --- a/src/test/ui/coherence/impl[t]-foreign-for-fundamental[t].stderr +++ b/src/test/ui/coherence/impl[t]-foreign-for-fundamental[t].stderr @@ -1,8 +1,8 @@ -error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/impl[t]-foreign-for-fundamental[t].rs:10:6 +error[E0210]: type parameter `T` as argument to a fundamental type must be used as the type parameter for some local type (e.g., `MyStruct`) + --> $DIR/impl[t]-foreign-for-fundamental[t].rs:10:20 | LL | impl Remote for Box { - | ^ type parameter `T` must be used as the type parameter for some local type + | ^^^^^^ type parameter `T` as argument to a fundamental type must be used as the type parameter for some local type | = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local = note: only traits defined in the current crate can be implemented for a type parameter diff --git a/src/test/ui/coherence/impl[t]-foreign[foreign]-for-fundamental[t].rs b/src/test/ui/coherence/impl[t]-foreign[foreign]-for-fundamental[t].rs index 81044cd0529af..99d9bf3510c8d 100644 --- a/src/test/ui/coherence/impl[t]-foreign[foreign]-for-fundamental[t].rs +++ b/src/test/ui/coherence/impl[t]-foreign[foreign]-for-fundamental[t].rs @@ -8,11 +8,13 @@ use std::rc::Rc; struct Local; impl Remote1 for Box { - //~^ ERROR type parameter `T` must be used as the type parameter for some local type + //~^ ERROR type parameter `T` as argument to a fundamental type + // | must be used as the type parameter for some local type } impl<'a, T> Remote1 for &'a T { - //~^ ERROR type parameter `T` must be used as the type parameter for some local type + //~^ ERROR type parameter `T` as argument to a fundamental type + // | must be used as the type parameter for some local type } fn main() {} diff --git a/src/test/ui/coherence/impl[t]-foreign[foreign]-for-fundamental[t].stderr b/src/test/ui/coherence/impl[t]-foreign[foreign]-for-fundamental[t].stderr index 95a20cc5b0f5c..fb356e3787e24 100644 --- a/src/test/ui/coherence/impl[t]-foreign[foreign]-for-fundamental[t].stderr +++ b/src/test/ui/coherence/impl[t]-foreign[foreign]-for-fundamental[t].stderr @@ -1,17 +1,17 @@ -error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/impl[t]-foreign[foreign]-for-fundamental[t].rs:10:6 +error[E0210]: type parameter `T` as argument to a fundamental type must be used as the type parameter for some local type (e.g., `MyStruct`) + --> $DIR/impl[t]-foreign[foreign]-for-fundamental[t].rs:10:26 | LL | impl Remote1 for Box { - | ^ type parameter `T` must be used as the type parameter for some local type + | ^^^^^^ type parameter `T` as argument to a fundamental type must be used as the type parameter for some local type | = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local = note: only traits defined in the current crate can be implemented for a type parameter -error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/impl[t]-foreign[foreign]-for-fundamental[t].rs:14:10 +error[E0210]: type parameter `T` as argument to a fundamental type must be used as the type parameter for some local type (e.g., `MyStruct`) + --> $DIR/impl[t]-foreign[foreign]-for-fundamental[t].rs:15:30 | LL | impl<'a, T> Remote1 for &'a T { - | ^ type parameter `T` must be used as the type parameter for some local type + | ^^^^^ type parameter `T` as argument to a fundamental type must be used as the type parameter for some local type | = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local = note: only traits defined in the current crate can be implemented for a type parameter diff --git a/src/test/ui/coherence/impl[t]-foreign[foreign]-for-t.stderr b/src/test/ui/coherence/impl[t]-foreign[foreign]-for-t.stderr index aed184767a0bd..06c464edd2cdf 100644 --- a/src/test/ui/coherence/impl[t]-foreign[foreign]-for-t.stderr +++ b/src/test/ui/coherence/impl[t]-foreign[foreign]-for-t.stderr @@ -1,8 +1,8 @@ error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/impl[t]-foreign[foreign]-for-t.rs:10:6 + --> $DIR/impl[t]-foreign[foreign]-for-t.rs:10:26 | LL | impl Remote1 for T { - | ^ type parameter `T` must be used as the type parameter for some local type + | ^ type parameter `T` must be used as the type parameter for some local type | = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local = note: only traits defined in the current crate can be implemented for a type parameter diff --git a/src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-foreign.stderr b/src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-foreign.stderr index 73b1e2c6ed248..54598b0339e11 100644 --- a/src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-foreign.stderr +++ b/src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-foreign.stderr @@ -1,17 +1,17 @@ error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/impl[t]-foreign[fundamental[t]]-for-foreign.rs:10:6 + --> $DIR/impl[t]-foreign[fundamental[t]]-for-foreign.rs:10:17 | LL | impl Remote1> for u32 { - | ^ type parameter `T` must be used as the type parameter for some local type + | ^^^^^^ type parameter `T` must be used as the type parameter for some local type | = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local = note: only traits defined in the current crate can be implemented for a type parameter error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/impl[t]-foreign[fundamental[t]]-for-foreign.rs:14:10 + --> $DIR/impl[t]-foreign[fundamental[t]]-for-foreign.rs:14:21 | LL | impl<'a, T> Remote1<&'a T> for u32 { - | ^ type parameter `T` must be used as the type parameter for some local type + | ^^^^^ type parameter `T` must be used as the type parameter for some local type | = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local = note: only traits defined in the current crate can be implemented for a type parameter diff --git a/src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-fundamental[t].rs b/src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-fundamental[t].rs index 703f25dd60a62..dcfca77de335e 100644 --- a/src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-fundamental[t].rs +++ b/src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-fundamental[t].rs @@ -8,10 +8,12 @@ use std::rc::Rc; struct Local; impl<'a, T> Remote1> for &'a T { - //~^ ERROR type parameter `T` must be used as the type parameter for some local type + //~^ ERROR type parameter `T` as argument to a fundamental type + // | must be used as the type parameter for some local type } impl<'a, T> Remote1<&'a T> for Box { - //~^ ERROR type parameter `T` must be used as the type parameter for some local type + //~^ ERROR type parameter `T` as argument to a fundamental type + // | must be used as the type parameter for some local type } fn main() {} diff --git a/src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-fundamental[t].stderr b/src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-fundamental[t].stderr index 5f89a7aa469c1..cd6ecf508518e 100644 --- a/src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-fundamental[t].stderr +++ b/src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-fundamental[t].stderr @@ -1,17 +1,17 @@ -error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/impl[t]-foreign[fundamental[t]]-for-fundamental[t].rs:10:10 +error[E0210]: type parameter `T` as argument to a fundamental type must be used as the type parameter for some local type (e.g., `MyStruct`) + --> $DIR/impl[t]-foreign[fundamental[t]]-for-fundamental[t].rs:10:33 | LL | impl<'a, T> Remote1> for &'a T { - | ^ type parameter `T` must be used as the type parameter for some local type + | ^^^^^ type parameter `T` as argument to a fundamental type must be used as the type parameter for some local type | = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local = note: only traits defined in the current crate can be implemented for a type parameter -error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/impl[t]-foreign[fundamental[t]]-for-fundamental[t].rs:13:10 +error[E0210]: type parameter `T` as argument to a fundamental type must be used as the type parameter for some local type (e.g., `MyStruct`) + --> $DIR/impl[t]-foreign[fundamental[t]]-for-fundamental[t].rs:14:32 | LL | impl<'a, T> Remote1<&'a T> for Box { - | ^ type parameter `T` must be used as the type parameter for some local type + | ^^^^^^ type parameter `T` as argument to a fundamental type must be used as the type parameter for some local type | = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local = note: only traits defined in the current crate can be implemented for a type parameter diff --git a/src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-t.stderr b/src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-t.stderr index 45559d8b62d37..cc0bdef9d1ccf 100644 --- a/src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-t.stderr +++ b/src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-t.stderr @@ -1,17 +1,17 @@ error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/impl[t]-foreign[fundamental[t]]-for-t.rs:10:6 + --> $DIR/impl[t]-foreign[fundamental[t]]-for-t.rs:10:29 | LL | impl Remote1> for T { - | ^ type parameter `T` must be used as the type parameter for some local type + | ^ type parameter `T` must be used as the type parameter for some local type | = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local = note: only traits defined in the current crate can be implemented for a type parameter error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/impl[t]-foreign[fundamental[t]]-for-t.rs:13:10 + --> $DIR/impl[t]-foreign[fundamental[t]]-for-t.rs:13:32 | LL | impl<'a, T> Remote1<&'a T> for T { - | ^ type parameter `T` must be used as the type parameter for some local type + | ^ type parameter `T` must be used as the type parameter for some local type | = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local = note: only traits defined in the current crate can be implemented for a type parameter diff --git a/src/test/ui/coherence/impl[t]-foreign[fundamental[t]_local]-for-foreign.stderr b/src/test/ui/coherence/impl[t]-foreign[fundamental[t]_local]-for-foreign.stderr index f94f04c8df5c1..df6b4c1d6d410 100644 --- a/src/test/ui/coherence/impl[t]-foreign[fundamental[t]_local]-for-foreign.stderr +++ b/src/test/ui/coherence/impl[t]-foreign[fundamental[t]_local]-for-foreign.stderr @@ -1,19 +1,19 @@ error[E0210]: type parameter `T` must be covered by another type when it appears before the first local type (`Local`) - --> $DIR/impl[t]-foreign[fundamental[t]_local]-for-foreign.rs:10:6 + --> $DIR/impl[t]-foreign[fundamental[t]_local]-for-foreign.rs:10:17 | LL | impl Remote2, Local> for u32 { - | ^ type parameter `T` must be covered by another type when it appears before the first local type (`Local`) + | ^^^^^^ type parameter `T` must be covered by another type when it appears before the first local type (`Local`) | - = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local, and no uncovered type parameters appear before that first local type + = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local, and no uncovered type parameters or associated types appear before that first local type = note: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last error[E0210]: type parameter `T` must be covered by another type when it appears before the first local type (`Local`) - --> $DIR/impl[t]-foreign[fundamental[t]_local]-for-foreign.rs:14:10 + --> $DIR/impl[t]-foreign[fundamental[t]_local]-for-foreign.rs:14:21 | LL | impl<'a, T> Remote2<&'a T, Local> for u32 { - | ^ type parameter `T` must be covered by another type when it appears before the first local type (`Local`) + | ^^^^^ type parameter `T` must be covered by another type when it appears before the first local type (`Local`) | - = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local, and no uncovered type parameters appear before that first local type + = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local, and no uncovered type parameters or associated types appear before that first local type = note: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last error: aborting due to 2 previous errors diff --git a/src/test/ui/coherence/impl[t]-foreign[local]-for-fundamental[t].rs b/src/test/ui/coherence/impl[t]-foreign[local]-for-fundamental[t].rs index 7709bd9c89b6f..217067aafd2a3 100644 --- a/src/test/ui/coherence/impl[t]-foreign[local]-for-fundamental[t].rs +++ b/src/test/ui/coherence/impl[t]-foreign[local]-for-fundamental[t].rs @@ -8,11 +8,13 @@ use std::rc::Rc; struct Local; impl Remote1 for Box { - //~^ ERROR type parameter `T` must be covered by another type + //~^ ERROR type parameter `T` as argument to a fundamental type + // | must be covered by another type when it appears before the first local type (`Local`) } impl Remote1 for &T { - //~^ ERROR type parameter `T` must be covered by another type + //~^ ERROR type parameter `T` as argument to a fundamental type + // | must be covered by another type when it appears before the first local type (`Local`) } fn main() {} diff --git a/src/test/ui/coherence/impl[t]-foreign[local]-for-fundamental[t].stderr b/src/test/ui/coherence/impl[t]-foreign[local]-for-fundamental[t].stderr index e68f2fe585637..964006ec521ef 100644 --- a/src/test/ui/coherence/impl[t]-foreign[local]-for-fundamental[t].stderr +++ b/src/test/ui/coherence/impl[t]-foreign[local]-for-fundamental[t].stderr @@ -1,19 +1,19 @@ -error[E0210]: type parameter `T` must be covered by another type when it appears before the first local type (`Local`) - --> $DIR/impl[t]-foreign[local]-for-fundamental[t].rs:10:6 +error[E0210]: type parameter `T` as argument to a fundamental type must be covered by another type when it appears before the first local type (`Local`) + --> $DIR/impl[t]-foreign[local]-for-fundamental[t].rs:10:28 | LL | impl Remote1 for Box { - | ^ type parameter `T` must be covered by another type when it appears before the first local type (`Local`) + | ^^^^^^ type parameter `T` as argument to a fundamental type must be covered by another type when it appears before the first local type (`Local`) | - = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local, and no uncovered type parameters appear before that first local type + = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local, and no uncovered type parameters or associated types appear before that first local type = note: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last -error[E0210]: type parameter `T` must be covered by another type when it appears before the first local type (`Local`) - --> $DIR/impl[t]-foreign[local]-for-fundamental[t].rs:14:6 +error[E0210]: type parameter `T` as argument to a fundamental type must be covered by another type when it appears before the first local type (`Local`) + --> $DIR/impl[t]-foreign[local]-for-fundamental[t].rs:15:28 | LL | impl Remote1 for &T { - | ^ type parameter `T` must be covered by another type when it appears before the first local type (`Local`) + | ^^ type parameter `T` as argument to a fundamental type must be covered by another type when it appears before the first local type (`Local`) | - = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local, and no uncovered type parameters appear before that first local type + = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local, and no uncovered type parameters or associated types appear before that first local type = note: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last error: aborting due to 2 previous errors diff --git a/src/test/ui/coherence/impl[t]-foreign[local]-for-t.stderr b/src/test/ui/coherence/impl[t]-foreign[local]-for-t.stderr index d97e85dcb3c3e..fb3b39361594b 100644 --- a/src/test/ui/coherence/impl[t]-foreign[local]-for-t.stderr +++ b/src/test/ui/coherence/impl[t]-foreign[local]-for-t.stderr @@ -1,10 +1,10 @@ error[E0210]: type parameter `T` must be covered by another type when it appears before the first local type (`Local`) - --> $DIR/impl[t]-foreign[local]-for-t.rs:10:6 + --> $DIR/impl[t]-foreign[local]-for-t.rs:10:28 | LL | impl Remote1 for T { - | ^ type parameter `T` must be covered by another type when it appears before the first local type (`Local`) + | ^ type parameter `T` must be covered by another type when it appears before the first local type (`Local`) | - = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local, and no uncovered type parameters appear before that first local type + = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local, and no uncovered type parameters or associated types appear before that first local type = note: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last error: aborting due to previous error diff --git a/src/test/ui/coherence/impl[t]-foreign[t]-for-foreign.stderr b/src/test/ui/coherence/impl[t]-foreign[t]-for-foreign.stderr index 44e3b7eedb40c..d412b1c8d523a 100644 --- a/src/test/ui/coherence/impl[t]-foreign[t]-for-foreign.stderr +++ b/src/test/ui/coherence/impl[t]-foreign[t]-for-foreign.stderr @@ -1,8 +1,8 @@ error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/impl[t]-foreign[t]-for-foreign.rs:10:6 + --> $DIR/impl[t]-foreign[t]-for-foreign.rs:10:17 | LL | impl Remote1 for u32 { - | ^ type parameter `T` must be used as the type parameter for some local type + | ^ type parameter `T` must be used as the type parameter for some local type | = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local = note: only traits defined in the current crate can be implemented for a type parameter diff --git a/src/test/ui/coherence/impl[t]-foreign[t]-for-fundamental.rs b/src/test/ui/coherence/impl[t]-foreign[t]-for-fundamental.rs index 79b5aa3fc6202..fed36babfdc3b 100644 --- a/src/test/ui/coherence/impl[t]-foreign[t]-for-fundamental.rs +++ b/src/test/ui/coherence/impl[t]-foreign[t]-for-fundamental.rs @@ -8,11 +8,13 @@ use std::rc::Rc; struct Local; impl Remote1 for Box { - //~^ ERROR type parameter `T` must be used as the type parameter for some local type + //~^ ERROR type parameter `T` as argument to a fundamental type + // | must be used as the type parameter for some local type } impl<'a, A, B> Remote1 for &'a B { - //~^ ERROR type parameter `B` must be used as the type parameter for some local type + //~^ ERROR type parameter `B` as argument to a fundamental type + // | must be used as the type parameter for some local type } fn main() {} diff --git a/src/test/ui/coherence/impl[t]-foreign[t]-for-fundamental.stderr b/src/test/ui/coherence/impl[t]-foreign[t]-for-fundamental.stderr index 80fb5dbec8662..e2cb43bb38930 100644 --- a/src/test/ui/coherence/impl[t]-foreign[t]-for-fundamental.stderr +++ b/src/test/ui/coherence/impl[t]-foreign[t]-for-fundamental.stderr @@ -1,17 +1,17 @@ -error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/impl[t]-foreign[t]-for-fundamental.rs:10:6 +error[E0210]: type parameter `T` as argument to a fundamental type must be used as the type parameter for some local type (e.g., `MyStruct`) + --> $DIR/impl[t]-foreign[t]-for-fundamental.rs:10:24 | LL | impl Remote1 for Box { - | ^ type parameter `T` must be used as the type parameter for some local type + | ^^^^^^ type parameter `T` as argument to a fundamental type must be used as the type parameter for some local type | = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local = note: only traits defined in the current crate can be implemented for a type parameter -error[E0210]: type parameter `B` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/impl[t]-foreign[t]-for-fundamental.rs:14:13 +error[E0210]: type parameter `B` as argument to a fundamental type must be used as the type parameter for some local type (e.g., `MyStruct`) + --> $DIR/impl[t]-foreign[t]-for-fundamental.rs:15:31 | LL | impl<'a, A, B> Remote1 for &'a B { - | ^ type parameter `B` must be used as the type parameter for some local type + | ^^^^^ type parameter `B` as argument to a fundamental type must be used as the type parameter for some local type | = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local = note: only traits defined in the current crate can be implemented for a type parameter diff --git a/src/test/ui/coherence/impl[t]-foreign[t]-for-t.stderr b/src/test/ui/coherence/impl[t]-foreign[t]-for-t.stderr index ff72969dc52ae..f28b5c3e7b0d9 100644 --- a/src/test/ui/coherence/impl[t]-foreign[t]-for-t.stderr +++ b/src/test/ui/coherence/impl[t]-foreign[t]-for-t.stderr @@ -1,8 +1,8 @@ error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/impl[t]-foreign[t]-for-t.rs:10:6 + --> $DIR/impl[t]-foreign[t]-for-t.rs:10:24 | LL | impl Remote1 for T { - | ^ type parameter `T` must be used as the type parameter for some local type + | ^ type parameter `T` must be used as the type parameter for some local type | = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local = note: only traits defined in the current crate can be implemented for a type parameter diff --git a/src/test/ui/coherence/issue-100191.stderr b/src/test/ui/coherence/issue-100191.stderr index 1adb0f1e4fa7b..9bd6498a72f74 100644 --- a/src/test/ui/coherence/issue-100191.stderr +++ b/src/test/ui/coherence/issue-100191.stderr @@ -1,8 +1,8 @@ error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/issue-100191.rs:18:6 + --> $DIR/issue-100191.rs:18:38 | LL | impl From< as Z>::Assoc> for T {} - | ^ type parameter `T` must be used as the type parameter for some local type + | ^ type parameter `T` must be used as the type parameter for some local type | = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local = note: only traits defined in the current crate can be implemented for a type parameter diff --git a/src/test/ui/error-codes/e0119/issue-28981.stderr b/src/test/ui/error-codes/e0119/issue-28981.stderr index 97b570bc7aca3..a2d0030a4e15f 100644 --- a/src/test/ui/error-codes/e0119/issue-28981.stderr +++ b/src/test/ui/error-codes/e0119/issue-28981.stderr @@ -1,8 +1,8 @@ error[E0210]: type parameter `Foo` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/issue-28981.rs:5:6 + --> $DIR/issue-28981.rs:5:21 | LL | impl Deref for Foo { } - | ^^^ type parameter `Foo` must be used as the type parameter for some local type + | ^^^ type parameter `Foo` must be used as the type parameter for some local type | = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local = note: only traits defined in the current crate can be implemented for a type parameter diff --git a/src/test/ui/issues/issue-41974.stderr b/src/test/ui/issues/issue-41974.stderr index e249db9df5324..aca96eb14f14d 100644 --- a/src/test/ui/issues/issue-41974.stderr +++ b/src/test/ui/issues/issue-41974.stderr @@ -1,8 +1,8 @@ error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/issue-41974.rs:7:6 + --> $DIR/issue-41974.rs:7:18 | LL | impl Drop for T where T: A { - | ^ type parameter `T` must be used as the type parameter for some local type + | ^ type parameter `T` must be used as the type parameter for some local type | = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local = note: only traits defined in the current crate can be implemented for a type parameter diff --git a/src/test/ui/orphan-check-diagnostics.stderr b/src/test/ui/orphan-check-diagnostics.stderr index 7a7cea56307de..c37a925575912 100644 --- a/src/test/ui/orphan-check-diagnostics.stderr +++ b/src/test/ui/orphan-check-diagnostics.stderr @@ -1,8 +1,8 @@ error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/orphan-check-diagnostics.rs:11:6 + --> $DIR/orphan-check-diagnostics.rs:11:25 | LL | impl RemoteTrait for T where T: LocalTrait {} - | ^ type parameter `T` must be used as the type parameter for some local type + | ^ type parameter `T` must be used as the type parameter for some local type | = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local = note: only traits defined in the current crate can be implemented for a type parameter diff --git a/src/test/ui/specialization/issue-43037.stderr b/src/test/ui/specialization/issue-43037.stderr index 4249cd8947716..4799c63fc489d 100644 --- a/src/test/ui/specialization/issue-43037.stderr +++ b/src/test/ui/specialization/issue-43037.stderr @@ -1,8 +1,8 @@ error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/issue-43037.rs:17:6 + --> $DIR/issue-43037.rs:17:38 | LL | impl From< as Z>::Assoc> for T {} - | ^ type parameter `T` must be used as the type parameter for some local type + | ^ type parameter `T` must be used as the type parameter for some local type | = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local = note: only traits defined in the current crate can be implemented for a type parameter diff --git a/src/test/ui/type-alias-impl-trait/incoherent-assoc-imp-trait.rs b/src/test/ui/type-alias-impl-trait/incoherent-assoc-imp-trait.rs index 685d76ee36f33..60c12d7bc4cc8 100644 --- a/src/test/ui/type-alias-impl-trait/incoherent-assoc-imp-trait.rs +++ b/src/test/ui/type-alias-impl-trait/incoherent-assoc-imp-trait.rs @@ -8,7 +8,9 @@ trait MyTrait {} impl MyTrait for () {} impl FnOnce<()> for &F { - //~^ ERROR type parameter `F` must be used + //~^ ERROR type parameter `F` as argument to a fundamental type + // | must be used as the type parameter for some local type + // | (e.g., `MyStruct`) type Output = impl MyTrait; extern "rust-call" fn call_once(self, _: ()) -> Self::Output {} } diff --git a/src/test/ui/type-alias-impl-trait/incoherent-assoc-imp-trait.stderr b/src/test/ui/type-alias-impl-trait/incoherent-assoc-imp-trait.stderr index b93ea955c89f5..33dcba8ba24c1 100644 --- a/src/test/ui/type-alias-impl-trait/incoherent-assoc-imp-trait.stderr +++ b/src/test/ui/type-alias-impl-trait/incoherent-assoc-imp-trait.stderr @@ -1,8 +1,8 @@ -error[E0210]: type parameter `F` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/incoherent-assoc-imp-trait.rs:10:6 +error[E0210]: type parameter `F` as argument to a fundamental type must be used as the type parameter for some local type (e.g., `MyStruct`) + --> $DIR/incoherent-assoc-imp-trait.rs:10:24 | LL | impl FnOnce<()> for &F { - | ^ type parameter `F` must be used as the type parameter for some local type + | ^^ type parameter `F` as argument to a fundamental type must be used as the type parameter for some local type | = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local = note: only traits defined in the current crate can be implemented for a type parameter