Skip to content

Instantiate higher-ranked transmute goal w/ placeholders before emitting sub-obligations #139541

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
};

Expand All @@ -343,7 +343,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
obligation.cause.clone(),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bad freeze obl was being constructed on line 335 above.

obligation.recursion_depth + 1,
obligation.param_env,
obligation.predicate.rebind(outlives),
outlives,
)
};

Expand Down Expand Up @@ -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.
Expand Down
18 changes: 18 additions & 0 deletions tests/ui/transmutability/transmute-higher-ranked.rs
Original file line number Diff line number Diff line change
@@ -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();
}
Loading