diff options
Diffstat (limited to 'tests/ui/self')
| -rw-r--r-- | tests/ui/self/dispatch-from-dyn-layout-2.rs | 16 | ||||
| -rw-r--r-- | tests/ui/self/dispatch-from-dyn-layout-3.rs | 19 | ||||
| -rw-r--r-- | tests/ui/self/dispatch-from-dyn-layout.rs | 15 |
3 files changed, 50 insertions, 0 deletions
diff --git a/tests/ui/self/dispatch-from-dyn-layout-2.rs b/tests/ui/self/dispatch-from-dyn-layout-2.rs new file mode 100644 index 00000000000..cd52f060dc8 --- /dev/null +++ b/tests/ui/self/dispatch-from-dyn-layout-2.rs @@ -0,0 +1,16 @@ +//@ check-pass +// Regression test for #90110. + +// Make sure that object safety checking doesn't freak out when +// we have impossible-to-satisfy `Sized` predicates. + +trait Parser +where + for<'a> (dyn Parser + 'a): Sized, +{ + fn parse_line(&self); +} + +fn foo(_: &dyn Parser) {} + +fn main() {} diff --git a/tests/ui/self/dispatch-from-dyn-layout-3.rs b/tests/ui/self/dispatch-from-dyn-layout-3.rs new file mode 100644 index 00000000000..6878a4f4ac2 --- /dev/null +++ b/tests/ui/self/dispatch-from-dyn-layout-3.rs @@ -0,0 +1,19 @@ +//@ check-pass + +// Make sure that object safety checking doesn't freak out when +// we have impossible-to-satisfy `DispatchFromDyn` predicates. + +#![feature(dispatch_from_dyn)] +#![feature(arbitrary_self_types)] + +use std::ops::Deref; +use std::ops::DispatchFromDyn; + +trait Trait<T: Deref<Target = Self>> +where + for<'a> &'a T: DispatchFromDyn<&'a T>, +{ + fn foo(self: &T) -> Box<dyn Trait<T>>; +} + +fn main() {} diff --git a/tests/ui/self/dispatch-from-dyn-layout.rs b/tests/ui/self/dispatch-from-dyn-layout.rs new file mode 100644 index 00000000000..468dc89a73e --- /dev/null +++ b/tests/ui/self/dispatch-from-dyn-layout.rs @@ -0,0 +1,15 @@ +//@ check-pass +// Regression test for #57276. + +// Make sure that object safety checking doesn't freak out when +// we have impossible-to-satisfy `DispatchFromDyn` predicates. + +#![feature(arbitrary_self_types, dispatch_from_dyn)] + +use std::ops::{Deref, DispatchFromDyn}; + +trait Trait<T: Deref<Target = Self> + DispatchFromDyn<T>> { + fn foo(self: T) -> dyn Trait<T>; +} + +fn main() {} |
