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

rustdoc: support for precise capturing #127228

Open
fmease opened this issue Jul 1, 2024 · 3 comments
Open

rustdoc: support for precise capturing #127228

fmease opened this issue Jul 1, 2024 · 3 comments
Labels
C-bug Category: This is a bug. F-precise_capturing `#![feature(precise_capturing)]` T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@fmease
Copy link
Member

fmease commented Jul 1, 2024

Source:

#![feature(precise_capturing)]

pub fn demo(_: &str) -> impl Sized + use<> {}

Current rendered output (both HIR-based and middle-based) below (issue: dropping the precise capturing arg):

pub fn demo(_: &str) -> impl Sized

Tracking:

@fmease fmease added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. C-bug Category: This is a bug. F-precise_capturing `#![feature(precise_capturing)]` labels Jul 1, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jul 1, 2024
@fmease fmease removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jul 1, 2024
@fmease
Copy link
Member Author

fmease commented Jul 1, 2024

I consider this issue to be partially blocked: Please don't try to add use<> support for inlined cross-crate reexports — more generally: middle-based cleaning — before I fix #113015 (which should happen very soon!).

Note that use<> doesn't get preserved post-HIR IINM, so it'd be non-trivial to impl anyway. To clarify, while it's possible to recover the list of captured regions from rustc_middle::ty data (via variance data: bivariant means not captured IIRC — maybe that's only true for TAITs not RPITs, haven't double-checked), it won't necessarily coincide with what the user wrote literally.

@fmease
Copy link
Member Author

fmease commented Jul 1, 2024

Furthermore, there's some design wiggle room which we should probably explore in a T-rustdoc meeting (I might add it to the agenda later).

Namely, with the edition differences around opaque type captures it might make sense for the rendered output to deviate from the actual source code as written by the user and to provide a 'normalized view' that's edition-agnostic (e.g., by always listing captures explicitly, etc. etc.).

@compiler-errors
Copy link
Member

Note that use<> doesn't get preserved post-HIR IINM, so it'd be non-trivial to impl anyway. To clarify, while it's possible to recover the list of captured regions from rustc_middle::ty data (via variance data: bivariant means not captured IIRC — maybe that's only true for TAITs not RPITs, haven't double-checked), it won't necessarily coincide with what the user wrote literally.

I think we could/should probably just expose it as a query which is encoded in the crate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. F-precise_capturing `#![feature(precise_capturing)]` T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants