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: replace clean::InstantiationParam with clean::GenericArg #120999

Merged
merged 1 commit into from
Feb 14, 2024

Conversation

fmease
Copy link
Member

@fmease fmease commented Feb 13, 2024

Probably better known as SubstParam (until #120958 which should've probably renamed it to InstantiatedParam but anyways).

It doesn't make any sense to me why it should exist as a separate type. GenericArg is exactly what we want here anyways from a semantic perspective. Both have the same size btw.

I also took the liberty of doing some drive-by cleanups.

@rustbot
Copy link
Collaborator

rustbot commented Feb 13, 2024

r? @jsha

rustbot has assigned @jsha.
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 S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Feb 13, 2024
@rustbot
Copy link
Collaborator

rustbot commented Feb 13, 2024

Some changes occurred in src/librustdoc/clean/types.rs

cc @camelid

@fmease fmease changed the title Replace clean::InstantiationParam with clean::GenericArg rustdoc: replace clean::InstantiationParam with clean::GenericArg Feb 13, 2024
Comment on lines -1828 to +1819
hir::GenericParamKind::Const { .. } => {
let mut j = 0;
let const_ = generic_args.args.iter().find_map(|arg| match arg {
hir::GenericArg::Const(ct) => {
if indices.consts == j {
return Some(ct);
}
j += 1;
None
}
_ => None,
});
if let Some(_) = const_ {
args.insert(param.def_id.to_def_id(), InstantiationParam::Constant);
}
// FIXME(const_generics_defaults)
indices.consts += 1;
}
// FIXME(#82852): Instantiate const parameters.
hir::GenericParamKind::Const { .. } => {}
Copy link
Member Author

Choose a reason for hiding this comment

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

No need to perform all this logic when the result isn't used anyway at the moment, cc #82852.
Cc'ing the source code comment I added below:

We don't record const params since we don't visit const exprs at all and […] therefore wouldn't use the corresp. generic arg anyway. […]

@fmease fmease added the C-cleanup Category: PRs that clean code up or issues documenting cleanup. label Feb 13, 2024
@fmease fmease force-pushed the rustdoc-rm-instantiation-param branch from 11a1afa to 36d7f76 Compare February 13, 2024 04:06
@fmease
Copy link
Member Author

fmease commented Feb 13, 2024

r? rustdoc

@rustbot rustbot assigned notriddle and unassigned jsha Feb 13, 2024
@notriddle
Copy link
Contributor

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Feb 13, 2024

📌 Commit 36d7f76 has been approved by notriddle

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 13, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 13, 2024
…ram, r=notriddle

rustdoc: replace `clean::InstantiationParam` with `clean::GenericArg`

Probably better known as `SubstParam` (until rust-lang#120958 which should've probably renamed it to `InstantiatedParam` but anyways).

It doesn't make any sense to me why it should exist as a separate type. `GenericArg` is exactly what we want here anyways from a semantic perspective. Both have the same size btw.

I also took the liberty of doing some drive-by cleanups.
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 13, 2024
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#118882 (Check normalized call signature for WF in mir typeck)
 - rust-lang#120999 (rustdoc: replace `clean::InstantiationParam` with `clean::GenericArg`)
 - rust-lang#121002 (remove unnecessary calls to `commit_if_ok`)
 - rust-lang#121005 (Remove jsha from the rustdoc review rotation)
 - rust-lang#121043 (add lcnr to the compiler-team assignment group)
 - rust-lang#121045 (Fix two UI tests with incorrect directive / invalid revision)
 - rust-lang#121046 (Fix incorrect use of `compile_fail`)
 - rust-lang#121047 (Do not assemble candidates for default impls)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 13, 2024
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#118882 (Check normalized call signature for WF in mir typeck)
 - rust-lang#120999 (rustdoc: replace `clean::InstantiationParam` with `clean::GenericArg`)
 - rust-lang#121002 (remove unnecessary calls to `commit_if_ok`)
 - rust-lang#121005 (Remove jsha from the rustdoc review rotation)
 - rust-lang#121014 (Remove `force_print_diagnostic`)
 - rust-lang#121043 (add lcnr to the compiler-team assignment group)
 - rust-lang#121046 (Fix incorrect use of `compile_fail`)
 - rust-lang#121047 (Do not assemble candidates for default impls)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 14, 2024
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#118882 (Check normalized call signature for WF in mir typeck)
 - rust-lang#120999 (rustdoc: replace `clean::InstantiationParam` with `clean::GenericArg`)
 - rust-lang#121002 (remove unnecessary calls to `commit_if_ok`)
 - rust-lang#121005 (Remove jsha from the rustdoc review rotation)
 - rust-lang#121014 (Remove `force_print_diagnostic`)
 - rust-lang#121043 (add lcnr to the compiler-team assignment group)
 - rust-lang#121046 (Fix incorrect use of `compile_fail`)
 - rust-lang#121047 (Do not assemble candidates for default impls)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 14, 2024
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#118882 (Check normalized call signature for WF in mir typeck)
 - rust-lang#120999 (rustdoc: replace `clean::InstantiationParam` with `clean::GenericArg`)
 - rust-lang#121002 (remove unnecessary calls to `commit_if_ok`)
 - rust-lang#121005 (Remove jsha from the rustdoc review rotation)
 - rust-lang#121014 (Remove `force_print_diagnostic`)
 - rust-lang#121043 (add lcnr to the compiler-team assignment group)
 - rust-lang#121046 (Fix incorrect use of `compile_fail`)
 - rust-lang#121047 (Do not assemble candidates for default impls)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 2e98b27 into rust-lang:master Feb 14, 2024
11 checks passed
@rustbot rustbot added this to the 1.78.0 milestone Feb 14, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Feb 14, 2024
Rollup merge of rust-lang#120999 - fmease:rustdoc-rm-instantiation-param, r=notriddle

rustdoc: replace `clean::InstantiationParam` with `clean::GenericArg`

Probably better known as `SubstParam` (until rust-lang#120958 which should've probably renamed it to `InstantiatedParam` but anyways).

It doesn't make any sense to me why it should exist as a separate type. `GenericArg` is exactly what we want here anyways from a semantic perspective. Both have the same size btw.

I also took the liberty of doing some drive-by cleanups.
@fmease fmease deleted the rustdoc-rm-instantiation-param branch February 14, 2024 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-cleanup Category: PRs that clean code up or issues documenting cleanup. 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants