diff options
| author | Jake Goulding <jake.goulding@gmail.com> | 2025-07-10 18:36:22 -0400 |
|---|---|---|
| committer | Jake Goulding <jake.goulding@gmail.com> | 2025-07-14 09:52:58 -0400 |
| commit | ff1ae2b994960b23eac9e7ce5275c0c5235a0c1d (patch) | |
| tree | a8387c7a373a0883602d244d4efb0d9f9f63be46 | |
| parent | 434fb311f1d29419f0ffee2cfa541ea5a920129b (diff) | |
| download | rust-ff1ae2b994960b23eac9e7ce5275c0c5235a0c1d.tar.gz rust-ff1ae2b994960b23eac9e7ce5275c0c5235a0c1d.zip | |
Reword mismatched-lifetime-syntaxes text based on feedback
Key changes include: - Removal of the word "syntax" from the lint message. More accurately, it could have been something like "syntax group" or "syntax category", but avoiding it completely is easier. - The primary lint message now reflects exactly which mismatch is occurring, instead of trying to be general. A new `help` line is general across the mismatch kinds. - Suggestions have been reduced to be more minimal, no longer also changing non-idiomatic but unrelated aspects. - Suggestion text no longer mentions changes when those changes don't occur in that specific suggestion.
| -rw-r--r-- | tests/ui/ptr_arg.rs | 2 | ||||
| -rw-r--r-- | tests/ui/ptr_arg.stderr | 11 |
2 files changed, 7 insertions, 6 deletions
diff --git a/tests/ui/ptr_arg.rs b/tests/ui/ptr_arg.rs index 65f3f05d6cb..578641e910d 100644 --- a/tests/ui/ptr_arg.rs +++ b/tests/ui/ptr_arg.rs @@ -312,7 +312,7 @@ mod issue_9218 { // Inferred to be `&'a str`, afaik. fn cow_good_ret_ty<'a>(input: &'a Cow<'a, str>) -> &str { - //~^ ERROR: lifetime flowing from input to output with different syntax + //~^ ERROR: eliding a lifetime that's named elsewhere is confusing todo!() } } diff --git a/tests/ui/ptr_arg.stderr b/tests/ui/ptr_arg.stderr index 600343754e1..fd9ceddfe11 100644 --- a/tests/ui/ptr_arg.stderr +++ b/tests/ui/ptr_arg.stderr @@ -231,18 +231,19 @@ error: writing `&String` instead of `&str` involves a new object where a slice w LL | fn good(v1: &String, v2: &String) { | ^^^^^^^ help: change this to: `&str` -error: lifetime flowing from input to output with different syntax can be confusing +error: eliding a lifetime that's named elsewhere is confusing --> tests/ui/ptr_arg.rs:314:36 | LL | fn cow_good_ret_ty<'a>(input: &'a Cow<'a, str>) -> &str { - | ^^ ^^ ---- the lifetime gets resolved as `'a` + | ^^ ^^ ---- the same lifetime is elided here | | | - | | these lifetimes flow to the output - | these lifetimes flow to the output + | | the lifetime is named here + | the lifetime is named here | + = help: the same lifetime is referred to in inconsistent ways, making the signature confusing = note: `-D mismatched-lifetime-syntaxes` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(mismatched_lifetime_syntaxes)]` -help: one option is to consistently use `'a` +help: consistently use `'a` | LL | fn cow_good_ret_ty<'a>(input: &'a Cow<'a, str>) -> &'a str { | ++ |
