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

normalize in trait_ref_is_knowable in new solver #114457

Merged
merged 2 commits into from
Aug 13, 2023

Conversation

lcnr
Copy link
Contributor

@lcnr lcnr commented Aug 4, 2023

fixes rust-lang/trait-system-refactor-initiative#51

Alternatively we could avoid normalizing the self type and do this at the end of the assemble_candidates_via_self_ty stack by splitting candidates into:

  • applicable without normalizing self type
  • applicable for aliases, even if they can be normalized
  • applicable for stuff which cannot get normalized further

I don't think this would have any significant benefits and it also seems non-trivial to avoid normalizing only the self type in trait_ref_is_knowable.

r? @compiler-errors

@lcnr lcnr added the A-coherence Area: Coherence label Aug 4, 2023
@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. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Aug 4, 2023
@rustbot
Copy link
Collaborator

rustbot commented Aug 4, 2023

Some changes occurred to the core trait solver

cc @rust-lang/initiative-trait-system-refactor

Comment on lines +902 to +892
#[derive(Debug)]
enum FailureKind {
Overflow,
NoSolution(NoSolution),
}
Copy link
Member

Choose a reason for hiding this comment

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

Do you think lazy_normalize_ty should just return this FailureKind?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm, I think it's valuable to guarantee that trait_ref_is_knowable always returns the outer Ok when used outside of the new solver

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.

r=me nit or not

@compiler-errors compiler-errors 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 Aug 4, 2023
@bors
Copy link
Contributor

bors commented Aug 5, 2023

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

@lcnr lcnr force-pushed the trait_ref_is_knowable-normalize branch from d2d3fd4 to ff150f9 Compare August 7, 2023 20:11
@lcnr
Copy link
Contributor Author

lcnr commented Aug 7, 2023

@bors r=compiler-errors rollup

@bors
Copy link
Contributor

bors commented Aug 7, 2023

📌 Commit ff150f9 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 7, 2023
@rust-log-analyzer

This comment has been minimized.

@compiler-errors
Copy link
Member

@bors r-

looks like we're hitting that stability assertion :(

@bors bors 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Aug 7, 2023
@lcnr
Copy link
Contributor Author

lcnr commented Aug 8, 2023

that sure is a nice way to get a minimized test ✨

@lcnr
Copy link
Contributor Author

lcnr commented Aug 8, 2023

lowered the stability check to a warn! and accepted it with a FIXME. It is non-trivial to fix and by keeping it as a warn we should be able to actually keep it enabled while testing stuff.

@lcnr
Copy link
Contributor Author

lcnr commented Aug 8, 2023

see rust-lang/trait-system-refactor-initiative#54 for an issue tracking the evaluate goal instability bug.

@bors r=compiler-errors rollup (new solver)

@bors
Copy link
Contributor

bors commented Aug 8, 2023

📌 Commit 48b5dbd 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 8, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Aug 8, 2023
…ze, r=compiler-errors

normalize in `trait_ref_is_knowable` in new solver

fixes rust-lang/trait-system-refactor-initiative#51

Alternatively we could avoid normalizing the self type and do this at the end of the `assemble_candidates_via_self_ty` stack by splitting candidates into:
- applicable without normalizing self type
- applicable for aliases, even if they can be normalized
- applicable for stuff which cannot get normalized further

I don't think this would have any significant benefits and it also seems non-trivial to avoid normalizing only the self type in `trait_ref_is_knowable`.

r? `@compiler-errors`
}

Ok((has_changed, certainty, nested_goals))
}

fn check_evaluate_goal_stable_result(
Copy link
Member

Choose a reason for hiding this comment

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

This check should even when debug assertions are enabled -- otherwise, there's UI test instability between rustc w/ debug_assertions and not.

@compiler-errors
Copy link
Member

Failed in rollup

@bors r-

#114632 (comment)

@bors bors 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Aug 8, 2023
@lcnr lcnr force-pushed the trait_ref_is_knowable-normalize branch 3 times, most recently from bf154dc to d502fff Compare August 10, 2023 12:44
@lcnr
Copy link
Contributor Author

lcnr commented Aug 10, 2023

rebased on top of #114694 so evaluate_goal is stable now. Marking it as blocked on this PR

@lcnr lcnr added S-blocked Status: Blocked on something else such as an RFC or other implementation work. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 10, 2023
@lcnr lcnr force-pushed the trait_ref_is_knowable-normalize branch from d502fff to 5176288 Compare August 12, 2023 18:50
@compiler-errors
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Aug 12, 2023

📌 Commit 5176288 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-blocked Status: Blocked on something else such as an RFC or other implementation work. labels Aug 12, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Aug 12, 2023
…ze, r=compiler-errors

normalize in `trait_ref_is_knowable` in new solver

fixes rust-lang/trait-system-refactor-initiative#51

Alternatively we could avoid normalizing the self type and do this at the end of the `assemble_candidates_via_self_ty` stack by splitting candidates into:
- applicable without normalizing self type
- applicable for aliases, even if they can be normalized
- applicable for stuff which cannot get normalized further

I don't think this would have any significant benefits and it also seems non-trivial to avoid normalizing only the self type in `trait_ref_is_knowable`.

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

bors commented Aug 13, 2023

⌛ Testing commit 5176288 with merge 7455aa5...

@bors
Copy link
Contributor

bors commented Aug 13, 2023

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

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Aug 13, 2023
@bors bors merged commit 7455aa5 into rust-lang:master Aug 13, 2023
@rustbot rustbot added this to the 1.73.0 milestone Aug 13, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (7455aa5): 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
Regressions ❌
(secondary)
0.4% [0.4%, 0.4%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Max RSS (memory usage)

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

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)
3.1% [2.0%, 4.7%] 9
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Binary size

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

Bootstrap: 632.32s -> 633.837s (0.24%)

@lcnr lcnr deleted the trait_ref_is_knowable-normalize branch August 14, 2023 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-coherence Area: Coherence 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.

Trait ref is not considered knowable due to normalization
6 participants