about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src/solve
AgeCommit message (Collapse)AuthorLines
2023-02-17Replace `mk_foo` calls with `infer_foo` where possible.Nicholas Nethercote-2/+2
There are several `mk_foo`/`intern_foo` pairs, where the former takes an iterator and the latter takes a slice. (This naming convention is bad, but that's a fix for another PR.) This commit changes several `mk_foo` occurrences into `intern_foo`, avoiding the need for some `.iter()`/`.into_iter()` calls. Affected cases: - mk_type_list - mk_tup - mk_substs - mk_const_list
2023-02-17add predicate evaluation logicBoxy-3/+13
2023-02-17Add `Clause::ConstArgHasType` variantBoxy-0/+3
2023-02-16remove bound_type_of query; make type_of return EarlyBinder; change type_of ↵Kyle Matsuda-4/+4
in metadata
2023-02-15don't clone types that are copyMatthias Krüger-1/+1
2023-02-14Auto merge of #108056 - matthiaskrgr:rollup-oa6bxvh, r=matthiaskrgrbors-2/+26
Rollup of 9 pull requests Successful merges: - #107573 (Update the minimum external LLVM to 14) - #107626 (Fix `x fix` on the standard library itself) - #107673 (update ICU4X to 1.1.0) - #107733 (Store metrics from `metrics.json` to CI PGO timer) - #108007 (Use `is_str` instead of string kind comparison) - #108033 (add an unstable `#[rustc_coinductive]` attribute) - #108039 (Refactor refcounted structural_impls via functors) - #108040 (Use derive attributes for uninteresting traversals) - #108044 (interpret: rename Pointer::from_addr → from_addr_invalid) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-02-14Rollup merge of #107739 - spastorino:check-overflow-evaluate_canonical_goal, ↵Matthias Krüger-88/+139
r=lcnr Check for overflow in evaluate_canonical_goal r? `@lcnr`
2023-02-14Reduce visibility of some itemsSantiago Pastorino-9/+9
2023-02-14Check for overflow in evaluate_canonical_goalSantiago Pastorino-24/+46
2023-02-14add test for coinduction in new solverlcnr-2/+26
2023-02-13Implement repeat_while_none for both SearchGraph and EvalCtxtSantiago Pastorino-24/+38
2023-02-13Extract try_move_finished_goal_to_global_cache from try_finalize_goalSantiago Pastorino-23/+34
2023-02-13Make Ok value of repeat_while_none more generalSantiago Pastorino-28/+32
2023-02-13Make visiting traits generic over the InternerAlan Egerton-1/+1
2023-02-13Alias folding/visiting traits instead of re-exportAlan Egerton-1/+1
2023-02-10implement `compute_alias_eq_goal`Boxy-3/+113
2023-02-10add `AliasEq` to `PredicateKind`Boxy-0/+9
2023-02-10Multiple candidates with same response is not ambiguousMichael Goulet-3/+5
2023-02-09Rollup merge of #107815 - compiler-errors:new-solver-no-auto-if-impl, r=lcnrDylan DPC-0/+14
Disqualify `auto trait` built-in impl in new solver if explicit `impl` exists
2023-02-09Disqualify auto-trait builtin impl in new solver if impl existsMichael Goulet-0/+14
2023-02-09Move winnowing to assemblyMichael Goulet-140/+81
2023-02-09Implement a dummy drop-in-favor-of for the new solverMichael Goulet-19/+33
2023-02-09Use elaborated item bounds for alias typesMichael Goulet-4/+1
2023-02-08Rollup merge of #107799 - lcnr:update-provisional-result, r=oli-obkMichael Goulet-5/+8
correctly update goals in the cache we may want to actually write the response for our goal into the provisional or global cache instead of simply using the result from the last iteration '^^ r? ```@rust-lang/initiative-trait-system-refactor```
2023-02-08correctly update goals in the cachelcnr-5/+8
2023-02-08Rollup merge of #107780 - compiler-errors:instantiate-binder, r=lcnrMatthias Krüger-11/+11
Rename `replace_bound_vars_with_*` to `instantiate_binder_with_*` Mentioning "binder" rather than "bound vars", imo, makes it clearer that we're doing something to the binder as a whole. Also, "instantiate" is the verb that I'm always reaching for when I'm looking for these functions, and the name that we use in the new solver anyways. r? types
2023-02-07Replacing bound vars is actually instantiating a binderMichael Goulet-11/+11
2023-02-07Rename PointerSized to PointerLikeMichael Goulet-7/+7
2023-02-03intern external constraintsMichael Goulet-21/+17
2023-02-03Use new helper inside probeWilco Kusee-6/+2
2023-02-01Simplify discriminant_kind goal using new helper functionWilco Kusee-14/+7
2023-02-01Add candidates for DiscriminantKind builtinWilco Kusee-0/+36
2023-01-31Rollup merge of #107348 - lcnr:project-solve-new, r=compiler-errorsGuillaume Gomez-45/+86
small refactor to new projection code extract `eq_term_and_make_canonical_response` into a helper function which also is another guarantee that the expected term does not influence candidate selection for projections. also change `evaluate_all(vec![single_goal])` to use `evaluate_goal`. the second commit now also adds a `debug_assert!` to `evaluate_goal`.
2023-01-30nitsMichael Goulet-16/+16
2023-01-30Trait upcasting support in new solverMichael Goulet-59/+107
2023-01-30Implement unsizing in the new trait solverMichael Goulet-0/+192
2023-01-29Auto merge of #106253 - nbdd0121:upcast, r=compiler-errorsbors-1/+1
Skip possible where_clause_object_safety lints when checking `multiple_supertrait_upcastable` Fix #106247 To achieve this, I lifted the `WhereClauseReferencesSelf` out from `object_safety_violations` and move it into `is_object_safe` (which is changed to a new query). cc `@dtolnay` r? `@compiler-errors`
2023-01-29Rollup merge of #107401 - ↵Matthias Krüger-8/+5
lenko-d:remove_the_usize_field_from_CandidateSource_AliasBound, r=compiler-errors remove the usize field from CandidateSource::AliasBound Fixes [#107380](https://github.com/rust-lang/rust/issues/107380)
2023-01-28Auto merge of #107303 - compiler-errors:intern-canonical-var-values, r=lcnrbors-26/+4
Intern `CanonicalVarValues` So that they are copy :sparkles:
2023-01-28Rename `is_object_safe` to `check_is_object_safe` to hint side effectsGary Guo-1/+1
2023-01-28Use field-less variant for AliasBound.Lenko Donchev-6/+5
2023-01-28Rollup merge of #107398 - scottmcm:its-their-funeral, r=dtolnayMatthias Krüger-4/+4
Remove `ControlFlow::{BREAK, CONTINUE}` Libs-API decided to remove these in #102697. Follow-up to #107023, which removed them from `compiler/`, but a couple new ones showed up since that was merged. r? libs
2023-01-27remove the usize field from CandidateSource::AliasBoundLenko Donchev-7/+5
2023-01-28Rollup merge of #107344 - compiler-errors:new-solver-tweaks, r=lcnrMatthias Krüger-23/+54
Minor tweaks in the new solver 1. `InferCtxt::probe` is not needed in `compute_subtype_goal` and `compute_well_formed_goal`. 2. Add a handful of comments. 3. Add a micro-optimization in `consider_assumption` where we check the def-ids of the assumption and goal match before instantiating any binders. r? ``@lcnr``
2023-01-27Remove `ControlFlow::{BREAK, CONTINUE}`Scott McMurray-4/+4
Libs-API decided to remove these in #102697. Follow-up to #107023, which removed them from `compiler/`, but a couple new ones showed up since that was merged.
2023-01-28Auto merge of #101692 - cjgillot:generator-lazy-witness, r=oli-obkbors-6/+17
Compute generator saved locals on MIR Generators are currently type-checked by introducing a `witness` type variable, which is unified with a `GeneratorWitness(captured types)` whose purpose is to ensure that the auto traits correctly migrate from the captured types to the `witness` type. This requires computing the captured types on HIR during type-checking, only to re-do it on MIR later. This PR proposes to drop the HIR-based computation, and only keep the MIR one. This is done in 3 steps. 1. During type-checking, the `witness` type variable is never unified. This allows to stall all the obligations that depend on it until the end of type-checking. Then, the stalled obligations are marked as successful, and saved into the typeck results for later verification. 2. At type-checking writeback, `witness` is replaced by `GeneratorWitnessMIR(def_id, substs)`. From this point on, all trait selection involving `GeneratorWitnessMIR` will fetch the MIR-computed locals, similar to what opaque types do. There is no lifetime to be preserved here: we consider all the lifetimes appearing in this witness type to be higher-ranked. 3. After borrowck, the stashed obligations are verified against the actually computed types, in the `check_generator_obligations` query. If any obligation was wrongly marked as fulfilled in step 1, it should be reported here. There are still many issues: - ~I am not too happy having to filter out some locals from the checked bounds, I think this is MIR building that introduces raw pointers polluting the analysis;~ solved by a check specific to static variables. - the diagnostics for captured types don't show where they are used/dropped; - I do not attempt to support chalk. cc `@eholk` `@jyn514` for the drop-tracking work r? `@oli-obk` as you warned me of potential unsoundness
2023-01-27Compute generator saved locals on MIR.Camille GILLOT-0/+7
2023-01-27Micro-optimization in consider_assumptionMichael Goulet-2/+6
2023-01-27Add some commentsMichael Goulet-0/+31
2023-01-27No need to probe when computing goalsMichael Goulet-21/+17