1
Fork 0

Instantiate higher-ranked transmute goal

This commit is contained in:
Michael Goulet 2025-04-08 17:00:11 +00:00
parent c6c179662d
commit 68692b7fbb
2 changed files with 21 additions and 3 deletions

View file

@ -317,7 +317,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
obligation.cause.clone(),
obligation.recursion_depth + 1,
obligation.param_env,
obligation.predicate.rebind(trait_ref),
trait_ref,
)
};
@ -343,7 +343,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
obligation.cause.clone(),
obligation.recursion_depth + 1,
obligation.param_env,
obligation.predicate.rebind(outlives),
outlives,
)
};
@ -404,7 +404,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
}
}
let predicate = obligation.predicate.skip_binder();
let predicate = self.infcx.enter_forall_and_leak_universe(obligation.predicate);
let mut assume = predicate.trait_ref.args.const_at(2);
// FIXME(mgca): We should shallowly normalize this.

View file

@ -0,0 +1,18 @@
// Ensure we don't ICE when transmuting higher-ranked types via a
// higher-ranked transmute goal.
//@ check-pass
#![feature(transmutability)]
use std::mem::TransmuteFrom;
pub fn transmute()
where
for<'a> &'a &'a i32: TransmuteFrom<&'a &'a u32>,
{
}
fn main() {
transmute();
}