Repository navigation
Lower to hir::Params for required trait functions - #166147
JonathanBrouwer wants to merge 6 commits into
Conversation
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Lower to `hir::Params` for required trait functions
5e7d96f to
cb432b1
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment has been minimized.
This comment has been minimized.
hir::Params for required trait functionshir::Params for required trait functions
This comment was marked as outdated.
This comment was marked as outdated.
cb432b1 to
ba69df0
Compare
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Lower to `hir::Param`s for required trait functions
|
Changes to the size of AST and/or HIR nodes. cc @nnethercote
cc @rust-lang/clippy |
This comment has been minimized.
This comment has been minimized.
ba69df0 to
c1821bd
Compare
|
Finished benchmarking commit (0f49c8c): comparison URL. Overall result: no relevant changes - no action neededBenchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up. @rustbot label: -S-waiting-on-perf -perf-regression Instruction countThis perf run didn't have relevant results for this metric. Max RSS (memory usage)Results (primary 1.4%, secondary 1.7%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary -0.0%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis perf run didn't have relevant results for this metric. Bootstrap: 460.778s -> 458.292s (-0.54%) |
| TraitItemKind::Fn(ref sig, TraitFn::Required(params)) => { | ||
| try_visit!(visitor.visit_fn_decl(sig.decl)); | ||
| for ident in param_idents.iter().copied() { | ||
| visit_opt!(visitor, visit_ident, ident); |
There was a problem hiding this comment.
This unwrap in clippy becomes reachable
Small reproducer:
#![warn(clippy::shadow_unrelated)]
pub trait Required {
fn method(argument: u8);
}There was a problem hiding this comment.
Fixed. Welp, let's hope we caught em all now.
This bug was also already introduced for foreign functions by #166142.
I've added that as a regression test for that as well.
| TraitFn::Required(sig) => (None, Some(sig)), | ||
| TraitFn::Provided(id) => (Some(id), None), | ||
| let (body, params) = match *body { | ||
| TraitFn::Required(sig) => (None, sig), |
There was a problem hiding this comment.
| TraitFn::Required(sig) => (None, sig), | |
| TraitFn::Required(param) => (None, param), |
small naming nit since TraitFn::Required now holds &'hir [Param<'hir>]
There was a problem hiding this comment.
I'll rename it to params (since it's multiple)
Because a `FnParam::Ident` now always comes from function args const generics, we can change it to `FnParam::GenericParam`
c1821bd to
6a6515c
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
Processed the feedback
This works well for me. |
6a6515c to
6fda44b
Compare
View all comments
The same as #166142, but for required trait functions.
Also includes a bunch of cleanup.
I recommend reviewing commit by commit, every commit passes tests.
Earlier commits leave TODOs that are fixed by later commits
Part of #164357
r? Kivooeo