mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 16:54:01 +00:00
Extra assertions in eval_body_using_ecx to disallow queries for
functions that does allocations
This commit is contained in:
parent
7cb74ed191
commit
de1cd4b36d
@ -132,7 +132,6 @@ pub use self::pointer::{Pointer, PointerArithmetic};
|
||||
/// Uniquely identifies one of the following:
|
||||
/// - A constant
|
||||
/// - A static
|
||||
/// - A const fn where all arguments (if any) are zero-sized types
|
||||
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, TyEncodable, TyDecodable)]
|
||||
#[derive(HashStable, Lift)]
|
||||
pub struct GlobalId<'tcx> {
|
||||
|
@ -30,6 +30,13 @@ fn eval_body_using_ecx<'mir, 'tcx>(
|
||||
body: &'mir mir::Body<'tcx>,
|
||||
) -> InterpResult<'tcx, MPlaceTy<'tcx>> {
|
||||
debug!("eval_body_using_ecx: {:?}, {:?}", cid, ecx.param_env);
|
||||
assert!(
|
||||
cid.promoted.is_some()
|
||||
|| matches!(
|
||||
ecx.tcx.hir().body_const_context(def_id),
|
||||
Some(ConstContext::Const | ConstContext::Static(_))
|
||||
)
|
||||
);
|
||||
let tcx = *ecx.tcx;
|
||||
let layout = ecx.layout_of(body.return_ty().subst(tcx, cid.instance.substs))?;
|
||||
assert!(!layout.is_unsized());
|
||||
|
Loading…
Reference in New Issue
Block a user