next solver: prefer to select impl candidates over global where-clause candidates - #162655
Conversation
| // Don't winnow until `Certainty::Yes` -- we don't need to winnow until | ||
| // codegen, and only on the good path. | ||
| // Don't winnow until `Certainty::Yes` -- we don't need to winnow until constant evaluation or | ||
| // codegen. |
There was a problem hiding this comment.
not totally sure what to do with this comment, but seeing as it was wrong before, I'd like to update it in some way
There was a problem hiding this comment.
seems good enough.
select is slightly weird in general rn and will clean this up post next-solver stabilization https://github.com/rust-lang/trait-system-refactor-initiative/blob/main/notes/stabilization-report/proof-tree-visitors.md#select
| ( | ||
| CandidateSource::ParamEnv(ParamEnvSource::Global), | ||
| CandidateSource::Impl(_) | CandidateSource::BuiltinImpl(_), | ||
| ) => true, |
There was a problem hiding this comment.
maybe this could be more aggressive? I'm not sure what else would be needed, so I'm treating this as a targeted fix. so far, I haven't been able to find any examples that would still fail without this if const-to-pat resolved and evaluated consts in a clean environment (e.g. as it does when full gca is enabled)
| #![feature(const_trait_impl)] | ||
| #![feature(const_clone)] |
There was a problem hiding this comment.
this is for testing the preference for builtin impls over global where-clause candidates. I haven't found a way to do that without unstable features
There was a problem hiding this comment.
want to split this out into a separate test given that the other one doesn't rely on unstable features?
| //@ revisions: current next | ||
| //@ ignore-compare-mode-next-solver (explicit revisions) | ||
| //@[next] compile-flags: -Znext-solver |
There was a problem hiding this comment.
could maybe get rid of the current-solver revision but I figured I'd include it as a sanity check
|
r? @lcnr or reassign |
|
Some changes occurred to the core trait solver cc @rust-lang/initiative-trait-system-refactor |
79010d2 to
e10ae86
Compare
e10ae86 to
b6d0fb1
Compare
|
nit addressed! I needed to come up with new test names and tweak the comments on the split-out test a bit to make up for missing context, but I'm going to assume that's minor enough to @bors r=lcnr |
…=lcnr next solver: prefer to select impl candidates over global where-clause candidates Fixes rust-lang#162331 Ideally we'd use a more appropriate typing environment when doing const-eval for const-to-pat, which would also fix that (since the problem clauses wouldn't be present to begin with). Being able to do that seems kind of far off, though, so here's a quick fix that (mostly) matches what the old solver does.
…=lcnr next solver: prefer to select impl candidates over global where-clause candidates Fixes rust-lang#162331 Ideally we'd use a more appropriate typing environment when doing const-eval for const-to-pat, which would also fix that (since the problem clauses wouldn't be present to begin with). Being able to do that seems kind of far off, though, so here's a quick fix that (mostly) matches what the old solver does.
…uwer Rollup of 15 pull requests Successful merges: - #158936 (Add `std::fs::{Home|Media}Dirs`) - #129036 (Additional NonZero conversions) - #158997 (Avoid recording unnameable `extern crate` aliases in diagnostic metadata) - #161015 (Stabilize `funnel_shifts` (including `const`)) - #161712 (Stabilize `Result::into_{ok,err}`) - #162493 (Add support for -Zsanitizer-cfi-minimal-runtime) - #162655 (next solver: prefer to select impl candidates over global where-clause candidates) - #162862 (Fix intra doc link resolution when a doc comment is composed of both inner and outer doc comment) - #163200 (make `RustaceansAreAwesome` satisfy trait bounds) - #163331 (Move `Arc` and `Rc` into `rcs` mod) - #163427 (implement #![feature(gca_adts)]) - #163428 (do not complain about unstable target features on nightly) - #163444 (Add `stable_rustc` helper in `run-make-support`) - #163447 (Allow using different index types when reading and writing to tables) - #163450 (Force the correct type variable to never for method resolution on an adjusted never type)
…=lcnr next solver: prefer to select impl candidates over global where-clause candidates Fixes rust-lang#162331 Ideally we'd use a more appropriate typing environment when doing const-eval for const-to-pat, which would also fix that (since the problem clauses wouldn't be present to begin with). Being able to do that seems kind of far off, though, so here's a quick fix that (mostly) matches what the old solver does.
…uwer Rollup of 9 pull requests Successful merges: - #162655 (next solver: prefer to select impl candidates over global where-clause candidates) - #162832 (add `Div` and `Mul` for `Complex<{float}>`) - #162862 (Fix intra doc link resolution when a doc comment is composed of both inner and outer doc comment) - #163024 (Add `Dir` equivalents of `fs::metadata` & `fs::symlink_metadata`) - #163200 (make `RustaceansAreAwesome` satisfy trait bounds) - #163210 (std: split stack overflow module) - #163331 (Move `Arc` and `Rc` into `rcs` mod) - #163183 (Add .seek_read_buf_exact() to std::os::windows::fs::FileExt) - #163450 (Force the correct type variable to never for method resolution on an adjusted never type)
…uwer Rollup of 9 pull requests Successful merges: - #158997 (Avoid recording unnameable `extern crate` aliases in diagnostic metadata) - #162655 (next solver: prefer to select impl candidates over global where-clause candidates) - #162832 (add `Div` and `Mul` for `Complex<{float}>`) - #162862 (Fix intra doc link resolution when a doc comment is composed of both inner and outer doc comment) - #163200 (make `RustaceansAreAwesome` satisfy trait bounds) - #163210 (std: split stack overflow module) - #163331 (Move `Arc` and `Rc` into `rcs` mod) - #163183 (Add .seek_read_buf_exact() to std::os::windows::fs::FileExt) - #163450 (Force the correct type variable to never for method resolution on an adjusted never type)
Rollup merge of #162655 - dianne:drop-paramenv-candidates, r=lcnr next solver: prefer to select impl candidates over global where-clause candidates Fixes #162331 Ideally we'd use a more appropriate typing environment when doing const-eval for const-to-pat, which would also fix that (since the problem clauses wouldn't be present to begin with). Being able to do that seems kind of far off, though, so here's a quick fix that (mostly) matches what the old solver does.
…uwer Rollup of 9 pull requests Successful merges: - rust-lang/rust#158997 (Avoid recording unnameable `extern crate` aliases in diagnostic metadata) - rust-lang/rust#162655 (next solver: prefer to select impl candidates over global where-clause candidates) - rust-lang/rust#162832 (add `Div` and `Mul` for `Complex<{float}>`) - rust-lang/rust#162862 (Fix intra doc link resolution when a doc comment is composed of both inner and outer doc comment) - rust-lang/rust#163200 (make `RustaceansAreAwesome` satisfy trait bounds) - rust-lang/rust#163210 (std: split stack overflow module) - rust-lang/rust#163331 (Move `Arc` and `Rc` into `rcs` mod) - rust-lang/rust#163183 (Add .seek_read_buf_exact() to std::os::windows::fs::FileExt) - rust-lang/rust#163450 (Force the correct type variable to never for method resolution on an adjusted never type)
…uwer Rollup of 9 pull requests Successful merges: - rust-lang/rust#158997 (Avoid recording unnameable `extern crate` aliases in diagnostic metadata) - rust-lang/rust#162655 (next solver: prefer to select impl candidates over global where-clause candidates) - rust-lang/rust#162832 (add `Div` and `Mul` for `Complex<{float}>`) - rust-lang/rust#162862 (Fix intra doc link resolution when a doc comment is composed of both inner and outer doc comment) - rust-lang/rust#163200 (make `RustaceansAreAwesome` satisfy trait bounds) - rust-lang/rust#163210 (std: split stack overflow module) - rust-lang/rust#163331 (Move `Arc` and `Rc` into `rcs` mod) - rust-lang/rust#163183 (Add .seek_read_buf_exact() to std::os::windows::fs::FileExt) - rust-lang/rust#163450 (Force the correct type variable to never for method resolution on an adjusted never type)
Fixes #162331
Ideally we'd use a more appropriate typing environment when doing const-eval for const-to-pat, which would also fix that (since the problem clauses wouldn't be present to begin with). Being able to do that seems kind of far off, though, so here's a quick fix that (mostly) matches what the old solver does.