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

Bad second error about Copy reference #50480

Closed
remexre opened this issue May 6, 2018 · 1 comment · Fixed by #50536
Closed

Bad second error about Copy reference #50480

remexre opened this issue May 6, 2018 · 1 comment · Fixed by #50536
Labels
A-diagnostics Area: Messages for errors, warnings, and lints

Comments

@remexre
Copy link
Contributor

remexre commented May 6, 2018

The code

#[derive(Clone, Copy)]
struct Foo<'a>(&'a NotDefined);

fn main() {}

results in

error[E0412]: cannot find type `NotDefined` in this scope
 --> src/main.rs:2:20
  |
2 | struct Foo<'a>(&'a NotDefined);
  |                    ^^^^^^^^^^ not found in this scope

error[E0204]: the trait `Copy` may not be implemented for this type
 --> src/main.rs:1:17
  |
1 | #[derive(Clone, Copy)]
  |                 ^^^^
2 | struct Foo<'a>(&'a NotDefined);
  |                --------------- this field does not implement `Copy`

Many warnings can end up between these two, so somebody who starts reading errors from the bottom up can become very confused.

@estebank estebank added the A-diagnostics Area: Messages for errors, warnings, and lints label May 7, 2018
@leoyvens
Copy link
Contributor

leoyvens commented May 7, 2018

I'm working on a fix.

bors added a commit that referenced this issue May 12, 2018
…derive, r=estebank

Better error reporting in Copy derive

In Copy derive, report all fulfillment erros when present and do not report errors for types tainted with `TyErr`. Also report all fields which are not Copy rather than just the first.

Also refactored `fn fully_normalize`, removing the not very useful helper function along with a FIXME to the closed issue #26721 that looks out of context now.

Fixes #50480

r? @estebank
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants