Skip to content

Commit d00928a

Browse files
committed
Require pointers to be sized
1 parent e2866c0 commit d00928a

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

compiler/rustc_codegen_llvm/src/intrinsic.rs

+10-2
Original file line numberDiff line numberDiff line change
@@ -1718,11 +1718,19 @@ unsupported {} from `{}` with element `{}` of size `{}` to `{}`"#,
17181718
);
17191719

17201720
match in_elem.kind() {
1721-
ty::RawPtr(_) => {}
1721+
ty::RawPtr(p) => require!(
1722+
p.ty.is_sized(bx.tcx.at(span), ty::ParamEnv::reveal_all()),
1723+
"cannot cast pointer to unsized type `{}`",
1724+
in_elem
1725+
),
17221726
_ => return_error!("expected pointer, got `{}`", in_elem),
17231727
}
17241728
match out_elem.kind() {
1725-
ty::RawPtr(_) => {}
1729+
ty::RawPtr(p) => require!(
1730+
p.ty.is_sized(bx.tcx.at(span), ty::ParamEnv::reveal_all()),
1731+
"cannot cast to pointer to unsized type `{}`",
1732+
out_elem
1733+
),
17261734
_ => return_error!("expected pointer, got `{}`", out_elem),
17271735
}
17281736

0 commit comments

Comments
 (0)