2018-10-11 14:51:44 -05:00
|
|
|
// Check that we error when `'_` appears as the name of a lifetime parameter.
|
|
|
|
//
|
|
|
|
// Regression test for #52098.
|
|
|
|
|
|
|
|
// revisions: Rust2015 Rust2018
|
|
|
|
//[Rust2018] edition:2018
|
|
|
|
|
|
|
|
struct IceCube<'a> {
|
|
|
|
v: Vec<&'a char>
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<'_> IceCube<'_> {}
|
2018-10-19 15:43:46 -05:00
|
|
|
//[Rust2015]~^ ERROR `'_` cannot be used here
|
|
|
|
//[Rust2015]~| ERROR missing lifetime specifier
|
|
|
|
//[Rust2018]~^^^ ERROR `'_` cannot be used here
|
2018-10-11 14:51:44 -05:00
|
|
|
|
|
|
|
struct Struct<'_> {
|
2018-10-19 15:43:46 -05:00
|
|
|
//[Rust2015]~^ ERROR `'_` cannot be used here
|
|
|
|
//[Rust2018]~^^ ERROR `'_` cannot be used here
|
2018-10-11 14:51:44 -05:00
|
|
|
v: Vec<&'static char>
|
|
|
|
}
|
|
|
|
|
|
|
|
enum Enum<'_> {
|
2018-10-19 15:43:46 -05:00
|
|
|
//[Rust2015]~^ ERROR `'_` cannot be used here
|
|
|
|
//[Rust2018]~^^ ERROR `'_` cannot be used here
|
2018-10-11 14:51:44 -05:00
|
|
|
Variant
|
|
|
|
}
|
|
|
|
|
|
|
|
union Union<'_> {
|
2018-10-19 15:43:46 -05:00
|
|
|
//[Rust2015]~^ ERROR `'_` cannot be used here
|
|
|
|
//[Rust2018]~^^ ERROR `'_` cannot be used here
|
2018-10-11 14:51:44 -05:00
|
|
|
a: u32
|
|
|
|
}
|
|
|
|
|
|
|
|
trait Trait<'_> {
|
2018-10-19 15:43:46 -05:00
|
|
|
//[Rust2015]~^ ERROR `'_` cannot be used here
|
|
|
|
//[Rust2018]~^^ ERROR `'_` cannot be used here
|
2018-10-11 14:51:44 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn foo<'_>() {
|
2018-10-19 15:43:46 -05:00
|
|
|
//[Rust2015]~^ ERROR `'_` cannot be used here
|
|
|
|
//[Rust2018]~^^ ERROR `'_` cannot be used here
|
2018-10-11 14:51:44 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|