diff options
| author | Jubilee <workingjubilee@gmail.com> | 2025-06-13 20:59:17 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-13 20:59:17 -0700 |
| commit | 179bcf6805a88cab439f9bb5ad4e57aeb1b21cfa (patch) | |
| tree | a02574e088474916fe117dfdd07ae7a6db9916ee | |
| parent | 4db9554358d85ddd86d71a7ca5477c65321d9523 (diff) | |
| parent | de4e7adc966e0e1a6aaff455fbeaf979b80f461c (diff) | |
| download | rust-179bcf6805a88cab439f9bb5ad4e57aeb1b21cfa.tar.gz rust-179bcf6805a88cab439f9bb5ad4e57aeb1b21cfa.zip | |
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
| -rw-r--r-- | compiler/rustc_const_eval/src/interpret/intrinsics.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/intrinsics.rs b/compiler/rustc_const_eval/src/interpret/intrinsics.rs index 754b2ba0d76..96c39c7bb32 100644 --- a/compiler/rustc_const_eval/src/interpret/intrinsics.rs +++ b/compiler/rustc_const_eval/src/interpret/intrinsics.rs @@ -139,13 +139,13 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { sym::needs_drop | sym::type_id | sym::type_name | sym::variant_count => { let gid = GlobalId { instance, promoted: None }; - let ty = match intrinsic_name { - sym::variant_count => self.tcx.types.usize, - sym::needs_drop => self.tcx.types.bool, - sym::type_id => self.tcx.types.u128, - sym::type_name => Ty::new_static_str(self.tcx.tcx), - _ => bug!(), - }; + let ty = self + .tcx + .fn_sig(instance.def_id()) + .instantiate(self.tcx.tcx, instance.args) + .output() + .no_bound_vars() + .unwrap(); let val = self .ctfe_query(|tcx| tcx.const_eval_global_id(self.typing_env, gid, tcx.span))?; let val = self.const_val_to_op(val, ty, Some(dest.layout))?; |
