Skip to content

Commit f1204cf

Browse files
authored
Unrolled build for #151373
Rollup merge of #151373 - issue-151300, r=lcnr Fix an ICE on transmute goals with placeholders in `param_env` Fixes #151300 The next solver short-circuits `consider_builtin_transmute_candidate` when the goal contains non-region placeholders, since `rustc_transmute` does not support type parameters. However, this check should likely be refined to apply only to the predicate itself: excess bounds with type params in the param env can cause the goal to be rejected even when its predicate trivially holds. r? types
2 parents 5c49c4f + 328893e commit f1204cf

2 files changed

Lines changed: 22 additions & 1 deletion

File tree

compiler/rustc_next_trait_solver/src/solve/trait_goals.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@ where
659659
}
660660

661661
// `rustc_transmute` does not have support for type or const params
662-
if goal.has_non_region_placeholders() {
662+
if goal.predicate.has_non_region_placeholders() {
663663
return Err(NoSolution);
664664
}
665665

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//@ revisions: current next
2+
//@ ignore-compare-mode-next-solver (explicit revisions)
3+
//@ [next] compile-flags: -Znext-solver
4+
//@ check-pass
5+
6+
// A regression test for https://github.com/rust-lang/rust/issues/151300
7+
8+
#![feature(transmutability)]
9+
use std::mem::TransmuteFrom;
10+
11+
pub fn is_maybe_transmutable<Src, Dst>()
12+
where
13+
Dst: TransmuteFrom<Src>,
14+
{
15+
}
16+
17+
fn function_with_generic<T>() {
18+
is_maybe_transmutable::<(), ()>();
19+
}
20+
21+
fn main() {}

0 commit comments

Comments
 (0)