rust/tests/ui/dyn-star/enum-cast.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

24 lines
409 B
Rust
Raw Normal View History

//@ check-pass
// This used to ICE, because the compiler confused a pointer-like to dyn* coercion
// with a c-like enum to integer cast.
2024-11-20 02:46:56 +00:00
#![feature(dyn_star, pointer_like_trait)]
#![expect(incomplete_features)]
2024-11-20 02:46:56 +00:00
use std::marker::PointerLike;
#[repr(transparent)]
enum E {
Num(usize),
}
2024-11-20 02:46:56 +00:00
impl PointerLike for E {}
trait Trait {}
impl Trait for E {}
fn main() {
let _ = E::Num(42) as dyn* Trait;
}