Point only at generic arguments when they are unexpected
This commit is contained in:
parent
7907345e58
commit
2e846d6f61
5 changed files with 29 additions and 12 deletions
|
@ -133,7 +133,15 @@ impl<'a> Parser<'a> {
|
|||
maybe_whole!(self, NtPath, |path| {
|
||||
if style == PathStyle::Mod && path.segments.iter().any(|segment| segment.args.is_some())
|
||||
{
|
||||
self.struct_span_err(path.span, "unexpected generic arguments in path").emit();
|
||||
self.struct_span_err(
|
||||
path.segments
|
||||
.iter()
|
||||
.filter_map(|segment| segment.args.as_ref())
|
||||
.map(|arg| arg.span())
|
||||
.collect::<Vec<_>>(),
|
||||
"unexpected generic arguments in path",
|
||||
)
|
||||
.emit();
|
||||
}
|
||||
path
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue