@@ -583,6 +583,11 @@ impl<'a> Parser<'a> {
583
583
}
584
584
}
585
585
586
+ fn parse_ident_into_path ( & mut self ) -> PResult < ' a , ast:: Path > {
587
+ let ident = self . parse_ident ( ) ?;
588
+ Ok ( ast:: Path :: from_ident ( self . last_span , ident) )
589
+ }
590
+
586
591
/// Check if the next token is `tok`, and return `true` if so.
587
592
///
588
593
/// This method will automatically add `tok` to `expected_tokens` if `tok` is not
@@ -1462,7 +1467,7 @@ impl<'a> Parser<'a> {
1462
1467
} else if self . eat_lt ( ) {
1463
1468
1464
1469
let ( qself, path) =
1465
- self . parse_qualified_path ( NoTypesAllowed ) ?;
1470
+ self . parse_qualified_path ( LifetimeAndTypesWithoutColons ) ?;
1466
1471
1467
1472
TyKind :: Path ( Some ( qself) , path)
1468
1473
} else if self . is_path_start ( ) {
@@ -3573,7 +3578,7 @@ impl<'a> Parser<'a> {
3573
3578
let ( qself, path) = if self . eat_lt ( ) {
3574
3579
// Parse a qualified path
3575
3580
let ( qself, path) =
3576
- self . parse_qualified_path ( NoTypesAllowed ) ?;
3581
+ self . parse_qualified_path ( LifetimeAndTypesWithColons ) ?;
3577
3582
( Some ( qself) , path)
3578
3583
} else {
3579
3584
// Parse an unqualified path
@@ -3651,9 +3656,7 @@ impl<'a> Parser<'a> {
3651
3656
// Plain idents have some extra abilities here compared to general paths
3652
3657
if self . look_ahead ( 1 , |t| * t == token:: Not ) {
3653
3658
// Parse macro invocation
3654
- let ident = self . parse_ident ( ) ?;
3655
- let ident_span = self . last_span ;
3656
- let path = ast:: Path :: from_ident ( ident_span, ident) ;
3659
+ let path = self . parse_ident_into_path ( ) ?;
3657
3660
self . bump ( ) ;
3658
3661
let delim = self . expect_open_delim ( ) ?;
3659
3662
let tts = self . parse_seq_to_end (
@@ -3673,7 +3676,7 @@ impl<'a> Parser<'a> {
3673
3676
let ( qself, path) = if self . eat_lt ( ) {
3674
3677
// Parse a qualified path
3675
3678
let ( qself, path) =
3676
- self . parse_qualified_path ( NoTypesAllowed ) ?;
3679
+ self . parse_qualified_path ( LifetimeAndTypesWithColons ) ?;
3677
3680
( Some ( qself) , path)
3678
3681
} else {
3679
3682
// Parse an unqualified path
@@ -3936,7 +3939,7 @@ impl<'a> Parser<'a> {
3936
3939
3937
3940
// Potential trouble: if we allow macros with paths instead of
3938
3941
// idents, we'd need to look ahead past the whole path here...
3939
- let pth = self . parse_path ( NoTypesAllowed ) ?;
3942
+ let pth = self . parse_ident_into_path ( ) ?;
3940
3943
self . bump ( ) ;
3941
3944
3942
3945
let id = match self . token {
@@ -4956,7 +4959,7 @@ impl<'a> Parser<'a> {
4956
4959
self . complain_if_pub_macro ( & vis, last_span) ;
4957
4960
4958
4961
let lo = self . span . lo ;
4959
- let pth = self . parse_path ( NoTypesAllowed ) ?;
4962
+ let pth = self . parse_ident_into_path ( ) ?;
4960
4963
self . expect ( & token:: Not ) ?;
4961
4964
4962
4965
// eat a matched-delimiter token tree:
@@ -6009,7 +6012,7 @@ impl<'a> Parser<'a> {
6009
6012
let mac_lo = self . span . lo ;
6010
6013
6011
6014
// item macro.
6012
- let pth = self . parse_path ( NoTypesAllowed ) ?;
6015
+ let pth = self . parse_ident_into_path ( ) ?;
6013
6016
self . expect ( & token:: Not ) ?;
6014
6017
6015
6018
// a 'special' identifier (like what `macro_rules!` uses)
0 commit comments