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

Implement partial support for non-lifetime binders #107489

Merged
merged 6 commits into from
Feb 17, 2023

Conversation

compiler-errors
Copy link
Member

This implements support for non-lifetime binders. It's pretty useless currently, but I wanted to put this up so the implementation can be discussed.

Specifically, this piggybacks off of the late-bound lifetime collection code in rustc_hir_typeck::collect::lifetimes. This seems like a necessary step given the fact we don't resolve late-bound regions until this point, and binders are sometimes merged.

Q: I'm not sure if I should go along this route, or try to modify the earlier nameres code to compute the right bound var indices for type and const binders eagerly... If so, I'll need to rename all these queries to something more appropriate (I've done this for resolve_lifetime::Region -> resolve_lifetime::ResolvedArg)

cc rust-lang/types-team#81

r? @ghost

@compiler-errors compiler-errors added the T-types Relevant to the types team, which will review and decide on the PR/issue. label Jan 30, 2023
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 30, 2023
@compiler-errors compiler-errors added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jan 30, 2023
compiler/rustc_ast_passes/src/feature_gate.rs Outdated Show resolved Hide resolved
compiler/rustc_hir_analysis/src/collect/lifetimes.rs Outdated Show resolved Hide resolved
compiler/rustc_middle/src/middle/resolve_lifetime.rs Outdated Show resolved Hide resolved
compiler/rustc_hir_analysis/src/collect/lifetimes.rs Outdated Show resolved Hide resolved
compiler/rustc_hir_analysis/src/collect/lifetimes.rs Outdated Show resolved Hide resolved
compiler/rustc_hir/src/def.rs Outdated Show resolved Hide resolved
@compiler-errors
Copy link
Member Author

I reworked this PR quite a lot -- specifically, to remove Res::Late, I had to move all ty/const parameter resolution logic through the old compiler/rustc_hir_analysis/src/collect/lifetimes.rs, which I've renamed to compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs.

@compiler-errors
Copy link
Member Author

I think this is worth a review at this point, though. Not sure if the strategy I took to get rid of needing to introduce a separate Res::Late is right, but seems like it works fine.

@compiler-errors compiler-errors marked this pull request as ready for review February 7, 2023 00:19
@rustbot
Copy link
Collaborator

rustbot commented Feb 7, 2023

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@compiler-errors
Copy link
Member Author

r? compiler

@cjgillot cjgillot self-assigned this Feb 7, 2023
Copy link
Contributor

@cjgillot cjgillot left a comment

Choose a reason for hiding this comment

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

First pass. I'll do a more in-depth review a bit later.

@bors
Copy link
Contributor

bors commented Feb 8, 2023

☔ The latest upstream changes (presumably #107811) made this pull request unmergeable. Please resolve the merge conflicts.

@bors
Copy link
Contributor

bors commented Feb 13, 2023

☔ The latest upstream changes (presumably #107924) made this pull request unmergeable. Please resolve the merge conflicts.

Copy link
Contributor

@cjgillot cjgillot left a comment

Choose a reason for hiding this comment

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

Excited to see this working soon.
Last nits and then r=me.

compiler/rustc_hir_analysis/src/astconv/mod.rs Outdated Show resolved Hide resolved
compiler/rustc_hir_analysis/src/astconv/mod.rs Outdated Show resolved Hide resolved
compiler/rustc_hir_analysis/src/astconv/mod.rs Outdated Show resolved Hide resolved
@compiler-errors
Copy link
Member Author

@bors r=cjgillot

@bors
Copy link
Contributor

bors commented Feb 13, 2023

📌 Commit 0162292 has been approved by cjgillot

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 Feb 13, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 14, 2023
…rs, r=cjgillot

Implement partial support for non-lifetime binders

This implements support for non-lifetime binders. It's pretty useless currently, but I wanted to put this up so the implementation can be discussed.

Specifically, this piggybacks off of the late-bound lifetime collection code in `rustc_hir_typeck::collect::lifetimes`. This seems like a necessary step given the fact we don't resolve late-bound regions until this point, and binders are sometimes merged.

Q: I'm not sure if I should go along this route, or try to modify the earlier nameres code to compute the right bound var indices for type and const binders eagerly... If so, I'll need to rename all these queries to something more appropriate (I've done this for `resolve_lifetime::Region` -> `resolve_lifetime::ResolvedArg`)

cc rust-lang/types-team#81

r? `@ghost`
@matthiaskrgr
Copy link
Member

@bors bors 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 14, 2023
@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 Feb 14, 2023
@bors
Copy link
Contributor

bors commented Feb 15, 2023

☔ The latest upstream changes (presumably #108006) made this pull request unmergeable. Please resolve the merge conflicts.

@bors bors 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 15, 2023
@compiler-errors
Copy link
Member Author

Rebased.

@bors r=cjgillot

@bors
Copy link
Contributor

bors commented Feb 16, 2023

📌 Commit 95f35fe has been approved by cjgillot

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 Feb 16, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 17, 2023
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#104068 (rustdoc: Add PartialOrd trait to doc comment explanation)
 - rust-lang#107489 (Implement partial support for non-lifetime binders)
 - rust-lang#107905 (Pass arguments to `x` subcommands with `--`)
 - rust-lang#108009 (Move some tests)
 - rust-lang#108086 (wasm: Register the `relaxed-simd` target feature)
 - rust-lang#108104 (don't into self)
 - rust-lang#108133 (Small cleanups around `EarlyBinder`)
 - rust-lang#108136 (Do not ICE on unmet trait alias impl bounds)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 089e8c0 into rust-lang:master Feb 17, 2023
@rustbot rustbot added this to the 1.69.0 milestone Feb 17, 2023
Jarcho pushed a commit to Jarcho/rust that referenced this pull request Feb 26, 2023
…rs, r=cjgillot

Implement partial support for non-lifetime binders

This implements support for non-lifetime binders. It's pretty useless currently, but I wanted to put this up so the implementation can be discussed.

Specifically, this piggybacks off of the late-bound lifetime collection code in `rustc_hir_typeck::collect::lifetimes`. This seems like a necessary step given the fact we don't resolve late-bound regions until this point, and binders are sometimes merged.

Q: I'm not sure if I should go along this route, or try to modify the earlier nameres code to compute the right bound var indices for type and const binders eagerly... If so, I'll need to rename all these queries to something more appropriate (I've done this for `resolve_lifetime::Region` -> `resolve_lifetime::ResolvedArg`)

cc rust-lang/types-team#81

r? `@ghost`
@compiler-errors compiler-errors added the F-non_lifetime_binders `#![feature(non_lifetime_binders)]` label Mar 10, 2023
@compiler-errors compiler-errors deleted the non_lifetime_binders branch August 11, 2023 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-non_lifetime_binders `#![feature(non_lifetime_binders)]` 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. T-types Relevant to the types team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants