Move an underscore-lifetime error test to an IHLE success test
This commit is contained in:
parent
faf68f473f
commit
ae130b0889
3 changed files with 24 additions and 15 deletions
19
src/test/ui/impl-header-lifetime-elision/inherent-impl.rs
Normal file
19
src/test/ui/impl-header-lifetime-elision/inherent-impl.rs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// compile-pass
|
||||
|
||||
struct Foo<'a>(&'a u8);
|
||||
|
||||
impl Foo<'_> {
|
||||
fn x() {}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -11,10 +11,6 @@
|
|||
struct Foo<'a>(&'a u8);
|
||||
struct Baz<'a>(&'_ &'a u8); //~ ERROR missing lifetime specifier
|
||||
|
||||
impl Foo<'_> { //~ ERROR missing lifetime specifier
|
||||
fn x() {}
|
||||
}
|
||||
|
||||
fn foo<'_> //~ ERROR cannot be used here
|
||||
(_: Foo<'_>) {}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
error[E0637]: `'_` cannot be used here
|
||||
--> $DIR/underscore-lifetime-binders.rs:18:8
|
||||
--> $DIR/underscore-lifetime-binders.rs:14:8
|
||||
|
|
||||
LL | fn foo<'_> //~ ERROR cannot be used here
|
||||
| ^^ `'_` is a reserved lifetime name
|
||||
|
||||
error[E0637]: `'_` cannot be used here
|
||||
--> $DIR/underscore-lifetime-binders.rs:24:21
|
||||
--> $DIR/underscore-lifetime-binders.rs:20:21
|
||||
|
|
||||
LL | fn meh() -> Box<for<'_> Meh<'_>> //~ ERROR cannot be used here
|
||||
| ^^ `'_` is a reserved lifetime name
|
||||
|
|
@ -17,13 +17,7 @@ LL | struct Baz<'a>(&'_ &'a u8); //~ ERROR missing lifetime specifier
|
|||
| ^^ expected lifetime parameter
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/underscore-lifetime-binders.rs:14:10
|
||||
|
|
||||
LL | impl Foo<'_> { //~ ERROR missing lifetime specifier
|
||||
| ^^ expected lifetime parameter
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/underscore-lifetime-binders.rs:24:29
|
||||
--> $DIR/underscore-lifetime-binders.rs:20:29
|
||||
|
|
||||
LL | fn meh() -> Box<for<'_> Meh<'_>> //~ ERROR cannot be used here
|
||||
| ^^ expected lifetime parameter
|
||||
|
|
@ -32,14 +26,14 @@ LL | fn meh() -> Box<for<'_> Meh<'_>> //~ ERROR cannot be used here
|
|||
= help: consider giving it a 'static lifetime
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/underscore-lifetime-binders.rs:30:35
|
||||
--> $DIR/underscore-lifetime-binders.rs:26:35
|
||||
|
|
||||
LL | fn foo2(_: &'_ u8, y: &'_ u8) -> &'_ u8 { y } //~ ERROR missing lifetime specifier
|
||||
| ^^ expected lifetime parameter
|
||||
|
|
||||
= help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `_` or `y`
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
Some errors occurred: E0106, E0637.
|
||||
For more information about an error, try `rustc --explain E0106`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue