]> git.lizzy.rs Git - rust.git/blob - src/test/ui/fn/implied-bounds-unnorm-associated-type-3.rs
Rollup merge of #98640 - cuviper:stable-rust-analyzer, r=Mark-Simulacrum
[rust.git] / src / test / ui / fn / implied-bounds-unnorm-associated-type-3.rs
1 // check-fail
2 // See issue #91899. If we treat unnormalized args as WF, `Self` can also be a
3 // source of unsoundness.
4
5 pub trait Yokeable<'a>: 'static {
6     type Output: 'a;
7 }
8
9 impl<'a, T: 'static + ?Sized> Yokeable<'a> for &'static T {
10     type Output = &'a T;
11 }
12
13 pub trait ZeroCopyFrom<C: ?Sized>: for<'a> Yokeable<'a> {
14     /// Clone the cart `C` into a [`Yokeable`] struct, which may retain references into `C`.
15     fn zero_copy_from<'b>(cart: &'b C) -> <Self as Yokeable<'b>>::Output;
16 }
17
18 impl<T> ZeroCopyFrom<[T]> for &'static [T] {
19     fn zero_copy_from<'b>(cart: &'b [T]) -> &'b [T] {
20         //~^ the parameter
21         cart
22     }
23 }
24
25 fn main() {}