Rollup merge of #151373 - issue-151300, r=lcnr
Fix an ICE on transmute goals with placeholders in `param_env` Fixes rust-lang/rust#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
This commit is contained in:
commit
c05083582c
2 changed files with 22 additions and 1 deletions
|
|
@ -659,7 +659,7 @@ where
|
|||
}
|
||||
|
||||
// `rustc_transmute` does not have support for type or const params
|
||||
if goal.has_non_region_placeholders() {
|
||||
if goal.predicate.has_non_region_placeholders() {
|
||||
return Err(NoSolution);
|
||||
}
|
||||
|
||||
|
|
|
|||
21
tests/ui/transmutability/transmute-with-type-params.rs
Normal file
21
tests/ui/transmutability/transmute-with-type-params.rs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
//@ revisions: current next
|
||||
//@ ignore-compare-mode-next-solver (explicit revisions)
|
||||
//@ [next] compile-flags: -Znext-solver
|
||||
//@ check-pass
|
||||
|
||||
// A regression test for https://github.com/rust-lang/rust/issues/151300
|
||||
|
||||
#![feature(transmutability)]
|
||||
use std::mem::TransmuteFrom;
|
||||
|
||||
pub fn is_maybe_transmutable<Src, Dst>()
|
||||
where
|
||||
Dst: TransmuteFrom<Src>,
|
||||
{
|
||||
}
|
||||
|
||||
fn function_with_generic<T>() {
|
||||
is_maybe_transmutable::<(), ()>();
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue