libsyntax: Forbid type parameters in field expressions.
This breaks code like:
struct Foo {
x: int,
}
let f: Foo = ...;
... f.x::<int> ...
Change this code to not contain an unused type parameter. For example:
struct Foo {
x: int,
}
let f: Foo = ...;
... f.x ...
Closes #18680.
[breaking-change]
This commit is contained in:
@@ -2415,9 +2415,16 @@ impl<'a> Parser<'a> {
|
||||
e = self.mk_expr(lo, hi, nd);
|
||||
}
|
||||
_ => {
|
||||
if !tys.is_empty() {
|
||||
let last_span = self.last_span;
|
||||
self.span_err(last_span,
|
||||
"field expressions may not \
|
||||
have type parameters");
|
||||
}
|
||||
|
||||
let id = spanned(dot, hi, i);
|
||||
let field = self.mk_field(e, id, tys);
|
||||
e = self.mk_expr(lo, hi, field)
|
||||
e = self.mk_expr(lo, hi, field);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user