about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src/solve
AgeCommit message (Collapse)AuthorLines
2023-03-23Rename AliasEq -> AliasRelateMichael Goulet-9/+13
2023-03-23Include relation direction in AliasEq predicateMichael Goulet-26/+75
2023-03-22Rollup merge of #109447 - lcnr:coherence, r=compiler-errorsMatthias Krüger-44/+112
new solver cleanup + implement coherence the cleanup: - change `Certainty::unify_and` to consider ambig + overflow to be ambig - rename `trait_candidate_should_be_dropped_in_favor_of` to `candidate_should_be_dropped_in_favor_of` - remove outdated fixme For coherence I mostly just add an ambiguous candidate if the current trait ref is unknowable. I am doing the same for reservation impl where I also just add an ambiguous candidate.
2023-03-22Implement non-const Destruct trait in new solverMichael Goulet-0/+28
2023-03-21Rollup merge of #109441 - oli-obk:fn_trait_new_solver, r=compiler-errorsMatthias Krüger-6/+22
Only implement Fn* traits for extern "Rust" safe function pointers and items Since calling the function via an `Fn` trait will assume `extern "Rust"` ABI and not do any safety checks, only safe `extern "Rust"` function can implement the `Fn` traits. This syncs the logic between the old solver and the new solver. r? `@compiler-errors`
2023-03-21disable global caching during coherencelcnr-1/+2
2023-03-21enable `intercrate` in the solver `InferCtxt`lcnr-2/+8
2023-03-21new solver cleanup + coherencelcnr-41/+102
2023-03-21Also check function items' signatures for Fn* trait compatibilityOli Scherer-5/+14
2023-03-21Deduplicate fn trait compatibility checksOli Scherer-8/+1
2023-03-21Only implement Fn* traits for extern "Rust" safe function pointers.Oli Scherer-1/+15
2023-03-17move `compute_goal` and `evaluate_x` methods to inner moduleBoxy-272/+272
2023-03-17fix bad assertionBoxy-13/+4
2023-03-17replace chain with two `add_goal`Boxy-16/+11
2023-03-17fix let else unformattingBoxy-5/+9
2023-03-17UNACEPTABLEBoxy-9/+9
2023-03-17add commentsBoxy-0/+5
Co-authored-by: lcnr <rust@lcnr.de>
2023-03-17add assertBoxy-2/+9
2023-03-17review nitsBoxy-14/+18
2023-03-16replace usage of `evaluate_goal` with a new `add_goal`Boxy-254/+336
2023-03-15always make `define_opaque_types` explicitlcnr-4/+4
2023-03-13Better names?Michael Goulet-2/+2
2023-03-13Treat projections with infer as placeholder during fast reject in new solverMichael Goulet-2/+10
2023-03-12Rollup merge of #108726 - est31:backticks_matchmaking_tidy, r=NilstriebMatthias Krüger-1/+2
tidy: enforce comment blocks to have an even number of backticks After PR #108694, most unmatched backticks in `compiler/` comments have been eliminated. This PR adds a tidy lint to ensure no new unmatched backticks are added, and either addresses the lint in the remaining instances it found, or allows it. Very often, backtick containing sections wrap around lines, for example: ```Rust // This function takes a tuple `(Vec<String>, // Box<[u8]>)` and transforms it into `Vec<u8>`. ``` The lint is implemented to work on top of blocks, counting each line with a `//` into a block, and counting if there are an odd or even number of backticks in the entire block, instead of looking at just a single line.
2023-03-11Add a fixme and address a more non trivial caseest31-1/+2
Co-authored-by: nils <48135649+Nilstrieb@users.noreply.github.com>
2023-03-11Rollup merge of #108071 - compiler-errors:new-solver-caching, r=lcnrMatthias Krüger-170/+76
Implement goal caching with the new solver Maybe it's wrong, idk. Opening mostly for first impressions before I go to sleep. r? ``@lcnr,`` cc ``@cjgillot``
2023-03-10Actually cache goalsMichael Goulet-70/+60
2023-03-10Move some solver stuff to middleMichael Goulet-100/+16
2023-03-10Rollup merge of #108828 - compiler-errors:new-solver-alias-eq-on-num-var, r=lcnrMatthias Krüger-4/+4
Emit alias-eq when equating numeric var and projection This doesn't fix everything having to do with projections and infer vars, but it does fix a common case I saw in HIR typeck. r? `@lcnr`
2023-03-10Unconstrained terms should account for infer vars being equatedMichael Goulet-15/+20
2023-03-09Fix canonicalizer bug for int/float vars tooMichael Goulet-4/+4
2023-03-07fix var equality issue with old canonicalizerMichael Goulet-1/+0
2023-03-07Canonicalize the ROOT VARMichael Goulet-11/+34
2023-03-05drop_tracking_mir: support new solver.Camille GILLOT-1/+1
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.