Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workaround an upstream nom bug #1338

Merged
merged 1 commit into from
Mar 13, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions crates/webidl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,17 @@ fn parse(webidl_source: &str, allowed_types: Option<&[&str]>) -> Result<Program>
.context(ErrorKind::ParsingWebIDLSource)
.into(),
weedle::Err::Error(cx) | weedle::Err::Failure(cx) => {
// Note that #[allow] here is a workaround for Geal/nom#843
// because the `Context` type here comes from `nom` and if
// something else in our crate graph enables the
// `verbose-errors` feature then we need to still compiled
// against the changed enum definition.
#[allow(unreachable_patterns)]
let remaining = match cx {
weedle::Context::Code(remaining, _) => remaining,
weedle::Context::Code(remaining, _) => remaining.len(),
_ => 0,
};
let pos = webidl_source.len() - remaining.len();
let pos = webidl_source.len() - remaining;
format_err!("failed to parse WebIDL")
.context(ErrorKind::ParsingWebIDLSourcePos(pos))
.into()
Expand Down