Skip to content

Commit 44bee53

Browse files
authored
Rollup merge of #84887 - jyn514:index-span, r=Xanewok
Remove SpanInterner::get - It's used exactly once, so it's trivial to replace - It doesn't match the normal convention for containers: normally `get()` returns an option and indexing panics. Instead `SpanInterner::get()` panics and there's no indexing operation available.
2 parents eb36bc6 + b73ad09 commit 44bee53

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

compiler/rustc_span/src/span_encoding.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ impl Span {
102102
// Interned format.
103103
debug_assert!(self.ctxt_or_zero == 0);
104104
let index = self.base_or_index;
105-
with_span_interner(|interner| *interner.get(index))
105+
with_span_interner(|interner| interner.spans[index as usize])
106106
}
107107
}
108108
}
@@ -117,11 +117,6 @@ impl SpanInterner {
117117
let (index, _) = self.spans.insert_full(*span_data);
118118
index as u32
119119
}
120-
121-
#[inline]
122-
fn get(&self, index: u32) -> &SpanData {
123-
&self.spans[index as usize]
124-
}
125120
}
126121

127122
// If an interner exists, return it. Otherwise, prepare a fresh one.

0 commit comments

Comments
 (0)