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

Rename can_coerce to may_coerce, and then structurally resolve correctly in the probe #131751

Merged
merged 3 commits into from
Oct 16, 2024

Conversation

compiler-errors
Copy link
Member

We need to structurally resolve the lhs and rhs of the coercion. Also, renaming the method so it's less ambiguous about what it's doing... the word "may" gives more clear signal that it has false positives imo.

r? lcnr

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Oct 15, 2024
@@ -0,0 +1,21 @@
error[E0308]: arguments to this function are incorrect
Copy link
Member Author

@compiler-errors compiler-errors Oct 15, 2024

Choose a reason for hiding this comment

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

This is one test I could invent that demonstrated the change. I could make morel, but they're kinda annoying lol

let cause = self.cause(DUMMY_SP, ObligationCauseCode::ExprAssignable);
// We don't ever need two-phase here since we throw out the result of the coercion.
// We also just always set `coerce_never` to true, since this is a heuristic.
let coerce = Coerce::new(self, cause, AllowTwoPhase::No, true);
let coerce = Coerce::new(self, cause.clone(), AllowTwoPhase::No, true);
Copy link
Contributor

@lcnr lcnr Oct 15, 2024

Choose a reason for hiding this comment

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

is this hot enough that it may cause perf issues? Probably not, as this is only used in error paths

Copy link
Member Author

Choose a reason for hiding this comment

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

Yah, probably not.

Copy link
Contributor

@lcnr lcnr left a comment

Choose a reason for hiding this comment

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

r=me after nit

@compiler-errors
Copy link
Member Author

@bors r=lcnr

@bors
Copy link
Contributor

bors commented Oct 16, 2024

📌 Commit 9070aba has been approved by lcnr

It is now in the queue for this repository.

@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 Oct 16, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Oct 16, 2024
…ve, r=lcnr

Rename `can_coerce` to `may_coerce`, and then structurally resolve correctly in the probe

We need to structurally resolve the lhs and rhs of the coercion. Also, renaming the method so it's less ambiguous about what it's doing... the word "may" gives more clear signal that it has false positives imo.

r? lcnr
Urgau added a commit to Urgau/rust that referenced this pull request Oct 16, 2024
…ve, r=lcnr

Rename `can_coerce` to `may_coerce`, and then structurally resolve correctly in the probe

We need to structurally resolve the lhs and rhs of the coercion. Also, renaming the method so it's less ambiguous about what it's doing... the word "may" gives more clear signal that it has false positives imo.

r? lcnr
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 16, 2024
Rollup of 10 pull requests

Successful merges:

 - rust-lang#129181 (Pass end position of span through inline ASM cookie)
 - rust-lang#130989 (Don't check unsize goal in MIR validation when opaques remain)
 - rust-lang#131657 (Rustfmt `for<'a> async` correctly)
 - rust-lang#131691 (Delay ambiguous intra-doc link resolution after `Cache` has been populated)
 - rust-lang#131730 (Refactor some `core::fmt` macros)
 - rust-lang#131751 (Rename `can_coerce` to `may_coerce`, and then structurally resolve correctly in the probe)
 - rust-lang#131753 (Unify `secondary_span` and `swap_secondary_and_primary` args in `note_type_err`)
 - rust-lang#131776 (Emscripten: Xfail backtrace ui tests)
 - rust-lang#131777 (Fix trivially_copy_pass_by_ref in stable_mir)
 - rust-lang#131778 (Fix needless_lifetimes in stable_mir)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 16, 2024
…iaskrgr

Rollup of 9 pull requests

Successful merges:

 - rust-lang#130989 (Don't check unsize goal in MIR validation when opaques remain)
 - rust-lang#131657 (Rustfmt `for<'a> async` correctly)
 - rust-lang#131691 (Delay ambiguous intra-doc link resolution after `Cache` has been populated)
 - rust-lang#131730 (Refactor some `core::fmt` macros)
 - rust-lang#131751 (Rename `can_coerce` to `may_coerce`, and then structurally resolve correctly in the probe)
 - rust-lang#131753 (Unify `secondary_span` and `swap_secondary_and_primary` args in `note_type_err`)
 - rust-lang#131776 (Emscripten: Xfail backtrace ui tests)
 - rust-lang#131777 (Fix trivially_copy_pass_by_ref in stable_mir)
 - rust-lang#131778 (Fix needless_lifetimes in stable_mir)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 3b8fd5f into rust-lang:master Oct 16, 2024
6 checks passed
@rustbot rustbot added this to the 1.84.0 milestone Oct 16, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Oct 16, 2024
Rollup merge of rust-lang#131751 - compiler-errors:structurally-resolve, r=lcnr

Rename `can_coerce` to `may_coerce`, and then structurally resolve correctly in the probe

We need to structurally resolve the lhs and rhs of the coercion. Also, renaming the method so it's less ambiguous about what it's doing... the word "may" gives more clear signal that it has false positives imo.

r? lcnr
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. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants