diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2023-02-11 17:37:52 +0000 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2023-02-11 17:46:22 +0000 |
| commit | e80afa6501a700cb7bd356ea1c26190f6e21e79a (patch) | |
| tree | 49fae8baa631be6574f8d0f61e4e8ef6d6676cea /compiler | |
| parent | 8cca42a47f5d574c8f7302c98c3f918cdc772fbb (diff) | |
| download | rust-e80afa6501a700cb7bd356ea1c26190f6e21e79a.tar.gz rust-e80afa6501a700cb7bd356ea1c26190f6e21e79a.zip | |
Intern span when length is MAX_LEN with parent.
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_span/src/span_encoding.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/rustc_span/src/span_encoding.rs b/compiler/rustc_span/src/span_encoding.rs index d48c4f7e5a8..c600298c51a 100644 --- a/compiler/rustc_span/src/span_encoding.rs +++ b/compiler/rustc_span/src/span_encoding.rs @@ -110,11 +110,16 @@ impl Span { // Inline format with parent. let len_or_tag = len_or_tag | PARENT_MASK; let parent2 = parent.local_def_index.as_u32(); - if ctxt2 == SyntaxContext::root().as_u32() && parent2 <= MAX_CTXT { + if ctxt2 == SyntaxContext::root().as_u32() + && parent2 <= MAX_CTXT + && len_or_tag < LEN_TAG + { + debug_assert_ne!(len_or_tag, LEN_TAG); return Span { base_or_index: base, len_or_tag, ctxt_or_tag: parent2 as u16 }; } } else { // Inline format with ctxt. + debug_assert_ne!(len_or_tag, LEN_TAG); return Span { base_or_index: base, len_or_tag: len as u16, |
