Skip to content

Commit

Permalink
Fix ICE for transmutability in candidate assembly
Browse files Browse the repository at this point in the history
Don't skip transmutability check just because there may be generics in the
ParamEnv.

Fixes #110467
  • Loading branch information
bryangarza committed Apr 19, 2023
1 parent 7908a1d commit 238756e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
obligation: &TraitObligation<'tcx>,
candidates: &mut SelectionCandidateSet<'tcx>,
) {
if obligation.has_non_region_param() {
if obligation.predicate.has_non_region_param() {
return;
}

Expand Down
17 changes: 17 additions & 0 deletions tests/ui/transmutability/issue-110467.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// check-pass
#![crate_type = "lib"]
#![feature(transmutability)]
use std::mem::BikeshedIntrinsicFrom;
pub struct Context;

pub fn is_maybe_transmutable<Src, Dst>()
where
Dst: BikeshedIntrinsicFrom<Src, Context>,
{
}

// The `T` here should not have any effect on checking
// if transmutability is allowed or not.
fn function_with_generic<T>() {
is_maybe_transmutable::<(), ()>();
}

0 comments on commit 238756e

Please sign in to comment.