2024-09-16 14:37:40 -05:00
|
|
|
// issue: #127737
|
|
|
|
//@ check-pass
|
2024-07-21 10:50:57 -05:00
|
|
|
//@ compile-flags: -Zmir-opt-level=5 --crate-type lib
|
|
|
|
|
2024-09-16 14:37:40 -05:00
|
|
|
//! This test is very similar to `invalid-unsized-const-eval.rs`, but also requires
|
|
|
|
//! checking for unsized types in the last field of each enum variant.
|
|
|
|
|
2024-07-21 10:50:57 -05:00
|
|
|
pub trait TestTrait {
|
|
|
|
type MyType;
|
|
|
|
fn func() -> Option<Self>
|
|
|
|
where
|
|
|
|
Self: Sized;
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<T> dyn TestTrait<MyType = T>
|
|
|
|
where
|
|
|
|
Self: Sized,
|
|
|
|
{
|
|
|
|
pub fn other_func() -> Option<Self> {
|
|
|
|
match Self::func() {
|
|
|
|
Some(me) => Some(me),
|
|
|
|
None => None,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|