Skip to content

Do not record unresolved const vars in generator interior #104788

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Nov 26, 2022

Conversation

compiler-errors
Copy link
Member

@compiler-errors compiler-errors commented Nov 23, 2022

Don't record types in the generator interior when we see unresolved const variables.

We already do this for associated types -- this is important to avoid unresolved inference variables in the generator results during writeback, since the writeback results get stable hashed in incremental mode.

Fixes #104787

@rustbot
Copy link
Collaborator

rustbot commented Nov 23, 2022

r? @fee1-dead

(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 Nov 23, 2022
@rustbot
Copy link
Collaborator

rustbot commented Nov 23, 2022

Some changes occurred in need_type_info.rs

cc @lcnr

Comment on lines 1451 to 1455
/// Returns the first unresolved variable contained in `T`. In the
/// process of visiting `T`, this will resolve (where possible)
/// type variables in `T`, but it never constructs the final,
/// resolved type, so it's more efficient than
/// `resolve_vars_if_possible()`.
pub fn unresolved_type_vars<T>(&self, value: &T) -> Option<(Ty<'tcx>, Option<Span>)>
/// Returns the first unresolved type or const variable contained in `T`.
/// In the process of visiting `T`, this will resolve (where possible)
/// type variables in `T`, but it never constructs the final, resolved
/// type, so it's more efficient than `resolve_vars_if_possible()`.
pub fn unresolved_non_region_vars<T>(&self, value: &T) -> Option<(ty::Term<'tcx>, Option<Span>)>
Copy link
Member

Choose a reason for hiding this comment

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

With #101900, I think this should be called unresolved_type_or_const_vars

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, though I would assume that effect vars, if they existed, would also need to be included in this, or else we'd have the same ICE

@@ -121,33 +122,62 @@ impl<'a, 'tcx> UnresolvedTypeFinder<'a, 'tcx> {
}

impl<'a, 'tcx> TypeVisitor<'tcx> for UnresolvedTypeFinder<'a, 'tcx> {
Copy link
Member

Choose a reason for hiding this comment

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

Rename?

@fee1-dead
Copy link
Member

@bors r+

@bors
Copy link
Collaborator

bors commented Nov 26, 2022

📌 Commit 6210812 has been approved by fee1-dead

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 Nov 26, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 26, 2022
…llaumeGomez

Rollup of 7 pull requests

Successful merges:

 - rust-lang#104786 (Use the power of adding helper function to simplify code w/ `Mutability`)
 - rust-lang#104788 (Do not record unresolved const vars in generator interior)
 - rust-lang#104909 (Rename `normalize_opaque_types` to `reveal_opaque_types_in_bounds`)
 - rust-lang#104921 (Remove unnecessary binder from `get_impl_future_output_ty`)
 - rust-lang#104924 (jsondoclint: Accept trait alias is places where trait expected.)
 - rust-lang#104928 (rustdoc: use flexbox CSS to align sidebar button instead of position)
 - rust-lang#104943 (jsondoclint: Handle using enum variants and glob using enums.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit e6c83d9 into rust-lang:master Nov 26, 2022
@rustbot rustbot added this to the 1.67.0 milestone Nov 26, 2022
@compiler-errors compiler-errors deleted the unresolved-ct-in-gen branch August 11, 2023 20:22
@fee1-dead fee1-dead added the PG-const-traits Project group: Const traits label Aug 9, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
PG-const-traits Project group: Const traits 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 const variables should not be hashed: Var(_#0c) inside async context on nightly
4 participants