File tree Expand file tree Collapse file tree 5 files changed +29
-12
lines changed
compiler/rustc_parse/src/parser Expand file tree Collapse file tree 5 files changed +29
-12
lines changed Original file line number Diff line number Diff line change @@ -133,7 +133,15 @@ impl<'a> Parser<'a> {
133133 maybe_whole!(self, NtPath, |path| {
134134 if style == PathStyle::Mod && path.segments.iter().any(|segment| segment.args.is_some())
135135 {
136- self.struct_span_err(path.span, "unexpected generic arguments in path").emit();
136+ self.struct_span_err(
137+ path.segments
138+ .iter()
139+ .filter_map(|segment| segment.args.as_ref())
140+ .map(|arg| arg.span())
141+ .collect::<Vec<_>>(),
142+ "unexpected generic arguments in path",
143+ )
144+ .emit();
137145 }
138146 path
139147 });
Original file line number Diff line number Diff line change 11error: unexpected generic arguments in path
2- --> $DIR/issue-43424.rs:10:4
2+ --> $DIR/issue-43424.rs:10:10
33 |
44LL | m!(inline<u8>);
5- | ^^^^^^ ^^^^
5+ | ^^^^
66
77error: aborting due to previous error
88
Original file line number Diff line number Diff line change @@ -16,5 +16,8 @@ fn f1() {
1616fn f2() {
1717 import! { a::b::c::S<> } //~ ERROR unexpected generic arguments in path
1818}
19+ fn f3() {
20+ import! { a::b<>::c<u8>::S<> } //~ ERROR unexpected generic arguments in path
21+ }
1922
2023fn main() {}
Original file line number Diff line number Diff line change 11error: unexpected generic arguments in path
2- --> $DIR/import-ty-params.rs:14:15
2+ --> $DIR/import-ty-params.rs:14:25
33 |
44LL | import! { a::b::c::S<u8> }
5- | ^^^^^^^^^^ ^^^^
5+ | ^^^^
66
77error: unexpected generic arguments in path
8- --> $DIR/import-ty-params.rs:17:15
8+ --> $DIR/import-ty-params.rs:17:25
99 |
1010LL | import! { a::b::c::S<> }
11- | ^^^^^^^^^^ ^^
11+ | ^^
1212
13- error: aborting due to 2 previous errors
13+ error: unexpected generic arguments in path
14+ --> $DIR/import-ty-params.rs:20:19
15+ |
16+ LL | import! { a::b<>::c<u8>::S<> }
17+ | ^^ ^^^^ ^^
18+
19+ error: aborting due to 3 previous errors
1420
Original file line number Diff line number Diff line change 11error: unexpected generic arguments in path
2- --> $DIR/visibility-ty-params.rs:6:5
2+ --> $DIR/visibility-ty-params.rs:6:6
33 |
44LL | m!{ S<u8> }
5- | ^ ^^^^
5+ | ^^^^
66
77error[E0577]: expected module, found struct `S`
88 --> $DIR/visibility-ty-params.rs:6:5
@@ -11,10 +11,10 @@ LL | m!{ S<u8> }
1111 | ^^^^^ not a module
1212
1313error: unexpected generic arguments in path
14- --> $DIR/visibility-ty-params.rs:10:9
14+ --> $DIR/visibility-ty-params.rs:10:10
1515 |
1616LL | m!{ m<> }
17- | ^ ^^
17+ | ^^
1818
1919error: aborting due to 3 previous errors
2020
You can’t perform that action at this time.
0 commit comments