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

Better errors when a Copy impl on a Struct is not self-consistent #94249

Merged
merged 1 commit into from
Mar 24, 2022

Conversation

compiler-errors
Copy link
Member

@compiler-errors compiler-errors commented Feb 22, 2022

As discovered in a Zulip thread with @nnethercote and @Mark-Simulacrum, it's not immediately obvious why a field on an ADT doesn't implement Copy. This PR attempts to give slightly more detailed information by spinning up a fulfillment context to try to dig down and discover transitive fulfillment errors that cause is_copy_modulo_regions to fail on a ADT field.

The error message still kinda sucks, but should only show up in the case that an existing error message was totally missing... so I think it's a good compromise for now?

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Feb 22, 2022
@rust-highfive
Copy link
Collaborator

r? @davidtwco

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 22, 2022
Copy link
Member

@davidtwco davidtwco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies for the slow review, I think this is a sensible change and looks good. I've left a small comment, if it seems feasible to fix without a lot more work then we can do that before landing this, otherwise it can be a follow-up.

@davidtwco davidtwco added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 1, 2022
@compiler-errors
Copy link
Member Author

@rustbot ready

I left a FIXME, but otherwise just rebased this code.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 23, 2022
@davidtwco
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Mar 23, 2022

📌 Commit c8cbd3d has been approved by davidtwco

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 23, 2022
@bors
Copy link
Contributor

bors commented Mar 23, 2022

⌛ Testing commit c8cbd3d with merge 5114b946e9d2e10226feb30bec8c2f2e24fe3113...

@bors
Copy link
Contributor

bors commented Mar 23, 2022

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Mar 23, 2022
@rust-log-analyzer
Copy link
Collaborator

The job armhf-gnu failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
failures:

---- [ui] ui/imports/glob-use-std.rs stdout ----

error: error pattern 'panic works' not found!
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/remote-test-client" "run" "0" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/imports/glob-use-std/a"
--- stdout -------------------------------
uploaded "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/imports/glob-use-std/a", waiting for result
------------------------------------------
------------------------------------------
--- stderr -------------------------------
thread 'main' panicked at 'client.read_exact(&mut header) failed with Connection reset by peer (os error 104)', src/tools/remote-test-client/src/main.rs:310:9
------------------------------------------



@compiler-errors
Copy link
Member Author

can someone bors-retry this? spurious error it seems.

@nnethercote
Copy link
Contributor

@bors retry

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 23, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 23, 2022
…askrgr

Rollup of 5 pull requests

Successful merges:

 - rust-lang#94249 (Better errors when a Copy impl on a Struct is not self-consistent)
 - rust-lang#95069 (Fix auto traits in rustdoc)
 - rust-lang#95221 (interpret/memory: simplify check_and_deref_ptr)
 - rust-lang#95225 (remove `[async output]` from `impl Future` pretty-printing)
 - rust-lang#95238 (Stop emitting E0026 for struct enums with underscores)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit af19a50 into rust-lang:master Mar 24, 2022
@rustbot rustbot added this to the 1.61.0 milestone Mar 24, 2022
@compiler-errors compiler-errors deleted the better-copy-errors branch April 7, 2022 04:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants