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:
parent
5d29209bda
commit
e6e58e43f8
2 changed files with 32 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue