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

Tracking Issue for precise_capturing #123432

Open
9 of 15 tasks
traviscross opened this issue Apr 3, 2024 · 0 comments · May be fixed by #127672
Open
9 of 15 tasks

Tracking Issue for precise_capturing #123432

traviscross opened this issue Apr 3, 2024 · 0 comments · May be fixed by #127672
Assignees
Labels
A-edition-2024 Area: The 2024 edition B-RFC-approved Blocker: Approved by a merged RFC but not yet implemented. C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. F-precise_capturing `#![feature(precise_capturing)]` S-tracking-needs-documentation Status: Needs documentation. S-tracking-ready-to-stabilize Status: This is ready to stabilize; it may need a stabilization report and a PR T-lang Relevant to the language team, which will review and decide on the PR/issue.

Comments

@traviscross
Copy link
Contributor

traviscross commented Apr 3, 2024

This is a tracking issue for precise capturing of type and lifetime parameters in impl Trait opaque types.

The feature gate for the issue is #![feature(precise_capturing)].

About tracking issues

Tracking issues are used to record the overall progress of implementation. They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions. A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature. Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.

Steps

Related

Implementation history

cc @oli-obk @compiler-errors @rust-lang/style

@traviscross traviscross added C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. T-lang Relevant to the language team, which will review and decide on the PR/issue. labels Apr 3, 2024
@compiler-errors compiler-errors self-assigned this Apr 3, 2024
@fmease fmease added B-experimental Blocker: In-tree experiment; RFC pending or unneeded. S-tracking-unimplemented Status: The feature has not been implemented. S-tracking-needs-design-proposal Status: This needs a clear design proposal and then a meeting with the team. labels Apr 3, 2024
@traviscross traviscross changed the title Tracking Issue for precise_capturing Tracking Issue for precise_captures Apr 4, 2024
@traviscross traviscross changed the title Tracking Issue for precise_captures Tracking Issue for precise_capturing Apr 4, 2024
@traviscross traviscross added the F-precise_capturing `#![feature(precise_capturing)]` label Apr 4, 2024
@compiler-errors compiler-errors removed their assignment Apr 8, 2024
@fmease fmease added S-tracking-unimplemented Status: The feature has not been implemented. and removed S-tracking-unimplemented Status: The feature has not been implemented. labels Apr 10, 2024
@traviscross traviscross added the A-edition-2024 Area: The 2024 edition label Apr 10, 2024
@traviscross traviscross self-assigned this Apr 12, 2024
bors added a commit to rust-lang-ci/rust that referenced this issue Apr 15, 2024
…=oli-obk

Implement syntax for `impl Trait` to specify its captures explicitly (`feature(precise_capturing)`)

Implements `impl use<'a, 'b, T, U> Sized` syntax that allows users to explicitly list the captured parameters for an opaque, rather than inferring it from the opaque's bounds (or capturing *all* lifetimes under 2024-edition capture rules). This allows us to exclude some implicit captures, so this syntax may be used as a migration strategy for changes due to rust-lang#117587.

We represent this list of captured params as `PreciseCapturingArg` in AST and HIR, resolving them between `rustc_resolve` and `resolve_bound_vars`. Later on, we validate that the opaques only capture the parameters in this list.

We artificially limit the feature to *require* mentioning all type and const parameters, since we don't currently have support for non-lifetime bivariant generics. This can be relaxed in the future.

We also may need to limit this to require naming *all* lifetime parameters for RPITIT, since GATs have no variance. I have to investigate this. This can also be relaxed in the future.

r? `@oli-obk`

Tracking issue:

- rust-lang#123432
bors added a commit to rust-lang-ci/rust that referenced this issue Apr 16, 2024
…=oli-obk

Implement syntax for `impl Trait` to specify its captures explicitly (`feature(precise_capturing)`)

Implements `impl use<'a, 'b, T, U> Sized` syntax that allows users to explicitly list the captured parameters for an opaque, rather than inferring it from the opaque's bounds (or capturing *all* lifetimes under 2024-edition capture rules). This allows us to exclude some implicit captures, so this syntax may be used as a migration strategy for changes due to rust-lang#117587.

We represent this list of captured params as `PreciseCapturingArg` in AST and HIR, resolving them between `rustc_resolve` and `resolve_bound_vars`. Later on, we validate that the opaques only capture the parameters in this list.

