-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Simplify some places that deal with generic parameter defaults #132912
Simplify some places that deal with generic parameter defaults #132912
Conversation
This comment has been minimized.
This comment has been minimized.
1f80553
to
29551af
Compare
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
29551af
to
d33e885
Compare
Ah, lol. I guess there's some merit in checking if it actually compiles and in reading the rest of a function body ^^. |
d33e885
to
c247dec
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
c247dec
to
d0ddba3
Compare
@bors r=compiler-errors |
…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
…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
Rollup merge of rust-lang#132912 - fmease:simplify-gen-param-default-users, r=compiler-errors Simplify some places that deal with generic parameter defaults
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) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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.
No description provided.