-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Move placeholder handling to a proper preprocessing step #140466
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
base: master
Are you sure you want to change the base?
Move placeholder handling to a proper preprocessing step #140466
Conversation
r? lcnr |
This commit breaks out the logic of placheolder rewriting into its own preprocessing step. It's one of the more boring parts of rust-lang#130227. The only functional change from this is that the preprocessing step (where extra `r: 'static` constraints are added) is performed upstream of Polonius legacy, finally affecting Polonius. That is mostly a by-product, though.
8b2cab2
to
af75e13
Compare
Ok; revised SCC annotations have landed and I think I addressed all of your concerns so far @lcnr? |
af75e13
to
ef9cb23
Compare
@lcnr Fixed all the code review stuff now, I think! I amended it into the second commit. |
max_placeholder_universe_reached: UniverseIndex, | ||
|
||
/// The smallest universe index reachable form the nodes of this SCC. | ||
min_reachable_universe: UniverseIndex, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
min_reachable_universe: UniverseIndex, | |
max_nameable_universe: UniverseIndex, |
:3
} | ||
|
||
/// The smallest-indexed universe reachable from and/or in this SCC. | ||
pub(crate) fn min_universe(self) -> UniverseIndex { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pub(crate) fn min_universe(self) -> UniverseIndex { | |
pub(crate) fn max_nameable_universe(self) -> UniverseIndex { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also update comment :>
} | ||
|
||
/// Determines if the region variable definitions contain | ||
/// placeholers, and compute them for later use. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// placeholers, and compute them for later use. | |
/// placeholders, and compute them for later use. |
sup: annotation.representative.rvid(), | ||
sub: fr_static, | ||
category: ConstraintCategory::IllegalUniverse, | ||
locations: Locations::All(rustc_span::DUMMY_SP), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we track a span related to the placeholder in the scc annotation and use that here?
pub(crate) definitions: Frozen<IndexVec<RegionVid, RegionDefinition<'tcx>>>, | ||
pub(crate) scc_annotations: IndexVec<ConstraintSccIndex, RegionTracker>, | ||
pub(crate) member_constraints: MemberConstraintSet<'tcx, RegionVid>, | ||
pub(crate) outlives_constraints: OutlivesConstraintSet<'tcx>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pub(crate) outlives_constraints: OutlivesConstraintSet<'tcx>, | |
pub(crate) outlives_constraints: Frozen<OutlivesConstraintSet<'tcx>>, |
outlives_constraints.push(scc_representative_outlives_static); | ||
} | ||
} | ||
outlives_static |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
feel like this can just return a bool
? and we add a debug!
stmtm when adding an outlives constraint here
/// Since universes can also be involved in errors (if one placeholder | ||
/// transitively outlives another), this function also flags those. | ||
/// | ||
/// Additionally, it similarly rewrites type-tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no :> generally, this comment isn't applicable
This commit breaks out the logic of placheolder rewriting into its own preprocessing step. It's one of the more boring
parts of #130227.
The only functional change from this is that the preprocessing step (where extra
r: 'static
constraints are added) is performed upstream of Polonius legacy, finally affecting Polonius. That is mostly a by-product, though.This should be reviewable by anyone in the compiler team, so
r? rust-lang/compiler