]> git.lizzy.rs Git - rust.git/commitdiff
Simplify issue-4291 test
authorMichael Wright <mikerite@lavabit.com>
Sun, 1 Sep 2019 05:55:29 +0000 (07:55 +0200)
committerMichael Wright <mikerite@lavabit.com>
Sun, 1 Sep 2019 05:55:29 +0000 (07:55 +0200)
tests/ui/extra_unused_lifetimes.rs
tests/ui/extra_unused_lifetimes.stderr

index 66f6e67a75c2916831cb53657b3b628e659e6d82..ba95fd63bf9a566b40bb3e922e4869da44d064cb 100644 (file)
@@ -63,20 +63,12 @@ fn explicit_self_with_lifetime<'a>(self: &'a Self) {}
 
 // Methods implementing traits must have matching lifetimes
 mod issue4291 {
-    #[derive(Debug)]
-    pub struct Foo<'a>(&'a std::marker::PhantomData<u8>);
-
-    #[derive(Debug)]
-    pub struct Bar<'a: 'b, 'b>(Foo<'a>, &'b std::marker::PhantomData<u8>);
-
-    trait LT {
-        fn test<'a: 'b, 'b>(foo: &Foo<'a>, bar: &Bar<'a, 'b>);
+    trait BadTrait {
+        fn unused_lt<'a>(x: u8) {}
     }
 
-    pub struct Baz;
-
-    impl LT for Baz {
-        fn test<'a: 'b, 'b>(_foo: &Foo, _bar: &Bar) {}
+    impl BadTrait for () {
+        fn unused_lt<'a>(_x: u8) {}
     }
 }
 
index 6473a2fbcb28aecd7274fae80c58761163545165..ebdb8e749520fed2bd95045043b76e60f5829543 100644 (file)
@@ -18,5 +18,11 @@ error: this lifetime isn't used in the function definition
 LL |     fn x<'a>(&self) {}
    |          ^^
 
-error: aborting due to 3 previous errors
+error: this lifetime isn't used in the function definition
+  --> $DIR/extra_unused_lifetimes.rs:67:22
+   |
+LL |         fn unused_lt<'a>(x: u8) {}
+   |                      ^^
+
+error: aborting due to 4 previous errors