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

Use proper InferCtxt when probing for associated types in astconv #107100

Merged
merged 1 commit into from
Jan 28, 2023

Conversation

compiler-errors
Copy link
Member

Fixes #107087

@rustbot
Copy link
Collaborator

rustbot commented Jan 20, 2023

r? @lcnr

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

@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. labels Jan 20, 2023
@rust-log-analyzer

This comment has been minimized.

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.

i really dislike this setup 😅 we should just have the right infcx available here.

Could we instead add a method fn infcx(&self) -> Option<&InferCtxt> to trait AstConv and use that here?

@@ -2135,6 +2138,34 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
// Find all the `impl`s that `qself_ty` has for any trait that has the
Copy link
Contributor

Choose a reason for hiding this comment

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

can you move the whole if let error reporting chain into a separate function (and module astconv/errors.rs). having this much error reporting in a function with relevant behavior makes it harder to read.

@lcnr lcnr 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 Jan 20, 2023
Comment on lines +2210 to +2212
infcx_ = tcx.infer_ctxt().build();
&infcx_
Copy link
Contributor

Choose a reason for hiding this comment

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

can you add an assert that qself_ty does not have infer vars in this branch.

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 updated title

@compiler-errors compiler-errors changed the title Fresh inference variables when making assoc ty suggestions in astconv Use proper InferCtxt when probing for associated types in astconv Jan 23, 2023
@compiler-errors
Copy link
Member Author

@bors r=lcnr

@bors
Copy link
Contributor

bors commented Jan 23, 2023

📌 Commit da3ecb0 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 23, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 27, 2023
Use proper `InferCtxt` when probing for associated types in astconv

Fixes rust-lang#107087
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 28, 2023
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#107022 (Implement `SpecOptionPartialEq` for `cmp::Ordering`)
 - rust-lang#107100 (Use proper `InferCtxt` when probing for associated types in astconv)
 - rust-lang#107103 (Use new solver in `evaluate_obligation` query (when new solver is enabled))
 - rust-lang#107190 (Recover from more const arguments that are not wrapped in curly braces)
 - rust-lang#107306 (Correct suggestions for closure arguments that need a borrow)
 - rust-lang#107339 (internally change regions to be covariant)
 - rust-lang#107344 (Minor tweaks in the new solver)
 - rust-lang#107373 (Don't merge vtables when full debuginfo is enabled.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 28188d1 into rust-lang:master Jan 28, 2023
@rustbot rustbot added this to the 1.69.0 milestone Jan 28, 2023
@compiler-errors compiler-errors deleted the issue-107087 branch August 11, 2023 20:04
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.

[ICE]: index out of bounds: the len is 0 but the index is 0 snapshot_vec.rs
5 participants