diff --git a/compiler/rustc_borrowck/src/diagnostics/opaque_types.rs b/compiler/rustc_borrowck/src/diagnostics/opaque_types.rs index 259330611c483..590c2c9c3965b 100644 --- a/compiler/rustc_borrowck/src/diagnostics/opaque_types.rs +++ b/compiler/rustc_borrowck/src/diagnostics/opaque_types.rs @@ -12,8 +12,8 @@ use rustc_middle::ty::{ Unnormalized, }; use rustc_span::Span; +use rustc_trait_selection::diagnostics::impl_trait_overcapture_suggestion; use rustc_trait_selection::error_reporting::infer::region::unexpected_hidden_region_diagnostic; -use rustc_trait_selection::errors::impl_trait_overcapture_suggestion; use crate::MirBorrowckCtxt; use crate::borrow_set::BorrowData; diff --git a/compiler/rustc_hir_analysis/src/coherence/orphan.rs b/compiler/rustc_hir_analysis/src/coherence/orphan.rs index 7042849c11bfd..d49326a089c90 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, + diagnostics::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") @@ -458,56 +472,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(diagnostics::TyParamFirstLocal { - span, - note: (), - param: name, - local_type, - }), - None => { - tcx.dcx().emit_err(diagnostics::TyParamSome { span, note: (), param: name }) - } - }); + guar.get_or_insert(tcx.dcx().emit_err(diagnostics::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, - diagnostics::TyParamFirstLocalLint { span, note: (), param: name, local_type }, - ), - None => tcx.emit_node_span_lint( - UNCOVERED_PARAM_IN_PROJECTION, - hir_id, - span, - diagnostics::TyParamSomeLint { span, note: (), param: name }, - ), - }; - } -} - struct UncoveredTyParamCollector<'cx, 'tcx> { infcx: &'cx InferCtxt<'tcx>, uncovered_params: FxIndexSet, diff --git a/compiler/rustc_hir_analysis/src/diagnostics.rs b/compiler/rustc_hir_analysis/src/diagnostics.rs index d969f9761d132..5997f16b42917 100644 --- a/compiler/rustc_hir_analysis/src/diagnostics.rs +++ b/compiler/rustc_hir_analysis/src/diagnostics.rs @@ -1474,72 +1474,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)] @@ -2024,3 +1958,53 @@ 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) + .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"; + + if let Some(local_ty) = local_ty { + 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},\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`,\n\ + where `T0` is the first and `Tn` is the last", + ); + } 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", + ); + } + + diag + } +} diff --git a/compiler/rustc_lint/src/impl_trait_overcaptures.rs b/compiler/rustc_lint/src/impl_trait_overcaptures.rs index 76d55030b1312..842a9be7093a7 100644 --- a/compiler/rustc_lint/src/impl_trait_overcaptures.rs +++ b/compiler/rustc_lint/src/impl_trait_overcaptures.rs @@ -23,7 +23,7 @@ use rustc_middle::{bug, span_bug}; use rustc_session::lint::fcw; use rustc_session::{declare_lint, declare_lint_pass}; use rustc_span::{Span, Symbol}; -use rustc_trait_selection::errors::{ +use rustc_trait_selection::diagnostics::{ AddPreciseCapturingForOvercapture, impl_trait_overcapture_suggestion, }; use rustc_trait_selection::regions::OutlivesEnvironmentBuildExt; diff --git a/compiler/rustc_mir_transform/src/check_call_recursion.rs b/compiler/rustc_mir_transform/src/check_call_recursion.rs index b47e7bd168678..216ada600ce34 100644 --- a/compiler/rustc_mir_transform/src/check_call_recursion.rs +++ b/compiler/rustc_mir_transform/src/check_call_recursion.rs @@ -10,7 +10,7 @@ use rustc_middle::ty::{self, GenericArg, GenericArgs, Instance, Ty, TyCtxt, Unno use rustc_session::lint::builtin::UNCONDITIONAL_RECURSION; use rustc_span::Span; -use crate::errors::UnconditionalRecursion; +use crate::diagnostics::UnconditionalRecursion; use crate::pass_manager::MirLint; pub(super) struct CheckCallRecursion; diff --git a/compiler/rustc_mir_transform/src/check_const_item_mutation.rs b/compiler/rustc_mir_transform/src/check_const_item_mutation.rs index 8545704cb6a34..f1876bafbf79b 100644 --- a/compiler/rustc_mir_transform/src/check_const_item_mutation.rs +++ b/compiler/rustc_mir_transform/src/check_const_item_mutation.rs @@ -6,7 +6,7 @@ use rustc_session::lint::builtin::CONST_ITEM_MUTATION; use rustc_span::Span; use rustc_span::def_id::DefId; -use crate::errors; +use crate::diagnostics; pub(super) struct CheckConstItemMutation; @@ -108,7 +108,7 @@ impl<'tcx> Visitor<'tcx> for ConstMutationChecker<'_, 'tcx> { CONST_ITEM_MUTATION, lint_root, span, - errors::ConstMutate::Modify { konst: item }, + diagnostics::ConstMutate::Modify { konst: item }, ); } @@ -154,7 +154,7 @@ impl<'tcx> Visitor<'tcx> for ConstMutationChecker<'_, 'tcx> { CONST_ITEM_MUTATION, lint_root, span, - errors::ConstMutate::MutBorrow { method_call, konst: item }, + diagnostics::ConstMutate::MutBorrow { method_call, konst: item }, ); } } diff --git a/compiler/rustc_mir_transform/src/check_inline.rs b/compiler/rustc_mir_transform/src/check_inline.rs index 50ef94f623dc5..c267fb171fba5 100644 --- a/compiler/rustc_mir_transform/src/check_inline.rs +++ b/compiler/rustc_mir_transform/src/check_inline.rs @@ -26,7 +26,7 @@ impl<'tcx> MirLint<'tcx> for CheckForceInline { if let Err(reason) = is_inline_valid_on_fn(tcx, def_id).and_then(|_| is_inline_valid_on_body(tcx, body)) { - tcx.dcx().emit_err(crate::errors::InvalidForceInline { + tcx.dcx().emit_err(crate::diagnostics::InvalidForceInline { attr_span, callee_span: tcx.def_span(def_id), callee: tcx.def_path_str(def_id), diff --git a/compiler/rustc_mir_transform/src/check_packed_ref.rs b/compiler/rustc_mir_transform/src/check_packed_ref.rs index 9ce244a00fcec..fd87587b8f9ce 100644 --- a/compiler/rustc_mir_transform/src/check_packed_ref.rs +++ b/compiler/rustc_mir_transform/src/check_packed_ref.rs @@ -3,7 +3,7 @@ use rustc_middle::mir::*; use rustc_middle::span_bug; use rustc_middle::ty::{self, TyCtxt}; -use crate::{errors, util}; +use crate::{diagnostics, util}; pub(super) struct CheckPackedRef; @@ -50,7 +50,7 @@ impl<'tcx> Visitor<'tcx> for PackedRefChecker<'_, 'tcx> { // shouldn't do. span_bug!(self.source_info.span, "builtin derive created an unaligned reference"); } else { - self.tcx.dcx().emit_err(errors::UnalignedPackedRef { + self.tcx.dcx().emit_err(diagnostics::UnalignedPackedRef { span: self.source_info.span, ty_descr: adt.descr(), align: pack.bytes(), diff --git a/compiler/rustc_mir_transform/src/coroutine/layout.rs b/compiler/rustc_mir_transform/src/coroutine/layout.rs index be8402f082e62..7262d44dcab99 100644 --- a/compiler/rustc_mir_transform/src/coroutine/layout.rs +++ b/compiler/rustc_mir_transform/src/coroutine/layout.rs @@ -46,7 +46,7 @@ use rustc_trait_selection::infer::TyCtxtInferExt as _; use rustc_trait_selection::traits::{ObligationCause, ObligationCauseCode, ObligationCtxt}; use tracing::{debug, instrument, trace}; -use crate::errors::{MustNotSupend, MustNotSuspendReason}; +use crate::diagnostics::{MustNotSupend, MustNotSuspendReason}; const SELF_ARG: Local = Local::arg(0); diff --git a/compiler/rustc_mir_transform/src/errors.rs b/compiler/rustc_mir_transform/src/diagnostics.rs similarity index 100% rename from compiler/rustc_mir_transform/src/errors.rs rename to compiler/rustc_mir_transform/src/diagnostics.rs diff --git a/compiler/rustc_mir_transform/src/ffi_unwind_calls.rs b/compiler/rustc_mir_transform/src/ffi_unwind_calls.rs index 06e7bf974b515..1d90d282a62b9 100644 --- a/compiler/rustc_mir_transform/src/ffi_unwind_calls.rs +++ b/compiler/rustc_mir_transform/src/ffi_unwind_calls.rs @@ -9,7 +9,7 @@ use rustc_session::lint::builtin::FFI_UNWIND_CALLS; use rustc_target::spec::PanicStrategy; use tracing::debug; -use crate::errors; +use crate::diagnostics; // Check if the body of this def_id can possibly leak a foreign unwind into Rust code. fn has_ffi_unwind_calls(tcx: TyCtxt<'_>, local_def_id: LocalDefId) -> bool { @@ -67,7 +67,7 @@ fn has_ffi_unwind_calls(tcx: TyCtxt<'_>, local_def_id: LocalDefId) -> bool { FFI_UNWIND_CALLS, lint_root, span, - errors::AsmUnwindCall { span }, + diagnostics::AsmUnwindCall { span }, ); tainted = true; @@ -119,7 +119,7 @@ fn has_ffi_unwind_calls(tcx: TyCtxt<'_>, local_def_id: LocalDefId) -> bool { FFI_UNWIND_CALLS, lint_root, span, - errors::FfiUnwindCall { span, foreign }, + diagnostics::FfiUnwindCall { span, foreign }, ); tainted = true; diff --git a/compiler/rustc_mir_transform/src/function_item_references.rs b/compiler/rustc_mir_transform/src/function_item_references.rs index 71c9b79d682df..ca1aeedf10180 100644 --- a/compiler/rustc_mir_transform/src/function_item_references.rs +++ b/compiler/rustc_mir_transform/src/function_item_references.rs @@ -7,7 +7,7 @@ use rustc_middle::ty::{self, EarlyBinder, GenericArgsRef, Ty, TyCtxt}; use rustc_session::lint::builtin::FUNCTION_ITEM_REFERENCES; use rustc_span::{Span, Spanned, sym}; -use crate::errors; +use crate::diagnostics; pub(super) struct FunctionItemReferences; @@ -179,7 +179,7 @@ impl<'tcx> FunctionItemRefChecker<'_, 'tcx> { FUNCTION_ITEM_REFERENCES, lint_root, span, - errors::FnItemRef { span, sugg, ident }, + diagnostics::FnItemRef { span, sugg, ident }, ); } } diff --git a/compiler/rustc_mir_transform/src/inline.rs b/compiler/rustc_mir_transform/src/inline.rs index f234166be24a6..bfd200884b676 100644 --- a/compiler/rustc_mir_transform/src/inline.rs +++ b/compiler/rustc_mir_transform/src/inline.rs @@ -253,7 +253,7 @@ impl<'tcx> Inliner<'tcx> for ForceInliner<'tcx> { let call_span = callsite.source_info.span; let callee = tcx.def_path_str(callsite.callee.def_id()); - tcx.dcx().emit_err(crate::errors::ForceInlineFailure { + tcx.dcx().emit_err(crate::diagnostics::ForceInlineFailure { call_span, attr_span, caller_span: tcx.def_span(self.def_id), @@ -262,7 +262,7 @@ impl<'tcx> Inliner<'tcx> for ForceInliner<'tcx> { callee: callee.clone(), reason, justification: justification - .map(|sym| crate::errors::ForceInlineJustification { sym, callee }), + .map(|sym| crate::diagnostics::ForceInlineJustification { sym, callee }), }); } } diff --git a/compiler/rustc_mir_transform/src/known_panics_lint.rs b/compiler/rustc_mir_transform/src/known_panics_lint.rs index ff5006032308e..cd8dc963eb33c 100644 --- a/compiler/rustc_mir_transform/src/known_panics_lint.rs +++ b/compiler/rustc_mir_transform/src/known_panics_lint.rs @@ -22,7 +22,7 @@ use rustc_middle::ty::{self, ConstInt, ScalarInt, Ty, TyCtxt, TypeVisitableExt, use rustc_span::Span; use tracing::{debug, instrument, trace}; -use crate::errors::{AssertLint, AssertLintKind}; +use crate::diagnostics::{AssertLint, AssertLintKind}; pub(super) struct KnownPanicsLint; diff --git a/compiler/rustc_mir_transform/src/lib.rs b/compiler/rustc_mir_transform/src/lib.rs index b783cc2d5933b..edf0dcca775ca 100644 --- a/compiler/rustc_mir_transform/src/lib.rs +++ b/compiler/rustc_mir_transform/src/lib.rs @@ -40,8 +40,8 @@ mod check_pointers; mod cost_checker; mod cross_crate_inline; mod deduce_param_attrs; +mod diagnostics; mod elaborate_drop; -mod errors; mod ffi_unwind_calls; mod lint; mod lint_tail_expr_drop_order; diff --git a/compiler/rustc_mir_transform/src/lint_and_remove_uninhabited.rs b/compiler/rustc_mir_transform/src/lint_and_remove_uninhabited.rs index 0b46ba6ffc747..81e98585995fd 100644 --- a/compiler/rustc_mir_transform/src/lint_and_remove_uninhabited.rs +++ b/compiler/rustc_mir_transform/src/lint_and_remove_uninhabited.rs @@ -3,7 +3,7 @@ use rustc_middle::mir::*; use rustc_middle::ty::TyCtxt; use rustc_session::lint::builtin::UNREACHABLE_CODE; -use crate::errors::UnreachableDueToUninhabited; +use crate::diagnostics::UnreachableDueToUninhabited; /// Lint unreachable code due to uninhabited values from function calls, /// and remove return edges from those calls. diff --git a/compiler/rustc_mir_transform/src/liveness.rs b/compiler/rustc_mir_transform/src/liveness.rs index c449cf6867395..795b0b9cac82e 100644 --- a/compiler/rustc_mir_transform/src/liveness.rs +++ b/compiler/rustc_mir_transform/src/liveness.rs @@ -19,7 +19,7 @@ use rustc_span::Span; use rustc_span::edit_distance::find_best_match_for_name; use rustc_span::symbol::{Symbol, kw, sym}; -use crate::errors; +use crate::diagnostics; #[derive(Copy, Clone, Debug, PartialEq, Eq)] enum AccessKind { @@ -175,7 +175,7 @@ fn maybe_suggest_unit_pattern_typo<'tcx>( name: Symbol, span: Span, ty: Ty<'tcx>, -) -> Option { +) -> Option { if let ty::Adt(adt_def, _) = ty.peel_refs().kind() { let variant_names: Vec<_> = adt_def .variants() @@ -189,7 +189,7 @@ fn maybe_suggest_unit_pattern_typo<'tcx>( .iter() .find(|v| v.name == name && matches!(v.ctor, Some((CtorKind::Const, _)))) { - return Some(errors::PatternTypo { + return Some(diagnostics::PatternTypo { span, code: with_no_trimmed_paths!(tcx.def_path_str(variant.def_id)), kind: tcx.def_descr(variant.def_id), @@ -213,7 +213,7 @@ fn maybe_suggest_unit_pattern_typo<'tcx>( && let Some(position) = names.iter().position(|&n| n == item_name) && let Some(&def_id) = constants.get(position) { - return Some(errors::PatternTypo { + return Some(diagnostics::PatternTypo { span, code: with_no_trimmed_paths!(tcx.def_path_str(def_id)), kind: "constant", @@ -275,7 +275,7 @@ fn annotate_mut_binding_to_immutable_binding<'tcx>( body_def_id: LocalDefId, assignment_span: Span, body: &Body<'tcx>, -) -> Option { +) -> Option { use rustc_hir as hir; use rustc_hir::intravisit::{self, Visitor}; @@ -316,7 +316,7 @@ fn annotate_mut_binding_to_immutable_binding<'tcx>( Some(mut_ty.ty.span.shrink_to_lo()) }; - return Some(errors::UnusedAssignSuggestion { + return Some(diagnostics::UnusedAssignSuggestion { ty_span, pre, // Span of the `mut` before the binding. @@ -939,7 +939,7 @@ impl<'a, 'tcx> AssignmentResult<'a, 'tcx> { .split(&brace_name) .any(|c| matches!(c.chars().next(), Some('}' | ':'))) }) - .map(|&(lit, _)| errors::UnusedVariableStringInterp { lit }) + .map(|&(lit, _)| diagnostics::UnusedVariableStringInterp { lit }) .collect::>() }; @@ -997,16 +997,16 @@ impl<'a, 'tcx> AssignmentResult<'a, 'tcx> { } let sugg = if from_macro { - errors::UnusedVariableSugg::NoSugg { span: def_span, name } + diagnostics::UnusedVariableSugg::NoSugg { span: def_span, name } } else { let typo = maybe_suggest_typo(); - errors::UnusedVariableSugg::TryPrefix { spans: vec![def_span], name, typo } + diagnostics::UnusedVariableSugg::TryPrefix { spans: vec![def_span], name, typo } }; tcx.emit_node_span_lint( lint::builtin::UNUSED_VARIABLES, hir_id, def_span, - errors::UnusedVariable { + diagnostics::UnusedVariable { name, string_interp: maybe_suggest_literal_matching_name(name), sugg, @@ -1056,7 +1056,7 @@ impl<'a, 'tcx> AssignmentResult<'a, 'tcx> { lint::builtin::UNUSED_VARIABLES, hir_id, def_span, - errors::UnusedVarAssignedOnly { name, typo }, + diagnostics::UnusedVarAssignedOnly { name, typo }, ); continue; } @@ -1067,7 +1067,7 @@ impl<'a, 'tcx> AssignmentResult<'a, 'tcx> { let any_shorthand = introductions.iter().any(|intro| intro.is_shorthand); let sugg = if any_shorthand { - errors::UnusedVariableSugg::TryIgnore { + diagnostics::UnusedVariableSugg::TryIgnore { name: name.to_ident_string(), shorthands: introductions .iter() @@ -1085,20 +1085,20 @@ impl<'a, 'tcx> AssignmentResult<'a, 'tcx> { .collect(), } } else if from_macro { - errors::UnusedVariableSugg::NoSugg { span: def_span, name } + diagnostics::UnusedVariableSugg::NoSugg { span: def_span, name } } else if !introductions.is_empty() { let typo = maybe_suggest_typo(); - errors::UnusedVariableSugg::TryPrefix { name, typo, spans: spans.clone() } + diagnostics::UnusedVariableSugg::TryPrefix { name, typo, spans: spans.clone() } } else { let typo = maybe_suggest_typo(); - errors::UnusedVariableSugg::TryPrefix { name, typo, spans: vec![def_span] } + diagnostics::UnusedVariableSugg::TryPrefix { name, typo, spans: vec![def_span] } }; tcx.emit_node_span_lint( lint::builtin::UNUSED_VARIABLES, hir_id, spans, - errors::UnusedVariable { + diagnostics::UnusedVariable { name, string_interp: maybe_suggest_literal_matching_name(name), sugg, @@ -1147,7 +1147,7 @@ impl<'a, 'tcx> AssignmentResult<'a, 'tcx> { .rfind(|(_, overwrite_location)| { location.is_predecessor_of(*overwrite_location, self.body) }) - .map(|&(overwrite_span, _)| errors::UnusedAssignOverwrite { + .map(|&(overwrite_span, _)| diagnostics::UnusedAssignOverwrite { assigned_span: source_info.span, overwrite_span, name, @@ -1190,20 +1190,20 @@ impl<'a, 'tcx> AssignmentResult<'a, 'tcx> { lint::builtin::UNUSED_ASSIGNMENTS, hir_id, source_info.span, - errors::UnusedAssign { name, overwrite, help, suggestion }, + diagnostics::UnusedAssign { name, overwrite, help, suggestion }, ) } AccessKind::Param => tcx.emit_node_span_lint( lint::builtin::UNUSED_ASSIGNMENTS, hir_id, source_info.span, - errors::UnusedAssignPassed { name }, + diagnostics::UnusedAssignPassed { name }, ), AccessKind::Capture => tcx.emit_node_span_lint( lint::builtin::UNUSED_ASSIGNMENTS, hir_id, decl_span, - errors::UnusedCaptureMaybeCaptureRef { name }, + diagnostics::UnusedCaptureMaybeCaptureRef { name }, ), } } diff --git a/compiler/rustc_mir_transform/src/pass_manager.rs b/compiler/rustc_mir_transform/src/pass_manager.rs index fbf16f91610c5..72af7b846861e 100644 --- a/compiler/rustc_mir_transform/src/pass_manager.rs +++ b/compiler/rustc_mir_transform/src/pass_manager.rs @@ -9,7 +9,7 @@ use rustc_session::Session; use tracing::trace; use crate::lint::lint_body; -use crate::{errors, validate}; +use crate::{diagnostics, validate}; thread_local! { /// Maps MIR pass names to a snake case form to match profiling naming style @@ -255,14 +255,14 @@ fn run_passes_inner<'tcx>( let mut unknown_found = false; for &name in named_passes.difference(&*crate::PASS_NAMES) { - tcx.dcx().emit_warn(errors::UnknownPassName { name }); + tcx.dcx().emit_warn(diagnostics::UnknownPassName { name }); unknown_found = true; } if unknown_found { let mut valid_pass_names = crate::PASS_NAMES.iter().copied().collect::>(); valid_pass_names.sort(); - tcx.dcx().emit_note(errors::ValidPassNames { valid_passes: valid_pass_names.into() }); + tcx.dcx().emit_note(diagnostics::ValidPassNames { valid_passes: valid_pass_names.into() }); } // Verify that no passes are missing from the `declare_passes` invocation diff --git a/compiler/rustc_trait_selection/src/errors.rs b/compiler/rustc_trait_selection/src/diagnostics.rs similarity index 100% rename from compiler/rustc_trait_selection/src/errors.rs rename to compiler/rustc_trait_selection/src/diagnostics.rs diff --git a/compiler/rustc_trait_selection/src/errors/note_and_explain.rs b/compiler/rustc_trait_selection/src/diagnostics/note_and_explain.rs similarity index 100% rename from compiler/rustc_trait_selection/src/errors/note_and_explain.rs rename to compiler/rustc_trait_selection/src/diagnostics/note_and_explain.rs diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs index dc5b9b2ccb1eb..e9d47835d2ad0 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs @@ -72,11 +72,11 @@ use rustc_span::{BytePos, DUMMY_SP, DesugaringKind, Pos, Span, sym}; use thin_vec::ThinVec; use tracing::{debug, instrument}; +use crate::diagnostics::{ObligationCauseFailureCode, TypeErrorAdditionalDiags}; use crate::error_reporting::TypeErrCtxt; use crate::error_reporting::traits::ambiguity::{ CandidateSource, compute_applicable_impls_for_diagnostics, }; -use crate::errors::{ObligationCauseFailureCode, TypeErrorAdditionalDiags}; use crate::infer; use crate::infer::relate::{self, RelateResult, TypeRelation}; use crate::infer::{InferCtxt, InferCtxtExt as _, TypeTrace, ValuePairs}; diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/need_type_info.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/need_type_info.rs index e075be19693cb..2aea9e5bcf369 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/infer/need_type_info.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/infer/need_type_info.rs @@ -23,11 +23,11 @@ use rustc_span::{BytePos, DUMMY_SP, Ident, Span, sym}; use tracing::{debug, instrument, warn}; use super::nice_region_error::placeholder_error::Highlighted; -use crate::error_reporting::TypeErrCtxt; -use crate::errors::{ +use crate::diagnostics::{ AmbiguousImpl, AmbiguousReturn, AnnotationRequired, InferenceBadError, SourceKindMultiSuggestion, SourceKindSubdiag, }; +use crate::error_reporting::TypeErrCtxt; use crate::infer::{InferCtxt, TyOrConstInferVar}; pub enum TypeAnnotationNeeded { diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/different_lifetimes.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/different_lifetimes.rs index 9cb58a9d45bd7..e315f53cad7fb 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/different_lifetimes.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/different_lifetimes.rs @@ -7,10 +7,10 @@ use rustc_hir::def_id::LocalDefId; use rustc_middle::ty::{Region, TyCtxt}; use tracing::debug; +use crate::diagnostics::{AddLifetimeParamsSuggestion, LifetimeMismatch, LifetimeMismatchLabels}; use crate::error_reporting::infer::nice_region_error::NiceRegionError; use crate::error_reporting::infer::nice_region_error::find_anon_type::find_anon_type; use crate::error_reporting::infer::nice_region_error::util::AnonymousParamInfo; -use crate::errors::{AddLifetimeParamsSuggestion, LifetimeMismatch, LifetimeMismatchLabels}; use crate::infer::{RegionResolutionError, SubregionOrigin}; impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/mismatched_static_lifetime.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/mismatched_static_lifetime.rs index 4422980051afb..e8a9e929d6a5d 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/mismatched_static_lifetime.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/mismatched_static_lifetime.rs @@ -9,11 +9,11 @@ use rustc_middle::bug; use rustc_middle::ty::TypeVisitor; use tracing::debug; -use crate::error_reporting::infer::nice_region_error::NiceRegionError; -use crate::errors::{ +use crate::diagnostics::{ DoesNotOutliveStaticFromImpl, ImplicitStaticLifetimeSubdiag, IntroducesStaticBecauseUnmetLifetimeReq, MismatchedStaticLifetime, note_and_explain, }; +use crate::error_reporting::infer::nice_region_error::NiceRegionError; use crate::infer::{RegionResolutionError, SubregionOrigin, TypeTrace}; use crate::traits::ObligationCauseCode; diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/named_anon_conflict.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/named_anon_conflict.rs index ad8cc5d279af1..f555f0435dd8f 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/named_anon_conflict.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/named_anon_conflict.rs @@ -5,9 +5,9 @@ use rustc_errors::Diag; use rustc_middle::ty; use tracing::debug; +use crate::diagnostics::ExplicitLifetimeRequired; use crate::error_reporting::infer::nice_region_error::NiceRegionError; use crate::error_reporting::infer::nice_region_error::find_anon_type::find_anon_type; -use crate::errors::ExplicitLifetimeRequired; impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { /// When given a `ConcreteFailure` for a function with parameters containing a named region and diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs index fdbf4cf228de9..31bd3b32e76d8 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs @@ -10,11 +10,11 @@ use rustc_middle::ty::print::{FmtPrinter, Print, PrintTraitRefExt as _, RegionHi use rustc_middle::ty::{self, GenericArgsRef, RePlaceholder, Region, TyCtxt}; use tracing::{debug, instrument}; -use crate::error_reporting::infer::nice_region_error::NiceRegionError; -use crate::errors::{ +use crate::diagnostics::{ ActualImplExpectedKind, ActualImplExpectedLifetimeKind, ActualImplExplNotes, TraitPlaceholderMismatch, TyOrSig, }; +use crate::error_reporting::infer::nice_region_error::NiceRegionError; use crate::infer::{RegionResolutionError, SubregionOrigin, TypeTrace, ValuePairs}; use crate::traits::{ObligationCause, ObligationCauseCode}; diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_relation.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_relation.rs index 05a1e3fe95dd9..97101fe8f6884 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_relation.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_relation.rs @@ -3,8 +3,8 @@ use rustc_errors::Diag; use rustc_middle::bug; use rustc_middle::ty::{self, RePlaceholder, Region}; +use crate::diagnostics::PlaceholderRelationLfNotSatisfied; use crate::error_reporting::infer::nice_region_error::NiceRegionError; -use crate::errors::PlaceholderRelationLfNotSatisfied; use crate::infer::{RegionResolutionError, SubregionOrigin}; impl<'tcx> NiceRegionError<'_, 'tcx> { diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/static_impl_trait.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/static_impl_trait.rs index b227cd065eab9..dfa0d4a3bfd48 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/static_impl_trait.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/static_impl_trait.rs @@ -13,8 +13,8 @@ use rustc_span::def_id::LocalDefId; use rustc_span::{Ident, Span}; use tracing::debug; +use crate::diagnostics::ButNeedsToSatisfy; use crate::error_reporting::infer::nice_region_error::NiceRegionError; -use crate::errors::ButNeedsToSatisfy; use crate::infer::{RegionResolutionError, SubregionOrigin}; impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/trait_impl_difference.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/trait_impl_difference.rs index 7e6f566e242a3..eb0b9a0234275 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/trait_impl_difference.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/trait_impl_difference.rs @@ -14,9 +14,9 @@ use rustc_middle::ty::{self, TyCtxt, TypeVisitable}; use rustc_span::{Ident, Span}; use tracing::debug; +use crate::diagnostics::{ConsiderBorrowingParamHelp, TraitImplDiff}; use crate::error_reporting::infer::nice_region_error::NiceRegionError; use crate::error_reporting::infer::nice_region_error::placeholder_error::Highlighted; -use crate::errors::{ConsiderBorrowingParamHelp, TraitImplDiff}; use crate::infer::{RegionResolutionError, ValuePairs}; impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/region.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/region.rs index 9d2eb42496e2f..f6ef59918af0c 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/infer/region.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/infer/region.rs @@ -19,12 +19,12 @@ use tracing::{debug, instrument}; use super::ObligationCauseAsDiagArg; use super::nice_region_error::find_anon_type; -use crate::error_reporting::TypeErrCtxt; -use crate::error_reporting::infer::ObligationCauseExt; -use crate::errors::{ +use crate::diagnostics::{ self, FulfillReqLifetime, LfBoundNotSatisfied, OutlivesBound, OutlivesContent, RefLongerThanData, RegionOriginNote, WhereClauseSuggestions, note_and_explain, }; +use crate::error_reporting::TypeErrCtxt; +use crate::error_reporting::infer::ObligationCauseExt; use crate::infer::region_constraints::GenericKind; use crate::infer::{ BoundRegionConversionTime, InferCtxt, RegionResolutionError, RegionVariableOrigin, @@ -1276,7 +1276,7 @@ pub fn unexpected_hidden_region_diagnostic<'a, 'tcx>( opaque_ty_key: ty::OpaqueTypeKey<'tcx>, ) -> Diag<'a> { let tcx = infcx.tcx; - let mut err = infcx.dcx().create_err(errors::OpaqueCapturesLifetime { + let mut err = infcx.dcx().create_err(diagnostics::OpaqueCapturesLifetime { span, opaque_ty: Ty::new_opaque(tcx, opaque_ty_key.def_id.to_def_id(), opaque_ty_key.args), opaque_ty_span: tcx.def_span(opaque_ty_key.def_id), @@ -1389,7 +1389,12 @@ fn suggest_precise_capturing<'tcx>( (span.with_hi(span.hi() - BytePos(1)).shrink_to_hi(), "", "") }; - diag.subdiagnostic(errors::AddPreciseCapturing::Existing { span, new_lifetime, pre, post }); + diag.subdiagnostic(diagnostics::AddPreciseCapturing::Existing { + span, + new_lifetime, + pre, + post, + }); } else { let mut captured_lifetimes = FxIndexSet::default(); let mut captured_non_lifetimes = FxIndexSet::default(); @@ -1437,7 +1442,7 @@ fn suggest_precise_capturing<'tcx>( .collect::>() .join(", "); - diag.subdiagnostic(errors::AddPreciseCapturing::New { + diag.subdiagnostic(diagnostics::AddPreciseCapturing::New { span: tcx.def_span(opaque_def_id).shrink_to_hi(), new_lifetime, concatenated_bounds, @@ -1504,7 +1509,7 @@ fn suggest_precise_capturing<'tcx>( format!(" + use<{concatenated_bounds}>"), )); - diag.subdiagnostic(errors::AddPreciseCapturingAndParams { + diag.subdiagnostic(diagnostics::AddPreciseCapturingAndParams { suggs, new_lifetime, apit_spans, diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/suggest.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/suggest.rs index 224be68bbcd10..72982a69f9275 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/infer/suggest.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/infer/suggest.rs @@ -17,13 +17,13 @@ use rustc_middle::ty::{ use rustc_span::{Span, sym}; use tracing::debug; -use crate::error_reporting::TypeErrCtxt; -use crate::error_reporting::infer::hir::Path; -use crate::errors::{ +use crate::diagnostics::{ ConsiderAddingAwait, FnConsiderCasting, FnConsiderCastingBoth, FnItemsAreDistinct, FnUniqTypes, FunctionPointerSuggestion, SuggestAccessingField, SuggestRemoveSemiOrReturnBinding, SuggestTuplePatternMany, SuggestTuplePatternOne, TypeErrorAdditionalDiags, }; +use crate::error_reporting::TypeErrCtxt; +use crate::error_reporting::infer::hir::Path; #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] enum StatementAsExpression { diff --git a/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs b/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs index 051604c94c445..aa414dc6fedb6 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs @@ -39,10 +39,12 @@ use tracing::{debug, instrument}; use super::suggestions::get_explanation_based_on_obligation; use super::{ArgKind, CandidateSimilarity, GetSafeTransmuteErrorAndReason, ImplCandidate}; +use crate::diagnostics::{ + ClosureFnMutLabel, ClosureFnOnceLabel, ClosureKindMismatch, CoroClosureNotFn, +}; use crate::error_reporting::TypeErrCtxt; use crate::error_reporting::infer::TyCategory; use crate::error_reporting::traits::report_dyn_incompatibility; -use crate::errors::{ClosureFnMutLabel, ClosureFnOnceLabel, ClosureKindMismatch, CoroClosureNotFn}; use crate::infer::{self, InferCtxt, InferCtxtExt as _}; use crate::traits::query::evaluate_obligation::InferCtxtExt as _; use crate::traits::{ diff --git a/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs b/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs index 6594fac09af76..0849215c13404 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs @@ -48,8 +48,8 @@ use super::{ DefIdOrName, FindExprBySpan, ImplCandidate, Obligation, ObligationCause, ObligationCauseCode, PredicateObligation, }; +use crate::diagnostics; use crate::error_reporting::TypeErrCtxt; -use crate::errors; use crate::infer::InferCtxtExt as _; use crate::traits::query::evaluate_obligation::InferCtxtExt as _; use crate::traits::{ImplDerivedCause, NormalizeExt, ObligationCtxt, SelectionContext}; @@ -6119,11 +6119,11 @@ fn hint_missing_borrow<'tcx>( } if !to_borrow.is_empty() { - err.subdiagnostic(errors::AdjustSignatureBorrow::Borrow { to_borrow }); + err.subdiagnostic(diagnostics::AdjustSignatureBorrow::Borrow { to_borrow }); } if !remove_borrow.is_empty() { - err.subdiagnostic(errors::AdjustSignatureBorrow::RemoveBorrow { remove_borrow }); + err.subdiagnostic(diagnostics::AdjustSignatureBorrow::RemoveBorrow { remove_borrow }); } } diff --git a/compiler/rustc_trait_selection/src/lib.rs b/compiler/rustc_trait_selection/src/lib.rs index c1a0dcf5aa4c2..9f1bfc018f3a2 100644 --- a/compiler/rustc_trait_selection/src/lib.rs +++ b/compiler/rustc_trait_selection/src/lib.rs @@ -25,8 +25,8 @@ #![recursion_limit = "512"] // For rustdoc // tidy-alphabetical-end +pub mod diagnostics; pub mod error_reporting; -pub mod errors; pub mod infer; pub mod opaque_types; pub mod regions; diff --git a/compiler/rustc_trait_selection/src/opaque_types.rs b/compiler/rustc_trait_selection/src/opaque_types.rs index 28b9bf21eee59..9606efe4a3d8b 100644 --- a/compiler/rustc_trait_selection/src/opaque_types.rs +++ b/compiler/rustc_trait_selection/src/opaque_types.rs @@ -9,7 +9,7 @@ use rustc_middle::ty::{ }; use rustc_span::{ErrorGuaranteed, Span}; -use crate::errors::NonGenericOpaqueTypeParam; +use crate::diagnostics::NonGenericOpaqueTypeParam; use crate::regions::OutlivesEnvironmentBuildExt; use crate::traits::ObligationCtxt; diff --git a/compiler/rustc_trait_selection/src/traits/auto_trait.rs b/compiler/rustc_trait_selection/src/traits/auto_trait.rs index 3a58dbaf1ec8d..5331773e58bed 100644 --- a/compiler/rustc_trait_selection/src/traits/auto_trait.rs +++ b/compiler/rustc_trait_selection/src/traits/auto_trait.rs @@ -13,7 +13,7 @@ use rustc_span::DUMMY_SP; use tracing::debug; use super::*; -use crate::errors::UnableToConstructConstantValue; +use crate::diagnostics::UnableToConstructConstantValue; use crate::infer::TypeFreshener; use crate::infer::region_constraints::{ConstraintKind, RegionConstraintData}; use crate::regions::OutlivesEnvironmentBuildExt; diff --git a/compiler/rustc_trait_selection/src/traits/project.rs b/compiler/rustc_trait_selection/src/traits/project.rs index cc802a6342807..e267d18515a40 100644 --- a/compiler/rustc_trait_selection/src/traits/project.rs +++ b/compiler/rustc_trait_selection/src/traits/project.rs @@ -25,7 +25,7 @@ use super::{ PredicateObligation, ProjectionCacheEntry, ProjectionCacheKey, Selection, SelectionContext, SelectionError, specialization_graph, translate_args, util, }; -use crate::errors::InherentProjectionNormalizationOverflow; +use crate::diagnostics::InherentProjectionNormalizationOverflow; use crate::infer::{BoundRegionConversionTime, InferOk}; use crate::traits::normalize::{normalize_with_depth, normalize_with_depth_to}; use crate::traits::query::evaluate_obligation::InferCtxtExt as _; diff --git a/compiler/rustc_trait_selection/src/traits/specialize/mod.rs b/compiler/rustc_trait_selection/src/traits/specialize/mod.rs index 164d01a3285e6..506d38c17bc9a 100644 --- a/compiler/rustc_trait_selection/src/traits/specialize/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/specialize/mod.rs @@ -28,8 +28,8 @@ use rustc_span::{DUMMY_SP, ErrorGuaranteed, Span, sym}; use specialization_graph::GraphExt; use tracing::{debug, instrument}; +use crate::diagnostics::NegativePositiveConflict; use crate::error_reporting::traits::to_pretty_impl_header; -use crate::errors::NegativePositiveConflict; use crate::infer::{InferCtxt, TyCtxtInferExt}; use crate::traits::select::IntercrateAmbiguityCause; use crate::traits::{ 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 06b6bd4eb0fd5..29e09ff550e9e 100644 --- a/tests/ui/coherence/orphan-check-alias.classic.stderr +++ b/tests/ui/coherence/orphan-check-alias.classic.stderr @@ -1,15 +1,16 @@ -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 { - | ^ 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 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..29e09ff550e9e 100644 --- a/tests/ui/coherence/orphan-check-alias.next.stderr +++ b/tests/ui/coherence/orphan-check-alias.next.stderr @@ -1,15 +1,16 @@ -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 { - | ^ 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 warning: 1 warning emitted -For more information about this error, try `rustc --explain E0210`. 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 a000fc2f0bc11..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 @@ -1,15 +1,16 @@ -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 {} - | ^ 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 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..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 @@ -1,15 +1,16 @@ -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 {} - | ^ 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 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..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 @@ -1,26 +1,29 @@ -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 {} - | ^ 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 -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 {} - | ^ 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 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..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 @@ -1,26 +1,29 @@ -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 {} - | ^ 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 -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 {} - | ^ 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 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..6d1a3114937af 100644 --- a/tests/ui/coherence/orphan-check-projections-not-covering.classic.stderr +++ b/tests/ui/coherence/orphan-check-projections-not-covering.classic.stderr @@ -1,37 +1,42 @@ -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 {} - | ^ 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 -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 {} - | ^ 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 -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 {} - | ^ 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 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..6d1a3114937af 100644 --- a/tests/ui/coherence/orphan-check-projections-not-covering.next.stderr +++ b/tests/ui/coherence/orphan-check-projections-not-covering.next.stderr @@ -1,37 +1,42 @@ -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 {} - | ^ 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 -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 {} - | ^ 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 -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 {} - | ^ 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 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..9021a4757b851 100644 --- a/tests/ui/coherence/orphan-check-projections-unsat-bounds.classic.stderr +++ b/tests/ui/coherence/orphan-check-projections-unsat-bounds.classic.stderr @@ -1,15 +1,16 @@ -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 - | ^ 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 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..9021a4757b851 100644 --- a/tests/ui/coherence/orphan-check-projections-unsat-bounds.next.stderr +++ b/tests/ui/coherence/orphan-check-projections-unsat-bounds.next.stderr @@ -1,15 +1,16 @@ -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 - | ^ 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 warning: 1 warning emitted -For more information about this error, try `rustc --explain E0210`. 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