mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-06 04:08:40 +00:00
Intern span when length is MAX_LEN with parent.
This commit is contained in:
parent
8cca42a47f
commit
e80afa6501
@ -110,11 +110,16 @@ impl Span {
|
|||||||
// Inline format with parent.
|
// Inline format with parent.
|
||||||
let len_or_tag = len_or_tag | PARENT_MASK;
|
let len_or_tag = len_or_tag | PARENT_MASK;
|
||||||
let parent2 = parent.local_def_index.as_u32();
|
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 };
|
return Span { base_or_index: base, len_or_tag, ctxt_or_tag: parent2 as u16 };
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Inline format with ctxt.
|
// Inline format with ctxt.
|
||||||
|
debug_assert_ne!(len_or_tag, LEN_TAG);
|
||||||
return Span {
|
return Span {
|
||||||
base_or_index: base,
|
base_or_index: base,
|
||||||
len_or_tag: len as u16,
|
len_or_tag: len as u16,
|
||||||
|
8
tests/ui/span/issue-107353.rs
Normal file
8
tests/ui/span/issue-107353.rs
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user