Skip to content

Commit 88cbb7b

Browse files
committed
Add an assertion to NodeRange::new.
1 parent c44336c commit 88cbb7b

File tree

1 file changed

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

1 file changed

+1
-0
lines changed

compiler/rustc_parse/src/parser/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ impl NodeRange {
237237
// is the position of the function's start token. This gives
238238
// `NodeRange(10..15)`.
239239
fn new(ParserRange(parser_range): ParserRange, start_pos: u32) -> NodeRange {
240+
assert!(parser_range.start >= start_pos);
240241
NodeRange((parser_range.start - start_pos)..(parser_range.end - start_pos))
241242
}
242243
}

0 commit comments

Comments
 (0)