Continue parsing after lifetime in incorrect location
This commit is contained in:
parent
5c67ba615c
commit
fc4b54157f
@ -5329,8 +5329,12 @@ impl<'a> Parser<'a> {
|
|||||||
// Parse lifetime argument.
|
// Parse lifetime argument.
|
||||||
args.push(GenericArg::Lifetime(self.expect_lifetime()));
|
args.push(GenericArg::Lifetime(self.expect_lifetime()));
|
||||||
if seen_type || seen_binding {
|
if seen_type || seen_binding {
|
||||||
self.span_err(self.prev_span,
|
self.struct_span_err(
|
||||||
"lifetime parameters must be declared prior to type parameters");
|
self.prev_span,
|
||||||
|
"lifetime parameters must be declared prior to type parameters"
|
||||||
|
)
|
||||||
|
.span_label(self.prev_span, "must be declared prior to type parameters")
|
||||||
|
.emit();
|
||||||
}
|
}
|
||||||
} else if self.check_ident() && self.look_ahead(1, |t| t == &token::Eq) {
|
} else if self.check_ident() && self.look_ahead(1, |t| t == &token::Eq) {
|
||||||
// Parse associated type binding.
|
// Parse associated type binding.
|
||||||
|
@ -3,4 +3,6 @@ fn main() {
|
|||||||
.map(|x| x * 2)
|
.map(|x| x * 2)
|
||||||
.collect::<Vec<'a, usize, 'b>>()
|
.collect::<Vec<'a, usize, 'b>>()
|
||||||
//~^ ERROR lifetime parameters must be declared prior to type parameters
|
//~^ ERROR lifetime parameters must be declared prior to type parameters
|
||||||
|
//~| ERRROR use of undeclared lifetime name
|
||||||
|
//~| ERRROR use of undeclared lifetime name
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,20 @@ error: lifetime parameters must be declared prior to type parameters
|
|||||||
--> $DIR/issue-14303-fncall.rs:4:31
|
--> $DIR/issue-14303-fncall.rs:4:31
|
||||||
|
|
|
|
||||||
LL | .collect::<Vec<'a, usize, 'b>>()
|
LL | .collect::<Vec<'a, usize, 'b>>()
|
||||||
| ^^
|
| ^^ must be declared prior to type parameters
|
||||||
|
|
||||||
error: aborting due to previous error
|
error[E0261]: use of undeclared lifetime name `'a`
|
||||||
|
--> $DIR/issue-14303-fncall.rs:4:20
|
||||||
|
|
|
||||||
|
LL | .collect::<Vec<'a, usize, 'b>>()
|
||||||
|
| ^^ undeclared lifetime
|
||||||
|
|
||||||
|
error[E0261]: use of undeclared lifetime name `'b`
|
||||||
|
--> $DIR/issue-14303-fncall.rs:4:31
|
||||||
|
|
|
||||||
|
LL | .collect::<Vec<'a, usize, 'b>>()
|
||||||
|
| ^^ undeclared lifetime
|
||||||
|
|
||||||
|
error: aborting due to 3 previous errors
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0261`.
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
fn bar<'a, T>(x: mymodule::X<'a, T, 'b, 'c>) {}
|
fn bar<'a, T>(x: mymodule::X<'a, T, 'b, 'c>) {}
|
||||||
//~^ ERROR lifetime parameters must be declared prior to type parameters
|
//~^ ERROR lifetime parameters must be declared prior to type parameters
|
||||||
|
//~| ERROR failed to resolve: use of undeclared type or module `mymodule`
|
||||||
|
//~| ERROR use of undeclared lifetime name `'b`
|
||||||
|
//~| ERROR use of undeclared lifetime name `'c`
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
@ -2,7 +2,33 @@ error: lifetime parameters must be declared prior to type parameters
|
|||||||
--> $DIR/issue-14303-path.rs:1:37
|
--> $DIR/issue-14303-path.rs:1:37
|
||||||
|
|
|
|
||||||
LL | fn bar<'a, T>(x: mymodule::X<'a, T, 'b, 'c>) {}
|
LL | fn bar<'a, T>(x: mymodule::X<'a, T, 'b, 'c>) {}
|
||||||
| ^^
|
| ^^ must be declared prior to type parameters
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: lifetime parameters must be declared prior to type parameters
|
||||||
|
--> $DIR/issue-14303-path.rs:1:41
|
||||||
|
|
|
||||||
|
LL | fn bar<'a, T>(x: mymodule::X<'a, T, 'b, 'c>) {}
|
||||||
|
| ^^ must be declared prior to type parameters
|
||||||
|
|
||||||
|
error[E0433]: failed to resolve: use of undeclared type or module `mymodule`
|
||||||
|
--> $DIR/issue-14303-path.rs:1:18
|
||||||
|
|
|
||||||
|
LL | fn bar<'a, T>(x: mymodule::X<'a, T, 'b, 'c>) {}
|
||||||
|
| ^^^^^^^^ use of undeclared type or module `mymodule`
|
||||||
|
|
||||||
|
error[E0261]: use of undeclared lifetime name `'b`
|
||||||
|
--> $DIR/issue-14303-path.rs:1:37
|
||||||
|
|
|
||||||
|
LL | fn bar<'a, T>(x: mymodule::X<'a, T, 'b, 'c>) {}
|
||||||
|
| ^^ undeclared lifetime
|
||||||
|
|
||||||
|
error[E0261]: use of undeclared lifetime name `'c`
|
||||||
|
--> $DIR/issue-14303-path.rs:1:41
|
||||||
|
|
|
||||||
|
LL | fn bar<'a, T>(x: mymodule::X<'a, T, 'b, 'c>) {}
|
||||||
|
| ^^ undeclared lifetime
|
||||||
|
|
||||||
|
error: aborting due to 5 previous errors
|
||||||
|
|
||||||
|
Some errors occurred: E0261, E0433.
|
||||||
|
For more information about an error, try `rustc --explain E0261`.
|
||||||
|
@ -2,7 +2,7 @@ error: lifetime parameters must be declared prior to type parameters
|
|||||||
--> $DIR/trait-object-vs-lifetime.rs:16:25
|
--> $DIR/trait-object-vs-lifetime.rs:16:25
|
||||||
|
|
|
|
||||||
LL | let _: S<'static +, 'static>;
|
LL | let _: S<'static +, 'static>;
|
||||||
| ^^^^^^^
|
| ^^^^^^^ must be declared prior to type parameters
|
||||||
|
|
||||||
error[E0224]: at least one non-builtin trait is required for an object type
|
error[E0224]: at least one non-builtin trait is required for an object type
|
||||||
--> $DIR/trait-object-vs-lifetime.rs:11:23
|
--> $DIR/trait-object-vs-lifetime.rs:11:23
|
||||||
|
Loading…
x
Reference in New Issue
Block a user