-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Make alias-eq have a relation direction (and rename it to alias-relate) #109462
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
Conversation
Some changes occurred in src/tools/clippy cc @rust-lang/clippy Some changes occurred to the core trait solver cc @rust-lang/initiative-trait-system-refactor |
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.
for caching it would be better if we only have AliasRelateDir::Eq
and AliasRelateDir::Sub
, or maybe in that case AliasRelateMode::Eq
and AliasRelateMode::Sub
, and instead of flipping the direction, flipping the order of the aliases 🤔
apart from that and nits 👍
c1fc243
to
290080c
Compare
This comment has been minimized.
This comment has been minimized.
290080c
to
c54f297
Compare
/// | ||
/// FIXME: rename `AliasTy` to `AliasTerm` and make sure we correctly | ||
/// deal with constants. | ||
pub fn to_alias_term_no_opaque(&self, tcx: TyCtxt<'tcx>) -> Option<AliasTy<'tcx>> { | ||
pub fn to_projection_term(&self, tcx: TyCtxt<'tcx>) -> Option<AliasTy<'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.
I'm not a huge fan of this rename, when we start representing free type aliases in Ty
I would expect this function to return Some
for them. It's also not really accurate for ConstKind::Unevaluated
which represents anon consts which are sort of like free consts (although nothing about normalization or equality of ConstKind::Unevaluated
is really implemented right for new solver yet so shrug)
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.
I just think the old name is unnecessarily obtuse though, and also kinda long -- I'd rather have the behavior not be defined by what it is "not" if possible. If you can think of a better one, though, happy to consider naming it something else.
c54f297
to
244cdaa
Compare
@rustbot ready |
@bors r=BoxyUwU,lcnr |
…xyUwU,lcnr Make alias-eq have a relation direction (and rename it to alias-relate) Emitting an "alias-eq" is too strict in some situations, since we don't always want strict equality between a projection and rigid ty. Adds a relation direction. * I could probably just reuse this [`RelationDir`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_infer/infer/combine/enum.RelationDir.html) -- happy to uplift that struct into middle and use that instead, but I didn't feel compelled to... 🤷 * Some of the matching in `compute_alias_relate_goal` is a bit verbose -- I guess I could simplify it by using [`At::relate`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_infer/infer/at/struct.At.html#method.relate) and mapping the relation-dir to a variance. * Alternatively, I coulld simplify things by making more helper functions on `EvalCtxt` (e.g. `EvalCtxt::relate_with_direction(T, T)` that also does the nested goal registration). No preference. r? `@lcnr` cc `@BoxyUwU` though boxy can claim it if she wants NOTE: first commit is all the changes, the second is just renaming stuff
…xyUwU,lcnr Make alias-eq have a relation direction (and rename it to alias-relate) Emitting an "alias-eq" is too strict in some situations, since we don't always want strict equality between a projection and rigid ty. Adds a relation direction. * I could probably just reuse this [`RelationDir`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_infer/infer/combine/enum.RelationDir.html) -- happy to uplift that struct into middle and use that instead, but I didn't feel compelled to... 🤷 * Some of the matching in `compute_alias_relate_goal` is a bit verbose -- I guess I could simplify it by using [`At::relate`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_infer/infer/at/struct.At.html#method.relate) and mapping the relation-dir to a variance. * Alternatively, I coulld simplify things by making more helper functions on `EvalCtxt` (e.g. `EvalCtxt::relate_with_direction(T, T)` that also does the nested goal registration). No preference. r? ``@lcnr`` cc ``@BoxyUwU`` though boxy can claim it if she wants NOTE: first commit is all the changes, the second is just renaming stuff
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#108541 (Suppress `opaque_hidden_inferred_bound` for nested RPITs) - rust-lang#109137 (resolve: Querify most cstore access methods (subset 2)) - rust-lang#109380 (add `known-bug` test for unsoundness issue) - rust-lang#109462 (Make alias-eq have a relation direction (and rename it to alias-relate)) - rust-lang#109475 (Simpler checked shifts in MIR building) - rust-lang#109504 (Stabilize `arc_into_inner` and `rc_into_inner`.) - rust-lang#109506 (make param bound vars visibly bound vars with -Zverbose) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#108541 (Suppress `opaque_hidden_inferred_bound` for nested RPITs) - rust-lang#109137 (resolve: Querify most cstore access methods (subset 2)) - rust-lang#109380 (add `known-bug` test for unsoundness issue) - rust-lang#109462 (Make alias-eq have a relation direction (and rename it to alias-relate)) - rust-lang#109475 (Simpler checked shifts in MIR building) - rust-lang#109504 (Stabilize `arc_into_inner` and `rc_into_inner`.) - rust-lang#109506 (make param bound vars visibly bound vars with -Zverbose) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Emitting an "alias-eq" is too strict in some situations, since we don't always want strict equality between a projection and rigid ty. Adds a relation direction.
RelationDir
-- happy to uplift that struct into middle and use that instead, but I didn't feel compelled to... 🤷compute_alias_relate_goal
is a bit verbose -- I guess I could simplify it by usingAt::relate
and mapping the relation-dir to a variance.EvalCtxt
(e.g.EvalCtxt::relate_with_direction(T, T)
that also does the nested goal registration). No preference.r? @lcnr cc @BoxyUwU though boxy can claim it if she wants
NOTE: first commit is all the changes, the second is just renaming stuff