Skip to content

Commit 7969fd3

Browse files
committed
Fix encoder
1 parent af25358 commit 7969fd3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler/rustc_metadata/src/rmeta/encoder.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2233,7 +2233,7 @@ fn encode_metadata_impl(tcx: TyCtxt<'_>) -> EncodedMetadata {
22332233
// Encode the root position.
22342234
let header = METADATA_HEADER.len() + 8;
22352235
let pos = root.position.get();
2236-
result[header..header + 4].copy_from_slice(&pos.to_le_bytes());
2236+
result[header..header + 4].copy_from_slice(&u32::try_from(pos).unwrap().to_le_bytes());
22372237

22382238
// Record metadata size for self-profiling
22392239
tcx.prof.artifact_size("crate_metadata", "crate_metadata", result.len() as u64);

0 commit comments

Comments
 (0)