Skip to content

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

Closed

Description

@CDirkx

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

Activity

  1. added
    A-diagnostics
    F-impl_trait_in_bindings
    P-low
    D-confusing
    D-terse
    T-compiler
    A-impl-trait
    requires-nightly
    on Apr 10, 2020
  2. added
    C-enhancement
    on Apr 12, 2020
  3. self-assigned this
    on Apr 19, 2020
  4. added a commit that references this issue on Jun 15, 2020
    96f5584
  5. added a commit that references this issue on Jun 16, 2020
    dd582fe
  6. added a commit that references this issue on Jun 17, 2020
    c0d3f22
  7. added a commit that references this issue on Jun 18, 2020
    e9995fe
  8. added 2 commits that reference this issue on Jun 18, 2020
    2e9e434
    45d033b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-diagnosticsA-impl-traitC-enhancementD-confusingD-terseF-impl_trait_in_bindingsP-lowT-compilerrequires-nightly

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions