Skip to content

Commit

Permalink
Rollup merge of rust-lang#110510 - bryangarza:issue-110467-safe-trans…
Browse files Browse the repository at this point in the history
…mute, r=compiler-errors

Fix ICE for transmutability in candidate assembly

Don't skip transmutability check just because there may be generics in the ParamEnv.

Fixes rust-lang#110467
  • Loading branch information
matthiaskrgr authored Apr 19, 2023
2 parents e85b026 + 238756e commit fdd2f4b
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 fdd2f4b

Please sign in to comment.