-
Notifications
You must be signed in to change notification settings - Fork 13.3k
rustdoc/clean: Fix lowering of fn params (fixes correctness & HIR vs. middle parity regressions) #139913
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rustbot has assigned @GuillaumeGomez. Use |
fmease
commented
Apr 16, 2025
d38d576
to
a662fd9
Compare
GuillaumeGomez
approved these changes
Apr 16, 2025
It's great, thanks a lot! @bors r+ rollup |
This comment was marked as resolved.
This comment was marked as resolved.
…params from "argument" to "parameter"
a662fd9
to
82ff0a0
Compare
Rebased. |
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Apr 17, 2025
…ng, r=GuillaumeGomez rustdoc/clean: Fix lowering of fn params (fixes correctness & HIR vs. middle parity regressions) **(0)** PR rust-lang#136411 aimed to stop rendering unnamed params of fn ptr types as underscores in the common case (e.g., `fn(_: i32)` → `fn(i32)`) to make the rendered output stylistically more conventional. **(0.a)** However, since the cleaning fn that the PR modified is also used for lowering the HIR params of foreign fns and required assoc fns in traits, it accidentally butchered the rendering of the latter two: ```rs pub trait Trait { fn assoc_fn(_: i32); } // as well as (Rust 2015 only): fn assoc_fn(i32); unsafe extern "C" { pub fn foreign_fn(_: i32); } // Since 1.86 the fns above gets mis-rendered as: pub fn assoc_fn(: i32) // <-- BUTCHERED pub unsafe extern "C" fn foreign_fn(: i32) // <-- BUTCHERED ``` **(0.b)** Furthermore, it broke parity with middle cleaning (which includes inlined cross-crate re-exports) re-regressing parts of rust-lang#44306 I once fixed in PR rust-lang#103885. **(1)** Lastly, PR rust-lang#139035 introduced an ICE triggered by the following input file: ```rs trait Trait { fn anon(()) {} } // internal error: entered unreachable code ``` --- This PR fixes all of these regressions and in the first commit renames several types and fns to be more ~~correct~~ descriptive and legible. ~~It also refactors `Param.name` to be of type `Option<Symbol>` instead `Symbol` (where `None` ~ `kw::Empty`), so rendering mistakes like that can no longer creep in like that (ignoring tests). CC rust-lang#137978.~~ Independently done in PR rust-lang#139846 a day prior.
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Apr 17, 2025
…iaskrgr Rollup of 9 pull requests Successful merges: - rust-lang#138528 (deref patterns: implement implicit deref patterns) - rust-lang#138934 (support config extensions) - rust-lang#139114 (Implement `pin!()` using `super let`) - rust-lang#139393 (rustdoc-json: Output target feature information) - rust-lang#139553 (sync::mpsc: prevent double free on `Drop`) - rust-lang#139615 (Remove `name_or_empty`) - rust-lang#139853 (Disable combining LLD with external llvm-config) - rust-lang#139913 (rustdoc/clean: Fix lowering of fn params (fixes correctness & HIR vs. middle parity regressions)) - rust-lang#139942 (Ignore aix for tests/ui/erros/pic-linker.rs) r? `@ghost` `@rustbot` modify labels: rollup
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Apr 17, 2025
…ng, r=GuillaumeGomez rustdoc/clean: Fix lowering of fn params (fixes correctness & HIR vs. middle parity regressions) **(0)** PR rust-lang#136411 aimed to stop rendering unnamed params of fn ptr types as underscores in the common case (e.g., `fn(_: i32)` → `fn(i32)`) to make the rendered output stylistically more conventional. **(0.a)** However, since the cleaning fn that the PR modified is also used for lowering the HIR params of foreign fns and required assoc fns in traits, it accidentally butchered the rendering of the latter two: ```rs pub trait Trait { fn assoc_fn(_: i32); } // as well as (Rust 2015 only): fn assoc_fn(i32); unsafe extern "C" { pub fn foreign_fn(_: i32); } // Since 1.86 the fns above gets mis-rendered as: pub fn assoc_fn(: i32) // <-- BUTCHERED pub unsafe extern "C" fn foreign_fn(: i32) // <-- BUTCHERED ``` **(0.b)** Furthermore, it broke parity with middle cleaning (which includes inlined cross-crate re-exports) re-regressing parts of rust-lang#44306 I once fixed in PR rust-lang#103885. **(1)** Lastly, PR rust-lang#139035 introduced an ICE triggered by the following input file: ```rs trait Trait { fn anon(()) {} } // internal error: entered unreachable code ``` --- This PR fixes all of these regressions and in the first commit renames several types and fns to be more ~~correct~~ descriptive and legible. ~~It also refactors `Param.name` to be of type `Option<Symbol>` instead `Symbol` (where `None` ~ `kw::Empty`), so rendering mistakes like that can no longer creep in like that (ignoring tests). CC rust-lang#137978.~~ Independently done in PR rust-lang#139846 a day prior.
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Apr 17, 2025
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#138528 (deref patterns: implement implicit deref patterns) - rust-lang#138934 (support config extensions) - rust-lang#139393 (rustdoc-json: Output target feature information) - rust-lang#139553 (sync::mpsc: prevent double free on `Drop`) - rust-lang#139615 (Remove `name_or_empty`) - rust-lang#139853 (Disable combining LLD with external llvm-config) - rust-lang#139913 (rustdoc/clean: Fix lowering of fn params (fixes correctness & HIR vs. middle parity regressions)) - rust-lang#139942 (Ignore aix for tests/ui/erros/pic-linker.rs) r? `@ghost` `@rustbot` modify labels: rollup
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Apr 18, 2025
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#138528 (deref patterns: implement implicit deref patterns) - rust-lang#138934 (support config extensions) - rust-lang#139393 (rustdoc-json: Output target feature information) - rust-lang#139553 (sync::mpsc: prevent double free on `Drop`) - rust-lang#139615 (Remove `name_or_empty`) - rust-lang#139853 (Disable combining LLD with external llvm-config) - rust-lang#139913 (rustdoc/clean: Fix lowering of fn params (fixes correctness & HIR vs. middle parity regressions)) - rust-lang#139942 (Ignore aix for tests/ui/erros/pic-linker.rs) r? `@ghost` `@rustbot` modify labels: rollup
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Apr 18, 2025
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#138528 (deref patterns: implement implicit deref patterns) - rust-lang#139393 (rustdoc-json: Output target feature information) - rust-lang#139553 (sync::mpsc: prevent double free on `Drop`) - rust-lang#139615 (Remove `name_or_empty`) - rust-lang#139853 (Disable combining LLD with external llvm-config) - rust-lang#139913 (rustdoc/clean: Fix lowering of fn params (fixes correctness & HIR vs. middle parity regressions)) - rust-lang#139942 (Ignore aix for tests/ui/erros/pic-linker.rs) r? `@ghost` `@rustbot` modify labels: rollup
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Apr 18, 2025
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#138528 (deref patterns: implement implicit deref patterns) - rust-lang#139393 (rustdoc-json: Output target feature information) - rust-lang#139553 (sync::mpsc: prevent double free on `Drop`) - rust-lang#139615 (Remove `name_or_empty`) - rust-lang#139853 (Disable combining LLD with external llvm-config) - rust-lang#139913 (rustdoc/clean: Fix lowering of fn params (fixes correctness & HIR vs. middle parity regressions)) - rust-lang#139942 (Ignore aix for tests/ui/erros/pic-linker.rs) r? `@ghost` `@rustbot` modify labels: rollup
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Apr 18, 2025
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#138528 (deref patterns: implement implicit deref patterns) - rust-lang#139393 (rustdoc-json: Output target feature information) - rust-lang#139553 (sync::mpsc: prevent double free on `Drop`) - rust-lang#139615 (Remove `name_or_empty`) - rust-lang#139853 (Disable combining LLD with external llvm-config) - rust-lang#139913 (rustdoc/clean: Fix lowering of fn params (fixes correctness & HIR vs. middle parity regressions)) - rust-lang#139942 (Ignore aix for tests/ui/erros/pic-linker.rs) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Apr 18, 2025
Rollup merge of rust-lang#139913 - fmease:rustdoc-fix-fn-param-handling, r=GuillaumeGomez rustdoc/clean: Fix lowering of fn params (fixes correctness & HIR vs. middle parity regressions) **(0)** PR rust-lang#136411 aimed to stop rendering unnamed params of fn ptr types as underscores in the common case (e.g., `fn(_: i32)` → `fn(i32)`) to make the rendered output stylistically more conventional. **(0.a)** However, since the cleaning fn that the PR modified is also used for lowering the HIR params of foreign fns and required assoc fns in traits, it accidentally butchered the rendering of the latter two: ```rs pub trait Trait { fn assoc_fn(_: i32); } // as well as (Rust 2015 only): fn assoc_fn(i32); unsafe extern "C" { pub fn foreign_fn(_: i32); } // Since 1.86 the fns above gets mis-rendered as: pub fn assoc_fn(: i32) // <-- BUTCHERED pub unsafe extern "C" fn foreign_fn(: i32) // <-- BUTCHERED ``` **(0.b)** Furthermore, it broke parity with middle cleaning (which includes inlined cross-crate re-exports) re-regressing parts of rust-lang#44306 I once fixed in PR rust-lang#103885. **(1)** Lastly, PR rust-lang#139035 introduced an ICE triggered by the following input file: ```rs trait Trait { fn anon(()) {} } // internal error: entered unreachable code ``` --- This PR fixes all of these regressions and in the first commit renames several types and fns to be more ~~correct~~ descriptive and legible. ~~It also refactors `Param.name` to be of type `Option<Symbol>` instead `Symbol` (where `None` ~ `kw::Empty`), so rendering mistakes like that can no longer creep in like that (ignoring tests). CC rust-lang#137978.~~ Independently done in PR rust-lang#139846 a day prior.
github-actions bot
pushed a commit
to model-checking/verify-rust-std
that referenced
this pull request
Apr 19, 2025
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#138528 (deref patterns: implement implicit deref patterns) - rust-lang#139393 (rustdoc-json: Output target feature information) - rust-lang#139553 (sync::mpsc: prevent double free on `Drop`) - rust-lang#139615 (Remove `name_or_empty`) - rust-lang#139853 (Disable combining LLD with external llvm-config) - rust-lang#139913 (rustdoc/clean: Fix lowering of fn params (fixes correctness & HIR vs. middle parity regressions)) - rust-lang#139942 (Ignore aix for tests/ui/erros/pic-linker.rs) r? `@ghost` `@rustbot` modify labels: rollup
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
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
(0) PR #136411 aimed to stop rendering unnamed params of fn ptr types as underscores in the common case (e.g.,
fn(_: i32)
→fn(i32)
) to make the rendered output stylistically more conventional.(0.a) However, since the cleaning fn that the PR modified is also used for lowering the HIR params of foreign fns and required assoc fns in traits, it accidentally butchered the rendering of the latter two:
(0.b) Furthermore, it broke parity with middle cleaning (which includes inlined cross-crate re-exports) re-regressing parts of #44306 I once fixed in PR #103885.
(1) Lastly, PR #139035 introduced an ICE triggered by the following input file:
This PR fixes all of these regressions and in the first commit renames several types and fns to be more
correctdescriptive and legible.It also refactorsIndependently done in PR #139846 a day prior.Param.name
to be of typeOption<Symbol>
insteadSymbol
(whereNone
~kw::Empty
), so rendering mistakes like that can no longer creep in like that (ignoring tests). CC #137978.