Skip to content

pix regression: env is global after normalization impl shadowing #179

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

Closed
compiler-errors opened this issue Apr 18, 2025 · 1 comment
Closed
Assignees
Labels
A-winnowing from-crater A regression found via a crater run, not part of our test suite

Comments

@compiler-errors
Copy link
Member

compiler-errors commented Apr 18, 2025

https://crater-reports.s3.amazonaws.com/pr-133502-2/try%23da0a4799770027c4c578bf48cdb390acfde09023/reg/pix-0.14.0/log.txt

Minimized:

struct NewSolver;
struct OldSolver;

fn foo<T>()
where
    T: Iterator<Item = NewSolver>,
    OldSolver: Into<T::Item>,
{
    let x: OldSolver = OldSolver.into();
}

New solver sees T::Item in where clause, prefers that b/c it mentions params even though it can be normalized, and chooses the OldSolver: Into<NewSolver> impl.

Old solver normalizes param-env, so it sees OldSolver: Into<NewSolver> is global, and chooses the reflexive T: Into<T> impl.

@compiler-errors compiler-errors marked this as a duplicate of #178 Apr 18, 2025
@lcnr lcnr added the from-crater A regression found via a crater run, not part of our test suite label Apr 19, 2025
@lcnr lcnr changed the title pix regression pix regression: env is global after normalization impl shadowing Apr 19, 2025
@lcnr lcnr moved this from unknown to in progress in -Znext-solver=globally Apr 24, 2025
Zalathar added a commit to Zalathar/rust that referenced this issue May 8, 2025
…orm, r=lcnr

Only prefer param-env candidates if they remain non-global after norm

Introduce `CandidateSource::GlobalParamEnv`, and dynamically compute the `CandidateSource` based on whether the predicate contains params *post-normalization*.

This code needs some cleanup and documentation. I'm just putting this up for review.

cc rust-lang/trait-system-refactor-initiative#179

r? lcnr
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue May 8, 2025
…orm, r=lcnr

Only prefer param-env candidates if they remain non-global after norm

Introduce `CandidateSource::GlobalParamEnv`, and dynamically compute the `CandidateSource` based on whether the predicate contains params *post-normalization*.

This code needs some cleanup and documentation. I'm just putting this up for review.

cc rust-lang/trait-system-refactor-initiative#179

r? lcnr
rust-timer added a commit to rust-lang-ci/rust that referenced this issue May 8, 2025
Rollup merge of rust-lang#140260 - compiler-errors:only-global-post-norm, r=lcnr

Only prefer param-env candidates if they remain non-global after norm

Introduce `CandidateSource::GlobalParamEnv`, and dynamically compute the `CandidateSource` based on whether the predicate contains params *post-normalization*.

This code needs some cleanup and documentation. I'm just putting this up for review.

cc rust-lang/trait-system-refactor-initiative#179

r? lcnr
@lcnr
Copy link
Contributor

lcnr commented May 8, 2025

fixed by #140260

@lcnr lcnr closed this as completed May 8, 2025
@lcnr lcnr moved this from in progress to done in -Znext-solver=globally May 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-winnowing from-crater A regression found via a crater run, not part of our test suite
Projects
Development

No branches or pull requests

2 participants