Skip to content

Simplify some places that deal with generic parameter defaults#132912

Merged
bors merged 1 commit into
rust-lang:masterfrom
fmease:simplify-gen-param-default-users
Nov 12, 2024
Merged

Simplify some places that deal with generic parameter defaults#132912
bors merged 1 commit into
rust-lang:masterfrom
fmease:simplify-gen-param-default-users

Conversation

@fmease

@fmease fmease commented Nov 11, 2024

Copy link
Copy Markdown
Member

No description provided.

@rustbot

rustbot commented Nov 11, 2024

Copy link
Copy Markdown
Collaborator

r? @BoxyUwU

rustbot has assigned @BoxyUwU.
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-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 11, 2024
Comment thread compiler/rustc_hir_analysis/src/check/wfcheck.rs
Comment thread compiler/rustc_hir_analysis/src/check/wfcheck.rs
@fmease fmease added the C-cleanup Category: PRs that clean code up or issues documenting cleanup. label Nov 11, 2024
@rust-log-analyzer

This comment has been minimized.

@fmease fmease marked this pull request as draft November 11, 2024 17:59
@fmease fmease force-pushed the simplify-gen-param-default-users branch from 1f80553 to 29551af Compare November 11, 2024 18:03
@fmease fmease marked this pull request as ready for review November 11, 2024 18:03
@rust-log-analyzer

This comment has been minimized.

@compiler-errors compiler-errors left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

r=me after fixing typo and green ci

Comment thread compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs Outdated

@compiler-errors compiler-errors left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Oh, and you need to fix the default arg logic below. I can re-review that after you've fixed it.

@fmease fmease force-pushed the simplify-gen-param-default-users branch from 29551af to d33e885 Compare November 11, 2024 19:03
@fmease

fmease commented Nov 11, 2024

Copy link
Copy Markdown
Member Author

Ah, lol. I guess there's some merit in checking if it actually compiles and in reading the rest of a function body ^^.

@fmease fmease force-pushed the simplify-gen-param-default-users branch from d33e885 to c247dec Compare November 11, 2024 20:26
@fmease

This comment was marked as outdated.

@bors

This comment was marked as outdated.

@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 Nov 11, 2024
@fmease

This comment was marked as outdated.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Nov 11, 2024
@fmease fmease force-pushed the simplify-gen-param-default-users branch from c247dec to d0ddba3 Compare November 11, 2024 20:30
@fmease

fmease commented Nov 11, 2024

Copy link
Copy Markdown
Member Author

@bors r=compiler-errors

@bors

bors commented Nov 11, 2024

Copy link
Copy Markdown
Collaborator

📌 Commit d0ddba3 has been approved by compiler-errors

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 11, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 11, 2024
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#120077 (Add Set entry API )
 - rust-lang#132144 (Arbitrary self types v2: (unused) Receiver trait)
 - rust-lang#132297 (Document some `check_expr` methods, and other misc `hir_typeck` tweaks)
 - rust-lang#132820 (Add a default implementation for CodegenBackend::link)
 - rust-lang#132881 (triagebot: Autolabel rustdoc book)
 - rust-lang#132912 (Simplify some places that deal with generic parameter defaults)
 - rust-lang#132916 (Unvacation fmease)

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

Rollup of 7 pull requests

Successful merges:

 - rust-lang#120077 (Add Set entry API )
 - rust-lang#132144 (Arbitrary self types v2: (unused) Receiver trait)
 - rust-lang#132297 (Document some `check_expr` methods, and other misc `hir_typeck` tweaks)
 - rust-lang#132820 (Add a default implementation for CodegenBackend::link)
 - rust-lang#132881 (triagebot: Autolabel rustdoc book)
 - rust-lang#132912 (Simplify some places that deal with generic parameter defaults)
 - rust-lang#132916 (Unvacation fmease)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit b41baf8 into rust-lang:master Nov 12, 2024
@rustbot rustbot added this to the 1.84.0 milestone Nov 12, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Nov 12, 2024
Rollup merge of rust-lang#132912 - fmease:simplify-gen-param-default-users, r=compiler-errors

Simplify some places that deal with generic parameter defaults
@fmease fmease deleted the simplify-gen-param-default-users branch November 12, 2024 06:41
if let GenericParamDefKind::Const { .. } = param.kind {
self.visit(self.ev.tcx.type_of(param.def_id).instantiate_identity());
}
if let Some(default) = param.default_value(self.ev.tcx) {

@petrochenkov petrochenkov Nov 12, 2024

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The default_value naming is pretty misleading, it looks like it only returns something for constant parameters (because only they has values).
I thought the GenericParamDefKind::Type was lost here before I looked at the definition.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

How do you feel about renaming it to default?

@fmease fmease Nov 12, 2024

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Alternatively, default_term (cc, {ast, hir}::Term) or default_arg?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think default_term would be fine and probably actually an improvement, but also I don't know if I share the same concern about the default_value name.

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-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants