• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Checking the `Send` bound in `main` requires:
2 //
3 // checking             <C<'static> as Y>::P: Send
4 // which normalizes to  Box<X<C<'?1>>>: Send
5 // which needs          X<C<'?1>>: Send
6 // which needs          <C<'?1> as Y>::P: Send
7 //
8 // At this point we used to normalize the predicate to `Box<X<C<'?2>>>: Send`
9 // and continue in a loop where we created new region variables to the
10 // recursion limit. To avoid this we now "canonicalize" region variables to
11 // lowest unified region vid. This means we instead have to prove
12 // `Box<X<C<'?1>>>: Send`, which we can because auto traits are coinductive.
13 
14 // check-pass
15 
16 // Avoid a really long error message if this regresses.
17 #![recursion_limit="20"]
18 
19 trait Y {
20     type P;
21 }
22 
23 impl<'a> Y for C<'a> {
24     type P = Box<X<C<'a>>>;
25 }
26 
27 struct C<'a>(&'a ());
28 struct X<T: Y>(T::P);
29 
is_send<S: Send>()30 fn is_send<S: Send>() {}
31 
main()32 fn main() {
33     is_send::<X<C<'static>>>();
34 }
35