Simplify some places that deal with generic parameter defaults#132912
Simplify some places that deal with generic parameter defaults#132912bors merged 1 commit intorust-lang:masterfrom
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.
compiler-errors
left a comment
There was a problem hiding this comment.
r=me after fixing typo and green ci
compiler-errors
left a comment
There was a problem hiding this comment.
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.
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.
How do you feel about renaming it to default?
There was a problem hiding this comment.
Alternatively, default_term (cc, {ast, hir}::Term) or default_arg?
There was a problem hiding this comment.
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.