Skip to content

Commit cdfc7af

Browse files
committed
transpile: emit warning when we use align_of instead of pref_align_of
1 parent 32729ce commit cdfc7af

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

  • c2rust-transpile/src/translator

c2rust-transpile/src/translator/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3399,6 +3399,12 @@ impl<'c> Translation<'c> {
33993399
path.push(mk().path_segment("intrinsics"));
34003400
path.push(mk().path_segment_with_args("pref_align_of", mk().angle_bracketed_args(tys)));
34013401
} else {
3402+
if preferred {
3403+
warn!(
3404+
"using `core::mem::align_of` instead of `core::intrinsics::pref_align_of` \
3405+
for preferred alignment (`__alignof`/`__alignof__`) as the latter has been removed in Rust"
3406+
);
3407+
}
34023408
path.push(mk().path_segment("mem"));
34033409
path.push(mk().path_segment_with_args("align_of", mk().angle_bracketed_args(tys)));
34043410
}

0 commit comments

Comments
 (0)