- for arg in args {
- check_operand(tcx, mir, arg, span)?;
- }
- Ok(())
- } else {
- Err((
+ // some intrinsics are waved through if called inside the
+ // standard library. Users never need to call them directly
+ match tcx.fn_sig(def_id).abi() {
+ abi::Abi::RustIntrinsic => match &tcx.item_name(def_id).as_str()[..] {
+ | "size_of"
+ | "min_align_of"
+ | "needs_drop"
+ => {},
+ _ => return Err((
+ span,
+ "can only call a curated list of intrinsics in `min_const_fn`".into(),
+ )),
+ },
+ abi::Abi::Rust if tcx.is_min_const_fn(def_id) => {},
+ abi::Abi::Rust => return Err((