Skip to content

Commit 5aaa2f9

Browse files
committed
Add an assertion to NodeRange::new.
1 parent c8098be commit 5aaa2f9

File tree

1 file changed

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

1 file changed

+1
-0
lines changed

Diff for: compiler/rustc_parse/src/parser/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ 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);
241242
NodeRange((parser_range.start - start_pos)..(parser_range.end - start_pos))
242243
}
243244
}

0 commit comments

Comments
 (0)