1
Fork 0

Fix invalid syntax in impl Trait parameter type suggestions for E0311

This commit is contained in:
yanchen4791 2022-12-26 15:43:31 -08:00 committed by David Tolnay
parent ef4046e4f3
commit 621d412241
No known key found for this signature in database
GPG key ID: F9BA143B95FF6D82
14 changed files with 365 additions and 39 deletions

View file

@ -0,0 +1,13 @@
// run-rustfix
#![allow(warnings)]
fn no_restriction<'a, T: 'a>(x: &'a ()) -> &() {
with_restriction::<T>(x) //~ ERROR the parameter type `T` may not live long enough
}
fn with_restriction<'b, T: 'b>(x: &'b ()) -> &'b () {
x
}
fn main() {}