Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confusing error message with let _ : impl Trait; #70968

Closed
CDirkx opened this issue Apr 10, 2020 · 0 comments · Fixed by #71338
Closed

Confusing error message with let _ : impl Trait; #70968

CDirkx opened this issue Apr 10, 2020 · 0 comments · Fixed by #71338
Assignees
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. C-enhancement Category: An issue proposing an enhancement or a PR with one. D-confusing Diagnostics: Confusing error or lint that should be reworked. D-terse Diagnostics: An error or lint that doesn't give enough information about the problem at hand. F-impl_trait_in_bindings `#![feature(impl_trait_in_bindings)]` P-low Low priority requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@CDirkx
Copy link
Contributor

CDirkx commented Apr 10, 2020

A let binding with an existential type annotation and without an initializer expression results in error[E0720]: opaque type expands to a recursive type.

#![feature(impl_trait_in_bindings)]

fn foo() {
    let _ : impl Copy;
}
error[E0720]: opaque type expands to a recursive type
 --> src/lib.rs:4:13
  |
4 |     let _ : impl Copy;
  |             ^^^^^^^^^ expands to a recursive type
  |
  = note: type resolves to itself

(playground)

The mention of recursion here distracts from the actual problem (the type could not be resolved to/satisfied as a concrete type) and no hint is given how to fix this error.

Related: #66523

@Centril Centril added A-diagnostics Area: Messages for errors, warnings, and lints F-impl_trait_in_bindings `#![feature(impl_trait_in_bindings)]` P-low Low priority D-confusing Diagnostics: Confusing error or lint that should be reworked. D-terse Diagnostics: An error or lint that doesn't give enough information about the problem at hand. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. requires-nightly This issue requires a nightly compiler in some way. labels Apr 10, 2020
@JohnTitor JohnTitor added the C-enhancement Category: An issue proposing an enhancement or a PR with one. label Apr 12, 2020
@estebank estebank self-assigned this Apr 19, 2020
Manishearth added a commit to Manishearth/rust that referenced this issue Jun 16, 2020
…komatsakis

Expand "recursive opaque type" diagnostic

Fix rust-lang#70968, partially address rust-lang#66523.
tmandry added a commit to tmandry/rust that referenced this issue Jun 17, 2020
…komatsakis

Expand "recursive opaque type" diagnostic

Fix rust-lang#70968, partially address rust-lang#66523.
RalfJung added a commit to RalfJung/rust that referenced this issue Jun 18, 2020
…komatsakis

Expand "recursive opaque type" diagnostic

Fix rust-lang#70968, partially address rust-lang#66523.
Manishearth added a commit to Manishearth/rust that referenced this issue Jun 18, 2020
…komatsakis

Expand "recursive opaque type" diagnostic

Fix rust-lang#70968, partially address rust-lang#66523.
Manishearth added a commit to Manishearth/rust that referenced this issue Jun 18, 2020
…komatsakis

Expand "recursive opaque type" diagnostic

Fix rust-lang#70968, partially address rust-lang#66523.
@bors bors closed this as completed in 96f5584 Jun 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. C-enhancement Category: An issue proposing an enhancement or a PR with one. D-confusing Diagnostics: Confusing error or lint that should be reworked. D-terse Diagnostics: An error or lint that doesn't give enough information about the problem at hand. F-impl_trait_in_bindings `#![feature(impl_trait_in_bindings)]` P-low Low priority requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants