Skip to content

Conversation

compiler-errors
Copy link
Member

Not sure if this is a change we actually want, but autoderef really is only (functionally) used by rustc_hir_analysis and rustc_hir_typeck, so it probably should live there.

Instead, implement a separate autoderef helper in TypeErrCtxt for the one use-case that goes against the ordering of the crate graph..

@rustbot
Copy link
Collaborator

rustbot commented Dec 27, 2022

r? @davidtwco

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic 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. labels Dec 27, 2022
@rustbot
Copy link
Collaborator

rustbot commented Dec 27, 2022

rustc_error_messages was changed

cc @davidtwco, @compiler-errors, @JohnTitor, @estebank, @TaKO8Ki

@compiler-errors
Copy link
Member Author

r? @lcnr might have some thoughts about this -- leaving this PR for them when they return from holiday, though this is a very low-pri pr.

@rustbot rustbot assigned lcnr and unassigned davidtwco Jan 6, 2023
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 with one nit, does this conflict with #106171 (comment)?

@@ -690,6 +690,7 @@ impl<'tcx> InferCtxt<'tcx> {
typeck_results: None,
fallback_has_occurred: false,
normalize_fn_sig: Box::new(|fn_sig| fn_sig),
autoderef_steps: Box::new(|ty| vec![(ty, vec![])]),
Copy link
Contributor

Choose a reason for hiding this comment

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

can this ICE instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hm, why?

Copy link
Contributor

Choose a reason for hiding this comment

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

my hope was that we only rely on autoderef_steps in errors during typeck. I guess we also autoderef when checking method receivers?

If so, don't mind this.

Copy link
Member Author

Choose a reason for hiding this comment

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

So right now the current users of autoderef_steps are obligation cause codes that only come from typeck, but there's nothing stopping someone adding a check that uses this during other trait error reporting code, for example, so I'd rather not ICE here.

I'll rename it to autoderef_steps_for_diagnostic so people know it's best effort...

Copy link
Contributor

Choose a reason for hiding this comment

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

r=me after adding debug_assert

@compiler-errors
Copy link
Member Author

Addressed nit

@bors r=lcnr

@bors
Copy link
Collaborator

bors commented Jan 11, 2023

📌 Commit c8334ce 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 Jan 11, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 12, 2023
…sis, r=lcnr

Move autoderef to `rustc_hir_analysis`

Not sure if this is a change we actually want, but autoderef really is only (functionally) used by `rustc_hir_analysis` and `rustc_hir_typeck`, so it probably should live there.

Instead, implement a separate autoderef helper in `TypeErrCtxt` for the one use-case that  goes against the ordering of the crate graph..
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 12, 2023
…mpiler-errors

Rollup of 8 pull requests

Successful merges:

 - rust-lang#103236 (doc: rewrite doc for signed int::{carrying_add,borrowing_sub})
 - rust-lang#103800 (Stabilize `::{core,std}::pin::pin!`)
 - rust-lang#106097 (Migrate mir_build diagnostics 2 of 3)
 - rust-lang#106170 (Move autoderef to `rustc_hir_analysis`)
 - rust-lang#106323 (Stabilize f16c_target_feature)
 - rust-lang#106360 (Tweak E0277 `&`-removal suggestions)
 - rust-lang#106524 (Label `struct/enum constructor` instead of `fn item`, mention that it should be called on type mismatch)
 - rust-lang#106739 (Remove `<dyn AstConv<'tcx>>::fun(c, ...)` calls in favour of `c.astconv().fun(...)`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 9928b14 into rust-lang:master Jan 12, 2023
@rustbot rustbot added this to the 1.68.0 milestone Jan 12, 2023
@compiler-errors compiler-errors deleted the autoderef-to-analysis branch August 11, 2023 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic 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.

5 participants