Skip to content

Commit b815532

Browse files
committed
try to fix ICE in fn_abi_of_instance
1 parent 90d7dad commit b815532

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Diff for: compiler/rustc_middle/src/ty/layout.rs

+7-4
Original file line numberDiff line numberDiff line change
@@ -2581,9 +2581,12 @@ impl<'tcx> ty::Instance<'tcx> {
25812581
// for `Instance` (e.g. typeck would use `Ty::fn_sig` instead),
25822582
// or should go through `FnAbi` instead, to avoid losing any
25832583
// adjustments `fn_abi_of_instance` might be performing.
2584-
fn fn_sig_for_fn_abi(&self, tcx: TyCtxt<'tcx>) -> ty::PolyFnSig<'tcx> {
2585-
// FIXME(davidtwco,eddyb): A `ParamEnv` should be passed through to this function.
2586-
let ty = self.ty(tcx, ty::ParamEnv::reveal_all());
2584+
fn fn_sig_for_fn_abi(
2585+
&self,
2586+
tcx: TyCtxt<'tcx>,
2587+
param_env: ty::ParamEnv<'tcx>,
2588+
) -> ty::PolyFnSig<'tcx> {
2589+
let ty = self.ty(tcx, param_env);
25872590
match *ty.kind() {
25882591
ty::FnDef(..) => {
25892592
// HACK(davidtwco,eddyb): This is a workaround for polymorphization considering
@@ -2965,7 +2968,7 @@ fn fn_abi_of_instance<'tcx>(
29652968
) -> Result<&'tcx FnAbi<'tcx, Ty<'tcx>>, FnAbiError<'tcx>> {
29662969
let (param_env, (instance, extra_args)) = query.into_parts();
29672970

2968-
let sig = instance.fn_sig_for_fn_abi(tcx);
2971+
let sig = instance.fn_sig_for_fn_abi(tcx, param_env);
29692972

29702973
let caller_location = if instance.def.requires_caller_location(tcx) {
29712974
Some(tcx.caller_location_ty())

0 commit comments

Comments
 (0)