Open
Description
Minimal Example
main.rs
use std::pin::Pin;
use futures::Future;
trait MyTrait {
type Value;
type Future;
}
impl<S> MyTrait for &S where S: MyTrait {}
struct MyStruct<S>;
impl MyTrait for MyStruct<dyn MyTrait<
Value = usize,
Future = Pin<Box<dyn Future<Output = Option<usize>>>>,
>>
where Self::Future: 'static
{
type Value = usize;
type Future = Pin<Box<dyn Future<Output = Option<Self::Value>>>>;
}
fn main() {}
Cargo.toml
[package]
name = "rust-playground"
version = "0.1.0"
edition = "2021"
[dependencies]
futures = "0.3.14"
Meta
rustc --version --verbose
:
rustc 1.59.0-nightly (0fb1c371d 2021-12-06)
binary: rustc
commit-hash: 0fb1c371d4a14f9ce7a721d8aea683a6e6774f6c
commit-date: 2021-12-06
host: aarch64-apple-darwin
release: 1.59.0-nightly
LLVM version: 13.0.0
Error output
It doesn't produce error output, the compiler hangs indefinitely. However, simplifying the example in any way seems to uncover a bunch of "overflow evaluating the requirement" errors. For example, by commenting out the first implementation of the trait, one of the errors is:
error[E0275]: overflow evaluating the requirement `<MyStruct<(dyn MyTrait<Value = usize, Future = Pin<Box<(dyn futures::Future<Output = Option<usize>> + 'static)>>> + 'static)> as MyTrait>::Future == _`
--> src/main.rs:13:1
|
13 | / impl MyTrait for MyStruct<dyn MyTrait<
14 | | Value = usize,
15 | | Future = Pin<Box<dyn Future<Output = Option<usize>>>>,
16 | | >>
... |
20 | | type Future = Pin<Box<dyn Future<Output = Option<Self::Value>>>>;
21 | | }
| |_^
|
note: required because of the requirements on the impl of `MyTrait` for `MyStruct<(dyn MyTrait<Value = usize, Future = Pin<Box<(dyn futures::Future<Output = Option<usize>> + 'static)>>> + 'static)>`
--> src/main.rs:13:6
|
13 | impl MyTrait for MyStruct<dyn MyTrait<
| ______^^^^^^^_____^
14 | | Value = usize,
15 | | Future = Pin<Box<dyn Future<Output = Option<usize>>>>,
16 | | >>
| |__^
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity