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

Range iteration specialization: remove trivial bounds #124380

Merged
merged 1 commit into from
Apr 25, 2024

Conversation

lcnr
Copy link
Contributor

@lcnr lcnr commented Apr 25, 2024

These bounds on impl items are trivially true and never checked by a caller. They end up shadowing the actual impls, currently preventing normalization in the new solver. While we may have to fix the underlying issue in the new solver at some point, for now this is an easy way to get us closer to compiling core with -Znext-solver.

r? @Nilstrieb

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Apr 25, 2024
fn spec_next_back(&mut self) -> Option<Self::Item>
where Range<$t>: DoubleEndedIterator + ExactSizeIterator,
{
fn spec_next_back(&mut self) -> Option<Self::Item> {
Copy link
Member

@compiler-errors compiler-errors Apr 25, 2024

Choose a reason for hiding this comment

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

Forgetting a bound here is sound because we already validate for method compatibility in compare_method_predicate_entailment.

But in this case the bound is not forgotten -- it's just trivial.

@Noratrieb
Copy link
Member

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Apr 25, 2024

📌 Commit ce70584 has been approved by Nilstrieb

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 25, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 25, 2024
…r=<try>

`obligations_for_self_ty`: use `ProofTreeVisitor` for nested goals

As always, dealing with proof trees continues to be a hacked together mess. After this PR and rust-lang#124380 the only remaining blocker for core is rust-lang/trait-system-refactor-initiative#90. There is also a `ProofTreeVisitor` issue causing an ICE when compiling `alloc` which I will handle in a separate PR. This issue likely affects coherence diagnostics more generally.

The core idea is to extend the proof tree visitor to support visiting nested candidates without using a `probe`. We then simply recurse into nested candidates if they are the only potentially applicable candidate for a given goal and check whether the self type matches the expected one.

For that to work, we need to improve `CanonicalState` to also handle unconstrained inference variables created inside of the trait solver. This is done by extending the `var_values` of `CanoncalState` with each fresh inference variables. Furthermore, we also store the state of all inference variables at the end of each probe. When recursing into `InspectCandidates` we then unify the values of all these states.

r? `@compiler-errors`
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 25, 2024
…iaskrgr

Rollup of 3 pull requests

Successful merges:

 - rust-lang#124313 (Detect borrow error involving sub-slices and suggest `split_at_mut`)
 - rust-lang#124374 (Don't ICE when `codegen_select_candidate` returns ambiguity in new solver)
 - rust-lang#124380 (`Range` iteration specialization: remove trivial bounds)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 3c0c5b4 into rust-lang:master Apr 25, 2024
10 checks passed
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Apr 25, 2024
Rollup merge of rust-lang#124380 - lcnr:std-unnecessary-params, r=Nilstrieb

`Range` iteration specialization: remove trivial bounds

These bounds on impl items are trivially true and never checked by a caller. They end up shadowing the actual impls, currently preventing normalization in the new solver. While we may have to fix the underlying issue in the new solver at some point, for now this is an easy way to get us closer to compiling core with `-Znext-solver`.

r? `@Nilstrieb`
@rustbot rustbot added this to the 1.79.0 milestone Apr 25, 2024
@lcnr lcnr deleted the std-unnecessary-params branch April 26, 2024 01:13
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 26, 2024
…r=<try>

`obligations_for_self_ty`: use `ProofTreeVisitor` for nested goals

As always, dealing with proof trees continues to be a hacked together mess. After this PR and rust-lang#124380 the only remaining blocker for core is rust-lang/trait-system-refactor-initiative#90. There is also a `ProofTreeVisitor` issue causing an ICE when compiling `alloc` which I will handle in a separate PR. This issue likely affects coherence diagnostics more generally.

The core idea is to extend the proof tree visitor to support visiting nested candidates without using a `probe`. We then simply recurse into nested candidates if they are the only potentially applicable candidate for a given goal and check whether the self type matches the expected one.

For that to work, we need to improve `CanonicalState` to also handle unconstrained inference variables created inside of the trait solver. This is done by extending the `var_values` of `CanoncalState` with each fresh inference variables. Furthermore, we also store the state of all inference variables at the end of each probe. When recursing into `InspectCandidates` we then unify the values of all these states.

r? `@compiler-errors`
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 26, 2024
…r=compiler-errors

`obligations_for_self_ty`: use `ProofTreeVisitor` for nested goals

As always, dealing with proof trees continues to be a hacked together mess. After this PR and rust-lang#124380 the only remaining blocker for core is rust-lang/trait-system-refactor-initiative#90. There is also a `ProofTreeVisitor` issue causing an ICE when compiling `alloc` which I will handle in a separate PR. This issue likely affects coherence diagnostics more generally.

The core idea is to extend the proof tree visitor to support visiting nested candidates without using a `probe`. We then simply recurse into nested candidates if they are the only potentially applicable candidate for a given goal and check whether the self type matches the expected one.

For that to work, we need to improve `CanonicalState` to also handle unconstrained inference variables created inside of the trait solver. This is done by extending the `var_values` of `CanoncalState` with each fresh inference variables. Furthermore, we also store the state of all inference variables at the end of each probe. When recursing into `InspectCandidates` we then unify the values of all these states.

r? `@compiler-errors`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants