summary refs log tree commit diff
path: root/compiler/rustc_middle/src/traits
AgeCommit message (Collapse)AuthorLines
2024-04-26Auto merge of #122385 - lcnr:analyze-obligations-for-infer, r=compiler-errorsbors-0/+1
`obligations_for_self_ty`: use `ProofTreeVisitor` for nested goals As always, dealing with proof trees continues to be a hacked together mess. After this PR and #124380 the only remaining blocker for core is https://github.com/rust-lang/trait-system-refactor-initiative/issues/90. There is also a `ProofTreeVisitor` issue causing an ICE when compiling `alloc` which I will handle in a separate PR. This issue likely affects coherence diagnostics more generally. The core idea is to extend the proof tree visitor to support visiting nested candidates without using a `probe`. We then simply recurse into nested candidates if they are the only potentially applicable candidate for a given goal and check whether the self type matches the expected one. For that to work, we need to improve `CanonicalState` to also handle unconstrained inference variables created inside of the trait solver. This is done by extending the `var_values` of `CanoncalState` with each fresh inference variables. Furthermore, we also store the state of all inference variables at the end of each probe. When recursing into `InspectCandidates` we then unify the values of all these states. r? `@compiler-errors`
2024-04-25Rollup merge of #124381 - compiler-errors:derived-for-wf, r=lcnrMichael Goulet-2/+7
Renamed `DerivedObligation` to `WellFormedDeriveObligation` It's used when computing `WellFormed` obligations, so let's give it a less ambiguous name.
2024-04-25Renamed DerivedObligation to WellFormedDeriveObligationMichael Goulet-2/+7
2024-04-25hir typeck: look into nested goalslcnr-0/+1
uses a `ProofTreeVisitor` to look into nested goals when looking at the pending obligations during hir typeck. Used by closure signature inference, coercion, and for async functions.
2024-04-25Check closure args and returns are WFMichael Goulet-1/+1
2024-04-18Auto merge of #124008 - nnethercote:simpler-static_assert_size, r=Nilstriebbors-1/+1
Simplify `static_assert_size`s. We want to run them on all 64-bit platforms. r? `@ghost`
2024-04-18Simplify `static_assert_size`s.Nicholas Nethercote-1/+1
We want to run them on all 64-bit platforms.
2024-04-16Avoid lots of `hir::HirId{,Map,Set}` qualifiers.Nicholas Nethercote-15/+16
Because they're a bit redundant.
2024-04-15Stop using PolyTraitRef for closure/coroutine predicates already ↵Michael Goulet-3/+2
instantiated w placeholders
2024-04-08Eliminate `DefiningAnchor` now that is just a single-variant enumOli Scherer-30/+1
2024-04-08Pass list of defineable opaque types into canonical queriesOli Scherer-10/+8
2024-04-05Fix typoWaffle Maybe-1/+1
2024-04-04normalizes-to change from '1' to '0 to inf' stepslcnr-10/+5
2024-04-03Check `x86_64` size assertions on `aarch64`, tooZalathar-1/+1
This makes it easier for contributors on aarch64 workstations (e.g. Macs) to notice when these assertions have been violated.
2024-03-31Remove EvaluatedToErrStackDependentMichael Goulet-48/+4
2024-03-27Stop doing expensive work in opt_suggest_box_span eagerlyMichael Goulet-2/+4
2024-03-18cleanup + reviewlcnr-13/+4
2024-03-18`NormalizesTo` return nested goalslcnr-2/+21
2024-03-14eagerly instantiate binders to avoid relying on `sub`lcnr-0/+1
2024-03-11Eliminate `DefiningAnchor::Error`, it is indistinguishable from ↵Oli Scherer-4/+4
`DefiningAnchor::Bind` with an empty list
2024-03-11Make `DefiningAnchor::Bind` only store the opaque types that may be ↵Oli Scherer-6/+12
constrained, instead of the current infcx root item. This makes `Bind` almost always be empty, so we can start forwarding it to queries, allowing us to remove `Bubble` entirely
2024-03-08inspect formatter: add braceslcnr-17/+30
2024-03-05Convert `TypeVisitor` and `DefIdVisitor` to use `VisitorResult`Jason Newcomb-14/+6
2024-02-29distinguish recursion limit based overflow for diagnosticslcnr-10/+20
also change the number of allowed fixpoint steps to be fixed instead of using the `log` of the total recursion depth.
2024-02-28Rename `DiagnosticBuilder` as `Diag`.Nicholas Nethercote-2/+2
Much better! Note that this involves renaming (and updating the value of) `DIAGNOSTIC_BUILDER` in clippy.
2024-02-26always emit `AliasRelate` goals when relating aliaseslcnr-16/+1
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-23remove repetitive wordscui fliter-1/+1
Signed-off-by: cui fliter <imcusg@gmail.com>
2024-02-20Rollup merge of #121344 - fmease:lta-constr-by-input, r=oli-obkMatthias Krüger-3/+3
Expand weak alias types before collecting constrained/referenced late bound regions + refactorings Fixes #114220. Follow-up to #120780. r? `@oli-obk`
2024-02-20Rename some normalization-related itemsLeón Orell Valerian Liehr-3/+3
2024-02-19Prefer `DiagnosticBuilder` over `Diagnostic` in diagnostic modifiers.Nicholas Nethercote-2/+2
There are lots of functions that modify a diagnostic. This can be via a `&mut Diagnostic` or a `&mut DiagnosticBuilder`, because the latter type wraps the former and impls `DerefMut`. This commit converts all the `&mut Diagnostic` occurrences to `&mut DiagnosticBuilder`. This is a step towards greatly simplifying `Diagnostic`. Some of the relevant function are made generic, because they deal with both errors and warnings. No function bodies are changed, because all the modifier methods are available on both `Diagnostic` and `DiagnosticBuilder`.
2024-02-15Remove a suggestion that is redundantMichael Goulet-1/+0
2024-02-15Only point out non-diverging arms for match suggestionsMichael Goulet-1/+1
2024-02-12Dejargnonize substShoyu Vanilla-3/+4
2024-02-07improve pretty printing for trait objectsLukas Markeffsky-20/+34
2024-02-06Bless tests, add commentsMichael Goulet-1/+3
2024-02-06Teach typeck/borrowck/solvers how to deal with async closuresMichael Goulet-0/+7
2024-01-24Deduplicate more sized errors on call exprsEsteban Küber-0/+2
Change the implicit `Sized` `Obligation` `Span` for call expressions to include the whole expression. This aids the existing deduplication machinery to reduce the number of errors caused by a single unsized expression.
2024-01-17Correctly handle normalization in implied boundsAli MJ Al-Nasrawy-1/+1
Special-case Bevy dependents to not error
2024-01-15Rollup merge of #119897 - compiler-errors:fulfillment-errors, r=lcnrMatthias Krüger-2/+2
`OutputTypeParameterMismatch` -> `SignatureMismatch` I'm probably missing something that made this rename more complicated. What did you end up getting stuck on when renaming this selection error, `@lcnr?` **also** I renamed the `FulfillmentErrorCode` variants. This is just churn but I wanted to do it forever. I can move it out of this PR if desired. r? lcnr
2024-01-12Remove unused ErrorReporting variant from overflow handlingMichael Goulet-5/+0
2024-01-12OutputTypeParameterMismatch -> SignatureMismatchMichael Goulet-2/+2
2024-01-12Auto merge of #119879 - matthiaskrgr:rollup-y710der, r=matthiaskrgrbors-10/+4
Rollup of 4 pull requests Successful merges: - #119781 (fix typo) - #119865 (Set `c_str_literals` stabilization version back to `CURRENT_RUSTC_VERSION`) - #119866 (Convert `effects` description to doc comment) - #119868 (Register even erroneous impls) r? `@ghost` `@rustbot` modify labels: rollup
2024-01-11`specialization_graph_of`'s `errored` field is used in the only call site, ↵Oli Scherer-10/+4
and used to immediately throw away the rest of the value. Let's use `Result` to statically signal that this is happening
2024-01-09readd the provisional cachelcnr-0/+4
2024-01-03Track `HirId` instead of `Span` in `ObligationCauseCode::SizedArgumentType`Esteban Küber-1/+1
This gets us more accurate suggestions.
2023-12-26Auto merge of #118431 - sjwang05:issue-44695, r=estebankbors-1/+18
Emit better suggestions for `&T == T` and `T == &T` Fixes #40660 Fixes #44695
2023-12-26Auto merge of #119129 - jyn514:verbose, r=compiler-errors,estebankbors-1/+1
rework `-Zverbose` implements the changes described in https://github.com/rust-lang/compiler-team/issues/706 the first commit is only a name change from `-Zverbose` to `-Zverbose-internals` and does not change behavior. the second commit changes diagnostics. possible follow up work: - `ty::pretty` could print more info with `--verbose` than it does currently. `-Z verbose-internals` shows too much info in a way that's not helpful to users. michael had ideas about this i didn't fully understand: https://rust-lang.zulipchat.com/#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/uplift.20some.20-Zverbose.20calls.20and.20rename.20to.E2.80.A6.20compiler-team.23706/near/408984200 - `--verbose` should imply `-Z write-long-types-to-disk=no`. the code in `ty_string_with_limit` should take `--verbose` into account (apparently this affects `Ty::sort_string`, i'm not familiar with this code). writing a file to disk should suggest passing `--verbose`. r? `@compiler-errors` cc `@estebank`
2023-12-24Remove `Session` methods that duplicate `DiagCtxt` methods.Nicholas Nethercote-2/+2
Also add some `dcx` methods to types that wrap `TyCtxt`, for easier access.
2023-12-20Rollup merge of #119071 - lcnr:overflowo, r=compiler-errorsMatthias Krüger-4/+31
-Znext-solver: adapt overflow rules to avoid breakage Do not erase overflow constraints if they are from equating the impl header when normalizing[^1]. This should be the minimal change to not break crates depending on the old project behavior of "apply impl constraints while only lazily evaluating any nested goals". Fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/70, see https://hackmd.io/ATf4hN0NRY-w2LIVgeFsVg for the reasoning behind this. Only keeping constraints on overflow for `normalize-to` goals as that's the only thing needed for backcompat. It also allows us to not track the origin of root obligations. The issue with root goals would be something like the following: ```rust trait Foo {} trait Bar {} trait FooBar {} impl<T: Foo + Bar> FooBar for T {} // These two should behave the same, rn we can drop constraints for both, // but if we don't drop `Misc` goals we would only drop the constraints for // `FooBar` unless we track origins of root obligations. fn func1<T: Foo + Bar>() {} fn func2<T: FooBaz>() {} ``` [^1]: mostly, the actual rules are slightly different r? ``@compiler-errors``
2023-12-19rename to verbose-internalsjyn-1/+1