-
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
Detect non-lifetime binder params shadowing item params #128357
Detect non-lifetime binder params shadowing item params #128357
Conversation
|
||
// Break at mod level, to account for nested items which are | ||
// allowed to shadow generic param names. | ||
if matches!(parent_rib.kind, RibKind::Module(..)) { |
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 check for lifetime shadowing uses LifetimeRibKind::Item
below, but we use RibKind::Module
here. The only case where I expect this to matter is nested items, in which case RibKind::Module
operates fine enough, but I may be missing some subtle case.
fn repeated() where for<T, T> (): Sized {} | ||
//~^ ERROR the name `T` is already used for a generic parameter |
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.
This one already existed, for the record. Just exercising it for good measure.
@bors r+ |
…ime-binder, r=petrochenkov Detect non-lifetime binder params shadowing item params We should check that `for<T>` shadows `T` from an item in the same way that `for<'a>` shadows `'a` from an item. r? `@petrochenkov` since you're familiar w the nuances of rib kinds
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#127543 (More unsafe attr verification) - rust-lang#128357 (Detect non-lifetime binder params shadowing item params) - rust-lang#128367 (CI: rfl: build the generated doctests and documentation) - rust-lang#128376 (Mark `Parser::eat`/`check` methods as `#[must_use]`) - rust-lang#128379 (the output in stderr expects panic-unwind) - rust-lang#128380 (make `///` doc comments compatible with naked functions) - rust-lang#128382 (cargo-miri: better error when we seem to run inside bootstrap but something is wrong) - rust-lang#128398 (tidy: Fix quote in error message) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#128357 (Detect non-lifetime binder params shadowing item params) - rust-lang#128367 (CI: rfl: build the generated doctests and documentation) - rust-lang#128376 (Mark `Parser::eat`/`check` methods as `#[must_use]`) - rust-lang#128379 (the output in stderr expects panic-unwind) - rust-lang#128380 (make `///` doc comments compatible with naked functions) - rust-lang#128382 (cargo-miri: better error when we seem to run inside bootstrap but something is wrong) - rust-lang#128398 (tidy: Fix quote in error message) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#128357 - compiler-errors:shadowed-non-lifetime-binder, r=petrochenkov Detect non-lifetime binder params shadowing item params We should check that `for<T>` shadows `T` from an item in the same way that `for<'a>` shadows `'a` from an item. r? ``@petrochenkov`` since you're familiar w the nuances of rib kinds
@rust-timer build 4822434 |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (4822434): comparison URL. Overall result: ❌ regressions - ACTION NEEDEDBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)Results (primary -2.2%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
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: 769.587s -> 768.835s (-0.10%) |
Seems like this has regressed trait-heavy code (mostly |
…, r=<try> Only walk ribs to collect possibly shadowed params if we are adding params in our new rib No need to collect params from parent ribs if we literally have no params to declare in this new rib. Attempt to win back some of the perf in rust-lang#128357 (comment). Please review with whitespace *off*, the diff should be like 2 lines. r? petrochenkov
…, r=petrochenkov Only walk ribs to collect possibly shadowed params if we are adding params in our new rib No need to collect params from parent ribs if we literally have no params to declare in this new rib. Attempt to win back some of the perf in rust-lang#128357 (comment). Please review with whitespace *off*, the diff should be like 2 lines. r? petrochenkov
…, r=petrochenkov Only walk ribs to collect possibly shadowed params if we are adding params in our new rib No need to collect params from parent ribs if we literally have no params to declare in this new rib. Attempt to win back some of the perf in rust-lang#128357 (comment). Please review with whitespace *off*, the diff should be like 2 lines. r? petrochenkov
…, r=petrochenkov Only walk ribs to collect possibly shadowed params if we are adding params in our new rib No need to collect params from parent ribs if we literally have no params to declare in this new rib. Attempt to win back some of the perf in rust-lang#128357 (comment). Please review with whitespace *off*, the diff should be like 2 lines. r? petrochenkov
…chenkov Only walk ribs to collect possibly shadowed params if we are adding params in our new rib No need to collect params from parent ribs if we literally have no params to declare in this new rib. Attempt to win back some of the perf in rust-lang/rust#128357 (comment). Please review with whitespace *off*, the diff should be like 2 lines. r? petrochenkov
We should check that
for<T>
shadowsT
from an item in the same way thatfor<'a>
shadows'a
from an item.r? @petrochenkov since you're familiar w the nuances of rib kinds