File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -2415,9 +2415,16 @@ impl<'a> Parser<'a> {
24152415 e = self . mk_expr ( lo, hi, nd) ;
24162416 }
24172417 _ => {
2418+ if !tys. is_empty ( ) {
2419+ let last_span = self . last_span ;
2420+ self . span_err ( last_span,
2421+ "field expressions may not \
2422+ have type parameters") ;
2423+ }
2424+
24182425 let id = spanned ( dot, hi, i) ;
24192426 let field = self . mk_field ( e, id, tys) ;
2420- e = self . mk_expr ( lo, hi, field)
2427+ e = self . mk_expr ( lo, hi, field) ;
24212428 }
24222429 }
24232430 }
Original file line number Diff line number Diff line change 1+ // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+ // file at the top-level directory of this distribution and at
3+ // http://rust-lang.org/COPYRIGHT.
4+ //
5+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+ // option. This file may not be copied, modified, or distributed
9+ // except according to those terms.
10+
11+ struct Foo {
12+ x : int ,
13+ y : int ,
14+ }
15+
16+ fn main ( ) {
17+ let f = Foo {
18+ x : 1 ,
19+ y : 2 ,
20+ } ;
21+ f. x :: < int > ;
22+ //~^ ERROR field expressions may not have type parameters
23+ }
24+
You can’t perform that action at this time.
0 commit comments