about summary refs log tree commit diff
path: root/tests/ui/const-generics
diff options
context:
space:
mode:
authorJake Goulding <jake.goulding@gmail.com>2025-07-10 18:36:22 -0400
committerJake Goulding <jake.goulding@gmail.com>2025-07-14 09:52:58 -0400
commit553074431875701f66107049339dc1e67f0cdeba (patch)
tree77f65d5855cc372bf54693299b5af57a6f9110ca /tests/ui/const-generics
parent9c3064e131f4939cc95a29bb11413c49bbda1491 (diff)
downloadrust-553074431875701f66107049339dc1e67f0cdeba.tar.gz
rust-553074431875701f66107049339dc1e67f0cdeba.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.
Diffstat (limited to 'tests/ui/const-generics')
-rw-r--r--tests/ui/const-generics/type-dependent/issue-71348.full.stderr11
-rw-r--r--tests/ui/const-generics/type-dependent/issue-71348.rs2
2 files changed, 7 insertions, 6 deletions
diff --git a/tests/ui/const-generics/type-dependent/issue-71348.full.stderr b/tests/ui/const-generics/type-dependent/issue-71348.full.stderr
index f68fdb3b651..32fa46b92b3 100644
--- a/tests/ui/const-generics/type-dependent/issue-71348.full.stderr
+++ b/tests/ui/const-generics/type-dependent/issue-71348.full.stderr
@@ -1,14 +1,15 @@
-warning: lifetime flowing from input to output with different syntax can be confusing
+warning: hiding a lifetime that's named elsewhere is confusing
   --> $DIR/issue-71348.rs:18:40
    |
 LL |     fn ask<'a, const N: &'static str>(&'a self) -> &'a <Self as Get<N>>::Target
-   |                                        ^^           -- ------------------------ the lifetimes get resolved as `'a`
+   |                                        ^^           -- ------------------------ the same lifetime is hidden here
    |                                        |            |
-   |                                        |            the lifetimes get resolved as `'a`
-   |                                        this lifetime flows to the output
+   |                                        |            the same lifetime is named here
+   |                                        the lifetime is named here
    |
+   = help: the same lifetime is referred to in inconsistent ways, making the signature confusing
    = note: `#[warn(mismatched_lifetime_syntaxes)]` on by default
-help: one option is to consistently use `'a`
+help: consistently use `'a`
    |
 LL |     fn ask<'a, const N: &'static str>(&'a self) -> &'a <Self as Get<'a, N>>::Target
    |                                                                     +++
diff --git a/tests/ui/const-generics/type-dependent/issue-71348.rs b/tests/ui/const-generics/type-dependent/issue-71348.rs
index c6563c80305..9053f362ce4 100644
--- a/tests/ui/const-generics/type-dependent/issue-71348.rs
+++ b/tests/ui/const-generics/type-dependent/issue-71348.rs
@@ -17,7 +17,7 @@ trait Get<'a, const N: &'static str> {
 impl Foo {
     fn ask<'a, const N: &'static str>(&'a self) -> &'a <Self as Get<N>>::Target
     //[min]~^ ERROR `&'static str` is forbidden as the type of a const generic parameter
-    //[full]~^^ WARNING lifetime flowing from input to output with different syntax
+    //[full]~^^ WARNING hiding a lifetime that's named elsewhere is confusing
     where
         Self: Get<'a, N>,
     {