diff options
| author | bors <bors@rust-lang.org> | 2014-11-13 12:27:03 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-11-13 12:27:03 +0000 |
| commit | 82f383839c7cc0ce66d7cfbd400182b535029f0f (patch) | |
| tree | 6707e33c88d72e9239ca6422800889986da4f343 /src/libsyntax/parse/parser.rs | |
| parent | f6c025013945cbd00ec4ac24b7ef1ac20db0b43a (diff) | |
| parent | e6e58e43f8f9507474fdf35544b6b0c0fc6cef39 (diff) | |
| download | rust-82f383839c7cc0ce66d7cfbd400182b535029f0f.tar.gz rust-82f383839c7cc0ce66d7cfbd400182b535029f0f.zip | |
auto merge of #18879 : pcwalton/rust/path-silliness, r=aturon
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]
r? @aturon
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 6873c015fd5..90ada8a687c 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -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); } } } |
