diff --git a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs index 1582833bf15d4..c2c07614bc0dd 100644 --- a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs @@ -535,7 +535,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { if let Some(pat) = finder.parent_pat { sugg.insert(0, (pat.span.shrink_to_lo(), "ref ".to_string())); } - err.multipart_suggestion_verbose( + err.multipart_suggestion( "borrow this binding in the pattern to avoid moving the value", sugg, Applicability::MachineApplicable, @@ -1509,7 +1509,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { } else { "consider cloning the value if the performance cost is acceptable" }; - err.multipart_suggestion_verbose(msg, sugg, Applicability::MachineApplicable); + err.multipart_suggestion(msg, sugg, Applicability::MachineApplicable); true } @@ -2759,7 +2759,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { .chain(finder.closure_call_changes) .collect(); - err.multipart_suggestion_verbose( + err.multipart_suggestion( "try explicitly passing `&Self` into the closure as an argument", sugg, Applicability::MachineApplicable, @@ -3347,7 +3347,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { let addition = format!("let {}binding = {};\n{}", mutability, s, " ".repeat(p)); - err.multipart_suggestion_verbose( + err.multipart_suggestion( msg, vec![ (stmt.span.shrink_to_lo(), addition), diff --git a/compiler/rustc_borrowck/src/diagnostics/mod.rs b/compiler/rustc_borrowck/src/diagnostics/mod.rs index 04bacd049bc97..10dcced2ba7c8 100644 --- a/compiler/rustc_borrowck/src/diagnostics/mod.rs +++ b/compiler/rustc_borrowck/src/diagnostics/mod.rs @@ -1516,11 +1516,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { ) } }; - err.multipart_suggestion_verbose( - msg, - sugg, - Applicability::MaybeIncorrect, - ); + err.multipart_suggestion(msg, sugg, Applicability::MaybeIncorrect); for error in errors { if let FulfillmentErrorCode::Select( SelectionError::Unimplemented, diff --git a/compiler/rustc_borrowck/src/diagnostics/move_errors.rs b/compiler/rustc_borrowck/src/diagnostics/move_errors.rs index 986ade57fb31d..b6e18240cbab1 100644 --- a/compiler/rustc_borrowck/src/diagnostics/move_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/move_errors.rs @@ -375,7 +375,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { .source_map() .indentation_before(stmt.span) .unwrap_or_else(|| " ".to_string()); - err.multipart_suggestion_verbose( + err.multipart_suggestion( "consider cloning the value before moving it into the closure", vec![ ( @@ -405,7 +405,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { .source_map() .indentation_before(closure_expr.span) .unwrap_or_else(|| " ".to_string()); - err.multipart_suggestion_verbose( + err.multipart_suggestion( "consider cloning the value before moving it into the closure", vec![ ( diff --git a/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs b/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs index 96090e85e5622..824125099cfde 100644 --- a/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs @@ -1340,7 +1340,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { return; } - err.multipart_suggestion_verbose( + err.multipart_suggestion( format!( "consider changing this to be a mutable {pointer_desc}{}{extra}", if is_trait_sig { @@ -1365,7 +1365,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { if self.infcx.tcx.sess.source_map().is_imported(span) { return; } - err.multipart_suggestion_verbose( + err.multipart_suggestion( "consider using `get_mut`", vec![(span, suggestion)], Applicability::MaybeIncorrect, diff --git a/compiler/rustc_borrowck/src/diagnostics/region_errors.rs b/compiler/rustc_borrowck/src/diagnostics/region_errors.rs index ca6b9965f1e9e..26ce8f3a130e0 100644 --- a/compiler/rustc_borrowck/src/diagnostics/region_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/region_errors.rs @@ -290,7 +290,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { }); if suggestions.len() > 0 { suggestions.dedup(); - diag.multipart_suggestion_verbose( + diag.multipart_suggestion( inline_fluent!("consider restricting the type parameter to the `'static` lifetime"), suggestions, Applicability::MaybeIncorrect, @@ -902,7 +902,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { spans_suggs.push((alias_span.shrink_to_hi(), "<'a>".to_string())); } - diag.multipart_suggestion_verbose( + diag.multipart_suggestion( format!( "to declare that the trait object {captures}, you can add a lifetime parameter `'a` in the type alias" ), diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs index 087c5e700df07..c8ba7dbec97ca 100644 --- a/compiler/rustc_errors/src/diagnostic.rs +++ b/compiler/rustc_errors/src/diagnostic.rs @@ -838,25 +838,9 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> { } with_fn! { with_multipart_suggestion, - /// Show a suggestion that has multiple parts to it. - /// In other words, multiple changes need to be applied as part of this suggestion. - pub fn multipart_suggestion( - &mut self, - msg: impl Into, - suggestion: Vec<(Span, String)>, - applicability: Applicability, - ) -> &mut Self { - self.multipart_suggestion_with_style( - msg, - suggestion, - applicability, - SuggestionStyle::ShowCode, - ) - } } - /// Show a suggestion that has multiple parts to it, always as its own subdiagnostic. /// In other words, multiple changes need to be applied as part of this suggestion. - pub fn multipart_suggestion_verbose( + pub fn multipart_suggestion( &mut self, msg: impl Into, suggestion: Vec<(Span, String)>, @@ -868,7 +852,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> { applicability, SuggestionStyle::ShowAlways, ) - } + } } /// [`Diag::multipart_suggestion()`] but you can set the [`SuggestionStyle`]. pub fn multipart_suggestion_with_style( diff --git a/compiler/rustc_hir_analysis/src/errors/wrong_number_of_generic_args.rs b/compiler/rustc_hir_analysis/src/errors/wrong_number_of_generic_args.rs index 2b7854769b426..615c0a766a63f 100644 --- a/compiler/rustc_hir_analysis/src/errors/wrong_number_of_generic_args.rs +++ b/compiler/rustc_hir_analysis/src/errors/wrong_number_of_generic_args.rs @@ -1026,7 +1026,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> { .collect::>(); if !suggestions.is_empty() { - err.multipart_suggestion_verbose( + err.multipart_suggestion( format!( "replace the generic bound{s} with the associated type{s}", s = pluralize!(unbound_types.len()) diff --git a/compiler/rustc_hir_analysis/src/hir_ty_lowering/dyn_trait.rs b/compiler/rustc_hir_analysis/src/hir_ty_lowering/dyn_trait.rs index a0b9b60cde5c5..9a95833d2630e 100644 --- a/compiler/rustc_hir_analysis/src/hir_ty_lowering/dyn_trait.rs +++ b/compiler/rustc_hir_analysis/src/hir_ty_lowering/dyn_trait.rs @@ -619,7 +619,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { tcx.node_span_lint(BARE_TRAIT_OBJECTS, hir_id, span, |lint| { lint.primary_message("trait objects without an explicit `dyn` are deprecated"); if span.can_be_used_for_suggestions() { - lint.multipart_suggestion_verbose( + lint.multipart_suggestion( "if this is a dyn-compatible trait, use `dyn`", sugg, Applicability::MachineApplicable, @@ -684,7 +684,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { } else { sugg.push((generics.where_clause_span, format!("<{param}: {}>", rendered_ty))); } - diag.multipart_suggestion_verbose( + diag.multipart_suggestion( "you might be missing a type parameter", sugg, Applicability::MachineApplicable, @@ -795,7 +795,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { } // FIXME: Only emit this suggestion if the trait is dyn-compatible. - diag.multipart_suggestion_verbose( + diag.multipart_suggestion( "you can add the `dyn` keyword if you want a trait object", sugg, Applicability::MachineApplicable, @@ -881,7 +881,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { single underlying type", ); - diag.multipart_suggestion_verbose(msg, impl_sugg, Applicability::MachineApplicable); + diag.multipart_suggestion(msg, impl_sugg, Applicability::MachineApplicable); // Suggest `Box` for return type if is_dyn_compatible { @@ -897,7 +897,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { ] }; - diag.multipart_suggestion_verbose( + diag.multipart_suggestion( "alternatively, you can return an owned trait object", suggestion, Applicability::MachineApplicable, @@ -912,12 +912,12 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { continue; } let sugg = self.add_generic_param_suggestion(generics, span, &trait_name); - diag.multipart_suggestion_verbose( + diag.multipart_suggestion( format!("use a new generic type parameter, constrained by `{trait_name}`"), sugg, Applicability::MachineApplicable, ); - diag.multipart_suggestion_verbose( + diag.multipart_suggestion( "you can also use an opaque type, but users won't be able to specify the type \ parameter when calling the `fn`, having to rely exclusively on type inference", impl_sugg, @@ -941,7 +941,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { } else { vec![(span.shrink_to_lo(), dyn_str.to_string())] }; - diag.multipart_suggestion_verbose( + diag.multipart_suggestion( format!( "alternatively, use a trait object to accept any type that implements \ `{trait_name}`, accessing its methods at runtime using dynamic dispatch", 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 36dae4c2798e9..1be9762d129ff 100644 --- a/compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs +++ b/compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs @@ -528,7 +528,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { } } } - err.multipart_suggestion_verbose( + err.multipart_suggestion( "there is a variant with a similar name", suggestion, Applicability::HasPlaceholders, @@ -1546,7 +1546,7 @@ pub fn prohibit_assoc_item_constraint( (constraint.span.with_lo(constraint.ident.span.hi()), String::new()), ]; - err.multipart_suggestion_verbose( + err.multipart_suggestion( "declare the type parameter right after the `impl` keyword", suggestions, Applicability::MaybeIncorrect, @@ -1721,7 +1721,7 @@ fn generics_args_err_extend<'a>( }, (args_span, String::new()), ]; - err.multipart_suggestion_verbose(msg, suggestion, Applicability::MaybeIncorrect); + err.multipart_suggestion(msg, suggestion, Applicability::MaybeIncorrect); } GenericsArgsErrExtend::DefVariant(segments) => { let args: Vec = segments diff --git a/compiler/rustc_hir_typeck/src/cast.rs b/compiler/rustc_hir_typeck/src/cast.rs index b5094d736dd57..eaa87f1d4cbc6 100644 --- a/compiler/rustc_hir_typeck/src/cast.rs +++ b/compiler/rustc_hir_typeck/src/cast.rs @@ -485,7 +485,7 @@ impl<'a, 'tcx> CastCheck<'tcx> { )); } - err.multipart_suggestion_verbose( + err.multipart_suggestion( "consider borrowing the value", suggestion, Applicability::MachineApplicable, diff --git a/compiler/rustc_hir_typeck/src/demand.rs b/compiler/rustc_hir_typeck/src/demand.rs index 68cbfa7280589..2768023e49b94 100644 --- a/compiler/rustc_hir_typeck/src/demand.rs +++ b/compiler/rustc_hir_typeck/src/demand.rs @@ -888,7 +888,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ]); // We suggest changing the argument from `mut ident: &Ty` to `ident: &'_ mut Ty` and the // assignment from `ident = val;` to `*ident = val;`. - err.multipart_suggestion_verbose( + err.multipart_suggestion( "you might have meant to mutate the pointed at value being passed in, instead of \ changing the reference in the local binding", sugg, diff --git a/compiler/rustc_hir_typeck/src/errors.rs b/compiler/rustc_hir_typeck/src/errors.rs index ad0467ddec966..361642dfbae45 100644 --- a/compiler/rustc_hir_typeck/src/errors.rs +++ b/compiler/rustc_hir_typeck/src/errors.rs @@ -304,7 +304,7 @@ impl Subdiagnostic for SuggestAnnotations { } } - diag.multipart_suggestion_verbose( + diag.multipart_suggestion( "use `()` annotations to avoid fallback changes", suggestions, Applicability::MachineApplicable, diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs index 54d8306936dd6..43695095b8d40 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs @@ -1994,7 +1994,7 @@ impl<'a, 'b, 'tcx> FnCallDiagCtxt<'a, 'b, 'tcx> { ), ); err.code(self.err_code.to_owned()); - err.multipart_suggestion_verbose( + err.multipart_suggestion( "wrap these arguments in parentheses to construct a tuple", vec![ (lo.shrink_to_lo(), "(".to_string()), @@ -2649,7 +2649,7 @@ impl<'a, 'b, 'tcx> FnCallDiagCtxt<'a, 'b, 'tcx> { Some(format!("provide the argument{}", if plural { "s" } else { "" })) } SuggestionText::Remove(plural) => { - err.multipart_suggestion_verbose( + err.multipart_suggestion( format!("remove the extra argument{}", if plural { "s" } else { "" }), suggestions, Applicability::HasPlaceholders, diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs index c703057a30fbf..e7817d0b4db95 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs @@ -156,11 +156,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } }; - err.multipart_suggestion_verbose( - format!("use parentheses to {msg}"), - sugg, - applicability, - ); + err.multipart_suggestion(format!("use parentheses to {msg}"), sugg, applicability); return true; } false @@ -245,7 +241,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } } - err.multipart_suggestion_verbose("use parentheses to call these", sugg, applicability); + err.multipart_suggestion("use parentheses to call these", sugg, applicability); true } else { @@ -298,7 +294,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { self.suggest_deref_or_ref(expr, found, expected) { if verbose { - err.multipart_suggestion_verbose(msg, suggestion, applicability); + err.multipart_suggestion(msg, suggestion, applicability); } else { err.multipart_suggestion(msg, suggestion, applicability); } @@ -1299,7 +1295,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { if !is_in_arm(expr, self.tcx) { suggs.push((span.shrink_to_hi(), ";".to_string())); } - err.multipart_suggestion_verbose( + err.multipart_suggestion( "you might have meant to return this value", suggs, Applicability::MaybeIncorrect, @@ -1611,7 +1607,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { return; } let msg = format!("use `{adt_name}::map_or` to deref inner value of `{adt_name}`"); - err.multipart_suggestion_verbose( + err.multipart_suggestion( msg, vec![ (call_ident.span, "map_or".to_owned()), @@ -1639,7 +1635,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { && snippet.starts_with('{') && snippet.ends_with('}') { - diag.multipart_suggestion_verbose( + diag.multipart_suggestion( "to create an array, use square brackets instead of curly braces", vec![ ( @@ -2604,7 +2600,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { [] => { /* No variants to format */ } [(variant, ctor_kind, field_name, note)] => { // Just a single matching variant. - err.multipart_suggestion_verbose( + err.multipart_suggestion( format!( "try wrapping the expression in `{variant}`{note}", note = note.as_deref().unwrap_or("") @@ -3375,7 +3371,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { )); (msg, suggestion) }; - err.multipart_suggestion_verbose(msg, suggestion, Applicability::MachineApplicable); + err.multipart_suggestion(msg, suggestion, Applicability::MachineApplicable); }; let suggest_to_change_suffix_or_into = @@ -3410,7 +3406,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } else { into_suggestion.clone() }; - err.multipart_suggestion_verbose(msg, suggestion, Applicability::MachineApplicable); + err.multipart_suggestion(msg, suggestion, Applicability::MachineApplicable); }; match (expected_ty.kind(), checked_ty.kind()) { @@ -3464,14 +3460,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { if found.bit_width() < exp.bit_width() { suggest_to_change_suffix_or_into(err, false, true); } else if literal_is_ty_suffixed(expr) { - err.multipart_suggestion_verbose( + err.multipart_suggestion( lit_msg, suffix_suggestion, Applicability::MachineApplicable, ); } else if can_cast { // Missing try_into implementation for `f64` to `f32` - err.multipart_suggestion_verbose( + err.multipart_suggestion( format!("{cast_msg}, producing the closest possible value"), cast_suggestion, Applicability::MaybeIncorrect, // lossy conversion @@ -3481,14 +3477,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } (&ty::Uint(_) | &ty::Int(_), &ty::Float(_)) => { if literal_is_ty_suffixed(expr) { - err.multipart_suggestion_verbose( + err.multipart_suggestion( lit_msg, suffix_suggestion, Applicability::MachineApplicable, ); } else if can_cast { // Missing try_into implementation for `{float}` to `{integer}` - err.multipart_suggestion_verbose( + err.multipart_suggestion( format!("{msg}, rounding the float towards zero"), cast_suggestion, Applicability::MaybeIncorrect, // lossy conversion @@ -3499,7 +3495,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { (ty::Float(exp), ty::Uint(found)) => { // if `found` is `None` (meaning found is `usize`), don't suggest `.into()` if exp.bit_width() > found.bit_width().unwrap_or(256) { - err.multipart_suggestion_verbose( + err.multipart_suggestion( format!( "{msg}, producing the floating point representation of the integer", ), @@ -3507,14 +3503,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { Applicability::MachineApplicable, ); } else if literal_is_ty_suffixed(expr) { - err.multipart_suggestion_verbose( + err.multipart_suggestion( lit_msg, suffix_suggestion, Applicability::MachineApplicable, ); } else { // Missing try_into implementation for `{integer}` to `{float}` - err.multipart_suggestion_verbose( + err.multipart_suggestion( format!( "{cast_msg}, producing the floating point representation of the integer, \ rounded if necessary", @@ -3528,7 +3524,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { (ty::Float(exp), ty::Int(found)) => { // if `found` is `None` (meaning found is `isize`), don't suggest `.into()` if exp.bit_width() > found.bit_width().unwrap_or(256) { - err.multipart_suggestion_verbose( + err.multipart_suggestion( format!( "{}, producing the floating point representation of the integer", msg.clone(), @@ -3537,14 +3533,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { Applicability::MachineApplicable, ); } else if literal_is_ty_suffixed(expr) { - err.multipart_suggestion_verbose( + err.multipart_suggestion( lit_msg, suffix_suggestion, Applicability::MachineApplicable, ); } else { // Missing try_into implementation for `{integer}` to `{float}` - err.multipart_suggestion_verbose( + err.multipart_suggestion( format!( "{}, producing the floating point representation of the integer, \ rounded if necessary", @@ -3561,7 +3557,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { | &ty::Int(ty::IntTy::I32 | ty::IntTy::I64 | ty::IntTy::I128), &ty::Char, ) => { - err.multipart_suggestion_verbose( + err.multipart_suggestion( format!("{cast_msg}, since a `char` always occupies 4 bytes"), cast_suggestion, Applicability::MachineApplicable, diff --git a/compiler/rustc_hir_typeck/src/lib.rs b/compiler/rustc_hir_typeck/src/lib.rs index 8692720529d50..cbc761c80e0ea 100644 --- a/compiler/rustc_hir_typeck/src/lib.rs +++ b/compiler/rustc_hir_typeck/src/lib.rs @@ -452,7 +452,7 @@ fn report_unexpected_variant_res( } } - err.multipart_suggestion_verbose(descr, suggestion, Applicability::HasPlaceholders); + err.multipart_suggestion(descr, suggestion, Applicability::HasPlaceholders); err } Res::Def(DefKind::Variant, _) if expr.is_none() => { diff --git a/compiler/rustc_hir_typeck/src/method/suggest.rs b/compiler/rustc_hir_typeck/src/method/suggest.rs index 517d73f517833..737ba250957d2 100644 --- a/compiler/rustc_hir_typeck/src/method/suggest.rs +++ b/compiler/rustc_hir_typeck/src/method/suggest.rs @@ -854,7 +854,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { { err.span_label(span, format!("`{rcvr_ty}` is not an iterator")); if !span.in_external_macro(self.tcx.sess.source_map()) { - err.multipart_suggestion_verbose( + err.multipart_suggestion( "call `.into_iter()` first", vec![(span.shrink_to_lo(), format!("into_iter()."))], Applicability::MaybeIncorrect, @@ -1581,7 +1581,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } } } - err.multipart_suggestion_verbose( + err.multipart_suggestion( "there is a variant with a similar name", suggestion, Applicability::HasPlaceholders, diff --git a/compiler/rustc_hir_typeck/src/op.rs b/compiler/rustc_hir_typeck/src/op.rs index a175b3557c47a..cb75e8a943b3e 100644 --- a/compiler/rustc_hir_typeck/src/op.rs +++ b/compiler/rustc_hir_typeck/src/op.rs @@ -465,7 +465,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { && lhs_new_mutbl.is_not() && rhs_new_mutbl.is_not() { - err.multipart_suggestion_verbose( + err.multipart_suggestion( "consider reborrowing both sides", vec![ (lhs_expr.span.shrink_to_lo(), "&*".to_string()), @@ -826,7 +826,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { lhs_sugg, (rhs_expr.span.shrink_to_lo(), "&".to_owned()), ]; - err.multipart_suggestion_verbose( + err.multipart_suggestion( sugg_msg, suggestions, Applicability::MachineApplicable, diff --git a/compiler/rustc_hir_typeck/src/pat.rs b/compiler/rustc_hir_typeck/src/pat.rs index 13f87c0923526..8f78faddba0e7 100644 --- a/compiler/rustc_hir_typeck/src/pat.rs +++ b/compiler/rustc_hir_typeck/src/pat.rs @@ -1410,7 +1410,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // Check that there is explicit type (ie this is not a closure param with inferred type) // so we don't suggest moving something to the type that does not exist hir::Node::Param(hir::Param { ty_span, pat, .. }) if pat.span != *ty_span => { - err.multipart_suggestion_verbose( + err.multipart_suggestion( format!("to take parameter `{binding}` by reference, move `&{pin_and_mut}` to the type"), vec![ (pat.span.until(inner.span), "".to_owned()), diff --git a/compiler/rustc_lint/src/default_could_be_derived.rs b/compiler/rustc_lint/src/default_could_be_derived.rs index 8f028b1d96a21..0db2f6a3565c7 100644 --- a/compiler/rustc_lint/src/default_could_be_derived.rs +++ b/compiler/rustc_lint/src/default_could_be_derived.rs @@ -180,7 +180,7 @@ fn mk_lint( if removed_all_fields { let msg = "to avoid divergence in behavior between `Struct { .. }` and \ `::default()`, derive the `Default`"; - diag.multipart_suggestion_verbose( + diag.multipart_suggestion( msg, vec![ (tcx.def_span(type_def_id).shrink_to_lo(), "#[derive(Default)] ".to_string()), diff --git a/compiler/rustc_macros/src/lib.rs b/compiler/rustc_macros/src/lib.rs index 8cd6c02644481..8345a20c5c6f0 100644 --- a/compiler/rustc_macros/src/lib.rs +++ b/compiler/rustc_macros/src/lib.rs @@ -233,7 +233,6 @@ decl_derive!( multipart_suggestion, multipart_suggestion_short, multipart_suggestion_hidden, - multipart_suggestion_verbose, // field attributes skip_arg, primary_span, diff --git a/compiler/rustc_middle/src/ty/diagnostics.rs b/compiler/rustc_middle/src/ty/diagnostics.rs index b3b06314e1a0f..329a7b99e15b7 100644 --- a/compiler/rustc_middle/src/ty/diagnostics.rs +++ b/compiler/rustc_middle/src/ty/diagnostics.rs @@ -572,7 +572,7 @@ pub fn suggest_constraining_type_params<'a>( 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( + err.multipart_suggestion( format!("consider restricting type parameters{post}"), suggestions.into_iter().map(|(span, _, suggestion, _)| (span, suggestion)).collect(), applicability, diff --git a/compiler/rustc_mir_build/src/thir/pattern/migration.rs b/compiler/rustc_mir_build/src/thir/pattern/migration.rs index 095023a471b93..9a5cc08e6c4c5 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/migration.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/migration.rs @@ -129,7 +129,7 @@ impl<'a> PatMigration<'a> { // FIXME(dianne): for peace of mind, don't risk emitting a 0-part suggestion (that panics!) debug_assert!(!self.suggestion.is_empty()); if !self.suggestion.is_empty() { - diag.multipart_suggestion_verbose(msg, self.suggestion, applicability); + diag.multipart_suggestion(msg, self.suggestion, applicability); } } diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs index c7eb1b9b56385..8d6286ae5a8a1 100644 --- a/compiler/rustc_parse/src/parser/diagnostics.rs +++ b/compiler/rustc_parse/src/parser/diagnostics.rs @@ -236,7 +236,7 @@ impl MultiSugg { } fn emit_verbose(self, err: &mut Diag<'_>) { - err.multipart_suggestion_verbose(self.msg, self.patches, self.applicability); + err.multipart_suggestion(self.msg, self.patches, self.applicability); } } @@ -389,7 +389,7 @@ impl<'a> Parser<'a> { && let Ok(snippet) = self.psess.source_map().span_to_snippet(generic.span) { - err.multipart_suggestion_verbose( + err.multipart_suggestion( format!("place the generic parameter name after the {ident_name} name"), vec![ (self.token.span.shrink_to_hi(), snippet), @@ -1056,7 +1056,7 @@ impl<'a> Parser<'a> { // and recover. self.eat_to_tokens(&[exp!(CloseParen), exp!(Comma)]); - err.multipart_suggestion_verbose( + err.multipart_suggestion( "you might have meant to open the body of the closure", vec![ (prev.span.shrink_to_hi(), " {".to_string()), @@ -1069,7 +1069,7 @@ impl<'a> Parser<'a> { _ if token.kind != token::OpenBrace => { // We don't have a heuristic to correctly identify where the block // should be closed. - err.multipart_suggestion_verbose( + err.multipart_suggestion( "you might have meant to open the body of the closure", vec![(prev.span.shrink_to_hi(), " {".to_string())], Applicability::HasPlaceholders, diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index 5c44bfb0cf3f3..8772365ef295b 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -2521,7 +2521,7 @@ impl<'a> Parser<'a> { ret_span, "explicit return type requires closure body to be enclosed in braces", ); - diag.multipart_suggestion_verbose( + diag.multipart_suggestion( "wrap the expression in curly braces", vec![ (expr.span.shrink_to_lo(), "{ ".to_string()), diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index 9a88f74b5b179..695bb06ac723a 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -2377,7 +2377,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { (last_span.shrink_to_hi(), ", ..".to_string()), ] }; - err.multipart_suggestion_verbose( + err.multipart_suggestion( format!( "the type `{ident}` of field `{}` is private, but you can construct \ the default value defined for it in `{}` using `..` in the struct \ diff --git a/compiler/rustc_resolve/src/late.rs b/compiler/rustc_resolve/src/late.rs index fe6346f6c6e92..f46f885579221 100644 --- a/compiler/rustc_resolve/src/late.rs +++ b/compiler/rustc_resolve/src/late.rs @@ -2032,7 +2032,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { if let Some(ty) = &self.diag_metadata.current_self_type && let ControlFlow::Break(sp) = AnonRefFinder.visit_ty(ty) { - err.multipart_suggestion_verbose( + err.multipart_suggestion( "add a lifetime to the impl block and use it in the self type and associated \ type", vec![ @@ -2047,7 +2047,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { && let Some(of_trait) = &impl_.of_trait && let ControlFlow::Break(sp) = AnonRefFinder.visit_trait_ref(&of_trait.trait_ref) { - err.multipart_suggestion_verbose( + err.multipart_suggestion( "add a lifetime to the impl block and use it in the trait and associated type", vec![ (span, "<'a>".to_string()), diff --git a/compiler/rustc_resolve/src/late/diagnostics.rs b/compiler/rustc_resolve/src/late/diagnostics.rs index 95f0d3e67ef2d..70cb42160decf 100644 --- a/compiler/rustc_resolve/src/late/diagnostics.rs +++ b/compiler/rustc_resolve/src/late/diagnostics.rs @@ -1998,7 +1998,7 @@ impl<'ast, 'ra, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> { "}".to_owned(), )); - err.multipart_suggestion_verbose( + err.multipart_suggestion( format!("use struct {descr} syntax instead of calling"), parts, applicability, @@ -2210,7 +2210,7 @@ impl<'ast, 'ra, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> { if non_visible_spans.len() > 0 { if let Some(fields) = self.r.field_visibility_spans.get(&def_id) { - err.multipart_suggestion_verbose( + err.multipart_suggestion( format!( "consider making the field{} publicly accessible", pluralize!(fields.len()) @@ -3309,7 +3309,7 @@ impl<'ast, 'ra, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> { &mut err, Some(lifetime_ref.ident), |err, _, span, message, suggestion, span_suggs| { - err.multipart_suggestion_verbose( + err.multipart_suggestion( message, std::iter::once((span, suggestion)).chain(span_suggs).collect(), Applicability::MaybeIncorrect, @@ -3690,7 +3690,7 @@ impl<'ast, 'ra, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> { err, None, |err, higher_ranked, span, message, intro_sugg, _| { - err.multipart_suggestion_verbose( + err.multipart_suggestion( message, std::iter::once((span, intro_sugg)) .chain(spans_suggs.clone()) @@ -3717,7 +3717,7 @@ impl<'ast, 'ra, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> { } else { String::new() }; - err.multipart_suggestion_verbose( + err.multipart_suggestion( format!("consider using the `{existing_name}` lifetime{post}"), spans_suggs, Applicability::MaybeIncorrect, @@ -3764,7 +3764,7 @@ impl<'ast, 'ra, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> { }; let dotdotdot = if lt.kind == MissingLifetimeKind::Ampersand { "..." } else { "" }; - err.multipart_suggestion_verbose( + err.multipart_suggestion( format!( "instead, you are more likely to want to change {the} \ argument{s} to be borrowed{dotdotdot}", @@ -3819,7 +3819,7 @@ impl<'ast, 'ra, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> { err, None, |err, higher_ranked, span, message, intro_sugg, _| { - err.multipart_suggestion_verbose( + err.multipart_suggestion( message, std::iter::once((span, intro_sugg)) .chain(spans_suggs.clone()) @@ -3932,7 +3932,7 @@ impl<'ast, 'ra, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> { } } if owned_sugg { - err.multipart_suggestion_verbose( + err.multipart_suggestion( format!("{pre} to return an owned value"), sugg, Applicability::MaybeIncorrect, @@ -3949,7 +3949,7 @@ impl<'ast, 'ra, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> { if spans_suggs.len() > 0 { // This happens when we have `Foo` where we point at the space before `T`, // but this can be confusing so we give a suggestion with placeholders. - err.multipart_suggestion_verbose( + err.multipart_suggestion( "consider using one of the available lifetimes here", spans_suggs, Applicability::HasPlaceholders, diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/static_impl_trait.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/static_impl_trait.rs index 3ed1f7c3481f9..b227cd065eab9 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/static_impl_trait.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/static_impl_trait.rs @@ -238,7 +238,7 @@ pub fn suggest_new_region_bound( format!("you can use the named lifetime parameter `{name}`") }; spans_suggs.push((fn_return.span.shrink_to_hi(), format!(" + {name} "))); - err.multipart_suggestion_verbose( + err.multipart_suggestion( format!("{declare} `{ty}` {captures}, {use_lt}"), spans_suggs, Applicability::MaybeIncorrect, diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/region.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/region.rs index 81cca3dd67ac6..db3245f88bf28 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/infer/region.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/infer/region.rs @@ -867,7 +867,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { } if !suggs.is_empty() { - err.multipart_suggestion_verbose( + err.multipart_suggestion( msg, suggs, Applicability::MaybeIncorrect, // Issue #41966 diff --git a/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs b/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs index 63fd61cb257b2..796c5b0143602 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs @@ -558,7 +558,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { if receiver_expr.hir_id == *arg_hir_id ); if is_receiver { - err.multipart_suggestion_verbose( + err.multipart_suggestion( msg, vec![ (span.shrink_to_lo(), format!("({derefs}")), @@ -697,7 +697,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { { let mut suggestion = make_sugg(lhs, lsteps).1; suggestion.append(&mut make_sugg(rhs, rsteps).1); - err.multipart_suggestion_verbose( + err.multipart_suggestion( "consider dereferencing both sides of the expression", suggestion, Applicability::MachineApplicable, @@ -707,21 +707,13 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { && lsteps > 0 { let (msg, suggestion) = make_sugg(lhs, lsteps); - err.multipart_suggestion_verbose( - msg, - suggestion, - Applicability::MachineApplicable, - ); + err.multipart_suggestion(msg, suggestion, Applicability::MachineApplicable); return true; } else if let Some(rsteps) = rsteps && rsteps > 0 { let (msg, suggestion) = make_sugg(rhs, rsteps); - err.multipart_suggestion_verbose( - msg, - suggestion, - Applicability::MachineApplicable, - ); + err.multipart_suggestion(msg, suggestion, Applicability::MachineApplicable); return true; } } @@ -1268,7 +1260,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { }; match (imm_ref_self_ty_satisfies_pred, mut_ref_self_ty_satisfies_pred, mtbl) { (true, _, hir::Mutability::Not) | (_, true, hir::Mutability::Mut) => { - err.multipart_suggestion_verbose( + err.multipart_suggestion( sugg_msg(mtbl.prefix_str()), vec![ (outer.span.shrink_to_lo(), "<".to_string()), @@ -1279,7 +1271,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { } (true, _, hir::Mutability::Mut) => { // There's an associated function found on the immutable borrow of the - err.multipart_suggestion_verbose( + err.multipart_suggestion( sugg_msg("mut "), vec![ (outer.span.shrink_to_lo().until(span), "<&".to_string()), @@ -1289,7 +1281,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { ); } (_, true, hir::Mutability::Not) => { - err.multipart_suggestion_verbose( + err.multipart_suggestion( sugg_msg(""), vec![ (outer.span.shrink_to_lo().until(span), "<&mut ".to_string()), @@ -1608,11 +1600,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { format!("consider removing {count} leading `&`-references") }; - err.multipart_suggestion_verbose( - msg, - suggestions, - Applicability::MachineApplicable, - ); + err.multipart_suggestion(msg, suggestions, Applicability::MachineApplicable); true } else { false @@ -3273,7 +3261,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { (ty.span.shrink_to_hi(), ")".to_string()), ] }; - err.multipart_suggestion_verbose( + err.multipart_suggestion( borrowed_msg, sugg, Applicability::MachineApplicable, @@ -3350,7 +3338,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { "&", Applicability::MachineApplicable, ); - err.multipart_suggestion_verbose( + err.multipart_suggestion( "the `Box` type always has a statically known size and allocates its contents \ in the heap", vec![ @@ -4849,7 +4837,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { suggestions.push((span.shrink_to_lo(), "&".into())); } suggestions.push((span.shrink_to_hi(), "[..]".into())); - err.multipart_suggestion_verbose(msg, suggestions, Applicability::MaybeIncorrect); + err.multipart_suggestion(msg, suggestions, Applicability::MaybeIncorrect); } else { err.span_help(span, msg); } @@ -4884,7 +4872,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { if self.predicate_must_hold_modulo_regions(&obligation) { let arg_span = self.tcx.hir_span(*arg_hir_id); - err.multipart_suggestion_verbose( + err.multipart_suggestion( format!("use a unary tuple instead"), vec![(arg_span.shrink_to_lo(), "(".into()), (arg_span.shrink_to_hi(), ",)".into())], Applicability::MaybeIncorrect, @@ -5178,7 +5166,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { ), )); } - err.multipart_suggestion_verbose( + err.multipart_suggestion( format!("consider adding return type"), sugg_spans, Applicability::MaybeIncorrect, @@ -5268,7 +5256,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { suggs.push((span, suggestion)); } - err.multipart_suggestion_verbose( + err.multipart_suggestion( "consider relaxing the implicit `Sized` restriction", suggs, Applicability::MachineApplicable, diff --git a/compiler/rustc_trait_selection/src/errors.rs b/compiler/rustc_trait_selection/src/errors.rs index 0b19a470b726e..3a3268efbc774 100644 --- a/compiler/rustc_trait_selection/src/errors.rs +++ b/compiler/rustc_trait_selection/src/errors.rs @@ -154,7 +154,7 @@ impl Subdiagnostic for AdjustSignatureBorrow { match self { AdjustSignatureBorrow::Borrow { to_borrow } => { diag.arg("borrow_len", to_borrow.len()); - diag.multipart_suggestion_verbose( + diag.multipart_suggestion( inline_fluent!( "consider adjusting the signature so it borrows its {$borrow_len -> [one] argument @@ -167,7 +167,7 @@ impl Subdiagnostic for AdjustSignatureBorrow { } AdjustSignatureBorrow::RemoveBorrow { remove_borrow } => { diag.arg("remove_borrow_len", remove_borrow.len()); - diag.multipart_suggestion_verbose( + diag.multipart_suggestion( inline_fluent!( "consider adjusting the signature so it does not borrow its {$remove_borrow_len -> [one] argument @@ -786,7 +786,7 @@ impl Subdiagnostic for AddLifetimeParamsSuggestion<'_> { visitor.suggestions.push(new_param_suggestion); } - diag.multipart_suggestion_verbose( + diag.multipart_suggestion( inline_fluent!( "consider {$is_reuse -> [true] reusing @@ -2027,7 +2027,7 @@ pub struct AddPreciseCapturingAndParams { impl Subdiagnostic for AddPreciseCapturingAndParams { fn add_to_diag(self, diag: &mut Diag<'_, G>) { diag.arg("new_lifetime", self.new_lifetime); - diag.multipart_suggestion_verbose( + diag.multipart_suggestion( inline_fluent!("add a `use<...>` bound to explicitly capture `{$new_lifetime}` after turning all argument-position `impl Trait` into type parameters, noting that this possibly affects the API of this crate"), self.suggs, Applicability::MaybeIncorrect, @@ -2174,7 +2174,7 @@ impl Subdiagnostic for AddPreciseCapturingForOvercapture { // not intended. Applicability::MaybeIncorrect }; - diag.multipart_suggestion_verbose( + diag.multipart_suggestion( inline_fluent!( "use the precise capturing `use<...>` syntax to make the captures explicit" ), diff --git a/src/tools/clippy/clippy_lints/src/create_dir.rs b/src/tools/clippy/clippy_lints/src/create_dir.rs index 695b25aeb0b7d..f68c0b3a1ddc7 100644 --- a/src/tools/clippy/clippy_lints/src/create_dir.rs +++ b/src/tools/clippy/clippy_lints/src/create_dir.rs @@ -51,7 +51,7 @@ impl LateLintPass<'_> for CreateDir { suggestions.push((path.span.shrink_to_lo(), "std::fs::".to_owned())); } - diag.multipart_suggestion_verbose( + diag.multipart_suggestion( "consider calling `std::fs::create_dir_all` instead", suggestions, Applicability::MaybeIncorrect, diff --git a/src/tools/clippy/clippy_lints/src/duration_suboptimal_units.rs b/src/tools/clippy/clippy_lints/src/duration_suboptimal_units.rs index 8140585b70d33..eaf5d05bba042 100644 --- a/src/tools/clippy/clippy_lints/src/duration_suboptimal_units.rs +++ b/src/tools/clippy/clippy_lints/src/duration_suboptimal_units.rs @@ -97,7 +97,7 @@ impl LateLintPass<'_> for DurationSuboptimalUnits { (func_name.ident.span, promoted_constructor.to_string()), (arg.span, promoted_value.to_string()), ]; - diag.multipart_suggestion_verbose( + diag.multipart_suggestion( format!("try using {promoted_constructor}"), suggestions, Applicability::MachineApplicable, diff --git a/src/tools/clippy/clippy_lints/src/empty_line_after.rs b/src/tools/clippy/clippy_lints/src/empty_line_after.rs index 76e67b1154be1..12dcf9252f73f 100644 --- a/src/tools/clippy/clippy_lints/src/empty_line_after.rs +++ b/src/tools/clippy/clippy_lints/src/empty_line_after.rs @@ -367,7 +367,7 @@ impl EmptyLineAfter { Some(name) => format!("{} `{name}`", info.kind).into(), None => Cow::from("the following item"), }; - diag.multipart_suggestion_verbose( + diag.multipart_suggestion( format!("if the doc comment should not document {name} then comment it out"), suggestions, Applicability::MaybeIncorrect, @@ -384,7 +384,7 @@ impl EmptyLineAfter { // Commentless empty gaps between line doc comments, possibly intended to be part of the markdown let indent = snippet_indent(cx, first_gap.prev_stop.span).unwrap_or_default(); - diag.multipart_suggestion_verbose( + diag.multipart_suggestion( format!("if the documentation should include the empty {lines} include {them} in the comment"), empty_lines() .map(|empty_line| (empty_line, format!("{indent}///"))) @@ -414,7 +414,7 @@ impl EmptyLineAfter { } else { parent.kind }; - diag.multipart_suggestion_verbose( + diag.multipart_suggestion( match kind { StopKind::Attr => format!("if the attribute should apply to the {desc} use an inner attribute"), StopKind::Doc(_) => format!("if the comment should document the {desc} use an inner doc comment"), diff --git a/src/tools/clippy/clippy_lints/src/loops/never_loop.rs b/src/tools/clippy/clippy_lints/src/loops/never_loop.rs index e7b9b1cd38819..b5551264bd0dd 100644 --- a/src/tools/clippy/clippy_lints/src/loops/never_loop.rs +++ b/src/tools/clippy/clippy_lints/src/loops/never_loop.rs @@ -55,7 +55,7 @@ pub(super) fn check<'tcx>( )]; // Make sure to clear up the diverging sites when we remove a loopp. suggestions.extend(break_spans.iter().map(|span| (*span, String::new()))); - diag.multipart_suggestion_verbose( + diag.multipart_suggestion( "if you need the first element of the iterator, try writing", suggestions, app, diff --git a/src/tools/clippy/clippy_lints/src/matches/match_same_arms.rs b/src/tools/clippy/clippy_lints/src/matches/match_same_arms.rs index c20217563d62b..5b0de80e67fd7 100644 --- a/src/tools/clippy/clippy_lints/src/matches/match_same_arms.rs +++ b/src/tools/clippy/clippy_lints/src/matches/match_same_arms.rs @@ -129,7 +129,7 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, arms: &'tcx [Arm<'_>]) { diag.span_label(last.span, "the wildcard arm"); let s = if prev.len() > 1 { "s" } else { "" }; - diag.multipart_suggestion_verbose( + diag.multipart_suggestion( format!("otherwise remove the non-wildcard arm{s}"), prev.iter() .map(|(_, arm)| (adjusted_arm_span(cx, arm.span), String::new())) @@ -158,7 +158,7 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, arms: &'tcx [Arm<'_>]) { .chain([(dest.pat.span, pat_snippets.iter().join(" | "))]) .collect_vec(); - diag.multipart_suggestion_verbose( + diag.multipart_suggestion( "otherwise merge the patterns into a single arm", suggs, Applicability::MaybeIncorrect, diff --git a/src/tools/clippy/clippy_lints/src/matches/redundant_guards.rs b/src/tools/clippy/clippy_lints/src/matches/redundant_guards.rs index 757ecf75ed45e..fa8b6a65a2038 100644 --- a/src/tools/clippy/clippy_lints/src/matches/redundant_guards.rs +++ b/src/tools/clippy/clippy_lints/src/matches/redundant_guards.rs @@ -226,7 +226,7 @@ fn emit_redundant_guards<'tcx>( } => (span.shrink_to_hi(), format!(": {binding_replacement}")), PatBindingInfo { span, .. } => (span, binding_replacement.into_owned()), }; - diag.multipart_suggestion_verbose( + diag.multipart_suggestion( "try", vec![ suggestion_span, diff --git a/src/tools/clippy/clippy_lints/src/methods/io_other_error.rs b/src/tools/clippy/clippy_lints/src/methods/io_other_error.rs index b081e804859a5..d9735f2941409 100644 --- a/src/tools/clippy/clippy_lints/src/methods/io_other_error.rs +++ b/src/tools/clippy/clippy_lints/src/methods/io_other_error.rs @@ -24,7 +24,7 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, path: &Expr<'_>, args expr.span, "this can be `std::io::Error::other(_)`", |diag| { - diag.multipart_suggestion_verbose( + diag.multipart_suggestion( "use `std::io::Error::other`", vec![ (new_segment.ident.span, "other".to_owned()), diff --git a/src/tools/clippy/clippy_lints/src/methods/ip_constant.rs b/src/tools/clippy/clippy_lints/src/methods/ip_constant.rs index d5e4dac5e4526..7c24cf03fd976 100644 --- a/src/tools/clippy/clippy_lints/src/methods/ip_constant.rs +++ b/src/tools/clippy/clippy_lints/src/methods/ip_constant.rs @@ -45,7 +45,7 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, func: &Expr<'_>, args } span_lint_and_then(cx, IP_CONSTANT, expr.span, "hand-coded well-known IP address", |diag| { - diag.multipart_suggestion_verbose("use", sugg, Applicability::MachineApplicable); + diag.multipart_suggestion("use", sugg, Applicability::MachineApplicable); }); } } diff --git a/src/tools/clippy/clippy_lints/src/methods/suspicious_command_arg_space.rs b/src/tools/clippy/clippy_lints/src/methods/suspicious_command_arg_space.rs index 3e9c677fe34a2..be733c5d35147 100644 --- a/src/tools/clippy/clippy_lints/src/methods/suspicious_command_arg_space.rs +++ b/src/tools/clippy/clippy_lints/src/methods/suspicious_command_arg_space.rs @@ -23,7 +23,7 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, recv: &'tcx hir::Expr<'_>, arg arg.span, "single argument that looks like it should be multiple arguments", |diag: &mut Diag<'_, ()>| { - diag.multipart_suggestion_verbose( + diag.multipart_suggestion( "consider splitting the argument", vec![(span, "args".to_string()), (arg.span, format!("[{arg1:?}, {arg2:?}]"))], Applicability::MaybeIncorrect, diff --git a/src/tools/clippy/clippy_lints/src/methods/unnecessary_map_or.rs b/src/tools/clippy/clippy_lints/src/methods/unnecessary_map_or.rs index 21e112360aafa..b9af391843876 100644 --- a/src/tools/clippy/clippy_lints/src/methods/unnecessary_map_or.rs +++ b/src/tools/clippy/clippy_lints/src/methods/unnecessary_map_or.rs @@ -154,7 +154,7 @@ pub(super) fn check<'a>( expr.span, "this `map_or` can be simplified", |diag| { - diag.multipart_suggestion_verbose(format!("use {method} instead"), sugg, applicability); + diag.multipart_suggestion(format!("use {method} instead"), sugg, applicability); }, ); } diff --git a/src/tools/clippy/clippy_lints/src/needless_arbitrary_self_type.rs b/src/tools/clippy/clippy_lints/src/needless_arbitrary_self_type.rs index 691d9035d02c5..0d9e0bcff48e0 100644 --- a/src/tools/clippy/clippy_lints/src/needless_arbitrary_self_type.rs +++ b/src/tools/clippy/clippy_lints/src/needless_arbitrary_self_type.rs @@ -117,7 +117,7 @@ impl EarlyLintPass for NeedlessArbitrarySelfType { if !add.is_empty() { sugg.push((p.span.shrink_to_lo(), add)); } - diag.multipart_suggestion_verbose("remove the type", sugg, applicability); + diag.multipart_suggestion("remove the type", sugg, applicability); }, ); } diff --git a/src/tools/clippy/clippy_lints/src/raw_strings.rs b/src/tools/clippy/clippy_lints/src/raw_strings.rs index 943e662479e9f..63b9a38eef1e8 100644 --- a/src/tools/clippy/clippy_lints/src/raw_strings.rs +++ b/src/tools/clippy/clippy_lints/src/raw_strings.rs @@ -123,7 +123,7 @@ impl RawStrings { remove.push((end, String::new())); } - diag.multipart_suggestion_verbose( + diag.multipart_suggestion( format!("use a plain {descr} literal instead"), remove, Applicability::MachineApplicable, diff --git a/src/tools/clippy/clippy_lints/src/returns/needless_return.rs b/src/tools/clippy/clippy_lints/src/returns/needless_return.rs index 7d836b610e5f8..04e4f379e37c1 100644 --- a/src/tools/clippy/clippy_lints/src/returns/needless_return.rs +++ b/src/tools/clippy/clippy_lints/src/returns/needless_return.rs @@ -251,7 +251,7 @@ fn emit_return_lint( .chain(semi_spans.into_iter().map(|span| (span, String::new()))) .collect(); - diag.multipart_suggestion_verbose(replacement.sugg_help(), suggestions, replacement.applicability()); + diag.multipart_suggestion(replacement.sugg_help(), suggestions, replacement.applicability()); }, ); } diff --git a/src/tools/clippy/clippy_lints/src/significant_drop_tightening.rs b/src/tools/clippy/clippy_lints/src/significant_drop_tightening.rs index 8557e8d18d10a..c2c1778882d3a 100644 --- a/src/tools/clippy/clippy_lints/src/significant_drop_tightening.rs +++ b/src/tools/clippy/clippy_lints/src/significant_drop_tightening.rs @@ -104,7 +104,7 @@ impl<'tcx> LateLintPass<'tcx> for SignificantDropTightening<'tcx> { format!("\n{indent}{init_method}.{usage_method};") }; - diag.multipart_suggestion_verbose( + diag.multipart_suggestion( "merge the temporary construction with its single usage", vec![(apa.first_stmt_span, stmt), (apa.last_stmt_span, String::new())], Applicability::MaybeIncorrect, diff --git a/src/tools/clippy/clippy_lints/src/unit_types/let_unit_value.rs b/src/tools/clippy/clippy_lints/src/unit_types/let_unit_value.rs index 2645e94358e11..2a23e5329e9e1 100644 --- a/src/tools/clippy/clippy_lints/src/unit_types/let_unit_value.rs +++ b/src/tools/clippy/clippy_lints/src/unit_types/let_unit_value.rs @@ -118,7 +118,7 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, format_args: &FormatArgsStorag init_new_span.shrink_to_lo(), format!("();\n{}", snippet_indent(cx, local.span).as_deref().unwrap_or("")), )); - diag.multipart_suggestion_verbose("replace variable usages with `()`", suggestions, app); + diag.multipart_suggestion("replace variable usages with `()`", suggestions, app); return; } } @@ -131,7 +131,7 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, format_args: &FormatArgsStorag } else { "omit the `let` binding and replace variable usages with `()`" }; - diag.multipart_suggestion_verbose(message, suggestions, app); + diag.multipart_suggestion(message, suggestions, app); }, ); } diff --git a/src/tools/clippy/clippy_lints_internal/src/repeated_is_diagnostic_item.rs b/src/tools/clippy/clippy_lints_internal/src/repeated_is_diagnostic_item.rs index 55fb78b1e296f..8644ea1fc9071 100644 --- a/src/tools/clippy/clippy_lints_internal/src/repeated_is_diagnostic_item.rs +++ b/src/tools/clippy/clippy_lints_internal/src/repeated_is_diagnostic_item.rs @@ -190,7 +190,7 @@ impl<'tcx> LateLintPass<'tcx> for RepeatedIsDiagnosticItem { })) .collect(); - diag.multipart_suggestion_verbose( + diag.multipart_suggestion( format!("call `{recv_ty}::opt_diag_name`, and reuse the results"), sugg, app, @@ -234,7 +234,7 @@ impl<'tcx> LateLintPass<'tcx> for RepeatedIsDiagnosticItem { })) .collect(); - diag.multipart_suggestion_verbose( + diag.multipart_suggestion( "call `TyCtxt::get_diagnostic_name`, and reuse the results", sugg, app, @@ -437,7 +437,7 @@ fn check_if_chains<'tcx>(cx: &LateContext<'tcx>, expr: &Expr<'_>, conds: Vec<&'t })) .collect(); - diag.multipart_suggestion_verbose( + diag.multipart_suggestion( format!("call `{recv_ty}::opt_diag_name`, and reuse the results"), sugg, app, @@ -489,7 +489,7 @@ fn check_if_chains<'tcx>(cx: &LateContext<'tcx>, expr: &Expr<'_>, conds: Vec<&'t })) .collect(); - diag.multipart_suggestion_verbose( + diag.multipart_suggestion( "call `TyCtxt::get_diagnostic_name`, and reuse the results", sugg, app, diff --git a/tests/ui/associated-inherent-types/type-alias-bounds.stderr b/tests/ui/associated-inherent-types/type-alias-bounds.stderr index c56dd498f7708..7a74f7bb18fc8 100644 --- a/tests/ui/associated-inherent-types/type-alias-bounds.stderr +++ b/tests/ui/associated-inherent-types/type-alias-bounds.stderr @@ -2,15 +2,17 @@ warning: bounds on generic parameters in type aliases are not enforced --> $DIR/type-alias-bounds.rs:21:19 | LL | pub type Alias = (Source::Assoc,); - | --^^^^^ - | | | - | | will not be checked at usage sites of the type alias - | help: remove this bound + | ^^^^^ will not be checked at usage sites of the type alias | = note: this is a known limitation of the type checker that may be lifted in a future edition. see issue #112792 for more information = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics = note: `#[warn(type_alias_bounds)]` on by default +help: remove this bound + | +LL - pub type Alias = (Source::Assoc,); +LL + pub type Alias = (Source::Assoc,); + | warning: 1 warning emitted diff --git a/tests/ui/associated-type-bounds/overlaping-bound-suggestion.stderr b/tests/ui/associated-type-bounds/overlaping-bound-suggestion.stderr index 54bcef4557463..e83376a75e321 100644 --- a/tests/ui/associated-type-bounds/overlaping-bound-suggestion.stderr +++ b/tests/ui/associated-type-bounds/overlaping-bound-suggestion.stderr @@ -2,7 +2,12 @@ error[E0191]: the value of the associated types `Item` and `IntoIter` in `IntoIt --> $DIR/overlaping-bound-suggestion.rs:7:13 | LL | inner: >::IntoIterator as Item>::Core, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: specify the associated types: `IntoIterator, Item = /* Type */, IntoIter = /* Type */>` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: specify the associated types + | +LL | inner: , Item = /* Type */, IntoIter = /* Type */>::IntoIterator as Item>::Core, + | ++++++++++++++++++++++++++++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/associated-type-bounds/type-alias.stderr b/tests/ui/associated-type-bounds/type-alias.stderr index d59952b4a146a..3e9b593a6b9e6 100644 --- a/tests/ui/associated-type-bounds/type-alias.stderr +++ b/tests/ui/associated-type-bounds/type-alias.stderr @@ -2,158 +2,182 @@ warning: where clauses on type aliases are not enforced --> $DIR/type-alias.rs:3:25 | LL | type _TaWhere1 where T: Iterator = T; - | ------^^^^^^^^^^^^^^^^^^^^^^^ - | | | - | | will not be checked at usage sites of the type alias - | help: remove this where clause + | ^^^^^^^^^^^^^^^^^^^^^^^ will not be checked at usage sites of the type alias | = note: this is a known limitation of the type checker that may be lifted in a future edition. see issue #112792 for more information = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics = note: `#[warn(type_alias_bounds)]` on by default +help: remove this where clause + | +LL - type _TaWhere1 where T: Iterator = T; +LL + type _TaWhere1 = T; + | warning: where clauses on type aliases are not enforced --> $DIR/type-alias.rs:4:25 | LL | type _TaWhere2 where T: Iterator = T; - | ------^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | | - | | will not be checked at usage sites of the type alias - | help: remove this where clause + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ will not be checked at usage sites of the type alias | = note: this is a known limitation of the type checker that may be lifted in a future edition. see issue #112792 for more information = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics +help: remove this where clause + | +LL - type _TaWhere2 where T: Iterator = T; +LL + type _TaWhere2 = T; + | warning: where clauses on type aliases are not enforced --> $DIR/type-alias.rs:5:25 | LL | type _TaWhere3 where T: Iterator = T; - | ------^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | | - | | will not be checked at usage sites of the type alias - | help: remove this where clause + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ will not be checked at usage sites of the type alias | = note: this is a known limitation of the type checker that may be lifted in a future edition. see issue #112792 for more information = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics +help: remove this where clause + | +LL - type _TaWhere3 where T: Iterator = T; +LL + type _TaWhere3 = T; + | warning: where clauses on type aliases are not enforced --> $DIR/type-alias.rs:6:25 | LL | type _TaWhere4 where T: Iterator = T; - | ------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | | - | | will not be checked at usage sites of the type alias - | help: remove this where clause + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ will not be checked at usage sites of the type alias | = note: this is a known limitation of the type checker that may be lifted in a future edition. see issue #112792 for more information = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics +help: remove this where clause + | +LL - type _TaWhere4 where T: Iterator = T; +LL + type _TaWhere4 = T; + | warning: where clauses on type aliases are not enforced --> $DIR/type-alias.rs:7:25 | LL | type _TaWhere5 where T: Iterator Into<&'a u8>> = T; - | ------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | | - | | will not be checked at usage sites of the type alias - | help: remove this where clause + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ will not be checked at usage sites of the type alias | = note: this is a known limitation of the type checker that may be lifted in a future edition. see issue #112792 for more information = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics +help: remove this where clause + | +LL - type _TaWhere5 where T: Iterator Into<&'a u8>> = T; +LL + type _TaWhere5 = T; + | warning: where clauses on type aliases are not enforced --> $DIR/type-alias.rs:8:25 | LL | type _TaWhere6 where T: Iterator> = T; - | ------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | | - | | will not be checked at usage sites of the type alias - | help: remove this where clause + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ will not be checked at usage sites of the type alias | = note: this is a known limitation of the type checker that may be lifted in a future edition. see issue #112792 for more information = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics +help: remove this where clause + | +LL - type _TaWhere6 where T: Iterator> = T; +LL + type _TaWhere6 = T; + | warning: bounds on generic parameters in type aliases are not enforced --> $DIR/type-alias.rs:10:20 | LL | type _TaInline1> = T; - | --^^^^^^^^^^^^^^^^^^^^ - | | | - | | will not be checked at usage sites of the type alias - | help: remove this bound + | ^^^^^^^^^^^^^^^^^^^^ will not be checked at usage sites of the type alias | = note: this is a known limitation of the type checker that may be lifted in a future edition. see issue #112792 for more information = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics +help: remove this bound + | +LL - type _TaInline1> = T; +LL + type _TaInline1 = T; + | warning: bounds on generic parameters in type aliases are not enforced --> $DIR/type-alias.rs:11:20 | LL | type _TaInline2> = T; - | --^^^^^^^^^^^^^^^^^^^^^^^ - | | | - | | will not be checked at usage sites of the type alias - | help: remove this bound + | ^^^^^^^^^^^^^^^^^^^^^^^ will not be checked at usage sites of the type alias | = note: this is a known limitation of the type checker that may be lifted in a future edition. see issue #112792 for more information = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics +help: remove this bound + | +LL - type _TaInline2> = T; +LL + type _TaInline2 = T; + | warning: bounds on generic parameters in type aliases are not enforced --> $DIR/type-alias.rs:12:20 | LL | type _TaInline3> = T; - | --^^^^^^^^^^^^^^^^^^^^^^^ - | | | - | | will not be checked at usage sites of the type alias - | help: remove this bound + | ^^^^^^^^^^^^^^^^^^^^^^^ will not be checked at usage sites of the type alias | = note: this is a known limitation of the type checker that may be lifted in a future edition. see issue #112792 for more information = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics +help: remove this bound + | +LL - type _TaInline3> = T; +LL + type _TaInline3 = T; + | warning: bounds on generic parameters in type aliases are not enforced --> $DIR/type-alias.rs:13:20 | LL | type _TaInline4> = T; - | --^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | | - | | will not be checked at usage sites of the type alias - | help: remove this bound + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ will not be checked at usage sites of the type alias | = note: this is a known limitation of the type checker that may be lifted in a future edition. see issue #112792 for more information = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics +help: remove this bound + | +LL - type _TaInline4> = T; +LL + type _TaInline4 = T; + | warning: bounds on generic parameters in type aliases are not enforced --> $DIR/type-alias.rs:14:20 | LL | type _TaInline5 Into<&'a u8>>> = T; - | --^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | | - | | will not be checked at usage sites of the type alias - | help: remove this bound + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ will not be checked at usage sites of the type alias | = note: this is a known limitation of the type checker that may be lifted in a future edition. see issue #112792 for more information = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics +help: remove this bound + | +LL - type _TaInline5 Into<&'a u8>>> = T; +LL + type _TaInline5 = T; + | warning: bounds on generic parameters in type aliases are not enforced --> $DIR/type-alias.rs:15:20 | LL | type _TaInline6>> = T; - | --^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | | - | | will not be checked at usage sites of the type alias - | help: remove this bound + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ will not be checked at usage sites of the type alias | = note: this is a known limitation of the type checker that may be lifted in a future edition. see issue #112792 for more information = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics +help: remove this bound + | +LL - type _TaInline6>> = T; +LL + type _TaInline6 = T; + | warning: 12 warnings emitted diff --git a/tests/ui/associated-types/associated-types-incomplete-object.stderr b/tests/ui/associated-types/associated-types-incomplete-object.stderr index 52aa6adc4695c..c90259d0e1fc2 100644 --- a/tests/ui/associated-types/associated-types-incomplete-object.stderr +++ b/tests/ui/associated-types/associated-types-incomplete-object.stderr @@ -5,7 +5,12 @@ LL | type B; | ------ `B` defined here ... LL | let b = &42isize as &dyn Foo; - | ^^^^^^^^^^^^ help: specify the associated type: `Foo` + | ^^^^^^^^^^^^ + | +help: specify the associated type + | +LL | let b = &42isize as &dyn Foo; + | ++++++++++++++++ error[E0191]: the value of the associated type `A` in `Foo` must be specified --> $DIR/associated-types-incomplete-object.rs:26:30 @@ -14,7 +19,12 @@ LL | type A; | ------ `A` defined here ... LL | let c = &42isize as &dyn Foo; - | ^^^^^^^^^^^ help: specify the associated type: `Foo` + | ^^^^^^^^^^^ + | +help: specify the associated type + | +LL | let c = &42isize as &dyn Foo; + | ++++++++++++++++ error[E0191]: the value of the associated types `A` and `B` in `Foo` must be specified --> $DIR/associated-types-incomplete-object.rs:29:30 @@ -25,7 +35,12 @@ LL | type B; | ------ `B` defined here ... LL | let d = &42isize as &dyn Foo; - | ^^^ help: specify the associated types: `Foo` + | ^^^ + | +help: specify the associated types + | +LL | let d = &42isize as &dyn Foo; + | ++++++++++++++++++++++++++++++++ error: aborting due to 3 previous errors diff --git a/tests/ui/associated-types/issue-23595-1.stderr b/tests/ui/associated-types/issue-23595-1.stderr index 8083355deb766..11f6889702cc9 100644 --- a/tests/ui/associated-types/issue-23595-1.stderr +++ b/tests/ui/associated-types/issue-23595-1.stderr @@ -6,7 +6,12 @@ LL | type Value; LL | type ChildKey; | ------------- `ChildKey` defined here LL | type Children = dyn Index; - | ------------- `Children` defined here ^^^^^^^^^ help: specify the associated types: `Hierarchy` + | ------------- `Children` defined here ^^^^^^^^^ + | +help: specify the associated types + | +LL | type Children = dyn Index>; + | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/associated-types/tuple-struct-expr-pat.stderr b/tests/ui/associated-types/tuple-struct-expr-pat.stderr index 135dfcb3447e5..b6ceaae362654 100644 --- a/tests/ui/associated-types/tuple-struct-expr-pat.stderr +++ b/tests/ui/associated-types/tuple-struct-expr-pat.stderr @@ -2,17 +2,27 @@ error[E0575]: expected method or associated constant, found associated type `Tra --> $DIR/tuple-struct-expr-pat.rs:10:36 | LL | let as Trait>::Assoc() = as Trait>::Assoc(); - | ^^^^^^^^^^^^^^^^^^^^^^-- help: use struct expression instead: `{}` + | ^^^^^^^^^^^^^^^^^^^^^^ | = note: can't use a type alias as a constructor +help: use struct expression instead + | +LL - let as Trait>::Assoc() = as Trait>::Assoc(); +LL + let as Trait>::Assoc() = as Trait>::Assoc {}; + | error[E0575]: expected tuple struct or tuple variant, found associated type `Trait::Assoc` --> $DIR/tuple-struct-expr-pat.rs:10:9 | LL | let as Trait>::Assoc() = as Trait>::Assoc(); - | ^^^^^^^^^^^^^^^^^^^^^^-- help: use struct pattern instead: `{}` + | ^^^^^^^^^^^^^^^^^^^^^^ | = note: can't use a type alias as tuple pattern +help: use struct pattern instead + | +LL - let as Trait>::Assoc() = as Trait>::Assoc(); +LL + let as Trait>::Assoc {} = as Trait>::Assoc(); + | error[E0575]: expected method or associated constant, found associated type `Trait::Assoc` --> $DIR/tuple-struct-expr-pat.rs:13:38 diff --git a/tests/ui/borrowck/issue-109271-pass-self-into-closure.stderr b/tests/ui/borrowck/issue-109271-pass-self-into-closure.stderr index aa4e5fb2f6918..304f2072d3b5f 100644 --- a/tests/ui/borrowck/issue-109271-pass-self-into-closure.stderr +++ b/tests/ui/borrowck/issue-109271-pass-self-into-closure.stderr @@ -5,10 +5,15 @@ LL | v.call(|(), this: &mut S| v.get()); | ^^----^------------------^-^^^^^^^ | | | | | | | | | first borrow occurs due to use of `v` in closure - | | | | help: try using the closure argument: `this` | | | immutable borrow occurs here | | immutable borrow later used by call | mutable borrow occurs here + | +help: try using the closure argument + | +LL - v.call(|(), this: &mut S| v.get()); +LL + v.call(|(), this: &mut S| this.get()); + | error[E0499]: cannot borrow `v` as mutable more than once at a time --> $DIR/issue-109271-pass-self-into-closure.rs:21:5 @@ -17,10 +22,15 @@ LL | v.call(|(), this: &mut S| v.set()); | ^^----^------------------^-^^^^^^^ | | | | | | | | | first borrow occurs due to use of `v` in closure - | | | | help: try using the closure argument: `this` | | | first mutable borrow occurs here | | first borrow later used by call | second mutable borrow occurs here + | +help: try using the closure argument + | +LL - v.call(|(), this: &mut S| v.set()); +LL + v.call(|(), this: &mut S| this.set()); + | error[E0499]: cannot borrow `v` as mutable more than once at a time --> $DIR/issue-109271-pass-self-into-closure.rs:21:12 diff --git a/tests/ui/const-generics/associated-const-bindings/dyn-compat-const-projection-from-supertrait-mentions-self.stderr b/tests/ui/const-generics/associated-const-bindings/dyn-compat-const-projection-from-supertrait-mentions-self.stderr index dae9e3d8c22bf..de4e9dc61aa4e 100644 --- a/tests/ui/const-generics/associated-const-bindings/dyn-compat-const-projection-from-supertrait-mentions-self.stderr +++ b/tests/ui/const-generics/associated-const-bindings/dyn-compat-const-projection-from-supertrait-mentions-self.stderr @@ -5,7 +5,12 @@ LL | type const K: usize; | ------------------- `K` defined here ... LL | let _: dyn X; - | ^^^^^^^^^ help: specify the associated constant: `X` + | ^^^^^^^^^ + | +help: specify the associated constant + | +LL | let _: dyn X; + | +++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/associated-const-bindings/dyn-compat-unspecified-assoc-consts.stderr b/tests/ui/const-generics/associated-const-bindings/dyn-compat-unspecified-assoc-consts.stderr index 35fdd7f2751e5..d9ddea7a2524d 100644 --- a/tests/ui/const-generics/associated-const-bindings/dyn-compat-unspecified-assoc-consts.stderr +++ b/tests/ui/const-generics/associated-const-bindings/dyn-compat-unspecified-assoc-consts.stderr @@ -5,7 +5,12 @@ LL | type const K: usize; | ------------------- `K` defined here ... LL | struct Store(dyn Trait); - | ^^^^^ help: specify the associated constant: `Trait` + | ^^^^^ + | +help: specify the associated constant + | +LL | struct Store(dyn Trait); + | +++++++++++++++++ error[E0191]: the value of the associated constant `K` in `Trait` must be specified --> $DIR/dyn-compat-unspecified-assoc-consts.rs:23:21 @@ -14,7 +19,12 @@ LL | type const K: usize; | ------------------- `K` defined here ... LL | type DynTrait = dyn Trait; - | ^^^^^ help: specify the associated constant: `Trait` + | ^^^^^ + | +help: specify the associated constant + | +LL | type DynTrait = dyn Trait; + | +++++++++++++++++ error[E0191]: the value of the associated constant `K` in `Trait` must be specified --> $DIR/dyn-compat-unspecified-assoc-consts.rs:14:16 @@ -23,7 +33,12 @@ LL | type const K: usize; | ------------------- `K` defined here ... LL | let _: dyn Trait; - | ^^^^^ help: specify the associated constant: `Trait` + | ^^^^^ + | +help: specify the associated constant + | +LL | let _: dyn Trait; + | +++++++++++++++++ error: aborting due to 3 previous errors diff --git a/tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.stderr b/tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.stderr index b547bdd7d07a4..4fab35591ef43 100644 --- a/tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.stderr +++ b/tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.stderr @@ -2,10 +2,13 @@ error[E0432]: unresolved import `v20::v13` --> $DIR/unevaluated-const-ice-119731.rs:42:15 | LL | pub use v20::{v13, v17}; - | ^^^ - | | - | no `v13` in `v20` - | help: a similar name exists in the module: `v11` + | ^^^ no `v13` in `v20` + | +help: a similar name exists in the module + | +LL - pub use v20::{v13, v17}; +LL + pub use v20::{v11, v17}; + | error[E0425]: cannot find value `v8` in this scope --> $DIR/unevaluated-const-ice-119731.rs:13:38 diff --git a/tests/ui/dyn-compatibility/assoc_type_bounds.stderr b/tests/ui/dyn-compatibility/assoc_type_bounds.stderr index 717d8949e2d8d..16dafe3ef7475 100644 --- a/tests/ui/dyn-compatibility/assoc_type_bounds.stderr +++ b/tests/ui/dyn-compatibility/assoc_type_bounds.stderr @@ -5,7 +5,12 @@ LL | type Bar | -------- `Bar` defined here ... LL | fn foo(_: &dyn Foo<()>) {} - | ^^^^^^^ help: specify the associated type: `Foo<(), Bar = /* Type */>` + | ^^^^^^^ + | +help: specify the associated type + | +LL | fn foo(_: &dyn Foo<(), Bar = /* Type */>) {} + | ++++++++++++++++++ error[E0191]: the value of the associated type `Bar` in `Foo` must be specified --> $DIR/assoc_type_bounds.rs:11:16 @@ -14,7 +19,12 @@ LL | type Bar | -------- `Bar` defined here ... LL | fn bar(_: &dyn Foo) {} - | ^^^^^^^^ help: specify the associated type: `Foo` + | ^^^^^^^^ + | +help: specify the associated type + | +LL | fn bar(_: &dyn Foo) {} + | ++++++++++++++++++ error: aborting due to 2 previous errors diff --git a/tests/ui/dyn-compatibility/assoc_type_bounds2.stderr b/tests/ui/dyn-compatibility/assoc_type_bounds2.stderr index 9ddded9addfaf..19d8576c7ada2 100644 --- a/tests/ui/dyn-compatibility/assoc_type_bounds2.stderr +++ b/tests/ui/dyn-compatibility/assoc_type_bounds2.stderr @@ -5,7 +5,12 @@ LL | type Bar | -------- `Bar` defined here ... LL | fn foo(_: &dyn Foo<()>) {} - | ^^^^^^^ help: specify the associated type: `Foo<(), Bar = /* Type */>` + | ^^^^^^^ + | +help: specify the associated type + | +LL | fn foo(_: &dyn Foo<(), Bar = /* Type */>) {} + | ++++++++++++++++++ error[E0191]: the value of the associated type `Bar` in `Foo` must be specified --> $DIR/assoc_type_bounds2.rs:11:16 @@ -14,7 +19,12 @@ LL | type Bar | -------- `Bar` defined here ... LL | fn bar(_: &dyn Foo) {} - | ^^^^^^^^ help: specify the associated type: `Foo` + | ^^^^^^^^ + | +help: specify the associated type + | +LL | fn bar(_: &dyn Foo) {} + | ++++++++++++++++++ error: aborting due to 2 previous errors diff --git a/tests/ui/dyn-compatibility/assoc_type_bounds_sized_others.stderr b/tests/ui/dyn-compatibility/assoc_type_bounds_sized_others.stderr index 8f75f19f571a4..7c6cf3c380018 100644 --- a/tests/ui/dyn-compatibility/assoc_type_bounds_sized_others.stderr +++ b/tests/ui/dyn-compatibility/assoc_type_bounds_sized_others.stderr @@ -5,7 +5,12 @@ LL | type Bop; | -------- `Bop` defined here ... LL | fn foo(_: &dyn Foo) {} - | ^^^ help: specify the associated type: `Foo` + | ^^^ + | +help: specify the associated type + | +LL | fn foo(_: &dyn Foo) {} + | ++++++++++++++++++ error[E0191]: the value of the associated type `Bop` in `Bar` must be specified --> $DIR/assoc_type_bounds_sized_others.rs:22:16 @@ -14,7 +19,12 @@ LL | type Bop; | -------- `Bop` defined here ... LL | fn bar(_: &dyn Bar) {} - | ^^^ help: specify the associated type: `Bar` + | ^^^ + | +help: specify the associated type + | +LL | fn bar(_: &dyn Bar) {} + | ++++++++++++++++++ error: aborting due to 2 previous errors diff --git a/tests/ui/dyn-compatibility/require-assoc-for-all-super-substs.stderr b/tests/ui/dyn-compatibility/require-assoc-for-all-super-substs.stderr index f39be936f4177..4b372bf4c3dad 100644 --- a/tests/ui/dyn-compatibility/require-assoc-for-all-super-substs.stderr +++ b/tests/ui/dyn-compatibility/require-assoc-for-all-super-substs.stderr @@ -5,7 +5,12 @@ LL | type Assoc: Default; | ------------------- `Assoc` defined here ... LL | let q: as Sup>::Assoc = Default::default(); - | ^^^^^^^^^^^^^ help: specify the associated type: `Dyn` + | ^^^^^^^^^^^^^ + | +help: specify the associated type + | +LL | let q: as Sup>::Assoc = Default::default(); + | ++++++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/env-macro/error-recovery-issue-55897.stderr b/tests/ui/env-macro/error-recovery-issue-55897.stderr index e839378bf2f82..ac2174833f5e1 100644 --- a/tests/ui/env-macro/error-recovery-issue-55897.stderr +++ b/tests/ui/env-macro/error-recovery-issue-55897.stderr @@ -16,10 +16,12 @@ error[E0432]: unresolved import `prelude` --> $DIR/error-recovery-issue-55897.rs:2:5 | LL | use prelude::*; - | ^^^^^^^ - | | - | unresolved import - | help: a similar path exists: `std::prelude` + | ^^^^^^^ unresolved import + | +help: a similar path exists + | +LL | use std::prelude::*; + | +++++ error[E0432]: unresolved import `env` --> $DIR/error-recovery-issue-55897.rs:5:9 diff --git a/tests/ui/error-codes/E0191.stderr b/tests/ui/error-codes/E0191.stderr index 6fbb20839777a..1888a2b605c5a 100644 --- a/tests/ui/error-codes/E0191.stderr +++ b/tests/ui/error-codes/E0191.stderr @@ -5,7 +5,12 @@ LL | type Bar; | -------- `Bar` defined here ... LL | type Foo = dyn Trait; - | ^^^^^ help: specify the associated type: `Trait` + | ^^^^^ + | +help: specify the associated type + | +LL | type Foo = dyn Trait; + | ++++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/error-codes/E0220.stderr b/tests/ui/error-codes/E0220.stderr index 48197c9a8ccfd..fc5da5211c84a 100644 --- a/tests/ui/error-codes/E0220.stderr +++ b/tests/ui/error-codes/E0220.stderr @@ -11,7 +11,12 @@ LL | type Bar; | -------- `Bar` defined here ... LL | type Foo = dyn Trait; - | ^^^^^^^^^^^^ help: specify the associated type: `Trait` + | ^^^^^^^^^^^^ + | +help: specify the associated type + | +LL | type Foo = dyn Trait; + | ++++++++++++++++++ error: aborting due to 2 previous errors diff --git a/tests/ui/errors/dynless-turbofish-e0191-issue-91997.stderr b/tests/ui/errors/dynless-turbofish-e0191-issue-91997.stderr index cae414bf12255..4edf535967b12 100644 --- a/tests/ui/errors/dynless-turbofish-e0191-issue-91997.stderr +++ b/tests/ui/errors/dynless-turbofish-e0191-issue-91997.stderr @@ -16,7 +16,12 @@ error[E0191]: the value of the associated type `Item` in `Iterator` must be spec --> $DIR/dynless-turbofish-e0191-issue-91997.rs:5:13 | LL | let _ = MyIterator::next; - | ^^^^^^^^^^ help: specify the associated type: `MyIterator::` + | ^^^^^^^^^^ + | +help: specify the associated type + | +LL | let _ = MyIterator::::next; + | +++++++++++++++++++++ error: aborting due to 1 previous error; 1 warning emitted diff --git a/tests/ui/feature-gates/feature-gate-extern_absolute_paths.stderr b/tests/ui/feature-gates/feature-gate-extern_absolute_paths.stderr index dd78501de7185..be68cf0a132fe 100644 --- a/tests/ui/feature-gates/feature-gate-extern_absolute_paths.stderr +++ b/tests/ui/feature-gates/feature-gate-extern_absolute_paths.stderr @@ -2,10 +2,13 @@ error[E0432]: unresolved import `core` --> $DIR/feature-gate-extern_absolute_paths.rs:2:5 | LL | use core::default; - | ^^^^ - | | - | you might be missing crate `core` - | help: try using `std` instead of `core`: `std` + | ^^^^ you might be missing crate `core` + | +help: try using `std` instead of `core` + | +LL - use core::default; +LL + use std::default; + | error[E0433]: failed to resolve: you might be missing crate `core` --> $DIR/feature-gate-extern_absolute_paths.rs:5:19 diff --git a/tests/ui/fmt/ifmt-bad-arg.stderr b/tests/ui/fmt/ifmt-bad-arg.stderr index 9018482e70782..1d5e79cc93771 100644 --- a/tests/ui/fmt/ifmt-bad-arg.stderr +++ b/tests/ui/fmt/ifmt-bad-arg.stderr @@ -178,11 +178,14 @@ error: argument never used --> $DIR/ifmt-bad-arg.rs:56:27 | LL | format!("foo %s baz", "bar"); - | -- ^^^^^ argument never used - | | - | help: format specifiers use curly braces: `{}` + | ^^^^^ argument never used | = note: printf formatting is not supported; see the documentation for `std::fmt` +help: format specifiers use curly braces + | +LL - format!("foo %s baz", "bar"); +LL + format!("foo {} baz", "bar"); + | error: invalid format string: expected `}`, found `t` --> $DIR/ifmt-bad-arg.rs:75:1 diff --git a/tests/ui/impl-trait/associated-type-cycle.stderr b/tests/ui/impl-trait/associated-type-cycle.stderr index 438a5a92ffc28..e63364cb46c5f 100644 --- a/tests/ui/impl-trait/associated-type-cycle.stderr +++ b/tests/ui/impl-trait/associated-type-cycle.stderr @@ -5,7 +5,12 @@ LL | type Bar; | -------- `Bar` defined here ... LL | impl Foo for Box { - | ^^^ help: specify the associated type: `Foo` + | ^^^ + | +help: specify the associated type + | +LL | impl Foo for Box> { + | ++++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/imports/import.stderr b/tests/ui/imports/import.stderr index 6b41d0d731166..f6c69d108e34e 100644 --- a/tests/ui/imports/import.stderr +++ b/tests/ui/imports/import.stderr @@ -2,10 +2,13 @@ error[E0432]: unresolved import `zed::baz` --> $DIR/import.rs:5:5 | LL | use zed::baz; - | ^^^^^--- - | | | - | | help: a similar name exists in the module: `bar` - | no `baz` in `zed` + | ^^^^^^^^ no `baz` in `zed` + | +help: a similar name exists in the module + | +LL - use zed::baz; +LL + use zed::bar; + | error[E0432]: unresolved import `foo` --> $DIR/import.rs:13:9 diff --git a/tests/ui/imports/issue-55457.stderr b/tests/ui/imports/issue-55457.stderr index e88831bb44b0b..751bf1b9f7cbd 100644 --- a/tests/ui/imports/issue-55457.stderr +++ b/tests/ui/imports/issue-55457.stderr @@ -2,10 +2,13 @@ error[E0432]: unresolved import `NonExistent` --> $DIR/issue-55457.rs:2:5 | LL | use NonExistent; - | ^^^^^^^^^^^ - | | - | no `NonExistent` in the root - | help: a similar name exists in the module: `non_existent` + | ^^^^^^^^^^^ no `NonExistent` in the root + | +help: a similar name exists in the module + | +LL - use NonExistent; +LL + use non_existent; + | error[E0432]: unresolved import `non_existent` --> $DIR/issue-55457.rs:3:5 diff --git a/tests/ui/imports/resolve_self_super_hint.stderr b/tests/ui/imports/resolve_self_super_hint.stderr index 095a89ca2f1d2..ae8f952c14129 100644 --- a/tests/ui/imports/resolve_self_super_hint.stderr +++ b/tests/ui/imports/resolve_self_super_hint.stderr @@ -2,31 +2,45 @@ error[E0432]: unresolved import `alloc` --> $DIR/resolve_self_super_hint.rs:4:9 | LL | use alloc::HashMap; - | ^^^^^ help: a similar path exists: `self::alloc` + | ^^^^^ + | +help: a similar path exists + | +LL | use self::alloc::HashMap; + | ++++++ error[E0432]: unresolved import `alloc` --> $DIR/resolve_self_super_hint.rs:9:13 | LL | use alloc::HashMap; - | ^^^^^ help: a similar path exists: `super::alloc` + | ^^^^^ + | +help: a similar path exists + | +LL | use super::alloc::HashMap; + | +++++++ error[E0432]: unresolved import `alloc` --> $DIR/resolve_self_super_hint.rs:14:17 | LL | use alloc::HashMap; - | ^^^^^ - | | - | unresolved import - | help: a similar path exists: `a::alloc` + | ^^^^^ unresolved import + | +help: a similar path exists + | +LL | use a::alloc::HashMap; + | +++ error[E0432]: unresolved import `alloc` --> $DIR/resolve_self_super_hint.rs:19:21 | LL | use alloc::HashMap; - | ^^^^^ - | | - | unresolved import - | help: a similar path exists: `a::alloc` + | ^^^^^ unresolved import + | +help: a similar path exists + | +LL | use a::alloc::HashMap; + | +++ error: aborting due to 4 previous errors diff --git a/tests/ui/imports/shadow-glob-module-resolution-2.stderr b/tests/ui/imports/shadow-glob-module-resolution-2.stderr index 4fdfe27b3d729..26745384dee34 100644 --- a/tests/ui/imports/shadow-glob-module-resolution-2.stderr +++ b/tests/ui/imports/shadow-glob-module-resolution-2.stderr @@ -16,10 +16,13 @@ error[E0432]: unresolved import `e` --> $DIR/shadow-glob-module-resolution-2.rs:14:5 | LL | use e as b; - | -^^^^^ - | | - | no `e` in the root - | help: a similar name exists in the module: `a` + | ^^^^^^ no `e` in the root + | +help: a similar name exists in the module + | +LL - use e as b; +LL + use a as b; + | error: aborting due to 3 previous errors diff --git a/tests/ui/issues/issue-19482.stderr b/tests/ui/issues/issue-19482.stderr index 7683e16610e69..5ac5130b2cd6c 100644 --- a/tests/ui/issues/issue-19482.stderr +++ b/tests/ui/issues/issue-19482.stderr @@ -5,7 +5,12 @@ LL | type A; | ------ `A` defined here ... LL | fn bar(x: &dyn Foo) {} - | ^^^ help: specify the associated type: `Foo` + | ^^^ + | +help: specify the associated type + | +LL | fn bar(x: &dyn Foo) {} + | ++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-28344.stderr b/tests/ui/issues/issue-28344.stderr index 9940f005b7f8e..0dcb585033d07 100644 --- a/tests/ui/issues/issue-28344.stderr +++ b/tests/ui/issues/issue-28344.stderr @@ -16,7 +16,12 @@ error[E0191]: the value of the associated type `Output` in `BitXor<_>` must be s --> $DIR/issue-28344.rs:5:17 | LL | let x: u8 = BitXor::bitor(0 as u8, 0 as u8); - | ^^^^^^ help: specify the associated type: `BitXor::` + | ^^^^^^ + | +help: specify the associated type + | +LL | let x: u8 = BitXor::::bitor(0 as u8, 0 as u8); + | +++++++++++++++++++++++ warning: trait objects without an explicit `dyn` are deprecated --> $DIR/issue-28344.rs:10:13 @@ -35,7 +40,12 @@ error[E0191]: the value of the associated type `Output` in `BitXor<_>` must be s --> $DIR/issue-28344.rs:10:13 | LL | let g = BitXor::bitor; - | ^^^^^^ help: specify the associated type: `BitXor::` + | ^^^^^^ + | +help: specify the associated type + | +LL | let g = BitXor::::bitor; + | +++++++++++++++++++++++ error: aborting due to 2 previous errors; 2 warnings emitted diff --git a/tests/ui/macros/format-foreign.stderr b/tests/ui/macros/format-foreign.stderr index ccb6583615cf7..f4f8ad9276963 100644 --- a/tests/ui/macros/format-foreign.stderr +++ b/tests/ui/macros/format-foreign.stderr @@ -19,11 +19,14 @@ error: argument never used --> $DIR/format-foreign.rs:3:29 | LL | println!("%1$*2$.*3$f", 123.456); - | ----------- ^^^^^^^ argument never used - | | - | help: format specifiers use curly braces: `{0:1$.2$}` + | ^^^^^^^ argument never used | = note: printf formatting is not supported; see the documentation for `std::fmt` +help: format specifiers use curly braces + | +LL - println!("%1$*2$.*3$f", 123.456); +LL + println!("{0:1$.2$}", 123.456); + | error: multiple unused formatting arguments --> $DIR/format-foreign.rs:6:7 @@ -57,11 +60,14 @@ error: named argument never used --> $DIR/format-foreign.rs:14:39 | LL | println!("Hi there, $NAME.", NAME="Tim"); - | ----- ^^^^^ named argument never used - | | - | help: format specifiers use curly braces: `{NAME}` + | ^^^^^ named argument never used | = note: shell formatting is not supported; see the documentation for `std::fmt` +help: format specifiers use curly braces + | +LL - println!("Hi there, $NAME.", NAME="Tim"); +LL + println!("Hi there, {NAME}.", NAME="Tim"); + | error: multiple unused formatting arguments --> $DIR/format-foreign.rs:15:32 diff --git a/tests/ui/macros/format-unused-lables.stderr b/tests/ui/macros/format-unused-lables.stderr index 90eed8dd86b5a..d174b7857ef62 100644 --- a/tests/ui/macros/format-unused-lables.stderr +++ b/tests/ui/macros/format-unused-lables.stderr @@ -47,10 +47,7 @@ error: multiple unused formatting arguments --> $DIR/format-unused-lables.rs:14:9 | LL | println!("Some more $STUFF", - | ------------------ - | | | - | | help: format specifiers use curly braces: `{STUFF}` - | multiple missing formatting specifiers + | ------------------ multiple missing formatting specifiers LL | "woo!", | ^^^^^^ argument never used LL | STUFF= @@ -60,6 +57,11 @@ LL | , UNUSED="args"); | ^^^^^^ named argument never used | = note: shell formatting is not supported; see the documentation for `std::fmt` +help: format specifiers use curly braces + | +LL - println!("Some more $STUFF", +LL + println!("Some more {STUFF}", + | error: aborting due to 4 previous errors diff --git a/tests/ui/macros/non-fmt-panic.stderr b/tests/ui/macros/non-fmt-panic.stderr index 8a89d5ea79394..edef9d8d97c43 100644 --- a/tests/ui/macros/non-fmt-panic.stderr +++ b/tests/ui/macros/non-fmt-panic.stderr @@ -413,13 +413,16 @@ warning: panic message is not a string literal --> $DIR/non-fmt-panic.rs:79:12 | LL | panic!(v); - | ------ ^ - | | - | help: use std::panic::panic_any instead: `std::panic::panic_any` + | ^ | = note: for more information, see = note: this usage of `panic!()` is deprecated; it will be a hard error in Rust 2021 = note: for more information, see +help: use std::panic::panic_any instead + | +LL - panic!(v); +LL + std::panic::panic_any(v); + | warning: panic message is not a string literal --> $DIR/non-fmt-panic.rs:80:20 diff --git a/tests/ui/parser/issues/issue-112188.stderr b/tests/ui/parser/issues/issue-112188.stderr index 6d2d8e6a3b055..ecd8bcf12d377 100644 --- a/tests/ui/parser/issues/issue-112188.stderr +++ b/tests/ui/parser/issues/issue-112188.stderr @@ -27,11 +27,16 @@ error: expected `}`, found `,` --> $DIR/issue-112188.rs:13:17 | LL | let Foo { .., x, .. } = f; - | --^- + | --^ | | | | | expected `}` | `..` must be at the end and cannot have a trailing comma - | help: remove the starting `..` + | +help: remove the starting `..` + | +LL - let Foo { .., x, .. } = f; +LL + let Foo { x, .. } = f; + | error: aborting due to 3 previous errors diff --git a/tests/ui/privacy/private-in-public-warn.stderr b/tests/ui/privacy/private-in-public-warn.stderr index 1fa415e27c16f..1fd648f13a8ca 100644 --- a/tests/ui/privacy/private-in-public-warn.stderr +++ b/tests/ui/privacy/private-in-public-warn.stderr @@ -543,28 +543,32 @@ warning: bounds on generic parameters in type aliases are not enforced --> $DIR/private-in-public-warn.rs:42:23 | LL | pub type Alias = T; - | --^^^^^^ - | | | - | | will not be checked at usage sites of the type alias - | help: remove this bound + | ^^^^^^ will not be checked at usage sites of the type alias | = note: this is a known limitation of the type checker that may be lifted in a future edition. see issue #112792 for more information = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics = note: `#[warn(type_alias_bounds)]` on by default +help: remove this bound + | +LL - pub type Alias = T; +LL + pub type Alias = T; + | warning: where clauses on type aliases are not enforced --> $DIR/private-in-public-warn.rs:67:29 | LL | pub type Alias where T: PrivTr = T; - | ------^^^^^^^^^ - | | | - | | will not be checked at usage sites of the type alias - | help: remove this where clause + | ^^^^^^^^^ will not be checked at usage sites of the type alias | = note: this is a known limitation of the type checker that may be lifted in a future edition. see issue #112792 for more information = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics +help: remove this where clause + | +LL - pub type Alias where T: PrivTr = T; +LL + pub type Alias = T; + | error: aborting due to 46 previous errors; 2 warnings emitted diff --git a/tests/ui/proc-macro/mixed-site-span.stderr b/tests/ui/proc-macro/mixed-site-span.stderr index fd941f65b788c..18b6b7d984a7a 100644 --- a/tests/ui/proc-macro/mixed-site-span.stderr +++ b/tests/ui/proc-macro/mixed-site-span.stderr @@ -42,74 +42,88 @@ error[E0432]: unresolved import `$crate::proc_macro_item` --> $DIR/mixed-site-span.rs:56:5 | LL | invoke_with_ident!{krate input proc_macro_item} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------^ - | | | - | | help: a similar name exists in the module: `proc_macro_rules` - | no `proc_macro_item` in the root + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `proc_macro_item` in the root | = note: this error originates in the macro `with_crate` which comes from the expansion of the macro `invoke_with_ident` (in Nightly builds, run with -Z macro-backtrace for more info) +help: a similar name exists in the module + | +LL - invoke_with_ident!{krate input proc_macro_item} +LL + invoke_with_ident!{krate input proc_macro_rules} + | error[E0432]: unresolved import `$crate::proc_macro_item` --> $DIR/mixed-site-span.rs:57:5 | LL | with_crate!{krate input proc_macro_item} - | ^^^^^^^^^^^^^^^^^^^^^^^^---------------^ - | | | - | | help: a similar name exists in the module: `proc_macro_rules` - | no `proc_macro_item` in the root + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `proc_macro_item` in the root | = note: this error originates in the macro `with_crate` (in Nightly builds, run with -Z macro-backtrace for more info) +help: a similar name exists in the module + | +LL - with_crate!{krate input proc_macro_item} +LL + with_crate!{krate input proc_macro_rules} + | error[E0432]: unresolved import `$crate` --> $DIR/mixed-site-span.rs:58:5 | LL | with_crate!{krate call proc_macro_item} - | ^^^^^^^^^^^^^^^^^^^^^^^---------------^ - | | | - | | help: a similar name exists in the module: `proc_macro_rules` - | no `proc_macro_item` in the root + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `proc_macro_item` in the root | = note: this error originates in the macro `with_crate` (in Nightly builds, run with -Z macro-backtrace for more info) +help: a similar name exists in the module + | +LL - with_crate!{krate call proc_macro_item} +LL + with_crate!{krate call proc_macro_rules} + | error[E0432]: unresolved import `$crate` --> $DIR/mixed-site-span.rs:62:28 | LL | invoke_with_ident!{$crate input proc_macro_item} - | ^^^^^^ --------------- help: a similar name exists in the module: `proc_macro_rules` - | | - | no `proc_macro_item` in the root + | ^^^^^^ no `proc_macro_item` in the root ... LL | test!(); | ------- in this macro invocation | = note: this error originates in the macro `test` (in Nightly builds, run with -Z macro-backtrace for more info) +help: a similar name exists in the module + | +LL - invoke_with_ident!{$crate input proc_macro_item} +LL + invoke_with_ident!{$crate input proc_macro_rules} + | error[E0432]: unresolved import `$crate` --> $DIR/mixed-site-span.rs:63:21 | LL | with_crate!{$crate input proc_macro_item} - | ^^^^^^ --------------- help: a similar name exists in the module: `proc_macro_rules` - | | - | no `proc_macro_item` in the root + | ^^^^^^ no `proc_macro_item` in the root ... LL | test!(); | ------- in this macro invocation | = note: this error originates in the macro `test` (in Nightly builds, run with -Z macro-backtrace for more info) +help: a similar name exists in the module + | +LL - with_crate!{$crate input proc_macro_item} +LL + with_crate!{$crate input proc_macro_rules} + | error[E0432]: unresolved import `$crate` --> $DIR/mixed-site-span.rs:64:9 | LL | with_crate!{$crate call proc_macro_item} - | ^^^^^^^^^^^^^^^^^^^^^^^^---------------^ - | | | - | | help: a similar name exists in the module: `proc_macro_rules` - | no `proc_macro_item` in the root + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `proc_macro_item` in the root ... LL | test!(); | ------- in this macro invocation | = note: this error originates in the macro `with_crate` which comes from the expansion of the macro `test` (in Nightly builds, run with -Z macro-backtrace for more info) +help: a similar name exists in the module + | +LL - with_crate!{$crate call proc_macro_item} +LL + with_crate!{$crate call proc_macro_rules} + | error[E0432]: unresolved import `$crate` --> $DIR/mixed-site-span.rs:67:9 diff --git a/tests/ui/resolve/issue-81508.stderr b/tests/ui/resolve/issue-81508.stderr index 7258174ba89b3..c31baa1ac214b 100644 --- a/tests/ui/resolve/issue-81508.stderr +++ b/tests/ui/resolve/issue-81508.stderr @@ -1,20 +1,26 @@ error[E0433]: failed to resolve: use of undeclared type `Baz` --> $DIR/issue-81508.rs:11:20 | -LL | let Baz: &str = ""; - | --- help: `Baz` is defined here, but is not a type -LL | LL | println!("{}", Baz::Bar); | ^^^ use of undeclared type `Baz` + | +help: `Baz` is defined here, but is not a type + | +LL - let Baz: &str = ""; +LL + let : &str = ""; + | error[E0433]: failed to resolve: use of undeclared type `Foo` --> $DIR/issue-81508.rs:20:24 | -LL | use super::Foo; - | ---------- help: `Foo` is defined here, but is not a type -LL | fn function() { LL | println!("{}", Foo::Bar); | ^^^ use of undeclared type `Foo` + | +help: `Foo` is defined here, but is not a type + | +LL - use super::Foo; +LL + use ; + | error: aborting due to 2 previous errors diff --git a/tests/ui/resolve/underscore-bindings-disambiguators.stderr b/tests/ui/resolve/underscore-bindings-disambiguators.stderr index 9208b84c43a2f..69ac95158f8cb 100644 --- a/tests/ui/resolve/underscore-bindings-disambiguators.stderr +++ b/tests/ui/resolve/underscore-bindings-disambiguators.stderr @@ -2,19 +2,25 @@ error[E0432]: unresolved import `X` --> $DIR/underscore-bindings-disambiguators.rs:25:5 | LL | use X as Y; - | -^^^^^ - | | - | no `X` in the root - | help: a similar name exists in the module: `_` + | ^^^^^^ no `X` in the root + | +help: a similar name exists in the module + | +LL - use X as Y; +LL + use _ as Y; + | error[E0432]: unresolved import `Z` --> $DIR/underscore-bindings-disambiguators.rs:26:5 | LL | use Z as W; - | -^^^^^ - | | - | no `Z` in the root - | help: a similar name exists in the module: `_` + | ^^^^^^ no `Z` in the root + | +help: a similar name exists in the module + | +LL - use Z as W; +LL + use _ as W; + | error[E0080]: evaluation panicked: not yet implemented --> $DIR/underscore-bindings-disambiguators.rs:19:19 diff --git a/tests/ui/rust-2018/issue-54006.stderr b/tests/ui/rust-2018/issue-54006.stderr index 35d4c17d2c7f1..1663c44422bff 100644 --- a/tests/ui/rust-2018/issue-54006.stderr +++ b/tests/ui/rust-2018/issue-54006.stderr @@ -2,7 +2,12 @@ error[E0432]: unresolved import `alloc` --> $DIR/issue-54006.rs:6:5 | LL | use alloc::vec; - | ^^^^^ help: a similar path exists: `core::alloc` + | ^^^^^ + | +help: a similar path exists + | +LL | use core::alloc::vec; + | ++++++ error: aborting due to 1 previous error diff --git a/tests/ui/rust-2018/local-path-suggestions-2015.stderr b/tests/ui/rust-2018/local-path-suggestions-2015.stderr index e726b1e3e8182..16e847da4fc03 100644 --- a/tests/ui/rust-2018/local-path-suggestions-2015.stderr +++ b/tests/ui/rust-2018/local-path-suggestions-2015.stderr @@ -2,10 +2,12 @@ error[E0432]: unresolved import `foobar` --> $DIR/local-path-suggestions-2015.rs:24:5 | LL | use foobar::Baz; - | ^^^^^^ - | | - | unresolved import - | help: a similar path exists: `aux_baz::foobar` + | ^^^^^^ unresolved import + | +help: a similar path exists + | +LL | use aux_baz::foobar::Baz; + | +++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/rust-2018/local-path-suggestions-2018.stderr b/tests/ui/rust-2018/local-path-suggestions-2018.stderr index 40f3d6bf1cf1e..eefaba027d0dd 100644 --- a/tests/ui/rust-2018/local-path-suggestions-2018.stderr +++ b/tests/ui/rust-2018/local-path-suggestions-2018.stderr @@ -2,15 +2,24 @@ error[E0432]: unresolved import `foo` --> $DIR/local-path-suggestions-2018.rs:10:9 | LL | use foo::Bar; - | ^^^ help: a similar path exists: `crate::foo` + | ^^^ | = note: `use` statements changed in Rust 2018; read more at +help: a similar path exists + | +LL | use crate::foo::Bar; + | +++++++ error[E0432]: unresolved import `foobar` --> $DIR/local-path-suggestions-2018.rs:19:5 | LL | use foobar::Baz; - | ^^^^^^ help: a similar path exists: `baz::foobar` + | ^^^^^^ + | +help: a similar path exists + | +LL | use baz::foobar::Baz; + | +++++ error: aborting due to 2 previous errors diff --git a/tests/ui/simd/portable-intrinsics-arent-exposed.stderr b/tests/ui/simd/portable-intrinsics-arent-exposed.stderr index 043a4ca376184..7adf4adc21e08 100644 --- a/tests/ui/simd/portable-intrinsics-arent-exposed.stderr +++ b/tests/ui/simd/portable-intrinsics-arent-exposed.stderr @@ -2,10 +2,13 @@ error[E0433]: failed to resolve: you might be missing crate `core` --> $DIR/portable-intrinsics-arent-exposed.rs:5:5 | LL | use core::simd::intrinsics; - | ^^^^ - | | - | you might be missing crate `core` - | help: try using `std` instead of `core`: `std` + | ^^^^ you might be missing crate `core` + | +help: try using `std` instead of `core` + | +LL - use core::simd::intrinsics; +LL + use std::simd::intrinsics; + | error[E0432]: unresolved import `std::simd::intrinsics` --> $DIR/portable-intrinsics-arent-exposed.rs:6:5 diff --git a/tests/ui/suggestions/trait-hidden-method.stderr b/tests/ui/suggestions/trait-hidden-method.stderr index c764034d84664..73bf66a0f01e2 100644 --- a/tests/ui/suggestions/trait-hidden-method.stderr +++ b/tests/ui/suggestions/trait-hidden-method.stderr @@ -2,7 +2,12 @@ error[E0191]: the value of the associated type `Item` in `Iterator` must be spec --> $DIR/trait-hidden-method.rs:4:33 | LL | Box::new(1..=10) as Box - | ^^^^^^^^ help: specify the associated type: `Iterator` + | ^^^^^^^^ + | +help: specify the associated type + | +LL | Box::new(1..=10) as Box> + | +++++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/traits/alias/object-fail.stderr b/tests/ui/traits/alias/object-fail.stderr index 088af686258ab..6108e72cca4cd 100644 --- a/tests/ui/traits/alias/object-fail.stderr +++ b/tests/ui/traits/alias/object-fail.stderr @@ -19,7 +19,12 @@ error[E0191]: the value of the associated type `Item` in `Iterator` must be spec --> $DIR/object-fail.rs:9:17 | LL | let _: &dyn IteratorAlias = &vec![123].into_iter(); - | ^^^^^^^^^^^^^ help: specify the associated type: `IteratorAlias` + | ^^^^^^^^^^^^^ + | +help: specify the associated type + | +LL | let _: &dyn IteratorAlias = &vec![123].into_iter(); + | +++++++++++++++++++ error: aborting due to 2 previous errors diff --git a/tests/ui/traits/cast-as-dyn-trait-wo-assoc-type-issue-21950.stderr b/tests/ui/traits/cast-as-dyn-trait-wo-assoc-type-issue-21950.stderr index 6a7d3c850c92f..1d9d46489ae10 100644 --- a/tests/ui/traits/cast-as-dyn-trait-wo-assoc-type-issue-21950.stderr +++ b/tests/ui/traits/cast-as-dyn-trait-wo-assoc-type-issue-21950.stderr @@ -5,7 +5,12 @@ LL | type Output; | ----------- `Output` defined here ... LL | let x = &10 as &dyn Add; - | ^^^ help: specify the associated type: `Add` + | ^^^ + | +help: specify the associated type + | +LL | let x = &10 as &dyn Add; + | +++++++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/traits/const-traits/issue-102156.stderr b/tests/ui/traits/const-traits/issue-102156.stderr index 20505b685f309..80f9a1f66629e 100644 --- a/tests/ui/traits/const-traits/issue-102156.stderr +++ b/tests/ui/traits/const-traits/issue-102156.stderr @@ -2,21 +2,26 @@ error[E0433]: failed to resolve: you might be missing crate `core` --> $DIR/issue-102156.rs:5:5 | LL | use core::convert::{From, TryFrom}; - | ^^^^ - | | - | you might be missing crate `core` - | help: try using `std` instead of `core`: `std` + | ^^^^ you might be missing crate `core` + | +help: try using `std` instead of `core` + | +LL - use core::convert::{From, TryFrom}; +LL + use std::convert::{From, TryFrom}; + | error[E0433]: failed to resolve: you might be missing crate `core` --> $DIR/issue-102156.rs:5:5 | LL | use core::convert::{From, TryFrom}; - | ^^^^ - | | - | you might be missing crate `core` - | help: try using `std` instead of `core`: `std` + | ^^^^ you might be missing crate `core` | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: try using `std` instead of `core` + | +LL - use core::convert::{From, TryFrom}; +LL + use std::convert::{From, TryFrom}; + | error: aborting due to 2 previous errors diff --git a/tests/ui/traits/object/with-self-in-projection-output-bad.stderr b/tests/ui/traits/object/with-self-in-projection-output-bad.stderr index d0cc7f7fc9241..b63573b425e24 100644 --- a/tests/ui/traits/object/with-self-in-projection-output-bad.stderr +++ b/tests/ui/traits/object/with-self-in-projection-output-bad.stderr @@ -5,7 +5,12 @@ LL | type Output; | ----------- `Output` defined here ... LL | let _x: Box> = Box::new(2u32); - | ^^^^^^^^^^^^^^^^^^ help: specify the associated type: `Helper` + | ^^^^^^^^^^^^^^^^^^ + | +help: specify the associated type + | +LL | let _x: Box> = Box::new(2u32); + | +++++++++++++++++++++ error[E0191]: the value of the associated type `Output` in `Base` must be specified --> $DIR/with-self-in-projection-output-bad.rs:48:21 @@ -14,7 +19,12 @@ LL | type Output; | ----------- `Output` defined here ... LL | let _y: Box> = Box::new(2u32); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: specify the associated type: `NormalizableHelper` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: specify the associated type + | +LL | let _y: Box> = Box::new(2u32); + | +++++++++++++++++++++ error: aborting due to 2 previous errors diff --git a/tests/ui/transmute/unnecessary-transmutation.stderr b/tests/ui/transmute/unnecessary-transmutation.stderr index 0132ac4776be7..8399f760ceb37 100644 --- a/tests/ui/transmute/unnecessary-transmutation.stderr +++ b/tests/ui/transmute/unnecessary-transmutation.stderr @@ -2,9 +2,7 @@ error: unnecessary transmute --> $DIR/unnecessary-transmutation.rs:7:14 | LL | unsafe { transmute(x) } - | ---------^^^ - | | - | help: replace this with: `u32::to_ne_bytes` + | ^^^^^^^^^^^^ | = help: there's also `to_le_bytes` and `to_be_bytes` if you expect a particular byte order note: the lint level is defined here @@ -12,6 +10,11 @@ note: the lint level is defined here | LL | #![deny(unnecessary_transmutes)] | ^^^^^^^^^^^^^^^^^^^^^^ +help: replace this with + | +LL - unsafe { transmute(x) } +LL + unsafe { u32::to_ne_bytes(x) } + | error: unnecessary transmute --> $DIR/unnecessary-transmutation.rs:12:14 @@ -77,179 +80,234 @@ error: unnecessary transmute --> $DIR/unnecessary-transmutation.rs:33:22 | LL | let x: u16 = transmute(*b"01"); - | ---------^^^^^^^^ - | | - | help: replace this with: `u16::from_ne_bytes` + | ^^^^^^^^^^^^^^^^^ | = help: there's also `from_le_bytes` and `from_be_bytes` if you expect a particular byte order +help: replace this with + | +LL - let x: u16 = transmute(*b"01"); +LL + let x: u16 = u16::from_ne_bytes(*b"01"); + | error: unnecessary transmute --> $DIR/unnecessary-transmutation.rs:35:26 | LL | let x: [u8; 2] = transmute(x); - | ---------^^^ - | | - | help: replace this with: `u16::to_ne_bytes` + | ^^^^^^^^^^^^ | = help: there's also `to_le_bytes` and `to_be_bytes` if you expect a particular byte order +help: replace this with + | +LL - let x: [u8; 2] = transmute(x); +LL + let x: [u8; 2] = u16::to_ne_bytes(x); + | error: unnecessary transmute --> $DIR/unnecessary-transmutation.rs:37:22 | LL | let x: u32 = transmute(*b"0123"); - | ---------^^^^^^^^^^ - | | - | help: replace this with: `u32::from_ne_bytes` + | ^^^^^^^^^^^^^^^^^^^ | = help: there's also `from_le_bytes` and `from_be_bytes` if you expect a particular byte order +help: replace this with + | +LL - let x: u32 = transmute(*b"0123"); +LL + let x: u32 = u32::from_ne_bytes(*b"0123"); + | error: unnecessary transmute --> $DIR/unnecessary-transmutation.rs:39:26 | LL | let x: [u8; 4] = transmute(x); - | ---------^^^ - | | - | help: replace this with: `u32::to_ne_bytes` + | ^^^^^^^^^^^^ | = help: there's also `to_le_bytes` and `to_be_bytes` if you expect a particular byte order +help: replace this with + | +LL - let x: [u8; 4] = transmute(x); +LL + let x: [u8; 4] = u32::to_ne_bytes(x); + | error: unnecessary transmute --> $DIR/unnecessary-transmutation.rs:41:22 | LL | let x: u64 = transmute(*b"feriscat"); - | ---------^^^^^^^^^^^^^^ - | | - | help: replace this with: `u64::from_ne_bytes` + | ^^^^^^^^^^^^^^^^^^^^^^^ | = help: there's also `from_le_bytes` and `from_be_bytes` if you expect a particular byte order +help: replace this with + | +LL - let x: u64 = transmute(*b"feriscat"); +LL + let x: u64 = u64::from_ne_bytes(*b"feriscat"); + | error: unnecessary transmute --> $DIR/unnecessary-transmutation.rs:43:26 | LL | let x: [u8; 8] = transmute(x); - | ---------^^^ - | | - | help: replace this with: `u64::to_ne_bytes` + | ^^^^^^^^^^^^ | = help: there's also `to_le_bytes` and `to_be_bytes` if you expect a particular byte order +help: replace this with + | +LL - let x: [u8; 8] = transmute(x); +LL + let x: [u8; 8] = u64::to_ne_bytes(x); + | error: unnecessary transmute --> $DIR/unnecessary-transmutation.rs:46:22 | LL | let y: i16 = transmute(*b"01"); - | ---------^^^^^^^^ - | | - | help: replace this with: `i16::from_ne_bytes` + | ^^^^^^^^^^^^^^^^^ | = help: there's also `from_le_bytes` and `from_be_bytes` if you expect a particular byte order +help: replace this with + | +LL - let y: i16 = transmute(*b"01"); +LL + let y: i16 = i16::from_ne_bytes(*b"01"); + | error: unnecessary transmute --> $DIR/unnecessary-transmutation.rs:48:26 | LL | let y: [u8; 2] = transmute(y); - | ---------^^^ - | | - | help: replace this with: `i16::to_ne_bytes` + | ^^^^^^^^^^^^ | = help: there's also `to_le_bytes` and `to_be_bytes` if you expect a particular byte order +help: replace this with + | +LL - let y: [u8; 2] = transmute(y); +LL + let y: [u8; 2] = i16::to_ne_bytes(y); + | error: unnecessary transmute --> $DIR/unnecessary-transmutation.rs:50:22 | LL | let y: i32 = transmute(*b"0123"); - | ---------^^^^^^^^^^ - | | - | help: replace this with: `i32::from_ne_bytes` + | ^^^^^^^^^^^^^^^^^^^ | = help: there's also `from_le_bytes` and `from_be_bytes` if you expect a particular byte order +help: replace this with + | +LL - let y: i32 = transmute(*b"0123"); +LL + let y: i32 = i32::from_ne_bytes(*b"0123"); + | error: unnecessary transmute --> $DIR/unnecessary-transmutation.rs:52:26 | LL | let y: [u8; 4] = transmute(y); - | ---------^^^ - | | - | help: replace this with: `i32::to_ne_bytes` + | ^^^^^^^^^^^^ | = help: there's also `to_le_bytes` and `to_be_bytes` if you expect a particular byte order +help: replace this with + | +LL - let y: [u8; 4] = transmute(y); +LL + let y: [u8; 4] = i32::to_ne_bytes(y); + | error: unnecessary transmute --> $DIR/unnecessary-transmutation.rs:54:22 | LL | let y: i64 = transmute(*b"feriscat"); - | ---------^^^^^^^^^^^^^^ - | | - | help: replace this with: `i64::from_ne_bytes` + | ^^^^^^^^^^^^^^^^^^^^^^^ | = help: there's also `from_le_bytes` and `from_be_bytes` if you expect a particular byte order +help: replace this with + | +LL - let y: i64 = transmute(*b"feriscat"); +LL + let y: i64 = i64::from_ne_bytes(*b"feriscat"); + | error: unnecessary transmute --> $DIR/unnecessary-transmutation.rs:56:26 | LL | let y: [u8; 8] = transmute(y); - | ---------^^^ - | | - | help: replace this with: `i64::to_ne_bytes` + | ^^^^^^^^^^^^ | = help: there's also `to_le_bytes` and `to_be_bytes` if you expect a particular byte order +help: replace this with + | +LL - let y: [u8; 8] = transmute(y); +LL + let y: [u8; 8] = i64::to_ne_bytes(y); + | error: unnecessary transmute --> $DIR/unnecessary-transmutation.rs:59:22 | LL | let z: f32 = transmute(*b"0123"); - | ---------^^^^^^^^^^ - | | - | help: replace this with: `f32::from_ne_bytes` + | ^^^^^^^^^^^^^^^^^^^ | = help: there's also `from_le_bytes` and `from_be_bytes` if you expect a particular byte order +help: replace this with + | +LL - let z: f32 = transmute(*b"0123"); +LL + let z: f32 = f32::from_ne_bytes(*b"0123"); + | error: unnecessary transmute --> $DIR/unnecessary-transmutation.rs:61:26 | LL | let z: [u8; 4] = transmute(z); - | ---------^^^ - | | - | help: replace this with: `f32::to_ne_bytes` + | ^^^^^^^^^^^^ | = help: there's also `to_le_bytes` and `to_be_bytes` if you expect a particular byte order +help: replace this with + | +LL - let z: [u8; 4] = transmute(z); +LL + let z: [u8; 4] = f32::to_ne_bytes(z); + | error: unnecessary transmute --> $DIR/unnecessary-transmutation.rs:63:22 | LL | let z: f64 = transmute(*b"feriscat"); - | ---------^^^^^^^^^^^^^^ - | | - | help: replace this with: `f64::from_ne_bytes` + | ^^^^^^^^^^^^^^^^^^^^^^^ | = help: there's also `from_le_bytes` and `from_be_bytes` if you expect a particular byte order +help: replace this with + | +LL - let z: f64 = transmute(*b"feriscat"); +LL + let z: f64 = f64::from_ne_bytes(*b"feriscat"); + | error: unnecessary transmute --> $DIR/unnecessary-transmutation.rs:65:26 | LL | let z: [u8; 8] = transmute(z); - | ---------^^^ - | | - | help: replace this with: `f64::to_ne_bytes` + | ^^^^^^^^^^^^ | = help: there's also `to_le_bytes` and `to_be_bytes` if you expect a particular byte order +help: replace this with + | +LL - let z: [u8; 8] = transmute(z); +LL + let z: [u8; 8] = f64::to_ne_bytes(z); + | error: unnecessary transmute --> $DIR/unnecessary-transmutation.rs:68:22 | LL | let y: u32 = transmute('🦀'); - | ---------^^^^^^ - | | - | help: replace this with: `u32::from` + | ^^^^^^^^^^^^^^^ + | +help: replace this with + | +LL - let y: u32 = transmute('🦀'); +LL + let y: u32 = u32::from('🦀'); + | error: unnecessary transmute --> $DIR/unnecessary-transmutation.rs:70:23 | LL | let y: char = transmute(y); - | ---------^^^ - | | - | help: replace this with: `char::from_u32_unchecked` + | ^^^^^^^^^^^^ | = help: consider using `char::from_u32(…).unwrap()` +help: replace this with + | +LL - let y: char = transmute(y); +LL + let y: char = char::from_u32_unchecked(y); + | error: unnecessary transmute --> $DIR/unnecessary-transmutation.rs:72:22 @@ -280,81 +338,121 @@ error: unnecessary transmute --> $DIR/unnecessary-transmutation.rs:77:22 | LL | let x: u16 = transmute(8i16); - | ---------^^^^^^ - | | - | help: replace this with: `i16::cast_unsigned` + | ^^^^^^^^^^^^^^^ + | +help: replace this with + | +LL - let x: u16 = transmute(8i16); +LL + let x: u16 = i16::cast_unsigned(8i16); + | error: unnecessary transmute --> $DIR/unnecessary-transmutation.rs:79:22 | LL | let x: i16 = transmute(x); - | ---------^^^ - | | - | help: replace this with: `u16::cast_signed` + | ^^^^^^^^^^^^ + | +help: replace this with + | +LL - let x: i16 = transmute(x); +LL + let x: i16 = u16::cast_signed(x); + | error: unnecessary transmute --> $DIR/unnecessary-transmutation.rs:81:22 | LL | let x: u32 = transmute(4i32); - | ---------^^^^^^ - | | - | help: replace this with: `i32::cast_unsigned` + | ^^^^^^^^^^^^^^^ + | +help: replace this with + | +LL - let x: u32 = transmute(4i32); +LL + let x: u32 = i32::cast_unsigned(4i32); + | error: unnecessary transmute --> $DIR/unnecessary-transmutation.rs:83:22 | LL | let x: i32 = transmute(x); - | ---------^^^ - | | - | help: replace this with: `u32::cast_signed` + | ^^^^^^^^^^^^ + | +help: replace this with + | +LL - let x: i32 = transmute(x); +LL + let x: i32 = u32::cast_signed(x); + | error: unnecessary transmute --> $DIR/unnecessary-transmutation.rs:85:22 | LL | let x: u64 = transmute(7i64); - | ---------^^^^^^ - | | - | help: replace this with: `i64::cast_unsigned` + | ^^^^^^^^^^^^^^^ + | +help: replace this with + | +LL - let x: u64 = transmute(7i64); +LL + let x: u64 = i64::cast_unsigned(7i64); + | error: unnecessary transmute --> $DIR/unnecessary-transmutation.rs:87:22 | LL | let x: i64 = transmute(x); - | ---------^^^ - | | - | help: replace this with: `u64::cast_signed` + | ^^^^^^^^^^^^ + | +help: replace this with + | +LL - let x: i64 = transmute(x); +LL + let x: i64 = u64::cast_signed(x); + | error: unnecessary transmute --> $DIR/unnecessary-transmutation.rs:90:22 | LL | let y: f32 = transmute(1u32); - | ---------^^^^^^ - | | - | help: replace this with: `f32::from_bits` + | ^^^^^^^^^^^^^^^ + | +help: replace this with + | +LL - let y: f32 = transmute(1u32); +LL + let y: f32 = f32::from_bits(1u32); + | error: unnecessary transmute --> $DIR/unnecessary-transmutation.rs:92:22 | LL | let y: u32 = transmute(y); - | ---------^^^ - | | - | help: replace this with: `f32::to_bits` + | ^^^^^^^^^^^^ + | +help: replace this with + | +LL - let y: u32 = transmute(y); +LL + let y: u32 = f32::to_bits(y); + | error: unnecessary transmute --> $DIR/unnecessary-transmutation.rs:94:22 | LL | let y: f64 = transmute(3u64); - | ---------^^^^^^ - | | - | help: replace this with: `f64::from_bits` + | ^^^^^^^^^^^^^^^ + | +help: replace this with + | +LL - let y: f64 = transmute(3u64); +LL + let y: f64 = f64::from_bits(3u64); + | error: unnecessary transmute --> $DIR/unnecessary-transmutation.rs:96:22 | LL | let y: u64 = transmute(2.0); - | ---------^^^^^ - | | - | help: replace this with: `f64::to_bits` + | ^^^^^^^^^^^^^^ + | +help: replace this with + | +LL - let y: u64 = transmute(2.0); +LL + let y: u64 = f64::to_bits(2.0); + | error: unnecessary transmute --> $DIR/unnecessary-transmutation.rs:99:22 @@ -384,17 +482,25 @@ error: unnecessary transmute --> $DIR/unnecessary-transmutation.rs:106:21 | LL | let z: u8 = transmute(z); - | ---------^^^ - | | - | help: replace this with: `u8::from` + | ^^^^^^^^^^^^ + | +help: replace this with + | +LL - let z: u8 = transmute(z); +LL + let z: u8 = u8::from(z); + | error: unnecessary transmute --> $DIR/unnecessary-transmutation.rs:111:21 | LL | let z: i8 = transmute(z); - | ---------^^^ - | | - | help: replace this with: `i8::from` + | ^^^^^^^^^^^^ + | +help: replace this with + | +LL - let z: i8 = transmute(z); +LL + let z: i8 = i8::from(z); + | error: aborting due to 40 previous errors diff --git a/tests/ui/trivial-bounds/trivial-bounds-inconsistent.stderr b/tests/ui/trivial-bounds/trivial-bounds-inconsistent.stderr index 0eae68bfcf0f8..e4107a4f4abea 100644 --- a/tests/ui/trivial-bounds/trivial-bounds-inconsistent.stderr +++ b/tests/ui/trivial-bounds/trivial-bounds-inconsistent.stderr @@ -28,15 +28,17 @@ warning: where clauses on type aliases are not enforced --> $DIR/trivial-bounds-inconsistent.rs:22:14 | LL | type Y where i32: Foo = (); - | ------^^^^^^^^ - | | | - | | will not be checked at usage sites of the type alias - | help: remove this where clause + | ^^^^^^^^ will not be checked at usage sites of the type alias | = note: this is a known limitation of the type checker that may be lifted in a future edition. see issue #112792 for more information = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics = note: `#[warn(type_alias_bounds)]` on by default +help: remove this where clause + | +LL - type Y where i32: Foo = (); +LL + type Y = (); + | warning: trait bound i32: Foo does not depend on any type or lifetime parameters --> $DIR/trivial-bounds-inconsistent.rs:22:19 diff --git a/tests/ui/type-alias/missing-associated-type-in-trait-object-22434.stderr b/tests/ui/type-alias/missing-associated-type-in-trait-object-22434.stderr index c198b83e96886..c25aeb4c5ed9c 100644 --- a/tests/ui/type-alias/missing-associated-type-in-trait-object-22434.stderr +++ b/tests/ui/type-alias/missing-associated-type-in-trait-object-22434.stderr @@ -5,7 +5,12 @@ LL | type A; | ------ `A` defined here ... LL | type I<'a> = &'a (dyn Foo + 'a); - | ^^^ help: specify the associated type: `Foo` + | ^^^ + | +help: specify the associated type + | +LL | type I<'a> = &'a (dyn Foo + 'a); + | ++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/type/issue-67690-type-alias-bound-diagnostic-crash.stderr b/tests/ui/type/issue-67690-type-alias-bound-diagnostic-crash.stderr index 9fd0fe4913b47..ef0a7235c354b 100644 --- a/tests/ui/type/issue-67690-type-alias-bound-diagnostic-crash.stderr +++ b/tests/ui/type/issue-67690-type-alias-bound-diagnostic-crash.stderr @@ -2,15 +2,17 @@ warning: bounds on generic parameters in type aliases are not enforced --> $DIR/issue-67690-type-alias-bound-diagnostic-crash.rs:5:15 | LL | pub type T = P; - | --^^^^---^^^^---^^^^ - | | | - | | will not be checked at usage sites of the type alias - | help: remove this bound + | ^^^^ ^^^^ ^^^^ will not be checked at usage sites of the type alias | = note: this is a known limitation of the type checker that may be lifted in a future edition. see issue #112792 for more information = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics = note: `#[warn(type_alias_bounds)]` on by default +help: remove this bound + | +LL - pub type T = P; +LL + pub type T

= P; + | warning: 1 warning emitted diff --git a/tests/ui/type/type-alias-bounds.stderr b/tests/ui/type/type-alias-bounds.stderr index 15c0090106655..f7f530a0861c8 100644 --- a/tests/ui/type/type-alias-bounds.stderr +++ b/tests/ui/type/type-alias-bounds.stderr @@ -2,67 +2,77 @@ warning: bounds on generic parameters in type aliases are not enforced --> $DIR/type-alias-bounds.rs:8:14 | LL | type SVec = Vec; - | --^^^^---^^^^ - | | | - | | will not be checked at usage sites of the type alias - | help: remove this bound + | ^^^^ ^^^^ will not be checked at usage sites of the type alias | = note: this is a known limitation of the type checker that may be lifted in a future edition. see issue #112792 for more information = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics = note: `#[warn(type_alias_bounds)]` on by default +help: remove this bound + | +LL - type SVec = Vec; +LL + type SVec = Vec; + | warning: where clauses on type aliases are not enforced --> $DIR/type-alias-bounds.rs:10:21 | LL | type S2Vec where T: Send = Vec; - | ------^^^^^^^ - | | | - | | will not be checked at usage sites of the type alias - | help: remove this where clause + | ^^^^^^^ will not be checked at usage sites of the type alias | = note: this is a known limitation of the type checker that may be lifted in a future edition. see issue #112792 for more information = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics +help: remove this where clause + | +LL - type S2Vec where T: Send = Vec; +LL + type S2Vec = Vec; + | warning: bounds on generic parameters in type aliases are not enforced --> $DIR/type-alias-bounds.rs:12:19 | LL | type VVec<'b, 'a: 'b + 'b> = (&'b u32, Vec<&'a i32>); - | --^^---^^ - | | | - | | will not be checked at usage sites of the type alias - | help: remove this bound + | ^^ ^^ will not be checked at usage sites of the type alias | = note: this is a known limitation of the type checker that may be lifted in a future edition. see issue #112792 for more information = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics +help: remove this bound + | +LL - type VVec<'b, 'a: 'b + 'b> = (&'b u32, Vec<&'a i32>); +LL + type VVec<'b, 'a> = (&'b u32, Vec<&'a i32>); + | warning: bounds on generic parameters in type aliases are not enforced --> $DIR/type-alias-bounds.rs:14:18 | LL | type WVec<'b, T: 'b + 'b> = (&'b u32, Vec); - | --^^---^^ - | | | - | | will not be checked at usage sites of the type alias - | help: remove this bound + | ^^ ^^ will not be checked at usage sites of the type alias | = note: this is a known limitation of the type checker that may be lifted in a future edition. see issue #112792 for more information = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics +help: remove this bound + | +LL - type WVec<'b, T: 'b + 'b> = (&'b u32, Vec); +LL + type WVec<'b, T> = (&'b u32, Vec); + | warning: where clauses on type aliases are not enforced --> $DIR/type-alias-bounds.rs:16:25 | LL | type W2Vec<'b, T> where T: 'b, T: 'b = (&'b u32, Vec); - | ------^^^^^--^^^^^ - | | | - | | will not be checked at usage sites of the type alias - | help: remove this where clause + | ^^^^^ ^^^^^ will not be checked at usage sites of the type alias | = note: this is a known limitation of the type checker that may be lifted in a future edition. see issue #112792 for more information = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics +help: remove this where clause + | +LL - type W2Vec<'b, T> where T: 'b, T: 'b = (&'b u32, Vec); +LL + type W2Vec<'b, T> = (&'b u32, Vec); + | warning: bounds on generic parameters in type aliases are not enforced --> $DIR/type-alias-bounds.rs:48:12 @@ -106,27 +116,31 @@ warning: bounds on generic parameters in type aliases are not enforced --> $DIR/type-alias-bounds.rs:57:12 | LL | type T5 = ::Assoc; - | --^^^^^ - | | | - | | will not be checked at usage sites of the type alias - | help: remove this bound + | ^^^^^ will not be checked at usage sites of the type alias | = note: this is a known limitation of the type checker that may be lifted in a future edition. see issue #112792 for more information = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics +help: remove this bound + | +LL - type T5 = ::Assoc; +LL + type T5 = ::Assoc; + | warning: bounds on generic parameters in type aliases are not enforced --> $DIR/type-alias-bounds.rs:58:12 | LL | type T6 = ::std::vec::Vec; - | --^^^^^ - | | | - | | will not be checked at usage sites of the type alias - | help: remove this bound + | ^^^^^ will not be checked at usage sites of the type alias | = note: this is a known limitation of the type checker that may be lifted in a future edition. see issue #112792 for more information = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics +help: remove this bound + | +LL - type T6 = ::std::vec::Vec; +LL + type T6 = ::std::vec::Vec; + | warning: 9 warnings emitted diff --git a/tests/ui/underscore-imports/multiple-uses.ed2015.stderr b/tests/ui/underscore-imports/multiple-uses.ed2015.stderr index a295586fa16fd..802aedb03e2f6 100644 --- a/tests/ui/underscore-imports/multiple-uses.ed2015.stderr +++ b/tests/ui/underscore-imports/multiple-uses.ed2015.stderr @@ -32,11 +32,14 @@ error[E0432]: unresolved imports `std::b`, `std::c` --> $DIR/multiple-uses.rs:9:15 | LL | pub use std::{b, _, c}; - | ^ ^ - | | | - | | no `c` in the root - | | help: a similar name exists in the module: `rc` + | ^ ^ no `c` in the root + | | | no `b` in the root + | +help: a similar name exists in the module + | +LL | pub use std::{b, _, rc}; + | + error[E0432]: unresolved import `std::d` --> $DIR/multiple-uses.rs:12:18 diff --git a/tests/ui/underscore-imports/multiple-uses.ed2021.stderr b/tests/ui/underscore-imports/multiple-uses.ed2021.stderr index a295586fa16fd..802aedb03e2f6 100644 --- a/tests/ui/underscore-imports/multiple-uses.ed2021.stderr +++ b/tests/ui/underscore-imports/multiple-uses.ed2021.stderr @@ -32,11 +32,14 @@ error[E0432]: unresolved imports `std::b`, `std::c` --> $DIR/multiple-uses.rs:9:15 | LL | pub use std::{b, _, c}; - | ^ ^ - | | | - | | no `c` in the root - | | help: a similar name exists in the module: `rc` + | ^ ^ no `c` in the root + | | | no `b` in the root + | +help: a similar name exists in the module + | +LL | pub use std::{b, _, rc}; + | + error[E0432]: unresolved import `std::d` --> $DIR/multiple-uses.rs:12:18 diff --git a/tests/ui/unresolved/unresolved-import.stderr b/tests/ui/unresolved/unresolved-import.stderr index 690aa5e551e6d..8bd3698f7a5c1 100644 --- a/tests/ui/unresolved/unresolved-import.stderr +++ b/tests/ui/unresolved/unresolved-import.stderr @@ -13,46 +13,64 @@ error[E0432]: unresolved import `bar::Baz` --> $DIR/unresolved-import.rs:8:5 | LL | use bar::Baz as x; - | ^^^^^---^^^^^ - | | | - | | help: a similar name exists in the module: `Bar` - | no `Baz` in `bar` + | ^^^^^^^^^^^^^ no `Baz` in `bar` + | +help: a similar name exists in the module + | +LL - use bar::Baz as x; +LL + use bar::Bar as x; + | error[E0432]: unresolved import `food::baz` --> $DIR/unresolved-import.rs:14:5 | LL | use food::baz; - | ^^^^^^--- - | | | - | | help: a similar name exists in the module: `bag` - | no `baz` in `food` + | ^^^^^^^^^ no `baz` in `food` | note: module `food::zug::baz` exists but is inaccessible --> $DIR/unresolved-import.rs:34:9 | LL | pub mod baz { | ^^^^^^^^^^^ not accessible +help: a similar name exists in the module + | +LL - use food::baz; +LL + use food::bag; + | error[E0432]: unresolved import `food::beens` --> $DIR/unresolved-import.rs:20:12 | LL | use food::{beens as Foo}; - | -----^^^^^^^ - | | - | no `beens` in `food` - | help: a similar name exists in the module: `beans` + | ^^^^^^^^^^^^ no `beens` in `food` + | +help: a similar name exists in the module + | +LL - use food::{beens as Foo}; +LL + use food::{beans as Foo}; + | error[E0432]: unresolved import `MyEnum` --> $DIR/unresolved-import.rs:47:9 | LL | use MyEnum::*; - | ^^^^^^ help: a similar path exists: `self::MyEnum` + | ^^^^^^ + | +help: a similar path exists + | +LL | use self::MyEnum::*; + | ++++++ error[E0432]: unresolved import `Enum` --> $DIR/unresolved-import.rs:58:9 | LL | use Enum::*; - | ^^^^ help: a similar path exists: `self::Enum` + | ^^^^ + | +help: a similar path exists + | +LL | use self::Enum::*; + | ++++++ error: aborting due to 6 previous errors diff --git a/tests/ui/use/use-nested-groups-error.stderr b/tests/ui/use/use-nested-groups-error.stderr index d73754c6baa2d..2e331a9019a49 100644 --- a/tests/ui/use/use-nested-groups-error.stderr +++ b/tests/ui/use/use-nested-groups-error.stderr @@ -2,10 +2,13 @@ error[E0432]: unresolved import `a::b1::C1` --> $DIR/use-nested-groups-error.rs:9:14 | LL | use a::{b1::{C1, C2}, B2}; - | ^^ - | | - | no `C1` in `a::b1` - | help: a similar name exists in the module: `C2` + | ^^ no `C1` in `a::b1` + | +help: a similar name exists in the module + | +LL - use a::{b1::{C1, C2}, B2}; +LL + use a::{b1::{C2, C2}, B2}; + | error: aborting due to 1 previous error