Skip to content

Commit ae130b0

Browse files
committed
Move an underscore-lifetime error test to an IHLE success test
1 parent faf68f4 commit ae130b0

File tree

3 files changed

+24
-15
lines changed

3 files changed

+24
-15
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// compile-pass
12+
13+
struct Foo<'a>(&'a u8);
14+
15+
impl Foo<'_> {
16+
fn x() {}
17+
}
18+
19+
fn main() {}

src/test/ui/underscore-lifetime/underscore-lifetime-binders.rs

-4
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@
1111
struct Foo<'a>(&'a u8);
1212
struct Baz<'a>(&'_ &'a u8); //~ ERROR missing lifetime specifier
1313

14-
impl Foo<'_> { //~ ERROR missing lifetime specifier
15-
fn x() {}
16-
}
17-
1814
fn foo<'_> //~ ERROR cannot be used here
1915
(_: Foo<'_>) {}
2016

Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error[E0637]: `'_` cannot be used here
2-
--> $DIR/underscore-lifetime-binders.rs:18:8
2+
--> $DIR/underscore-lifetime-binders.rs:14:8
33
|
44
LL | fn foo<'_> //~ ERROR cannot be used here
55
| ^^ `'_` is a reserved lifetime name
66

77
error[E0637]: `'_` cannot be used here
8-
--> $DIR/underscore-lifetime-binders.rs:24:21
8+
--> $DIR/underscore-lifetime-binders.rs:20:21
99
|
1010
LL | fn meh() -> Box<for<'_> Meh<'_>> //~ ERROR cannot be used here
1111
| ^^ `'_` is a reserved lifetime name
@@ -17,13 +17,7 @@ LL | struct Baz<'a>(&'_ &'a u8); //~ ERROR missing lifetime specifier
1717
| ^^ expected lifetime parameter
1818

1919
error[E0106]: missing lifetime specifier
20-
--> $DIR/underscore-lifetime-binders.rs:14:10
21-
|
22-
LL | impl Foo<'_> { //~ ERROR missing lifetime specifier
23-
| ^^ expected lifetime parameter
24-
25-
error[E0106]: missing lifetime specifier
26-
--> $DIR/underscore-lifetime-binders.rs:24:29
20+
--> $DIR/underscore-lifetime-binders.rs:20:29
2721
|
2822
LL | fn meh() -> Box<for<'_> Meh<'_>> //~ ERROR cannot be used here
2923
| ^^ expected lifetime parameter
@@ -32,14 +26,14 @@ LL | fn meh() -> Box<for<'_> Meh<'_>> //~ ERROR cannot be used here
3226
= help: consider giving it a 'static lifetime
3327

3428
error[E0106]: missing lifetime specifier
35-
--> $DIR/underscore-lifetime-binders.rs:30:35
29+
--> $DIR/underscore-lifetime-binders.rs:26:35
3630
|
3731
LL | fn foo2(_: &'_ u8, y: &'_ u8) -> &'_ u8 { y } //~ ERROR missing lifetime specifier
3832
| ^^ expected lifetime parameter
3933
|
4034
= help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `_` or `y`
4135

42-
error: aborting due to 6 previous errors
36+
error: aborting due to 5 previous errors
4337

4438
Some errors occurred: E0106, E0637.
4539
For more information about an error, try `rustc --explain E0106`.

0 commit comments

Comments
 (0)