Skip to content

Commit 919497c

Browse files
rustc_metadata: Remove Metadata::raw_bytes() and use Metadata::blob() directly instead.
1 parent 5f73085 commit 919497c

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

compiler/rustc_metadata/src/rmeta/decoder.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,7 @@ pub(super) struct DecodeContext<'a, 'tcx> {
167167
/// Abstract over the various ways one can create metadata decoders.
168168
pub(super) trait Metadata<'a, 'tcx>: Copy {
169169
fn blob(self) -> &'a MetadataBlob;
170-
#[inline]
171-
fn raw_bytes(self) -> &'a [u8] {
172-
self.blob()
173-
}
170+
174171
fn cdata(self) -> Option<CrateMetadataRef<'a>> {
175172
None
176173
}
@@ -184,7 +181,7 @@ pub(super) trait Metadata<'a, 'tcx>: Copy {
184181
fn decoder(self, pos: usize) -> DecodeContext<'a, 'tcx> {
185182
let tcx = self.tcx();
186183
DecodeContext {
187-
opaque: opaque::Decoder::new(self.raw_bytes(), pos),
184+
opaque: opaque::Decoder::new(self.blob(), pos),
188185
cdata: self.cdata(),
189186
blob: self.blob(),
190187
sess: self.sess().or(tcx.map(|tcx| tcx.sess)),
@@ -637,7 +634,7 @@ impl MetadataBlob {
637634
}
638635

639636
crate fn is_compatible(&self) -> bool {
640-
self.raw_bytes().starts_with(METADATA_HEADER)
637+
self.blob().starts_with(METADATA_HEADER)
641638
}
642639

643640
crate fn get_rustc_version(&self) -> String {
@@ -646,7 +643,7 @@ impl MetadataBlob {
646643
}
647644

648645
crate fn get_root(&self) -> CrateRoot<'tcx> {
649-
let slice = self.raw_bytes();
646+
let slice = &self.blob()[..];
650647
let offset = METADATA_HEADER.len();
651648
let pos = (((slice[offset + 0] as u32) << 24)
652649
| ((slice[offset + 1] as u32) << 16)

0 commit comments

Comments
 (0)