mirror of https://github.com/rust-lang/rust.git
Add an assertion to `NodeRange::new`.
This commit is contained in:
parent
c8098be41f
commit
5aaa2f92ee
|
@ -238,6 +238,7 @@ 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);
|
||||
NodeRange((parser_range.start - start_pos)..(parser_range.end - start_pos))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue