diff options
Diffstat (limited to 'tests/ui/async-await/higher-ranked-auto-trait-12.rs')
| -rw-r--r-- | tests/ui/async-await/higher-ranked-auto-trait-12.rs | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/ui/async-await/higher-ranked-auto-trait-12.rs b/tests/ui/async-await/higher-ranked-auto-trait-12.rs new file mode 100644 index 00000000000..b1cca5cbb00 --- /dev/null +++ b/tests/ui/async-await/higher-ranked-auto-trait-12.rs @@ -0,0 +1,40 @@ +// Repro for <https://github.com/rust-lang/rust/issues/71671#issuecomment-848994782>. +//@ edition: 2021 +//@ revisions: assumptions no_assumptions +//@[assumptions] compile-flags: -Zhigher-ranked-assumptions +//@[assumptions] check-pass +//@[no_assumptions] known-bug: #110338 + +pub trait Robot { + type Id; +} + +pub type DynRobot = Box<dyn Robot<Id = u32> + Send>; + +impl Robot for DynRobot { + type Id = u32; +} + +struct IRobot<R: Robot> { + id: R::Id, + robot: R, +} + +// stand-in for tokio::spawn +fn this_is_send<T: Send>(value: T) -> T { + value +} + +async fn yield_now() {} + +fn test(source: DynRobot) { + let _my_task = this_is_send(async move { + let _my_iter = IRobot { + id: 32, + robot: source, + }; + yield_now().await; + }); +} + +fn main() {} |
