2024-07-13 10:49:14 -05:00
|
|
|
//@ edition:2021
|
|
|
|
|
|
|
|
trait Trait {}
|
|
|
|
|
|
|
|
struct IceCream;
|
|
|
|
|
|
|
|
impl IceCream {
|
|
|
|
fn foo(_: &Trait) {}
|
2024-10-04 09:10:28 -05:00
|
|
|
//~^ ERROR: expected a type, found a trait
|
2024-07-13 10:49:14 -05:00
|
|
|
|
|
|
|
fn bar(self, _: &'a Trait) {}
|
2024-10-04 09:10:28 -05:00
|
|
|
//~^ ERROR: expected a type, found a trait
|
2024-07-13 10:49:14 -05:00
|
|
|
//~| ERROR: use of undeclared lifetime name
|
|
|
|
|
|
|
|
fn alice<'a>(&self, _: &Trait) {}
|
2024-10-04 09:10:28 -05:00
|
|
|
//~^ ERROR: expected a type, found a trait
|
2024-07-13 10:49:14 -05:00
|
|
|
|
|
|
|
fn bob<'a>(_: &'a Trait) {}
|
2024-10-04 09:10:28 -05:00
|
|
|
//~^ ERROR: expected a type, found a trait
|
2024-07-13 10:49:14 -05:00
|
|
|
|
|
|
|
fn cat() -> &Trait {
|
|
|
|
//~^ ERROR: missing lifetime specifier
|
2024-10-04 09:10:28 -05:00
|
|
|
//~| ERROR: expected a type, found a trait
|
2024-07-13 10:49:14 -05:00
|
|
|
&Type
|
|
|
|
}
|
|
|
|
|
|
|
|
fn dog<'a>() -> &Trait {
|
|
|
|
//~^ ERROR: missing lifetime specifier
|
2024-10-04 09:10:28 -05:00
|
|
|
//~| ERROR: expected a type, found a trait
|
2024-07-13 10:49:14 -05:00
|
|
|
&Type
|
|
|
|
}
|
|
|
|
|
|
|
|
fn kitten() -> &'a Trait {
|
|
|
|
//~^ ERROR: use of undeclared lifetime name
|
2024-10-04 09:10:28 -05:00
|
|
|
//~| ERROR: expected a type, found a trait
|
2024-07-13 10:49:14 -05:00
|
|
|
&Type
|
|
|
|
}
|
|
|
|
|
|
|
|
fn puppy<'a>() -> &'a Trait {
|
2024-10-04 09:10:28 -05:00
|
|
|
//~^ ERROR: expected a type, found a trait
|
2024-07-13 10:49:14 -05:00
|
|
|
&Type
|
|
|
|
}
|
|
|
|
|
|
|
|
fn parrot() -> &mut Trait {
|
|
|
|
//~^ ERROR: missing lifetime specifier
|
2024-10-04 09:10:28 -05:00
|
|
|
//~| ERROR: expected a type, found a trait
|
2024-07-13 10:49:14 -05:00
|
|
|
&mut Type
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
trait Sing {
|
|
|
|
fn foo(_: &Trait);
|
2024-10-04 09:10:28 -05:00
|
|
|
//~^ ERROR: expected a type, found a trait
|
2024-07-13 10:49:14 -05:00
|
|
|
|
|
|
|
fn bar(_: &'a Trait);
|
2024-10-04 09:10:28 -05:00
|
|
|
//~^ ERROR: expected a type, found a trait
|
2024-07-13 10:49:14 -05:00
|
|
|
//~| ERROR: use of undeclared lifetime name
|
|
|
|
|
|
|
|
fn alice<'a>(_: &Trait);
|
2024-10-04 09:10:28 -05:00
|
|
|
//~^ ERROR: expected a type, found a trait
|
2024-07-13 10:49:14 -05:00
|
|
|
|
|
|
|
fn bob<'a>(_: &'a Trait);
|
2024-10-04 09:10:28 -05:00
|
|
|
//~^ ERROR: expected a type, found a trait
|
2024-07-13 10:49:14 -05:00
|
|
|
|
|
|
|
fn cat() -> &Trait;
|
|
|
|
//~^ ERROR: missing lifetime specifier
|
2024-10-04 09:10:28 -05:00
|
|
|
//~| ERROR: expected a type, found a trait
|
2024-07-13 10:49:14 -05:00
|
|
|
|
|
|
|
fn dog<'a>() -> &Trait {
|
|
|
|
//~^ ERROR: missing lifetime specifier
|
2024-10-04 09:10:28 -05:00
|
|
|
//~| ERROR: expected a type, found a trait
|
2024-07-13 10:49:14 -05:00
|
|
|
&Type
|
|
|
|
}
|
|
|
|
|
|
|
|
fn kitten() -> &'a Trait {
|
|
|
|
//~^ ERROR: use of undeclared lifetime name
|
2024-10-04 09:10:28 -05:00
|
|
|
//~| ERROR: expected a type, found a trait
|
2024-07-13 10:49:14 -05:00
|
|
|
&Type
|
|
|
|
}
|
|
|
|
|
|
|
|
fn puppy<'a>() -> &'a Trait {
|
2024-10-04 09:10:28 -05:00
|
|
|
//~^ ERROR: expected a type, found a trait
|
2024-07-13 10:49:14 -05:00
|
|
|
&Type
|
|
|
|
}
|
|
|
|
|
|
|
|
fn parrot() -> &mut Trait {
|
|
|
|
//~^ ERROR: missing lifetime specifier
|
2024-10-04 09:10:28 -05:00
|
|
|
//~| ERROR: expected a type, found a trait
|
2024-07-13 10:49:14 -05:00
|
|
|
&mut Type
|
|
|
|
}
|
|
|
|
}
|
2024-07-13 11:05:16 -05:00
|
|
|
|
2024-07-13 10:49:14 -05:00
|
|
|
fn foo(_: &Trait) {}
|
2024-10-04 09:10:28 -05:00
|
|
|
//~^ ERROR: expected a type, found a trait
|
2024-07-13 10:49:14 -05:00
|
|
|
|
|
|
|
fn bar(_: &'a Trait) {}
|
2024-10-04 09:10:28 -05:00
|
|
|
//~^ ERROR: expected a type, found a trait
|
2024-07-13 10:49:14 -05:00
|
|
|
//~| ERROR: use of undeclared lifetime name
|
|
|
|
|
|
|
|
fn alice<'a>(_: &Trait) {}
|
2024-10-04 09:10:28 -05:00
|
|
|
//~^ ERROR: expected a type, found a trait
|
2024-07-13 10:49:14 -05:00
|
|
|
|
|
|
|
fn bob<'a>(_: &'a Trait) {}
|
2024-10-04 09:10:28 -05:00
|
|
|
//~^ ERROR: expected a type, found a trait
|
2024-07-13 10:49:14 -05:00
|
|
|
|
|
|
|
struct Type;
|
|
|
|
|
|
|
|
impl Trait for Type {}
|
|
|
|
|
|
|
|
fn cat() -> &Trait {
|
|
|
|
//~^ ERROR: missing lifetime specifier
|
2024-10-04 09:10:28 -05:00
|
|
|
//~| ERROR: expected a type, found a trait
|
2024-07-13 10:49:14 -05:00
|
|
|
&Type
|
|
|
|
}
|
|
|
|
|
|
|
|
fn dog<'a>() -> &Trait {
|
|
|
|
//~^ ERROR: missing lifetime specifier
|
2024-10-04 09:10:28 -05:00
|
|
|
//~| ERROR: expected a type, found a trait
|
2024-07-13 10:49:14 -05:00
|
|
|
&Type
|
|
|
|
}
|
|
|
|
|
|
|
|
fn kitten() -> &'a Trait {
|
|
|
|
//~^ ERROR: use of undeclared lifetime name
|
2024-10-04 09:10:28 -05:00
|
|
|
//~| ERROR: expected a type, found a trait
|
2024-07-13 10:49:14 -05:00
|
|
|
&Type
|
|
|
|
}
|
|
|
|
|
|
|
|
fn puppy<'a>() -> &'a Trait {
|
2024-10-04 09:10:28 -05:00
|
|
|
//~^ ERROR: expected a type, found a trait
|
2024-07-13 10:49:14 -05:00
|
|
|
&Type
|
|
|
|
}
|
|
|
|
|
|
|
|
fn parrot() -> &mut Trait {
|
|
|
|
//~^ ERROR: missing lifetime specifier
|
2024-10-04 09:10:28 -05:00
|
|
|
//~| ERROR: expected a type, found a trait
|
2024-07-13 10:49:14 -05:00
|
|
|
&mut Type
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|