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 `panic!()` and `impl trait` #66523

Open
Aaron1011 opened this issue Nov 18, 2019 · 1 comment

Comments

@Aaron1011
Copy link
Contributor

@Aaron1011 Aaron1011 commented Nov 18, 2019

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!

@Centril

This comment has been minimized.

Copy link
Member

@Centril Centril commented Nov 19, 2019

(Sidenote: "cannot resolve" trips me up every time since it feels like it talking about name resolution, not type checking)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.