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

instantiate higher ranked goals in candidate selection again #127568

Merged
merged 1 commit into from
Jul 10, 2024

Conversation

lcnr
Copy link
Contributor

@lcnr lcnr commented Jul 10, 2024

This reverts #119820 as that PR has a significant impact and breaks code which feels like it should work. The impact ended up being larger than we expected during the FCP and we've ended up with some ideas for how we can work around this issue in the next solver. This has been discussed in the previous high bandwidth t-types meeting: https://rust-lang.zulipchat.com/#narrow/stream/326132-t-types.2Fmeetings/topic/2024-07-09.20high.20bandwidth.20meeting.

We'll therefore keep this inconsistency between the two solvers for now and will have to deal with it before stabilizating the use of the new solver outside of coherence: rust-lang/trait-system-refactor-initiative#120.

fixes #125194 after a beta-backport.

The pattern which is more widely used than expected and feels like it should work, especially without deep knowledge of the type system is

trait Trait<'a> {}
impl<'a, T> Trait<'a> for T {}

fn trait_bound<T: for<'a> Trait<'a>>() {}

// A function with a where-bound which is more restrictive than the impl.
fn function1<T: Trait<'static>>() {
    // stable: ok
    // with #119820: error as we prefer the where-bound over the impl
    // with this PR: back to ok
    trait_bound::<T>();
}

r? @rust-lang/types

@lcnr lcnr added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Jul 10, 2024
@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 Jul 10, 2024
@oli-obk
Copy link
Contributor

oli-obk commented Jul 10, 2024

@bors r+

@bors
Copy link
Contributor

bors commented Jul 10, 2024

📌 Commit f77394f has been approved by oli-obk

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 Jul 10, 2024
@oli-obk oli-obk assigned oli-obk and unassigned BoxyUwU Jul 10, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 10, 2024
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#126476 (Fix running bootstrap tests with a local Rust toolchain as the stage0)
 - rust-lang#127094 (E0191 suggestion correction, inserts turbofish)
 - rust-lang#127554 ( do not run test where it cannot run)
 - rust-lang#127564 (Temporarily remove me from review rotation.)
 - rust-lang#127568 (instantiate higher ranked goals in candidate selection again)
 - rust-lang#127569 (Fix local download of Docker caches from CI)
 - rust-lang#127570 ( small normalization improvement)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 7faef5d into rust-lang:master Jul 10, 2024
6 checks passed
@rustbot rustbot added this to the 1.81.0 milestone Jul 10, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Jul 10, 2024
Rollup merge of rust-lang#127568 - lcnr:undo-leakcheck, r=oli-obk

instantiate higher ranked goals in candidate selection again

This reverts rust-lang#119820 as that PR has a significant impact and breaks code which *feels like it should work*. The impact ended up being larger than we expected during the FCP and we've ended up with some ideas for how we can work around this issue in the next solver. This has been discussed in the previous high bandwidth t-types meeting: https://rust-lang.zulipchat.com/#narrow/stream/326132-t-types.2Fmeetings/topic/2024-07-09.20high.20bandwidth.20meeting.

We'll therefore keep this inconsistency between the two solvers for now and will have to deal with it before stabilizating the use of the new solver outside of coherence: rust-lang/trait-system-refactor-initiative#120.

fixes rust-lang#125194 after a beta-backport.

The pattern which is more widely used than expected and feels like it should work, especially without deep knowledge of the type system is
```rust
trait Trait<'a> {}
impl<'a, T> Trait<'a> for T {}

fn trait_bound<T: for<'a> Trait<'a>>() {}

// A function with a where-bound which is more restrictive than the impl.
fn function1<T: Trait<'static>>() {
    // stable: ok
    // with rust-lang#119820: error as we prefer the where-bound over the impl
    // with this PR: back to ok
    trait_bound::<T>();
}

```

r? `@rust-lang/types`
@lcnr lcnr deleted the undo-leakcheck branch July 11, 2024 07:40
@apiraino
Copy link
Contributor

Beta backport accepted as per compiler team on Zulip. A backport PR will be authored by the release team at the end of the current development cycle.

@rustbot label +beta-accepted

@rustbot rustbot added the beta-accepted Accepted for backporting to the compiler in the beta channel. label Jul 11, 2024
@cuviper cuviper mentioned this pull request Jul 11, 2024
@cuviper cuviper modified the milestones: 1.81.0, 1.80.0 Jul 11, 2024
@cuviper cuviper removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Jul 11, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 12, 2024
[beta] backports

- Update LLVM submodule rust-lang#127364
- instantiate higher ranked goals in candidate selection again rust-lang#127568

r? cuviper
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta-accepted Accepted for backporting to the compiler in the beta channel. 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.

regression: trait bound not satisfied
7 participants