We artificially limit the feature to *require* mentioning all type and const parameters, since we don't currently have support for non-lifetime bivariant generics. This can be relaxed in the future.

We also may need to limit this to require naming *all* lifetime parameters for RPITIT, since GATs have no variance. I have to investigate this. This can also be relaxed in the future.

r? `@oli-obk`

Tracking issue:

- rust-lang#123432
bors added a commit to rust-lang-ci/rust that referenced this issue Apr 16, 2024
…=oli-obk

Implement syntax for `impl Trait` to specify its captures explicitly (`feature(precise_capturing)`)

Implements `impl use<'a, 'b, T, U> Sized` syntax that allows users to explicitly list the captured parameters for an opaque, rather than inferring it from the opaque's bounds (or capturing *all* lifetimes under 2024-edition capture rules). This allows us to exclude some implicit captures, so this syntax may be used as a migration strategy for changes due to rust-lang#117587.

We represent this list of captured params as `PreciseCapturingArg` in AST and HIR, resolving them between `rustc_resolve` and `resolve_bound_vars`. Later on, we validate that the opaques only capture the parameters in this list.

We artificially limit the feature to *require* mentioning all type and const parameters, since we don't currently have support for non-lifetime bivariant generics. This can be relaxed in the future.

We also may need to limit this to require naming *all* lifetime parameters for RPITIT, since GATs have no variance. I have to investigate this. This can also be relaxed in the future.

r? `@oli-obk`

Tracking issue:

- rust-lang#123432
bors added a commit to rust-lang-ci/rust that referenced this issue Apr 16, 2024
…=oli-obk

Implement syntax for `impl Trait` to specify its captures explicitly (`feature(precise_capturing)`)

Implements `impl use<'a, 'b, T, U> Sized` syntax that allows users to explicitly list the captured parameters for an opaque, rather than inferring it from the opaque's bounds (or capturing *all* lifetimes under 2024-edition capture rules). This allows us to exclude some implicit captures, so this syntax may be used as a migration strategy for changes due to rust-lang#117587.

We represent this list of captured params as `PreciseCapturingArg` in AST and HIR, resolving them between `rustc_resolve` and `resolve_bound_vars`. Later on, we validate that the opaques only capture the parameters in this list.

We artificially limit the feature to *require* mentioning all type and const parameters, since we don't currently have support for non-lifetime bivariant generics. This can be relaxed in the future.

We also may need to limit this to require naming *all* lifetime parameters for RPITIT, since GATs have no variance. I have to investigate this. This can also be relaxed in the future.

r? `@oli-obk`

Tracking issue:

- rust-lang#123432
flip1995 pushed a commit to flip1995/rust-clippy that referenced this issue Apr 18, 2024
Implement syntax for `impl Trait` to specify its captures explicitly (`feature(precise_capturing)`)

Implements `impl use<'a, 'b, T, U> Sized` syntax that allows users to explicitly list the captured parameters for an opaque, rather than inferring it from the opaque's bounds (or capturing *all* lifetimes under 2024-edition capture rules). This allows us to exclude some implicit captures, so this syntax may be used as a migration strategy for changes due to #117587.

We represent this list of captured params as `PreciseCapturingArg` in AST and HIR, resolving them between `rustc_resolve` and `resolve_bound_vars`. Later on, we validate that the opaques only capture the parameters in this list.

We artificially limit the feature to *require* mentioning all type and const parameters, since we don't currently have support for non-lifetime bivariant generics. This can be relaxed in the future.

We also may need to limit this to require naming *all* lifetime parameters for RPITIT, since GATs have no variance. I have to investigate this. This can also be relaxed in the future.

r? `@oli-obk`

Tracking issue:

- rust-lang/rust#123432
@compiler-errors compiler-errors removed the S-tracking-unimplemented Status: The feature has not been implemented. label Apr 21, 2024
@traviscross traviscross added B-RFC-approved Blocker: Approved by a merged RFC but not yet implemented. and removed B-experimental Blocker: In-tree experiment; RFC pending or unneeded. labels May 6, 2024
@traviscross traviscross added S-tracking-impl-incomplete Status: The implementation is incomplete. S-tracking-needs-migration-lint Status: This item needs a migration lint. S-tracking-needs-documentation Status: Needs documentation. and removed S-tracking-needs-design-proposal Status: This needs a clear design proposal and then a meeting with the team. labels May 21, 2024
workingjubilee added a commit to workingjubilee/rustc that referenced this issue Jun 24, 2024
…ebcartwright

Implement `use<>` formatting in rustfmt

This PR implements formatting for precise-capturing `use<>` syntax as proposed in rust-lang#126753.

The syntax is implemented as-if the `use<>` bound were a trait bound but with the `use` keyword as its path segment identifier.

I opted to develop this in the rust-lang/rust tree since I'm not certain when the next rustfmt subtree sync is going to be, and I'd rather not block landing nightly support for `use<>` on something I have no control over. If `@rust-lang/rustfmt` would rather I move this PR over to that repository, then I would at least like to know when the next rustfmt->rust subtree sync is going to be, since stabilizing `precise_capturing` without formatting will be disruptive.

This implementation is otherwise rather straightforward.

Tracking:

- rust-lang#123432
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jun 24, 2024
…ebcartwright

Implement `use<>` formatting in rustfmt

This PR implements formatting for precise-capturing `use<>` syntax as proposed in rust-lang#126753.

The syntax is implemented as-if the `use<>` bound were a trait bound but with the `use` keyword as its path segment identifier.

I opted to develop this in the rust-lang/rust tree since I'm not certain when the next rustfmt subtree sync is going to be, and I'd rather not block landing nightly support for `use<>` on something I have no control over. If ``@rust-lang/rustfmt`` would rather I move this PR over to that repository, then I would at least like to know when the next rustfmt->rust subtree sync is going to be, since stabilizing `precise_capturing` without formatting will be disruptive.

This implementation is otherwise rather straightforward.

Tracking:

- rust-lang#123432
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Jun 24, 2024
Rollup merge of rust-lang#126754 - compiler-errors:use-rustfmt, r=calebcartwright

Implement `use<>` formatting in rustfmt

This PR implements formatting for precise-capturing `use<>` syntax as proposed in rust-lang#126753.

The syntax is implemented as-if the `use<>` bound were a trait bound but with the `use` keyword as its path segment identifier.

I opted to develop this in the rust-lang/rust tree since I'm not certain when the next rustfmt subtree sync is going to be, and I'd rather not block landing nightly support for `use<>` on something I have no control over. If ``@rust-lang/rustfmt`` would rather I move this PR over to that repository, then I would at least like to know when the next rustfmt->rust subtree sync is going to be, since stabilizing `precise_capturing` without formatting will be disruptive.

This implementation is otherwise rather straightforward.

Tracking:

- rust-lang#123432
compiler-errors pushed a commit to compiler-errors/rustfmt that referenced this issue Jun 25, 2024
Implement `use<>` formatting in rustfmt

This PR implements formatting for precise-capturing `use<>` syntax as proposed in rust-lang/rust#126753.

The syntax is implemented as-if the `use<>` bound were a trait bound but with the `use` keyword as its path segment identifier.

I opted to develop this in the rust-lang/rust tree since I'm not certain when the next rustfmt subtree sync is going to be, and I'd rather not block landing nightly support for `use<>` on something I have no control over. If ``@rust-lang/rustfmt`` would rather I move this PR over to that repository, then I would at least like to know when the next rustfmt->rust subtree sync is going to be, since stabilizing `precise_capturing` without formatting will be disruptive.

This implementation is otherwise rather straightforward.

Tracking:

- rust-lang/rust#123432
compiler-errors added a commit to compiler-errors/rust that referenced this issue Jun 25, 2024
Deny `use<>` for RPITITs

Precise capturing `use<>` syntax is currently a no-op on RPITITs, since GATs have no variance, so all captured lifetimes are captured invariantly.

We don't currently *need* to support `use<>` on RPITITs, since `use<>` is initially intended for migrating RPIT *overcaptures* from edition 2021->2024, but since RPITITs currently capture all in-scope lifetimes, we'll never need to write `use<>` on an RPITIT.

Eventually, though, it would be desirable to support precise capturing on RPITITs, since RPITITs overcapturing by default can be annoying to some folks. But let's separate that (which will likely require some delicate types team work for adding variances to GATs and adjusting the refinement rules) from the stabilization of the feature for edition 2024.

r? oli-obk cc `@traviscross`

Tracking:

- rust-lang#123432
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jun 25, 2024
Deny `use<>` for RPITITs

Precise capturing `use<>` syntax is currently a no-op on RPITITs, since GATs have no variance, so all captured lifetimes are captured invariantly.

We don't currently *need* to support `use<>` on RPITITs, since `use<>` is initially intended for migrating RPIT *overcaptures* from edition 2021->2024, but since RPITITs currently capture all in-scope lifetimes, we'll never need to write `use<>` on an RPITIT.

Eventually, though, it would be desirable to support precise capturing on RPITITs, since RPITITs overcapturing by default can be annoying to some folks. But let's separate that (which will likely require some delicate types team work for adding variances to GATs and adjusting the refinement rules) from the stabilization of the feature for edition 2024.

r? oli-obk cc ``@traviscross``

Tracking:

- rust-lang#123432
workingjubilee added a commit to workingjubilee/rustc that referenced this issue Jun 25, 2024
Deny `use<>` for RPITITs

Precise capturing `use<>` syntax is currently a no-op on RPITITs, since GATs have no variance, so all captured lifetimes are captured invariantly.

We don't currently *need* to support `use<>` on RPITITs, since `use<>` is initially intended for migrating RPIT *overcaptures* from edition 2021->2024, but since RPITITs currently capture all in-scope lifetimes, we'll never need to write `use<>` on an RPITIT.

Eventually, though, it would be desirable to support precise capturing on RPITITs, since RPITITs overcapturing by default can be annoying to some folks. But let's separate that (which will likely require some delicate types team work for adding variances to GATs and adjusting the refinement rules) from the stabilization of the feature for edition 2024.

r? oli-obk cc ```@traviscross```

Tracking:

- rust-lang#123432
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Jun 26, 2024
Rollup merge of rust-lang#126746 - compiler-errors:no-rpitit, r=oli-obk

Deny `use<>` for RPITITs

Precise capturing `use<>` syntax is currently a no-op on RPITITs, since GATs have no variance, so all captured lifetimes are captured invariantly.

We don't currently *need* to support `use<>` on RPITITs, since `use<>` is initially intended for migrating RPIT *overcaptures* from edition 2021->2024, but since RPITITs currently capture all in-scope lifetimes, we'll never need to write `use<>` on an RPITIT.

Eventually, though, it would be desirable to support precise capturing on RPITITs, since RPITITs overcapturing by default can be annoying to some folks. But let's separate that (which will likely require some delicate types team work for adding variances to GATs and adjusting the refinement rules) from the stabilization of the feature for edition 2024.

r? oli-obk cc ``@traviscross``

Tracking:

- rust-lang#123432
flip1995 pushed a commit to flip1995/rust-clippy that referenced this issue Jun 28, 2024
Rework `feature(precise_capturing)` to represent `use<...>` as a syntactical bound

Reworks `precise_capturing` for a recent lang-team consensus.

Specifically:

> The conclusion of the team is that we'll make use<..> a bound. That is, we'll support impl use<..> + Trait, impl Trait + use<..>, etc.

> For now, we will support at most one such bound in a list of bounds, and semantically we'll only support these bounds in the item bounds of RPIT-like impl Trait opaque types (i.e., in the places discussed in the RFC).

Lang decision in favor of this approach:

- rust-lang/rust#125836 (comment)

Tracking:

- rust-lang/rust#123432
flip1995 pushed a commit to flip1995/rust-clippy that referenced this issue Jun 28, 2024
Deny `use<>` for RPITITs

Precise capturing `use<>` syntax is currently a no-op on RPITITs, since GATs have no variance, so all captured lifetimes are captured invariantly.

We don't currently *need* to support `use<>` on RPITITs, since `use<>` is initially intended for migrating RPIT *overcaptures* from edition 2021->2024, but since RPITITs currently capture all in-scope lifetimes, we'll never need to write `use<>` on an RPITIT.

Eventually, though, it would be desirable to support precise capturing on RPITITs, since RPITITs overcapturing by default can be annoying to some folks. But let's separate that (which will likely require some delicate types team work for adding variances to GATs and adjusting the refinement rules) from the stabilization of the feature for edition 2024.

r? oli-obk cc ``@traviscross``

Tracking:

- rust-lang/rust#123432
@traviscross traviscross added S-tracking-ready-to-stabilize Status: This is ready to stabilize; it may need a stabilization report and a PR and removed S-tracking-impl-incomplete Status: The implementation is incomplete. S-tracking-needs-migration-lint Status: This item needs a migration lint. labels Jun 30, 2024
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Jul 1, 2024
…=joshtriplett,calebcartwright

