Skip to content

Commit 238756e

Browse files
committed
Fix ICE for transmutability in candidate assembly
Don't skip transmutability check just because there may be generics in the ParamEnv. Fixes #110467
1 parent 7908a1d commit 238756e

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
775775
obligation: &TraitObligation<'tcx>,
776776
candidates: &mut SelectionCandidateSet<'tcx>,
777777
) {
778-
if obligation.has_non_region_param() {
778+
if obligation.predicate.has_non_region_param() {
779779
return;
780780
}
781781

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// check-pass
2+
#![crate_type = "lib"]
3+
#![feature(transmutability)]
4+
use std::mem::BikeshedIntrinsicFrom;
5+
pub struct Context;
6+
7+
pub fn is_maybe_transmutable<Src, Dst>()
8+
where
9+
Dst: BikeshedIntrinsicFrom<Src, Context>,
10+
{
11+
}
12+
13+
// The `T` here should not have any effect on checking
14+
// if transmutability is allowed or not.
15+
fn function_with_generic<T>() {
16+
is_maybe_transmutable::<(), ()>();
17+
}

0 commit comments

Comments
 (0)