Skip to content

Commit dcbde75

Browse files
authored
Unrolled build for #142405
Rollup merge of #142405 - oli-obk:type-once, r=RalfJung Don't hardcode the intrinsic return types twice in the compiler We already manually check intrinsic types in intrinsicck so we don't need to do it in the interpreter
2 parents 64c81fd + de4e7ad commit dcbde75

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

compiler/rustc_const_eval/src/interpret/intrinsics.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,13 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
139139

140140
sym::needs_drop | sym::type_id | sym::type_name | sym::variant_count => {
141141
let gid = GlobalId { instance, promoted: None };
142-
let ty = match intrinsic_name {
143-
sym::variant_count => self.tcx.types.usize,
144-
sym::needs_drop => self.tcx.types.bool,
145-
sym::type_id => self.tcx.types.u128,
146-
sym::type_name => Ty::new_static_str(self.tcx.tcx),
147-
_ => bug!(),
148-
};
142+
let ty = self
143+
.tcx
144+
.fn_sig(instance.def_id())
145+
.instantiate(self.tcx.tcx, instance.args)
146+
.output()
147+
.no_bound_vars()
148+
.unwrap();
149149
let val = self
150150
.ctfe_query(|tcx| tcx.const_eval_global_id(self.typing_env, gid, tcx.span))?;
151151
let val = self.const_val_to_op(val, ty, Some(dest.layout))?;

0 commit comments

Comments
 (0)