diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2024-05-17 21:23:47 +0000 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2024-05-17 21:23:47 +0000 |
| commit | cf5702ee91dd9ba93c19aae9e663e613a577d02b (patch) | |
| tree | 4fb66ba3adc94e78defb92e9a63fb55d58c5f061 /compiler | |
| parent | 1775e7b93d4142eb2e4c75c2d49a9c4d8541d7a6 (diff) | |
| download | rust-cf5702ee91dd9ba93c19aae9e663e613a577d02b.tar.gz rust-cf5702ee91dd9ba93c19aae9e663e613a577d02b.zip | |
Detect when a lifetime is being reused in suggestion
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_infer/messages.ftl | 5 | ||||
| -rw-r--r-- | compiler/rustc_infer/src/errors/mod.rs | 1 |
2 files changed, 5 insertions, 1 deletions
diff --git a/compiler/rustc_infer/messages.ftl b/compiler/rustc_infer/messages.ftl index 64f52ea7ac1..8f1c4ad462a 100644 --- a/compiler/rustc_infer/messages.ftl +++ b/compiler/rustc_infer/messages.ftl @@ -164,7 +164,10 @@ infer_label_bad = {$bad_kind -> infer_lf_bound_not_satisfied = lifetime bound not satisfied infer_lifetime_mismatch = lifetime mismatch -infer_lifetime_param_suggestion = consider introducing a named lifetime parameter{$is_impl -> +infer_lifetime_param_suggestion = consider {$is_reuse -> + [true] reusing + *[false] introducing +} a named lifetime parameter{$is_impl -> [true] {" "}and update trait if needed *[false] {""} } diff --git a/compiler/rustc_infer/src/errors/mod.rs b/compiler/rustc_infer/src/errors/mod.rs index 9998f089588..8bb0dc39143 100644 --- a/compiler/rustc_infer/src/errors/mod.rs +++ b/compiler/rustc_infer/src/errors/mod.rs @@ -517,6 +517,7 @@ impl Subdiagnostic for AddLifetimeParamsSuggestion<'_> { Applicability::MaybeIncorrect, ); diag.arg("is_impl", is_impl); + diag.arg("is_reuse", !introduce_new); true }; |
