rust/tests/crashes/138707.rs
2025-05-01 17:04:37 +02:00

38 lines
605 B
Rust

//@ known-bug: #138707
//@edition:2024
//@compile-flags: --crate-type lib
use core::marker::PhantomData;
struct LeftReflector<S> {
_phantom: PhantomData<S>,
}
struct DefaultAllocator {}
trait Allocator<R> {
type Buffer;
}
struct U2 {}
impl Allocator<U2> for DefaultAllocator {
type Buffer = [u8; 2];
}
impl<R> From<R> for LeftReflector<<DefaultAllocator as Allocator<R>>::Buffer>
where
DefaultAllocator: Allocator<R>,
{
fn from(_: R) -> Self {
todo!()
}
}
fn ice<D>(a: U2)
where
DefaultAllocator: Allocator<D>,
{
// ICE
let _ = LeftReflector::from(a);
}