summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src/solve
AgeCommit message (Collapse)AuthorLines
2023-03-03canonicalizationlcnr-73/+670
2023-02-26Rollup merge of #107941 - compiler-errors:str-has-u8-slice-for-auto, r=lcnrMatthias Krüger-1/+3
Treat `str` as containing `[u8]` for auto trait purposes Wanted to gauge ``@rust-lang/lang`` and ``@rust-lang/types`` teams' thoughts on treating `str` as "containing" a `[u8]` slice for auto-trait purposes. ``@dtolnay`` brought this up in https://github.com/rust-lang/rust/issues/13231#issuecomment-1399386472 as a blocker for future `str` type librarification, and I think it's both a valid concern and very easy to fix. I'm interested in actually doing that `str` type librarification (#107939), but this probably should be considered in the mean time regardless of that PR. r? types for the impl, though this definitely needs an FCP.
2023-02-25Treat `str` as containing `[u8]` for auto trait purposesMichael Goulet-1/+3
2023-02-25Rollup merge of #108333 - compiler-errors:new-solver-object-sound, r=lcnrMichael Goulet-3/+207
Make object bound candidates sound in the new trait solver r? `@lcnr`
2023-02-24Comments, another testMichael Goulet-2/+41
2023-02-24Make higher-ranked projections in object types work in new solverMichael Goulet-18/+31
2023-02-24Check object's supertrait and associated type bounds in new solverMichael Goulet-2/+154
2023-02-24Rename many interner functions.Nicholas Nethercote-12/+11
(This is a large commit. The changes to `compiler/rustc_middle/src/ty/context.rs` are the most important ones.) The current naming scheme is a mess, with a mix of `_intern_`, `intern_` and `mk_` prefixes, with little consistency. In particular, in many cases it's easy to use an iterator interner when a (preferable) slice interner is available. The guiding principles of the new naming system: - No `_intern_` prefixes. - The `intern_` prefix is for internal operations. - The `mk_` prefix is for external operations. - For cases where there is a slice interner and an iterator interner, the former is `mk_foo` and the latter is `mk_foo_from_iter`. Also, `slice_interners!` and `direct_interners!` can now be `pub` or non-`pub`, which helps enforce the internal/external operations division. It's not perfect, but I think it's a clear improvement. The following lists show everything that was renamed. slice_interners - const_list - mk_const_list -> mk_const_list_from_iter - intern_const_list -> mk_const_list - substs - mk_substs -> mk_substs_from_iter - intern_substs -> mk_substs - check_substs -> check_and_mk_substs (this is a weird one) - canonical_var_infos - intern_canonical_var_infos -> mk_canonical_var_infos - poly_existential_predicates - mk_poly_existential_predicates -> mk_poly_existential_predicates_from_iter - intern_poly_existential_predicates -> mk_poly_existential_predicates - _intern_poly_existential_predicates -> intern_poly_existential_predicates - predicates - mk_predicates -> mk_predicates_from_iter - intern_predicates -> mk_predicates - _intern_predicates -> intern_predicates - projs - intern_projs -> mk_projs - place_elems - mk_place_elems -> mk_place_elems_from_iter - intern_place_elems -> mk_place_elems - bound_variable_kinds - mk_bound_variable_kinds -> mk_bound_variable_kinds_from_iter - intern_bound_variable_kinds -> mk_bound_variable_kinds direct_interners - region - intern_region (unchanged) - const - mk_const_internal -> intern_const - const_allocation - intern_const_alloc -> mk_const_alloc - layout - intern_layout -> mk_layout - adt_def - intern_adt_def -> mk_adt_def_from_data (unusual case, hard to avoid) - alloc_adt_def(!) -> mk_adt_def - external_constraints - intern_external_constraints -> mk_external_constraints Other - type_list - mk_type_list -> mk_type_list_from_iter - intern_type_list -> mk_type_list - tup - mk_tup -> mk_tup_from_iter - intern_tup -> mk_tup
2023-02-22Rename ty_error_with_guaranteed to ty_error, ty_error to ty_error_miscMichael Goulet-1/+1
2023-02-22Remove type-traversal trait aliasesAlan Egerton-7/+10
2023-02-22Move some InferCtxt methods to EvalCtxt in new solverMichael Goulet-226/+228
2023-02-21Make hidden type registration opt-in, so that each site can be reviewed on ↵Oli Scherer-1/+0
its own and we have the right defaults for trait solvers
2023-02-18Add consider_implied_clauseMichael Goulet-102/+97
2023-02-18Check that built-in callable types validate their output type is `Sized` (in ↵Michael Goulet-14/+45
new solver)
2023-02-18Auto merge of #108112 - nnethercote:clarify-iterator-interners, ↵bors-3/+3
r=oli-obk,compiler-errors Clarify iterator interners I found the iterator interners very confusing. This PR clarifies things. r? `@compiler-errors`
2023-02-17Remove the `InternIteratorElement` impl for `&'a T`.Nicholas Nethercote-1/+1
`InternIteratorElement` is a trait used to intern values produces by iterators. There are three impls, corresponding to iterators that produce different types: - One for `T`, which operates straightforwardly. - One for `Result<T, E>`, which is fallible, and will fail early with an error result if any of the iterator elements are errors. - One for `&'a T`, which clones the items as it iterates. That last one is bad: it's extremely easy to use it without realizing that it clones, which goes against Rust's normal "explicit is better" approach to cloning. So this commit just removes it. In practice, there weren't many use sites. For all but one of them `into_iter()` could be used, which avoids the need for cloning. And for the one remaining case `copied()` is used.
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