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 A-impl-trait C-enhancement D-confusing D-terse F-impl_trait_in_bindings P-low requires-nightly T-compiler

Comments

@CDirkx
Copy link
Contributor

@CDirkx 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 F-impl_trait_in_bindings P-low D-confusing D-terse T-compiler A-impl-trait requires-nightly labels Apr 10, 2020
@JohnTitor JohnTitor added the C-enhancement label Apr 12, 2020
@estebank estebank self-assigned this Apr 19, 2020
estebank added a commit to estebank/rust that referenced this issue Apr 19, 2020
estebank added a commit to estebank/rust that referenced this issue Apr 21, 2020
estebank added a commit to estebank/rust that referenced this issue Apr 27, 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
P1n3appl3 pushed a commit to P1n3appl3/rust that referenced this issue Jun 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics A-impl-trait C-enhancement D-confusing D-terse F-impl_trait_in_bindings P-low requires-nightly T-compiler
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants