Skip to content

Commit

Permalink
add more to the ERROR messages
Browse files Browse the repository at this point in the history
  • Loading branch information
nikomatsakis committed Oct 19, 2018
1 parent df8adb5 commit c294ec6
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 27 deletions.
26 changes: 13 additions & 13 deletions src/test/ui/underscore-lifetime/in-binder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,36 +10,36 @@ struct IceCube<'a> {
}

impl<'_> IceCube<'_> {}
//[Rust2015]~^ ERROR
//[Rust2015]~| ERROR
//[Rust2018]~^^^ ERROR
//[Rust2015]~^ ERROR `'_` cannot be used here
//[Rust2015]~| ERROR missing lifetime specifier
//[Rust2018]~^^^ ERROR `'_` cannot be used here

struct Struct<'_> {
//[Rust2015]~^ ERROR
//[Rust2018]~^^ ERROR
//[Rust2015]~^ ERROR `'_` cannot be used here
//[Rust2018]~^^ ERROR `'_` cannot be used here
v: Vec<&'static char>
}

enum Enum<'_> {
//[Rust2015]~^ ERROR
//[Rust2018]~^^ ERROR
//[Rust2015]~^ ERROR `'_` cannot be used here
//[Rust2018]~^^ ERROR `'_` cannot be used here
Variant
}

union Union<'_> {
//[Rust2015]~^ ERROR
//[Rust2018]~^^ ERROR
//[Rust2015]~^ ERROR `'_` cannot be used here
//[Rust2018]~^^ ERROR `'_` cannot be used here
a: u32
}

trait Trait<'_> {
//[Rust2015]~^ ERROR
//[Rust2018]~^^ ERROR
//[Rust2015]~^ ERROR `'_` cannot be used here
//[Rust2018]~^^ ERROR `'_` cannot be used here
}

fn foo<'_>() {
//[Rust2015]~^ ERROR
//[Rust2018]~^^ ERROR
//[Rust2015]~^ ERROR `'_` cannot be used here
//[Rust2018]~^^ ERROR `'_` cannot be used here
}

fn main() {}
2 changes: 1 addition & 1 deletion src/test/ui/underscore-lifetime/in-fn-return-illegal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@

use std::fmt::Debug;

fn foo(x: &u32, y: &u32) -> &'_ u32 { loop { } } //~ ERROR
fn foo(x: &u32, y: &u32) -> &'_ u32 { loop { } } //~ ERROR missing lifetime specifier

fn main() { }
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
error[E0106]: missing lifetime specifier
--> $DIR/in-fn-return-illegal.rs:15:30
|
LL | fn foo(x: &u32, y: &u32) -> &'_ u32 { loop { } } //~ ERROR
LL | fn foo(x: &u32, y: &u32) -> &'_ u32 { loop { } } //~ 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 `x` or `y`
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/underscore-lifetime/in-struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
use std::fmt::Debug;

struct Foo {
x: &'_ u32, //~ ERROR
x: &'_ u32, //~ ERROR missing lifetime specifier
}

enum Bar {
Variant(&'_ u32), //~ ERROR
Variant(&'_ u32), //~ ERROR missing lifetime specifier
}

fn main() { }
4 changes: 2 additions & 2 deletions src/test/ui/underscore-lifetime/in-struct.stderr
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
error[E0106]: missing lifetime specifier
--> $DIR/in-struct.rs:16:9
|
LL | x: &'_ u32, //~ ERROR
LL | x: &'_ u32, //~ ERROR missing lifetime specifier
| ^^ expected lifetime parameter

error[E0106]: missing lifetime specifier
--> $DIR/in-struct.rs:20:14
|
LL | Variant(&'_ u32), //~ ERROR
LL | Variant(&'_ u32), //~ ERROR missing lifetime specifier
| ^^ expected lifetime parameter

error: aborting due to 2 previous errors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ struct Foo<T> {
impl<T> Foo<T>
where
T: WithType<&u32>
//[rust2015]~^ ERROR
//[rust2018]~^^ ERROR
//[rust2015]~^ ERROR `&` without an explicit lifetime name cannot be used here
//[rust2018]~^^ ERROR `&` without an explicit lifetime name cannot be used here
{ }

fn main() {}
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ struct Foo<T> {
impl<T> Foo<T>
where
T: WithRegion<'_>
//[rust2015]~^ ERROR
//[rust2018]~^^ ERROR
//[rust2015]~^ ERROR `'_` cannot be used here
//[rust2018]~^^ ERROR `'_` cannot be used here
{ }

fn main() {}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ trait Foo { }
impl<T> Foo for Vec<T>
where
T: WithType<&u32>
//[rust2015]~^ ERROR
//[rust2018]~^^ ERROR
//[rust2015]~^ ERROR `&` without an explicit lifetime name cannot be used here
//[rust2018]~^^ ERROR `&` without an explicit lifetime name cannot be used here
{ }

fn main() {}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ trait Foo { }
impl<T> Foo for Vec<T>
where
T: WithRegion<'_>
//[rust2015]~^ ERROR
//[rust2018]~^^ ERROR
//[rust2015]~^ ERROR `'_` cannot be used here
//[rust2018]~^^ ERROR `'_` cannot be used here
{ }

fn main() {}

0 comments on commit c294ec6

Please sign in to comment.