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

a general type system cleanup #109119

Merged
merged 3 commits into from
Mar 22, 2023
Merged

a general type system cleanup #109119

merged 3 commits into from
Mar 22, 2023

Conversation

lcnr
Copy link
Contributor

@lcnr lcnr commented Mar 14, 2023

removes the helper functions traits::fully_solve_X as they add more complexity then they are worth. It's confusing which of these helpers should be used in which context.

changes the way we deal with overflow to always add depth in evaluate_predicates_recursively. It may make sense to actually fully transition to not have recursion_depth on obligations but that's probably a bit too much for this PR.

also removes some other small - and imo unnecessary - helpers.

r? types

@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 Mar 14, 2023
@lcnr lcnr added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 14, 2023
@lcnr lcnr changed the title remove some trait solver helpers a general type system cleanup Mar 14, 2023
@lcnr
Copy link
Contributor Author

lcnr commented Mar 14, 2023

changes to the recursion depth are scary as they can easily break crates which recurse right until that depth.

@bors try @rust-timer build

@bors
Copy link
Contributor

bors commented Mar 14, 2023

⌛ Trying commit 66ce86eb3b9141650972282a4c568bc2d6f76863 with merge b9d6bd6dc9d9fa058c92b56258df6e48604cc5b7...

@lcnr
Copy link
Contributor Author

lcnr commented Mar 14, 2023

@rust-timer queue

it's not build '^^

@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 Mar 14, 2023
@rustbot
Copy link
Collaborator

rustbot commented Mar 14, 2023

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

@@ -59,6 +59,7 @@ fn equate_intrinsic_type<'tcx>(
require_same_types(
tcx,
&cause,
ty::ParamEnv::empty(), // FIXME: do all intrinsics have an empty param env?
Copy link
Member

Choose a reason for hiding this comment

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

Intrinsics can have where clauses (const_eval_select is the only one at first glance?)

// FIXME: This should potentially just add the obligation to the `FnCtxt`
let ocx = ObligationCtxt::new(&self.infcx);
ocx.register_obligation(obligation);
Err(ocx.select_all_or_error())
Copy link
Member

Choose a reason for hiding this comment

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

We probably use these errors eagerly for better diagnostics. It's likely possible to re-create this obligation_for_method in the diagnostics code and re-process it though, or move the diagnostics code into the ObligationCauseCode::BinOp handling branch of note_cause_code or whatever.

compiler/rustc_lint/src/for_loops_over_fallibles.rs Outdated Show resolved Hide resolved

let has_impl = self.infcx.predicate_may_hold(&obligation);
// FIXME: should this call a `predicate_must_hold` variant instead?
Copy link
Member

Choose a reason for hiding this comment

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

Probably.

@compiler-errors
Copy link
Member

@bors try

@bors
Copy link
Contributor

bors commented Mar 14, 2023

⌛ Trying commit 774e3effe1d05b60f5829730be7f7a13abc1be3e with merge 7a89b05fa7ebfbb9dd798a7dbd888c0550beb838...

@bors
Copy link
Contributor

bors commented Mar 14, 2023

☀️ Try build successful - checks-actions
Build commit: 7a89b05fa7ebfbb9dd798a7dbd888c0550beb838 (7a89b05fa7ebfbb9dd798a7dbd888c0550beb838)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (7a89b05fa7ebfbb9dd798a7dbd888c0550beb838): 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)
1.6% [1.6%, 1.6%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.2% [-4.0%, -2.4%] 2
All ❌✅ (primary) - - 0

Cycles

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)
-4.4% [-5.2%, -3.6%] 4
All ❌✅ (primary) - - 0

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 15, 2023
@compiler-errors
Copy link
Member

let's see if anything breaks due to the recursion depth changes

@craterbot check

@craterbot
Copy link
Collaborator

👌 Experiment pr-109119 created and queued.
🤖 Automatically detected try build 7a89b05fa7ebfbb9dd798a7dbd888c0550beb838
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 15, 2023
@craterbot
Copy link
Collaborator

🚧 Experiment pr-109119 is now running

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@lcnr lcnr force-pushed the trait-system-cleanup branch from 774e3ef to 5b7662d Compare March 15, 2023 13:39
@craterbot
Copy link
Collaborator

🎉 Experiment pr-109119 is completed!
📊 29 regressed and 6 fixed (258511 total)
📰 Open the full report.

⚠️ If you notice any spurious failure please add them to the blacklist!
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-crater Status: Waiting on a crater run to be completed. labels Mar 16, 2023
@lcnr
Copy link
Contributor Author

lcnr commented Mar 16, 2023

the only breakage seems to be https://crates.io/crates/indented-blocks/0.6.0 which has an explicit #[recursion_limit = 8] in its source. I don't think we should care about breaking that.

@rustbot ready

@compiler-errors
Copy link
Member

r=me rebased

lcnr added 3 commits March 21, 2023 09:57
they add more complexity then they are worth. It's confusing
which of these helpers should be used in which context.
@lcnr lcnr force-pushed the trait-system-cleanup branch from 5b7662d to b8541eb Compare March 21, 2023 09:05
@lcnr
Copy link
Contributor Author

lcnr commented Mar 21, 2023

@bors r+

@bors
Copy link
Contributor

bors commented Mar 21, 2023

📌 Commit b8541eb 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 Mar 21, 2023
@compiler-errors
Copy link
Member

@bors r=compiler-errors

@bors
Copy link
Contributor

bors commented Mar 21, 2023

💡 This pull request was already approved, no need to approve it again.

@bors
Copy link
Contributor

bors commented Mar 21, 2023

📌 Commit b8541eb has been approved by compiler-errors

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Mar 22, 2023

⌛ Testing commit b8541eb with merge 9bdb488...

@bors
Copy link
Contributor

bors commented Mar 22, 2023

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

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Mar 22, 2023
@bors bors merged commit 9bdb488 into rust-lang:master Mar 22, 2023
@rustbot rustbot added this to the 1.70.0 milestone Mar 22, 2023
@lcnr lcnr deleted the trait-system-cleanup branch March 22, 2023 08:38
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (9bdb488): 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.6% [0.5%, 0.8%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.8% [-1.0%, -0.6%] 4
All ❌✅ (primary) - - 0

Cycles

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.9% [0.4%, 1.4%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.8% [-1.1%, -0.5%] 4
All ❌✅ (primary) - - 0

flip1995 pushed a commit to flip1995/rust that referenced this pull request Mar 24, 2023
…r-errors

a general type system cleanup

removes the helper functions `traits::fully_solve_X` as they add more complexity then they are worth. It's confusing which of these helpers should be used in which context.

changes the way we deal with overflow to always add depth in `evaluate_predicates_recursively`. It may make sense to actually fully transition to not have `recursion_depth` on obligations but that's probably a bit too much for this PR.

also removes some other small - and imo unnecessary - helpers.

r? types
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants