diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-08-22 06:58:31 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-08-23 14:40:08 +1000 |
| commit | 39b38a94e397bb2f55bb7b8e2a5cd69f649cadc1 (patch) | |
| tree | 8596807d293c725fa2cef65fd4da9469d29335f6 /compiler/rustc_parse/src | |
| parent | 0bae33fcd503473aec70aef28b0e08abce965557 (diff) | |
| download | rust-39b38a94e397bb2f55bb7b8e2a5cd69f649cadc1.tar.gz rust-39b38a94e397bb2f55bb7b8e2a5cd69f649cadc1.zip | |
Split the assertion in `NodeRange::new`.
Diffstat (limited to 'compiler/rustc_parse/src')
| -rw-r--r-- | compiler/rustc_parse/src/parser/mod.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_parse/src/parser/mod.rs b/compiler/rustc_parse/src/parser/mod.rs index 61e3fa2e6c5..b72957ace52 100644 --- a/compiler/rustc_parse/src/parser/mod.rs +++ b/compiler/rustc_parse/src/parser/mod.rs @@ -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)) } } |
