about summary refs log tree commit diff
path: root/tests/ui/underscore-lifetime
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2024-07-09 22:30:26 +0000
committerEsteban Küber <esteban@kuber.com.ar>2025-02-10 20:21:39 +0000
commitf0845adb0c1b7a7fa1bef73e749b2d7e1d7f374d (patch)
treee97d87013709bda13934fdc452a2a459a069876a /tests/ui/underscore-lifetime
parent8c04e395952022a451138dc4dbead6dd6ae65203 (diff)
downloadrust-f0845adb0c1b7a7fa1bef73e749b2d7e1d7f374d.tar.gz
rust-f0845adb0c1b7a7fa1bef73e749b2d7e1d7f374d.zip
Show diff suggestion format on verbose replacement
```
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
  --> $DIR/attempted-access-non-fatal.rs:7:15
   |
LL |     let _ = 2.l;
   |               ^
   |
help: if intended to be a floating point literal, consider adding a `0` after the period and a `f64` suffix
   |
LL -     let _ = 2.l;
LL +     let _ = 2.0f64;
   |
```
Diffstat (limited to 'tests/ui/underscore-lifetime')
-rw-r--r--tests/ui/underscore-lifetime/in-fn-return-illegal.stderr5
-rw-r--r--tests/ui/underscore-lifetime/underscore-lifetime-binders.stderr15
-rw-r--r--tests/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.stderr5
3 files changed, 15 insertions, 10 deletions
diff --git a/tests/ui/underscore-lifetime/in-fn-return-illegal.stderr b/tests/ui/underscore-lifetime/in-fn-return-illegal.stderr
index fb036c695b4..a53e8adbecf 100644
--- a/tests/ui/underscore-lifetime/in-fn-return-illegal.stderr
+++ b/tests/ui/underscore-lifetime/in-fn-return-illegal.stderr
@@ -7,8 +7,9 @@ LL | fn foo(x: &u32, y: &u32) -> &'_ u32 { loop { } }
    = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `x` or `y`
 help: consider introducing a named lifetime parameter
    |
-LL | fn foo<'a>(x: &'a u32, y: &'a u32) -> &'a u32 { loop { } }
-   |       ++++     ++          ++          ~~
+LL - fn foo(x: &u32, y: &u32) -> &'_ u32 { loop { } }
+LL + fn foo<'a>(x: &'a u32, y: &'a u32) -> &'a u32 { loop { } }
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/underscore-lifetime/underscore-lifetime-binders.stderr b/tests/ui/underscore-lifetime/underscore-lifetime-binders.stderr
index cd74d27dcb5..d940166e9e2 100644
--- a/tests/ui/underscore-lifetime/underscore-lifetime-binders.stderr
+++ b/tests/ui/underscore-lifetime/underscore-lifetime-binders.stderr
@@ -6,8 +6,9 @@ LL | struct Baz<'a>(&'_ &'a u8);
    |
 help: consider using the `'a` lifetime
    |
-LL | struct Baz<'a>(&'a &'a u8);
-   |                 ~~
+LL - struct Baz<'a>(&'_ &'a u8);
+LL + struct Baz<'a>(&'a &'a u8);
+   |
 
 error[E0637]: `'_` cannot be used here
   --> $DIR/underscore-lifetime-binders.rs:4:8
@@ -30,8 +31,9 @@ LL | fn meh() -> Box<dyn for<'_> Meh<'_>>
    = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
 help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static`, or if you will only have owned values
    |
-LL | fn meh() -> Box<dyn for<'_> Meh<'static>>
-   |                                 ~~~~~~~
+LL - fn meh() -> Box<dyn for<'_> Meh<'_>>
+LL + fn meh() -> Box<dyn for<'_> Meh<'static>>
+   |
 
 error[E0106]: missing lifetime specifier
   --> $DIR/underscore-lifetime-binders.rs:16:35
@@ -42,8 +44,9 @@ LL | fn foo2(_: &'_ u8, y: &'_ u8) -> &'_ u8 { y }
    = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from argument 1 or `y`
 help: consider introducing a named lifetime parameter
    |
-LL | fn foo2<'a>(_: &'a u8, y: &'a u8) -> &'a u8 { y }
-   |        ++++     ~~         ~~         ~~
+LL - fn foo2(_: &'_ u8, y: &'_ u8) -> &'_ u8 { y }
+LL + fn foo2<'a>(_: &'a u8, y: &'a u8) -> &'a u8 { y }
+   |
 
 error: aborting due to 5 previous errors
 
diff --git a/tests/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.stderr b/tests/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.stderr
index 8bd9b1112c5..4b530ca4ba6 100644
--- a/tests/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.stderr
+++ b/tests/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.stderr
@@ -12,8 +12,9 @@ LL | fn foo(x: &mut Vec<&'_ u8>, y: &'_ u8) { x.push(y); }
    = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
 help: consider introducing a named lifetime parameter
    |
-LL | fn foo<'a>(x: &mut Vec<&'a u8>, y: &'a u8) { x.push(y); }
-   |       ++++              ~~          ~~
+LL - fn foo(x: &mut Vec<&'_ u8>, y: &'_ u8) { x.push(y); }
+LL + fn foo<'a>(x: &mut Vec<&'a u8>, y: &'a u8) { x.push(y); }
+   |
 
 error: aborting due to 1 previous error