Rollup merge of #84404 - tmiasko:intrinsics-in-coercion-lub, r=Mark-Simulacrum
Check for intrinsics before coercing to a function pointer Return an error if coercing function items / non-capturing closures to a common function pointer type would require reifying an intrinsic. Turns ICE reported in #84297 into a proper error.
This commit is contained in:
commit
f180c1e05d
3 changed files with 26 additions and 1 deletions
|
@ -973,6 +973,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
}
|
||||
};
|
||||
if let (Some(a_sig), Some(b_sig)) = (a_sig, b_sig) {
|
||||
// Intrinsics are not coercible to function pointers.
|
||||
if a_sig.abi() == Abi::RustIntrinsic
|
||||
|| a_sig.abi() == Abi::PlatformIntrinsic
|
||||
|| b_sig.abi() == Abi::RustIntrinsic
|
||||
|| b_sig.abi() == Abi::PlatformIntrinsic
|
||||
{
|
||||
return Err(TypeError::IntrinsicCast);
|
||||
}
|
||||
// The signature must match.
|
||||
let a_sig = self.normalize_associated_types_in(new.span, a_sig);
|
||||
let b_sig = self.normalize_associated_types_in(new.span, b_sig);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue