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

Add RTN support to rustdoc #137956

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

compiler-errors
Copy link
Member

@compiler-errors compiler-errors commented Mar 3, 2025

This adds support to rustdoc and rustdoc-json for rendering (..) RTN (return type notation) style generics.


Cleaning rustc_middle::ty::Ty is not correct still, though, and ends up rendering a function like:

pub fn foreign<T: Foreign<bar(..): Send>>()
where
    <T as Foreign>::bar(..): 'static,
    T::bar(..): Sync,

Into this:

pub fn foreign<T>()
where
    T: Foreign,
    impl Future<Output = ()>: Send + 'static + Sync,

This is because clean_middle_ty doesn't actually have sufficient context about whether the RPITIT is in its "defining scope" or not, so we don't know if the type was originally written like -> impl Trait or with RTN like T::method(..).

Closes #123996

@rustbot
Copy link
Collaborator

rustbot commented Mar 3, 2025

r? @fmease

rustbot has assigned @fmease.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added A-rustdoc-json Area: Rustdoc JSON backend A-rustdoc-search Area: Rustdoc's search feature S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. labels Mar 3, 2025
@rustbot
Copy link
Collaborator

rustbot commented Mar 3, 2025

rustdoc-json-types is a public (although nightly-only) API. If possible, consider changing src/librustdoc/json/conversions.rs; otherwise, make sure you bump the FORMAT_VERSION constant.

cc @CraftSpider, @aDotInTheVoid, @Enselic, @obi1kenobi

Some changes occurred in tests/rustdoc-json

cc @aDotInTheVoid

@aDotInTheVoid aDotInTheVoid added F-return_type_notation `#[feature(return_type_notation)]` and removed A-rustdoc-search Area: Rustdoc's search feature T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. labels Mar 3, 2025
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 3, 2025
…2, r=jieyouxu

triagebot.toml: Don't label `test/rustdoc-json` as A-rustdoc-search

This happened because `test/rustdoc-js` is a prefix of `test/rustdoc-json`, and triagebot works on prefixes.

Maybe this should be fixed in triagebot, but this works now.

This happened on rust-lang#137956 and rust-lang#137955.
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Mar 4, 2025
Rollup merge of rust-lang#137958 - aDotInTheVoid:aDotInTheVoid-patch-2, r=jieyouxu

triagebot.toml: Don't label `test/rustdoc-json` as A-rustdoc-search

This happened because `test/rustdoc-js` is a prefix of `test/rustdoc-json`, and triagebot works on prefixes.

Maybe this should be fixed in triagebot, but this works now.

This happened on rust-lang#137956 and rust-lang#137955.
@bors
Copy link
Contributor

bors commented Mar 7, 2025

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

@@ -30,7 +30,7 @@ pub type FxHashMap<K, V> = HashMap<K, V>; // re-export for use in src/librustdoc
/// This integer is incremented with every breaking change to the API,
/// and is returned along with the JSON blob as [`Crate::format_version`].
/// Consuming code should assert that this value matches the format version(s) that it supports.
pub const FORMAT_VERSION: u32 = 40;
pub const FORMAT_VERSION: u32 = 41;
Copy link
Member

Choose a reason for hiding this comment

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

This is taking place at the same time as #138109, which also (currently) makes the 40->41 change. Once one of these merges, the other should rebase then bump again. See #94591 for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rustdoc-json Area: Rustdoc JSON backend F-return_type_notation `#[feature(return_type_notation)]` S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rustdoc: support RTN once its syntax is somewhat finalized
5 participants