Add nightly style guide section for `precise_capturing` `use<>` syntax

r? style

Tracking:

- rust-lang#123432
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Jul 1, 2024
…=joshtriplett,calebcartwright

Add nightly style guide section for `precise_capturing` `use<>` syntax

r? style

Tracking:

- rust-lang#123432
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Jul 1, 2024
Rollup merge of rust-lang#126753 - compiler-errors:use-style-guide, r=joshtriplett,calebcartwright

Add nightly style guide section for `precise_capturing` `use<>` syntax

r? style

Tracking:

- rust-lang#123432
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jul 12, 2024
…rustdoc, r=fmease

Implement `precise_capturing` support for rustdoc

Implements rustdoc (+json) support for local (i.e. non-cross-crate-inlined) RPITs with `use<...>` precise capturing syntax.

Tests kinda suck. They're really hard to write 😰

r? `@fmease` or re-roll if you're too busy!
also cc `@aDotInTheVoid` for the json side

Tracking:
* rust-lang#127228 (comment) (not fully fixed for cross-crate-inlined opaques)
* rust-lang#123432
workingjubilee added a commit to workingjubilee/rustc that referenced this issue Jul 12, 2024
…rustdoc, r=fmease

Implement `precise_capturing` support for rustdoc

Implements rustdoc (+json) support for local (i.e. non-cross-crate-inlined) RPITs with `use<...>` precise capturing syntax.

Tests kinda suck. They're really hard to write 😰

r? ``@fmease`` or re-roll if you're too busy!
also cc ``@aDotInTheVoid`` for the json side

Tracking:
* rust-lang#127228 (comment) (not fully fixed for cross-crate-inlined opaques)
* rust-lang#123432
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jul 12, 2024
…rustdoc, r=fmease

Implement `precise_capturing` support for rustdoc

Implements rustdoc (+json) support for local (i.e. non-cross-crate-inlined) RPITs with `use<...>` precise capturing syntax.

Tests kinda suck. They're really hard to write 😰

r? `@fmease` or re-roll if you're too busy!
also cc `@aDotInTheVoid` for the json side

Tracking:
* rust-lang#127228 (comment) (not fully fixed for cross-crate-inlined opaques)
* rust-lang#123432
bors added a commit to rust-lang-ci/rust that referenced this issue Jul 12, 2024
…stdoc-cross, r=<try>

Add cross-crate precise capturing support to rustdoc

Follow-up to rust-lang#127632. Fixes rust-lang#127228.

r? `@fmease`

Tracking:
* rust-lang#123432
bors added a commit to rust-lang-ci/rust that referenced this issue Jul 12, 2024
…stdoc-cross, r=<try>

Add cross-crate precise capturing support to rustdoc

Follow-up to rust-lang#127632. Fixes rust-lang#127228.

r? `@fmease`

Tracking:
* rust-lang#123432
workingjubilee added a commit to workingjubilee/rustc that referenced this issue Jul 12, 2024
…rustdoc, r=fmease

Implement `precise_capturing` support for rustdoc

Implements rustdoc (+json) support for local (i.e. non-cross-crate-inlined) RPITs with `use<...>` precise capturing syntax.

Tests kinda suck. They're really hard to write 😰

r? `@fmease` or re-roll if you're too busy!
also cc `@aDotInTheVoid` for the json side

Tracking:
* rust-lang#127228 (comment) (not fully fixed for cross-crate-inlined opaques)
* rust-lang#123432
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Jul 13, 2024
Rollup merge of rust-lang#127632 - compiler-errors:precise-capturing-rustdoc, r=fmease

Implement `precise_capturing` support for rustdoc

Implements rustdoc (+json) support for local (i.e. non-cross-crate-inlined) RPITs with `use<...>` precise capturing syntax.

Tests kinda suck. They're really hard to write 😰

r? `@fmease` or re-roll if you're too busy!
also cc `@aDotInTheVoid` for the json side

Tracking:
* rust-lang#127228 (comment) (not fully fixed for cross-crate-inlined opaques)
* rust-lang#123432
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-edition-2024 Area: The 2024 edition B-RFC-approved Blocker: Approved by a merged RFC but not yet implemented. C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. F-precise_capturing `#![feature(precise_capturing)]` S-tracking-needs-documentation Status: Needs documentation. S-tracking-ready-to-stabilize Status: This is ready to stabilize; it may need a stabilization report and a PR T-lang Relevant to the language team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants