File tree 2 files changed +29
-1
lines changed
2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -1776,7 +1776,13 @@ impl<'a> Parser<'a> {
1776
1776
1777
1777
pub fn parse_path_common ( & mut self , style : PathStyle , enable_warning : bool )
1778
1778
-> PResult < ' a , ast:: Path > {
1779
- maybe_whole ! ( self , NtPath , |x| x) ;
1779
+ maybe_whole ! ( self , NtPath , |path| {
1780
+ if style == PathStyle :: Mod &&
1781
+ path. segments. iter( ) . any( |segment| segment. parameters. is_some( ) ) {
1782
+ self . diagnostic( ) . span_err( path. span, "unexpected generic arguments in path" ) ;
1783
+ }
1784
+ path
1785
+ } ) ;
1780
1786
1781
1787
let lo = self . meta_var_span . unwrap_or ( self . span ) ;
1782
1788
let mut segments = Vec :: new ( ) ;
Original file line number Diff line number Diff line change
1
+ // Copyright 2017 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
+ #![ allow( unused) ]
12
+
13
+ macro_rules! m {
14
+ ( $attr_path: path) => {
15
+ #[ $attr_path]
16
+ fn f( ) { }
17
+ }
18
+ }
19
+
20
+ m ! ( inline<u8 >) ; //~ ERROR: unexpected generic arguments in path
21
+
22
+ fn main ( ) { }
You can’t perform that action at this time.
0 commit comments