diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
commit | 218caa410aa38c29984be31a5229b9fa717560ee (patch) | |
tree | c54bd55eeb6e4c508940a30e94c0032fbd45d677 /tests/ui/auto-traits/auto-trait-projection-recursion.rs | |
parent | Releasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip |
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/auto-traits/auto-trait-projection-recursion.rs')
-rw-r--r-- | tests/ui/auto-traits/auto-trait-projection-recursion.rs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/ui/auto-traits/auto-trait-projection-recursion.rs b/tests/ui/auto-traits/auto-trait-projection-recursion.rs new file mode 100644 index 000000000..a36f26f02 --- /dev/null +++ b/tests/ui/auto-traits/auto-trait-projection-recursion.rs @@ -0,0 +1,34 @@ +// Checking the `Send` bound in `main` requires: +// +// checking <C<'static> as Y>::P: Send +// which normalizes to Box<X<C<'?1>>>: Send +// which needs X<C<'?1>>: Send +// which needs <C<'?1> as Y>::P: Send +// +// At this point we used to normalize the predicate to `Box<X<C<'?2>>>: Send` +// and continue in a loop where we created new region variables to the +// recursion limit. To avoid this we now "canonicalize" region variables to +// lowest unified region vid. This means we instead have to prove +// `Box<X<C<'?1>>>: Send`, which we can because auto traits are coinductive. + +// check-pass + +// Avoid a really long error message if this regresses. +#![recursion_limit="20"] + +trait Y { + type P; +} + +impl<'a> Y for C<'a> { + type P = Box<X<C<'a>>>; +} + +struct C<'a>(&'a ()); +struct X<T: Y>(T::P); + +fn is_send<S: Send>() {} + +fn main() { + is_send::<X<C<'static>>>(); +} |