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

Detect mistyped associated consts in Instance::resolve. #70970

Merged
merged 2 commits into from
Apr 22, 2020

Conversation

eddyb
Copy link
Member

@eddyb eddyb commented Apr 10, 2020

Based on #71049 to prevent redundant/misleading downstream errors.

Fixes #70942 by refusing to resolve an associated const if it doesn't have the same type in the impl that it does in the trait (which we assume had errored, and delay_span_bug guards against bugs).

@rust-highfive
Copy link
Collaborator

r? @petrochenkov

(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 Apr 10, 2020
@eddyb
Copy link
Member Author

eddyb commented Apr 10, 2020

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion

@bors
Copy link
Contributor

bors commented Apr 10, 2020

⌛ Trying commit 65ce0985c9462170b4ee97b1f9af493ac6d2976b with merge 2ffb9a054b7827a50003601cf5c67a1f483cc0c1...

@bors
Copy link
Contributor

bors commented Apr 10, 2020

☀️ Try build successful - checks-azure
Build commit: 2ffb9a054b7827a50003601cf5c67a1f483cc0c1 (2ffb9a054b7827a50003601cf5c67a1f483cc0c1)

@rust-timer
Copy link
Collaborator

Queued 2ffb9a054b7827a50003601cf5c67a1f483cc0c1 with parent 0c835b0, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit 2ffb9a054b7827a50003601cf5c67a1f483cc0c1, comparison URL.

@eddyb
Copy link
Member Author

eddyb commented Apr 10, 2020

Huh, I guess this is fast enough.

r? @oli-obk cc @nikomatsakis

@RalfJung
Copy link
Member

RalfJung commented Apr 10, 2020

Thanks! I take it we still need to keep the TransmuteSizeDiff hack?

The testcase for that is ui/consts/transmute-size-mismatch-before-typeck.rs. It looks superficially related in the "we are evaluating ill-typed MIR" sense, but maybe that's just me being naive.

@eddyb eddyb changed the title Detect mistyped associated consts in Instance::resolve. Detect mistyped associated consts in Instance::resolve. Apr 12, 2020
@eddyb eddyb added the S-blocked Status: Blocked on something else such as an RFC or other implementation work. label Apr 12, 2020
@eddyb
Copy link
Member Author

eddyb commented Apr 12, 2020

Blocked on #71049.

@bors
Copy link
Contributor

bors commented Apr 15, 2020

☔ The latest upstream changes (presumably #70452) made this pull request unmergeable. Please resolve the merge conflicts.

Copy link
Contributor

@nikomatsakis nikomatsakis left a comment

Choose a reason for hiding this comment

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

(All looks good to me, from a quick read)

@oli-obk
Copy link
Contributor

oli-obk commented Apr 22, 2020

@bors r+

@bors
Copy link
Contributor

bors commented Apr 22, 2020

📌 Commit 289f46a has been approved by oli-obk

@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-blocked Status: Blocked on something else such as an RFC or other implementation work. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 22, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 22, 2020
Rollup of 6 pull requests

Successful merges:

 - rust-lang#70970 (Detect mistyped associated consts in `Instance::resolve`.)
 - rust-lang#71203 (Correct await span for async-await error reporting)
 - rust-lang#71214 (Add error code for inner doc error)
 - rust-lang#71337 (Moving all rustdoc-ui tests to check-pass)
 - rust-lang#71412 (Clarify unused_doc_comments note on macro invocations)
 - rust-lang#71414 (More diagnostic items for Clippy usage)

Failed merges:

r? @ghost
@bors bors merged commit 707004c into rust-lang:master Apr 22, 2020
@eddyb eddyb deleted the trait-vs-impl-mismatch branch April 27, 2020 01:07
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[trait constants] thread 'rustc' panicked at 'assertion failed: (left == right) ...'
8 participants