Repository navigation
Conversation
explict_outlives_requirement to (generic) const itemsexplict_outlives_requirements to (generic) const items
This comment has been minimized.
This comment has been minimized.
In summary, rename various things & update a lot of comments.
1. Rename some types, fns that have "clause" in their name to contain
"outlives clause" instead. While we are in a module called `outlives`,
it's not immediately obvious & it certainly doesn't imply that all of
these things only represent / act on outlives-clauses.
Requested by Boxy.
2. Both `global_inferred_outlives` and `explicit_map` store a "global"
mapping from each crate-local item to a set of outlives-clauses
collected so far (one containing the inferred ones, the other the
explicit ones). So name both consistently: `global_inferred_clauses`
and `global_explicit_clauses`, respectively.
Similarly for their types which are now prefixed with `Global`.
3. Remove a bunch of really obvious & distracting comments.
4. Reduce rightward drift in the `ty::Dynamic` match arm by using an
if-let guard.
5. Deduplicate code shared between ADTs & CTAs in `inferred_outlives_of`
6. `bug!()` in a `GenericArgKind::Const(_)` branch which we know is
currently unreachable and which should explode if that were to change.
7. Rename `CrateClausesMap` to `CrateInferredOutlivesClausesMap`.
The type is public & lives in `rustc_middle` since
`inferred_outlives_crate` is a query. Considering that, its name is
way too general.
Moreover, remove all of its docs. This type can only be constructed
via query `inferred_outlives_crate` (well, and via the provider) which
has good docs already that also warn about the fact that query
`inferred_outlives_of` should always be used instead.
8. Remove comment "Typically there won't be many of these [explicit
outlives clauses], except in older code where they were mandatory" is
unnecessary and factually incorrect since there are various places
where we don't imply (early-bound) outlives-bounds.
9. Re. comment "Visit all the crates [...]" and "[...] we walk the crates
again [...]" is no longer correct: We only (re)visit the items in the
local crate; the inferred outlives clauses for cross-crate items have
already been computed and stored in the relevant crate metadata files.
10. Fix the example given in `check_explicit_clauses`'s docs, it has
several issues: Struct `Outer` gets used as a trait bound, it uses
`...: 'static` bounds and states they get processed but as a matter
of fact we don't process static bounds, we specifically only infer
clauses where the LHS is early-bound!
11. Various minor code tweaks.
explict_outlives_requirements to (generic) const itemsexplicit_outlives_requirements to (generic) const items
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Caution
Stacked on top of PR #143029 which itself is stacked on top of PR #164012. Empty "branch separator" commits are the boundaries.
Best reviewed by ignoring whitespace changes.
Part of #113521.
(No LLM was or will be used by me during the entire creation process of this PR)