Require pointers to be sized
This commit is contained in:
parent
e2866c0a67
commit
d00928aa69
1 changed files with 10 additions and 2 deletions
|
@ -1718,11 +1718,19 @@ unsupported {} from `{}` with element `{}` of size `{}` to `{}`"#,
|
||||||
);
|
);
|
||||||
|
|
||||||
match in_elem.kind() {
|
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),
|
_ => return_error!("expected pointer, got `{}`", in_elem),
|
||||||
}
|
}
|
||||||
match out_elem.kind() {
|
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),
|
_ => return_error!("expected pointer, got `{}`", out_elem),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue