summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src/solve
AgeCommit message (Collapse)AuthorLines
2024-03-14Rollup merge of #122238 - fee1-dead-contrib:builtin-impl-next-solver-dox, r=lcnrMatthias Krüger-0/+18
Document some builtin impls in the next solver This does not cover all builtin impls, but ones that I were able to go over within a cycle. r? `@lcnr` Let me know if the place isn't correct for these, or if you'd like me to change how the impls are presented ^^
2024-03-14move impl documentation to their actual locationsDeadbeef-33/+12
2024-03-12Rollup merge of #122319 - ↵Matthias Krüger-1/+3
compiler-errors:next-solver-normalizing-self-constrains-args, r=lcnr Don't ICE when non-self part of trait goal is constrained in new solver Self-explanatory. See test for example when this can happen.
2024-03-11Don't ICE when non-self part of trait goal is constrained in new solverMichael Goulet-1/+3
2024-03-11Eliminate `DefiningAnchor::Error`, it is indistinguishable from ↵Oli Scherer-5/+2
`DefiningAnchor::Bind` with an empty list
2024-03-10fix metadata for dyn-star in new solverLukas Markeffsky-2/+3
2024-03-09Document some builtin impls in the next solverDeadbeef-0/+39
2024-03-07Apply `EarlyBinder` only to `TraitRef` in `ImplTraitHeader`Yoshitomo Nakanishi-6/+6
2024-03-06remove outdated fixme commentDeadbeef-1/+0
The `TraitPredicate` no longer has constness as we have desugared it to work with the type system through const generics instead.
2024-03-05Convert `ProofTreeVisitor` to use `VisitorResult`Jason Newcomb-24/+23
2024-03-05Convert `TypeVisitor` and `DefIdVisitor` to use `VisitorResult`Jason Newcomb-3/+3
2024-03-02avoid collecting into vecs in some placesMatthias Krüger-1/+1
2024-03-01Rollup merge of #121497 - lcnr:coherence-suggest-increasing-recursion-limit, ↵Matthias Krüger-121/+187
r=compiler-errors `-Znext-solver=coherence`: suggest increasing recursion limit r? `@compiler-errors`
2024-03-01normalizes-to: handle negative implslcnr-3/+16
2024-03-01Auto merge of #121462 - compiler-errors:eq-and-sub, r=lcnrbors-1/+0
Combine `Sub` and `Equate` Combine `Sub` and `Equate` into a new relation called `TypeRelating` (that name sounds familiar...) Tracks the difference between `Sub` and `Equate` via `ambient_variance: ty::Variance` much like the `NllTypeRelating` relation, but implemented slightly jankier because it's a more general purpose relation. r? lcnr
2024-03-01Auto merge of #121728 - tgross35:f16-f128-step1-ty-updates, r=compiler-errorsbors-1/+3
Add stubs in IR and ABI for `f16` and `f128` This is the very first step toward the changes in https://github.com/rust-lang/rust/pull/114607 and the [`f16` and `f128` RFC](https://rust-lang.github.io/rfcs/3453-f16-and-f128.html). It adds the types to `rustc_type_ir::FloatTy` and `rustc_abi::Primitive`, and just propagates those out as `unimplemented!` stubs where necessary. These types do not parse yet so there is no feature gate, and it should be okay to use `unimplemented!`. The next steps will probably be AST support with parsing and the feature gate. r? `@compiler-errors` cc `@Nilstrieb` suggested breaking the PR up in https://github.com/rust-lang/rust/pull/120645#issuecomment-1925900572
2024-03-01Get rid of some sub_exp and eq_expMichael Goulet-1/+0
2024-02-29Rollup merge of #121681 - jswrenn:nix-visibility-analysis, r=compiler-errorsMatthias Krüger-4/+1
Safe Transmute: Revise safety analysis This PR migrates `BikeshedIntrinsicFrom` to a simplified safety analysis (described [here](https://github.com/rust-lang/project-safe-transmute/issues/15)) that does not rely on analyzing the visibility of types and fields. The revised analysis treats primitive types as safe, and user-defined types as potentially carrying safety invariants. If Rust gains explicit (un)safe fields, this PR is structured so that it will be fairly easy to thread support for those annotations into the analysis. Notably, this PR removes the `Context` type parameter from `BikeshedIntrinsicFrom`. Most of the files changed by this PR are just UI tests tweaked to accommodate the removed parameter. r? `@compiler-errors`
2024-02-29stash overflowing obligations in fulfilllcnr-12/+75
2024-02-29extract fulfillment err creationlcnr-82/+73
2024-02-29distinguish recursion limit based overflow for diagnosticslcnr-35/+47
also change the number of allowed fixpoint steps to be fixed instead of using the `log` of the total recursion depth.
2024-02-28Add `f16` and `f128` to `rustc_type_ir::FloatTy` and `rustc_abi::Primitive`Trevor Gross-1/+3
Make changes necessary to support these types in the compiler.
2024-02-27Add a couple helpers, make return types less confusingMichael Goulet-116/+172
2024-02-27Support `{async closure}: Fn` in new solverMichael Goulet-1/+73
2024-02-27safe transmute: revise safety analysisJack Wrenn-4/+1
Migrate to a simplified safety analysis that does not use visibility. Closes https://github.com/rust-lang/project-safe-transmute/issues/15
2024-02-26consider placeholders in `fn term_is_fully_unconstrained`lcnr-37/+49
2024-02-26always emit `AliasRelate` goals when relating aliaseslcnr-219/+232
Add `StructurallyRelateAliases` to allow instantiating infer vars with rigid aliases. Change `instantiate_query_response` to be infallible in the new solver. This requires canonicalization to not hide any information used by the query, so weaken universe compression. It also modifies `term_is_fully_unconstrained` to allow region inference variables in a higher universe.
2024-02-26add additional logginglcnr-1/+7
2024-02-22Auto merge of #119989 - lcnr:sub_relations-bye-bye, r=compiler-errorsbors-3/+7
remove `sub_relations` from the `InferCtxt` While doing so, I tried to remove the `delay_span_bug` in `rematch_impl` again, which lead me to discover another `freshen` bug, fixing that one in the second commit. See commit descriptions for the reasoning behind each change. r? `@compiler-errors`
2024-02-22Rollup merge of #120598 - compiler-errors:no-rigid-check, r=lcnrMatthias Krüger-115/+1
No need to `validate_alias_bound_self_from_param_env` in `assemble_alias_bound_candidates` We already fully normalize the self type before we reach `assemble_alias_bound_candidates`, so there's no reason to double check that a projection is truly rigid by checking param-env bounds. I think this is also blocked on us making sure to always normalize opaques: #120549. r? lcnr
2024-02-22overflow errors: change source to a concrete enumlcnr-3/+7
2024-02-21Rollup merge of #121359 - lcnr:typesystem-cleanup, r=compiler-errorsLeón Orell Valerian Liehr-63/+62
miscellaneous type system improvements see review comments for rationale r? `@compiler-errors`
2024-02-20some type system cleanuplcnr-63/+62
2024-02-20Simply do not ICEMichael Goulet-1/+4
2024-02-19split `project` into multiple fileslcnr-3/+2
2024-02-17Rollup merge of #121193 - compiler-errors:coherence-fulfillment, r=lcnrMatthias Krüger-3/+5
Use fulfillment in next trait solver coherence Use fulfillment in the new trait solver's `impl_intersection_has_impossible_obligation` routine. This means that inference that falls out of processing other obligations can influence whether we can determine if an obligation is impossible to satisfy. See the committed test. This should be completely sound, since evaluation and fulfillment both respect intercrate mode equally. We run the risk of breaking coherence later if we were to change the rules of fulfillment and/or inference during coherence, but this is a problem which affects evaluation, as nested obligations from a trait goal are processed together and can influence each other in the same way. r? lcnr cc #114862 Also changed obligationctxt -> fulfillmentctxt because it feels kind of redundant to use an ocx here. I don't really care enough and can change it back if it really matters much.
2024-02-16Use fulfillment in next trait solver coherenceMichael Goulet-3/+5
2024-02-16Move trait into attr so it's greppableMichael Goulet-8/+8
2024-02-16Use extension trait deriveMichael Goulet-33/+7
2024-02-15Consider principal trait ref's auto-trait super-traits in dyn upcastingMichael Goulet-8/+15
2024-02-13Rollup merge of #121047 - compiler-errors:default-impls, r=lcnrMatthias Krüger-0/+14
Do not assemble candidates for default impls There is no reason (as far as I can tell?) that we should assemble an impl candidate for a default impl. This candidate itself does not prove that the impl holds, and any time that it *does* hold, there will be a more specializing non-default impl that also is assembled. This is because `default impl<T> Foo for T {}` actually expands to `impl<T> Foo for T where T: Foo {}`. The only way to satisfy that where clause (without coinduction) is via *another* implementation that does hold -- precisely an impl that specializes it. This should fix the specialization related regressions for #116494. That should lead to one root crate regression that doesn't have to do with specialization, which I think we can regress. r? lcnr cc ``@rust-lang/types`` cc #31844
2024-02-13Do not assemble candidates for default implsMichael Goulet-0/+14
2024-02-13Rollup merge of #120549 - lcnr:errs-showcase, r=compiler-errorsMatthias Krüger-179/+81
modify alias-relate to also normalize ambiguous opaques allows a bunch of further cleanups and generally simplifies the type system. To handle https://github.com/rust-lang/trait-system-refactor-initiative/issues/8 we'll have to add a some additional complexity to the `(Alias, Infer)` branches in alias-relate, so removing the opaque type special case here is really valuable. It does worsen `deduce_closure_signature` and friends even more as they now receive an inference variable which is only constrained via an `AliasRelate` goal. These probably have to look into alias relate goals somehow. Leaving that for a future PR as this is something we'll have to tackle regardless. r? `@compiler-errors`
2024-02-13use alias-relate to structurally normalize in the solverlcnr-92/+75
2024-02-13also try to normalize opaque types in alias-relatelcnr-97/+16
with this, alias-relate treats all aliases the same way and it can be used for structural normalization.
2024-02-13Auto merge of #120919 - oli-obk:impl_polarity, r=compiler-errorsbors-4/+7
Merge `impl_polarity` and `impl_trait_ref` queries Hopefully this is perf neutral. I want to finish https://github.com/rust-lang/rust/pull/120835 and stop using the HIR in `coherent_trait`, which should then give us a perf improvement.
2024-02-12Rollup merge of #120958 - ShoyuVanilla:remove-subst, r=oli-obkMatthias Krüger-21/+24
Dejargonize `subst` In favor of #110793, replace almost every occurence of `subst` and `substitution` from rustc codes, but they still remains in subtrees under `src/tools/` like clippy and test codes (I'd like to replace them after this)
2024-02-12Stop calling `impl_polarity` when `impl_trait_ref` was also calledOli Scherer-4/+7
2024-02-12Dejargnonize substShoyu Vanilla-21/+24
2024-02-10Gracefully handle non-WF alias in assemble_alias_bound_candidates_recurMichael Goulet-2/+6