diff options
| author | Mara Bos <m-ou.se@m-ou.se> | 2025-06-19 14:08:29 +0200 |
|---|---|---|
| committer | Mara Bos <m-ou.se@m-ou.se> | 2025-06-19 14:08:29 +0200 |
| commit | b4f2cac097504a0728206b08fd4f8cb3d0946a3c (patch) | |
| tree | 8aa1c026e4d3af62a62604260dbc2f20f219bd9b | |
| parent | 2da3a66c5525a860f3aacd50877db4a0772b9023 (diff) | |
| download | rust-b4f2cac097504a0728206b08fd4f8cb3d0946a3c.tar.gz rust-b4f2cac097504a0728206b08fd4f8cb3d0946a3c.zip | |
Remove old format_args diagnostic.
| -rw-r--r-- | compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs | 38 |
1 files changed, 11 insertions, 27 deletions
diff --git a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs index 34d36849939..98dc898db23 100644 --- a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs @@ -3201,14 +3201,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { let expr_ty: Option<Ty<'_>> = visitor.prop_expr.map(|expr| typeck_results.expr_ty(expr).peel_refs()); - let is_format_arguments_item = if let Some(expr_ty) = expr_ty - && let ty::Adt(adt, _) = expr_ty.kind() - { - self.infcx.tcx.is_lang_item(adt.did(), LangItem::FormatArguments) - } else { - false - }; - if visitor.found == 0 && stmt.span.contains(proper_span) && let Some(p) = sm.span_to_margin(stmt.span) @@ -3236,25 +3228,17 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { "" }; - if !is_format_arguments_item { - let addition = format!( - "let {}binding = {};\n{}", - mutability, - s, - " ".repeat(p) - ); - err.multipart_suggestion_verbose( - msg, - vec![ - (stmt.span.shrink_to_lo(), addition), - (proper_span, "binding".to_string()), - ], - Applicability::MaybeIncorrect, - ); - } else { - err.note("the result of `format_args!` can only be assigned directly if no placeholders in its arguments are used"); - err.note("to learn more, visit <https://doc.rust-lang.org/std/macro.format_args.html>"); - } + let addition = + format!("let {}binding = {};\n{}", mutability, s, " ".repeat(p)); + err.multipart_suggestion_verbose( + msg, + vec![ + (stmt.span.shrink_to_lo(), addition), + (proper_span, "binding".to_string()), + ], + Applicability::MaybeIncorrect, + ); + suggested = true; break; } |
