-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Also emit suggestions for usages in the non_upper_case_globals
lint
#142645
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
base: master
Are you sure you want to change the base?
Conversation
r? @fee1-dead rustbot has assigned @fee1-dead. Use |
2589fe0
to
17f95ca
Compare
17f95ca
to
4df9f2f
Compare
This PR currently collects use sites eagerly, i.e., before the indirect call to If this ends up perf heavy, it should be possible to turn this into a @bors2 try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
Also emit suggestions for usages in the `non_upper_case_globals` lint This PR adds suggestions for all the usages of the renamed item in the warning of the `non_upper_case_globals` lint. Fixes #124061
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (4bb20cc): comparison URL. Overall result: ❌ regressions - please read the text belowBenchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @bors rollup=never Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary 1.2%, secondary -4.2%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary 30.3%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 692.606s -> 715.256s (3.27%) |
@bors2 try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
Also emit suggestions for usages in the `non_upper_case_globals` lint This PR adds suggestions for all the usages of the renamed item in the warning of the `non_upper_case_globals` lint. Fixes #124061
This comment has been minimized.
This comment has been minimized.
3939316
to
1b5ec3f
Compare
Finished benchmarking commit (5aafa84): comparison URL. Overall result: no relevant changes - no action neededBenchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf. @bors rollup=never Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results (primary -3.2%, secondary -2.5%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 689.042s -> 689.239s (0.03%) |
path: &rustc_hir::Path<'v>, | ||
_id: rustc_hir::HirId, | ||
) -> Self::Result { | ||
for seg in path.segments { |
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.
Wouldn't it be sufficient to just look at the Res
of the last segment or just at path.res
? STATIC::something
and CONST::something
are always an error and will likely always be one.
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.
We could but I don't think that would change much as we would still (I think) iterate over the segments to find the span. It's also (no longer) an expensive check anyway.
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.
It's alright.
we would still (I think) iterate over the segments to find the span
I guess that's true for looking at path.res
only. However, if you went with if let Some(final_seg) = path.segments.last() && …
, you could just use final_seg.ident.span
.
It's also (no longer) an expensive check anyway.
Well, we still run this logic whenever the lint actually triggers, it just doesn't show up in the perf profiles because presumably the benchmark suite doesn't contain many or any non-upper-case globals
#[suggestion( | ||
lint_suggestion, | ||
code = "{replace}", | ||
applicability = "machine-applicable", |
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.
(corner case that's unlikely to happen in practice) If the global is pub
, downstream crates could depend on the name (and we wouldn't know about that here)
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.
Yeah, we already have that issue with other lints anyway. I don't how we could solve that.
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.
Well if the effective visibility is reachable (I don't know the compiler API for that very well), we could make the def site suggestion maybe-incorrect and stop looking for usage sites 🤷
Needn't be done in this PR
f245ac2
to
5a670b6
Compare
r? fmease |
Requested reviewer is already assigned to this pull request. Please choose another assignee. |
r=me with or without final comment addressed @bors rollup |
5a670b6
to
6ffd0e6
Compare
@bors2 try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
Also emit suggestions for usages in the `non_upper_case_globals` lint This PR adds suggestions for all the usages of the renamed item in the warning of the `non_upper_case_globals` lint. Fixes #124061
This PR adds suggestions for all the usages of the renamed item in the warning of the
non_upper_case_globals
lint.Fixes #124061