Skip to content
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

Rework non_local_definitions lint to only use a syntactic heuristic #127117

Merged
merged 5 commits into from
Sep 24, 2024

Conversation

Urgau
Copy link
Member

@Urgau Urgau commented Jun 29, 2024

This PR reworks the non_local_definitions lint to only use a syntactic heuristic, i.e. not use a type-system logic for whenever an impl is local or not.

Instead the new logic wanted by T-lang in #126768 (comment), which is to consider every paths in Self and Trait and to no longer use the type-system inference trick.

@rustbot labels +L-non_local_definitions
Fixes #126768

@rustbot
Copy link
Collaborator

rustbot commented Jun 29, 2024

r? @BoxyUwU

rustbot has assigned @BoxyUwU.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. L-non_local_definitions Lint: non_local_definitions labels Jun 29, 2024
@BoxyUwU
Copy link
Member

BoxyUwU commented Jun 30, 2024

r? @WaffleLapkin since you reviewed the original PR

@rustbot rustbot assigned WaffleLapkin and unassigned BoxyUwU Jun 30, 2024
Copy link
Contributor

@traviscross traviscross left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked over the tests; looks right to me.

tests/ui/lint/non-local-defs/generics.rs Show resolved Hide resolved
Copy link
Member

@workingjubilee workingjubilee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just typo nits

compiler/rustc_lint/src/non_local_def.rs Outdated Show resolved Hide resolved
compiler/rustc_lint/src/non_local_def.rs Outdated Show resolved Hide resolved
@bors
Copy link
Contributor

bors commented Jul 9, 2024

☔ The latest upstream changes (presumably #127493) made this pull request unmergeable. Please resolve the merge conflicts.

Copy link
Member

@WaffleLapkin WaffleLapkin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know how to review this. T-lang's proposal looks to me like "let's make the lint incorrect". And I don't see why the lint is useful, if it's incorrect...

@workingjubilee
Copy link
Member

r? lang

@rustbot rustbot added the T-lang Relevant to the language team, which will review and decide on the PR/issue. label Jul 11, 2024
@rustbot rustbot assigned scottmcm and unassigned WaffleLapkin Jul 11, 2024
@workingjubilee
Copy link
Member

workingjubilee commented Jul 11, 2024

cc @rust-lang/lang also posted a followup comment in #126768 (comment)

@traviscross
Copy link
Contributor

traviscross commented Jul 11, 2024

Replied with further context and background over in #126768 (comment).

r? @workingjubilee

@rustbot rustbot assigned workingjubilee and unassigned scottmcm Jul 11, 2024
@workingjubilee
Copy link
Member

💭 ...if I asked for lang to review this, and then TC nominated me, does that mean I'm on lang? Is this my punishment for ribbing T-lang one too many times? Am I now the target of my own japes? ...oh no, I'm barely even awake at 9, how am I going to make a meeting at 8?

@traviscross
Copy link
Contributor

Maybe all of that? /s.... but no, seriously that was me just handing back off after answering the lang questions. Looking again, though, I mean to hand it back to compiler, so...

r? compiler

@michaelwoerister
Copy link
Member

r? diagnostics

@traviscross
Copy link
Contributor

traviscross commented Jul 20, 2024

@Urgau: That sounds right to me, but I'd probably point more normatively to my earlier comments if there were any questions here. And I think @BoxyUwU has a handle on this in any case.

@bors

This comment was marked as outdated.

@BoxyUwU
Copy link
Member

BoxyUwU commented Sep 19, 2024

Sorry for taking so long to get to this, I've been looking over this the past few days and will hopefully be done soon

@bors
Copy link
Contributor

bors commented Sep 23, 2024

☔ The latest upstream changes (presumably #130724) made this pull request unmergeable. Please resolve the merge conflicts.

@BoxyUwU
Copy link
Member

BoxyUwU commented Sep 24, 2024

I think the did_has_local_parent/path_has_local_parent logic is written confusingly which is why it took a while to wrap my head around how this file worked. That seems to be pre-existing so I'm fine to land this anyway.

@bors r+

@bors
Copy link
Contributor

bors commented Sep 24, 2024

📌 Commit 2423e9e has been approved by BoxyUwU

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 24, 2024
@bors
Copy link
Contributor

bors commented Sep 24, 2024

⌛ Testing commit 2423e9e with merge f5cd2c5...

@bors
Copy link
Contributor

bors commented Sep 24, 2024

☀️ Test successful - checks-actions
Approved by: BoxyUwU
Pushing f5cd2c5 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 24, 2024
@bors bors merged commit f5cd2c5 into rust-lang:master Sep 24, 2024
7 checks passed
@rustbot rustbot added this to the 1.83.0 milestone Sep 24, 2024
@Urgau Urgau added the relnotes Marks issues that should be documented in the release notes of the next release. label Sep 24, 2024
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (f5cd2c5): comparison URL.

Overall result: ❌✅ regressions and improvements - ACTION NEEDED

Next Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please open an issue or create a new PR that fixes the regressions, add a comment linking to the newly created issue or PR, and then add the perf-regression-triaged label to this PR.

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
3.3% [0.6%, 6.6%] 13
Regressions ❌
(secondary)
0.3% [0.1%, 0.4%] 3
Improvements ✅
(primary)
-0.7% [-1.0%, -0.2%] 8
Improvements ✅
(secondary)
-0.3% [-0.3%, -0.3%] 3
All ❌✅ (primary) 1.8% [-1.0%, 6.6%] 21

Max RSS (memory usage)

Results (primary 0.4%, secondary -3.3%)

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.

mean range count
Regressions ❌
(primary)
2.3% [2.3%, 2.3%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.4% [-1.4%, -1.4%] 1
Improvements ✅
(secondary)
-3.3% [-3.3%, -3.3%] 1
All ❌✅ (primary) 0.4% [-1.4%, 2.3%] 2

Cycles

Results (primary 1.8%, secondary 1.9%)

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.

mean range count
Regressions ❌
(primary)
2.9% [0.8%, 4.3%] 8
Regressions ❌
(secondary)
1.9% [1.9%, 1.9%] 1
Improvements ✅
(primary)
-0.6% [-0.7%, -0.5%] 4
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 1.8% [-0.7%, 4.3%] 12

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 768.261s -> 767.582s (-0.09%)
Artifact size: 341.50 MiB -> 341.38 MiB (-0.03%)

@rustbot rustbot added the perf-regression Performance regression. label Sep 24, 2024
@Urgau
Copy link
Member Author

Urgau commented Sep 24, 2024

Same as last times (#120393 (comment), #125722 (comment)), the version of diesel used by rustc-perf is too old and use named const AA items instead of un-named const _ items, making the lint trigger many times (more than 150 times last time). We ruled in the past that given the regression where located in one benchmark only, and only a pathological case that the regressions where fine. Marking as triaged.

@rustbot label: +perf-regression-triaged
cc rust-lang/rustc-perf#1819

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L-non_local_definitions Lint: non_local_definitions merged-by-bors This PR was explicitly merged by bors. perf-regression Performance regression. perf-regression-triaged The performance regression has been triaged. relnotes Marks issues that should be documented in the release notes of the next release. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-lang Relevant to the language team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

non_local_definitions lint fires for impl Trait for NonLocalType<SomeLocalType>, probably shouldn't