diff options
| author | Caleb Zulawski <caleb.zulawski@gmail.com> | 2022-08-04 03:49:16 +0000 |
|---|---|---|
| committer | Caleb Zulawski <caleb.zulawski@gmail.com> | 2022-08-04 03:49:16 +0000 |
| commit | d00928aa69512c02490fcb228a70ad5c3f865613 (patch) | |
| tree | f98c99c124ecf4e42d3096e4ca6dcd2c784aac0f | |
| parent | e2866c0a673ebe073ebfdd4b48b5f09508d143f6 (diff) | |
| download | rust-d00928aa69512c02490fcb228a70ad5c3f865613.tar.gz rust-d00928aa69512c02490fcb228a70ad5c3f865613.zip | |
Require pointers to be sized
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/intrinsic.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/compiler/rustc_codegen_llvm/src/intrinsic.rs b/compiler/rustc_codegen_llvm/src/intrinsic.rs index 78afbdfc521..45463f96b8b 100644 --- a/compiler/rustc_codegen_llvm/src/intrinsic.rs +++ b/compiler/rustc_codegen_llvm/src/intrinsic.rs @@ -1718,11 +1718,19 @@ unsupported {} from `{}` with element `{}` of size `{}` to `{}`"#, ); match in_elem.kind() { - ty::RawPtr(_) => {} + ty::RawPtr(p) => require!( + p.ty.is_sized(bx.tcx.at(span), ty::ParamEnv::reveal_all()), + "cannot cast pointer to unsized type `{}`", + in_elem + ), _ => return_error!("expected pointer, got `{}`", in_elem), } match out_elem.kind() { - ty::RawPtr(_) => {} + ty::RawPtr(p) => require!( + p.ty.is_sized(bx.tcx.at(span), ty::ParamEnv::reveal_all()), + "cannot cast to pointer to unsized type `{}`", + out_elem + ), _ => return_error!("expected pointer, got `{}`", out_elem), } |
