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

some trait system cleanups #120463

Merged
merged 5 commits into from
Feb 19, 2024
Merged

Conversation

lcnr
Copy link
Contributor

@lcnr lcnr commented Jan 29, 2024

Always eagerly replace projections with infer vars if normalization is ambig. Unsure why we previously didn't do so, wasn't able to find an explanation in #90887. This adds some complexity to the trait system and is afaict unnecessary.

The second commit simplifies pred_known_to_hold_modulo_regions, afaict the optional fulfill isn't necessary anymore.

r? types cc @jackh726

@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 Jan 29, 2024
@lcnr
Copy link
Contributor Author

lcnr commented Jan 29, 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 Jan 29, 2024
@bors
Copy link
Contributor

bors commented Jan 29, 2024

⌛ Trying commit 9ab257b with merge 8e50202...

bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 29, 2024
…<try>

never normalize without eager inference replacement

unsure why we previously didn't do so, wasn't able to find an explanation in
rust-lang#90887. This adds some complexity to the trait system and is afaict unnecessary,

r? types cc `@jackh726`
@lcnr lcnr changed the title never normalize without eager inference replacement some trait system cleanups Jan 29, 2024
@compiler-errors
Copy link
Member

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 29, 2024
…<try>

some trait system cleanups

Always eagerly replace projections with infer vars if normalization is ambig. Unsure why we previously didn't do so, wasn't able to find an explanation in rust-lang#90887. This adds some complexity to the trait system and is afaict unnecessary.

The second commit simplifies `pred_known_to_hold_modulo_regions`, afaict the optional `fulfill` isn't necessary anymore.

r? types cc `@jackh726`
@bors
Copy link
Contributor

bors commented Jan 29, 2024

⌛ Trying commit 2b3867b with merge 1e74e30...

@compiler-errors
Copy link
Member

r=me after perf is clean.

I also cannot remember why + don't believe it's meaningful to make this distinction when lazily normalizing.

@bors
Copy link
Contributor

bors commented Jan 29, 2024

☀️ Try build successful - checks-actions
Build commit: 1e74e30 (1e74e30961d4f19fa2e064a923aa2ee5d79f0d85)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (1e74e30): comparison URL.

Overall result: no relevant changes - 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 benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results

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)
- - 0
Regressions ❌
(secondary)
2.1% [2.0%, 2.2%] 2
Improvements ✅
(primary)
-2.6% [-2.7%, -2.4%] 2
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -2.6% [-2.7%, -2.4%] 2

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: 660.078s -> 661.755s (0.25%)
Artifact size: 308.02 MiB -> 308.06 MiB (0.01%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jan 29, 2024
@jackh726
Copy link
Member

@bors r=jackh726,compiler-errors

I don't remember why I made the try version. There may have been something specific that I ran into, or it may have just been defensive against adding extra obligations when we can't actually make progress on them.

Obviously, test suite passes and no perf regression - happy to remove it.

@bors
Copy link
Contributor

bors commented Jan 29, 2024

📌 Commit 2b3867b has been approved by jackh726,compiler-errors

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 Jan 29, 2024
Copy link
Member

@jackh726 jackh726 left a comment

Choose a reason for hiding this comment

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

Actually, quick point. But the if below the normalize call will always be true now: we won't ever not replace the projection, with either the type or an infer var.

@rustbot rustbot added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jan 29, 2024
@jackh726
Copy link
Member

@bors r-

@bors bors removed the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jan 29, 2024
@jackh726
Copy link
Member

r=me with that change

@lcnr lcnr force-pushed the eager-inference-replacement branch from 2b3867b to f996e18 Compare January 30, 2024 15:15
@lcnr
Copy link
Contributor Author

lcnr commented Jan 30, 2024

Actually, quick point. But the if below the normalize call will always be true now: we won't ever not replace the projection, with either the type or an infer var.

only in evaluate, because we only do so for global goals. In fulfill the projection could be rigid, e.g. for <T as Trait>::Assoc: Trait.

@rust-log-analyzer

This comment has been minimized.

@bors bors added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Feb 10, 2024
@lcnr lcnr force-pushed the eager-inference-replacement branch from aa847c5 to 0b8770c Compare February 12, 2024 10:57
@lcnr
Copy link
Contributor Author

lcnr commented Feb 15, 2024

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 15, 2024
@bors
Copy link
Contributor

bors commented Feb 17, 2024

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

@lcnr lcnr force-pushed the eager-inference-replacement branch from 0b8770c to 0c7672a Compare February 19, 2024 08:17
Copy link
Member

@compiler-errors compiler-errors left a comment

Choose a reason for hiding this comment

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

but whatever, we'll find out the hard way

false
}
let obligation = Obligation::new(infcx.tcx, ObligationCause::dummy(), param_env, trait_ref);
infcx.predicate_must_hold_modulo_regions(&obligation)
Copy link
Member

Choose a reason for hiding this comment

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

There's a fair chance this will cause regression bc we're no longer falling back to fulfillment in the local infcx lol

Copy link
Contributor Author

@lcnr lcnr Feb 19, 2024

Choose a reason for hiding this comment

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

we could do a crater run? think it's fine though, reverting this is straightforward 😀

@compiler-errors
Copy link
Member

@bors r+ rollup=never (so bisection is easier)

@bors
Copy link
Contributor

bors commented Feb 19, 2024

📌 Commit 0c7672a has been approved by compiler-errors

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 Feb 19, 2024
@compiler-errors compiler-errors self-assigned this Feb 19, 2024
@bors
Copy link
Contributor

bors commented Feb 19, 2024

⌛ Testing commit 0c7672a with merge 0243834...

@bors
Copy link
Contributor

bors commented Feb 19, 2024

☀️ Test successful - checks-actions
Approved by: compiler-errors
Pushing 0243834 to master...

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

Finished benchmarking commit (0243834): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

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

Max RSS (memory usage)

Results

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)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-1.7% [-2.3%, -1.1%] 2
All ❌✅ (primary) - - 0

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: 640.759s -> 640.857s (0.02%)
Artifact size: 308.79 MiB -> 308.81 MiB (0.01%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants