diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index 8ec1272e360e3..bac3f974ccae9 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -2011,7 +2011,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { ExprKind::Underscore => { if self.tcx.features().generic_arg_infer() { let ct_kind = hir::ConstArgKind::Infer(self.lower_span(c.value.span)); - self.arena.alloc(hir::ConstArg { hir_id: self.next_id(), kind: ct_kind }) + self.arena + .alloc(hir::ConstArg { hir_id: self.lower_node_id(c.id), kind: ct_kind }) } else { feature_err( &self.tcx.sess, diff --git a/compiler/rustc_ast_passes/src/feature_gate.rs b/compiler/rustc_ast_passes/src/feature_gate.rs index 8cdc7133cc070..bfe7625e85ba2 100644 --- a/compiler/rustc_ast_passes/src/feature_gate.rs +++ b/compiler/rustc_ast_passes/src/feature_gate.rs @@ -4,9 +4,9 @@ use rustc_ast::{NodeId, PatKind, attr, token}; use rustc_feature::{AttributeGate, BUILTIN_ATTRIBUTE_MAP, BuiltinAttribute, Features, GateIssue}; use rustc_session::Session; use rustc_session::parse::{feature_err, feature_err_issue, feature_warn}; +use rustc_span::Span; use rustc_span::source_map::Spanned; -use rustc_span::symbol::sym; -use rustc_span::{Span, Symbol}; +use rustc_span::symbol::{Symbol, sym}; use rustc_target::spec::abi; use thin_vec::ThinVec; @@ -690,6 +690,7 @@ fn check_new_solver_banned_features(sess: &Session, features: &Features) { .find(|feat| feat.gate_name == sym::generic_const_exprs) .map(|feat| feat.attr_sp) { + #[cfg_attr(not(bootstrap), allow(rustc::symbol_intern_string_literal))] sess.dcx().emit_err(errors::IncompatibleFeatures { spans: vec![gce_span], f1: Symbol::intern("-Znext-solver=globally"), diff --git a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs index c11103af476e3..b42c99e1a6d9d 100644 --- a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs @@ -1450,6 +1450,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { ty::Param(param_ty) => Ok(( generics.type_param(param_ty, tcx), predicate.trait_ref.print_trait_sugared().to_string(), + Some(predicate.trait_ref.def_id), )), _ => Err(()), } @@ -1463,9 +1464,9 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { tcx, hir_generics, err, - predicates - .iter() - .map(|(param, constraint)| (param.name.as_str(), &**constraint, None)), + predicates.iter().map(|(param, constraint, def_id)| { + (param.name.as_str(), &**constraint, *def_id) + }), None, ); } diff --git a/compiler/rustc_borrowck/src/universal_regions.rs b/compiler/rustc_borrowck/src/universal_regions.rs index 86a0111db49b4..bb64d646ff3ce 100644 --- a/compiler/rustc_borrowck/src/universal_regions.rs +++ b/compiler/rustc_borrowck/src/universal_regions.rs @@ -33,8 +33,8 @@ use rustc_middle::ty::{ TyCtxt, TypeVisitableExt, }; use rustc_middle::{bug, span_bug}; +use rustc_span::ErrorGuaranteed; use rustc_span::symbol::{kw, sym}; -use rustc_span::{ErrorGuaranteed, Symbol}; use tracing::{debug, instrument}; use crate::BorrowckInferCtxt; @@ -524,7 +524,7 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> { let reg_vid = self .infcx - .next_nll_region_var(FR, || RegionCtxt::Free(Symbol::intern("c-variadic"))) + .next_nll_region_var(FR, || RegionCtxt::Free(sym::c_dash_variadic)) .as_var(); let region = ty::Region::new_var(self.infcx.tcx, reg_vid); @@ -540,10 +540,8 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> { } } - let fr_fn_body = self - .infcx - .next_nll_region_var(FR, || RegionCtxt::Free(Symbol::intern("fn_body"))) - .as_var(); + let fr_fn_body = + self.infcx.next_nll_region_var(FR, || RegionCtxt::Free(sym::fn_body)).as_var(); let num_universals = self.infcx.num_region_vars(); diff --git a/compiler/rustc_codegen_cranelift/src/driver/jit.rs b/compiler/rustc_codegen_cranelift/src/driver/jit.rs index 0d62a13b4724e..ae9578eeffb61 100644 --- a/compiler/rustc_codegen_cranelift/src/driver/jit.rs +++ b/compiler/rustc_codegen_cranelift/src/driver/jit.rs @@ -74,7 +74,7 @@ fn create_jit_module( jit_builder.symbol("__clif_jit_fn", clif_jit_fn as *const u8); let mut jit_module = UnwindModule::new(JITModule::new(jit_builder), false); - let cx = crate::CodegenCx::new(tcx, jit_module.isa(), false, Symbol::intern("dummy_cgu_name")); + let cx = crate::CodegenCx::new(tcx, jit_module.isa(), false, sym::dummy_cgu_name); crate::allocator::codegen(tcx, &mut jit_module); @@ -276,12 +276,7 @@ fn jit_fn(instance_ptr: *const Instance<'static>, trampoline_ptr: *const u8) -> jit_module.module.prepare_for_function_redefine(func_id).unwrap(); - let mut cx = crate::CodegenCx::new( - tcx, - jit_module.isa(), - false, - Symbol::intern("dummy_cgu_name"), - ); + let mut cx = crate::CodegenCx::new(tcx, jit_module.isa(), false, sym::dummy_cgu_name); codegen_and_compile_fn(tcx, &mut cx, &mut Context::new(), jit_module, instance); assert!(cx.global_asm.is_empty()); diff --git a/compiler/rustc_codegen_cranelift/src/lib.rs b/compiler/rustc_codegen_cranelift/src/lib.rs index e6f6ae305816f..cac9975f04ce2 100644 --- a/compiler/rustc_codegen_cranelift/src/lib.rs +++ b/compiler/rustc_codegen_cranelift/src/lib.rs @@ -189,18 +189,13 @@ impl CodegenBackend for CraneliftCodegenBackend { // FIXME return the actually used target features. this is necessary for #[cfg(target_feature)] if sess.target.arch == "x86_64" && sess.target.os != "none" { // x86_64 mandates SSE2 support - vec![Symbol::intern("fxsr"), sym::sse, Symbol::intern("sse2")] + vec![sym::fsxr, sym::sse, sym::sse2] } else if sess.target.arch == "aarch64" { match &*sess.target.os { "none" => vec![], // On macOS the aes, sha2 and sha3 features are enabled by default and ring // fails to compile on macOS when they are not present. - "macos" => vec![ - sym::neon, - Symbol::intern("aes"), - Symbol::intern("sha2"), - Symbol::intern("sha3"), - ], + "macos" => vec![sym::neon, sym::aes, sym::sha2, sym::sha3], // AArch64 mandates Neon support _ => vec![sym::neon], } diff --git a/compiler/rustc_const_eval/src/check_consts/ops.rs b/compiler/rustc_const_eval/src/check_consts/ops.rs index ab81e60a33f23..fd933d5cb701e 100644 --- a/compiler/rustc_const_eval/src/check_consts/ops.rs +++ b/compiler/rustc_const_eval/src/check_consts/ops.rs @@ -140,7 +140,7 @@ impl<'tcx> NonConstOp<'tcx> for FnCallNonConst<'tcx> { err, param_ty.name.as_str(), &constraint, - None, + Some(trait_ref.def_id), None, ); } diff --git a/compiler/rustc_hir_analysis/src/collect/generics_of.rs b/compiler/rustc_hir_analysis/src/collect/generics_of.rs index 077696ac1f249..1d9114b0ef34e 100644 --- a/compiler/rustc_hir_analysis/src/collect/generics_of.rs +++ b/compiler/rustc_hir_analysis/src/collect/generics_of.rs @@ -419,7 +419,7 @@ pub(super) fn generics_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Generics { if let Node::ConstBlock(_) = node { own_params.push(ty::GenericParamDef { index: next_index(), - name: Symbol::intern(""), + name: rustc_span::sym::const_ty_placeholder, def_id: def_id.to_def_id(), pure_wrt_drop: false, kind: ty::GenericParamDefKind::Type { has_default: false, synthetic: false }, diff --git a/compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs b/compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs index ff449a858d674..2e227ead14a93 100644 --- a/compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs +++ b/compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs @@ -279,7 +279,13 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { } else { let mut err = self.dcx().create_err(err); if suggest_constraining_type_param( - tcx, generics, &mut err, &qself_str, &trait_ref, None, None, + tcx, + generics, + &mut err, + &qself_str, + &trait_ref, + Some(best_trait), + None, ) && !identically_named { // We suggested constraining a type parameter, but the associated item on it diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs index 3940d138deb0a..aacdcf027b6ec 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs @@ -307,7 +307,11 @@ impl<'tcx> HirTyLowerer<'tcx> for FnCtxt<'_, 'tcx> { ty::Alias(ty::Projection | ty::Inherent | ty::Weak, _) if !ty.has_escaping_bound_vars() => { - self.normalize(span, ty).ty_adt_def() + if self.next_trait_solver() { + self.try_structurally_resolve_type(span, ty).ty_adt_def() + } else { + self.normalize(span, ty).ty_adt_def() + } } _ => None, } diff --git a/compiler/rustc_hir_typeck/src/method/suggest.rs b/compiler/rustc_hir_typeck/src/method/suggest.rs index cff2aa6899390..6b1a288510ac1 100644 --- a/compiler/rustc_hir_typeck/src/method/suggest.rs +++ b/compiler/rustc_hir_typeck/src/method/suggest.rs @@ -664,7 +664,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let is_write = sugg_span.ctxt().outer_expn_data().macro_def_id.is_some_and(|def_id| { tcx.is_diagnostic_item(sym::write_macro, def_id) || tcx.is_diagnostic_item(sym::writeln_macro, def_id) - }) && item_name.name == Symbol::intern("write_fmt"); + }) && item_name.name == sym::write_fmt; let mut err = if is_write && let SelfSource::MethodCall(rcvr_expr) = source { self.suggest_missing_writer(rcvr_ty, rcvr_expr) } else { diff --git a/compiler/rustc_lint/messages.ftl b/compiler/rustc_lint/messages.ftl index 4aeaf61681604..40ffed480381a 100644 --- a/compiler/rustc_lint/messages.ftl +++ b/compiler/rustc_lint/messages.ftl @@ -775,6 +775,9 @@ lint_suspicious_double_ref_clone = lint_suspicious_double_ref_deref = using `.deref()` on a double reference, which returns `{$ty}` instead of dereferencing the inner type +lint_symbol_intern_string_literal = using `Symbol::intern` on a string literal + .help = consider adding the symbol to `compiler/rustc_span/src/symbol.rs` + lint_trailing_semi_macro = trailing semicolon in macro used in expression position .note1 = macro invocations at the end of a block are treated as expressions .note2 = to ignore the value produced by the macro, add a semicolon after the invocation of `{$name}` diff --git a/compiler/rustc_lint/src/if_let_rescope.rs b/compiler/rustc_lint/src/if_let_rescope.rs index 0e874669043f3..2db229ed133fe 100644 --- a/compiler/rustc_lint/src/if_let_rescope.rs +++ b/compiler/rustc_lint/src/if_let_rescope.rs @@ -103,8 +103,11 @@ fn expr_parent_is_else(tcx: TyCtxt<'_>, hir_id: hir::HirId) -> bool { } fn expr_parent_is_stmt(tcx: TyCtxt<'_>, hir_id: hir::HirId) -> bool { - let Some((_, hir::Node::Stmt(stmt))) = tcx.hir().parent_iter(hir_id).next() else { - return false; + let mut parents = tcx.hir().parent_iter(hir_id); + let stmt = match parents.next() { + Some((_, hir::Node::Stmt(stmt))) => stmt, + Some((_, hir::Node::Block(_) | hir::Node::Arm(_))) => return true, + _ => return false, }; let (hir::StmtKind::Semi(expr) | hir::StmtKind::Expr(expr)) = stmt.kind else { return false }; expr.hir_id == hir_id diff --git a/compiler/rustc_lint/src/internal.rs b/compiler/rustc_lint/src/internal.rs index 7c8a65059d117..482650e04e85c 100644 --- a/compiler/rustc_lint/src/internal.rs +++ b/compiler/rustc_lint/src/internal.rs @@ -17,8 +17,9 @@ use tracing::debug; use crate::lints::{ BadOptAccessDiag, DefaultHashTypesDiag, DiagOutOfImpl, LintPassByHand, NonExistentDocKeyword, - NonGlobImportTypeIrInherent, QueryInstability, QueryUntracked, SpanUseEqCtxtDiag, TyQualified, - TykindDiag, TykindKind, TypeIrInherentUsage, UntranslatableDiag, + NonGlobImportTypeIrInherent, QueryInstability, QueryUntracked, SpanUseEqCtxtDiag, + SymbolInternStringLiteralDiag, TyQualified, TykindDiag, TykindKind, TypeIrInherentUsage, + UntranslatableDiag, }; use crate::{EarlyContext, EarlyLintPass, LateContext, LateLintPass, LintContext}; @@ -650,3 +651,33 @@ fn is_span_ctxt_call(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool { _ => false, } } + +declare_tool_lint! { + /// The `symbol_intern_string_literal` detects `Symbol::intern` being called on a string literal + pub rustc::SYMBOL_INTERN_STRING_LITERAL, + // rustc_driver crates out of the compiler can't/shouldn't add preinterned symbols; + // bootstrap will deny this manually + Allow, + "Forbid uses of string literals in `Symbol::intern`, suggesting preinterning instead", + report_in_external_macro: true +} + +declare_lint_pass!(SymbolInternStringLiteral => [SYMBOL_INTERN_STRING_LITERAL]); + +impl<'tcx> LateLintPass<'tcx> for SymbolInternStringLiteral { + fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx rustc_hir::Expr<'tcx>) { + if let ExprKind::Call(path, [arg]) = expr.kind + && let ExprKind::Path(ref qpath) = path.kind + && let Some(def_id) = cx.qpath_res(qpath, path.hir_id).opt_def_id() + && cx.tcx.is_diagnostic_item(sym::SymbolIntern, def_id) + && let ExprKind::Lit(kind) = arg.kind + && let rustc_ast::LitKind::Str(_, _) = kind.node + { + cx.emit_span_lint( + SYMBOL_INTERN_STRING_LITERAL, + kind.span, + SymbolInternStringLiteralDiag, + ); + } + } +} diff --git a/compiler/rustc_lint/src/lib.rs b/compiler/rustc_lint/src/lib.rs index 4cf5c7b4ff964..a99c94592b302 100644 --- a/compiler/rustc_lint/src/lib.rs +++ b/compiler/rustc_lint/src/lib.rs @@ -614,6 +614,8 @@ fn register_internals(store: &mut LintStore) { store.register_late_mod_pass(|_| Box::new(PassByValue)); store.register_lints(&SpanUseEqCtxt::lint_vec()); store.register_late_mod_pass(|_| Box::new(SpanUseEqCtxt)); + store.register_lints(&SymbolInternStringLiteral::lint_vec()); + store.register_late_mod_pass(|_| Box::new(SymbolInternStringLiteral)); // FIXME(davidtwco): deliberately do not include `UNTRANSLATABLE_DIAGNOSTIC` and // `DIAGNOSTIC_OUTSIDE_OF_IMPL` here because `-Wrustc::internal` is provided to every crate and // these lints will trigger all of the time - change this once migration to diagnostic structs diff --git a/compiler/rustc_lint/src/lints.rs b/compiler/rustc_lint/src/lints.rs index 3a854796f6735..e6eae7e736832 100644 --- a/compiler/rustc_lint/src/lints.rs +++ b/compiler/rustc_lint/src/lints.rs @@ -907,6 +907,11 @@ pub(crate) struct QueryUntracked { #[diag(lint_span_use_eq_ctxt)] pub(crate) struct SpanUseEqCtxtDiag; +#[derive(LintDiagnostic)] +#[diag(lint_symbol_intern_string_literal)] +#[help] +pub(crate) struct SymbolInternStringLiteralDiag; + #[derive(LintDiagnostic)] #[diag(lint_tykind_kind)] pub(crate) struct TykindKind { diff --git a/compiler/rustc_lint/src/unused.rs b/compiler/rustc_lint/src/unused.rs index e1a0e1ec5791d..b775cd3740911 100644 --- a/compiler/rustc_lint/src/unused.rs +++ b/compiler/rustc_lint/src/unused.rs @@ -1563,7 +1563,7 @@ impl UnusedImportBraces { } rename.unwrap_or(orig_ident).name } - ast::UseTreeKind::Glob => Symbol::intern("*"), + ast::UseTreeKind::Glob => sym::asterisk, ast::UseTreeKind::Nested { .. } => return, }; diff --git a/compiler/rustc_metadata/src/creader.rs b/compiler/rustc_metadata/src/creader.rs index a18c6baec00f2..29dba2bca6149 100644 --- a/compiler/rustc_metadata/src/creader.rs +++ b/compiler/rustc_metadata/src/creader.rs @@ -861,8 +861,10 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> { // First up we check for global allocators. Look at the crate graph here // and see what's a global allocator, including if we ourselves are a // global allocator. - let mut global_allocator = - self.cstore.has_global_allocator.then(|| Symbol::intern("this crate")); + #[cfg_attr(not(bootstrap), allow(rustc::symbol_intern_string_literal))] + let this_crate = Symbol::intern("this crate"); + + let mut global_allocator = self.cstore.has_global_allocator.then_some(this_crate); for (_, data) in self.cstore.iter_crate_data() { if data.has_global_allocator() { match global_allocator { @@ -876,8 +878,7 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> { } } } - let mut alloc_error_handler = - self.cstore.has_alloc_error_handler.then(|| Symbol::intern("this crate")); + let mut alloc_error_handler = self.cstore.has_alloc_error_handler.then_some(this_crate); for (_, data) in self.cstore.iter_crate_data() { if data.has_alloc_error_handler() { match alloc_error_handler { diff --git a/compiler/rustc_metadata/src/rmeta/decoder.rs b/compiler/rustc_metadata/src/rmeta/decoder.rs index 56beff5aa6425..f3f5af494123a 100644 --- a/compiler/rustc_metadata/src/rmeta/decoder.rs +++ b/compiler/rustc_metadata/src/rmeta/decoder.rs @@ -872,6 +872,7 @@ impl MetadataBlob { let def_kind = root.tables.def_kind.get(blob, item).unwrap(); let def_key = root.tables.def_keys.get(blob, item).unwrap().decode(blob); + #[cfg_attr(not(bootstrap), allow(rustc::symbol_intern_string_literal))] let def_name = if item == CRATE_DEF_INDEX { rustc_span::symbol::kw::Crate } else { diff --git a/compiler/rustc_metadata/src/rmeta/encoder.rs b/compiler/rustc_metadata/src/rmeta/encoder.rs index 068a5d31a8e12..a34ea18f71697 100644 --- a/compiler/rustc_metadata/src/rmeta/encoder.rs +++ b/compiler/rustc_metadata/src/rmeta/encoder.rs @@ -1389,10 +1389,14 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { // `ConstArgKind::Path`. We never actually access this `DefId` // anywhere so we don't need to encode it for other crates. if def_kind == DefKind::AnonConst - && matches!( - tcx.hir_node_by_def_id(local_id), - hir::Node::ConstArg(hir::ConstArg { kind: hir::ConstArgKind::Path(..), .. }) - ) + && match tcx.hir_node_by_def_id(local_id) { + hir::Node::ConstArg(hir::ConstArg { kind, .. }) => match kind { + // Skip encoding defs for these as they should not have had a `DefId` created + hir::ConstArgKind::Path(..) | hir::ConstArgKind::Infer(..) => true, + hir::ConstArgKind::Anon(..) => false, + }, + _ => false, + } { continue; } diff --git a/compiler/rustc_middle/src/ty/diagnostics.rs b/compiler/rustc_middle/src/ty/diagnostics.rs index fd807882e0f7c..a88aea3fa8ee6 100644 --- a/compiler/rustc_middle/src/ty/diagnostics.rs +++ b/compiler/rustc_middle/src/ty/diagnostics.rs @@ -1,11 +1,12 @@ //! Diagnostics related methods for `Ty`. -use std::borrow::Cow; use std::fmt::Write; use std::ops::ControlFlow; use rustc_data_structures::fx::FxHashMap; -use rustc_errors::{Applicability, Diag, DiagArgValue, IntoDiagArg, into_diag_arg_using_display}; +use rustc_errors::{ + Applicability, Diag, DiagArgValue, IntoDiagArg, into_diag_arg_using_display, pluralize, +}; use rustc_hir::def::DefKind; use rustc_hir::def_id::DefId; use rustc_hir::{self as hir, LangItem, PredicateOrigin, WherePredicateKind}; @@ -161,7 +162,7 @@ pub fn suggest_arbitrary_trait_bound<'tcx>( true } -#[derive(Debug)] +#[derive(Debug, Clone, Copy)] enum SuggestChangingConstraintsMessage<'a> { RestrictBoundFurther, RestrictType { ty: &'a str }, @@ -172,7 +173,7 @@ enum SuggestChangingConstraintsMessage<'a> { fn suggest_changing_unsized_bound( generics: &hir::Generics<'_>, - suggestions: &mut Vec<(Span, String, SuggestChangingConstraintsMessage<'_>)>, + suggestions: &mut Vec<(Span, String, String, SuggestChangingConstraintsMessage<'_>)>, param: &hir::GenericParam<'_>, def_id: Option, ) { @@ -207,7 +208,8 @@ fn suggest_changing_unsized_bound( continue; } - let mut push_suggestion = |sp, msg| suggestions.push((sp, String::new(), msg)); + let mut push_suggestion = + |sp, msg| suggestions.push((sp, "Sized".to_string(), String::new(), msg)); if predicate.bounds.len() == unsized_bounds.len() { // All the bounds are unsized bounds, e.g. @@ -278,8 +280,25 @@ pub fn suggest_constraining_type_params<'a>( span_to_replace: Option, ) -> bool { let mut grouped = FxHashMap::default(); + let mut unstable_suggestion = false; param_names_and_constraints.for_each(|(param_name, constraint, def_id)| { - grouped.entry(param_name).or_insert(Vec::new()).push((constraint, def_id)) + let stable = match def_id { + Some(def_id) => match tcx.lookup_stability(def_id) { + Some(s) => s.level.is_stable(), + None => true, + }, + None => true, + }; + if stable || tcx.sess.is_nightly_build() { + grouped.entry(param_name).or_insert(Vec::new()).push(( + constraint, + def_id, + if stable { "" } else { "unstable " }, + )); + if !stable { + unstable_suggestion = true; + } + } }); let mut applicability = Applicability::MachineApplicable; @@ -290,16 +309,21 @@ pub fn suggest_constraining_type_params<'a>( let Some(param) = param else { return false }; { - let mut sized_constraints = constraints.extract_if(|(_, def_id)| { + let mut sized_constraints = constraints.extract_if(|(_, def_id, _)| { def_id.is_some_and(|def_id| tcx.is_lang_item(def_id, LangItem::Sized)) }); - if let Some((_, def_id)) = sized_constraints.next() { + if let Some((_, def_id, _)) = sized_constraints.next() { applicability = Applicability::MaybeIncorrect; err.span_label(param.span, "this type parameter needs to be `Sized`"); suggest_changing_unsized_bound(generics, &mut suggestions, param, def_id); } } + let bound_message = if constraints.iter().any(|(_, def_id, _)| def_id.is_none()) { + SuggestChangingConstraintsMessage::RestrictBoundFurther + } else { + SuggestChangingConstraintsMessage::RestrictTypeFurther { ty: param_name } + }; // in the scenario like impl has stricter requirements than trait, // we should not suggest restrict bound on the impl, here we double check @@ -312,15 +336,54 @@ pub fn suggest_constraining_type_params<'a>( .collect(); constraints - .retain(|(_, def_id)| def_id.map_or(true, |def| !bound_trait_defs.contains(&def))); + .retain(|(_, def_id, _)| def_id.map_or(true, |def| !bound_trait_defs.contains(&def))); if constraints.is_empty() { continue; } - let mut constraint = constraints.iter().map(|&(c, _)| c).collect::>(); + let mut constraint = constraints.iter().map(|&(c, _, _)| c).collect::>(); constraint.sort(); constraint.dedup(); + let all_known = constraints.iter().all(|&(_, def_id, _)| def_id.is_some()); + let all_stable = constraints.iter().all(|&(_, _, stable)| stable.is_empty()); + let all_unstable = constraints.iter().all(|&(_, _, stable)| !stable.is_empty()); + let post = if all_stable || all_unstable { + // Don't redundantly say "trait `X`, trait `Y`", instead "traits `X` and `Y`" + let mut trait_names = constraints + .iter() + .map(|&(c, def_id, _)| match def_id { + None => format!("`{c}`"), + Some(def_id) => format!("`{}`", tcx.item_name(def_id)), + }) + .collect::>(); + trait_names.sort(); + trait_names.dedup(); + let n = trait_names.len(); + let stable = if all_stable { "" } else { "unstable " }; + let trait_ = if all_known { "trait" } else { "" }; + format!("{stable}{trait_}{} {}", pluralize!(n), match &trait_names[..] { + [t] => t.to_string(), + [ts @ .., last] => format!("{} and {last}", ts.join(", ")), + [] => return false, + },) + } else { + // We're more explicit when there's a mix of stable and unstable traits. + let mut trait_names = constraints + .iter() + .map(|&(c, def_id, stable)| match def_id { + None => format!("`{c}`"), + Some(def_id) => format!("{stable}trait `{}`", tcx.item_name(def_id)), + }) + .collect::>(); + trait_names.sort(); + trait_names.dedup(); + match &trait_names[..] { + [t] => t.to_string(), + [ts @ .., last] => format!("{} and {last}", ts.join(", ")), + [] => return false, + } + }; let constraint = constraint.join(" + "); let mut suggest_restrict = |span, bound_list_non_empty, open_paren_sp| { let suggestion = if span_to_replace.is_some() { @@ -333,13 +396,11 @@ pub fn suggest_constraining_type_params<'a>( format!(" {constraint}") }; - use SuggestChangingConstraintsMessage::RestrictBoundFurther; - if let Some(open_paren_sp) = open_paren_sp { - suggestions.push((open_paren_sp, "(".to_string(), RestrictBoundFurther)); - suggestions.push((span, format!("){suggestion}"), RestrictBoundFurther)); + suggestions.push((open_paren_sp, post.clone(), "(".to_string(), bound_message)); + suggestions.push((span, post.clone(), format!("){suggestion}"), bound_message)); } else { - suggestions.push((span, suggestion, RestrictBoundFurther)); + suggestions.push((span, post.clone(), suggestion, bound_message)); } }; @@ -397,7 +458,8 @@ pub fn suggest_constraining_type_params<'a>( // - insert: `, X: Bar` suggestions.push(( generics.tail_span_for_predicate_suggestion(), - constraints.iter().fold(String::new(), |mut string, &(constraint, _)| { + post, + constraints.iter().fold(String::new(), |mut string, &(constraint, _, _)| { write!(string, ", {param_name}: {constraint}").unwrap(); string }), @@ -426,6 +488,7 @@ pub fn suggest_constraining_type_params<'a>( // default (``), so we suggest adding `where T: Bar`. suggestions.push(( generics.tail_span_for_predicate_suggestion(), + post, format!("{where_prefix} {param_name}: {constraint}"), SuggestChangingConstraintsMessage::RestrictTypeFurther { ty: param_name }, )); @@ -439,6 +502,7 @@ pub fn suggest_constraining_type_params<'a>( if let Some(colon_span) = param.colon_span { suggestions.push(( colon_span.shrink_to_hi(), + post, format!(" {constraint}"), SuggestChangingConstraintsMessage::RestrictType { ty: param_name }, )); @@ -451,6 +515,7 @@ pub fn suggest_constraining_type_params<'a>( // - help: consider restricting this type parameter with `T: Foo` suggestions.push(( param.span.shrink_to_hi(), + post, format!(": {constraint}"), SuggestChangingConstraintsMessage::RestrictType { ty: param_name }, )); @@ -459,39 +524,46 @@ pub fn suggest_constraining_type_params<'a>( // FIXME: remove the suggestions that are from derive, as the span is not correct suggestions = suggestions .into_iter() - .filter(|(span, _, _)| !span.in_derive_expansion()) + .filter(|(span, _, _, _)| !span.in_derive_expansion()) .collect::>(); - + let suggested = !suggestions.is_empty(); if suggestions.len() == 1 { - let (span, suggestion, msg) = suggestions.pop().unwrap(); + let (span, post, suggestion, msg) = suggestions.pop().unwrap(); let msg = match msg { SuggestChangingConstraintsMessage::RestrictBoundFurther => { - Cow::from("consider further restricting this bound") + format!("consider further restricting this bound with {post}") + } + SuggestChangingConstraintsMessage::RestrictTypeFurther { ty } + | SuggestChangingConstraintsMessage::RestrictType { ty } + if ty.starts_with("impl ") => + { + format!("consider restricting opaque type `{ty}` with {post}") } SuggestChangingConstraintsMessage::RestrictType { ty } => { - Cow::from(format!("consider restricting type parameter `{ty}`")) + format!("consider restricting type parameter `{ty}` with {post}") } SuggestChangingConstraintsMessage::RestrictTypeFurther { ty } => { - Cow::from(format!("consider further restricting type parameter `{ty}`")) + format!("consider further restricting type parameter `{ty}` with {post}") } SuggestChangingConstraintsMessage::RemoveMaybeUnsized => { - Cow::from("consider removing the `?Sized` bound to make the type parameter `Sized`") + format!("consider removing the `?Sized` bound to make the type parameter `Sized`") } SuggestChangingConstraintsMessage::ReplaceMaybeUnsizedWithSized => { - Cow::from("consider replacing `?Sized` with `Sized`") + format!("consider replacing `?Sized` with `Sized`") } }; err.span_suggestion_verbose(span, msg, suggestion, applicability); } else if suggestions.len() > 1 { + let post = if unstable_suggestion { " (some of them are unstable traits)" } else { "" }; err.multipart_suggestion_verbose( - "consider restricting type parameters", - suggestions.into_iter().map(|(span, suggestion, _)| (span, suggestion)).collect(), + format!("consider restricting type parameters{post}"), + suggestions.into_iter().map(|(span, _, suggestion, _)| (span, suggestion)).collect(), applicability, ); } - true + suggested } /// Collect al types that have an implicit `'static` obligation that we could suggest `'_` for. diff --git a/compiler/rustc_parse/src/parser/ty.rs b/compiler/rustc_parse/src/parser/ty.rs index 505586e74f11f..bf83a6533da0a 100644 --- a/compiler/rustc_parse/src/parser/ty.rs +++ b/compiler/rustc_parse/src/parser/ty.rs @@ -9,7 +9,7 @@ use rustc_ast::{ }; use rustc_errors::{Applicability, PResult}; use rustc_span::symbol::{Ident, kw, sym}; -use rustc_span::{ErrorGuaranteed, Span, Symbol}; +use rustc_span::{ErrorGuaranteed, Span}; use thin_vec::{ThinVec, thin_vec}; use super::{Parser, PathStyle, SeqSep, TokenType, Trailing}; @@ -1136,7 +1136,7 @@ impl<'a> Parser<'a> { Some(ast::Path { span: fn_token_span.to(self.prev_token.span), segments: thin_vec![ast::PathSegment { - ident: Ident::new(Symbol::intern("Fn"), fn_token_span), + ident: Ident::new(sym::Fn, fn_token_span), id: DUMMY_NODE_ID, args: Some(P(ast::GenericArgs::Parenthesized(ast::ParenthesizedArgs { span: args_lo.to(self.prev_token.span), diff --git a/compiler/rustc_resolve/src/late/diagnostics.rs b/compiler/rustc_resolve/src/late/diagnostics.rs index 663c3ac0045ab..09f3e84876689 100644 --- a/compiler/rustc_resolve/src/late/diagnostics.rs +++ b/compiler/rustc_resolve/src/late/diagnostics.rs @@ -3113,6 +3113,7 @@ impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> { } } + #[cfg_attr(not(bootstrap), allow(rustc::symbol_intern_string_literal))] let existing_name = match &in_scope_lifetimes[..] { [] => Symbol::intern("'a"), [(existing, _)] => existing.name, diff --git a/compiler/rustc_resolve/src/lib.rs b/compiler/rustc_resolve/src/lib.rs index 094871ad26876..ca4adce37ce03 100644 --- a/compiler/rustc_resolve/src/lib.rs +++ b/compiler/rustc_resolve/src/lib.rs @@ -2257,7 +2257,7 @@ fn module_to_string(module: Module<'_>) -> Option { collect_mod(names, parent); } } else { - names.push(Symbol::intern("")); + names.push(sym::opaque_module_name_placeholder); collect_mod(names, module.parent.unwrap()); } } diff --git a/compiler/rustc_session/src/output.rs b/compiler/rustc_session/src/output.rs index 357d746c1846f..2b2ba50d3fb77 100644 --- a/compiler/rustc_session/src/output.rs +++ b/compiler/rustc_session/src/output.rs @@ -87,7 +87,7 @@ pub fn find_crate_name(sess: &Session, attrs: &[ast::Attribute]) -> Symbol { } } - Symbol::intern("rust_out") + sym::rust_out } pub fn validate_crate_name(sess: &Session, s: Symbol, sp: Option) { diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index e94c0a5ea6e7f..44903f0d077b7 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -298,6 +298,7 @@ symbols! { Return, Right, Rust, + RustaceansAreAwesome, RustcDecodable, RustcEncodable, RwLock, @@ -316,6 +317,7 @@ symbols! { StructuralPartialEq, SubdiagMessage, Subdiagnostic, + SymbolIntern, Sync, SyncUnsafeCell, T, @@ -377,6 +379,7 @@ symbols! { adt_const_params, advanced_slice_patterns, adx_target_feature, + aes, aggregate_raw_ptr, alias, align, @@ -440,6 +443,7 @@ symbols! { associated_types, assume, assume_init, + asterisk: "*", async_await, async_call, async_call_mut, @@ -520,6 +524,7 @@ symbols! { btreeset_iter, builtin_syntax, c, + c_dash_variadic, c_str, c_str_literals, c_unwind, @@ -650,6 +655,7 @@ symbols! { const_trait_bound_opt_out, const_trait_impl, const_try, + const_ty_placeholder: "", constant, constructor, convert_identity, @@ -779,6 +785,7 @@ symbols! { drop_types_in_const, dropck_eyepatch, dropck_parametricity, + dummy_cgu_name, dylib, dyn_compatible_for_dispatch, dyn_metadata, @@ -922,6 +929,7 @@ symbols! { fmuladdf32, fmuladdf64, fn_align, + fn_body, fn_delegation, fn_must_use, fn_mut, @@ -962,6 +970,7 @@ symbols! { fs_create_dir, fsub_algebraic, fsub_fast, + fsxr, full, fundamental, fused_iterator, @@ -1385,6 +1394,7 @@ symbols! { on, on_unimplemented, opaque, + opaque_module_name_placeholder: "", open_options_new, ops, opt_out_copy, @@ -1654,6 +1664,7 @@ symbols! { rust_eh_catch_typeinfo, rust_eh_personality, rust_logo, + rust_out, rustc, rustc_abi, rustc_allocator, @@ -1776,6 +1787,8 @@ symbols! { self_in_typedefs, self_struct_ctor, semitransparent, + sha2, + sha3, sha512_sm_x86, shadow_call_stack, shallow, @@ -1889,6 +1902,7 @@ symbols! { sreg, sreg_low16, sse, + sse2, sse4a_target_feature, stable, staged_api, @@ -2176,6 +2190,7 @@ symbols! { wrapping_sub, wreg, write_bytes, + write_fmt, write_macro, write_str, write_via_move, @@ -2405,6 +2420,7 @@ impl Symbol { } /// Maps a string to its interned representation. + #[rustc_diagnostic_item = "SymbolIntern"] pub fn intern(string: &str) -> Self { with_session_globals(|session_globals| session_globals.symbol_interner.intern(string)) } diff --git a/compiler/rustc_trait_selection/src/traits/dyn_compatibility.rs b/compiler/rustc_trait_selection/src/traits/dyn_compatibility.rs index e0a9ddf1876e6..993bc2e9b9407 100644 --- a/compiler/rustc_trait_selection/src/traits/dyn_compatibility.rs +++ b/compiler/rustc_trait_selection/src/traits/dyn_compatibility.rs @@ -18,7 +18,6 @@ use rustc_middle::ty::{ TypeVisitableExt, TypeVisitor, TypingMode, Upcast, }; use rustc_span::Span; -use rustc_span::symbol::Symbol; use smallvec::SmallVec; use tracing::{debug, instrument}; @@ -679,7 +678,7 @@ fn receiver_is_dispatchable<'tcx>( // FIXME(mikeyhew) this is a total hack. Once dyn_compatible_for_dispatch is stabilized, we can // replace this with `dyn Trait` let unsized_self_ty: Ty<'tcx> = - Ty::new_param(tcx, u32::MAX, Symbol::intern("RustaceansAreAwesome")); + Ty::new_param(tcx, u32::MAX, rustc_span::sym::RustaceansAreAwesome); // `Receiver[Self => U]` let unsized_receiver_ty = diff --git a/library/core/src/alloc/layout.rs b/library/core/src/alloc/layout.rs index 60936da2e0b0d..d884fa69efbb0 100644 --- a/library/core/src/alloc/layout.rs +++ b/library/core/src/alloc/layout.rs @@ -179,6 +179,7 @@ impl Layout { /// or other unsized type like a slice). #[stable(feature = "alloc_layout", since = "1.28.0")] #[rustc_const_unstable(feature = "const_alloc_layout", issue = "67521")] + #[rustc_const_stable_indirect] #[must_use] #[inline] pub const fn for_value(t: &T) -> Self { @@ -215,7 +216,6 @@ impl Layout { /// [trait object]: ../../book/ch17-02-trait-objects.html /// [extern type]: ../../unstable-book/language-features/extern-types.html #[unstable(feature = "layout_for_ptr", issue = "69835")] - #[rustc_const_unstable(feature = "layout_for_ptr", issue = "69835")] #[must_use] pub const unsafe fn for_value_raw(t: *const T) -> Self { // SAFETY: we pass along the prerequisites of these functions to the caller diff --git a/library/core/src/intrinsics/mod.rs b/library/core/src/intrinsics/mod.rs index 46873fdc0479f..ea41cecfec24f 100644 --- a/library/core/src/intrinsics/mod.rs +++ b/library/core/src/intrinsics/mod.rs @@ -4099,6 +4099,7 @@ pub const fn variant_count() -> usize { #[unstable(feature = "core_intrinsics", issue = "none")] #[rustc_intrinsic] #[rustc_intrinsic_must_be_overridden] +#[rustc_intrinsic_const_stable_indirect] pub const unsafe fn size_of_val(_ptr: *const T) -> usize { unreachable!() } @@ -4114,6 +4115,7 @@ pub const unsafe fn size_of_val(_ptr: *const T) -> usize { #[unstable(feature = "core_intrinsics", issue = "none")] #[rustc_intrinsic] #[rustc_intrinsic_must_be_overridden] +#[rustc_intrinsic_const_stable_indirect] pub const unsafe fn min_align_of_val(_ptr: *const T) -> usize { unreachable!() } diff --git a/library/core/src/mem/mod.rs b/library/core/src/mem/mod.rs index 4cf52042a57f6..78ad6880709fb 100644 --- a/library/core/src/mem/mod.rs +++ b/library/core/src/mem/mod.rs @@ -333,7 +333,7 @@ pub const fn size_of() -> usize { #[inline] #[must_use] #[stable(feature = "rust1", since = "1.0.0")] -#[rustc_const_unstable(feature = "const_size_of_val", issue = "46571")] +#[rustc_const_stable(feature = "const_size_of_val", since = "CURRENT_RUSTC_VERSION")] #[cfg_attr(not(test), rustc_diagnostic_item = "mem_size_of_val")] pub const fn size_of_val(val: &T) -> usize { // SAFETY: `val` is a reference, so it's a valid raw pointer @@ -390,7 +390,6 @@ pub const fn size_of_val(val: &T) -> usize { #[inline] #[must_use] #[unstable(feature = "layout_for_ptr", issue = "69835")] -#[rustc_const_unstable(feature = "const_size_of_val_raw", issue = "46571")] pub const unsafe fn size_of_val_raw(val: *const T) -> usize { // SAFETY: the caller must provide a valid raw pointer unsafe { intrinsics::size_of_val(val) } @@ -485,7 +484,7 @@ pub const fn align_of() -> usize { #[inline] #[must_use] #[stable(feature = "rust1", since = "1.0.0")] -#[rustc_const_unstable(feature = "const_align_of_val", issue = "46571")] +#[rustc_const_stable(feature = "const_align_of_val", since = "CURRENT_RUSTC_VERSION")] #[allow(deprecated)] pub const fn align_of_val(val: &T) -> usize { // SAFETY: val is a reference, so it's a valid raw pointer @@ -534,7 +533,6 @@ pub const fn align_of_val(val: &T) -> usize { #[inline] #[must_use] #[unstable(feature = "layout_for_ptr", issue = "69835")] -#[rustc_const_unstable(feature = "const_align_of_val_raw", issue = "46571")] pub const unsafe fn align_of_val_raw(val: *const T) -> usize { // SAFETY: the caller must provide a valid raw pointer unsafe { intrinsics::min_align_of_val(val) } diff --git a/library/core/tests/lib.rs b/library/core/tests/lib.rs index ec4b42b966b33..e0b1c21e1ecb9 100644 --- a/library/core/tests/lib.rs +++ b/library/core/tests/lib.rs @@ -13,7 +13,6 @@ #![feature(bigint_helper_methods)] #![feature(cell_update)] #![feature(clone_to_uninit)] -#![feature(const_align_of_val_raw)] #![feature(const_black_box)] #![feature(const_eval_select)] #![feature(const_nonnull_new)] diff --git a/src/bootstrap/src/core/builder/cargo.rs b/src/bootstrap/src/core/builder/cargo.rs index dd138508bea62..77f6edaabb248 100644 --- a/src/bootstrap/src/core/builder/cargo.rs +++ b/src/bootstrap/src/core/builder/cargo.rs @@ -1033,6 +1033,15 @@ impl Builder<'_> { if mode == Mode::Rustc { rustflags.arg("-Wrustc::internal"); + // cfg(bootstrap) - remove this check when lint is in bootstrap compiler + if stage != 0 { + // Lint is allow by default so downstream tools don't get a lit + // they can do nothing about + // We shouldn't be preinterning symbols used by tests + if cmd_kind != Kind::Test { + rustflags.arg("-Drustc::symbol_intern_string_literal"); + } + } // FIXME(edition_2024): Change this to `-Wrust_2024_idioms` when all // of the individual lints are satisfied. rustflags.arg("-Wkeyword_idents_2024"); diff --git a/src/doc/unstable-book/src/compiler-flags/randomize-layout.md b/src/doc/unstable-book/src/compiler-flags/randomize-layout.md new file mode 100644 index 0000000000000..84c6712bc23a0 --- /dev/null +++ b/src/doc/unstable-book/src/compiler-flags/randomize-layout.md @@ -0,0 +1,23 @@ +# `randomize-layout` + +The tracking issue for this feature is: [#106764](https://github.com/rust-lang/rust/issues/106764). + +------------------------ + +The `-Zrandomize-layout` flag changes the layout algorithm for `repr(Rust)` types defined in the current crate from its normal +optimization goals to pseudorandomly rearranging fields within the degrees of freedom provided by the largely unspecified +default representation. This also affects type sizes and padding. +Downstream intantiations of generic types defined in a crate with randomization enabled will also be randomized. + +It can be used to find unsafe code that accidentally relies on unspecified behavior. + +Randomization is not guaranteed to use a different permutation for each compilation session. +`-Zlayout-seed=` can be used to supply additional entropy. + +Randomization only approximates the intended freedom of repr(Rust). Sometimes two distinct types may still consistently +result in the same layout due to limitations of the current implementation. Randomization may become +more aggressive over time as our coverage of the available degrees of freedoms improves. +Corollary: Randomization is not a safety oracle. Two struct layouts being observably the same under different layout seeds +on the current compiler version does not guarantee that future compiler versions won't give them distinct layouts. + +Randomization may also become less aggressive in the future if additional guarantees get added to the default layout. diff --git a/tests/crashes/132320.rs b/tests/crashes/132320.rs deleted file mode 100644 index 79181c3a2c522..0000000000000 --- a/tests/crashes/132320.rs +++ /dev/null @@ -1,15 +0,0 @@ -//@ known-bug: #132320 -//@ compile-flags: -Znext-solver=globally - -trait Foo { - type Item; - fn foo(&mut self); -} - -impl Foo for () { - type Item = Option<()>; - - fn foo(&mut self) { - let _ = Self::Item::None; - } -} diff --git a/tests/run-make/missing-unstable-trait-bound/missing-bound.rs b/tests/run-make/missing-unstable-trait-bound/missing-bound.rs new file mode 100644 index 0000000000000..65d0745f49440 --- /dev/null +++ b/tests/run-make/missing-unstable-trait-bound/missing-bound.rs @@ -0,0 +1,4 @@ +pub fn baz(t: std::ops::Range) { + for _ in t {} +} +fn main() {} diff --git a/tests/run-make/missing-unstable-trait-bound/missing-bound.stderr b/tests/run-make/missing-unstable-trait-bound/missing-bound.stderr new file mode 100644 index 0000000000000..7196a1a6fed77 --- /dev/null +++ b/tests/run-make/missing-unstable-trait-bound/missing-bound.stderr @@ -0,0 +1,12 @@ +error[E0277]: the trait bound `T: Step` is not satisfied + --> missing-bound.rs:2:14 + | +2 | for _ in t {} + | ^ the trait `Step` is not implemented for `T` + | + = note: required for `std::ops::Range` to implement `Iterator` + = note: required for `std::ops::Range` to implement `IntoIterator` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/run-make/missing-unstable-trait-bound/rmake.rs b/tests/run-make/missing-unstable-trait-bound/rmake.rs new file mode 100644 index 0000000000000..20f77f7c9aa0d --- /dev/null +++ b/tests/run-make/missing-unstable-trait-bound/rmake.rs @@ -0,0 +1,24 @@ +//@ only-linux +//@ ignore-wasm32 +//@ ignore-wasm64 +// ignore-tidy-linelength + +// Ensure that on stable we don't suggest restricting with an unsafe trait and we continue +// mentioning the rest of the obligation chain. + +use run_make_support::{diff, rust_lib_name, rustc}; + +fn main() { + let out = rustc() + .env("RUSTC_BOOTSTRAP", "-1") + .input("missing-bound.rs") + .run_fail() + .assert_stderr_not_contains("help: consider restricting type parameter `T`") + .assert_stderr_contains( + r#" + = note: required for `std::ops::Range` to implement `Iterator` + = note: required for `std::ops::Range` to implement `IntoIterator`"#, + ) + .stderr_utf8(); + diff().expected_file("missing-bound.stderr").actual_text("(stable rustc)", &out).run() +} diff --git a/tests/rustdoc-ui/issues/issue-96287.stderr b/tests/rustdoc-ui/issues/issue-96287.stderr index 9aba033216484..40dc1cc0e704b 100644 --- a/tests/rustdoc-ui/issues/issue-96287.stderr +++ b/tests/rustdoc-ui/issues/issue-96287.stderr @@ -4,7 +4,7 @@ error[E0220]: associated type `Assoc` not found for `V` LL | pub type Foo = impl Trait; | ^^^^^ there is an associated type `Assoc` in the trait `TraitWithAssoc` | -help: consider restricting type parameter `V` +help: consider restricting type parameter `V` with trait `TraitWithAssoc` | LL | pub type Foo = impl Trait; | ++++++++++++++++ @@ -16,7 +16,7 @@ LL | pub type Foo = impl Trait; | ^^^^^ there is an associated type `Assoc` in the trait `TraitWithAssoc` | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: consider restricting type parameter `V` +help: consider restricting type parameter `V` with trait `TraitWithAssoc` | LL | pub type Foo = impl Trait; | ++++++++++++++++ diff --git a/tests/rustdoc-ui/synthetic-auto-trait-impls/projections-in-super-trait-bound-unsatisfied.stderr b/tests/rustdoc-ui/synthetic-auto-trait-impls/projections-in-super-trait-bound-unsatisfied.stderr index d87e769b50538..045516d7d2ff6 100644 --- a/tests/rustdoc-ui/synthetic-auto-trait-impls/projections-in-super-trait-bound-unsatisfied.stderr +++ b/tests/rustdoc-ui/synthetic-auto-trait-impls/projections-in-super-trait-bound-unsatisfied.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `C: Bar<5>` is not satisfied LL | pub struct Structure { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar<5>` is not implemented for `C` | -help: consider further restricting this bound +help: consider further restricting type parameter `C` with trait `Bar` | LL | pub struct Structure> { | ++++++++ @@ -15,7 +15,7 @@ error[E0277]: the trait bound `C: Bar<5>` is not satisfied LL | _field: C::BarType, | ^^^^^^^^^^ the trait `Bar<5>` is not implemented for `C` | -help: consider further restricting this bound +help: consider further restricting type parameter `C` with trait `Bar` | LL | pub struct Structure> { | ++++++++ diff --git a/tests/ui/associated-types/associated-types-no-suitable-bound.stderr b/tests/ui/associated-types/associated-types-no-suitable-bound.stderr index 9713051d97327..4f951ee4b4e62 100644 --- a/tests/ui/associated-types/associated-types-no-suitable-bound.stderr +++ b/tests/ui/associated-types/associated-types-no-suitable-bound.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `T: Get` is not satisfied LL | fn uhoh(foo: ::Value) {} | ^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `T` | -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Get` | LL | fn uhoh(foo: ::Value) {} | +++++ @@ -15,7 +15,7 @@ error[E0277]: the trait bound `T: Get` is not satisfied LL | fn uhoh(foo: ::Value) {} | ^^ the trait `Get` is not implemented for `T` | -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Get` | LL | fn uhoh(foo: ::Value) {} | +++++ diff --git a/tests/ui/associated-types/defaults-suitability.current.stderr b/tests/ui/associated-types/defaults-suitability.current.stderr index 9c0ae59ae43bf..61247cee1f34d 100644 --- a/tests/ui/associated-types/defaults-suitability.current.stderr +++ b/tests/ui/associated-types/defaults-suitability.current.stderr @@ -47,7 +47,7 @@ note: required by a bound in `Foo::Bar` | LL | type Bar: Clone = Vec; | ^^^^^ required by this bound in `Foo::Bar` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Clone` | LL | trait Foo { | +++++++++++++++++++ @@ -132,7 +132,7 @@ LL | Self::Baz: Clone, ... LL | type Baz = T; | --- required by a bound in this associated type -help: consider further restricting type parameter `T` +help: consider further restricting type parameter `T` with trait `Clone` | LL | Self::Baz: Clone, T: std::clone::Clone | ~~~~~~~~~~~~~~~~~~~~~~ diff --git a/tests/ui/associated-types/defaults-suitability.next.stderr b/tests/ui/associated-types/defaults-suitability.next.stderr index 9c0ae59ae43bf..61247cee1f34d 100644 --- a/tests/ui/associated-types/defaults-suitability.next.stderr +++ b/tests/ui/associated-types/defaults-suitability.next.stderr @@ -47,7 +47,7 @@ note: required by a bound in `Foo::Bar` | LL | type Bar: Clone = Vec; | ^^^^^ required by this bound in `Foo::Bar` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Clone` | LL | trait Foo { | +++++++++++++++++++ @@ -132,7 +132,7 @@ LL | Self::Baz: Clone, ... LL | type Baz = T; | --- required by a bound in this associated type -help: consider further restricting type parameter `T` +help: consider further restricting type parameter `T` with trait `Clone` | LL | Self::Baz: Clone, T: std::clone::Clone | ~~~~~~~~~~~~~~~~~~~~~~ diff --git a/tests/ui/associated-types/hr-associated-type-bound-param-6.stderr b/tests/ui/associated-types/hr-associated-type-bound-param-6.stderr index 5278bdb7a5cf2..b2a86bb7f75e1 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-param-6.stderr +++ b/tests/ui/associated-types/hr-associated-type-bound-param-6.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `for<'b> T: X<'b, T>` is not satisfied LL | impl X<'_, T> for (S,) { | ^^^^^^^^ the trait `for<'b> X<'b, T>` is not implemented for `T` | -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `X` | LL | impl X<'b, T>> X<'_, T> for (S,) { | ++++++++++++++++++ diff --git a/tests/ui/associated-types/hr-associated-type-projection-1.stderr b/tests/ui/associated-types/hr-associated-type-projection-1.stderr index b871bb51ae313..c322d11925af2 100644 --- a/tests/ui/associated-types/hr-associated-type-projection-1.stderr +++ b/tests/ui/associated-types/hr-associated-type-projection-1.stderr @@ -16,7 +16,7 @@ LL | trait UnsafeCopy<'a, T: Copy> LL | where LL | for<'b> >::Item: std::ops::Deref, | ^^^^^^^^^^ required by this bound in `UnsafeCopy` -help: consider further restricting this bound +help: consider further restricting this bound with `` | LL | impl> UnsafeCopy<'_, T> for T { | ++++++++++++ diff --git a/tests/ui/associated-types/issue-27675-unchecked-bounds.stderr b/tests/ui/associated-types/issue-27675-unchecked-bounds.stderr index 70bf90150b8fa..0815bdce16fc3 100644 --- a/tests/ui/associated-types/issue-27675-unchecked-bounds.stderr +++ b/tests/ui/associated-types/issue-27675-unchecked-bounds.stderr @@ -9,7 +9,7 @@ note: required by a bound in `copy` | LL | fn copy(from: &U::From) -> U::From { | ^^^^^ required by this bound in `copy` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | pub fn copy_any(t: &T) -> T { | +++++++++++++++++++ diff --git a/tests/ui/associated-types/issue-43784-associated-type.stderr b/tests/ui/associated-types/issue-43784-associated-type.stderr index 529fc1f119a9c..ba4e683194f10 100644 --- a/tests/ui/associated-types/issue-43784-associated-type.stderr +++ b/tests/ui/associated-types/issue-43784-associated-type.stderr @@ -14,7 +14,7 @@ note: required by a bound in `Complete::Assoc` | LL | type Assoc: Partial; | ^^^^^^^^^^^^^ required by this bound in `Complete::Assoc` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | impl Complete for T { | +++++++++++++++++++ diff --git a/tests/ui/associated-types/issue-59324.stderr b/tests/ui/associated-types/issue-59324.stderr index 6c77ee6044f16..ec2890cc8e7f6 100644 --- a/tests/ui/associated-types/issue-59324.stderr +++ b/tests/ui/associated-types/issue-59324.stderr @@ -7,7 +7,7 @@ LL | | LL | | Service::OnlyFoo> | |______________________________________________^ the trait `Foo` is not implemented for `Bug` | -help: consider further restricting this bound +help: consider further restricting type parameter `Bug` with trait `Foo` | LL | pub trait ThriftService: | +++++ @@ -24,7 +24,7 @@ LL | | LL | | } | |_^ the trait `Foo` is not implemented for `Bug` | -help: consider further restricting this bound +help: consider further restricting type parameter `Bug` with trait `Foo` | LL | pub trait ThriftService: | +++++ @@ -38,7 +38,7 @@ LL | | &self, LL | | ) -> Self::AssocType; | |_________________________^ the trait `Foo` is not implemented for `Bug` | -help: consider further restricting this bound +help: consider further restricting type parameter `Bug` with trait `Foo` | LL | pub trait ThriftService: | +++++ @@ -61,7 +61,7 @@ error[E0277]: the trait bound `Bug: Foo` is not satisfied LL | ) -> Self::AssocType; | ^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `Bug` | -help: consider further restricting this bound +help: consider further restricting type parameter `Bug` with trait `Foo` | LL | pub trait ThriftService: | +++++ diff --git a/tests/ui/async-await/issue-70818.stderr b/tests/ui/async-await/issue-70818.stderr index 317c04d2c7478..8de6a825042bb 100644 --- a/tests/ui/async-await/issue-70818.stderr +++ b/tests/ui/async-await/issue-70818.stderr @@ -9,7 +9,7 @@ note: captured value is not `Send` | LL | async { (ty, ty1) } | ^^^ has type `U` which is not `Send` -help: consider restricting type parameter `U` +help: consider restricting type parameter `U` with trait `Send` | LL | fn foo(ty: T, ty1: U) -> impl Future + Send { | +++++++++++++++++++ diff --git a/tests/ui/async-await/issue-86507.stderr b/tests/ui/async-await/issue-86507.stderr index f4cd7c42706c8..6385a8c975e34 100644 --- a/tests/ui/async-await/issue-86507.stderr +++ b/tests/ui/async-await/issue-86507.stderr @@ -14,7 +14,7 @@ note: captured value is not `Send` because `&` references cannot be sent unless LL | let x = x; | ^ has type `&T` which is not `Send`, because `T` is not `Sync` = note: required for the cast from `Pin>` to `Pin + Send + 'async_trait)>>` -help: consider further restricting this bound +help: consider further restricting type parameter `T` with trait `Sync` | LL | fn bar<'me, 'async_trait, T: Send + std::marker::Sync>(x: &'me T) | +++++++++++++++++++ diff --git a/tests/ui/auto-traits/typeck-auto-trait-no-supertraits-2.stderr b/tests/ui/auto-traits/typeck-auto-trait-no-supertraits-2.stderr index 4c1de72798c45..27e38ce06a435 100644 --- a/tests/ui/auto-traits/typeck-auto-trait-no-supertraits-2.stderr +++ b/tests/ui/auto-traits/typeck-auto-trait-no-supertraits-2.stderr @@ -30,7 +30,7 @@ LL | fn copy(x: T) -> (T, T) { (x, x) } | ^ - you could clone this value | | | consider constraining this type parameter with `Clone` -help: consider further restricting this bound +help: consider further restricting type parameter `T` with trait `Copy` | LL | fn copy(x: T) -> (T, T) { (x, x) } | ++++++ diff --git a/tests/ui/binop/binop-consume-args.stderr b/tests/ui/binop/binop-consume-args.stderr index 1b59216b3c76c..d9d92a44766db 100644 --- a/tests/ui/binop/binop-consume-args.stderr +++ b/tests/ui/binop/binop-consume-args.stderr @@ -17,7 +17,7 @@ LL | lhs + rhs; | --- you could clone this value note: calling this operator moves the left-hand side --> $SRC_DIR/core/src/ops/arith.rs:LL:COL -help: consider further restricting this bound +help: consider further restricting type parameter `A` with trait `Copy` | LL | fn add + Copy, B>(lhs: A, rhs: B) { | ++++++ @@ -40,7 +40,7 @@ LL | fn add, B>(lhs: A, rhs: B) { | ^ consider constraining this type parameter with `Clone` LL | lhs + rhs; | --- you could clone this value -help: consider restricting type parameter `B` +help: consider restricting type parameter `B` with trait `Copy` | LL | fn add, B: Copy>(lhs: A, rhs: B) { | ++++++ @@ -64,7 +64,7 @@ LL | lhs - rhs; | --- you could clone this value note: calling this operator moves the left-hand side --> $SRC_DIR/core/src/ops/arith.rs:LL:COL -help: consider further restricting this bound +help: consider further restricting type parameter `A` with trait `Copy` | LL | fn sub + Copy, B>(lhs: A, rhs: B) { | ++++++ @@ -87,7 +87,7 @@ LL | fn sub, B>(lhs: A, rhs: B) { | ^ consider constraining this type parameter with `Clone` LL | lhs - rhs; | --- you could clone this value -help: consider restricting type parameter `B` +help: consider restricting type parameter `B` with trait `Copy` | LL | fn sub, B: Copy>(lhs: A, rhs: B) { | ++++++ @@ -111,7 +111,7 @@ LL | lhs * rhs; | --- you could clone this value note: calling this operator moves the left-hand side --> $SRC_DIR/core/src/ops/arith.rs:LL:COL -help: consider further restricting this bound +help: consider further restricting type parameter `A` with trait `Copy` | LL | fn mul + Copy, B>(lhs: A, rhs: B) { | ++++++ @@ -134,7 +134,7 @@ LL | fn mul, B>(lhs: A, rhs: B) { | ^ consider constraining this type parameter with `Clone` LL | lhs * rhs; | --- you could clone this value -help: consider restricting type parameter `B` +help: consider restricting type parameter `B` with trait `Copy` | LL | fn mul, B: Copy>(lhs: A, rhs: B) { | ++++++ @@ -158,7 +158,7 @@ LL | lhs / rhs; | --- you could clone this value note: calling this operator moves the left-hand side --> $SRC_DIR/core/src/ops/arith.rs:LL:COL -help: consider further restricting this bound +help: consider further restricting type parameter `A` with trait `Copy` | LL | fn div + Copy, B>(lhs: A, rhs: B) { | ++++++ @@ -181,7 +181,7 @@ LL | fn div, B>(lhs: A, rhs: B) { | ^ consider constraining this type parameter with `Clone` LL | lhs / rhs; | --- you could clone this value -help: consider restricting type parameter `B` +help: consider restricting type parameter `B` with trait `Copy` | LL | fn div, B: Copy>(lhs: A, rhs: B) { | ++++++ @@ -205,7 +205,7 @@ LL | lhs % rhs; | --- you could clone this value note: calling this operator moves the left-hand side --> $SRC_DIR/core/src/ops/arith.rs:LL:COL -help: consider further restricting this bound +help: consider further restricting type parameter `A` with trait `Copy` | LL | fn rem + Copy, B>(lhs: A, rhs: B) { | ++++++ @@ -228,7 +228,7 @@ LL | fn rem, B>(lhs: A, rhs: B) { | ^ consider constraining this type parameter with `Clone` LL | lhs % rhs; | --- you could clone this value -help: consider restricting type parameter `B` +help: consider restricting type parameter `B` with trait `Copy` | LL | fn rem, B: Copy>(lhs: A, rhs: B) { | ++++++ @@ -252,7 +252,7 @@ LL | lhs & rhs; | --- you could clone this value note: calling this operator moves the left-hand side --> $SRC_DIR/core/src/ops/bit.rs:LL:COL -help: consider further restricting this bound +help: consider further restricting type parameter `A` with trait `Copy` | LL | fn bitand + Copy, B>(lhs: A, rhs: B) { | ++++++ @@ -275,7 +275,7 @@ LL | fn bitand, B>(lhs: A, rhs: B) { | ^ consider constraining this type parameter with `Clone` LL | lhs & rhs; | --- you could clone this value -help: consider restricting type parameter `B` +help: consider restricting type parameter `B` with trait `Copy` | LL | fn bitand, B: Copy>(lhs: A, rhs: B) { | ++++++ @@ -299,7 +299,7 @@ LL | lhs | rhs; | --- you could clone this value note: calling this operator moves the left-hand side --> $SRC_DIR/core/src/ops/bit.rs:LL:COL -help: consider further restricting this bound +help: consider further restricting type parameter `A` with trait `Copy` | LL | fn bitor + Copy, B>(lhs: A, rhs: B) { | ++++++ @@ -322,7 +322,7 @@ LL | fn bitor, B>(lhs: A, rhs: B) { | ^ consider constraining this type parameter with `Clone` LL | lhs | rhs; | --- you could clone this value -help: consider restricting type parameter `B` +help: consider restricting type parameter `B` with trait `Copy` | LL | fn bitor, B: Copy>(lhs: A, rhs: B) { | ++++++ @@ -346,7 +346,7 @@ LL | lhs ^ rhs; | --- you could clone this value note: calling this operator moves the left-hand side --> $SRC_DIR/core/src/ops/bit.rs:LL:COL -help: consider further restricting this bound +help: consider further restricting type parameter `A` with trait `Copy` | LL | fn bitxor + Copy, B>(lhs: A, rhs: B) { | ++++++ @@ -369,7 +369,7 @@ LL | fn bitxor, B>(lhs: A, rhs: B) { | ^ consider constraining this type parameter with `Clone` LL | lhs ^ rhs; | --- you could clone this value -help: consider restricting type parameter `B` +help: consider restricting type parameter `B` with trait `Copy` | LL | fn bitxor, B: Copy>(lhs: A, rhs: B) { | ++++++ @@ -393,7 +393,7 @@ LL | lhs << rhs; | --- you could clone this value note: calling this operator moves the left-hand side --> $SRC_DIR/core/src/ops/bit.rs:LL:COL -help: consider further restricting this bound +help: consider further restricting type parameter `A` with trait `Copy` | LL | fn shl + Copy, B>(lhs: A, rhs: B) { | ++++++ @@ -416,7 +416,7 @@ LL | fn shl, B>(lhs: A, rhs: B) { | ^ consider constraining this type parameter with `Clone` LL | lhs << rhs; | --- you could clone this value -help: consider restricting type parameter `B` +help: consider restricting type parameter `B` with trait `Copy` | LL | fn shl, B: Copy>(lhs: A, rhs: B) { | ++++++ @@ -440,7 +440,7 @@ LL | lhs >> rhs; | --- you could clone this value note: calling this operator moves the left-hand side --> $SRC_DIR/core/src/ops/bit.rs:LL:COL -help: consider further restricting this bound +help: consider further restricting type parameter `A` with trait `Copy` | LL | fn shr + Copy, B>(lhs: A, rhs: B) { | ++++++ @@ -463,7 +463,7 @@ LL | fn shr, B>(lhs: A, rhs: B) { | ^ consider constraining this type parameter with `Clone` LL | lhs >> rhs; | --- you could clone this value -help: consider restricting type parameter `B` +help: consider restricting type parameter `B` with trait `Copy` | LL | fn shr, B: Copy>(lhs: A, rhs: B) { | ++++++ diff --git a/tests/ui/binop/binop-move-semantics.stderr b/tests/ui/binop/binop-move-semantics.stderr index 45c7f11040616..2e661c44abd1a 100644 --- a/tests/ui/binop/binop-move-semantics.stderr +++ b/tests/ui/binop/binop-move-semantics.stderr @@ -20,7 +20,7 @@ LL | x | - you could clone this value note: calling this operator moves the left-hand side --> $SRC_DIR/core/src/ops/arith.rs:LL:COL -help: consider further restricting this bound +help: consider further restricting type parameter `T` with trait `Copy` | LL | fn double_move + Copy>(x: T) { | ++++++ @@ -40,7 +40,7 @@ help: consider cloning the value if the performance cost is acceptable | LL | x.clone() | ++++++++ -help: consider further restricting this bound +help: consider further restricting type parameter `T` with trait `Copy` | LL | fn move_then_borrow + Clone + Copy>(x: T) { | ++++++ diff --git a/tests/ui/binop/issue-93927.stderr b/tests/ui/binop/issue-93927.stderr index 9bcf2b17357eb..ff5ecf66be631 100644 --- a/tests/ui/binop/issue-93927.stderr +++ b/tests/ui/binop/issue-93927.stderr @@ -6,7 +6,7 @@ LL | val == val | | | MyType | -help: consider further restricting this bound +help: consider further restricting type parameter `T` with trait `Eq` | LL | fn cond(val: MyType) -> bool { | ++++++++++++++ diff --git a/tests/ui/borrowck/clone-on-ref.stderr b/tests/ui/borrowck/clone-on-ref.stderr index d5d21296a3f96..911c136086cfc 100644 --- a/tests/ui/borrowck/clone-on-ref.stderr +++ b/tests/ui/borrowck/clone-on-ref.stderr @@ -12,7 +12,7 @@ LL | LL | drop(cloned_items); | ------------ immutable borrow later used here | -help: consider further restricting this bound +help: consider further restricting type parameter `T` with trait `Clone` | LL | fn foo(list: &mut Vec) { | +++++++ @@ -39,7 +39,7 @@ LL | fn bar(x: T) { | ^ consider constraining this type parameter with `Clone` LL | let a = &x; | - you could clone this value -help: consider further restricting this bound +help: consider further restricting type parameter `T` with trait `Clone` | LL | fn bar(x: T) { | +++++++ diff --git a/tests/ui/borrowck/move-error-suggest-clone-panic-issue-127915.stderr b/tests/ui/borrowck/move-error-suggest-clone-panic-issue-127915.stderr index 6997710ec89fa..e32a0c54dfee8 100644 --- a/tests/ui/borrowck/move-error-suggest-clone-panic-issue-127915.stderr +++ b/tests/ui/borrowck/move-error-suggest-clone-panic-issue-127915.stderr @@ -15,7 +15,7 @@ LL | fn test(a: i64, b: i64, c: i64, d: i64, e: i64, f: T, g: U) -> i64 { ... LL | 6, a as f64, b, b as f64, f, c as f64, d, d as f64, e, e as f64, f, g, | - you could clone this value -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | fn test(a: i64, b: i64, c: i64, d: i64, e: i64, f: T, g: U) -> i64 { | ++++++ diff --git a/tests/ui/builtin-superkinds/builtin-superkinds-double-superkind.stderr b/tests/ui/builtin-superkinds/builtin-superkinds-double-superkind.stderr index 592aa4369ce0d..9915b772afaf6 100644 --- a/tests/ui/builtin-superkinds/builtin-superkinds-double-superkind.stderr +++ b/tests/ui/builtin-superkinds/builtin-superkinds-double-superkind.stderr @@ -10,7 +10,7 @@ note: required by a bound in `Foo` | LL | trait Foo : Send+Sync { } | ^^^^ required by this bound in `Foo` -help: consider further restricting this bound +help: consider further restricting type parameter `T` with trait `Send` | LL | impl Foo for (T,) { } | +++++++++++++++++++ @@ -27,7 +27,7 @@ note: required by a bound in `Foo` | LL | trait Foo : Send+Sync { } | ^^^^ required by this bound in `Foo` -help: consider further restricting this bound +help: consider further restricting type parameter `T` with trait `Sync` | LL | impl Foo for (T,T) { } | +++++++++++++++++++ diff --git a/tests/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr b/tests/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr index 251651df4f908..39a04186981f3 100644 --- a/tests/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr +++ b/tests/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr @@ -14,7 +14,7 @@ note: required by a bound in `RequiresRequiresShareAndSend` | LL | pub trait RequiresRequiresShareAndSend : RequiresShare + Send { } | ^^^^ required by this bound in `RequiresRequiresShareAndSend` -help: consider further restricting this bound +help: consider further restricting type parameter `T` with trait `Send` | LL | impl RequiresRequiresShareAndSend for X { } | +++++++++++++++++++ diff --git a/tests/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.stderr b/tests/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.stderr index 4a25c42b5835d..dd273b875aebd 100644 --- a/tests/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.stderr +++ b/tests/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.stderr @@ -9,7 +9,7 @@ note: required by a bound in `Foo` | LL | trait Foo : Send { } | ^^^^ required by this bound in `Foo` -help: consider further restricting this bound +help: consider further restricting type parameter `T` with trait `Send` | LL | impl Foo for T { } | +++++++++++++++++++ diff --git a/tests/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr b/tests/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr index 8157590bd9e8e..9ceee477856d6 100644 --- a/tests/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr +++ b/tests/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr @@ -9,7 +9,7 @@ note: required by a bound in `X` | LL | struct X where F: FnOnce() + 'static + Send { | ^^^^ required by this bound in `X` -help: consider further restricting this bound +help: consider further restricting type parameter `F` with trait `Send` | LL | fn foo(blk: F) -> X where F: FnOnce() + 'static + std::marker::Send { | +++++++++++++++++++ @@ -25,7 +25,7 @@ note: required by a bound in `X` | LL | struct X where F: FnOnce() + 'static + Send { | ^^^^ required by this bound in `X` -help: consider further restricting this bound +help: consider further restricting type parameter `F` with trait `Send` | LL | fn foo(blk: F) -> X where F: FnOnce() + 'static + std::marker::Send { | +++++++++++++++++++ diff --git a/tests/ui/closures/closure-bounds-subtype.stderr b/tests/ui/closures/closure-bounds-subtype.stderr index 42588668e8a03..34c5e0299a751 100644 --- a/tests/ui/closures/closure-bounds-subtype.stderr +++ b/tests/ui/closures/closure-bounds-subtype.stderr @@ -15,7 +15,7 @@ help: use parentheses to call this type parameter | LL | take_const_owned(f()); | ++ -help: consider further restricting this bound +help: consider further restricting type parameter `F` with trait `Sync` | LL | fn give_owned(f: F) where F: FnOnce() + Send + std::marker::Sync { | +++++++++++++++++++ diff --git a/tests/ui/closures/issue-67123.stderr b/tests/ui/closures/issue-67123.stderr index bdafeaef15fd5..7db82845ea5a6 100644 --- a/tests/ui/closures/issue-67123.stderr +++ b/tests/ui/closures/issue-67123.stderr @@ -7,7 +7,7 @@ LL | || { t; t; }; | value moved here | = note: move occurs because `t` has type `T`, which does not implement the `Copy` trait -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | fn foo(t: T) { | ++++++ diff --git a/tests/ui/coherence/fuzzing/best-obligation-ICE.stderr b/tests/ui/coherence/fuzzing/best-obligation-ICE.stderr index 88de8023f6d79..01b6eaf422ed9 100644 --- a/tests/ui/coherence/fuzzing/best-obligation-ICE.stderr +++ b/tests/ui/coherence/fuzzing/best-obligation-ICE.stderr @@ -41,7 +41,7 @@ note: required by a bound in `W` | LL | struct W(*mut T); | ^^^^^ required by this bound in `W` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Trait` | LL | impl Trait for W>> {} | +++++++ diff --git a/tests/ui/const-generics/generic_arg_infer/array-repeat-expr-lib.rs b/tests/ui/const-generics/generic_arg_infer/array-repeat-expr-lib.rs new file mode 100644 index 0000000000000..c1f725db126a0 --- /dev/null +++ b/tests/ui/const-generics/generic_arg_infer/array-repeat-expr-lib.rs @@ -0,0 +1,12 @@ +//@ check-pass + +#![feature(generic_arg_infer)] +#![crate_type = "lib"] + +// Test that encoding the hallucinated `DefId` for the `_` const argument doesn't +// ICE (see #133468). This requires this to be a library crate. + +pub fn foo() { + let s: [u8; 10]; + s = [0; _]; +} diff --git a/tests/ui/const-generics/issues/issue-61336-2.stderr b/tests/ui/const-generics/issues/issue-61336-2.stderr index b0864689f7400..92a704da8b45e 100644 --- a/tests/ui/const-generics/issues/issue-61336-2.stderr +++ b/tests/ui/const-generics/issues/issue-61336-2.stderr @@ -7,7 +7,7 @@ LL | [x; { N }] = note: the `Copy` trait is required because this value will be copied for each element of the array = help: consider using `core::array::from_fn` to initialize the array = help: see https://doc.rust-lang.org/stable/std/array/fn.from_fn.html for more information -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | fn g(x: T) -> [T; N] { | +++++++++++++++++++ diff --git a/tests/ui/const-generics/issues/issue-61336.stderr b/tests/ui/const-generics/issues/issue-61336.stderr index 111afbda343f7..43e8f5c044a13 100644 --- a/tests/ui/const-generics/issues/issue-61336.stderr +++ b/tests/ui/const-generics/issues/issue-61336.stderr @@ -7,7 +7,7 @@ LL | [x; N] = note: the `Copy` trait is required because this value will be copied for each element of the array = help: consider using `core::array::from_fn` to initialize the array = help: see https://doc.rust-lang.org/stable/std/array/fn.from_fn.html for more information -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | fn g(x: T) -> [T; N] { | +++++++++++++++++++ diff --git a/tests/ui/consts/const-size_of_val-align_of_val-extern-type.rs b/tests/ui/consts/const-size_of_val-align_of_val-extern-type.rs index 4df3a793b4c38..598904d3c4453 100644 --- a/tests/ui/consts/const-size_of_val-align_of_val-extern-type.rs +++ b/tests/ui/consts/const-size_of_val-align_of_val-extern-type.rs @@ -1,6 +1,5 @@ #![feature(extern_types)] #![feature(core_intrinsics)] -#![feature(const_size_of_val, const_align_of_val)] use std::intrinsics::{min_align_of_val, size_of_val}; diff --git a/tests/ui/consts/const-size_of_val-align_of_val-extern-type.stderr b/tests/ui/consts/const-size_of_val-align_of_val-extern-type.stderr index ad2de0f4d3129..4c0252123a4d3 100644 --- a/tests/ui/consts/const-size_of_val-align_of_val-extern-type.stderr +++ b/tests/ui/consts/const-size_of_val-align_of_val-extern-type.stderr @@ -1,11 +1,11 @@ error[E0080]: evaluation of constant value failed - --> $DIR/const-size_of_val-align_of_val-extern-type.rs:11:31 + --> $DIR/const-size_of_val-align_of_val-extern-type.rs:10:31 | LL | const _SIZE: usize = unsafe { size_of_val(&4 as *const i32 as *const Opaque) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `extern type` does not have known layout error[E0080]: evaluation of constant value failed - --> $DIR/const-size_of_val-align_of_val-extern-type.rs:12:32 + --> $DIR/const-size_of_val-align_of_val-extern-type.rs:11:32 | LL | const _ALIGN: usize = unsafe { min_align_of_val(&4 as *const i32 as *const Opaque) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `extern type` does not have known layout diff --git a/tests/ui/consts/const-size_of_val-align_of_val.rs b/tests/ui/consts/const-size_of_val-align_of_val.rs index ee9dfca0170bb..d4b5a90351797 100644 --- a/tests/ui/consts/const-size_of_val-align_of_val.rs +++ b/tests/ui/consts/const-size_of_val-align_of_val.rs @@ -1,7 +1,6 @@ //@ run-pass -#![feature(const_size_of_val, const_align_of_val)] -#![feature(const_size_of_val_raw, const_align_of_val_raw, layout_for_ptr)] +#![feature(layout_for_ptr)] use std::{mem, ptr}; diff --git a/tests/ui/consts/ct-var-in-collect_all_mismatches.stderr b/tests/ui/consts/ct-var-in-collect_all_mismatches.stderr index 24572040b9104..74ec052f6ecb7 100644 --- a/tests/ui/consts/ct-var-in-collect_all_mismatches.stderr +++ b/tests/ui/consts/ct-var-in-collect_all_mismatches.stderr @@ -12,7 +12,7 @@ LL | fn unsatisfied(self) LL | where LL | T: Bar, | ^^^^^^ required by this bound in `Foo::::unsatisfied` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Bar` | LL | impl, const N: usize> Foo { | ++++++++ diff --git a/tests/ui/consts/fn_trait_refs.stderr b/tests/ui/consts/fn_trait_refs.stderr index 11e13c3efdd19..bb7ff76b1255c 100644 --- a/tests/ui/consts/fn_trait_refs.stderr +++ b/tests/ui/consts/fn_trait_refs.stderr @@ -212,10 +212,6 @@ LL | f() | ^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: consider further restricting this bound - | -LL | T: ~const Fn<()> + ~const Destruct + ~const Fn(), - | +++++++++++++ error[E0015]: cannot call non-const closure in constant functions --> $DIR/fn_trait_refs.rs:23:5 @@ -224,10 +220,6 @@ LL | f() | ^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: consider further restricting this bound - | -LL | T: ~const FnMut<()> + ~const Destruct + ~const FnMut(), - | ++++++++++++++++ error[E0015]: cannot call non-const closure in constant functions --> $DIR/fn_trait_refs.rs:30:5 @@ -236,10 +228,6 @@ LL | f() | ^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: consider further restricting this bound - | -LL | T: ~const FnOnce<()> + ~const FnOnce(), - | +++++++++++++++++ error: aborting due to 25 previous errors diff --git a/tests/ui/consts/unstable-const-fn-in-libcore.stderr b/tests/ui/consts/unstable-const-fn-in-libcore.stderr index 2bdec1bf41b72..f40c1871e90b9 100644 --- a/tests/ui/consts/unstable-const-fn-in-libcore.stderr +++ b/tests/ui/consts/unstable-const-fn-in-libcore.stderr @@ -19,10 +19,6 @@ LL | Opt::None => f(), | ^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: consider further restricting this bound - | -LL | const fn unwrap_or_else T + ~const FnOnce()>(self, f: F) -> T { - | +++++++++++++++++ error[E0493]: destructor of `F` cannot be evaluated at compile-time --> $DIR/unstable-const-fn-in-libcore.rs:19:60 diff --git a/tests/ui/drop/lint-if-let-rescope.fixed b/tests/ui/drop/lint-if-let-rescope.fixed index fec2e3b2ae705..182190aa323bc 100644 --- a/tests/ui/drop/lint-if-let-rescope.fixed +++ b/tests/ui/drop/lint-if-let-rescope.fixed @@ -14,7 +14,7 @@ impl Drop for Droppy { } } impl Droppy { - fn get(&self) -> Option { + const fn get(&self) -> Option { None } } @@ -62,11 +62,10 @@ fn main() { //~| HELP: a `match` with a single arm can preserve the drop order up to Edition 2021 } - if let () = { match Droppy.get() { Some(_value) => {} _ => {}} } { - //~^ ERROR: `if let` assigns a shorter lifetime since Edition 2024 - //~| WARN: this changes meaning in Rust 2024 - //~| HELP: the value is now dropped here in Edition 2024 - //~| HELP: a `match` with a single arm can preserve the drop order up to Edition 2021 + if let () = { if let Some(_value) = Droppy.get() {} } { + // This should not lint. + // This `if let` sits is a tail expression of a block. + // In Edition 2024, the temporaries are dropped before exiting the surrounding block. } #[rustfmt::skip] @@ -94,4 +93,17 @@ fn main() { //~| HELP: the value is now dropped here in Edition 2024 //~| HELP: a `match` with a single arm can preserve the drop order up to Edition 2021 } + + // We want to keep the `if let`s below as direct descendents of match arms, + // so the formatting is suppressed. + #[rustfmt::skip] + match droppy().get() { + _ => if let Some(_value) = droppy().get() {}, + // Should not lint + // There is implicitly a block surrounding the `if let`. + // Given that it is a tail expression, the temporaries are dropped duly before + // the execution is exiting the `match`. + } + + if let Some(_value) = droppy().get() {} } diff --git a/tests/ui/drop/lint-if-let-rescope.rs b/tests/ui/drop/lint-if-let-rescope.rs index ee184695b97ac..e1b38be0a0f50 100644 --- a/tests/ui/drop/lint-if-let-rescope.rs +++ b/tests/ui/drop/lint-if-let-rescope.rs @@ -14,7 +14,7 @@ impl Drop for Droppy { } } impl Droppy { - fn get(&self) -> Option { + const fn get(&self) -> Option { None } } @@ -63,10 +63,9 @@ fn main() { } if let () = { if let Some(_value) = Droppy.get() {} } { - //~^ ERROR: `if let` assigns a shorter lifetime since Edition 2024 - //~| WARN: this changes meaning in Rust 2024 - //~| HELP: the value is now dropped here in Edition 2024 - //~| HELP: a `match` with a single arm can preserve the drop order up to Edition 2021 + // This should not lint. + // This `if let` sits is a tail expression of a block. + // In Edition 2024, the temporaries are dropped before exiting the surrounding block. } #[rustfmt::skip] @@ -94,4 +93,17 @@ fn main() { //~| HELP: the value is now dropped here in Edition 2024 //~| HELP: a `match` with a single arm can preserve the drop order up to Edition 2021 } + + // We want to keep the `if let`s below as direct descendents of match arms, + // so the formatting is suppressed. + #[rustfmt::skip] + match droppy().get() { + _ => if let Some(_value) = droppy().get() {}, + // Should not lint + // There is implicitly a block surrounding the `if let`. + // Given that it is a tail expression, the temporaries are dropped duly before + // the execution is exiting the `match`. + } + + if let Some(_value) = droppy().get() {} } diff --git a/tests/ui/drop/lint-if-let-rescope.stderr b/tests/ui/drop/lint-if-let-rescope.stderr index ef60d141b7988..cfb7070c09755 100644 --- a/tests/ui/drop/lint-if-let-rescope.stderr +++ b/tests/ui/drop/lint-if-let-rescope.stderr @@ -112,27 +112,7 @@ LL | if let Some(1) = { match Droppy.get() { Some(_value) => { Some(1) } _ = | ~~~~~ +++++++++++++++++ ~~~~ + error: `if let` assigns a shorter lifetime since Edition 2024 - --> $DIR/lint-if-let-rescope.rs:65:22 - | -LL | if let () = { if let Some(_value) = Droppy.get() {} } { - | ^^^^^^^^^^^^^^^^^^^------^^^^^^ - | | - | this value has a significant drop implementation which may observe a major change in drop order and requires your discretion - | - = warning: this changes meaning in Rust 2024 - = note: for more information, see issue #124085 -help: the value is now dropped here in Edition 2024 - --> $DIR/lint-if-let-rescope.rs:65:55 - | -LL | if let () = { if let Some(_value) = Droppy.get() {} } { - | ^ -help: a `match` with a single arm can preserve the drop order up to Edition 2021 - | -LL | if let () = { match Droppy.get() { Some(_value) => {} _ => {}} } { - | ~~~~~ +++++++++++++++++ ++++++++ - -error: `if let` assigns a shorter lifetime since Edition 2024 - --> $DIR/lint-if-let-rescope.rs:73:12 + --> $DIR/lint-if-let-rescope.rs:72:12 | LL | if (if let Some(_value) = droppy().get() { true } else { false }) { | ^^^^^^^^^^^^^^^^^^^--------^^^^^^ @@ -142,7 +122,7 @@ LL | if (if let Some(_value) = droppy().get() { true } else { false }) { = warning: this changes meaning in Rust 2024 = note: for more information, see issue #124085 help: the value is now dropped here in Edition 2024 - --> $DIR/lint-if-let-rescope.rs:73:53 + --> $DIR/lint-if-let-rescope.rs:72:53 | LL | if (if let Some(_value) = droppy().get() { true } else { false }) { | ^ @@ -152,7 +132,7 @@ LL | if (match droppy().get() { Some(_value) => { true } _ => { false }}) { | ~~~~~ +++++++++++++++++ ~~~~ + error: `if let` assigns a shorter lifetime since Edition 2024 - --> $DIR/lint-if-let-rescope.rs:79:21 + --> $DIR/lint-if-let-rescope.rs:78:21 | LL | } else if (((if let Some(_value) = droppy().get() { true } else { false }))) { | ^^^^^^^^^^^^^^^^^^^--------^^^^^^ @@ -162,7 +142,7 @@ LL | } else if (((if let Some(_value) = droppy().get() { true } else { false = warning: this changes meaning in Rust 2024 = note: for more information, see issue #124085 help: the value is now dropped here in Edition 2024 - --> $DIR/lint-if-let-rescope.rs:79:62 + --> $DIR/lint-if-let-rescope.rs:78:62 | LL | } else if (((if let Some(_value) = droppy().get() { true } else { false }))) { | ^ @@ -172,7 +152,7 @@ LL | } else if (((match droppy().get() { Some(_value) => { true } _ => { fal | ~~~~~ +++++++++++++++++ ~~~~ + error: `if let` assigns a shorter lifetime since Edition 2024 - --> $DIR/lint-if-let-rescope.rs:91:15 + --> $DIR/lint-if-let-rescope.rs:90:15 | LL | while (if let Some(_value) = droppy().get() { false } else { true }) { | ^^^^^^^^^^^^^^^^^^^--------^^^^^^ @@ -182,7 +162,7 @@ LL | while (if let Some(_value) = droppy().get() { false } else { true }) { = warning: this changes meaning in Rust 2024 = note: for more information, see issue #124085 help: the value is now dropped here in Edition 2024 - --> $DIR/lint-if-let-rescope.rs:91:57 + --> $DIR/lint-if-let-rescope.rs:90:57 | LL | while (if let Some(_value) = droppy().get() { false } else { true }) { | ^ @@ -191,5 +171,5 @@ help: a `match` with a single arm can preserve the drop order up to Edition 2021 LL | while (match droppy().get() { Some(_value) => { false } _ => { true }}) { | ~~~~~ +++++++++++++++++ ~~~~ + -error: aborting due to 8 previous errors +error: aborting due to 7 previous errors diff --git a/tests/ui/dropck/explicit-drop-bounds.bad1.stderr b/tests/ui/dropck/explicit-drop-bounds.bad1.stderr index 3ef11e2c0bbd1..2caa779ffabac 100644 --- a/tests/ui/dropck/explicit-drop-bounds.bad1.stderr +++ b/tests/ui/dropck/explicit-drop-bounds.bad1.stderr @@ -9,7 +9,7 @@ note: required by a bound in `DropMe` | LL | struct DropMe(T); | ^^^^ required by this bound in `DropMe` -help: consider further restricting type parameter `T` +help: consider further restricting type parameter `T` with trait `Copy` | LL | [T; 1]: Copy, T: std::marker::Copy // But `[T; 1]: Copy` does not imply `T: Copy` | ~~~~~~~~~~~~~~~~~~~~~~ @@ -25,7 +25,7 @@ note: required by a bound in `DropMe` | LL | struct DropMe(T); | ^^^^ required by this bound in `DropMe` -help: consider further restricting type parameter `T` +help: consider further restricting type parameter `T` with trait `Copy` | LL | [T; 1]: Copy, T: std::marker::Copy // But `[T; 1]: Copy` does not imply `T: Copy` | ~~~~~~~~~~~~~~~~~~~~~~ diff --git a/tests/ui/dropck/explicit-drop-bounds.bad2.stderr b/tests/ui/dropck/explicit-drop-bounds.bad2.stderr index 8138b86ddea46..5851731e83461 100644 --- a/tests/ui/dropck/explicit-drop-bounds.bad2.stderr +++ b/tests/ui/dropck/explicit-drop-bounds.bad2.stderr @@ -9,7 +9,7 @@ note: required by a bound in `DropMe` | LL | struct DropMe(T); | ^^^^ required by this bound in `DropMe` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | impl Drop for DropMe | +++++++++++++++++++ @@ -25,7 +25,7 @@ note: required by a bound in `DropMe` | LL | struct DropMe(T); | ^^^^ required by this bound in `DropMe` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | impl Drop for DropMe | +++++++++++++++++++ diff --git a/tests/ui/error-codes/E0229.stderr b/tests/ui/error-codes/E0229.stderr index 038f44e8b14f0..ab2536cc0c9d5 100644 --- a/tests/ui/error-codes/E0229.stderr +++ b/tests/ui/error-codes/E0229.stderr @@ -42,7 +42,7 @@ error[E0277]: the trait bound `I: Foo` is not satisfied LL | fn baz(x: &>::A) {} | ^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `I` | -help: consider restricting type parameter `I` +help: consider restricting type parameter `I` with trait `Foo` | LL | fn baz(x: &>::A) {} | +++++ @@ -53,7 +53,7 @@ error[E0277]: the trait bound `I: Foo` is not satisfied LL | fn baz(x: &>::A) {} | ^^ the trait `Foo` is not implemented for `I` | -help: consider restricting type parameter `I` +help: consider restricting type parameter `I` with trait `Foo` | LL | fn baz(x: &>::A) {} | +++++ diff --git a/tests/ui/errors/trait-bound-error-spans/blame-trait-error.stderr b/tests/ui/errors/trait-bound-error-spans/blame-trait-error.stderr index 9228a047e8785..b221195a7bd5c 100644 --- a/tests/ui/errors/trait-bound-error-spans/blame-trait-error.stderr +++ b/tests/ui/errors/trait-bound-error-spans/blame-trait-error.stderr @@ -25,7 +25,7 @@ note: required by a bound in `want` | LL | fn want(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T3` | LL | fn example(q: Q) { | ++++ @@ -73,7 +73,7 @@ note: required by a bound in `want` | LL | fn want(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `Iterator` | LL | fn example(q: Q) { | +++++++++++++++++++++ @@ -100,7 +100,7 @@ note: required by a bound in `want` | LL | fn want(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `Iterator` | LL | fn example(q: Q) { | +++++++++++++++++++++ @@ -125,7 +125,7 @@ note: required by a bound in `want` | LL | fn want(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T3` | LL | fn example(q: Q) { | ++++ @@ -150,7 +150,7 @@ note: required by a bound in `want` | LL | fn want(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T3` | LL | fn example(q: Q) { | ++++ @@ -175,7 +175,7 @@ note: required by a bound in `want` | LL | fn want(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T3` | LL | fn example(q: Q) { | ++++ @@ -200,7 +200,7 @@ note: required by a bound in `want` | LL | fn want(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T3` | LL | fn example(q: Q) { | ++++ @@ -225,7 +225,7 @@ note: required by a bound in `want` | LL | fn want(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T3` | LL | fn example(q: Q) { | ++++ @@ -248,7 +248,7 @@ note: required by a bound in `want` | LL | fn want(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T3` | LL | fn example(q: Q) { | ++++ @@ -273,7 +273,7 @@ note: required by a bound in `want` | LL | fn want(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T3` | LL | fn example(q: Q) { | ++++ @@ -296,7 +296,7 @@ note: required by a bound in `want` | LL | fn want(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T3` | LL | fn example(q: Q) { | ++++ @@ -319,7 +319,7 @@ note: required by a bound in `want` | LL | fn want(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T3` | LL | fn example(q: Q) { | ++++ @@ -342,7 +342,7 @@ note: required by a bound in `want` | LL | fn want(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T3` | LL | fn example(q: Q) { | ++++ @@ -367,7 +367,7 @@ note: required by a bound in `want` | LL | fn want(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T3` | LL | fn example(q: Q) { | ++++ @@ -392,7 +392,7 @@ note: required by a bound in `want` | LL | fn want(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T3` | LL | fn example(q: Q) { | ++++ diff --git a/tests/ui/errors/traits/blame-trait-error-spans-on-exprs.stderr b/tests/ui/errors/traits/blame-trait-error-spans-on-exprs.stderr index b6a24e12bcc76..90380091c5096 100644 --- a/tests/ui/errors/traits/blame-trait-error-spans-on-exprs.stderr +++ b/tests/ui/errors/traits/blame-trait-error-spans-on-exprs.stderr @@ -23,7 +23,7 @@ note: required by a bound in `want` | LL | fn want(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T3` | LL | fn example(q: Q) { | ++++ @@ -53,7 +53,7 @@ note: required by a bound in `want` | LL | fn want(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T3` | LL | fn example(q: Q) { | ++++ @@ -85,7 +85,7 @@ note: required by a bound in `want` | LL | fn want(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T3` | LL | fn example(q: Q) { | ++++ @@ -117,7 +117,7 @@ note: required by a bound in `want` | LL | fn want(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T3` | LL | fn example(q: Q) { | ++++ @@ -147,7 +147,7 @@ note: required by a bound in `want` | LL | fn want(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T3` | LL | fn example(q: Q) { | ++++ @@ -172,7 +172,7 @@ note: required by a bound in `want` | LL | fn want(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T2` | LL | fn example(q: Q) { | ++++ @@ -204,7 +204,7 @@ note: required by a bound in `want` | LL | fn want(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T3` | LL | fn example(q: Q) { | ++++ @@ -236,7 +236,7 @@ note: required by a bound in `want` | LL | fn want(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T3` | LL | fn example(q: Q) { | ++++ @@ -261,7 +261,7 @@ note: required by a bound in `want` | LL | fn want(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T1` | LL | fn example(q: Q) { | ++++ @@ -286,7 +286,7 @@ note: required by a bound in `want` | LL | fn want(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T1` | LL | fn example(q: Q) { | ++++ @@ -318,7 +318,7 @@ note: required by a bound in `want` | LL | fn want(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T3` | LL | fn example(q: Q) { | ++++ @@ -343,7 +343,7 @@ note: required by a bound in `want` | LL | fn want(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T1` | LL | fn example(q: Q) { | ++++ @@ -370,7 +370,7 @@ note: required by a bound in `want` | LL | fn want(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T1` | LL | fn example(q: Q) { | ++++ @@ -402,7 +402,7 @@ note: required by a bound in `want` | LL | fn want(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T3` | LL | fn example(q: Q) { | ++++ diff --git a/tests/ui/generic-associated-types/generic-associated-types-where.stderr b/tests/ui/generic-associated-types/generic-associated-types-where.stderr index 9a745c099c0ed..7dce34650d78c 100644 --- a/tests/ui/generic-associated-types/generic-associated-types-where.stderr +++ b/tests/ui/generic-associated-types/generic-associated-types-where.stderr @@ -5,7 +5,7 @@ LL | type Assoc2 = Vec; | ^^^^^^ `T` cannot be formatted with the default formatter | = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Display` | LL | type Assoc2 = Vec; | +++++++++++++++++++ diff --git a/tests/ui/generic-associated-types/impl_bounds.stderr b/tests/ui/generic-associated-types/impl_bounds.stderr index 261070d1db4bf..aa56505dd300b 100644 --- a/tests/ui/generic-associated-types/impl_bounds.stderr +++ b/tests/ui/generic-associated-types/impl_bounds.stderr @@ -41,7 +41,7 @@ LL | trait Foo { LL | type C where Self: Clone; | ^ this trait's associated type doesn't have the requirement `Fooy: Copy` = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | impl Foo for Fooy { | +++++++++++++++++++ @@ -66,7 +66,7 @@ LL | trait Foo { LL | fn d() where Self: Clone; | ^ this trait's method doesn't have the requirement `Fooy: Copy` = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | impl Foo for Fooy { | +++++++++++++++++++ diff --git a/tests/ui/generic-associated-types/issue-68641-check-gat-bounds.stderr b/tests/ui/generic-associated-types/issue-68641-check-gat-bounds.stderr index 55901cf450b67..ac91bdcf3e932 100644 --- a/tests/ui/generic-associated-types/issue-68641-check-gat-bounds.stderr +++ b/tests/ui/generic-associated-types/issue-68641-check-gat-bounds.stderr @@ -9,7 +9,7 @@ note: required by a bound in `UnsafeCopy::Item` | LL | type Item<'a>: Copy; | ^^^^ required by this bound in `UnsafeCopy::Item` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | impl UnsafeCopy for T { | +++++++++++++++++++ diff --git a/tests/ui/generic-associated-types/issue-68642-broken-llvm-ir.stderr b/tests/ui/generic-associated-types/issue-68642-broken-llvm-ir.stderr index 3929e66a25a3a..d98071efe8311 100644 --- a/tests/ui/generic-associated-types/issue-68642-broken-llvm-ir.stderr +++ b/tests/ui/generic-associated-types/issue-68642-broken-llvm-ir.stderr @@ -10,7 +10,7 @@ note: required by a bound in `Fun::F` | LL | type F<'a>: Fn() -> u32; | ^^^^^^^^^^^ required by this bound in `Fun::F` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Fn` | LL | impl Fun for T { | ++++++ diff --git a/tests/ui/generic-associated-types/issue-68643-broken-mir.stderr b/tests/ui/generic-associated-types/issue-68643-broken-mir.stderr index 662726b899351..cd4c06a8660a8 100644 --- a/tests/ui/generic-associated-types/issue-68643-broken-mir.stderr +++ b/tests/ui/generic-associated-types/issue-68643-broken-mir.stderr @@ -10,7 +10,7 @@ note: required by a bound in `Fun::F` | LL | type F<'a>: Fn() -> u32; | ^^^^^^^^^^^ required by this bound in `Fun::F` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Fn` | LL | impl Fun for T { | ++++++ diff --git a/tests/ui/generic-associated-types/issue-68644-codegen-selection.stderr b/tests/ui/generic-associated-types/issue-68644-codegen-selection.stderr index 34278249e35d1..12f9949a0d304 100644 --- a/tests/ui/generic-associated-types/issue-68644-codegen-selection.stderr +++ b/tests/ui/generic-associated-types/issue-68644-codegen-selection.stderr @@ -10,7 +10,7 @@ note: required by a bound in `Fun::F` | LL | type F<'a>: Fn() -> u32; | ^^^^^^^^^^^ required by this bound in `Fun::F` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Fn` | LL | impl Fun for T { | ++++++ diff --git a/tests/ui/generic-associated-types/issue-68645-codegen-fulfillment.stderr b/tests/ui/generic-associated-types/issue-68645-codegen-fulfillment.stderr index dafe1c1d39503..8b23f60953061 100644 --- a/tests/ui/generic-associated-types/issue-68645-codegen-fulfillment.stderr +++ b/tests/ui/generic-associated-types/issue-68645-codegen-fulfillment.stderr @@ -10,7 +10,7 @@ note: required by a bound in `Fun::F` | LL | type F<'a>: Fn() -> u32; | ^^^^^^^^^^^ required by this bound in `Fun::F` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Fn` | LL | impl Fun for T { | ++++++ diff --git a/tests/ui/generic-associated-types/issue-68656-unsized-values.stderr b/tests/ui/generic-associated-types/issue-68656-unsized-values.stderr index ecb337bbceb91..16bfe2ec93373 100644 --- a/tests/ui/generic-associated-types/issue-68656-unsized-values.stderr +++ b/tests/ui/generic-associated-types/issue-68656-unsized-values.stderr @@ -13,7 +13,7 @@ note: required by a bound in `UnsafeCopy::Item` | LL | type Item<'a>: std::ops::Deref; | ^^^^^^^^^^ required by this bound in `UnsafeCopy::Item` -help: consider further restricting this bound +help: consider further restricting this bound with `` | LL | impl> UnsafeCopy for T { | ++++++++++++ diff --git a/tests/ui/generic-associated-types/issue-74824.current.stderr b/tests/ui/generic-associated-types/issue-74824.current.stderr index 231136612a051..3a72db27097f7 100644 --- a/tests/ui/generic-associated-types/issue-74824.current.stderr +++ b/tests/ui/generic-associated-types/issue-74824.current.stderr @@ -23,7 +23,7 @@ note: required by a bound in `UnsafeCopy::Copy` | LL | type Copy: Copy = Box; | ^^^^ required by this bound in `UnsafeCopy::Copy` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Clone` | LL | type Copy: Copy = Box; | +++++++++++++++++++ diff --git a/tests/ui/generic-associated-types/issue-74824.next.stderr b/tests/ui/generic-associated-types/issue-74824.next.stderr index 231136612a051..3a72db27097f7 100644 --- a/tests/ui/generic-associated-types/issue-74824.next.stderr +++ b/tests/ui/generic-associated-types/issue-74824.next.stderr @@ -23,7 +23,7 @@ note: required by a bound in `UnsafeCopy::Copy` | LL | type Copy: Copy = Box; | ^^^^ required by this bound in `UnsafeCopy::Copy` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Clone` | LL | type Copy: Copy = Box; | +++++++++++++++++++ diff --git a/tests/ui/generic-associated-types/missing-bounds.stderr b/tests/ui/generic-associated-types/missing-bounds.stderr index 1d7d80d1b0768..c18cc3106f351 100644 --- a/tests/ui/generic-associated-types/missing-bounds.stderr +++ b/tests/ui/generic-associated-types/missing-bounds.stderr @@ -35,7 +35,7 @@ note: tuple struct defined here | LL | struct A(B); | ^ -help: consider further restricting this bound +help: consider further restricting this bound with `` | LL | impl Add for A where B: Add { | ++++++++++++ @@ -58,7 +58,7 @@ note: tuple struct defined here | LL | struct C(B); | ^ -help: consider further restricting this bound +help: consider further restricting this bound with `` | LL | impl> Add for C { | ++++++++++++ @@ -71,7 +71,7 @@ LL | Self(self.0 + rhs.0) | | | B | -help: consider restricting type parameter `B` +help: consider restricting type parameter `B` with trait `Add` | LL | impl> Add for D { | +++++++++++++++++++++++++++ @@ -94,7 +94,7 @@ note: tuple struct defined here | LL | struct E(B); | ^ -help: consider further restricting this bound +help: consider further restricting this bound with `` | LL | impl> Add for E where ::Output = B { | ++++++++++++ diff --git a/tests/ui/higher-ranked/structually-relate-aliases.stderr b/tests/ui/higher-ranked/structually-relate-aliases.stderr index e9d91e45e217b..69a95d73547fe 100644 --- a/tests/ui/higher-ranked/structually-relate-aliases.stderr +++ b/tests/ui/higher-ranked/structually-relate-aliases.stderr @@ -5,7 +5,7 @@ error[E0277]: the trait bound `for<'a> T: ToUnit<'a>` is not satisfied LL | impl Overlap fn(&'a (), Assoc<'a, T>)> for T {} | ^^^^^^^^^^^^ the trait `for<'a> ToUnit<'a>` is not implemented for `T` | -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `ToUnit` | LL | impl ToUnit<'a>> Overlap fn(&'a (), Assoc<'a, T>)> for T {} | ++++++++++++++++++++ @@ -16,7 +16,7 @@ error[E0277]: the trait bound `for<'a> T: ToUnit<'a>` is not satisfied LL | impl Overlap fn(&'a (), Assoc<'a, T>)> for T {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> ToUnit<'a>` is not implemented for `T` | -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `ToUnit` | LL | impl ToUnit<'a>> Overlap fn(&'a (), Assoc<'a, T>)> for T {} | ++++++++++++++++++++ diff --git a/tests/ui/higher-ranked/trait-bounds/hrtb-higher-ranker-supertraits-transitive.stderr b/tests/ui/higher-ranked/trait-bounds/hrtb-higher-ranker-supertraits-transitive.stderr index e10da26665ebb..da6013a4af33f 100644 --- a/tests/ui/higher-ranked/trait-bounds/hrtb-higher-ranker-supertraits-transitive.stderr +++ b/tests/ui/higher-ranked/trait-bounds/hrtb-higher-ranker-supertraits-transitive.stderr @@ -13,7 +13,7 @@ LL | fn want_bar_for_any_ccx(b: &B) | -------------------- required by a bound in this function LL | where B : for<'ccx> Bar<'ccx> | ^^^^^^^^^^^^^^^^^^^ required by this bound in `want_bar_for_any_ccx` -help: consider further restricting this bound +help: consider further restricting type parameter `B` with trait `Bar` | LL | where B : Qux + for<'ccx> Bar<'ccx> | +++++++++++++++++++++ diff --git a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-85455.stderr b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-85455.stderr index e60531a876be1..5080d35bdde27 100644 --- a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-85455.stderr +++ b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-85455.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `for<'a> T: SomeTrait<'a>` is not satisfied LL | callee:: >::Associated>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> SomeTrait<'a>` is not implemented for `T` | -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `SomeTrait` | LL | fn give_me_ice SomeTrait<'a>>() { | +++++++++++++++++++++++ @@ -15,7 +15,7 @@ error[E0277]: the trait bound `for<'a> T: SomeTrait<'a>` is not satisfied LL | callee:: >::Associated>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> SomeTrait<'a>` is not implemented for `T` | -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `SomeTrait` | LL | fn give_me_ice SomeTrait<'a>>() { | +++++++++++++++++++++++ diff --git a/tests/ui/impl-trait/in-trait/false-positive-predicate-entailment-error.current.stderr b/tests/ui/impl-trait/in-trait/false-positive-predicate-entailment-error.current.stderr index 38c7a9ea16e64..1ddbd75142f9c 100644 --- a/tests/ui/impl-trait/in-trait/false-positive-predicate-entailment-error.current.stderr +++ b/tests/ui/impl-trait/in-trait/false-positive-predicate-entailment-error.current.stderr @@ -17,7 +17,7 @@ LL | impl> Callback for F { | ------- ^^^^^^^^^^^ ^ | | | unsatisfied trait bound introduced here -help: consider further restricting this bound +help: consider further restricting type parameter `F` with trait `MyFn` | LL | F: Callback + MyFn, | +++++++++++ @@ -43,7 +43,7 @@ LL | fn autobatch(self) -> impl Trait ... LL | F: Callback, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `::autobatch` -help: consider further restricting this bound +help: consider further restricting type parameter `F` with trait `MyFn` | LL | F: Callback + MyFn, | +++++++++++ @@ -68,7 +68,7 @@ LL | impl> Callback for F { | | | unsatisfied trait bound introduced here = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: consider further restricting this bound +help: consider further restricting type parameter `F` with trait `MyFn` | LL | F: Callback + MyFn, | +++++++++++ @@ -121,7 +121,7 @@ LL | impl> Callback for F { | | | unsatisfied trait bound introduced here = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: consider further restricting this bound +help: consider further restricting type parameter `F` with trait `MyFn` | LL | F: Callback + MyFn, | +++++++++++ @@ -137,7 +137,7 @@ note: required by a bound in `Callback` | LL | trait Callback: MyFn { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Callback` -help: consider further restricting this bound +help: consider further restricting type parameter `F` with trait `MyFn` | LL | F: Callback + MyFn, | +++++++++++ diff --git a/tests/ui/impl-trait/issue-55872-1.stderr b/tests/ui/impl-trait/issue-55872-1.stderr index 2ccca0b562c06..81759760bf13e 100644 --- a/tests/ui/impl-trait/issue-55872-1.stderr +++ b/tests/ui/impl-trait/issue-55872-1.stderr @@ -17,7 +17,7 @@ LL | (S::default(), T::default()) | ---------------------------- return type was inferred to be `(S, T)` here | = note: required because it appears within the type `(S, T)` -help: consider further restricting this bound +help: consider further restricting type parameter `S` with trait `Copy` | LL | impl Bar for S { | +++++++++++++++++++ @@ -32,7 +32,7 @@ LL | (S::default(), T::default()) | ---------------------------- return type was inferred to be `(S, T)` here | = note: required because it appears within the type `(S, T)` -help: consider further restricting this bound +help: consider further restricting type parameter `T` with trait `Copy` | LL | fn foo() -> Self::E { | +++++++++++++++++++ diff --git a/tests/ui/impl-trait/normalize-tait-in-const.stderr b/tests/ui/impl-trait/normalize-tait-in-const.stderr index 203fbfc1d2c55..1dd84f10ad862 100644 --- a/tests/ui/impl-trait/normalize-tait-in-const.stderr +++ b/tests/ui/impl-trait/normalize-tait-in-const.stderr @@ -33,10 +33,6 @@ LL | fun(filter_positive()); | ^^^^^^^^^^^^^^^^^^^^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: consider further restricting this bound - | -LL | const fn with_positive ~const Fn(&'a Alias<'a>) + ~const Destruct + ~const Fn(&foo::Alias<'_>)>(fun: F) { - | ++++++++++++++++++++++++++++ error: aborting due to 4 previous errors diff --git a/tests/ui/issues/issue-6738.stderr b/tests/ui/issues/issue-6738.stderr index 9c25c0fd9a142..f22d6a2e4686c 100644 --- a/tests/ui/issues/issue-6738.stderr +++ b/tests/ui/issues/issue-6738.stderr @@ -6,7 +6,7 @@ LL | self.x += v.x; | | | cannot use `+=` on type `T` | -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `AddAssign` | LL | impl Foo { | +++++++++++++++++++++ diff --git a/tests/ui/kindck/kindck-impl-type-params.stderr b/tests/ui/kindck/kindck-impl-type-params.stderr index da9a8e5532c33..a0a4ef09216f6 100644 --- a/tests/ui/kindck/kindck-impl-type-params.stderr +++ b/tests/ui/kindck/kindck-impl-type-params.stderr @@ -12,7 +12,7 @@ LL | impl Gettable for S {} | | | unsatisfied trait bound introduced here = note: required for the cast from `&S` to `&dyn Gettable` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Send` | LL | fn f(val: T) { | +++++++++++++++++++ @@ -31,7 +31,7 @@ LL | impl Gettable for S {} | | | unsatisfied trait bound introduced here = note: required for the cast from `&S` to `&dyn Gettable` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | fn f(val: T) { | +++++++++++++++++++ @@ -50,7 +50,7 @@ LL | impl Gettable for S {} | | | unsatisfied trait bound introduced here = note: required for the cast from `&S` to `&dyn Gettable` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Send` | LL | fn g(val: T) { | +++++++++++++++++++ @@ -69,7 +69,7 @@ LL | impl Gettable for S {} | | | unsatisfied trait bound introduced here = note: required for the cast from `&S` to `&dyn Gettable` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | fn g(val: T) { | +++++++++++++++++++ diff --git a/tests/ui/layout/rust-call-abi-not-a-tuple-ice-81974.stderr b/tests/ui/layout/rust-call-abi-not-a-tuple-ice-81974.stderr index 206a6801065db..3b051ef9a8823 100644 --- a/tests/ui/layout/rust-call-abi-not-a-tuple-ice-81974.stderr +++ b/tests/ui/layout/rust-call-abi-not-a-tuple-ice-81974.stderr @@ -6,7 +6,7 @@ LL | impl FnOnce for CachedFun | note: required by a bound in `FnOnce` --> $SRC_DIR/core/src/ops/function.rs:LL:COL -help: consider further restricting this bound +help: consider further restricting type parameter `A` with unstable trait `Tuple` | LL | A: Eq + Hash + Clone + std::marker::Tuple, | ++++++++++++++++++++ @@ -19,7 +19,7 @@ LL | impl FnMut for CachedFun | note: required by a bound in `FnMut` --> $SRC_DIR/core/src/ops/function.rs:LL:COL -help: consider further restricting this bound +help: consider further restricting type parameter `A` with unstable trait `Tuple` | LL | A: Eq + Hash + Clone + std::marker::Tuple, | ++++++++++++++++++++ @@ -30,7 +30,7 @@ error[E0277]: functions with the "rust-call" ABI must take a single non-self tup LL | extern "rust-call" fn call_once(mut self, a: A) -> Self::Output { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Tuple` is not implemented for `A` | -help: consider further restricting this bound +help: consider further restricting type parameter `A` with unstable trait `Tuple` | LL | A: Eq + Hash + Clone + std::marker::Tuple, | ++++++++++++++++++++ @@ -41,7 +41,7 @@ error[E0277]: functions with the "rust-call" ABI must take a single non-self tup LL | extern "rust-call" fn call_mut(&mut self, a: A) -> Self::Output { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Tuple` is not implemented for `A` | -help: consider further restricting this bound +help: consider further restricting type parameter `A` with unstable trait `Tuple` | LL | A: Eq + Hash + Clone + std::marker::Tuple, | ++++++++++++++++++++ @@ -56,7 +56,7 @@ LL | self.call_mut(a) | note: required by a bound in `call_mut` --> $SRC_DIR/core/src/ops/function.rs:LL:COL -help: consider further restricting this bound +help: consider further restricting type parameter `A` with unstable trait `Tuple` | LL | A: Eq + Hash + Clone + std::marker::Tuple, | ++++++++++++++++++++ diff --git a/tests/ui/lazy-type-alias/unsatisfied-bounds-type-alias-body.stderr b/tests/ui/lazy-type-alias/unsatisfied-bounds-type-alias-body.stderr index bd8095224a720..d0d4d04e28a38 100644 --- a/tests/ui/lazy-type-alias/unsatisfied-bounds-type-alias-body.stderr +++ b/tests/ui/lazy-type-alias/unsatisfied-bounds-type-alias-body.stderr @@ -4,7 +4,7 @@ error[E0277]: cannot multiply `T` by `T` LL | type Alias = ::Output; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `T * T` | -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Mul` | LL | type Alias = ::Output; | +++++++++++++++ diff --git a/tests/ui/methods/filter-relevant-fn-bounds.stderr b/tests/ui/methods/filter-relevant-fn-bounds.stderr index b737c0ab11fd4..0e00adf6ea64f 100644 --- a/tests/ui/methods/filter-relevant-fn-bounds.stderr +++ b/tests/ui/methods/filter-relevant-fn-bounds.stderr @@ -8,7 +8,7 @@ LL | | where LL | | F: for<'a> FnOnce(>::Type), | |___________________________________________________^ the trait `for<'a> Output<'a>` is not implemented for `F` | -help: consider further restricting this bound +help: consider further restricting type parameter `F` with trait `Output` | LL | F: for<'a> FnOnce(>::Type) + for<'a> Output<'a>, | ++++++++++++++++++++ @@ -19,7 +19,7 @@ error[E0277]: the trait bound `for<'a> F: Output<'a>` is not satisfied LL | fn do_something_wrapper(self, _: F) | ^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> Output<'a>` is not implemented for `F` | -help: consider further restricting this bound +help: consider further restricting type parameter `F` with trait `Output` | LL | F: for<'a> FnOnce(>::Type) + for<'a> Output<'a>, | ++++++++++++++++++++ @@ -30,7 +30,7 @@ error[E0277]: the trait bound `F: Output<'_>` is not satisfied LL | F: for<'a> FnOnce(>::Type), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Output<'_>` is not implemented for `F` | -help: consider further restricting this bound +help: consider further restricting type parameter `F` with trait `Output` | LL | F: for<'a> FnOnce(>::Type) + Output<'_>, | ++++++++++++ @@ -41,7 +41,7 @@ error[E0277]: the trait bound `F: Output<'_>` is not satisfied LL | F: for<'a> FnOnce(>::Type), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Output<'_>` is not implemented for `F` | -help: consider further restricting this bound +help: consider further restricting type parameter `F` with trait `Output` | LL | F: for<'a> FnOnce(>::Type) + Output<'_>, | ++++++++++++ diff --git a/tests/ui/mir/validate/validate-unsize-cast.stderr b/tests/ui/mir/validate/validate-unsize-cast.stderr index cfb47b34e980b..8449c6a24bd31 100644 --- a/tests/ui/mir/validate/validate-unsize-cast.stderr +++ b/tests/ui/mir/validate/validate-unsize-cast.stderr @@ -10,7 +10,7 @@ note: required by a bound in `CastTo` | LL | pub trait CastTo: Unsize {} | ^^^^^^^^^ required by this bound in `CastTo` -help: consider further restricting this bound +help: consider further restricting type parameter `T` with unstable trait `Unsize` | LL | impl, U: ?Sized> CastTo for T {} | ++++++++++++++++++++++++ diff --git a/tests/ui/missing-trait-bounds/missing-trait-bound-for-op.stderr b/tests/ui/missing-trait-bounds/missing-trait-bound-for-op.stderr index b3089cecfbb29..80b003bbcc56a 100644 --- a/tests/ui/missing-trait-bounds/missing-trait-bound-for-op.stderr +++ b/tests/ui/missing-trait-bounds/missing-trait-bound-for-op.stderr @@ -6,7 +6,7 @@ LL | let _ = s == t; | | | &[T] | -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `PartialEq` | LL | pub fn foo(s: &[T], t: &[T]) { | +++++++++++++++++++++ diff --git a/tests/ui/moves/issue-34721.stderr b/tests/ui/moves/issue-34721.stderr index 94780a04c1f29..9834d009d2227 100644 --- a/tests/ui/moves/issue-34721.stderr +++ b/tests/ui/moves/issue-34721.stderr @@ -18,7 +18,7 @@ note: `Foo::zero` takes ownership of the receiver `self`, which moves `x` | LL | fn zero(self) -> Self; | ^^^^ -help: consider further restricting this bound +help: consider further restricting type parameter `T` with trait `Copy` | LL | pub fn baz(x: T) -> T { | ++++++ diff --git a/tests/ui/moves/use_of_moved_value_copy_suggestions.fixed b/tests/ui/moves/use_of_moved_value_copy_suggestions.fixed index bfb855c7fb1f4..a5e0dd819b461 100644 --- a/tests/ui/moves/use_of_moved_value_copy_suggestions.fixed +++ b/tests/ui/moves/use_of_moved_value_copy_suggestions.fixed @@ -48,7 +48,7 @@ fn duplicate_custom_1(t: S) -> (S, S) where { fn duplicate_custom_2(t: S) -> (S, S) where T: A + Copy + Trait, - //~^ HELP consider further restricting this bound + //~^ HELP consider further restricting { (t, t) //~ use of moved value: `t` } @@ -56,14 +56,14 @@ where fn duplicate_custom_3(t: S) -> (S, S) where T: A + Copy + Trait, - //~^ HELP consider further restricting this bound + //~^ HELP consider further restricting T: B, { (t, t) //~ use of moved value: `t` } fn duplicate_custom_4(t: S) -> (S, S) -//~^ HELP consider further restricting this bound +//~^ HELP consider further restricting where T: B, { diff --git a/tests/ui/moves/use_of_moved_value_copy_suggestions.rs b/tests/ui/moves/use_of_moved_value_copy_suggestions.rs index fbe5a1d74c372..60ca03ed6984a 100644 --- a/tests/ui/moves/use_of_moved_value_copy_suggestions.rs +++ b/tests/ui/moves/use_of_moved_value_copy_suggestions.rs @@ -48,7 +48,7 @@ fn duplicate_custom_1(t: S) -> (S, S) where { fn duplicate_custom_2(t: S) -> (S, S) where T: A, - //~^ HELP consider further restricting this bound + //~^ HELP consider further restricting { (t, t) //~ use of moved value: `t` } @@ -56,14 +56,14 @@ where fn duplicate_custom_3(t: S) -> (S, S) where T: A, - //~^ HELP consider further restricting this bound + //~^ HELP consider further restricting T: B, { (t, t) //~ use of moved value: `t` } fn duplicate_custom_4(t: S) -> (S, S) -//~^ HELP consider further restricting this bound +//~^ HELP consider further restricting where T: B, { diff --git a/tests/ui/moves/use_of_moved_value_copy_suggestions.stderr b/tests/ui/moves/use_of_moved_value_copy_suggestions.stderr index c03204c7b9f10..784945dbbaeae 100644 --- a/tests/ui/moves/use_of_moved_value_copy_suggestions.stderr +++ b/tests/ui/moves/use_of_moved_value_copy_suggestions.stderr @@ -17,7 +17,7 @@ LL | fn duplicate_t(t: T) -> (T, T) { ... LL | (t, t) | - you could clone this value -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | fn duplicate_t(t: T) -> (T, T) { | ++++++ @@ -33,7 +33,7 @@ LL | (t, t) | | | value moved here | -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | fn duplicate_opt(t: Option) -> (Option, Option) { | ++++++ @@ -49,7 +49,7 @@ LL | (t, t) | | | value moved here | -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | fn duplicate_tup1(t: (T,)) -> ((T,), (T,)) { | ++++++ @@ -81,7 +81,7 @@ LL | (t, t) | | | value moved here | -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with traits `Copy` and `Trait` | LL | fn duplicate_custom(t: S) -> (S, S) { | ++++++++++++++ @@ -97,7 +97,7 @@ LL | (t, t) | | | value moved here | -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with traits `Copy` and `Trait` | LL | fn duplicate_custom_1(t: S) -> (S, S) where { | ++++++++++++++ @@ -113,7 +113,7 @@ LL | (t, t) | | | value moved here | -help: consider further restricting this bound +help: consider further restricting type parameter `T` with traits `Copy` and `Trait` | LL | T: A + Copy + Trait, | ++++++++++++++ @@ -129,7 +129,7 @@ LL | (t, t) | | | value moved here | -help: consider further restricting this bound +help: consider further restricting type parameter `T` with traits `Copy` and `Trait` | LL | T: A + Copy + Trait, | ++++++++++++++ @@ -145,7 +145,7 @@ LL | (t, t) | | | value moved here | -help: consider further restricting this bound +help: consider further restricting type parameter `T` with traits `Copy` and `Trait` | LL | fn duplicate_custom_4(t: S) -> (S, S) | ++++++++++++++ @@ -169,7 +169,7 @@ LL | fn existing_colon(t: T) { ... LL | [t, t]; | - you could clone this value -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | fn existing_colon(t: T) { | ++++ @@ -193,7 +193,7 @@ LL | fn existing_colon_in_where(t: T) ... LL | [t, t]; | - you could clone this value -help: consider further restricting type parameter `T` +help: consider further restricting type parameter `T` with trait `Copy` | LL | T:, T: Copy | ~~~~~~~~~ diff --git a/tests/ui/phantom-auto-trait.stderr b/tests/ui/phantom-auto-trait.stderr index 5af648f6a0cf1..ffd4c3a0e1ad0 100644 --- a/tests/ui/phantom-auto-trait.stderr +++ b/tests/ui/phantom-auto-trait.stderr @@ -23,7 +23,7 @@ note: required by a bound in `is_zen` | LL | fn is_zen(_: T) {} | ^^^ required by this bound in `is_zen` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Sync` | LL | fn not_sync(x: Guard) { | +++++++++++++++++++ @@ -58,7 +58,7 @@ note: required by a bound in `is_zen` | LL | fn is_zen(_: T) {} | ^^^ required by this bound in `is_zen` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Sync` | LL | fn nested_not_sync(x: Nested>) { | +++++++++++++++++++ diff --git a/tests/ui/regions/regions-implied-bounds-projection-gap-hr-1.stderr b/tests/ui/regions/regions-implied-bounds-projection-gap-hr-1.stderr index b17d1e0ab1136..87f0f47f2401e 100644 --- a/tests/ui/regions/regions-implied-bounds-projection-gap-hr-1.stderr +++ b/tests/ui/regions/regions-implied-bounds-projection-gap-hr-1.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `for<'z> T: Trait2<'y, 'z>` is not satisfied LL | fn callee<'x, 'y, T>(t: &'x dyn for<'z> Trait1< >::Foo >) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'z> Trait2<'y, 'z>` is not implemented for `T` | -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Trait2` | LL | fn callee<'x, 'y, T: for<'z> Trait2<'y, 'z>>(t: &'x dyn for<'z> Trait1< >::Foo >) | ++++++++++++++++++++++++ @@ -17,7 +17,7 @@ LL | | LL | | } | |_^ the trait `for<'z> Trait2<'y, 'z>` is not implemented for `T` | -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Trait2` | LL | fn callee<'x, 'y, T: for<'z> Trait2<'y, 'z>>(t: &'x dyn for<'z> Trait1< >::Foo >) | ++++++++++++++++++++++++ diff --git a/tests/ui/resolve/issue-55673.stderr b/tests/ui/resolve/issue-55673.stderr index 4069b35a99848..7d420126199b1 100644 --- a/tests/ui/resolve/issue-55673.stderr +++ b/tests/ui/resolve/issue-55673.stderr @@ -15,7 +15,7 @@ error[E0220]: associated type `Baa` not found for `T` LL | T::Baa: std::fmt::Debug, | ^^^ there is a similarly named associated type `Bar` in the trait `Foo` | -help: consider further restricting type parameter `T` +help: consider further restricting type parameter `T` with trait `Foo` | LL | T::Baa: std::fmt::Debug, T: Foo | ~~~~~~~~ diff --git a/tests/ui/specialization/default-generic-associated-type-bound.stderr b/tests/ui/specialization/default-generic-associated-type-bound.stderr index afdbe2eb22677..57d67ac526ac6 100644 --- a/tests/ui/specialization/default-generic-associated-type-bound.stderr +++ b/tests/ui/specialization/default-generic-associated-type-bound.stderr @@ -20,7 +20,7 @@ note: required by a bound in `X::U` | LL | type U<'a>: PartialEq<&'a Self> where Self: 'a; | ^^^^^^^^^^^^^^^^^^^ required by this bound in `X::U` -help: consider further restricting this bound +help: consider further restricting type parameter `T` with trait `PartialEq` | LL | impl X for T { | +++++++++++++++++++++ diff --git a/tests/ui/specialization/defaultimpl/specialization-wfcheck.stderr b/tests/ui/specialization/defaultimpl/specialization-wfcheck.stderr index 01188e293bd97..4a51a7dfa47fa 100644 --- a/tests/ui/specialization/defaultimpl/specialization-wfcheck.stderr +++ b/tests/ui/specialization/defaultimpl/specialization-wfcheck.stderr @@ -19,7 +19,7 @@ note: required by a bound in `Foo` | LL | trait Foo<'a, T: Eq + 'a> { } | ^^ required by this bound in `Foo` -help: consider restricting type parameter `U` +help: consider restricting type parameter `U` with trait `Eq` | LL | default impl Foo<'static, U> for () {} | ++++++++++++++ diff --git a/tests/ui/specialization/issue-33017.stderr b/tests/ui/specialization/issue-33017.stderr index 2c20077078fd3..29a82a4d87519 100644 --- a/tests/ui/specialization/issue-33017.stderr +++ b/tests/ui/specialization/issue-33017.stderr @@ -9,7 +9,7 @@ note: required by a bound in `UncheckedCopy::Output` | LL | type Output: From + Copy + Into; | ^^^^ required by this bound in `UncheckedCopy::Output` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | impl UncheckedCopy for T { | +++++++++++++++++++ diff --git a/tests/ui/specialization/min_specialization/issue-79224.stderr b/tests/ui/specialization/min_specialization/issue-79224.stderr index 268fc3a959167..84e526f459785 100644 --- a/tests/ui/specialization/min_specialization/issue-79224.stderr +++ b/tests/ui/specialization/min_specialization/issue-79224.stderr @@ -5,7 +5,7 @@ LL | impl Display for Cow<'_, B> { | ^^^^^^^^^^ the trait `Clone` is not implemented for `B` | = note: required for `B` to implement `ToOwned` -help: consider further restricting this bound +help: consider further restricting type parameter `B` with trait `Clone` | LL | impl Display for Cow<'_, B> { | +++++++++++++++++++ @@ -17,7 +17,7 @@ LL | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `B` | = note: required for `B` to implement `ToOwned` -help: consider further restricting this bound +help: consider further restricting type parameter `B` with trait `Clone` | LL | impl Display for Cow<'_, B> { | +++++++++++++++++++ @@ -29,7 +29,7 @@ LL | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | ^^^^ the trait `Clone` is not implemented for `B` | = note: required for `B` to implement `ToOwned` -help: consider further restricting this bound +help: consider further restricting type parameter `B` with trait `Clone` | LL | impl Display for Cow<'_, B> { | +++++++++++++++++++ @@ -47,7 +47,7 @@ LL | | } | |_____^ the trait `Clone` is not implemented for `B` | = note: required for `B` to implement `ToOwned` -help: consider further restricting this bound +help: consider further restricting type parameter `B` with trait `Clone` | LL | impl Display for Cow<'_, B> { | +++++++++++++++++++ diff --git a/tests/ui/suggestions/assoc-const-as-fn.stderr b/tests/ui/suggestions/assoc-const-as-fn.stderr index 69e9af726479e..6732033e774fe 100644 --- a/tests/ui/suggestions/assoc-const-as-fn.stderr +++ b/tests/ui/suggestions/assoc-const-as-fn.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `T: GlUniformScalar` is not satisfied LL | ::FACTORY(1, value); | ^ the trait `GlUniformScalar` is not implemented for `T` | -help: consider further restricting this bound +help: consider further restricting type parameter `T` with trait `GlUniformScalar` | LL | pub fn foo(value: T) { | +++++++++++++++++ diff --git a/tests/ui/suggestions/bound-suggestions.stderr b/tests/ui/suggestions/bound-suggestions.stderr index 4965e7439f849..e30deb11398e6 100644 --- a/tests/ui/suggestions/bound-suggestions.stderr +++ b/tests/ui/suggestions/bound-suggestions.stderr @@ -5,7 +5,7 @@ LL | println!("{:?}", t); | ^ `impl Sized` cannot be formatted using `{:?}` because it doesn't implement `Debug` | = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider further restricting this bound +help: consider restricting opaque type `impl Sized` with trait `Debug` | LL | fn test_impl(t: impl Sized + std::fmt::Debug) { | +++++++++++++++++ @@ -17,7 +17,7 @@ LL | println!("{:?}", t); | ^ `T` cannot be formatted using `{:?}` because it doesn't implement `Debug` | = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Debug` | LL | fn test_no_bounds(t: T) { | +++++++++++++++++ @@ -29,7 +29,7 @@ LL | println!("{:?}", t); | ^ `T` cannot be formatted using `{:?}` because it doesn't implement `Debug` | = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider further restricting this bound +help: consider further restricting type parameter `T` with trait `Debug` | LL | fn test_one_bound(t: T) { | +++++++++++++++++ @@ -41,7 +41,7 @@ LL | println!("{:?} {:?}", x, y); | ^ `Y` cannot be formatted using `{:?}` because it doesn't implement `Debug` | = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider further restricting type parameter `Y` +help: consider further restricting type parameter `Y` with trait `Debug` | LL | fn test_no_bounds_where(x: X, y: Y) where X: std::fmt::Debug, Y: std::fmt::Debug { | ~~~~~~~~~~~~~~~~~~~~ @@ -53,7 +53,7 @@ LL | println!("{:?}", x); | ^ `X` cannot be formatted using `{:?}` because it doesn't implement `Debug` | = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider further restricting this bound +help: consider further restricting type parameter `X` with trait `Debug` | LL | fn test_one_bound_where(x: X) where X: Sized + std::fmt::Debug { | +++++++++++++++++ @@ -65,7 +65,7 @@ LL | println!("{:?}", x); | ^ `X` cannot be formatted using `{:?}` because it doesn't implement `Debug` | = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider further restricting this bound +help: consider further restricting type parameter `X` with trait `Debug` | LL | fn test_many_bounds_where(x: X) where X: Sized + std::fmt::Debug, X: Sized { | +++++++++++++++++ diff --git a/tests/ui/suggestions/clone-bounds-121524.rs b/tests/ui/suggestions/clone-bounds-121524.rs index 8cd60b452de09..b7760584ebbc2 100644 --- a/tests/ui/suggestions/clone-bounds-121524.rs +++ b/tests/ui/suggestions/clone-bounds-121524.rs @@ -6,7 +6,7 @@ trait DoesAThing {} impl DoesAThing for ThingThatDoesAThing {} fn clones_impl_ref_inline(thing: &impl DoesAThing) { - //~^ HELP consider further restricting this bound + //~^ HELP consider restricting opaque type `impl DoesAThing` with trait `Clone` drops_impl_owned(thing.clone()); //~ ERROR E0277 //~^ NOTE copies the reference //~| NOTE the trait `DoesAThing` is not implemented for `&impl DoesAThing` diff --git a/tests/ui/suggestions/clone-bounds-121524.stderr b/tests/ui/suggestions/clone-bounds-121524.stderr index 6d60508a4a14c..bdba8d7e47226 100644 --- a/tests/ui/suggestions/clone-bounds-121524.stderr +++ b/tests/ui/suggestions/clone-bounds-121524.stderr @@ -9,7 +9,7 @@ note: this `clone()` copies the reference, which does not do anything, because ` | LL | drops_impl_owned(thing.clone()); | ^^^^^ -help: consider further restricting this bound +help: consider restricting opaque type `impl DoesAThing` with trait `Clone` | LL | fn clones_impl_ref_inline(thing: &impl DoesAThing + Clone) { | +++++++ diff --git a/tests/ui/suggestions/clone-on-unconstrained-borrowed-type-param.stderr b/tests/ui/suggestions/clone-on-unconstrained-borrowed-type-param.stderr index afbb9c32d516e..03a14b03781e3 100644 --- a/tests/ui/suggestions/clone-on-unconstrained-borrowed-type-param.stderr +++ b/tests/ui/suggestions/clone-on-unconstrained-borrowed-type-param.stderr @@ -15,7 +15,7 @@ note: `T` does not implement `Clone`, so `&T` was cloned instead | LL | t.clone() | ^ -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Clone` | LL | fn wat(t: &T) -> T { | +++++++ diff --git a/tests/ui/suggestions/derive-clone-for-eq.stderr b/tests/ui/suggestions/derive-clone-for-eq.stderr index 680890e880ca6..eae0b0ae81755 100644 --- a/tests/ui/suggestions/derive-clone-for-eq.stderr +++ b/tests/ui/suggestions/derive-clone-for-eq.stderr @@ -14,7 +14,7 @@ LL | impl PartialEq for Struct note: required by a bound in `Eq` --> $SRC_DIR/core/src/cmp.rs:LL:COL = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Clone` | LL | pub struct Struct(T); | +++++++++++++++++++ diff --git a/tests/ui/suggestions/derive-macro-missing-bounds.stderr b/tests/ui/suggestions/derive-macro-missing-bounds.stderr index bffcb1af487e9..37a5f4932ff27 100644 --- a/tests/ui/suggestions/derive-macro-missing-bounds.stderr +++ b/tests/ui/suggestions/derive-macro-missing-bounds.stderr @@ -38,7 +38,7 @@ LL | impl Debug for Inner { = note: required for `&c::Inner` to implement `Debug` = note: required for the cast from `&&c::Inner` to `&dyn Debug` = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Trait` | LL | struct Outer(Inner); | ++++++++++ @@ -60,7 +60,7 @@ LL | impl Debug for Inner where T: Debug, T: Trait { = note: required for `&d::Inner` to implement `Debug` = note: required for the cast from `&&d::Inner` to `&dyn Debug` = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Trait` | LL | struct Outer(Inner); | ++++++++++ @@ -82,7 +82,7 @@ LL | impl Debug for Inner where T: Debug + Trait { = note: required for `&e::Inner` to implement `Debug` = note: required for the cast from `&&e::Inner` to `&dyn Debug` = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Trait` | LL | struct Outer(Inner); | ++++++++++ @@ -104,7 +104,7 @@ LL | impl Debug for Inner where T: Trait { = note: required for `&f::Inner` to implement `Debug` = note: required for the cast from `&&f::Inner` to `&dyn Debug` = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Trait` | LL | struct Outer(Inner); | ++++++++++ diff --git a/tests/ui/suggestions/issue-106443-sugg-clone-for-bound.stderr b/tests/ui/suggestions/issue-106443-sugg-clone-for-bound.stderr index 8607917ede6bf..8b1c0b9a77ad2 100644 --- a/tests/ui/suggestions/issue-106443-sugg-clone-for-bound.stderr +++ b/tests/ui/suggestions/issue-106443-sugg-clone-for-bound.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `&T: X` is not satisfied LL | foo(s); | ^ the trait `X` is not implemented for `&T` | -help: consider further restricting this bound +help: consider further restricting type parameter `T` with trait `Clone` | LL | fn bar(s: &T) { | +++++++ diff --git a/tests/ui/suggestions/issue-97677.stderr b/tests/ui/suggestions/issue-97677.stderr index 0e95167d8515b..7fe091ef71c7f 100644 --- a/tests/ui/suggestions/issue-97677.stderr +++ b/tests/ui/suggestions/issue-97677.stderr @@ -6,7 +6,7 @@ LL | n + 10 | | | N | -help: consider restricting type parameter `N` +help: consider restricting type parameter `N` with trait `Add` | LL | fn add_ten>(n: N) -> N { | ++++++++++++++++++++++++++++++++ diff --git a/tests/ui/suggestions/missing-bound-in-derive-copy-impl-2.stderr b/tests/ui/suggestions/missing-bound-in-derive-copy-impl-2.stderr index d65ad109241a7..4408fe0a0a4bb 100644 --- a/tests/ui/suggestions/missing-bound-in-derive-copy-impl-2.stderr +++ b/tests/ui/suggestions/missing-bound-in-derive-copy-impl-2.stderr @@ -9,7 +9,7 @@ note: required by a bound in `Vector2` | LL | pub struct Vector2 { | ^^^^ required by this bound in `Vector2` -help: consider further restricting this bound +help: consider further restricting type parameter `K` with trait `Copy` | LL | pub struct AABB { | +++++++++++++++++++ @@ -32,7 +32,7 @@ LL | pub struct Vector2 { | ---- unsatisfied trait bound introduced in this `derive` macro = note: required for the cast from `&Vector2` to `&dyn Debug` = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider further restricting this bound +help: consider further restricting type parameter `K` with trait `Copy` | LL | pub struct AABB { | +++++++++++++++++++ @@ -52,7 +52,7 @@ note: required by a bound in `Vector2` LL | pub struct Vector2 { | ^^^^ required by this bound in `Vector2` = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider further restricting this bound +help: consider further restricting type parameter `K` with trait `Copy` | LL | pub struct AABB { | +++++++++++++++++++ @@ -74,7 +74,7 @@ LL | #[derive(Debug, Copy, Clone)] LL | pub struct Vector2 { | ---- unsatisfied trait bound introduced in this `derive` macro = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider further restricting this bound +help: consider further restricting type parameter `K` with trait `Copy` | LL | pub struct AABB { | +++++++++++++++++++ diff --git a/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.stderr b/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.stderr index 2ade0e974e495..1bbf6f66ab23f 100644 --- a/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.stderr +++ b/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.stderr @@ -13,7 +13,7 @@ note: the `Copy` impl for `Vector2` requires that `K: Debug` LL | pub loc: Vector2, | ^^^^^^^^^^ = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider further restricting this bound +help: consider further restricting type parameter `K` with trait `Debug` | LL | pub struct AABB{ | +++++++ @@ -29,7 +29,7 @@ note: required by a bound in `Vector2` | LL | pub struct Vector2{ | ^^^^^ required by this bound in `Vector2` -help: consider further restricting this bound +help: consider further restricting type parameter `K` with trait `Debug` | LL | pub struct AABB{ | +++++++++++++++++ @@ -44,7 +44,7 @@ LL | pub loc: Vector2, | ^^^^^^^^^^^^^^^^^^^ `K` cannot be formatted using `{:?}` because it doesn't implement `Debug` | = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider further restricting this bound +help: consider further restricting type parameter `K` with trait `Debug` | LL | pub struct AABB{ | +++++++++++++++++ @@ -59,7 +59,7 @@ LL | pub size: Vector2 | ^^^^^^^^^^^^^^^^^^^^ `K` cannot be formatted using `{:?}` because it doesn't implement `Debug` | = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider further restricting this bound +help: consider further restricting type parameter `K` with trait `Debug` | LL | pub struct AABB{ | +++++++++++++++++ diff --git a/tests/ui/suggestions/missing-bound-in-derive-copy-impl.stderr b/tests/ui/suggestions/missing-bound-in-derive-copy-impl.stderr index 316c2fa0fc960..8b5cced4c4aaa 100644 --- a/tests/ui/suggestions/missing-bound-in-derive-copy-impl.stderr +++ b/tests/ui/suggestions/missing-bound-in-derive-copy-impl.stderr @@ -13,7 +13,7 @@ note: the `Copy` impl for `Vector2` requires that `K: Debug` LL | pub loc: Vector2, | ^^^^^^^^^^ = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider restricting type parameter `K` +help: consider restricting type parameter `K` with trait `Debug` | LL | pub struct AABB { | +++++++ @@ -29,7 +29,7 @@ note: required by a bound in `Vector2` | LL | pub struct Vector2 { | ^^^^^ required by this bound in `Vector2` -help: consider restricting type parameter `K` +help: consider restricting type parameter `K` with trait `Debug` | LL | pub struct AABB { | +++++++++++++++++ @@ -45,7 +45,7 @@ note: required by a bound in `Vector2` | LL | pub struct Vector2 { | ^^^^ required by this bound in `Vector2` -help: consider restricting type parameter `K` +help: consider restricting type parameter `K` with trait `Copy` | LL | pub struct AABB { | +++++++++++++++++++ @@ -68,7 +68,7 @@ LL | pub struct Vector2 { | ---- unsatisfied trait bound introduced in this `derive` macro = note: required for the cast from `&Vector2` to `&dyn Debug` = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider restricting type parameter `K` +help: consider restricting type parameter `K` with trait `Copy` | LL | pub struct AABB { | +++++++++++++++++++ @@ -83,7 +83,7 @@ LL | pub loc: Vector2, | ^^^^^^^^^^^^^^^^^^^ `K` cannot be formatted using `{:?}` because it doesn't implement `Debug` | = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider restricting type parameter `K` +help: consider restricting type parameter `K` with trait `Debug` | LL | pub struct AABB { | +++++++++++++++++ @@ -103,7 +103,7 @@ note: required by a bound in `Vector2` LL | pub struct Vector2 { | ^^^^ required by this bound in `Vector2` = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider restricting type parameter `K` +help: consider restricting type parameter `K` with trait `Copy` | LL | pub struct AABB { | +++++++++++++++++++ @@ -118,7 +118,7 @@ LL | pub size: Vector2, | ^^^^^^^^^^^^^^^^^^^^ `K` cannot be formatted using `{:?}` because it doesn't implement `Debug` | = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider restricting type parameter `K` +help: consider restricting type parameter `K` with trait `Debug` | LL | pub struct AABB { | +++++++++++++++++ @@ -140,7 +140,7 @@ LL | #[derive(Debug, Copy, Clone)] LL | pub struct Vector2 { | ---- unsatisfied trait bound introduced in this `derive` macro = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider restricting type parameter `K` +help: consider restricting type parameter `K` with trait `Copy` | LL | pub struct AABB { | +++++++++++++++++++ diff --git a/tests/ui/suggestions/missing-bound-in-manual-copy-impl-2.stderr b/tests/ui/suggestions/missing-bound-in-manual-copy-impl-2.stderr index 23a75154f2008..600e5ae63d3d4 100644 --- a/tests/ui/suggestions/missing-bound-in-manual-copy-impl-2.stderr +++ b/tests/ui/suggestions/missing-bound-in-manual-copy-impl-2.stderr @@ -12,7 +12,7 @@ note: the `Copy` impl for `OnlyCopyIfDisplay` requires that `S: std::fmt::Dis | LL | struct Wrapper(T); | ^ -help: consider restricting type parameter `S` +help: consider restricting type parameter `S` with trait `Display` | LL | impl Copy for Wrapper> {} | +++++++++++++++++++ diff --git a/tests/ui/suggestions/missing-bound-in-manual-copy-impl.stderr b/tests/ui/suggestions/missing-bound-in-manual-copy-impl.stderr index c9f277fb3501a..b22aa35ef6d47 100644 --- a/tests/ui/suggestions/missing-bound-in-manual-copy-impl.stderr +++ b/tests/ui/suggestions/missing-bound-in-manual-copy-impl.stderr @@ -7,7 +7,7 @@ LL | LL | impl Copy for Wrapper {} | ^^^^^^^^^^ | -help: consider restricting type parameter `S` +help: consider restricting type parameter `S` with trait `Copy` | LL | impl Copy for Wrapper {} | ++++++ diff --git a/tests/ui/suggestions/restrict-existing-type-bounds.stderr b/tests/ui/suggestions/restrict-existing-type-bounds.stderr index fe8338c18c2bd..45dab9bec5daa 100644 --- a/tests/ui/suggestions/restrict-existing-type-bounds.stderr +++ b/tests/ui/suggestions/restrict-existing-type-bounds.stderr @@ -20,7 +20,7 @@ LL | Ok(self) | this argument influences the type of `Ok` note: tuple variant defined here --> $SRC_DIR/core/src/result.rs:LL:COL -help: consider further restricting this bound +help: consider further restricting this bound with `` | LL | impl> TryAdd for Option { | ++++++++++++ @@ -47,7 +47,7 @@ LL | Ok(self) | this argument influences the type of `Ok` note: tuple variant defined here --> $SRC_DIR/core/src/result.rs:LL:COL -help: consider further restricting this bound +help: consider further restricting this bound with `, Output = T` | LL | impl> TryAdd for Other { | ++++++++++++ diff --git a/tests/ui/suggestions/restrict-type-argument.stderr b/tests/ui/suggestions/restrict-type-argument.stderr index 01c2de7986419..4b6da8a9cd923 100644 --- a/tests/ui/suggestions/restrict-type-argument.stderr +++ b/tests/ui/suggestions/restrict-type-argument.stderr @@ -11,7 +11,7 @@ note: required by a bound in `is_send` | LL | fn is_send(val: T) {} | ^^^^ required by this bound in `is_send` -help: consider further restricting this bound +help: consider restricting opaque type `impl Sync` with trait `Send` | LL | fn use_impl_sync(val: impl Sync + std::marker::Send) { | +++++++++++++++++++ @@ -29,7 +29,7 @@ note: required by a bound in `is_send` | LL | fn is_send(val: T) {} | ^^^^ required by this bound in `is_send` -help: consider further restricting this bound +help: consider further restricting type parameter `S` with trait `Send` | LL | fn use_where(val: S) where S: Sync + std::marker::Send { | +++++++++++++++++++ @@ -47,7 +47,7 @@ note: required by a bound in `is_send` | LL | fn is_send(val: T) {} | ^^^^ required by this bound in `is_send` -help: consider further restricting this bound +help: consider further restricting type parameter `S` with trait `Send` | LL | fn use_bound(val: S) { | +++++++++++++++++++ @@ -65,7 +65,7 @@ note: required by a bound in `is_send` | LL | fn is_send(val: T) {} | ^^^^ required by this bound in `is_send` -help: consider further restricting this bound +help: consider further restricting type parameter `S` with trait `Send` | LL | Sync + std::marker::Send | +++++++++++++++++++ @@ -83,7 +83,7 @@ note: required by a bound in `is_send` | LL | fn is_send(val: T) {} | ^^^^ required by this bound in `is_send` -help: consider further restricting this bound +help: consider further restricting type parameter `S` with trait `Send` | LL | fn use_bound_and_where(val: S) where S: std::fmt::Debug { | +++++++++++++++++++ @@ -101,7 +101,7 @@ note: required by a bound in `is_send` | LL | fn is_send(val: T) {} | ^^^^ required by this bound in `is_send` -help: consider restricting type parameter `S` +help: consider restricting type parameter `S` with trait `Send` | LL | fn use_unbound(val: S) { | +++++++++++++++++++ diff --git a/tests/ui/suggestions/trait-impl-bound-suggestions.stderr b/tests/ui/suggestions/trait-impl-bound-suggestions.stderr index 6a75cbdf63974..346d19f1b7727 100644 --- a/tests/ui/suggestions/trait-impl-bound-suggestions.stderr +++ b/tests/ui/suggestions/trait-impl-bound-suggestions.stderr @@ -9,7 +9,7 @@ note: required by a bound in `ConstrainedStruct` | LL | struct ConstrainedStruct { | ^^^^ required by this bound in `ConstrainedStruct` -help: consider further restricting type parameter `X` +help: consider further restricting type parameter `X` with trait `Copy` | LL | trait InsufficientlyConstrainedGeneric where Self: Sized, X: std::marker::Copy { | ++++++++++++++++++++++ @@ -25,7 +25,7 @@ note: required by a bound in `ConstrainedStruct` | LL | struct ConstrainedStruct { | ^^^^ required by this bound in `ConstrainedStruct` -help: consider further restricting type parameter `X` +help: consider further restricting type parameter `X` with trait `Copy` | LL | trait InsufficientlyConstrainedGenericWithEmptyWhere where Self: Sized, X: std::marker::Copy { | ++++++++++++++++++++++ @@ -41,7 +41,7 @@ note: required by a bound in `ConstrainedStruct` | LL | struct ConstrainedStruct { | ^^^^ required by this bound in `ConstrainedStruct` -help: consider further restricting type parameter `X` +help: consider further restricting type parameter `X` with trait `Copy` | LL | trait InsufficientlyConstrainedGeneric where Self: Sized, X: std::marker::Copy { | ++++++++++++++++++++++ @@ -57,7 +57,7 @@ note: required by a bound in `ConstrainedStruct` | LL | struct ConstrainedStruct { | ^^^^ required by this bound in `ConstrainedStruct` -help: consider further restricting type parameter `X` +help: consider further restricting type parameter `X` with trait `Copy` | LL | trait InsufficientlyConstrainedGenericWithEmptyWhere where Self: Sized, X: std::marker::Copy { | ++++++++++++++++++++++ diff --git a/tests/ui/trait-bounds/restrict-assoc-type-of-generic-bound.stderr b/tests/ui/trait-bounds/restrict-assoc-type-of-generic-bound.stderr index 7aa32557af2de..ddadee3ea43fb 100644 --- a/tests/ui/trait-bounds/restrict-assoc-type-of-generic-bound.stderr +++ b/tests/ui/trait-bounds/restrict-assoc-type-of-generic-bound.stderr @@ -11,7 +11,7 @@ LL | return a.bar(); = note: expected type parameter `B` found associated type `::T` = note: the caller chooses a type for `B` which can be different from `::T` -help: consider further restricting this bound +help: consider further restricting this bound with `` | LL | pub fn foo, B>(a: A) -> B { | +++++++ diff --git a/tests/ui/trait-bounds/unstable-trait-suggestion.rs b/tests/ui/trait-bounds/unstable-trait-suggestion.rs new file mode 100644 index 0000000000000..ba96b4f3f97f9 --- /dev/null +++ b/tests/ui/trait-bounds/unstable-trait-suggestion.rs @@ -0,0 +1,19 @@ +#![feature(staged_api)] +#![allow(internal_features)] +#![stable(feature = "unit_test", since = "1.0.0")] + +#[unstable(feature = "step_trait", issue = "42168")] +pub trait Unstable {} + +#[stable(feature = "unit_test", since = "1.0.0")] +fn foo(_: T) {} + +#[stable(feature = "unit_test", since = "1.0.0")] +pub fn bar(t: T) { //~ HELP consider restricting type parameter `T` with unstable trait `Unstable` + foo(t) //~ ERROR E0277 +} +#[stable(feature = "unit_test", since = "1.0.0")] +pub fn baz(t: std::ops::Range) { //~ HELP consider restricting type parameter `T` with unstable trait + for _ in t {} //~ ERROR E0277 +} +fn main() {} diff --git a/tests/ui/trait-bounds/unstable-trait-suggestion.stderr b/tests/ui/trait-bounds/unstable-trait-suggestion.stderr new file mode 100644 index 0000000000000..dfa47f2ab4682 --- /dev/null +++ b/tests/ui/trait-bounds/unstable-trait-suggestion.stderr @@ -0,0 +1,34 @@ +error[E0277]: the trait bound `T: Unstable` is not satisfied + --> $DIR/unstable-trait-suggestion.rs:13:9 + | +LL | foo(t) + | --- ^ the trait `Unstable` is not implemented for `T` + | | + | required by a bound introduced by this call + | +note: required by a bound in `foo` + --> $DIR/unstable-trait-suggestion.rs:9:11 + | +LL | fn foo(_: T) {} + | ^^^^^^^^ required by this bound in `foo` +help: consider restricting type parameter `T` with unstable trait `Unstable` + | +LL | pub fn bar(t: T) { + | ++++++++++ + +error[E0277]: the trait bound `T: Step` is not satisfied + --> $DIR/unstable-trait-suggestion.rs:17:14 + | +LL | for _ in t {} + | ^ the trait `Step` is not implemented for `T` + | + = note: required for `std::ops::Range` to implement `Iterator` + = note: required for `std::ops::Range` to implement `IntoIterator` +help: consider restricting type parameter `T` with unstable trait `Step` + | +LL | pub fn baz(t: std::ops::Range) { + | +++++++++++++++++ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/alias/wf.stderr b/tests/ui/traits/alias/wf.stderr index 3be6e8a49d692..42b0104e8651b 100644 --- a/tests/ui/traits/alias/wf.stderr +++ b/tests/ui/traits/alias/wf.stderr @@ -9,7 +9,7 @@ note: required by a bound in `A` | LL | trait A {} | ^^^ required by this bound in `A` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Foo` | LL | trait B = A; | +++++ diff --git a/tests/ui/traits/bad-method-typaram-kind.stderr b/tests/ui/traits/bad-method-typaram-kind.stderr index 376a83e58a7d3..3b3d6e5f832b6 100644 --- a/tests/ui/traits/bad-method-typaram-kind.stderr +++ b/tests/ui/traits/bad-method-typaram-kind.stderr @@ -11,7 +11,7 @@ note: required by a bound in `Bar::bar` | LL | fn bar(&self); | ^^^^ required by this bound in `Bar::bar` -help: consider further restricting this bound +help: consider further restricting type parameter `T` with trait `Send` | LL | fn foo() { | +++++++++++++++++++ diff --git a/tests/ui/traits/bound/on-structs-and-enums.stderr b/tests/ui/traits/bound/on-structs-and-enums.stderr index 606f764852fed..7d6420c648273 100644 --- a/tests/ui/traits/bound/on-structs-and-enums.stderr +++ b/tests/ui/traits/bound/on-structs-and-enums.stderr @@ -9,7 +9,7 @@ note: required by a bound in `Foo` | LL | struct Foo { | ^^^^^ required by this bound in `Foo` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Trait` | LL | impl Foo { | +++++++ @@ -59,7 +59,7 @@ note: required by a bound in `Foo` | LL | struct Foo { | ^^^^^ required by this bound in `Foo` -help: consider restricting type parameter `U` +help: consider restricting type parameter `U` with trait `Trait` | LL | struct Badness { | +++++++ @@ -75,7 +75,7 @@ note: required by a bound in `Bar` | LL | enum Bar { | ^^^^^ required by this bound in `Bar` -help: consider restricting type parameter `V` +help: consider restricting type parameter `V` with trait `Trait` | LL | enum MoreBadness { | +++++++ diff --git a/tests/ui/traits/const-traits/call-generic-method-chain.stderr b/tests/ui/traits/const-traits/call-generic-method-chain.stderr index 9a53c61d0191d..21fb19daad4aa 100644 --- a/tests/ui/traits/const-traits/call-generic-method-chain.stderr +++ b/tests/ui/traits/const-traits/call-generic-method-chain.stderr @@ -42,10 +42,6 @@ LL | *t == *t | ^^^^^^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: consider further restricting this bound - | -LL | const fn equals_self(t: &T) -> bool { - | ++++++++++++++++++++++++++++ error[E0015]: cannot call non-const fn `::eq` in constant functions --> $DIR/call-generic-method-chain.rs:16:15 diff --git a/tests/ui/traits/const-traits/call-generic-method-dup-bound.stderr b/tests/ui/traits/const-traits/call-generic-method-dup-bound.stderr index a168171cfe84b..845949a38bf5a 100644 --- a/tests/ui/traits/const-traits/call-generic-method-dup-bound.stderr +++ b/tests/ui/traits/const-traits/call-generic-method-dup-bound.stderr @@ -42,10 +42,6 @@ LL | *t == *t | ^^^^^^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: consider further restricting this bound - | -LL | const fn equals_self(t: &T) -> bool { - | ++++++++++++++++++++++++++++ error[E0015]: cannot call non-const fn `::eq` in constant functions --> $DIR/call-generic-method-dup-bound.rs:14:15 @@ -62,10 +58,6 @@ LL | *t == *t | ^^^^^^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: consider further restricting this bound - | -LL | const fn equals_self2(t: &T) -> bool { - | ++++++++++++++++++++++++++++ error: aborting due to 8 previous errors diff --git a/tests/ui/traits/const-traits/call-generic-method-fail.stderr b/tests/ui/traits/const-traits/call-generic-method-fail.stderr index 07e50a7f7daae..6bacb986fef0c 100644 --- a/tests/ui/traits/const-traits/call-generic-method-fail.stderr +++ b/tests/ui/traits/const-traits/call-generic-method-fail.stderr @@ -5,10 +5,6 @@ LL | *t == *t | ^^^^^^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: consider further restricting this bound - | -LL | pub const fn equals_self(t: &T) -> bool { - | ++++++++++++++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/traits/const-traits/call-generic-method-pass.stderr b/tests/ui/traits/const-traits/call-generic-method-pass.stderr index af6e6d25dc9be..0c0037e36b86d 100644 --- a/tests/ui/traits/const-traits/call-generic-method-pass.stderr +++ b/tests/ui/traits/const-traits/call-generic-method-pass.stderr @@ -28,10 +28,6 @@ LL | *t == *t | ^^^^^^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: consider further restricting this bound - | -LL | const fn equals_self(t: &T) -> bool { - | ++++++++++++++++++++++++++++ error[E0015]: cannot call non-const fn `::eq` in constant functions --> $DIR/call-generic-method-pass.rs:16:15 diff --git a/tests/ui/traits/const-traits/const-closure-trait-method-fail.stderr b/tests/ui/traits/const-traits/const-closure-trait-method-fail.stderr index cb4c994bc2f2d..a76dc3e82af71 100644 --- a/tests/ui/traits/const-traits/const-closure-trait-method-fail.stderr +++ b/tests/ui/traits/const-traits/const-closure-trait-method-fail.stderr @@ -19,10 +19,6 @@ LL | x(()) | ^^^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: consider further restricting this bound - | -LL | const fn need_const_closure i32 + ~const FnOnce(())>(x: T) -> i32 { - | +++++++++++++++++++ error: aborting due to 3 previous errors diff --git a/tests/ui/traits/const-traits/const-closure-trait-method.stderr b/tests/ui/traits/const-traits/const-closure-trait-method.stderr index 43af435ae64d7..d37ff3d727cea 100644 --- a/tests/ui/traits/const-traits/const-closure-trait-method.stderr +++ b/tests/ui/traits/const-traits/const-closure-trait-method.stderr @@ -19,10 +19,6 @@ LL | x(()) | ^^^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: consider further restricting this bound - | -LL | const fn need_const_closure i32 + ~const FnOnce(())>(x: T) -> i32 { - | +++++++++++++++++++ error: aborting due to 3 previous errors diff --git a/tests/ui/traits/const-traits/const-closures.stderr b/tests/ui/traits/const-traits/const-closures.stderr index 2e9e37ba3216d..8ceaae16d8e70 100644 --- a/tests/ui/traits/const-traits/const-closures.stderr +++ b/tests/ui/traits/const-traits/const-closures.stderr @@ -61,10 +61,6 @@ LL | f() + f() | ^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: consider further restricting this bound - | -LL | const fn answer u8 + ~const Fn()>(f: &F) -> u8 { - | +++++++++++++ error[E0015]: cannot call non-const closure in constant functions --> $DIR/const-closures.rs:24:11 @@ -73,10 +69,6 @@ LL | f() + f() | ^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: consider further restricting this bound - | -LL | const fn answer u8 + ~const Fn()>(f: &F) -> u8 { - | +++++++++++++ error[E0015]: cannot call non-const closure in constant functions --> $DIR/const-closures.rs:12:5 @@ -85,10 +77,6 @@ LL | f() * 7 | ^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: consider further restricting this bound - | -LL | F: ~const FnOnce() -> u8 + ~const Fn(), - | +++++++++++++ error: aborting due to 11 previous errors diff --git a/tests/ui/traits/const-traits/trait-where-clause.stderr b/tests/ui/traits/const-traits/trait-where-clause.stderr index abe24b662a27f..3a15cc63f3223 100644 --- a/tests/ui/traits/const-traits/trait-where-clause.stderr +++ b/tests/ui/traits/const-traits/trait-where-clause.stderr @@ -33,7 +33,7 @@ note: required by a bound in `Foo::b` | LL | fn b() where Self: ~const Bar; | ^^^^^^^^^^ required by this bound in `Foo::b` -help: consider further restricting this bound +help: consider further restricting type parameter `T` with trait `Bar` | LL | fn test1() { | +++++ @@ -49,7 +49,7 @@ note: required by a bound in `Foo::c` | LL | fn c(); | ^^^^^^^^^^ required by this bound in `Foo::c` -help: consider further restricting this bound +help: consider further restricting type parameter `T` with trait `Bar` | LL | fn test1() { | +++++ diff --git a/tests/ui/traits/copy-impl-cannot-normalize.stderr b/tests/ui/traits/copy-impl-cannot-normalize.stderr index 3bdb8b70172c4..45c26ac9ef46a 100644 --- a/tests/ui/traits/copy-impl-cannot-normalize.stderr +++ b/tests/ui/traits/copy-impl-cannot-normalize.stderr @@ -14,7 +14,7 @@ LL | T: TraitFoo, | -------- unsatisfied trait bound introduced here note: required by a bound in `Copy` --> $SRC_DIR/core/src/marker.rs:LL:COL -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `TraitFoo` | LL | impl Copy for Foo {} | ++++++++++ diff --git a/tests/ui/traits/copy-is-not-modulo-regions.not_static.stderr b/tests/ui/traits/copy-is-not-modulo-regions.not_static.stderr index 56544dd4def0a..02170a127dbd3 100644 --- a/tests/ui/traits/copy-is-not-modulo-regions.not_static.stderr +++ b/tests/ui/traits/copy-is-not-modulo-regions.not_static.stderr @@ -12,7 +12,7 @@ note: the `Copy` impl for `Foo<'any>` requires that `'any: 'static` | LL | struct Bar<'lt>(Foo<'lt>); | ^^^^^^^^ -help: consider restricting type parameter `'any` +help: consider restricting type parameter `'any` with `'static` | LL | impl<'any: 'static> Copy for Bar<'any> {} | +++++++++ diff --git a/tests/ui/traits/inductive-overflow/two-traits.stderr b/tests/ui/traits/inductive-overflow/two-traits.stderr index 6092c194a8757..1816e029f1844 100644 --- a/tests/ui/traits/inductive-overflow/two-traits.stderr +++ b/tests/ui/traits/inductive-overflow/two-traits.stderr @@ -9,7 +9,7 @@ note: required by a bound in `Magic::X` | LL | type X: Trait; | ^^^^^ required by this bound in `Magic::X` -help: consider further restricting this bound +help: consider further restricting type parameter `T` with trait `Sync` | LL | impl Magic for T { | +++++++++++++++++++ diff --git a/tests/ui/traits/inheritance/repeated-supertrait-ambig.stderr b/tests/ui/traits/inheritance/repeated-supertrait-ambig.stderr index 6f7c9fa11d4b3..fdf0b1722beaf 100644 --- a/tests/ui/traits/inheritance/repeated-supertrait-ambig.stderr +++ b/tests/ui/traits/inheritance/repeated-supertrait-ambig.stderr @@ -18,7 +18,7 @@ LL | c.same_as(22) | | | required by a bound introduced by this call | -help: consider further restricting this bound +help: consider further restricting type parameter `C` with trait `CompareTo` | LL | fn with_trait>(c: &C) -> bool { | ++++++++++++++++ @@ -41,7 +41,7 @@ LL | CompareTo::same_as(c, 22) | | | required by a bound introduced by this call | -help: consider further restricting this bound +help: consider further restricting type parameter `C` with trait `CompareTo` | LL | fn with_ufcs2>(c: &C) -> bool { | ++++++++++++++++ diff --git a/tests/ui/traits/issue-21837.stderr b/tests/ui/traits/issue-21837.stderr index f198939268802..06e79d40c7d6c 100644 --- a/tests/ui/traits/issue-21837.stderr +++ b/tests/ui/traits/issue-21837.stderr @@ -9,7 +9,7 @@ note: required by a bound in `Foo` | LL | pub struct Foo(T); | ^^^^^ required by this bound in `Foo` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Bound` | LL | impl Trait2 for Foo {} | +++++++ diff --git a/tests/ui/traits/issue-43784-supertrait.stderr b/tests/ui/traits/issue-43784-supertrait.stderr index 2bf365745a6bd..1a6da70d76daf 100644 --- a/tests/ui/traits/issue-43784-supertrait.stderr +++ b/tests/ui/traits/issue-43784-supertrait.stderr @@ -14,7 +14,7 @@ note: required by a bound in `Complete` | LL | pub trait Complete: Partial { | ^^^^^^^ required by this bound in `Complete` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | impl Complete for T {} | +++++++++++++++++++ diff --git a/tests/ui/traits/next-solver/diagnostics/projection-trait-ref.stderr b/tests/ui/traits/next-solver/diagnostics/projection-trait-ref.stderr index cd8d8b3ffcd38..463e50a2553e4 100644 --- a/tests/ui/traits/next-solver/diagnostics/projection-trait-ref.stderr +++ b/tests/ui/traits/next-solver/diagnostics/projection-trait-ref.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `T: Trait` is not satisfied LL | let x: ::Assoc = (); | ^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `T` | -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Trait` | LL | fn test_poly() { | +++++++ diff --git a/tests/ui/traits/next-solver/dyn-incompatibility.stderr b/tests/ui/traits/next-solver/dyn-incompatibility.stderr index a720797efc4b9..6398fbddca5e5 100644 --- a/tests/ui/traits/next-solver/dyn-incompatibility.stderr +++ b/tests/ui/traits/next-solver/dyn-incompatibility.stderr @@ -10,7 +10,7 @@ note: required by a bound in `copy` | LL | fn copy(from: &U::From) -> U::From { | ^^^^^ required by this bound in `copy` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | pub fn copy_any(t: &T) -> T { | +++++++++++++++++++ @@ -38,7 +38,7 @@ LL | copy::>(t) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `dyn Setup`, the trait `Copy` is not implemented for `T` | = note: required because it appears within the type `dyn Setup` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | pub fn copy_any(t: &T) -> T { | +++++++++++++++++++ diff --git a/tests/ui/traits/next-solver/global-cache-and-parallel-frontend.stderr b/tests/ui/traits/next-solver/global-cache-and-parallel-frontend.stderr index 1f319cc6743bc..da269bbeae4c6 100644 --- a/tests/ui/traits/next-solver/global-cache-and-parallel-frontend.stderr +++ b/tests/ui/traits/next-solver/global-cache-and-parallel-frontend.stderr @@ -14,7 +14,7 @@ LL | impl PartialEq for Struct note: required by a bound in `Eq` --> $SRC_DIR/core/src/cmp.rs:LL:COL = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Clone` | LL | pub struct Struct(T); | +++++++++++++++++++ diff --git a/tests/ui/traits/next-solver/typeck/structurally-resolve-in-probe_adt.rs b/tests/ui/traits/next-solver/typeck/structurally-resolve-in-probe_adt.rs new file mode 100644 index 0000000000000..23915808279a5 --- /dev/null +++ b/tests/ui/traits/next-solver/typeck/structurally-resolve-in-probe_adt.rs @@ -0,0 +1,15 @@ +//@ check-pass +//@ compile-flags: -Znext-solver + +trait Mirror { + type Assoc; +} +impl Mirror for T { + type Assoc = T; +} + +type Foo = as Mirror>::Assoc; + +fn main() { + let x = Foo::::None; +} diff --git a/tests/ui/tuple/builtin-fail.stderr b/tests/ui/tuple/builtin-fail.stderr index e3e29a73fdc01..ccbc5ae2b7513 100644 --- a/tests/ui/tuple/builtin-fail.stderr +++ b/tests/ui/tuple/builtin-fail.stderr @@ -9,7 +9,7 @@ note: required by a bound in `assert_is_tuple` | LL | fn assert_is_tuple() {} | ^^^^^^^^^^^^^^^^^^ required by this bound in `assert_is_tuple` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with unstable trait `Tuple` | LL | fn from_param_env() { | ++++++++++++++++++++ diff --git a/tests/ui/type-alias-impl-trait/bounds-are-checked-2.stderr b/tests/ui/type-alias-impl-trait/bounds-are-checked-2.stderr index 8f887a6ac68f9..bbb32b2d604d0 100644 --- a/tests/ui/type-alias-impl-trait/bounds-are-checked-2.stderr +++ b/tests/ui/type-alias-impl-trait/bounds-are-checked-2.stderr @@ -14,7 +14,7 @@ note: this definition site has more where clauses than the opaque type | LL | fn f(t: T) -> X { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Clone` | LL | pub type X = impl Clone; | +++++++++++++++++++ diff --git a/tests/ui/type-alias-impl-trait/bounds-are-checked3.stderr b/tests/ui/type-alias-impl-trait/bounds-are-checked3.stderr index bca88b5fae10f..c0f6d6780976a 100644 --- a/tests/ui/type-alias-impl-trait/bounds-are-checked3.stderr +++ b/tests/ui/type-alias-impl-trait/bounds-are-checked3.stderr @@ -10,7 +10,7 @@ note: required by a bound in `Struct` | LL | struct Struct(Option); | ^^^^^^^ required by this bound in `Struct` -help: consider further restricting this bound +help: consider further restricting type parameter `T` with trait `Display` | LL | type Foo = (impl Debug, Struct); | +++++++++++++++++++ diff --git a/tests/ui/type-alias-impl-trait/future.stderr b/tests/ui/type-alias-impl-trait/future.stderr index b20073fcdfcde..047ad164239c0 100644 --- a/tests/ui/type-alias-impl-trait/future.stderr +++ b/tests/ui/type-alias-impl-trait/future.stderr @@ -9,7 +9,7 @@ note: required by a bound in `foo` | LL | fn foo(bar: B) -> FooFuture { | ^^^ required by this bound in `foo` -help: consider restricting type parameter `B` +help: consider restricting type parameter `B` with trait `Bar` | LL | type FooFuture = impl Future; | +++++ diff --git a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use2.stderr b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use2.stderr index af6e6e1e66e8f..cd6e85764bda4 100644 --- a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use2.stderr +++ b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use2.stderr @@ -14,7 +14,7 @@ note: this definition site has more where clauses than the opaque type | LL | fn two(t: T, _: U) -> Two { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Debug` | LL | type Two = impl Debug; | +++++++++++++++++ diff --git a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use4.stderr b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use4.stderr index a847bed93da79..bf3c4a0e04fe6 100644 --- a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use4.stderr +++ b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use4.stderr @@ -14,7 +14,7 @@ note: this definition site has more where clauses than the opaque type | LL | fn three(_: T, u: U) -> Two { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -help: consider restricting type parameter `U` +help: consider restricting type parameter `U` with trait `Debug` | LL | type Two = impl Debug; | +++++++++++++++++ diff --git a/tests/ui/type-alias-impl-trait/generic_underconstrained.stderr b/tests/ui/type-alias-impl-trait/generic_underconstrained.stderr index 88529b370f133..98f99cdbfbd65 100644 --- a/tests/ui/type-alias-impl-trait/generic_underconstrained.stderr +++ b/tests/ui/type-alias-impl-trait/generic_underconstrained.stderr @@ -9,7 +9,7 @@ note: required by a bound on the type alias `Underconstrained` | LL | type Underconstrained = impl Send; | ^^^^^ required by this bound -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Trait` | LL | fn underconstrain(_: T) -> Underconstrained { | +++++++ @@ -30,7 +30,7 @@ note: required by a bound on the type alias `Underconstrained` | LL | type Underconstrained = impl Send; | ^^^^^ required by this bound -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Trait` | LL | fn underconstrain(_: T) -> Underconstrained { | +++++++ diff --git a/tests/ui/type-alias-impl-trait/generic_underconstrained2.stderr b/tests/ui/type-alias-impl-trait/generic_underconstrained2.stderr index b3b9cbca96854..5506977a3e702 100644 --- a/tests/ui/type-alias-impl-trait/generic_underconstrained2.stderr +++ b/tests/ui/type-alias-impl-trait/generic_underconstrained2.stderr @@ -9,7 +9,7 @@ note: required by a bound on the type alias `Underconstrained` | LL | type Underconstrained = impl Send; | ^^^^^^^^^^^^^^^ required by this bound -help: consider restricting type parameter `U` +help: consider restricting type parameter `U` with trait `Debug` | LL | fn underconstrained(_: U) -> Underconstrained { | +++++++++++++++++ @@ -25,7 +25,7 @@ note: required by a bound on the type alias `Underconstrained2` | LL | type Underconstrained2 = impl Send; | ^^^^^^^^^^^^^^^ required by this bound -help: consider restricting type parameter `V` +help: consider restricting type parameter `V` with trait `Debug` | LL | fn underconstrained2(_: U, _: V) -> Underconstrained2 { | +++++++++++++++++ @@ -46,7 +46,7 @@ note: required by a bound on the type alias `Underconstrained` | LL | type Underconstrained = impl Send; | ^^^^^^^^^^^^^^^ required by this bound -help: consider restricting type parameter `U` +help: consider restricting type parameter `U` with trait `Debug` | LL | fn underconstrained(_: U) -> Underconstrained { | +++++++++++++++++ @@ -67,7 +67,7 @@ note: required by a bound on the type alias `Underconstrained2` | LL | type Underconstrained2 = impl Send; | ^^^^^^^^^^^^^^^ required by this bound -help: consider restricting type parameter `V` +help: consider restricting type parameter `V` with trait `Debug` | LL | fn underconstrained2(_: U, _: V) -> Underconstrained2 { | +++++++++++++++++ diff --git a/tests/ui/type-alias-impl-trait/issue-52843.stderr b/tests/ui/type-alias-impl-trait/issue-52843.stderr index a6bdddbc98c67..6673b03525d06 100644 --- a/tests/ui/type-alias-impl-trait/issue-52843.stderr +++ b/tests/ui/type-alias-impl-trait/issue-52843.stderr @@ -14,7 +14,7 @@ note: this definition site has more where clauses than the opaque type | LL | fn foo(t: T) -> Foo { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Default` | LL | type Foo = impl Default; | +++++++++++++++++++++++ diff --git a/tests/ui/type-alias-impl-trait/issue-53092.stderr b/tests/ui/type-alias-impl-trait/issue-53092.stderr index f04750866c762..579902aa3ab28 100644 --- a/tests/ui/type-alias-impl-trait/issue-53092.stderr +++ b/tests/ui/type-alias-impl-trait/issue-53092.stderr @@ -9,7 +9,7 @@ note: required by a bound in `make_bug` | LL | fn make_bug>() -> Bug { | ^^^^^^^ required by this bound in `make_bug` -help: consider restricting type parameter `U` +help: consider restricting type parameter `U` with trait `From` | LL | pub type Bug> = impl Fn(T) -> U + Copy; | +++++++++++++++++++++++ diff --git a/tests/ui/type-alias-impl-trait/issue-89686.stderr b/tests/ui/type-alias-impl-trait/issue-89686.stderr index 91d71339a0848..6fa7e197c40c4 100644 --- a/tests/ui/type-alias-impl-trait/issue-89686.stderr +++ b/tests/ui/type-alias-impl-trait/issue-89686.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `T: Trait` is not satisfied LL | async move { self.f().await } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `T` | -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Trait` | LL | type G<'a, T: Trait> = impl Future; | +++++++ diff --git a/tests/ui/type-alias-impl-trait/issue-90400-1.stderr b/tests/ui/type-alias-impl-trait/issue-90400-1.stderr index bc233a5321437..afdccd56a50f4 100644 --- a/tests/ui/type-alias-impl-trait/issue-90400-1.stderr +++ b/tests/ui/type-alias-impl-trait/issue-90400-1.stderr @@ -9,7 +9,7 @@ note: required by a bound in `::foo` | LL | fn foo(&self, bar: B) -> Self::FooFn { | ^^^ required by this bound in `::foo` -help: consider restricting type parameter `B` +help: consider restricting type parameter `B` with trait `Bar` | LL | type FooFn = impl FnOnce(); | +++++ diff --git a/tests/ui/type-alias-impl-trait/issue-90400-2.stderr b/tests/ui/type-alias-impl-trait/issue-90400-2.stderr index 4a6a62bdf96dd..d4faa6e939259 100644 --- a/tests/ui/type-alias-impl-trait/issue-90400-2.stderr +++ b/tests/ui/type-alias-impl-trait/issue-90400-2.stderr @@ -21,7 +21,7 @@ note: this definition site has more where clauses than the opaque type | LL | fn foo(&self, bar: B) -> Self::FooFn { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -help: consider restricting type parameter `B` +help: consider restricting type parameter `B` with trait `Bar` | LL | type FooFn = impl Baz; | +++++ diff --git a/tests/ui/type-alias-impl-trait/not_well_formed.stderr b/tests/ui/type-alias-impl-trait/not_well_formed.stderr index a2944a1acb97a..e2fa9442323ae 100644 --- a/tests/ui/type-alias-impl-trait/not_well_formed.stderr +++ b/tests/ui/type-alias-impl-trait/not_well_formed.stderr @@ -4,7 +4,7 @@ error[E0220]: associated type `Assoc` not found for `V` LL | type Foo = impl Trait; | ^^^^^ there is an associated type `Assoc` in the trait `TraitWithAssoc` | -help: consider restricting type parameter `V` +help: consider restricting type parameter `V` with trait `TraitWithAssoc` | LL | type Foo = impl Trait; | ++++++++++++++++ @@ -16,7 +16,7 @@ LL | type Foo = impl Trait; | ^^^^^ there is an associated type `Assoc` in the trait `TraitWithAssoc` | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: consider restricting type parameter `V` +help: consider restricting type parameter `V` with trait `TraitWithAssoc` | LL | type Foo = impl Trait; | ++++++++++++++++ diff --git a/tests/ui/type-alias-impl-trait/underconstrained_generic.stderr b/tests/ui/type-alias-impl-trait/underconstrained_generic.stderr index 48cef847fbbff..e50949ed8f369 100644 --- a/tests/ui/type-alias-impl-trait/underconstrained_generic.stderr +++ b/tests/ui/type-alias-impl-trait/underconstrained_generic.stderr @@ -21,7 +21,7 @@ note: this definition site has more where clauses than the opaque type | LL | fn _defining_use() -> Converter { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Trait` | LL | type Converter = impl ProofForConversion; | +++++++ diff --git a/tests/ui/type-alias-impl-trait/wf-check-fn-def.stderr b/tests/ui/type-alias-impl-trait/wf-check-fn-def.stderr index 47bea7bbe608c..9046a8a76b82b 100644 --- a/tests/ui/type-alias-impl-trait/wf-check-fn-def.stderr +++ b/tests/ui/type-alias-impl-trait/wf-check-fn-def.stderr @@ -9,7 +9,7 @@ note: required by a bound in `mop` | LL | fn mop(bar: B) { bar.bar() } | ^^^ required by this bound in `mop` -help: consider restricting type parameter `B` +help: consider restricting type parameter `B` with trait `Bar` | LL | type FooFn = impl FnOnce(B); | +++++ diff --git a/tests/ui/type-alias-impl-trait/wf_check_closures.stderr b/tests/ui/type-alias-impl-trait/wf_check_closures.stderr index 09a42f73490a0..4156f0ca96aea 100644 --- a/tests/ui/type-alias-impl-trait/wf_check_closures.stderr +++ b/tests/ui/type-alias-impl-trait/wf_check_closures.stderr @@ -9,7 +9,7 @@ note: required by a bound in `foo` | LL | fn foo(bar: B) -> FooFn { | ^^^ required by this bound in `foo` -help: consider restricting type parameter `B` +help: consider restricting type parameter `B` with trait `Bar` | LL | type FooFn = impl FnOnce(); | +++++ diff --git a/tests/ui/type-alias/unresolved-assoc-ty-suggest-trait.lazy.stderr b/tests/ui/type-alias/unresolved-assoc-ty-suggest-trait.lazy.stderr index 96179a7b48466..885c6ec9d8e8e 100644 --- a/tests/ui/type-alias/unresolved-assoc-ty-suggest-trait.lazy.stderr +++ b/tests/ui/type-alias/unresolved-assoc-ty-suggest-trait.lazy.stderr @@ -4,7 +4,7 @@ error[E0220]: associated type `Assoc` not found for `T` LL | type AssocOf = T::Assoc; | ^^^^^ there is an associated type `Assoc` in the trait `Trait` | -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Trait` | LL | type AssocOf = T::Assoc; | +++++++ @@ -15,7 +15,7 @@ error[E0220]: associated type `Assok` not found for `T` LL | type AssokOf = T::Assok; | ^^^^^ there is a similarly named associated type `Assoc` in the trait `Trait` | -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Trait` | LL | type AssokOf = T::Assok; | +++++++ @@ -30,7 +30,7 @@ error[E0220]: associated type `Proj` not found for `T` LL | type ProjOf = T::Proj; | ^^^^ there is an associated type `Proj` in the trait `Parametrized` | -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Parametrized` | LL | type ProjOf> = T::Proj; | ++++++++++++++++++++++++++++++ diff --git a/tests/ui/type/type-check-defaults.stderr b/tests/ui/type/type-check-defaults.stderr index 9c48250612971..ab3378eaa4ab6 100644 --- a/tests/ui/type/type-check-defaults.stderr +++ b/tests/ui/type/type-check-defaults.stderr @@ -53,7 +53,7 @@ note: required by a bound in `Super` | LL | trait Super { } | ^^^^ required by this bound in `Super` -help: consider further restricting type parameter `T` +help: consider further restricting type parameter `T` with trait `Copy` | LL | trait Base: Super where T: std::marker::Copy { } | ++++++++++++++++++++++++++ diff --git a/tests/ui/type/type-check/missing_trait_impl.stderr b/tests/ui/type/type-check/missing_trait_impl.stderr index 2b58cd4180bd3..033b42e6736d6 100644 --- a/tests/ui/type/type-check/missing_trait_impl.stderr +++ b/tests/ui/type/type-check/missing_trait_impl.stderr @@ -6,7 +6,7 @@ LL | let z = x + y; | | | T | -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Add` | LL | fn foo(x: T, y: T) { | +++++++++++++++ @@ -19,7 +19,7 @@ LL | x += x; | | | cannot use `+=` on type `T` | -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `AddAssign` | LL | fn bar(x: T) { | +++++++++++++++++++++ @@ -30,7 +30,7 @@ error[E0600]: cannot apply unary operator `-` to type `T` LL | let y = -x; | ^^ cannot apply unary operator `-` | -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Neg` | LL | fn baz(x: T) { | +++++++++++++++ @@ -41,7 +41,7 @@ error[E0600]: cannot apply unary operator `!` to type `T` LL | let y = !x; | ^^ cannot apply unary operator `!` | -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Not` | LL | fn baz(x: T) { | +++++++++++++++ diff --git a/tests/ui/typeck/bad-index-due-to-nested.stderr b/tests/ui/typeck/bad-index-due-to-nested.stderr index bd7fd0392c378..dd2ce092368a8 100644 --- a/tests/ui/typeck/bad-index-due-to-nested.stderr +++ b/tests/ui/typeck/bad-index-due-to-nested.stderr @@ -12,7 +12,7 @@ LL | impl Index<&K> for HashMap LL | where LL | K: Hash, | ---- unsatisfied trait bound introduced here -help: consider restricting type parameter `K` +help: consider restricting type parameter `K` with trait `Hash` | LL | fn index<'a, K: std::hash::Hash, V>(map: &'a HashMap, k: K) -> &'a V { | +++++++++++++++++ @@ -31,7 +31,7 @@ LL | impl Index<&K> for HashMap ... LL | V: Copy, | ---- unsatisfied trait bound introduced here -help: consider restricting type parameter `V` +help: consider restricting type parameter `V` with trait `Copy` | LL | fn index<'a, K, V: std::marker::Copy>(map: &'a HashMap, k: K) -> &'a V { | +++++++++++++++++++ diff --git a/tests/ui/typeck/issue-90164.stderr b/tests/ui/typeck/issue-90164.stderr index 43e96e1adc6bd..1be9c1a0b6e18 100644 --- a/tests/ui/typeck/issue-90164.stderr +++ b/tests/ui/typeck/issue-90164.stderr @@ -13,7 +13,7 @@ note: required by a bound in `copy` | LL | fn copy(_: R, _: W) {} | ^^^^^ required by this bound in `copy` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Unpin` | LL | fn f(r: T) { | ++++++++++++++++++++ diff --git a/tests/ui/typeck/typeck-default-trait-impl-send-param.stderr b/tests/ui/typeck/typeck-default-trait-impl-send-param.stderr index 537ae6b2b5f66..d72c56ac71278 100644 --- a/tests/ui/typeck/typeck-default-trait-impl-send-param.stderr +++ b/tests/ui/typeck/typeck-default-trait-impl-send-param.stderr @@ -9,7 +9,7 @@ note: required by a bound in `is_send` | LL | fn is_send() { | ^^^^ required by this bound in `is_send` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Send` | LL | fn foo() { | +++++++++++++++++++ diff --git a/tests/ui/union/issue-81199.stderr b/tests/ui/union/issue-81199.stderr index 0dd894beb2a46..8b78ddcf4a527 100644 --- a/tests/ui/union/issue-81199.stderr +++ b/tests/ui/union/issue-81199.stderr @@ -9,7 +9,7 @@ note: required by a bound in `PtrComponents` | LL | struct PtrComponents { | ^^^^^^^ required by this bound in `PtrComponents` -help: consider further restricting this bound +help: consider further restricting type parameter `T` with trait `Pointee` | LL | union PtrRepr { | +++++++++ diff --git a/tests/ui/unop/unop-move-semantics.stderr b/tests/ui/unop/unop-move-semantics.stderr index 0ae918d434a0f..5b81feaa578af 100644 --- a/tests/ui/unop/unop-move-semantics.stderr +++ b/tests/ui/unop/unop-move-semantics.stderr @@ -15,7 +15,7 @@ help: consider cloning the value if the performance cost is acceptable | LL | !x.clone(); | ++++++++ -help: consider further restricting this bound +help: consider further restricting type parameter `T` with trait `Copy` | LL | fn move_then_borrow + Clone + Copy>(x: T) { | ++++++ diff --git a/tests/ui/wf/issue-96810.stderr b/tests/ui/wf/issue-96810.stderr index 622d72f791e2e..3f87d3e0786fb 100644 --- a/tests/ui/wf/issue-96810.stderr +++ b/tests/ui/wf/issue-96810.stderr @@ -9,7 +9,7 @@ note: required by a bound in `S` | LL | struct S(T::Assoc); | ^^ required by this bound in `S` -help: consider restricting type parameter `K` +help: consider restricting type parameter `K` with trait `Tr` | LL | struct Hoge { | ++++ diff --git a/tests/ui/wf/wf-enum-bound.stderr b/tests/ui/wf/wf-enum-bound.stderr index 78b5c6ec20eb4..1f37dc409fc70 100644 --- a/tests/ui/wf/wf-enum-bound.stderr +++ b/tests/ui/wf/wf-enum-bound.stderr @@ -9,7 +9,7 @@ note: required by a bound in `ExtraCopy` | LL | trait ExtraCopy { } | ^^^^ required by this bound in `ExtraCopy` -help: consider further restricting type parameter `U` +help: consider further restricting type parameter `U` with trait `Copy` | LL | where T: ExtraCopy, U: std::marker::Copy | ++++++++++++++++++++++ diff --git a/tests/ui/wf/wf-enum-fields-struct-variant.stderr b/tests/ui/wf/wf-enum-fields-struct-variant.stderr index 2f2c1c2d2665c..f15a31887a203 100644 --- a/tests/ui/wf/wf-enum-fields-struct-variant.stderr +++ b/tests/ui/wf/wf-enum-fields-struct-variant.stderr @@ -9,7 +9,7 @@ note: required by a bound in `IsCopy` | LL | struct IsCopy { | ^^^^ required by this bound in `IsCopy` -help: consider restricting type parameter `A` +help: consider restricting type parameter `A` with trait `Copy` | LL | enum AnotherEnum { | +++++++++++++++++++ diff --git a/tests/ui/wf/wf-enum-fields.stderr b/tests/ui/wf/wf-enum-fields.stderr index a5feaadfc7587..3b4de77efdc26 100644 --- a/tests/ui/wf/wf-enum-fields.stderr +++ b/tests/ui/wf/wf-enum-fields.stderr @@ -9,7 +9,7 @@ note: required by a bound in `IsCopy` | LL | struct IsCopy { | ^^^^ required by this bound in `IsCopy` -help: consider restricting type parameter `A` +help: consider restricting type parameter `A` with trait `Copy` | LL | enum SomeEnum { | +++++++++++++++++++ diff --git a/tests/ui/wf/wf-fn-where-clause.stderr b/tests/ui/wf/wf-fn-where-clause.stderr index fbfe42ac62477..76671dedabf47 100644 --- a/tests/ui/wf/wf-fn-where-clause.stderr +++ b/tests/ui/wf/wf-fn-where-clause.stderr @@ -9,7 +9,7 @@ note: required by a bound in `ExtraCopy` | LL | trait ExtraCopy { } | ^^^^ required by this bound in `ExtraCopy` -help: consider further restricting type parameter `U` +help: consider further restricting type parameter `U` with trait `Copy` | LL | fn foo() where T: ExtraCopy, U: std::marker::Copy | ++++++++++++++++++++++ diff --git a/tests/ui/wf/wf-impl-associated-type-trait.stderr b/tests/ui/wf/wf-impl-associated-type-trait.stderr index 09e255bead025..47962c75d69d2 100644 --- a/tests/ui/wf/wf-impl-associated-type-trait.stderr +++ b/tests/ui/wf/wf-impl-associated-type-trait.stderr @@ -9,7 +9,7 @@ note: required by a bound in `MySet` | LL | pub struct MySet { | ^^^^^^ required by this bound in `MySet` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `MyHash` | LL | impl Foo for T { | ++++++++ diff --git a/tests/ui/wf/wf-in-fn-arg.stderr b/tests/ui/wf/wf-in-fn-arg.stderr index 8f22edd17a100..a65f621526b19 100644 --- a/tests/ui/wf/wf-in-fn-arg.stderr +++ b/tests/ui/wf/wf-in-fn-arg.stderr @@ -9,7 +9,7 @@ note: required by a bound in `MustBeCopy` | LL | struct MustBeCopy { | ^^^^ required by this bound in `MustBeCopy` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | fn bar(_: &MustBeCopy) | +++++++++++++++++++ diff --git a/tests/ui/wf/wf-in-fn-ret.stderr b/tests/ui/wf/wf-in-fn-ret.stderr index 1ae49a348cc69..3f2b46f8478df 100644 --- a/tests/ui/wf/wf-in-fn-ret.stderr +++ b/tests/ui/wf/wf-in-fn-ret.stderr @@ -9,7 +9,7 @@ note: required by a bound in `MustBeCopy` | LL | struct MustBeCopy { | ^^^^ required by this bound in `MustBeCopy` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | fn bar() -> MustBeCopy | +++++++++++++++++++ diff --git a/tests/ui/wf/wf-in-fn-type-arg.stderr b/tests/ui/wf/wf-in-fn-type-arg.stderr index 17594c813daa7..4626b90500a3d 100644 --- a/tests/ui/wf/wf-in-fn-type-arg.stderr +++ b/tests/ui/wf/wf-in-fn-type-arg.stderr @@ -9,7 +9,7 @@ note: required by a bound in `MustBeCopy` | LL | struct MustBeCopy { | ^^^^ required by this bound in `MustBeCopy` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | struct Bar { | +++++++++++++++++++ diff --git a/tests/ui/wf/wf-in-fn-type-ret.stderr b/tests/ui/wf/wf-in-fn-type-ret.stderr index fac535a112659..2ad405b445165 100644 --- a/tests/ui/wf/wf-in-fn-type-ret.stderr +++ b/tests/ui/wf/wf-in-fn-type-ret.stderr @@ -9,7 +9,7 @@ note: required by a bound in `MustBeCopy` | LL | struct MustBeCopy { | ^^^^ required by this bound in `MustBeCopy` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | struct Foo { | +++++++++++++++++++ diff --git a/tests/ui/wf/wf-in-fn-where-clause.stderr b/tests/ui/wf/wf-in-fn-where-clause.stderr index 4c556d3d77de3..6a56d1c032f7c 100644 --- a/tests/ui/wf/wf-in-fn-where-clause.stderr +++ b/tests/ui/wf/wf-in-fn-where-clause.stderr @@ -9,7 +9,7 @@ note: required by a bound in `MustBeCopy` | LL | trait MustBeCopy { | ^^^^ required by this bound in `MustBeCopy` -help: consider further restricting type parameter `U` +help: consider further restricting type parameter `U` with trait `Copy` | LL | where T: MustBeCopy, U: std::marker::Copy | ++++++++++++++++++++++ diff --git a/tests/ui/wf/wf-in-obj-type-trait.stderr b/tests/ui/wf/wf-in-obj-type-trait.stderr index b96f56a12a54c..5cd5bf5e24eec 100644 --- a/tests/ui/wf/wf-in-obj-type-trait.stderr +++ b/tests/ui/wf/wf-in-obj-type-trait.stderr @@ -9,7 +9,7 @@ note: required by a bound in `MustBeCopy` | LL | struct MustBeCopy { | ^^^^ required by this bound in `MustBeCopy` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | struct Bar { | +++++++++++++++++++ diff --git a/tests/ui/wf/wf-inherent-impl-method-where-clause.stderr b/tests/ui/wf/wf-inherent-impl-method-where-clause.stderr index 4cfbec12b6e41..8b41bb17d2fa7 100644 --- a/tests/ui/wf/wf-inherent-impl-method-where-clause.stderr +++ b/tests/ui/wf/wf-inherent-impl-method-where-clause.stderr @@ -9,7 +9,7 @@ note: required by a bound in `ExtraCopy` | LL | trait ExtraCopy { } | ^^^^ required by this bound in `ExtraCopy` -help: consider restricting type parameter `U` +help: consider restricting type parameter `U` with trait `Copy` | LL | impl Foo { | +++++++++++++++++++ diff --git a/tests/ui/wf/wf-inherent-impl-where-clause.stderr b/tests/ui/wf/wf-inherent-impl-where-clause.stderr index bdc1ee3e0e21c..216b7a98b13f4 100644 --- a/tests/ui/wf/wf-inherent-impl-where-clause.stderr +++ b/tests/ui/wf/wf-inherent-impl-where-clause.stderr @@ -9,7 +9,7 @@ note: required by a bound in `ExtraCopy` | LL | trait ExtraCopy { } | ^^^^ required by this bound in `ExtraCopy` -help: consider further restricting type parameter `U` +help: consider further restricting type parameter `U` with trait `Copy` | LL | impl Foo where T: ExtraCopy, U: std::marker::Copy | ++++++++++++++++++++++ diff --git a/tests/ui/wf/wf-struct-bound.stderr b/tests/ui/wf/wf-struct-bound.stderr index 4ac7f4634e462..24b4282538dac 100644 --- a/tests/ui/wf/wf-struct-bound.stderr +++ b/tests/ui/wf/wf-struct-bound.stderr @@ -9,7 +9,7 @@ note: required by a bound in `ExtraCopy` | LL | trait ExtraCopy { } | ^^^^ required by this bound in `ExtraCopy` -help: consider further restricting type parameter `U` +help: consider further restricting type parameter `U` with trait `Copy` | LL | where T: ExtraCopy, U: std::marker::Copy | ++++++++++++++++++++++ diff --git a/tests/ui/wf/wf-struct-field.stderr b/tests/ui/wf/wf-struct-field.stderr index 241ced3c2dbd8..4449b71bd880e 100644 --- a/tests/ui/wf/wf-struct-field.stderr +++ b/tests/ui/wf/wf-struct-field.stderr @@ -9,7 +9,7 @@ note: required by a bound in `IsCopy` | LL | struct IsCopy { | ^^^^ required by this bound in `IsCopy` -help: consider restricting type parameter `A` +help: consider restricting type parameter `A` with trait `Copy` | LL | struct SomeStruct { | +++++++++++++++++++ diff --git a/tests/ui/wf/wf-trait-associated-type-bound.stderr b/tests/ui/wf/wf-trait-associated-type-bound.stderr index 4ea895a9b0396..fe6a848f8667f 100644 --- a/tests/ui/wf/wf-trait-associated-type-bound.stderr +++ b/tests/ui/wf/wf-trait-associated-type-bound.stderr @@ -9,7 +9,7 @@ note: required by a bound in `ExtraCopy` | LL | trait ExtraCopy { } | ^^^^ required by this bound in `ExtraCopy` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | trait SomeTrait { | +++++++++++++++++++ diff --git a/tests/ui/wf/wf-trait-bound.stderr b/tests/ui/wf/wf-trait-bound.stderr index 5845d05b38e67..0a8d9aa7be825 100644 --- a/tests/ui/wf/wf-trait-bound.stderr +++ b/tests/ui/wf/wf-trait-bound.stderr @@ -9,7 +9,7 @@ note: required by a bound in `ExtraCopy` | LL | trait ExtraCopy { } | ^^^^ required by this bound in `ExtraCopy` -help: consider further restricting type parameter `U` +help: consider further restricting type parameter `U` with trait `Copy` | LL | where T: ExtraCopy, U: std::marker::Copy | ++++++++++++++++++++++ diff --git a/tests/ui/wf/wf-trait-superbound.stderr b/tests/ui/wf/wf-trait-superbound.stderr index 3c05065e57f91..9b0205bfe3955 100644 --- a/tests/ui/wf/wf-trait-superbound.stderr +++ b/tests/ui/wf/wf-trait-superbound.stderr @@ -9,7 +9,7 @@ note: required by a bound in `ExtraCopy` | LL | trait ExtraCopy { } | ^^^^ required by this bound in `ExtraCopy` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | trait SomeTrait: ExtraCopy { | +++++++++++++++++++ diff --git a/tests/ui/where-clauses/where-clause-constraints-are-local-for-inherent-impl.stderr b/tests/ui/where-clauses/where-clause-constraints-are-local-for-inherent-impl.stderr index 2612cefef28c1..955ec18f46515 100644 --- a/tests/ui/where-clauses/where-clause-constraints-are-local-for-inherent-impl.stderr +++ b/tests/ui/where-clauses/where-clause-constraints-are-local-for-inherent-impl.stderr @@ -11,7 +11,7 @@ note: required by a bound in `require_copy` | LL | fn require_copy(x: T) {} | ^^^^ required by this bound in `require_copy` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | impl Foo { | +++++++++++++++++++ diff --git a/tests/ui/where-clauses/where-clause-constraints-are-local-for-trait-impl.stderr b/tests/ui/where-clauses/where-clause-constraints-are-local-for-trait-impl.stderr index 090df26a39e10..793851a287175 100644 --- a/tests/ui/where-clauses/where-clause-constraints-are-local-for-trait-impl.stderr +++ b/tests/ui/where-clauses/where-clause-constraints-are-local-for-trait-impl.stderr @@ -11,7 +11,7 @@ note: required by a bound in `require_copy` | LL | fn require_copy(x: T) {} | ^^^^ required by this bound in `require_copy` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | impl Foo for Bar { | +++++++++++++++++++