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

Fix trait solver overflow with non_local_definitions lint #123594

Merged
merged 1 commit into from
Apr 21, 2024

Conversation

Urgau
Copy link
Member

@Urgau Urgau commented Apr 7, 2024

This PR fixes the trait solver overflow with the non_local_definitions lint reported in #123573 using the suggestion from @lcnr: #123573 (comment) to use the next trait solver.

I have not (yet) tried to create a minimized repro @compiler-errors did the minimization (thanks you) but I have manually tested on the starlark-rust project that it fixes the issue.

Fixes #123573
r? @lcnr

@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. labels Apr 7, 2024
@compiler-errors
Copy link
Member

compiler-errors commented Apr 7, 2024

I think I minimized a test:

pub trait Test {}

impl<'a, T: 'a> Test for &[T] where &'a T: Test {}

fn main() {
    struct Local {}
    impl Test for &Local {}
}

@Urgau Urgau force-pushed the fix-non_local_def-lint-overflow branch from ec3ee99 to 5250336 Compare April 8, 2024 05:57
@lcnr
Copy link
Contributor

lcnr commented Apr 8, 2024

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Apr 8, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 8, 2024
…w, r=<try>

Fix trait solver overflow with `non_local_definitions` lint

This PR fixes the trait solver overflow with the `non_local_definitions` lint reported in rust-lang#123573 using the suggestion from `@lcnr:` rust-lang#123573 (comment) to use the next trait solver.

~~I have not (yet) tried to create a minimized repro~~ ``@compiler-errors`` did the minimization (thanks you) but I have manually tested on the `starlark-rust` project that it fixes the issue.

Fixes rust-lang#123573
r? `@lcnr`
@bors
Copy link
Contributor

bors commented Apr 8, 2024

⌛ Trying commit 5250336 with merge fff3bb1...

@bors
Copy link
Contributor

bors commented Apr 8, 2024

☀️ Try build successful - checks-actions
Build commit: fff3bb1 (fff3bb18bd7c4c92cf9f277dffa7ff824422aa52)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (fff3bb1): comparison URL.

Overall result: ❌ regressions - no action needed

Benchmarking 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.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -perf-regression

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)
0.5% [0.5%, 0.5%] 1
Regressions ❌
(secondary)
0.3% [0.3%, 0.3%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.5% [0.5%, 0.5%] 1

Max RSS (memory usage)

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

Cycles

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

Binary size

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

Bootstrap: 667.477s -> 665.775s (-0.25%)
Artifact size: 318.52 MiB -> 318.75 MiB (0.07%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Apr 8, 2024
@lcnr
Copy link
Contributor

lcnr commented Apr 8, 2024

cc @rust-lang/types. this PR changes a lint to always use the new trait solver by default to avoid errors from fatal overflow with the old solver.

This lint always runs in an empty environment and does not use generic params. It therefore does not rely on any additional behavior not required for -Ztrait-solver=next which is getting stabilized separately. Given that it's a lint it is also not stability or soundness relevant.

@lcnr lcnr added T-types Relevant to the types team, which will review and decide on the PR/issue. and removed T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 8, 2024
@lcnr
Copy link
Contributor

lcnr commented Apr 8, 2024

Going to start a types FCP to officially state that going forward, the @rust-lang/initiative-trait-system-refactor has the authority to enable the use of the new solver on stable without FCPs as long as t-types is pinged in the PR and the affected area is neither relevant for soundness nor backwards compatibility.

@rfcbot fcp merge

@rfcbot
Copy link

rfcbot commented Apr 8, 2024

Team member @lcnr has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@rfcbot rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. labels Apr 8, 2024
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Apr 9, 2024
…=compiler-errors

Split `non_local_definitions` lint tests in separate test files

This PR splits the giant `non_local_definitions` lint UI test in separate test files.

This change is extracted from rust-lang#123594 (where it was requested rust-lang#123594 (comment)), to ease the review of the other PR and to reduce the size of the other PR.

r? `@compiler-errors`
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Apr 9, 2024
…=compiler-errors

Split `non_local_definitions` lint tests in separate test files

This PR splits the giant `non_local_definitions` lint UI test in separate test files.

This change is extracted from rust-lang#123594 (where it was requested rust-lang#123594 (comment)), to ease the review of the other PR and to reduce the size of the other PR.

r? ``@compiler-errors``
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Apr 9, 2024
Rollup merge of rust-lang#123653 - Urgau:split-test-non_local_defs, r=compiler-errors

Split `non_local_definitions` lint tests in separate test files

This PR splits the giant `non_local_definitions` lint UI test in separate test files.

This change is extracted from rust-lang#123594 (where it was requested rust-lang#123594 (comment)), to ease the review of the other PR and to reduce the size of the other PR.

r? ``@compiler-errors``
@bors
Copy link
Contributor

bors commented Apr 9, 2024

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

@Urgau Urgau force-pushed the fix-non_local_def-lint-overflow branch from 1286592 to c2e2245 Compare April 9, 2024 16:40
@rfcbot rfcbot added the final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. label Apr 10, 2024
@rfcbot rfcbot removed the proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. label Apr 10, 2024
@rfcbot
Copy link

rfcbot commented Apr 10, 2024

🔔 This is now entering its final comment period, as per the review above. 🔔

@rfcbot rfcbot added finished-final-comment-period The final comment period is finished for this PR / Issue. to-announce Announce this issue on triage meeting and removed final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. labels Apr 20, 2024
@rfcbot
Copy link

rfcbot commented Apr 20, 2024

The final comment period, with a disposition to merge, as per the review above, is now complete.

As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

This will be merged soon.

@lcnr
Copy link
Contributor

lcnr commented Apr 21, 2024

@bors r+

@bors
Copy link
Contributor

bors commented Apr 21, 2024

📌 Commit c2e2245 has been approved by lcnr

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 Apr 21, 2024
@bors
Copy link
Contributor

bors commented Apr 21, 2024

⌛ Testing commit c2e2245 with merge f22a0c2...

@bors
Copy link
Contributor

bors commented Apr 21, 2024

☀️ Test successful - checks-actions
Approved by: lcnr
Pushing f22a0c2 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Apr 21, 2024
@bors bors merged commit f22a0c2 into rust-lang:master Apr 21, 2024
12 checks passed
@rustbot rustbot added this to the 1.79.0 milestone Apr 21, 2024
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (f22a0c2): comparison URL.

Overall result: ❌ regressions - no action needed

@rustbot label: -perf-regression

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)
0.3% [0.3%, 0.3%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.3% [0.3%, 0.3%] 1

Max RSS (memory usage)

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

Cycles

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

Binary size

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

Bootstrap: 671.849s -> 669.682s (-0.32%)
Artifact size: 315.25 MiB -> 315.52 MiB (0.08%)

@apiraino apiraino removed the to-announce Announce this issue on triage meeting label Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-types Relevant to the types team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

nightly-2024-04-05 regression: error[E0275]: overflow evaluating the requirement
8 participants