summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src/solve
AgeCommit message (Collapse)AuthorLines
2023-05-26remove unnecessary `.ok()` callslcnr-6/+14
2023-05-26do not prefer substs relate during coherencelcnr-3/+11
2023-05-25Match on both reveal and solver mode at the same timeMichael Goulet-41/+38
2023-05-25Add InferCtxt::register_hidden_type_in_new_solverMichael Goulet-40/+24
2023-05-25Strongly prefer alias and param-env boundsMichael Goulet-5/+9
2023-05-25Pre-populate MIR with opaques, prefer subst-relate candidateMichael Goulet-28/+25
2023-05-25Check that opaque is a defining use, prefer pre-defined opaquesMichael Goulet-14/+91
2023-05-25Prepopulate opaques in canonical inputMichael Goulet-77/+170
2023-05-25Pull out logic from #111131, plus some new logic in ↵Michael Goulet-4/+56
EvalCtxt::normalize_opaque_type Co-authored-by: lcnr <rust@lcnr.de>
2023-05-24Use `Option::is_some_and` and `Result::is_ok_and` in the compilerMaybe Waffle-1/+1
2023-05-23Don't ICE when computing PointerLike trait when region vars are in param-envMichael Goulet-5/+9
2023-05-17Exclude inherent projections from some alias ty matchesLeón Orell Valerian Liehr-1/+3
2023-05-16Use error term if missing associated item in new solverMichael Goulet-1/+15
2023-05-09Consolidate the 'match assumption' type methods in GoalKindMichael Goulet-140/+47
2023-05-09Make alias bounds sound in the new solverMichael Goulet-2/+162
2023-05-04IAT: Introduce AliasKind::InherentLeón Orell Valerian Liehr-2/+2
2023-05-04Auto merge of #110806 - WaffleLapkin:unmkI, r=lcnrbors-20/+16
Replace `tcx.mk_trait_ref` with `TraitRef::new` First step in implementing https://github.com/rust-lang/compiler-team/issues/616 r? `@lcnr`
2023-04-29Rollup merge of #110614 - compiler-errors:new-solver-overflow-response, r=lcnrDylan DPC-20/+79
Clear response values for overflow in new solver When we have an overflow, return a trivial query response. This fixes an ICE with the code described in #110544: ```rust trait Trait {} struct W<T>(T); impl<T, U> Trait for W<(W<T>, W<U>)> where W<T>: Trait, W<U>: Trait, {} fn impls<T: Trait>() {} fn main() { impls::<W<_>>() } ``` Where, while proving `W<?0>: Trait`, we overflow but still apply the query response of `?0 = (W<?1>, W<?2>)`. Then while re-processing the query to validate that our evaluation result was stable, we get a different query response that looks like `?1 = (W<?3>, W<?4>), ?2 = (W<?5>, W<?6>)`, and so we trigger the ICE. Also, by returning a trivial query response we also avoid the infinite-loop/OOM behavior of the old solver. r? ``@lcnr``
2023-04-27rename `needs_infer` to `has_infer`Boxy-1/+1
2023-04-26Split out make_ambiguous_response_no_constraintsMichael Goulet-30/+53
2023-04-26Clear response values for overflow in new solverMichael Goulet-9/+45
2023-04-26Switch `ty::TraitRef::from_lang_item` from using `TyCtxtAt` to `TyCtxt` and ↵Maybe Waffle-3/+4
a `Span`
2023-04-26Remove some more useless `ty::Binder::dummy` callsMaybe Waffle-2/+2
2023-04-26Make some region folders a little stricter.Nicholas Nethercote-4/+5
Because certain regions cannot occur in them.
2023-04-25Rollup merge of #110671 - compiler-errors:polarity, r=lcnrMatthias Krüger-3/+69
Consider polarity in new solver It's kinda ugly to have a polarity check in all of the builtin impls -- I guess I could consider the polarity at the top of assemble-builtin but that would require adding a polarity fn to `GoalKind`... :shrug: putting this up just so i dont forget, since it's needed to bootstrap core during coherence (this alone does not allow core to bootstrap though, additional work is needed!) r? ``@lcnr``
2023-04-25Remove some useless `ty::Binder::dummy` callsMaybe Waffle-20/+5
2023-04-25Replace `tcx.mk_trait_ref` with `ty::TraitRef::new`Maybe Waffle-18/+28
2023-04-24Consider polarity in new solverMichael Goulet-3/+69
2023-04-24Split `{Idx, IndexVec, IndexSlice}` into their own modulesMaybe Waffle-3/+3
2023-04-24Rollup merge of #110514 - compiler-errors:remove-find_map_relevant_impl, ↵Matthias Krüger-3/+7
r=b-naber Remove `find_map_relevant_impl` Fixes #108895
2023-04-22Expect that equating a projection term always succeeds in new solverMichael Goulet-5/+10
2023-04-21Auto merge of #96840 - cjgillot:query-feed, r=oli-obkbors-1/+1
Allow to feed a value in another query's cache and remove `WithOptConstParam` I used it to remove `WithOptConstParam` queries, as an example. The idea is that a query (here `typeck(function)`) can write into another query's cache (here `type_of(anon const)`). The dependency node for `type_of` would depend on all the current dependencies of `typeck`. There is still an issue with cycles: if `type_of(anon const)` is accessed before `typeck(function)`, we will still have the usual cycle. The way around this issue is to `ensure` that `typeck(function)` is called before accessing `type_of(anon const)`. When replayed, we may the following cases: - `typeck` is green, in that case `type_of` is green too, and all is right; - `type_of` is green, `typeck` may still be marked as red (it depends on strictly more things than `type_of`) -> we verify that the saved value and the re-computed value of `type_of` have the same hash; - `type_of` is red, then `typeck` is red -> it's the caller responsibility to ensure `typeck` is recomputed *before* `type_of`. As `anon consts` have their own `DefPathData`, it's not possible to have the def-id of the anon-const point to something outside the original function, but the general case may have to be resolved before using this device more broadly. There is an open question about loading from the on-disk cache. If `typeck` is loaded from the on-disk cache, the side-effect does not happen. The regular `type_of` implementation can go and fetch the correct value from the decoded `typeck` results, and the dep-graph will check that the hashes match, but I'm not sure we want to rely on this behaviour. I specifically allowed to feed the value to `type_of` from inside a call to `type_of`. In that case, the dep-graph will check that the fingerprints of both values match. This implementation is still very sensitive to cycles, and requires that we call `typeck(function)` before `typeck(anon const)`. The reason is that `typeck(anon const)` calls `type_of(anon const)`, which calls `typeck(function)`, which feeds `type_of(anon const)`, and needs to build the MIR so needs `typeck(anon const)`. The latter call would not cycle, since `type_of(anon const)` has been set, but I'd rather not remove the cycle check.
2023-04-20Result is just bool but specialMichael Goulet-7/+9
2023-04-20Remove WithOptconstParam.Camille GILLOT-1/+1
2023-04-20Track if EvalCtxt has been tainted, make sure it can't be used to make query ↵Michael Goulet-0/+20
responses after
2023-04-19Remove find_map_relevant_implMichael Goulet-3/+7
2023-04-17Spelling - compilerJosh Soref-6/+6
* account * achieved * advising * always * ambiguous * analysis * annotations * appropriate * build * candidates * cascading * category * character * clarification * compound * conceptually * constituent * consts * convenience * corresponds * debruijn * debug * debugable * debuggable * deterministic * discriminant * display * documentation * doesn't * ellipsis * erroneous * evaluability * evaluate * evaluation * explicitly * fallible * fulfill * getting * has * highlighting * illustrative * imported * incompatible * infringing * initialized * into * intrinsic * introduced * javascript * liveness * metadata * monomorphization * nonexistent * nontrivial * obligation * obligations * offset * opaque * opportunities * opt-in * outlive * overlapping * paragraph * parentheses * poisson * precisely * predecessors * predicates * preexisting * propagated * really * reentrant * referent * responsibility * rustonomicon * shortcircuit * simplifiable * simplifications * specify * stabilized * structurally * suggestibility * translatable * transmuting * two * unclosed * uninhabited * visibility * volatile * workaround Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-17Rollup merge of #110394 - scottmcm:less-idx-new, r=WaffleLapkinMatthias Krüger-6/+7
Various minor Idx-related tweaks Nothing particularly exciting here, but a couple of things I noticed as I was looking for more index conversions to simplify. cc https://github.com/rust-lang/compiler-team/issues/606 r? `@WaffleLapkin`
2023-04-16Erase regions when confirming transmutability candidateMichael Goulet-1/+1
2023-04-16Various minor Idx-related tweaksScott McMurray-6/+7
Nothing particularly exciting here, but a couple of things I noticed as I was looking for more index conversions to simplify.
2023-04-14Rollup merge of #110207 - compiler-errors:new-solver-unpin, r=lcnrMatthias Krüger-61/+102
Assemble `Unpin` candidates specially for generators in new solver Fixes compiler-errors/next-solver-hir-issues#16 r? ``@lcnr``
2023-04-14Rollup merge of #110180 - lcnr:canonicalize, r=compiler-errorsMatthias Krüger-14/+11
don't uniquify regions when canonicalizing uniquifying causes a bunch of issues, most notably it causes `AliasEq(<?x as Trait<'a>>::Assoc, <?x as Trait<'a>>::Assoc)` to result in ambiguity because both `normalizes-to` paths result in ambiguity and substs equate should trivially succeed but doesn't because we uniquified `'a` to two different regions. I originally added uniquification to make it easier to deal with requirement 6 from the dev-guide: https://rustc-dev-guide.rust-lang.org/solve/trait-solving.html#requirements > ### 6. Trait solving must be (free) lifetime agnostic > > Trait solving during codegen should have the same result as during typeck. As we erase > all free regions during codegen we must not rely on them during typeck. A noteworthy example > is special behavior for `'static`. cc https://github.com/rust-lang/rustc-dev-guide/pull/1671 Relying on regions being identical may cause ICE during MIR typeck, but even without this PR we can end up relying on that as type inference vars can resolve to types which contain an identical region. Let's land this and deal with any ICE that crop up as we go. Will look at this issue again before stabilization. r? ```@compiler-errors```
2023-04-14Move auto trait built-in candidate disqualification to a separate methodMichael Goulet-77/+101
2023-04-14Assemble Unpin candidates specially for generators in new solverMichael Goulet-1/+18
2023-04-12Auto merge of #110252 - matthiaskrgr:rollup-ovaixra, r=matthiaskrgrbors-5/+24
Rollup of 8 pull requests Successful merges: - #109810 (Replace rustdoc-ui/{c,z}-help tests with a stable run-make test ) - #110035 (fix: ensure bad `#[test]` invocs retain correct AST) - #110089 (sync::mpsc: synchronize receiver disconnect with initialization) - #110103 (Report overflows gracefully with new solver) - #110122 (Fix x check --stage 1 when download-ci-llvm=false) - #110133 (Do not use ImplDerivedObligationCause for inherent impl method error reporting) - #110135 (Revert "Don't recover lifetimes/labels containing emojis as character literals") - #110235 (Fix `--extend-css` option) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-04-12Rollup merge of #110103 - compiler-errors:new-solver-overflows, r=lcnrMatthias Krüger-5/+24
Report overflows gracefully with new solver avoid reporting overflows as ambiguity errors, so that the error message is clearer. r? ```@lcnr```
2023-04-12Rollup merge of #110153 - DaniPopes:compiler-typos, r=NilstriebMatthias Krüger-6/+6
Fix typos in compiler I ran [`typos -w compiler`](https://github.com/crate-ci/typos) to fix typos in the `compiler` directory. Refs #110150
2023-04-12Auto merge of #107614 - ↵bors-1/+4
compiler-errors:allow-elaborator-to-filter-only-super-traits, r=oli-obk Split implied and super predicate queries, then allow elaborator to filter only supertraits Split the `super_predicates_of` query into a new `implied_predicates_of` query. The former now only returns the *real* supertraits of a trait alias, and the latter now returns the implied predicates (which include all of the `where` clauses of the trait alias). The behavior of these queries is identical for regular traits. Now that the two queries are split, we can add a new filter method to the elaborator, `filter_only_self()`, which can be used in instances that we need only the *supertrait* predicates, such as during the elaboration used in closure signature deduction. This toggles the usage of `super_predicates_of` instead of `implied_predicates_of` during elaboration of a trait predicate. This supersedes #104745, and fixes the four independent bugs identified in that PR. Fixes #104719 Fixes #106238 Fixes #110023 Fixes #109514 r? types
2023-04-11Rollup merge of #110126 - compiler-errors:new-solver-safe-transmute, r=oli-obkMichael Goulet-0/+64
Support safe transmute in new solver Basically copies the same implementation as the old solver, but instead of looking for param types, we look for type or const placeholders.
2023-04-11Allow the elaborator to only filter to real supertraitsMichael Goulet-1/+4