Skip to content

Commit

Permalink
Split the assertion in NodeRange::new.
Browse files Browse the repository at this point in the history
  • Loading branch information
nnethercote committed Aug 21, 2024
1 parent 8e3a40d commit aeaa62b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion compiler/rustc_parse/src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@ impl NodeRange {
// is the position of the function's start token. This gives
// `NodeRange(10..15)`.
fn new(ParserRange(parser_range): ParserRange, start_pos: u32) -> NodeRange {
assert!(parser_range.start >= start_pos && parser_range.end >= start_pos);
assert!(!parser_range.is_empty());
assert!(parser_range.start >= start_pos);
NodeRange((parser_range.start - start_pos)..(parser_range.end - start_pos))
}
}
Expand Down

0 comments on commit aeaa62b

Please sign in to comment.