-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
Closed
Labels
A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
trait Foo: Fn(i32) + Send {}
impl<T: ?Sized + Fn(i32) + Send> Foo for T {}
fn gives_foo() -> impl Foo {
let f = |x| println!("{}", x);
f
}
fn main() {
gives_foo()(42);
}yields
error[E0391]: cycle detected when processing `gives_foo::{{impl-Trait}}`
--> test.rs:5:19
|
5 | fn gives_foo() -> impl Foo {
| ^^^^^^^^
|
note: ...which requires processing `gives_foo::{{impl-Trait}}`...
--> test.rs:5:19
|
5 | fn gives_foo() -> impl Foo {
| ^^^^^^^^
note: ...which requires processing `gives_foo::{{impl-Trait}}`...
--> test.rs:5:19
|
5 | fn gives_foo() -> impl Foo {
| ^^^^^^^^
= note: ...which again requires processing `gives_foo::{{impl-Trait}}`, completing the cycle
note: cycle used when processing `gives_foo`
--> test.rs:5:1
|
5 | fn gives_foo() -> impl Foo {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
I originally thought this was my PR #55101 that was at fault, but I've now confirmed this bug occurs on master, so it looks like it isn't... not in the latest nightly though, as of now, so it must have been a recent PR.
Metadata
Metadata
Assignees
Labels
A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.