From 47391d7eb97990fa7fe6f83fe150e150748536bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Le=C3=B3n=20Orell=20Valerian=20Liehr?= Date: Tue, 4 Feb 2025 12:00:55 +0100 Subject: [PATCH 1/2] Deduplicate diagnostic impl of an orphanck error+lint Moreover, don't add the error code to the lint warning(!). While helpful, it's quite unconventional. --- .../src/coherence/orphan.rs | 64 ++++------- compiler/rustc_hir_analysis/src/errors.rs | 107 +++++++----------- .../orphan-check-alias.classic.stderr | 3 +- .../coherence/orphan-check-alias.next.stderr | 3 +- ...ions-not-covering-ambiguity.classic.stderr | 3 +- ...ections-not-covering-ambiguity.next.stderr | 3 +- ...ot-covering-multiple-params.classic.stderr | 5 +- ...s-not-covering-multiple-params.next.stderr | 5 +- ...ck-projections-not-covering.classic.stderr | 7 +- ...check-projections-not-covering.next.stderr | 7 +- ...ck-projections-unsat-bounds.classic.stderr | 3 +- ...check-projections-unsat-bounds.next.stderr | 3 +- 12 files changed, 78 insertions(+), 135 deletions(-) diff --git a/compiler/rustc_hir_analysis/src/coherence/orphan.rs b/compiler/rustc_hir_analysis/src/coherence/orphan.rs index bacc1f1549973..b0a3d708f4a20 100644 --- a/compiler/rustc_hir_analysis/src/coherence/orphan.rs +++ b/compiler/rustc_hir_analysis/src/coherence/orphan.rs @@ -31,7 +31,21 @@ pub(crate) fn orphan_check_impl( Err(err) => match orphan_check(tcx, impl_def_id, OrphanCheckMode::Compat) { Ok(()) => match err { OrphanCheckErr::UncoveredTyParams(uncovered_ty_params) => { - lint_uncovered_ty_params(tcx, uncovered_ty_params, impl_def_id) + let hir_id = tcx.local_def_id_to_hir_id(impl_def_id); + + for param_def_id in uncovered_ty_params.uncovered { + let ident = tcx.item_ident(param_def_id); + + tcx.emit_node_span_lint( + UNCOVERED_PARAM_IN_PROJECTION, + hir_id, + ident.span, + errors::UncoveredTyParam { + param: ident, + local_ty: uncovered_ty_params.local_ty, + }, + ); + } } OrphanCheckErr::NonLocalInputType(_) => { bug!("orphanck: shouldn't've gotten non-local input tys in compat mode") @@ -455,54 +469,18 @@ fn emit_orphan_check_error<'tcx>( diag.emit() } traits::OrphanCheckErr::UncoveredTyParams(UncoveredTyParams { uncovered, local_ty }) => { - let mut reported = None; + let mut guar = None; for param_def_id in uncovered { - let name = tcx.item_ident(param_def_id); - let span = name.span; - - reported.get_or_insert(match local_ty { - Some(local_type) => tcx.dcx().emit_err(errors::TyParamFirstLocal { - span, - note: (), - param: name, - local_type, - }), - None => tcx.dcx().emit_err(errors::TyParamSome { span, note: (), param: name }), - }); + guar.get_or_insert(tcx.dcx().emit_err(errors::UncoveredTyParam { + param: tcx.item_ident(param_def_id), + local_ty, + })); } - reported.unwrap() // FIXME(fmease): This is very likely reachable. + guar.unwrap() } } } -fn lint_uncovered_ty_params<'tcx>( - tcx: TyCtxt<'tcx>, - UncoveredTyParams { uncovered, local_ty }: UncoveredTyParams, FxIndexSet>, - impl_def_id: LocalDefId, -) { - let hir_id = tcx.local_def_id_to_hir_id(impl_def_id); - - for param_def_id in uncovered { - let span = tcx.def_ident_span(param_def_id).unwrap(); - let name = tcx.item_ident(param_def_id); - - match local_ty { - Some(local_type) => tcx.emit_node_span_lint( - UNCOVERED_PARAM_IN_PROJECTION, - hir_id, - span, - errors::TyParamFirstLocalLint { span, note: (), param: name, local_type }, - ), - None => tcx.emit_node_span_lint( - UNCOVERED_PARAM_IN_PROJECTION, - hir_id, - span, - errors::TyParamSomeLint { span, note: (), param: name }, - ), - }; - } -} - struct UncoveredTyParamCollector<'cx, 'tcx> { infcx: &'cx InferCtxt<'tcx>, uncovered_params: FxIndexSet, diff --git a/compiler/rustc_hir_analysis/src/errors.rs b/compiler/rustc_hir_analysis/src/errors.rs index e7518e46e3654..77a9f44e4d1a5 100644 --- a/compiler/rustc_hir_analysis/src/errors.rs +++ b/compiler/rustc_hir_analysis/src/errors.rs @@ -1498,72 +1498,6 @@ pub struct NoFieldOnType<'tcx> { pub field: Ident, } -// FIXME(fmease): Deduplicate: - -#[derive(Diagnostic)] -#[diag("type parameter `{$param}` must be covered by another type when it appears before the first local type (`{$local_type}`)", code = E0210)] -#[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" -)] -pub(crate) struct TyParamFirstLocal<'tcx> { - #[primary_span] - #[label( - "type parameter `{$param}` must be covered by another type when it appears before the first local type (`{$local_type}`)" - )] - pub span: Span, - #[note( - "in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last" - )] - pub note: (), - pub param: Ident, - pub local_type: Ty<'tcx>, -} - -#[derive(Diagnostic)] -#[diag("type parameter `{$param}` must be covered by another type when it appears before the first local type (`{$local_type}`)", code = E0210)] -#[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" -)] -pub(crate) struct TyParamFirstLocalLint<'tcx> { - #[label( - "type parameter `{$param}` must be covered by another type when it appears before the first local type (`{$local_type}`)" - )] - pub span: Span, - #[note( - "in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last" - )] - pub note: (), - pub param: Ident, - pub local_type: Ty<'tcx>, -} - -#[derive(Diagnostic)] -#[diag("type parameter `{$param}` must be used as the type parameter for some local type (e.g., `MyStruct<{$param}>`)", code = E0210)] -#[note( - "implementing a foreign trait is only possible if at least one of the types for which it is implemented is local" -)] -pub(crate) struct TyParamSome { - #[primary_span] - #[label("type parameter `{$param}` must be used as the type parameter for some local type")] - pub span: Span, - #[note("only traits defined in the current crate can be implemented for a type parameter")] - pub note: (), - pub param: Ident, -} - -#[derive(Diagnostic)] -#[diag("type parameter `{$param}` must be used as the type parameter for some local type (e.g., `MyStruct<{$param}>`)", code = E0210)] -#[note( - "implementing a foreign trait is only possible if at least one of the types for which it is implemented is local" -)] -pub(crate) struct TyParamSomeLint { - #[label("type parameter `{$param}` must be used as the type parameter for some local type")] - pub span: Span, - #[note("only traits defined in the current crate can be implemented for a type parameter")] - pub note: (), - pub param: Ident, -} - #[derive(Diagnostic)] pub(crate) enum OnlyCurrentTraits { #[diag("only traits defined in the current crate can be implemented for types defined outside of the crate", code = E0117)] @@ -2048,3 +1982,44 @@ pub(crate) struct PinV2OnPacked { pub pin_v2_span: Option, pub adt_name: Symbol, } + +pub(crate) struct UncoveredTyParam<'tcx> { + pub(crate) param: Ident, + pub(crate) local_ty: Option>, +} + +impl Diagnostic<'_, G> for UncoveredTyParam<'_> { + fn into_diag(self, dcx: DiagCtxtHandle<'_>, level: Level) -> Diag<'_, G> { + let Self { param, local_ty } = self; + + let mut diag = Diag::new(dcx, level, "").with_span(param.span); + if diag.is_error() { + diag.code(E0210); + } + + let note = "implementing a foreign trait is only possible if at least one of the types for which it is implemented is local"; + if let Some(local_ty) = local_ty { + let msg = format!( + "type parameter `{param}` must be covered by another type when it appears before the first local type (`{local_ty}`)" + ); + diag.primary_message(msg.clone()); + diag.span_label(param.span, msg); + diag.note(format!( + "{note}, and no uncovered type parameters appear before that first local type" + )); + diag.note("in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last"); + } else { + let msg = format!( + "type parameter `{param}` must be used as the type parameter for some local type" + ); + diag.primary_message(format!("{msg} (e.g., `MyStruct<{param}>`)")); + diag.span_label(param.span, msg); + diag.note(note); + diag.note( + "only traits defined in the current crate can be implemented for a type parameter", + ); + } + + diag + } +} diff --git a/tests/ui/coherence/orphan-check-alias.classic.stderr b/tests/ui/coherence/orphan-check-alias.classic.stderr index 06b6bd4eb0fd5..87afb0af8f4c4 100644 --- a/tests/ui/coherence/orphan-check-alias.classic.stderr +++ b/tests/ui/coherence/orphan-check-alias.classic.stderr @@ -1,4 +1,4 @@ -warning[E0210]: type parameter `T` must be covered by another type when it appears before the first local type (`B`) +warning: type parameter `T` must be covered by another type when it appears before the first local type (`B`) --> $DIR/orphan-check-alias.rs:21:6 | LL | impl foreign::Trait2 for ::Assoc { @@ -12,4 +12,3 @@ LL | impl foreign::Trait2 for ::Assoc { warning: 1 warning emitted -For more information about this error, try `rustc --explain E0210`. diff --git a/tests/ui/coherence/orphan-check-alias.next.stderr b/tests/ui/coherence/orphan-check-alias.next.stderr index 06b6bd4eb0fd5..87afb0af8f4c4 100644 --- a/tests/ui/coherence/orphan-check-alias.next.stderr +++ b/tests/ui/coherence/orphan-check-alias.next.stderr @@ -1,4 +1,4 @@ -warning[E0210]: type parameter `T` must be covered by another type when it appears before the first local type (`B`) +warning: type parameter `T` must be covered by another type when it appears before the first local type (`B`) --> $DIR/orphan-check-alias.rs:21:6 | LL | impl foreign::Trait2 for ::Assoc { @@ -12,4 +12,3 @@ LL | impl foreign::Trait2 for ::Assoc { warning: 1 warning emitted -For more information about this error, try `rustc --explain E0210`. diff --git a/tests/ui/coherence/orphan-check-projections-not-covering-ambiguity.classic.stderr b/tests/ui/coherence/orphan-check-projections-not-covering-ambiguity.classic.stderr index a000fc2f0bc11..989ed2df24262 100644 --- a/tests/ui/coherence/orphan-check-projections-not-covering-ambiguity.classic.stderr +++ b/tests/ui/coherence/orphan-check-projections-not-covering-ambiguity.classic.stderr @@ -1,4 +1,4 @@ -warning[E0210]: type parameter `T` must be covered by another type when it appears before the first local type (`Local`) +warning: type parameter `T` must be covered by another type when it appears before the first local type (`Local`) --> $DIR/orphan-check-projections-not-covering-ambiguity.rs:25:6 | LL | impl foreign::Trait1 for ::Output {} @@ -12,4 +12,3 @@ LL | impl foreign::Trait1 for ::Output {} warning: 1 warning emitted -For more information about this error, try `rustc --explain E0210`. diff --git a/tests/ui/coherence/orphan-check-projections-not-covering-ambiguity.next.stderr b/tests/ui/coherence/orphan-check-projections-not-covering-ambiguity.next.stderr index a000fc2f0bc11..989ed2df24262 100644 --- a/tests/ui/coherence/orphan-check-projections-not-covering-ambiguity.next.stderr +++ b/tests/ui/coherence/orphan-check-projections-not-covering-ambiguity.next.stderr @@ -1,4 +1,4 @@ -warning[E0210]: type parameter `T` must be covered by another type when it appears before the first local type (`Local`) +warning: type parameter `T` must be covered by another type when it appears before the first local type (`Local`) --> $DIR/orphan-check-projections-not-covering-ambiguity.rs:25:6 | LL | impl foreign::Trait1 for ::Output {} @@ -12,4 +12,3 @@ LL | impl foreign::Trait1 for ::Output {} warning: 1 warning emitted -For more information about this error, try `rustc --explain E0210`. diff --git a/tests/ui/coherence/orphan-check-projections-not-covering-multiple-params.classic.stderr b/tests/ui/coherence/orphan-check-projections-not-covering-multiple-params.classic.stderr index 1d71966b18cb7..6134677a4f9df 100644 --- a/tests/ui/coherence/orphan-check-projections-not-covering-multiple-params.classic.stderr +++ b/tests/ui/coherence/orphan-check-projections-not-covering-multiple-params.classic.stderr @@ -1,4 +1,4 @@ -warning[E0210]: type parameter `T` must be covered by another type when it appears before the first local type (`LocalTy`) +warning: type parameter `T` must be covered by another type when it appears before the first local type (`LocalTy`) --> $DIR/orphan-check-projections-not-covering-multiple-params.rs:17:6 | LL | impl foreign::Trait0 for <() as Trait>::Assoc {} @@ -10,7 +10,7 @@ LL | impl foreign::Trait0 for <() as Trait>::Assoc {} = note: for more information, see issue #124559 = note: `#[warn(uncovered_param_in_projection)]` (part of `#[warn(future_incompatible)]`) on by default -warning[E0210]: type parameter `U` must be covered by another type when it appears before the first local type (`LocalTy`) +warning: type parameter `U` must be covered by another type when it appears before the first local type (`LocalTy`) --> $DIR/orphan-check-projections-not-covering-multiple-params.rs:17:9 | LL | impl foreign::Trait0 for <() as Trait>::Assoc {} @@ -23,4 +23,3 @@ LL | impl foreign::Trait0 for <() as Trait>::Assoc {} warning: 2 warnings emitted -For more information about this error, try `rustc --explain E0210`. diff --git a/tests/ui/coherence/orphan-check-projections-not-covering-multiple-params.next.stderr b/tests/ui/coherence/orphan-check-projections-not-covering-multiple-params.next.stderr index 1d71966b18cb7..6134677a4f9df 100644 --- a/tests/ui/coherence/orphan-check-projections-not-covering-multiple-params.next.stderr +++ b/tests/ui/coherence/orphan-check-projections-not-covering-multiple-params.next.stderr @@ -1,4 +1,4 @@ -warning[E0210]: type parameter `T` must be covered by another type when it appears before the first local type (`LocalTy`) +warning: type parameter `T` must be covered by another type when it appears before the first local type (`LocalTy`) --> $DIR/orphan-check-projections-not-covering-multiple-params.rs:17:6 | LL | impl foreign::Trait0 for <() as Trait>::Assoc {} @@ -10,7 +10,7 @@ LL | impl foreign::Trait0 for <() as Trait>::Assoc {} = note: for more information, see issue #124559 = note: `#[warn(uncovered_param_in_projection)]` (part of `#[warn(future_incompatible)]`) on by default -warning[E0210]: type parameter `U` must be covered by another type when it appears before the first local type (`LocalTy`) +warning: type parameter `U` must be covered by another type when it appears before the first local type (`LocalTy`) --> $DIR/orphan-check-projections-not-covering-multiple-params.rs:17:9 | LL | impl foreign::Trait0 for <() as Trait>::Assoc {} @@ -23,4 +23,3 @@ LL | impl foreign::Trait0 for <() as Trait>::Assoc {} warning: 2 warnings emitted -For more information about this error, try `rustc --explain E0210`. diff --git a/tests/ui/coherence/orphan-check-projections-not-covering.classic.stderr b/tests/ui/coherence/orphan-check-projections-not-covering.classic.stderr index 8ea6496a42d70..9b38c3349f021 100644 --- a/tests/ui/coherence/orphan-check-projections-not-covering.classic.stderr +++ b/tests/ui/coherence/orphan-check-projections-not-covering.classic.stderr @@ -1,4 +1,4 @@ -warning[E0210]: type parameter `T` must be covered by another type when it appears before the first local type (`Local`) +warning: type parameter `T` must be covered by another type when it appears before the first local type (`Local`) --> $DIR/orphan-check-projections-not-covering.rs:22:6 | LL | impl foreign::Trait0 for ::Output {} @@ -10,7 +10,7 @@ LL | impl foreign::Trait0 for ::Output {} = note: for more information, see issue #124559 = note: `#[warn(uncovered_param_in_projection)]` (part of `#[warn(future_incompatible)]`) on by default -warning[E0210]: type parameter `T` must be covered by another type when it appears before the first local type (`Local`) +warning: type parameter `T` must be covered by another type when it appears before the first local type (`Local`) --> $DIR/orphan-check-projections-not-covering.rs:27:6 | LL | impl foreign::Trait0<::Output, Local, T> for Option {} @@ -21,7 +21,7 @@ LL | impl foreign::Trait0<::Output, Local, T> for Option {} = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #124559 -warning[E0210]: type parameter `T` must be covered by another type when it appears before the first local type (`Local`) +warning: type parameter `T` must be covered by another type when it appears before the first local type (`Local`) --> $DIR/orphan-check-projections-not-covering.rs:40:6 | LL | impl foreign::Trait1 for ::Output {} @@ -34,4 +34,3 @@ LL | impl foreign::Trait1 for ::Output {} warning: 3 warnings emitted -For more information about this error, try `rustc --explain E0210`. diff --git a/tests/ui/coherence/orphan-check-projections-not-covering.next.stderr b/tests/ui/coherence/orphan-check-projections-not-covering.next.stderr index 8ea6496a42d70..9b38c3349f021 100644 --- a/tests/ui/coherence/orphan-check-projections-not-covering.next.stderr +++ b/tests/ui/coherence/orphan-check-projections-not-covering.next.stderr @@ -1,4 +1,4 @@ -warning[E0210]: type parameter `T` must be covered by another type when it appears before the first local type (`Local`) +warning: type parameter `T` must be covered by another type when it appears before the first local type (`Local`) --> $DIR/orphan-check-projections-not-covering.rs:22:6 | LL | impl foreign::Trait0 for ::Output {} @@ -10,7 +10,7 @@ LL | impl foreign::Trait0 for ::Output {} = note: for more information, see issue #124559 = note: `#[warn(uncovered_param_in_projection)]` (part of `#[warn(future_incompatible)]`) on by default -warning[E0210]: type parameter `T` must be covered by another type when it appears before the first local type (`Local`) +warning: type parameter `T` must be covered by another type when it appears before the first local type (`Local`) --> $DIR/orphan-check-projections-not-covering.rs:27:6 | LL | impl foreign::Trait0<::Output, Local, T> for Option {} @@ -21,7 +21,7 @@ LL | impl foreign::Trait0<::Output, Local, T> for Option {} = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #124559 -warning[E0210]: type parameter `T` must be covered by another type when it appears before the first local type (`Local`) +warning: type parameter `T` must be covered by another type when it appears before the first local type (`Local`) --> $DIR/orphan-check-projections-not-covering.rs:40:6 | LL | impl foreign::Trait1 for ::Output {} @@ -34,4 +34,3 @@ LL | impl foreign::Trait1 for ::Output {} warning: 3 warnings emitted -For more information about this error, try `rustc --explain E0210`. diff --git a/tests/ui/coherence/orphan-check-projections-unsat-bounds.classic.stderr b/tests/ui/coherence/orphan-check-projections-unsat-bounds.classic.stderr index 1289c65b40d06..360ba7a43c3d0 100644 --- a/tests/ui/coherence/orphan-check-projections-unsat-bounds.classic.stderr +++ b/tests/ui/coherence/orphan-check-projections-unsat-bounds.classic.stderr @@ -1,4 +1,4 @@ -warning[E0210]: type parameter `T` must be covered by another type when it appears before the first local type (`LocalTy`) +warning: type parameter `T` must be covered by another type when it appears before the first local type (`LocalTy`) --> $DIR/orphan-check-projections-unsat-bounds.rs:28:6 | LL | impl foreign::Trait1 for as Discard>::Output @@ -12,4 +12,3 @@ LL | impl foreign::Trait1 for as Discard>::Output warning: 1 warning emitted -For more information about this error, try `rustc --explain E0210`. diff --git a/tests/ui/coherence/orphan-check-projections-unsat-bounds.next.stderr b/tests/ui/coherence/orphan-check-projections-unsat-bounds.next.stderr index 1289c65b40d06..360ba7a43c3d0 100644 --- a/tests/ui/coherence/orphan-check-projections-unsat-bounds.next.stderr +++ b/tests/ui/coherence/orphan-check-projections-unsat-bounds.next.stderr @@ -1,4 +1,4 @@ -warning[E0210]: type parameter `T` must be covered by another type when it appears before the first local type (`LocalTy`) +warning: type parameter `T` must be covered by another type when it appears before the first local type (`LocalTy`) --> $DIR/orphan-check-projections-unsat-bounds.rs:28:6 | LL | impl foreign::Trait1 for as Discard>::Output @@ -12,4 +12,3 @@ LL | impl foreign::Trait1 for as Discard>::Output warning: 1 warning emitted -For more information about this error, try `rustc --explain E0210`. From 47265551eeee286074879f0ae53e3bdc3f63a318 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Le=C3=B3n=20Orell=20Valerian=20Liehr?= Date: Tue, 9 Jun 2026 20:02:38 +0200 Subject: [PATCH 2/2] Slightly tweak the diagnostic for uncovered type parameters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The diagnostic is generally very noisy. This commit tries to make it slightly less cluttered and more legible by 1. stopping to reuse the lengthy primary message as the primary label. This duplication didn't increase the information content and only turned the diagnostic into a letter and symbol soup. Instead, we now pick a succinct label ("uncovered type parameter") that immediately(!) signals to the users in red what is wrong with the highlighted type parameter. 2. breaking some information-dense notes into multiple lines. Finally, this rephrases the slightly awkward and confusing "type parameter […] must be used as a type parameter for […] type" to "type parameter […] must be used as an argument to […] type". --- compiler/rustc_hir_analysis/src/errors.rs | 37 ++++++++++++------- .../invalid-blanket-coerce-unsized-impl.rs | 2 +- ...invalid-blanket-coerce-unsized-impl.stderr | 4 +- .../ui/coherence/coherence-all-remote.stderr | 4 +- .../coherence/coherence-bigint-param.stderr | 8 ++-- .../coherence-cross-crate-conflict.stderr | 4 +- .../coherence-lone-type-parameter.stderr | 4 +- .../impl[t]-foreign-for-fundamental[t].rs | 3 +- .../impl[t]-foreign-for-fundamental[t].stderr | 4 +- ...[t]-foreign[foreign]-for-fundamental[t].rs | 4 +- ...foreign[foreign]-for-fundamental[t].stderr | 8 ++-- .../impl[t]-foreign[foreign]-for-t.rs | 2 +- .../impl[t]-foreign[foreign]-for-t.stderr | 4 +- ...[t]-foreign[fundamental[t]]-for-foreign.rs | 4 +- ...foreign[fundamental[t]]-for-foreign.stderr | 8 ++-- ...eign[fundamental[t]]-for-fundamental[t].rs | 4 +- ...[fundamental[t]]-for-fundamental[t].stderr | 8 ++-- .../impl[t]-foreign[fundamental[t]]-for-t.rs | 4 +- ...pl[t]-foreign[fundamental[t]]-for-t.stderr | 8 ++-- ...n[fundamental[t]_local]-for-foreign.stderr | 16 +++++--- ...]-foreign[local]-for-fundamental[t].stderr | 16 +++++--- .../impl[t]-foreign[local]-for-t.stderr | 8 ++-- .../impl[t]-foreign[t]-for-foreign.rs | 2 +- .../impl[t]-foreign[t]-for-foreign.stderr | 4 +- .../impl[t]-foreign[t]-for-fundamental.rs | 4 +- .../impl[t]-foreign[t]-for-fundamental.stderr | 8 ++-- .../ui/coherence/impl[t]-foreign[t]-for-t.rs | 2 +- .../coherence/impl[t]-foreign[t]-for-t.stderr | 4 +- .../orphan-check-alias.classic.stderr | 8 ++-- .../coherence/orphan-check-alias.next.stderr | 8 ++-- .../ui/coherence/orphan-check-diagnostics.rs | 2 +- .../coherence/orphan-check-diagnostics.stderr | 4 +- ...han-check-opaque-types-not-covering.stderr | 16 +++++--- ...ions-not-covering-ambiguity.classic.stderr | 8 ++-- ...ections-not-covering-ambiguity.next.stderr | 8 ++-- ...ot-covering-multiple-params.classic.stderr | 16 +++++--- ...s-not-covering-multiple-params.next.stderr | 16 +++++--- ...ck-projections-not-covering.classic.stderr | 24 +++++++----- ...check-projections-not-covering.next.stderr | 24 +++++++----- ...ck-projections-unsat-bounds.classic.stderr | 8 ++-- ...check-projections-unsat-bounds.next.stderr | 8 ++-- ...han-check-weak-aliases-not-covering.stderr | 8 ++-- tests/ui/error-codes/e0119/issue-28981.stderr | 4 +- tests/ui/issues/issue-41974.stderr | 4 +- .../fuzzed/fuzzing-ice-134905.rs | 2 +- .../fuzzed/fuzzing-ice-134905.stderr | 4 +- .../specialization/issue-43037.current.stderr | 4 +- .../issue-43037.negative.stderr | 4 +- tests/ui/specialization/issue-43037.rs | 2 +- .../generics-default-stability-where.rs | 2 +- .../generics-default-stability-where.stderr | 4 +- .../ice-119717-constant-lifetime.rs | 2 +- .../ice-119717-constant-lifetime.stderr | 4 +- .../traits/dispatch-from-dyn-blanket-impl.rs | 2 +- .../dispatch-from-dyn-blanket-impl.stderr | 4 +- .../incoherent-assoc-imp-trait.stderr | 4 +- 56 files changed, 225 insertions(+), 167 deletions(-) diff --git a/compiler/rustc_hir_analysis/src/errors.rs b/compiler/rustc_hir_analysis/src/errors.rs index 77a9f44e4d1a5..e40a33d34f808 100644 --- a/compiler/rustc_hir_analysis/src/errors.rs +++ b/compiler/rustc_hir_analysis/src/errors.rs @@ -1992,28 +1992,37 @@ impl Diagnostic<'_, G> for UncoveredTyParam<'_> { fn into_diag(self, dcx: DiagCtxtHandle<'_>, level: Level) -> Diag<'_, G> { let Self { param, local_ty } = self; - let mut diag = Diag::new(dcx, level, "").with_span(param.span); + let mut diag = Diag::new(dcx, level, "") + .with_span(param.span) + .with_span_label(param.span, "uncovered type parameter"); if diag.is_error() { diag.code(E0210); } - let note = "implementing a foreign trait is only possible if at least one of the types for which it is implemented is local"; + let note = "\ + implementing a foreign trait is only possible if \ + at least one of the types for which it is implemented is local"; + if let Some(local_ty) = local_ty { - let msg = format!( - "type parameter `{param}` must be covered by another type when it appears before the first local type (`{local_ty}`)" - ); - diag.primary_message(msg.clone()); - diag.span_label(param.span, msg); + diag.primary_message(format!( + "type parameter `{param}` must be covered by another type when \ + it appears before the first local type (`{local_ty}`)" + )); + diag.note(format!( - "{note}, and no uncovered type parameters appear before that first local type" + "{note},\nand no uncovered type parameters appear before that first local type" )); - diag.note("in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last"); - } else { - let msg = format!( - "type parameter `{param}` must be used as the type parameter for some local type" + diag.note( + "in this case, 'before' refers to the following order: \ + `impl<..> ForeignTrait for T0`,\n\ + where `T0` is the first and `Tn` is the last", ); - diag.primary_message(format!("{msg} (e.g., `MyStruct<{param}>`)")); - diag.span_label(param.span, msg); + } else { + diag.primary_message(format!( + "type parameter `{param}` must be used as an argument to \ + some local type (e.g., `MyStruct<{param}>`)" + )); + diag.note(note); diag.note( "only traits defined in the current crate can be implemented for a type parameter", diff --git a/tests/ui/coercion/invalid-blanket-coerce-unsized-impl.rs b/tests/ui/coercion/invalid-blanket-coerce-unsized-impl.rs index a4fd771071887..29d323790de8e 100644 --- a/tests/ui/coercion/invalid-blanket-coerce-unsized-impl.rs +++ b/tests/ui/coercion/invalid-blanket-coerce-unsized-impl.rs @@ -5,7 +5,7 @@ #![feature(coerce_unsized)] impl std::ops::CoerceUnsized for A {} -//~^ ERROR type parameter `A` must be used as the type parameter for some local type +//~^ ERROR type parameter `A` must be used as an argument to some local type //~| ERROR the trait `CoerceUnsized` may only be implemented for a coercion between structures const C: usize = 1; diff --git a/tests/ui/coercion/invalid-blanket-coerce-unsized-impl.stderr b/tests/ui/coercion/invalid-blanket-coerce-unsized-impl.stderr index 377906ee334a9..60ee317e7f9ee 100644 --- a/tests/ui/coercion/invalid-blanket-coerce-unsized-impl.stderr +++ b/tests/ui/coercion/invalid-blanket-coerce-unsized-impl.stderr @@ -1,8 +1,8 @@ -error[E0210]: type parameter `A` must be used as the type parameter for some local type (e.g., `MyStruct`) +error[E0210]: type parameter `A` must be used as an argument to some local type (e.g., `MyStruct`) --> $DIR/invalid-blanket-coerce-unsized-impl.rs:7:6 | LL | impl std::ops::CoerceUnsized for A {} - | ^ type parameter `A` must be used as the type parameter for some local type + | ^ uncovered type parameter | = 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/tests/ui/coherence/coherence-all-remote.stderr b/tests/ui/coherence/coherence-all-remote.stderr index 0cf9f87b40ac7..f5072451db148 100644 --- a/tests/ui/coherence/coherence-all-remote.stderr +++ b/tests/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`) +error[E0210]: type parameter `T` must be used as an argument to some local type (e.g., `MyStruct`) --> $DIR/coherence-all-remote.rs:6:6 | LL | impl Remote1 for isize { } - | ^ type parameter `T` must be used as the type parameter for some local type + | ^ uncovered type parameter | = 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/tests/ui/coherence/coherence-bigint-param.stderr b/tests/ui/coherence/coherence-bigint-param.stderr index e6c77624a8e8d..0b1570f8fceae 100644 --- a/tests/ui/coherence/coherence-bigint-param.stderr +++ b/tests/ui/coherence/coherence-bigint-param.stderr @@ -2,10 +2,12 @@ error[E0210]: type parameter `T` must be covered by another type when it appears --> $DIR/coherence-bigint-param.rs:8:6 | LL | impl Remote1 for T { } - | ^ type parameter `T` must be covered by another type when it appears before the first local type (`BigInt`) + | ^ uncovered type parameter | - = 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: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last + = 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: 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 1 previous error diff --git a/tests/ui/coherence/coherence-cross-crate-conflict.stderr b/tests/ui/coherence/coherence-cross-crate-conflict.stderr index 812ce97721ccf..887e7e69ccb90 100644 --- a/tests/ui/coherence/coherence-cross-crate-conflict.stderr +++ b/tests/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`) +error[E0210]: type parameter `A` must be used as an argument to some local type (e.g., `MyStruct`) --> $DIR/coherence-cross-crate-conflict.rs:9:6 | LL | impl Foo for A { - | ^ type parameter `A` must be used as the type parameter for some local type + | ^ uncovered type parameter | = 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/tests/ui/coherence/coherence-lone-type-parameter.stderr b/tests/ui/coherence/coherence-lone-type-parameter.stderr index 48d25bba8d714..710b47ad70fd2 100644 --- a/tests/ui/coherence/coherence-lone-type-parameter.stderr +++ b/tests/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`) +error[E0210]: type parameter `T` must be used as an argument to some local type (e.g., `MyStruct`) --> $DIR/coherence-lone-type-parameter.rs:6:6 | LL | impl Remote for T { } - | ^ type parameter `T` must be used as the type parameter for some local type + | ^ uncovered type parameter | = 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/tests/ui/coherence/impl[t]-foreign-for-fundamental[t].rs b/tests/ui/coherence/impl[t]-foreign-for-fundamental[t].rs index d9616b9adda79..036896d631f0d 100644 --- a/tests/ui/coherence/impl[t]-foreign-for-fundamental[t].rs +++ b/tests/ui/coherence/impl[t]-foreign-for-fundamental[t].rs @@ -8,8 +8,7 @@ use std::rc::Rc; struct Local; impl Remote for Box { - //~^ ERROR type parameter `T` must be used as the type parameter for - // | some local type (e.g., `MyStruct`) + //~^ ERROR type parameter `T` must be used as an argument to some local type } fn main() {} diff --git a/tests/ui/coherence/impl[t]-foreign-for-fundamental[t].stderr b/tests/ui/coherence/impl[t]-foreign-for-fundamental[t].stderr index 12d9a807f492d..b48a607802998 100644 --- a/tests/ui/coherence/impl[t]-foreign-for-fundamental[t].stderr +++ b/tests/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`) +error[E0210]: type parameter `T` must be used as an argument to some local type (e.g., `MyStruct`) --> $DIR/impl[t]-foreign-for-fundamental[t].rs:10:6 | LL | impl Remote for Box { - | ^ type parameter `T` must be used as the type parameter for some local type + | ^ uncovered type parameter | = 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/tests/ui/coherence/impl[t]-foreign[foreign]-for-fundamental[t].rs b/tests/ui/coherence/impl[t]-foreign[foreign]-for-fundamental[t].rs index 9d4440ba4866a..76d262eabbfbe 100644 --- a/tests/ui/coherence/impl[t]-foreign[foreign]-for-fundamental[t].rs +++ b/tests/ui/coherence/impl[t]-foreign[foreign]-for-fundamental[t].rs @@ -8,11 +8,11 @@ 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` must be used as an argument to 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` must be used as an argument to some local type } fn main() {} diff --git a/tests/ui/coherence/impl[t]-foreign[foreign]-for-fundamental[t].stderr b/tests/ui/coherence/impl[t]-foreign[foreign]-for-fundamental[t].stderr index 95a20cc5b0f5c..e551534e473b0 100644 --- a/tests/ui/coherence/impl[t]-foreign[foreign]-for-fundamental[t].stderr +++ b/tests/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`) +error[E0210]: type parameter `T` must be used as an argument to some local type (e.g., `MyStruct`) --> $DIR/impl[t]-foreign[foreign]-for-fundamental[t].rs:10:6 | LL | impl Remote1 for Box { - | ^ type parameter `T` must be used as the type parameter for some local type + | ^ uncovered type parameter | = 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`) +error[E0210]: type parameter `T` must be used as an argument to some local type (e.g., `MyStruct`) --> $DIR/impl[t]-foreign[foreign]-for-fundamental[t].rs:14:10 | LL | impl<'a, T> Remote1 for &'a T { - | ^ type parameter `T` must be used as the type parameter for some local type + | ^ uncovered type parameter | = 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/tests/ui/coherence/impl[t]-foreign[foreign]-for-t.rs b/tests/ui/coherence/impl[t]-foreign[foreign]-for-t.rs index 533f0892b98fe..701c1dcaff4c0 100644 --- a/tests/ui/coherence/impl[t]-foreign[foreign]-for-t.rs +++ b/tests/ui/coherence/impl[t]-foreign[foreign]-for-t.rs @@ -8,7 +8,7 @@ use std::rc::Rc; struct Local; impl Remote1 for T { - //~^ ERROR type parameter `T` must be used as the type parameter for some local type + //~^ ERROR type parameter `T` must be used as an argument to some local type } fn main() {} diff --git a/tests/ui/coherence/impl[t]-foreign[foreign]-for-t.stderr b/tests/ui/coherence/impl[t]-foreign[foreign]-for-t.stderr index 6ca3ccd05febc..53481700b65fb 100644 --- a/tests/ui/coherence/impl[t]-foreign[foreign]-for-t.stderr +++ b/tests/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`) +error[E0210]: type parameter `T` must be used as an argument to some local type (e.g., `MyStruct`) --> $DIR/impl[t]-foreign[foreign]-for-t.rs:10:6 | LL | impl Remote1 for T { - | ^ type parameter `T` must be used as the type parameter for some local type + | ^ uncovered type parameter | = 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/tests/ui/coherence/impl[t]-foreign[fundamental[t]]-for-foreign.rs b/tests/ui/coherence/impl[t]-foreign[fundamental[t]]-for-foreign.rs index 02731052a6a96..25f0f51ddd03d 100644 --- a/tests/ui/coherence/impl[t]-foreign[fundamental[t]]-for-foreign.rs +++ b/tests/ui/coherence/impl[t]-foreign[fundamental[t]]-for-foreign.rs @@ -8,11 +8,11 @@ use std::rc::Rc; struct Local; impl Remote1> for u32 { - //~^ ERROR type parameter `T` must be used as the type parameter for some local type + //~^ ERROR type parameter `T` must be used as an argument to some local type } impl<'a, T> Remote1<&'a T> for u32 { - //~^ ERROR type parameter `T` must be used as the type parameter for some local type + //~^ ERROR type parameter `T` must be used as an argument to some local type } fn main() {} diff --git a/tests/ui/coherence/impl[t]-foreign[fundamental[t]]-for-foreign.stderr b/tests/ui/coherence/impl[t]-foreign[fundamental[t]]-for-foreign.stderr index 73b1e2c6ed248..138a8526a283e 100644 --- a/tests/ui/coherence/impl[t]-foreign[fundamental[t]]-for-foreign.stderr +++ b/tests/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`) +error[E0210]: type parameter `T` must be used as an argument to some local type (e.g., `MyStruct`) --> $DIR/impl[t]-foreign[fundamental[t]]-for-foreign.rs:10:6 | LL | impl Remote1> for u32 { - | ^ type parameter `T` must be used as the type parameter for some local type + | ^ uncovered type parameter | = 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`) +error[E0210]: type parameter `T` must be used as an argument to some local type (e.g., `MyStruct`) --> $DIR/impl[t]-foreign[fundamental[t]]-for-foreign.rs:14:10 | LL | impl<'a, T> Remote1<&'a T> for u32 { - | ^ type parameter `T` must be used as the type parameter for some local type + | ^ uncovered type parameter | = 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/tests/ui/coherence/impl[t]-foreign[fundamental[t]]-for-fundamental[t].rs b/tests/ui/coherence/impl[t]-foreign[fundamental[t]]-for-fundamental[t].rs index 7c94fd80af2f2..ffe630c4b9492 100644 --- a/tests/ui/coherence/impl[t]-foreign[fundamental[t]]-for-fundamental[t].rs +++ b/tests/ui/coherence/impl[t]-foreign[fundamental[t]]-for-fundamental[t].rs @@ -8,10 +8,10 @@ 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` must be used as an argument to 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` must be used as an argument to some local type } fn main() {} diff --git a/tests/ui/coherence/impl[t]-foreign[fundamental[t]]-for-fundamental[t].stderr b/tests/ui/coherence/impl[t]-foreign[fundamental[t]]-for-fundamental[t].stderr index 5f89a7aa469c1..72a8a6c14c630 100644 --- a/tests/ui/coherence/impl[t]-foreign[fundamental[t]]-for-fundamental[t].stderr +++ b/tests/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`) +error[E0210]: type parameter `T` must be used as an argument to some local type (e.g., `MyStruct`) --> $DIR/impl[t]-foreign[fundamental[t]]-for-fundamental[t].rs:10:10 | LL | impl<'a, T> Remote1> for &'a T { - | ^ type parameter `T` must be used as the type parameter for some local type + | ^ uncovered type parameter | = 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`) +error[E0210]: type parameter `T` must be used as an argument to some local type (e.g., `MyStruct`) --> $DIR/impl[t]-foreign[fundamental[t]]-for-fundamental[t].rs:13:10 | LL | impl<'a, T> Remote1<&'a T> for Box { - | ^ type parameter `T` must be used as the type parameter for some local type + | ^ uncovered type parameter | = 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/tests/ui/coherence/impl[t]-foreign[fundamental[t]]-for-t.rs b/tests/ui/coherence/impl[t]-foreign[fundamental[t]]-for-t.rs index d998731687c4f..d0deb1cde1ffd 100644 --- a/tests/ui/coherence/impl[t]-foreign[fundamental[t]]-for-t.rs +++ b/tests/ui/coherence/impl[t]-foreign[fundamental[t]]-for-t.rs @@ -8,10 +8,10 @@ use std::rc::Rc; struct Local; impl Remote1> for T { - //~^ ERROR type parameter `T` must be used as the type parameter for some local type + //~^ ERROR type parameter `T` must be used as an argument to some local type } impl<'a, T> Remote1<&'a T> for T { - //~^ ERROR type parameter `T` must be used as the type parameter for some local type + //~^ ERROR type parameter `T` must be used as an argument to some local type } fn main() {} diff --git a/tests/ui/coherence/impl[t]-foreign[fundamental[t]]-for-t.stderr b/tests/ui/coherence/impl[t]-foreign[fundamental[t]]-for-t.stderr index 45559d8b62d37..6c73e9e18ed45 100644 --- a/tests/ui/coherence/impl[t]-foreign[fundamental[t]]-for-t.stderr +++ b/tests/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`) +error[E0210]: type parameter `T` must be used as an argument to some local type (e.g., `MyStruct`) --> $DIR/impl[t]-foreign[fundamental[t]]-for-t.rs:10:6 | LL | impl Remote1> for T { - | ^ type parameter `T` must be used as the type parameter for some local type + | ^ uncovered type parameter | = 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`) +error[E0210]: type parameter `T` must be used as an argument to some local type (e.g., `MyStruct`) --> $DIR/impl[t]-foreign[fundamental[t]]-for-t.rs:13:10 | LL | impl<'a, T> Remote1<&'a T> for T { - | ^ type parameter `T` must be used as the type parameter for some local type + | ^ uncovered type parameter | = 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/tests/ui/coherence/impl[t]-foreign[fundamental[t]_local]-for-foreign.stderr b/tests/ui/coherence/impl[t]-foreign[fundamental[t]_local]-for-foreign.stderr index f94f04c8df5c1..347ca8dea5b1d 100644 --- a/tests/ui/coherence/impl[t]-foreign[fundamental[t]_local]-for-foreign.stderr +++ b/tests/ui/coherence/impl[t]-foreign[fundamental[t]_local]-for-foreign.stderr @@ -2,19 +2,23 @@ error[E0210]: type parameter `T` must be covered by another type when it appears --> $DIR/impl[t]-foreign[fundamental[t]_local]-for-foreign.rs:10:6 | LL | impl Remote2, Local> for u32 { - | ^ type parameter `T` must be covered by another type when it appears before the first local type (`Local`) + | ^ uncovered type parameter | - = 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: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last + = 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: 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 | 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`) + | ^ uncovered type parameter | - = 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: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last + = 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: 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/tests/ui/coherence/impl[t]-foreign[local]-for-fundamental[t].stderr b/tests/ui/coherence/impl[t]-foreign[local]-for-fundamental[t].stderr index e68f2fe585637..48ea6ba0948b5 100644 --- a/tests/ui/coherence/impl[t]-foreign[local]-for-fundamental[t].stderr +++ b/tests/ui/coherence/impl[t]-foreign[local]-for-fundamental[t].stderr @@ -2,19 +2,23 @@ error[E0210]: type parameter `T` must be covered by another type when it appears --> $DIR/impl[t]-foreign[local]-for-fundamental[t].rs:10:6 | LL | impl Remote1 for Box { - | ^ type parameter `T` must be covered by another type when it appears before the first local type (`Local`) + | ^ uncovered type parameter | - = 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: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last + = 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: 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 | LL | impl Remote1 for &T { - | ^ type parameter `T` must be covered by another type when it appears before the first local type (`Local`) + | ^ uncovered type parameter | - = 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: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last + = 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: 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/tests/ui/coherence/impl[t]-foreign[local]-for-t.stderr b/tests/ui/coherence/impl[t]-foreign[local]-for-t.stderr index 1f3463e88371b..09a2fa5b3f99f 100644 --- a/tests/ui/coherence/impl[t]-foreign[local]-for-t.stderr +++ b/tests/ui/coherence/impl[t]-foreign[local]-for-t.stderr @@ -2,10 +2,12 @@ error[E0210]: type parameter `T` must be covered by another type when it appears --> $DIR/impl[t]-foreign[local]-for-t.rs:10:6 | LL | impl Remote1 for T { - | ^ type parameter `T` must be covered by another type when it appears before the first local type (`Local`) + | ^ uncovered type parameter | - = 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: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last + = 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: 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 1 previous error diff --git a/tests/ui/coherence/impl[t]-foreign[t]-for-foreign.rs b/tests/ui/coherence/impl[t]-foreign[t]-for-foreign.rs index c23a2d87a695c..79ad1a5a3a7e1 100644 --- a/tests/ui/coherence/impl[t]-foreign[t]-for-foreign.rs +++ b/tests/ui/coherence/impl[t]-foreign[t]-for-foreign.rs @@ -8,7 +8,7 @@ use std::rc::Rc; struct Local; impl Remote1 for u32 { - //~^ ERROR type parameter `T` must be used as the type parameter for some local type + //~^ ERROR type parameter `T` must be used as an argument to some local type } fn main() {} diff --git a/tests/ui/coherence/impl[t]-foreign[t]-for-foreign.stderr b/tests/ui/coherence/impl[t]-foreign[t]-for-foreign.stderr index a1f3936497e65..b1d8927509be8 100644 --- a/tests/ui/coherence/impl[t]-foreign[t]-for-foreign.stderr +++ b/tests/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`) +error[E0210]: type parameter `T` must be used as an argument to some local type (e.g., `MyStruct`) --> $DIR/impl[t]-foreign[t]-for-foreign.rs:10:6 | LL | impl Remote1 for u32 { - | ^ type parameter `T` must be used as the type parameter for some local type + | ^ uncovered type parameter | = 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/tests/ui/coherence/impl[t]-foreign[t]-for-fundamental.rs b/tests/ui/coherence/impl[t]-foreign[t]-for-fundamental.rs index e9426e5127a04..eed22cfc20d71 100644 --- a/tests/ui/coherence/impl[t]-foreign[t]-for-fundamental.rs +++ b/tests/ui/coherence/impl[t]-foreign[t]-for-fundamental.rs @@ -8,11 +8,11 @@ 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` must be used as an argument to 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` must be used as an argument to some local type } fn main() {} diff --git a/tests/ui/coherence/impl[t]-foreign[t]-for-fundamental.stderr b/tests/ui/coherence/impl[t]-foreign[t]-for-fundamental.stderr index 80fb5dbec8662..022f1caa6914b 100644 --- a/tests/ui/coherence/impl[t]-foreign[t]-for-fundamental.stderr +++ b/tests/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`) +error[E0210]: type parameter `T` must be used as an argument to some local type (e.g., `MyStruct`) --> $DIR/impl[t]-foreign[t]-for-fundamental.rs:10:6 | LL | impl Remote1 for Box { - | ^ type parameter `T` must be used as the type parameter for some local type + | ^ uncovered type parameter | = 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`) +error[E0210]: type parameter `B` must be used as an argument to some local type (e.g., `MyStruct`) --> $DIR/impl[t]-foreign[t]-for-fundamental.rs:14:13 | LL | impl<'a, A, B> Remote1 for &'a B { - | ^ type parameter `B` must be used as the type parameter for some local type + | ^ uncovered type parameter | = 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/tests/ui/coherence/impl[t]-foreign[t]-for-t.rs b/tests/ui/coherence/impl[t]-foreign[t]-for-t.rs index 9c3e82ad762f0..1ffff0b6ff72c 100644 --- a/tests/ui/coherence/impl[t]-foreign[t]-for-t.rs +++ b/tests/ui/coherence/impl[t]-foreign[t]-for-t.rs @@ -8,7 +8,7 @@ use std::rc::Rc; struct Local; impl Remote1 for T { - //~^ ERROR type parameter `T` must be used as the type parameter for some local type + //~^ ERROR type parameter `T` must be used as an argument to some local type } fn main() {} diff --git a/tests/ui/coherence/impl[t]-foreign[t]-for-t.stderr b/tests/ui/coherence/impl[t]-foreign[t]-for-t.stderr index acd84f7115f57..66d5964f9b37d 100644 --- a/tests/ui/coherence/impl[t]-foreign[t]-for-t.stderr +++ b/tests/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`) +error[E0210]: type parameter `T` must be used as an argument to some local type (e.g., `MyStruct`) --> $DIR/impl[t]-foreign[t]-for-t.rs:10:6 | LL | impl Remote1 for T { - | ^ type parameter `T` must be used as the type parameter for some local type + | ^ uncovered type parameter | = 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/tests/ui/coherence/orphan-check-alias.classic.stderr b/tests/ui/coherence/orphan-check-alias.classic.stderr index 87afb0af8f4c4..29e09ff550e9e 100644 --- a/tests/ui/coherence/orphan-check-alias.classic.stderr +++ b/tests/ui/coherence/orphan-check-alias.classic.stderr @@ -2,10 +2,12 @@ warning: type parameter `T` must be covered by another type when it appears befo --> $DIR/orphan-check-alias.rs:21:6 | LL | impl foreign::Trait2 for ::Assoc { - | ^ type parameter `T` must be covered by another type when it appears before the first local type (`B`) + | ^ uncovered type parameter | - = 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: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last + = 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: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, + where `T0` is the first and `Tn` is the last = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #124559 = note: `#[warn(uncovered_param_in_projection)]` (part of `#[warn(future_incompatible)]`) on by default diff --git a/tests/ui/coherence/orphan-check-alias.next.stderr b/tests/ui/coherence/orphan-check-alias.next.stderr index 87afb0af8f4c4..29e09ff550e9e 100644 --- a/tests/ui/coherence/orphan-check-alias.next.stderr +++ b/tests/ui/coherence/orphan-check-alias.next.stderr @@ -2,10 +2,12 @@ warning: type parameter `T` must be covered by another type when it appears befo --> $DIR/orphan-check-alias.rs:21:6 | LL | impl foreign::Trait2 for ::Assoc { - | ^ type parameter `T` must be covered by another type when it appears before the first local type (`B`) + | ^ uncovered type parameter | - = 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: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last + = 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: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, + where `T0` is the first and `Tn` is the last = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #124559 = note: `#[warn(uncovered_param_in_projection)]` (part of `#[warn(future_incompatible)]`) on by default diff --git a/tests/ui/coherence/orphan-check-diagnostics.rs b/tests/ui/coherence/orphan-check-diagnostics.rs index 4b6557fc9c8e9..39c5d6258b77d 100644 --- a/tests/ui/coherence/orphan-check-diagnostics.rs +++ b/tests/ui/coherence/orphan-check-diagnostics.rs @@ -9,6 +9,6 @@ use orphan_check_diagnostics::RemoteTrait; trait LocalTrait { fn dummy(&self) { } } impl RemoteTrait for T where T: LocalTrait {} -//~^ ERROR type parameter `T` must be used as the type parameter for some local type +//~^ ERROR type parameter `T` must be used as an argument to some local type fn main() {} diff --git a/tests/ui/coherence/orphan-check-diagnostics.stderr b/tests/ui/coherence/orphan-check-diagnostics.stderr index b9fa7baf4c276..cd154d38d86e0 100644 --- a/tests/ui/coherence/orphan-check-diagnostics.stderr +++ b/tests/ui/coherence/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`) +error[E0210]: type parameter `T` must be used as an argument to some local type (e.g., `MyStruct`) --> $DIR/orphan-check-diagnostics.rs:11:6 | LL | impl RemoteTrait for T where T: LocalTrait {} - | ^ type parameter `T` must be used as the type parameter for some local type + | ^ uncovered type parameter | = 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/tests/ui/coherence/orphan-check-opaque-types-not-covering.stderr b/tests/ui/coherence/orphan-check-opaque-types-not-covering.stderr index 6203742b47c0a..2c67ec0ad2478 100644 --- a/tests/ui/coherence/orphan-check-opaque-types-not-covering.stderr +++ b/tests/ui/coherence/orphan-check-opaque-types-not-covering.stderr @@ -2,19 +2,23 @@ error[E0210]: type parameter `T` must be covered by another type when it appears --> $DIR/orphan-check-opaque-types-not-covering.rs:15:6 | LL | impl foreign::Trait0 for Identity {} - | ^ type parameter `T` must be covered by another type when it appears before the first local type (`Local`) + | ^ uncovered type parameter | - = 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: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last + = 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: 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/orphan-check-opaque-types-not-covering.rs:25:6 | LL | impl foreign::Trait1 for Opaque {} - | ^ type parameter `T` must be covered by another type when it appears before the first local type (`Local`) + | ^ uncovered type parameter | - = 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: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last + = 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: 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/tests/ui/coherence/orphan-check-projections-not-covering-ambiguity.classic.stderr b/tests/ui/coherence/orphan-check-projections-not-covering-ambiguity.classic.stderr index 989ed2df24262..635d9e6619004 100644 --- a/tests/ui/coherence/orphan-check-projections-not-covering-ambiguity.classic.stderr +++ b/tests/ui/coherence/orphan-check-projections-not-covering-ambiguity.classic.stderr @@ -2,10 +2,12 @@ warning: type parameter `T` must be covered by another type when it appears befo --> $DIR/orphan-check-projections-not-covering-ambiguity.rs:25:6 | LL | impl foreign::Trait1 for ::Output {} - | ^ type parameter `T` must be covered by another type when it appears before the first local type (`Local`) + | ^ uncovered type parameter | - = 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: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last + = 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: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, + where `T0` is the first and `Tn` is the last = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #124559 = note: `#[warn(uncovered_param_in_projection)]` (part of `#[warn(future_incompatible)]`) on by default diff --git a/tests/ui/coherence/orphan-check-projections-not-covering-ambiguity.next.stderr b/tests/ui/coherence/orphan-check-projections-not-covering-ambiguity.next.stderr index 989ed2df24262..635d9e6619004 100644 --- a/tests/ui/coherence/orphan-check-projections-not-covering-ambiguity.next.stderr +++ b/tests/ui/coherence/orphan-check-projections-not-covering-ambiguity.next.stderr @@ -2,10 +2,12 @@ warning: type parameter `T` must be covered by another type when it appears befo --> $DIR/orphan-check-projections-not-covering-ambiguity.rs:25:6 | LL | impl foreign::Trait1 for ::Output {} - | ^ type parameter `T` must be covered by another type when it appears before the first local type (`Local`) + | ^ uncovered type parameter | - = 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: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last + = 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: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, + where `T0` is the first and `Tn` is the last = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #124559 = note: `#[warn(uncovered_param_in_projection)]` (part of `#[warn(future_incompatible)]`) on by default diff --git a/tests/ui/coherence/orphan-check-projections-not-covering-multiple-params.classic.stderr b/tests/ui/coherence/orphan-check-projections-not-covering-multiple-params.classic.stderr index 6134677a4f9df..e75d4e61772f1 100644 --- a/tests/ui/coherence/orphan-check-projections-not-covering-multiple-params.classic.stderr +++ b/tests/ui/coherence/orphan-check-projections-not-covering-multiple-params.classic.stderr @@ -2,10 +2,12 @@ warning: type parameter `T` must be covered by another type when it appears befo --> $DIR/orphan-check-projections-not-covering-multiple-params.rs:17:6 | LL | impl foreign::Trait0 for <() as Trait>::Assoc {} - | ^ type parameter `T` must be covered by another type when it appears before the first local type (`LocalTy`) + | ^ uncovered type parameter | - = 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: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last + = 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: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, + where `T0` is the first and `Tn` is the last = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #124559 = note: `#[warn(uncovered_param_in_projection)]` (part of `#[warn(future_incompatible)]`) on by default @@ -14,10 +16,12 @@ warning: type parameter `U` must be covered by another type when it appears befo --> $DIR/orphan-check-projections-not-covering-multiple-params.rs:17:9 | LL | impl foreign::Trait0 for <() as Trait>::Assoc {} - | ^ type parameter `U` must be covered by another type when it appears before the first local type (`LocalTy`) + | ^ uncovered type parameter | - = 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: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last + = 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: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, + where `T0` is the first and `Tn` is the last = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #124559 diff --git a/tests/ui/coherence/orphan-check-projections-not-covering-multiple-params.next.stderr b/tests/ui/coherence/orphan-check-projections-not-covering-multiple-params.next.stderr index 6134677a4f9df..e75d4e61772f1 100644 --- a/tests/ui/coherence/orphan-check-projections-not-covering-multiple-params.next.stderr +++ b/tests/ui/coherence/orphan-check-projections-not-covering-multiple-params.next.stderr @@ -2,10 +2,12 @@ warning: type parameter `T` must be covered by another type when it appears befo --> $DIR/orphan-check-projections-not-covering-multiple-params.rs:17:6 | LL | impl foreign::Trait0 for <() as Trait>::Assoc {} - | ^ type parameter `T` must be covered by another type when it appears before the first local type (`LocalTy`) + | ^ uncovered type parameter | - = 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: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last + = 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: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, + where `T0` is the first and `Tn` is the last = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #124559 = note: `#[warn(uncovered_param_in_projection)]` (part of `#[warn(future_incompatible)]`) on by default @@ -14,10 +16,12 @@ warning: type parameter `U` must be covered by another type when it appears befo --> $DIR/orphan-check-projections-not-covering-multiple-params.rs:17:9 | LL | impl foreign::Trait0 for <() as Trait>::Assoc {} - | ^ type parameter `U` must be covered by another type when it appears before the first local type (`LocalTy`) + | ^ uncovered type parameter | - = 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: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last + = 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: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, + where `T0` is the first and `Tn` is the last = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #124559 diff --git a/tests/ui/coherence/orphan-check-projections-not-covering.classic.stderr b/tests/ui/coherence/orphan-check-projections-not-covering.classic.stderr index 9b38c3349f021..6d1a3114937af 100644 --- a/tests/ui/coherence/orphan-check-projections-not-covering.classic.stderr +++ b/tests/ui/coherence/orphan-check-projections-not-covering.classic.stderr @@ -2,10 +2,12 @@ warning: type parameter `T` must be covered by another type when it appears befo --> $DIR/orphan-check-projections-not-covering.rs:22:6 | LL | impl foreign::Trait0 for ::Output {} - | ^ type parameter `T` must be covered by another type when it appears before the first local type (`Local`) + | ^ uncovered type parameter | - = 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: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last + = 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: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, + where `T0` is the first and `Tn` is the last = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #124559 = note: `#[warn(uncovered_param_in_projection)]` (part of `#[warn(future_incompatible)]`) on by default @@ -14,10 +16,12 @@ warning: type parameter `T` must be covered by another type when it appears befo --> $DIR/orphan-check-projections-not-covering.rs:27:6 | LL | impl foreign::Trait0<::Output, Local, T> for Option {} - | ^ type parameter `T` must be covered by another type when it appears before the first local type (`Local`) + | ^ uncovered type parameter | - = 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: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last + = 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: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, + where `T0` is the first and `Tn` is the last = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #124559 @@ -25,10 +29,12 @@ warning: type parameter `T` must be covered by another type when it appears befo --> $DIR/orphan-check-projections-not-covering.rs:40:6 | LL | impl foreign::Trait1 for ::Output {} - | ^ type parameter `T` must be covered by another type when it appears before the first local type (`Local`) + | ^ uncovered type parameter | - = 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: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last + = 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: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, + where `T0` is the first and `Tn` is the last = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #124559 diff --git a/tests/ui/coherence/orphan-check-projections-not-covering.next.stderr b/tests/ui/coherence/orphan-check-projections-not-covering.next.stderr index 9b38c3349f021..6d1a3114937af 100644 --- a/tests/ui/coherence/orphan-check-projections-not-covering.next.stderr +++ b/tests/ui/coherence/orphan-check-projections-not-covering.next.stderr @@ -2,10 +2,12 @@ warning: type parameter `T` must be covered by another type when it appears befo --> $DIR/orphan-check-projections-not-covering.rs:22:6 | LL | impl foreign::Trait0 for ::Output {} - | ^ type parameter `T` must be covered by another type when it appears before the first local type (`Local`) + | ^ uncovered type parameter | - = 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: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last + = 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: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, + where `T0` is the first and `Tn` is the last = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #124559 = note: `#[warn(uncovered_param_in_projection)]` (part of `#[warn(future_incompatible)]`) on by default @@ -14,10 +16,12 @@ warning: type parameter `T` must be covered by another type when it appears befo --> $DIR/orphan-check-projections-not-covering.rs:27:6 | LL | impl foreign::Trait0<::Output, Local, T> for Option {} - | ^ type parameter `T` must be covered by another type when it appears before the first local type (`Local`) + | ^ uncovered type parameter | - = 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: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last + = 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: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, + where `T0` is the first and `Tn` is the last = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #124559 @@ -25,10 +29,12 @@ warning: type parameter `T` must be covered by another type when it appears befo --> $DIR/orphan-check-projections-not-covering.rs:40:6 | LL | impl foreign::Trait1 for ::Output {} - | ^ type parameter `T` must be covered by another type when it appears before the first local type (`Local`) + | ^ uncovered type parameter | - = 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: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last + = 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: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, + where `T0` is the first and `Tn` is the last = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #124559 diff --git a/tests/ui/coherence/orphan-check-projections-unsat-bounds.classic.stderr b/tests/ui/coherence/orphan-check-projections-unsat-bounds.classic.stderr index 360ba7a43c3d0..9021a4757b851 100644 --- a/tests/ui/coherence/orphan-check-projections-unsat-bounds.classic.stderr +++ b/tests/ui/coherence/orphan-check-projections-unsat-bounds.classic.stderr @@ -2,10 +2,12 @@ warning: type parameter `T` must be covered by another type when it appears befo --> $DIR/orphan-check-projections-unsat-bounds.rs:28:6 | LL | impl foreign::Trait1 for as Discard>::Output - | ^ type parameter `T` must be covered by another type when it appears before the first local type (`LocalTy`) + | ^ uncovered type parameter | - = 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: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last + = 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: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, + where `T0` is the first and `Tn` is the last = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #124559 = note: `#[warn(uncovered_param_in_projection)]` (part of `#[warn(future_incompatible)]`) on by default diff --git a/tests/ui/coherence/orphan-check-projections-unsat-bounds.next.stderr b/tests/ui/coherence/orphan-check-projections-unsat-bounds.next.stderr index 360ba7a43c3d0..9021a4757b851 100644 --- a/tests/ui/coherence/orphan-check-projections-unsat-bounds.next.stderr +++ b/tests/ui/coherence/orphan-check-projections-unsat-bounds.next.stderr @@ -2,10 +2,12 @@ warning: type parameter `T` must be covered by another type when it appears befo --> $DIR/orphan-check-projections-unsat-bounds.rs:28:6 | LL | impl foreign::Trait1 for as Discard>::Output - | ^ type parameter `T` must be covered by another type when it appears before the first local type (`LocalTy`) + | ^ uncovered type parameter | - = 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: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last + = 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: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, + where `T0` is the first and `Tn` is the last = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #124559 = note: `#[warn(uncovered_param_in_projection)]` (part of `#[warn(future_incompatible)]`) on by default diff --git a/tests/ui/coherence/orphan-check-weak-aliases-not-covering.stderr b/tests/ui/coherence/orphan-check-weak-aliases-not-covering.stderr index df915141a769f..37f6684692564 100644 --- a/tests/ui/coherence/orphan-check-weak-aliases-not-covering.stderr +++ b/tests/ui/coherence/orphan-check-weak-aliases-not-covering.stderr @@ -2,10 +2,12 @@ error[E0210]: type parameter `T` must be covered by another type when it appears --> $DIR/orphan-check-weak-aliases-not-covering.rs:13:6 | LL | impl foreign::Trait1 for Identity {} - | ^ type parameter `T` must be covered by another type when it appears before the first local type (`Local`) + | ^ uncovered type parameter | - = 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: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last + = 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: 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 1 previous error diff --git a/tests/ui/error-codes/e0119/issue-28981.stderr b/tests/ui/error-codes/e0119/issue-28981.stderr index be3e4aea51a1a..13d18697378f3 100644 --- a/tests/ui/error-codes/e0119/issue-28981.stderr +++ b/tests/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`) +error[E0210]: type parameter `Foo` must be used as an argument to some local type (e.g., `MyStruct`) --> $DIR/issue-28981.rs:5:6 | LL | impl Deref for Foo { } - | ^^^ type parameter `Foo` must be used as the type parameter for some local type + | ^^^ uncovered type parameter | = 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/tests/ui/issues/issue-41974.stderr b/tests/ui/issues/issue-41974.stderr index e249db9df5324..2ae073dd1ba82 100644 --- a/tests/ui/issues/issue-41974.stderr +++ b/tests/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`) +error[E0210]: type parameter `T` must be used as an argument to some local type (e.g., `MyStruct`) --> $DIR/issue-41974.rs:7:6 | LL | impl Drop for T where T: A { - | ^ type parameter `T` must be used as the type parameter for some local type + | ^ uncovered type parameter | = 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/tests/ui/specialization/fuzzed/fuzzing-ice-134905.rs b/tests/ui/specialization/fuzzed/fuzzing-ice-134905.rs index f0a40efde19e7..3eeed016f8a63 100644 --- a/tests/ui/specialization/fuzzed/fuzzing-ice-134905.rs +++ b/tests/ui/specialization/fuzzed/fuzzing-ice-134905.rs @@ -15,7 +15,7 @@ where trait Check {} impl<'a, T> Eq for T where >::Ty: Valid {} -//~^ ERROR type parameter `T` must be used as the type parameter for some local type +//~^ ERROR type parameter `T` must be used as an argument to some local type trait Valid {} diff --git a/tests/ui/specialization/fuzzed/fuzzing-ice-134905.stderr b/tests/ui/specialization/fuzzed/fuzzing-ice-134905.stderr index 5db98e73af60c..79117229300ae 100644 --- a/tests/ui/specialization/fuzzed/fuzzing-ice-134905.stderr +++ b/tests/ui/specialization/fuzzed/fuzzing-ice-134905.stderr @@ -15,11 +15,11 @@ note: required by a bound in `Iterate::Ty` LL | type Ty: Valid; | ^^^^^ required by this bound in `Iterate::Ty` -error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) +error[E0210]: type parameter `T` must be used as an argument to some local type (e.g., `MyStruct`) --> $DIR/fuzzing-ice-134905.rs:17:10 | LL | impl<'a, T> Eq for T where >::Ty: Valid {} - | ^ type parameter `T` must be used as the type parameter for some local type + | ^ uncovered type parameter | = 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/tests/ui/specialization/issue-43037.current.stderr b/tests/ui/specialization/issue-43037.current.stderr index 2711350925716..caa1354c22cc9 100644 --- a/tests/ui/specialization/issue-43037.current.stderr +++ b/tests/ui/specialization/issue-43037.current.stderr @@ -1,8 +1,8 @@ -error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) +error[E0210]: type parameter `T` must be used as an argument to some local type (e.g., `MyStruct`) --> $DIR/issue-43037.rs:19:6 | LL | impl From< as Z>::Assoc> for T {} - | ^ type parameter `T` must be used as the type parameter for some local type + | ^ uncovered type parameter | = 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/tests/ui/specialization/issue-43037.negative.stderr b/tests/ui/specialization/issue-43037.negative.stderr index 2711350925716..caa1354c22cc9 100644 --- a/tests/ui/specialization/issue-43037.negative.stderr +++ b/tests/ui/specialization/issue-43037.negative.stderr @@ -1,8 +1,8 @@ -error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) +error[E0210]: type parameter `T` must be used as an argument to some local type (e.g., `MyStruct`) --> $DIR/issue-43037.rs:19:6 | LL | impl From< as Z>::Assoc> for T {} - | ^ type parameter `T` must be used as the type parameter for some local type + | ^ uncovered type parameter | = 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/tests/ui/specialization/issue-43037.rs b/tests/ui/specialization/issue-43037.rs index fb9a581369e6c..b4603230a47b9 100644 --- a/tests/ui/specialization/issue-43037.rs +++ b/tests/ui/specialization/issue-43037.rs @@ -17,6 +17,6 @@ impl Z for A { // this impl is invalid, but causes an ICE anyway impl From< as Z>::Assoc> for T {} -//~^ ERROR type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) +//~^ ERROR type parameter `T` must be used as an argument to some local type (e.g., `MyStruct`) fn main() {} diff --git a/tests/ui/stability-attribute/generics-default-stability-where.rs b/tests/ui/stability-attribute/generics-default-stability-where.rs index a7bc1756d78a4..578c20dfdee83 100644 --- a/tests/ui/stability-attribute/generics-default-stability-where.rs +++ b/tests/ui/stability-attribute/generics-default-stability-where.rs @@ -5,7 +5,7 @@ extern crate unstable_generic_param; use unstable_generic_param::*; impl Trait3 for T where T: Trait2 { //~ ERROR use of unstable library feature `unstable_default` -//~^ ERROR `T` must be used as the type parameter for some local type +//~^ ERROR `T` must be used as an argument to some local type fn foo() -> usize { T::foo() } } diff --git a/tests/ui/stability-attribute/generics-default-stability-where.stderr b/tests/ui/stability-attribute/generics-default-stability-where.stderr index 9437f5d65fac2..ca4414aa9e004 100644 --- a/tests/ui/stability-attribute/generics-default-stability-where.stderr +++ b/tests/ui/stability-attribute/generics-default-stability-where.stderr @@ -7,11 +7,11 @@ LL | impl Trait3 for T where T: Trait2 { = help: add `#![feature(unstable_default)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) +error[E0210]: type parameter `T` must be used as an argument to some local type (e.g., `MyStruct`) --> $DIR/generics-default-stability-where.rs:7:6 | LL | impl Trait3 for T where T: Trait2 { - | ^ type parameter `T` must be used as the type parameter for some local type + | ^ uncovered type parameter | = 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/tests/ui/traits/const-traits/ice-119717-constant-lifetime.rs b/tests/ui/traits/const-traits/ice-119717-constant-lifetime.rs index af552ac0c5e71..8a6efda6e9b41 100644 --- a/tests/ui/traits/const-traits/ice-119717-constant-lifetime.rs +++ b/tests/ui/traits/const-traits/ice-119717-constant-lifetime.rs @@ -4,7 +4,7 @@ use std::ops::FromResidual; impl const FromResidual for T { - //~^ ERROR type parameter `T` must be used as the type parameter for some local type + //~^ ERROR type parameter `T` must be used as an argument to some local type fn from_residual(t: T) -> _ { //~^ ERROR the placeholder `_` is not allowed t diff --git a/tests/ui/traits/const-traits/ice-119717-constant-lifetime.stderr b/tests/ui/traits/const-traits/ice-119717-constant-lifetime.stderr index 08fc73fe77b4d..1d1805a1d1a9f 100644 --- a/tests/ui/traits/const-traits/ice-119717-constant-lifetime.stderr +++ b/tests/ui/traits/const-traits/ice-119717-constant-lifetime.stderr @@ -1,8 +1,8 @@ -error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) +error[E0210]: type parameter `T` must be used as an argument to some local type (e.g., `MyStruct`) --> $DIR/ice-119717-constant-lifetime.rs:6:6 | LL | impl const FromResidual for T { - | ^ type parameter `T` must be used as the type parameter for some local type + | ^ uncovered type parameter | = 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/tests/ui/traits/dispatch-from-dyn-blanket-impl.rs b/tests/ui/traits/dispatch-from-dyn-blanket-impl.rs index 4e0e7ca9793f8..6b169cbcc41fa 100644 --- a/tests/ui/traits/dispatch-from-dyn-blanket-impl.rs +++ b/tests/ui/traits/dispatch-from-dyn-blanket-impl.rs @@ -4,7 +4,7 @@ #![feature(dispatch_from_dyn)] impl std::ops::DispatchFromDyn for T {} -//~^ ERROR type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) +//~^ ERROR type parameter `T` must be used as an argument to some local type (e.g., `MyStruct`) //~| ERROR the trait `DispatchFromDyn` may only be implemented for a coercion between structures fn main() {} diff --git a/tests/ui/traits/dispatch-from-dyn-blanket-impl.stderr b/tests/ui/traits/dispatch-from-dyn-blanket-impl.stderr index 69f360817805a..68e6e5bea4732 100644 --- a/tests/ui/traits/dispatch-from-dyn-blanket-impl.stderr +++ b/tests/ui/traits/dispatch-from-dyn-blanket-impl.stderr @@ -1,8 +1,8 @@ -error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) +error[E0210]: type parameter `T` must be used as an argument to some local type (e.g., `MyStruct`) --> $DIR/dispatch-from-dyn-blanket-impl.rs:6:6 | LL | impl std::ops::DispatchFromDyn for T {} - | ^ type parameter `T` must be used as the type parameter for some local type + | ^ uncovered type parameter | = 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/tests/ui/type-alias-impl-trait/incoherent-assoc-imp-trait.stderr b/tests/ui/type-alias-impl-trait/incoherent-assoc-imp-trait.stderr index f0cf681d8bb72..8127b1a8df201 100644 --- a/tests/ui/type-alias-impl-trait/incoherent-assoc-imp-trait.stderr +++ b/tests/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`) +error[E0210]: type parameter `F` must be used as an argument to some local type (e.g., `MyStruct`) --> $DIR/incoherent-assoc-imp-trait.rs:10:6 | LL | impl FnOnce<()> for &F { - | ^ type parameter `F` must be used as the type parameter for some local type + | ^ uncovered type parameter | = 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