Open
Description
#![feature(existential_type)]
use std::rc::Rc;
existential type Foo: Fn() -> usize;
fn foo() -> Foo {
let rc = Rc::new(5);
move || { *rc.as_ref() }
}
fn assert_send<T: Send>(_: &T) {
}
fn main() {
let f = foo();
assert_send(&f);
println!("{}", f());
}
error[E0391]: cycle detected when processing `Foo`
--> src/main.rs:5:1
|
5 | existential type Foo: Fn() -> usize;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: ...which requires processing `main`...
--> src/main.rs:15:1
|
15| fn main() {
| ^^^^^^^^^
note: ...which requires evaluating trait selection obligation `Foo: std::marker::Send`...
= note: ...which again requires processing `Foo`, completing the cycle
Commenting out the assert_send(&f);
line compiles and runs fine (playground), moving Foo
and foo
into a sub-module correctly identifies that Foo: !Send
(playground).
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.`#[feature(type_alias_impl_trait)]`Issue: A query cycle occurred while none was expectedRelevant to the compiler team, which will review and decide on the PR/issue.This issue requires a nightly compiler in some way.
Type
Projects
Status
Can do after stabilization