File tree Expand file tree Collapse file tree 4 files changed +127
-1
lines changed
compiler/rustc_parse/src/parser Expand file tree Collapse file tree 4 files changed +127
-1
lines changed Original file line number Diff line number Diff line change @@ -707,7 +707,7 @@ impl<'a> Parser<'a> {
707707 } )
708708 } ;
709709
710- let ( ident, item_kind) = if self . eat ( & token :: PathSep ) {
710+ let ( ident, item_kind) = if self . eat_path_sep ( ) {
711711 let suffixes = if self . eat ( & token:: BinOp ( token:: Star ) ) {
712712 None
713713 } else {
Original file line number Diff line number Diff line change 1+ //@ run-rustfix
2+
3+ #![feature(fn_delegation)]
4+ #![allow(incomplete_features, unused)]
5+
6+ trait Trait {
7+ fn foo(&self) {}
8+ }
9+
10+ struct F;
11+ impl Trait for F {}
12+
13+ pub mod to_reuse {
14+ pub fn bar() {}
15+ }
16+
17+ mod fn_to_other {
18+ use super::*;
19+
20+ reuse Trait::foo; //~ ERROR path separator must be a double colon
21+ reuse to_reuse::bar; //~ ERROR path separator must be a double colon
22+ }
23+
24+ impl Trait for u8 {}
25+
26+ struct S(u8);
27+
28+ mod to_import {
29+ pub fn check(arg: &u8) -> &u8 { arg }
30+ }
31+
32+ impl Trait for S {
33+ reuse Trait::* { //~ ERROR path separator must be a double colon
34+ use to_import::check;
35+
36+ let _arr = Some(self.0).map(|x| [x * 2; 3]);
37+ check(&self.0)
38+ }
39+ }
40+
41+ fn main() {
42+ let s = S(0);
43+ s.foo();
44+ }
Original file line number Diff line number Diff line change 1+ //@ run-rustfix
2+
3+ #![ feature( fn_delegation) ]
4+ #![ allow( incomplete_features, unused) ]
5+
6+ trait Trait {
7+ fn foo ( & self ) { }
8+ }
9+
10+ struct F ;
11+ impl Trait for F { }
12+
13+ pub mod to_reuse {
14+ pub fn bar ( ) { }
15+ }
16+
17+ mod fn_to_other {
18+ use super :: * ;
19+
20+ reuse Trait :: : foo; //~ ERROR path separator must be a double colon
21+ reuse to_reuse:: : bar; //~ ERROR path separator must be a double colon
22+ }
23+
24+ impl Trait for u8 { }
25+
26+ struct S ( u8 ) ;
27+
28+ mod to_import {
29+ pub fn check ( arg : & u8 ) -> & u8 { arg }
30+ }
31+
32+ impl Trait for S {
33+ reuse Trait :: : * { //~ ERROR path separator must be a double colon
34+ use to_import:: check;
35+
36+ let _arr = Some ( self . 0 ) . map ( |x| [ x * 2 ; 3 ] ) ;
37+ check( & self . 0 )
38+ }
39+ }
40+
41+ fn main ( ) {
42+ let s = S ( 0 ) ;
43+ s. foo ( ) ;
44+ }
Original file line number Diff line number Diff line change 1+ error: path separator must be a double colon
2+ --> $DIR/triple-colon-delegation.rs:20:18
3+ |
4+ LL | reuse Trait:::foo;
5+ | ^
6+ |
7+ help: use a double colon instead
8+ |
9+ LL - reuse Trait:::foo;
10+ LL + reuse Trait::foo;
11+ |
12+
13+ error: path separator must be a double colon
14+ --> $DIR/triple-colon-delegation.rs:21:21
15+ |
16+ LL | reuse to_reuse:::bar;
17+ | ^
18+ |
19+ help: use a double colon instead
20+ |
21+ LL - reuse to_reuse:::bar;
22+ LL + reuse to_reuse::bar;
23+ |
24+
25+ error: path separator must be a double colon
26+ --> $DIR/triple-colon-delegation.rs:33:18
27+ |
28+ LL | reuse Trait:::* {
29+ | ^
30+ |
31+ help: use a double colon instead
32+ |
33+ LL - reuse Trait:::* {
34+ LL + reuse Trait::* {
35+ |
36+
37+ error: aborting due to 3 previous errors
38+
You can’t perform that action at this time.
0 commit comments