-
Notifications
You must be signed in to change notification settings - Fork 12.2k
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
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
precise_capturing
precise_captures
precise_captures
precise_capturing
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
This was referenced Jun 20, 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
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
This was referenced Jul 2, 2024
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.
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
impl Trait
to specify its captures explicitly (feature(precise_capturing)
) #123468incomplete_features
lint fromuse<..>
syntax.use<..>
within RPITIT.use<>
for RPITITs #126746impl use<..>
vsuse<..> impl
.impl Trait + use<..>
#125836feature(precise_capturing)
to representuse<...>
as a syntactical bound #126049rustfmt
.use<>
formatting in rustfmt #126754use<..>
syntax.impl_trait_overcaptures
lint torust_2024_compatibility
.precise_capturing
use<>
syntax #126753Related
impl use<..> Trait
vsuse<..> impl Trait
lang-team#269impl Trait + use<..>
#125836use<>
for RPITITs #126746precise_capturing
use<>
syntax #126753use<>
formatting in rustfmt #126754precise_capturing
support for rustdoc #127632Implementation history
impl Trait
to specify its captures explicitly (feature(precise_capturing)
) #123468cc @oli-obk @compiler-errors @rust-lang/style
The text was updated successfully, but these errors were encountered: