Only prefer param-env candidates if they remain non-global after norm by compiler-errors · Pull Request #140260 · rust-lang/rust (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

compiler-errors

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

@rustbot

HIR ty lowering was modified

cc @fmease

Some changes occurred to the core trait solver

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

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

@compiler-errors

@compiler-errors

@rust-log-analyzer

The job mingw-check failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

 Documenting rustc_next_trait_solver v0.0.0 (/checkout/compiler/rustc_next_trait_solver)
error: unresolved link to `I::DefId`
   --> compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs:161:15
    |
161 |     /// and [`I::DefId`].
    |               ^^^^^^^^ no item named `I` in scope
    |
    = note: `-D rustdoc::broken-intra-doc-links` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(rustdoc::broken_intra_doc_links)]`

error: could not document `rustc_next_trait_solver`
warning: build failed, waiting for other jobs to finish...
Command has failed. Rerun with -v to see more details.
Build completed unsuccessfully in 0:01:31
  local time: Thu Apr 24 16:40:45 UTC 2025
  network time: Thu, 24 Apr 2025 16:40:45 GMT
##[error]Process completed with exit code 1.
Post job cleanup.

lcnr

| .any(|c| { | | -------------------------------------------------------------------- | | matches!( | | c.source, | | CandidateSource::ParamEnv(_) | CandidateSource::GlobalParamEnv(_) |

Choose a reason for hiding this comment

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

vibe: bool on CandidateSource::ParamEnv seems nicer

@lcnr

pls add test

trait With { type Assoc; } impl With for T { type Assoc = T; }

trait Incomplete {} impl Incomplete for () {} fn impls_incomplete<T: Incomplete, U>() {} fn foo() where u32: With<Assoc = T>, (): Incomplete<::Assoc>, { impls_incomplete::<(), _>(); }

fn main() {}

edit: actually, added as part of #140313

@bors

@lcnr lcnr mentioned this pull request

Apr 28, 2025

bors added a commit to rust-lang-ci/rust that referenced this pull request

Apr 28, 2025

@bors

bors added a commit to rust-lang-ci/rust that referenced this pull request

Apr 29, 2025

@bors

bors added a commit to rust-lang-ci/rust that referenced this pull request

Apr 30, 2025

@bors

bors added a commit to rust-lang-ci/rust that referenced this pull request

Apr 30, 2025

@bors

bors added a commit to rust-lang-ci/rust that referenced this pull request

May 1, 2025

@bors

bors added a commit to rust-lang-ci/rust that referenced this pull request

May 3, 2025

@bors

bors added a commit to rust-lang-ci/rust that referenced this pull request

May 3, 2025

@bors

bors added a commit to rust-lang-ci/rust that referenced this pull request

May 5, 2025

@bors