about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2024-09-07 14:21:20 +0300
committerGitHub <noreply@github.com>2024-09-07 14:21:20 +0300
commit41a20dcb87bc2ccc52eae13f6c2c2248fea1c0d1 (patch)
treead6076b0fc43e5dcb782df38bd9502c9f5be0a6f /tests
parent040be55550d00f10ee81066b422e4ed5de9c63bd (diff)
parent9e2d264fa251f98780084382a071e10a123770d6 (diff)
downloadrust-41a20dcb87bc2ccc52eae13f6c2c2248fea1c0d1.tar.gz
rust-41a20dcb87bc2ccc52eae13f6c2c2248fea1c0d1.zip
Rollup merge of #129840 - GrigorenkoPV:elided-named-lifetimes-suggestion, r=cjgillot
Implement suggestions for `elided_named_lifetimes`

A follow-up to #129207, as per https://github.com/rust-lang/rust/pull/129207#issuecomment-2308992849.

r? cjgillot

I will probably squash this a bit, but later.

`@rustbot` label +A-lint
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/lint/elided-named-lifetimes/example-from-issue48686.stderr4
-rw-r--r--tests/ui/lint/elided-named-lifetimes/not-tied-to-crate.stderr8
-rw-r--r--tests/ui/lint/elided-named-lifetimes/static.stderr19
3 files changed, 31 insertions, 0 deletions
diff --git a/tests/ui/lint/elided-named-lifetimes/example-from-issue48686.stderr b/tests/ui/lint/elided-named-lifetimes/example-from-issue48686.stderr
index 8c5426a60cb..2d8c6e99643 100644
--- a/tests/ui/lint/elided-named-lifetimes/example-from-issue48686.stderr
+++ b/tests/ui/lint/elided-named-lifetimes/example-from-issue48686.stderr
@@ -9,6 +9,10 @@ note: the lint level is defined here
    |
 LL | #![deny(elided_named_lifetimes)]
    |         ^^^^^^^^^^^^^^^^^^^^^^
+help: consider specifying it explicitly
+   |
+LL |     pub fn get_mut(&'static self, x: &mut u8) -> &'static mut u8 {
+   |                                                   +++++++
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/lint/elided-named-lifetimes/not-tied-to-crate.stderr b/tests/ui/lint/elided-named-lifetimes/not-tied-to-crate.stderr
index c465aab1a03..3c01375d501 100644
--- a/tests/ui/lint/elided-named-lifetimes/not-tied-to-crate.stderr
+++ b/tests/ui/lint/elided-named-lifetimes/not-tied-to-crate.stderr
@@ -9,6 +9,10 @@ note: the lint level is defined here
    |
 LL | #[warn(elided_named_lifetimes)]
    |        ^^^^^^^^^^^^^^^^^^^^^^
+help: consider specifying it explicitly
+   |
+LL |     fn bar(x: &'static u8) -> &'static u8 {
+   |                                +++++++
 
 error: elided lifetime has a name
   --> $DIR/not-tied-to-crate.rs:11:31
@@ -21,6 +25,10 @@ note: the lint level is defined here
    |
 LL |     #[deny(elided_named_lifetimes)]
    |            ^^^^^^^^^^^^^^^^^^^^^^
+help: consider specifying it explicitly
+   |
+LL |     fn baz(x: &'static u8) -> &'static u8 {
+   |                                +++++++
 
 error: aborting due to 1 previous error; 1 warning emitted
 
diff --git a/tests/ui/lint/elided-named-lifetimes/static.stderr b/tests/ui/lint/elided-named-lifetimes/static.stderr
index d2e9776cb4f..fa2a2d3460f 100644
--- a/tests/ui/lint/elided-named-lifetimes/static.stderr
+++ b/tests/ui/lint/elided-named-lifetimes/static.stderr
@@ -9,24 +9,43 @@ note: the lint level is defined here
    |
 LL | #![deny(elided_named_lifetimes)]
    |         ^^^^^^^^^^^^^^^^^^^^^^
+help: consider specifying it explicitly
+   |
+LL | fn ampersand(x: &'static u8) -> &'static u8 {
+   |                                  +++++++
 
 error: elided lifetime has a name
   --> $DIR/static.rs:23:32
    |
 LL | fn brackets(x: &'static u8) -> Brackets {
    |                                ^^^^^^^^ this elided lifetime gets resolved as `'static`
+   |
+help: consider specifying it explicitly
+   |
+LL | fn brackets(x: &'static u8) -> Brackets<'static> {
+   |                                        +++++++++
 
 error: elided lifetime has a name
   --> $DIR/static.rs:30:34
    |
 LL | fn comma(x: &'static u8) -> Comma<u8> {
    |                                  ^ this elided lifetime gets resolved as `'static`
+   |
+help: consider specifying it explicitly
+   |
+LL | fn comma(x: &'static u8) -> Comma<'static, u8> {
+   |                                   ++++++++
 
 error: elided lifetime has a name
   --> $DIR/static.rs:35:35
    |
 LL | fn underscore(x: &'static u8) -> &'_ u8 {
    |                                   ^^ this elided lifetime gets resolved as `'static`
+   |
+help: consider specifying it explicitly
+   |
+LL | fn underscore(x: &'static u8) -> &'static u8 {
+   |                                   ~~~~~~~
 
 error: aborting due to 4 previous errors