about summary refs log tree commit diff
path: root/tests/ui/consts
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2024-05-18 16:56:08 -0400
committerMichael Goulet <michael@errs.io>2024-06-14 11:05:35 -0400
commit4f97ab54c452400b47e3518e17d18ada7675f07d (patch)
treea872ee4a3d67faec0f3104ee30f3181ea06309c4 /tests/ui/consts
parentf9515fdd5aa132e27d9b580a35b27f4b453251c1 (diff)
downloadrust-4f97ab54c452400b47e3518e17d18ada7675f07d.tar.gz
rust-4f97ab54c452400b47e3518e17d18ada7675f07d.zip
Resolve elided lifetimes in assoc const to static if no other lifetimes are in scope
Diffstat (limited to 'tests/ui/consts')
-rw-r--r--tests/ui/consts/assoc-const-elided-lifetime.stderr12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/ui/consts/assoc-const-elided-lifetime.stderr b/tests/ui/consts/assoc-const-elided-lifetime.stderr
index a1eeaff4ba8..3e847298c35 100644
--- a/tests/ui/consts/assoc-const-elided-lifetime.stderr
+++ b/tests/ui/consts/assoc-const-elided-lifetime.stderr
@@ -6,6 +6,11 @@ LL |     const FOO: Foo<'_> = Foo { x: PhantomData::<&()> };
    |
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #115010 <https://github.com/rust-lang/rust/issues/115010>
+note: cannot automatically infer `'static` because of other lifetimes in scope
+  --> $DIR/assoc-const-elided-lifetime.rs:9:6
+   |
+LL | impl<'a> Foo<'a> {
+   |      ^^
 note: the lint level is defined here
   --> $DIR/assoc-const-elided-lifetime.rs:1:9
    |
@@ -24,6 +29,13 @@ LL |     const BAR: &() = &();
    |
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #115010 <https://github.com/rust-lang/rust/issues/115010>
+note: cannot automatically infer `'static` because of other lifetimes in scope
+  --> $DIR/assoc-const-elided-lifetime.rs:9:6
+   |
+LL | impl<'a> Foo<'a> {
+   |      ^^
+LL |     const FOO: Foo<'_> = Foo { x: PhantomData::<&()> };
+   |                    ^^
 help: use the `'static` lifetime
    |
 LL |     const BAR: &'static () = &();