insert dummy 4 bytes to avoid the breaking change
This commit is contained in:
parent
e11dd802c1
commit
8d35ff16d2
compiler/rustc_metadata/src/rmeta
@ -682,7 +682,7 @@ impl MetadataBlob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn get_rustc_version(&self) -> String {
|
pub(crate) fn get_rustc_version(&self) -> String {
|
||||||
LazyValue::<String>::from_position(NonZeroUsize::new(METADATA_HEADER.len()).unwrap())
|
LazyValue::<String>::from_position(NonZeroUsize::new(METADATA_HEADER.len() + 4).unwrap())
|
||||||
.decode(self)
|
.decode(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2221,6 +2221,11 @@ fn encode_metadata_impl(tcx: TyCtxt<'_>, path: impl AsRef<Path>) {
|
|||||||
.unwrap_or_else(|err| tcx.sess.fatal(&format!("failed to create file encoder: {}", err)));
|
.unwrap_or_else(|err| tcx.sess.fatal(&format!("failed to create file encoder: {}", err)));
|
||||||
encoder.emit_raw_bytes(METADATA_HEADER);
|
encoder.emit_raw_bytes(METADATA_HEADER);
|
||||||
|
|
||||||
|
// Though we had holded the root position historically in this place, we moved it to the end
|
||||||
|
// of all emitted bytes by #96544. Therefore, now these 4 bytes are just a dummy to avoid the
|
||||||
|
// breaking change.
|
||||||
|
encoder.emit_raw_bytes(&[0, 0, 0, 0]).unwrap();
|
||||||
|
|
||||||
let source_map_files = tcx.sess.source_map().files();
|
let source_map_files = tcx.sess.source_map().files();
|
||||||
let source_file_cache = (source_map_files[0].clone(), 0);
|
let source_file_cache = (source_map_files[0].clone(), 0);
|
||||||
let required_source_files = Some(GrowableBitSet::with_capacity(source_map_files.len()));
|
let required_source_files = Some(GrowableBitSet::with_capacity(source_map_files.len()));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user