diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2020-06-29 11:14:42 -0700 | 
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2020-07-22 12:25:54 -0700 | 
| commit | 7bf39fa9d965535f815326e3f1c48799b8077ea6 (patch) | |
| tree | bf62c5f11658dbc1103062ba5743befbea524a27 /src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound.rs | |
| parent | 6bac3dbfc2c34ce1337bc6cdde36aaeb3b6deba5 (diff) | |
| download | rust-7bf39fa9d965535f815326e3f1c48799b8077ea6.tar.gz rust-7bf39fa9d965535f815326e3f1c48799b8077ea6.zip | |
Further tweak wording of E0759 and introduce E0767
Diffstat (limited to 'src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound.rs')
| -rw-r--r-- | src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound.rs | 29 | 
1 files changed, 25 insertions, 4 deletions
| diff --git a/src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound.rs b/src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound.rs index 28a599d12bf..ba26c2d67df 100644 --- a/src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound.rs +++ b/src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound.rs @@ -17,7 +17,7 @@ mod foo { impl Irrelevant for dyn ObjectTrait {} fn use_it<'a>(val: &'a dyn ObjectTrait) -> impl OtherTrait<'a> + 'a { - val.use_self() //~ ERROR cannot infer an appropriate lifetime + val.use_self() //~ ERROR E0759 } } @@ -34,7 +34,7 @@ mod bar { impl Irrelevant for dyn ObjectTrait {} fn use_it<'a>(val: &'a dyn ObjectTrait) -> &'a () { - val.use_self() //~ ERROR cannot infer an appropriate lifetime + val.use_self() //~ ERROR E0767 } } @@ -51,7 +51,7 @@ mod baz { impl Irrelevant for Box<dyn ObjectTrait> {} fn use_it<'a>(val: &'a Box<dyn ObjectTrait + 'a>) -> &'a () { - val.use_self() //~ ERROR cannot infer an appropriate lifetime + val.use_self() //~ ERROR E0767 } } @@ -66,8 +66,29 @@ mod bat { } fn use_it<'a>(val: &'a dyn ObjectTrait) -> impl OtherTrait<'a> + 'a { - val.use_self() //~ ERROR cannot infer an appropriate lifetime + val.use_self() //~ ERROR E0767 } } +mod ban { + trait OtherTrait<'a> {} + impl<'a> OtherTrait<'a> for &'a () {} + + trait ObjectTrait {} + trait MyTrait { + fn use_self(&self) -> &(); + } + trait Irrelevant {} + + impl MyTrait for dyn ObjectTrait { + fn use_self(&self) -> &() { panic!() } + } + impl Irrelevant for dyn ObjectTrait {} + + fn use_it<'a>(val: &'a dyn ObjectTrait) -> impl OtherTrait<'a> { + val.use_self() //~ ERROR E0759 + } +} + + fn main() {} | 
