Skip to content

Confusing error message with panic!() and impl trait #66523

Description

@Aaron1011

The following code:

fn bar() -> Vec<impl Copy> {
    panic!()
}

Currently gives the following error:

error[E0283]: type annotations required: cannot resolve `_: std::marker::Copy`
 --> src/lib.rs:1:17
  |
1 | fn bar() -> Vec<impl Copy> {
  |                 ^^^^^^^^^
  |
  = note: the return type of a function must have a statically known size

This message has a weird span, and doesn't give any clue that the problem lies with the call to panic!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsA-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.C-enhancementCategory: An issue proposing an enhancement or a PR with one.D-confusingDiagnostics: Confusing error or lint that should be reworked.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions