Skip to content

Commit

Permalink
Improve error reporting in path parser
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Mar 20, 2023
1 parent eaf6215 commit 7bb31b1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -548,9 +548,9 @@ pub(crate) mod parsing {
segments.push_punct(punct);
}
if segments.is_empty() {
return Err(input.error("expected path"));
return Err(input.parse::<Ident>().unwrap_err());
} else if segments.trailing_punct() {
return Err(input.error("expected path segment"));
return Err(input.error("expected path segment after `::`"));
}
segments
},
Expand Down

0 comments on commit 7bb31b1

Please sign in to comment.