Improve error messages when illegal lifetimes are used
This commit is contained in:
parent
d26f6eddfd
commit
3280e5a33d
8 changed files with 110 additions and 57 deletions
|
|
@ -8,8 +8,8 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
const c_x: &'blk int = &22; //~ ERROR only the static region is allowed here
|
||||
const c_y: &int = &22; //~ ERROR only the static region is allowed here
|
||||
const c_x: &'blk int = &22; //~ ERROR Illegal lifetime &blk: only 'static is allowed here
|
||||
const c_y: &int = &22; //~ ERROR Illegal anonymous lifetime: only 'static is allowed here
|
||||
const c_z: &'static int = &22;
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
enum yes0<'lt> {
|
||||
// This will eventually be legal (and in fact the only way):
|
||||
X3(&'lt uint) //~ ERROR named regions other than `self` are not allowed as part of a type declaration
|
||||
X3(&'lt uint) //~ ERROR Illegal lifetime <: only 'self is allowed allowed as part of a type declaration
|
||||
}
|
||||
|
||||
enum yes1 {
|
||||
|
|
@ -18,7 +18,7 @@ enum yes1 {
|
|||
}
|
||||
|
||||
enum yes2 {
|
||||
X5(&'foo uint) //~ ERROR named regions other than `self` are not allowed as part of a type declaration
|
||||
X5(&'foo uint) //~ ERROR Illegal lifetime &foo: only 'self is allowed allowed as part of a type declaration
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
struct yes0<'self> {
|
||||
x: &uint, //~ ERROR anonymous region types are not permitted here
|
||||
x: &uint, //~ ERROR Illegal anonymous lifetime: anonymous lifetimes are not permitted here
|
||||
}
|
||||
|
||||
struct yes1<'self> {
|
||||
|
|
@ -17,7 +17,7 @@ struct yes1<'self> {
|
|||
}
|
||||
|
||||
struct yes2<'self> {
|
||||
x: &'foo uint, //~ ERROR named regions other than `self` are not allowed as part of a type declaration
|
||||
x: &'foo uint, //~ ERROR Illegal lifetime &foo: only 'self is allowed allowed as part of a type declaration
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
type item_ty_yes0 = {
|
||||
x: &uint //~ ERROR anonymous region types are not permitted here
|
||||
x: &uint //~ ERROR Illegal anonymous lifetime: anonymous lifetimes are not permitted here
|
||||
};
|
||||
|
||||
type item_ty_yes1 = {
|
||||
|
|
@ -17,7 +17,7 @@ type item_ty_yes1 = {
|
|||
};
|
||||
|
||||
type item_ty_yes2 = {
|
||||
x: &'foo uint //~ ERROR named regions other than `self` are not allowed as part of a type declaration
|
||||
x: &'foo uint //~ ERROR Illegal lifetime &foo: only 'self is allowed allowed as part of a type declaration
|
||||
};
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue