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

selection failure: recompute applicable impls #103252

Merged
merged 3 commits into from
Nov 8, 2022

Conversation

lcnr
Copy link
Contributor

@lcnr lcnr commented Oct 19, 2022

The way we currently skip errors for ambiguous trait obligations seems pretty fragile so we get some duplicate errors because of this.

Removing this info from selection errors changes this system to be closer to my image of our new trait solver and is also making it far easier to change overflow errors to be non-fatal ✨

r? types cc @estebank

@rustbot rustbot added A-testsuite Area: The testsuite used to check the correctness of rustc T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 19, 2022
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 19, 2022
@lcnr lcnr force-pushed the recompute_applicable_impls branch from fe839c3 to 026ef10 Compare October 19, 2022 15:28
@lcnr lcnr added the A-type-system Area: Type system label Oct 19, 2022
@lcnr
Copy link
Contributor Author

lcnr commented Oct 20, 2022

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 20, 2022
@bors
Copy link
Contributor

bors commented Oct 20, 2022

⌛ Trying commit 026ef1007007420a7e7e7ca26b12ff73d1c7fd1d with merge 693bcdf375a5de5bd69df28f9984da1c1c64bea5...

@bors
Copy link
Contributor

bors commented Oct 20, 2022

☀️ Try build successful - checks-actions
Build commit: 693bcdf375a5de5bd69df28f9984da1c1c64bea5 (693bcdf375a5de5bd69df28f9984da1c1c64bea5)

@rust-timer
Copy link
Collaborator

Queued 693bcdf375a5de5bd69df28f9984da1c1c64bea5 with parent ebdde35, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (693bcdf375a5de5bd69df28f9984da1c1c64bea5): comparison URL.

Overall result: ✅ improvements - 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-review -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.

mean1 range count2
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.3% [-0.3%, -0.3%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.3% [-0.3%, -0.3%] 1

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.

mean1 range count2
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
3.7% [2.3%, 4.8%] 5
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Cycles

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

Footnotes

  1. the arithmetic mean of the percent change 2

  2. number of relevant changes 2

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 20, 2022
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.

This is going to take me more time than I have right now to do a real review, but I'm somewhat concerned about the extra duplicate diagnostics here. I'd like to get @estebank's okay on that.

I'll try to do an actual review by end of this weekend.

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.

Changes themselves make sense to me, but as I said, I'd like @estebank's thoughts on duplicated errors

@lcnr lcnr force-pushed the recompute_applicable_impls branch from 026ef10 to cc5ffcf Compare October 24, 2022 08:29
Copy link
Contributor

@estebank estebank left a comment

Choose a reason for hiding this comment

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

I'm sad to see duplicated errors, but I can also see a path forward to deduplicate based purely on the main span if that's our only choice. I'm looking further to see if I can think of a deduplication mechanism we can use before landing, but won't block moving forward.

@lcnr lcnr force-pushed the recompute_applicable_impls branch from cc5ffcf to 2afa416 Compare October 31, 2022 09:28
@lcnr
Copy link
Contributor Author

lcnr commented Oct 31, 2022

@bors r=jackh726

@bors
Copy link
Contributor

bors commented Oct 31, 2022

📌 Commit 2afa416a30b6ed286864c81760caf2fbeb43dc91 has been approved by jackh726

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 Oct 31, 2022
@bors
Copy link
Contributor

bors commented Nov 1, 2022

⌛ Testing commit 2afa416a30b6ed286864c81760caf2fbeb43dc91 with merge 4cdc4e4b913b4e277a85a689a0e7babe239ac714...

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Nov 1, 2022

💔 Test failed - checks-actions

@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 Nov 1, 2022
@lcnr
Copy link
Contributor Author

lcnr commented Nov 3, 2022

not a perfect solution, but I changed the code to only run if there are less than 5 applicable impls. If there are more and we would shorten the list of applicable impls anyways, it doesn't really make sense to talk about those.

As I've already talked about that with @jackh726

@bors r=jackh726

@bors
Copy link
Contributor

bors commented Nov 3, 2022

📌 Commit 689dcc4dee059af553c4324afd474afe853cfef5 has been approved by jackh726

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 Nov 3, 2022
@bors
Copy link
Contributor

bors commented Nov 4, 2022

⌛ Testing commit 689dcc4dee059af553c4324afd474afe853cfef5 with merge 8b47b1072029bed5d029c44d7c9200dca1e0bfbc...

@bors
Copy link
Contributor

bors commented Nov 4, 2022

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Nov 4, 2022
@rust-log-analyzer

This comment has been minimized.

@jackh726 jackh726 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 Nov 7, 2022
@lcnr lcnr force-pushed the recompute_applicable_impls branch from 689dcc4 to a45ea63 Compare November 8, 2022 13:29
@lcnr lcnr force-pushed the recompute_applicable_impls branch from a45ea63 to 91d5a32 Compare November 8, 2022 13:48
@@ -38,7 +38,7 @@ impl<'tcx> TraitEngineExt<'tcx> for dyn TraitEngine<'tcx> {

fn new_in_snapshot(tcx: TyCtxt<'tcx>) -> Box<Self> {
if tcx.sess.opts.unstable_opts.chalk {
Box::new(ChalkFulfillmentContext::new())
Box::new(ChalkFulfillmentContext::new_in_snapshot())
Copy link
Member

Choose a reason for hiding this comment

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

Is this needed for the changes here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, because ObligationCtxt::new_in_snapshot is used in fn recompute_ambiguous_candidates inside of a snapshot

@jackh726
Copy link
Member

jackh726 commented Nov 8, 2022

@bors r+

@bors
Copy link
Contributor

bors commented Nov 8, 2022

📌 Commit 91d5a32 has been approved by jackh726

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 8, 2022
@bors
Copy link
Contributor

bors commented Nov 8, 2022

⌛ Testing commit 91d5a32 with merge 85f4f41...

@bors
Copy link
Contributor

bors commented Nov 8, 2022

☀️ Test successful - checks-actions
Approved by: jackh726
Pushing 85f4f41 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Nov 8, 2022
@bors bors merged commit 85f4f41 into rust-lang:master Nov 8, 2022
@rustbot rustbot added this to the 1.67.0 milestone Nov 8, 2022
@rust-timer
Copy link
Collaborator

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

Cycles

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

@lcnr lcnr deleted the recompute_applicable_impls branch November 9, 2022 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc A-type-system Area: Type system 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.

8 participants