Skip to content

Commit aeaa62b

Browse files
committed
Split the assertion in NodeRange::new.
1 parent 8e3a40d commit aeaa62b

File tree

1 file changed

+2
-1
lines changed
  • compiler/rustc_parse/src/parser

1 file changed

+2
-1
lines changed

compiler/rustc_parse/src/parser/mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,8 @@ impl NodeRange {
238238
// is the position of the function's start token. This gives
239239
// `NodeRange(10..15)`.
240240
fn new(ParserRange(parser_range): ParserRange, start_pos: u32) -> NodeRange {
241-
assert!(parser_range.start >= start_pos && parser_range.end >= start_pos);
241+
assert!(!parser_range.is_empty());
242+
assert!(parser_range.start >= start_pos);
242243
NodeRange((parser_range.start - start_pos)..(parser_range.end - start_pos))
243244
}
244245
}

0 commit comments

Comments
 (0)