about summary refs log tree commit diff
path: root/compiler/rustc_infer/src
AgeCommit message (Collapse)AuthorLines
2024-07-08Rollup merge of #127437 - compiler-errors:uplift-trait-ref-is-knowable, r=lcnr许杰友 Jieyou Xu (Joe)-0/+4
Uplift trait ref is knowable into `rustc_next_trait_solver` Self-explanatory. Eliminates one more delegate method. r? lcnr cc ``@fmease``
2024-07-07Auto merge of #127172 - compiler-errors:full-can_eq-everywhere, r=lcnrbors-15/+5
Make `can_eq` process obligations (almost) everywhere Move `can_eq` to an extension trait on `InferCtxt` in `rustc_trait_selection`, and change it so that it processes obligations. This should strengthen it to be more accurate in some cases, but is most important for the new trait solver which delays relating aliases to `AliasRelate` goals. Without this, we always basically just return true when passing aliases to `can_eq`, which can lead to weird errors, for example #127149. I'm not actually certain if we should *have* `can_eq` be called on the good path. In cases where we need `can_eq`, we probably should just be using a regular probe. Fixes #127149 r? lcnr
2024-07-07Uplift elaborationMichael Goulet-345/+4
2024-07-07Make push_outlives_components into a visitorMichael Goulet-6/+1
2024-07-07Uplift trait_ref_is_knowable and friendsMichael Goulet-0/+4
2024-07-06Don't track visited outlives bounds when decomposing verify for aliasMichael Goulet-22/+14
2024-07-06Rollup merge of #127417 - chenyukang:yukang-method-output-diff, r=oli-obkMichael Goulet-2/+4
Show fnsig's unit output explicitly when there is output diff in diagnostics Fixes #127263
2024-07-06Rollup merge of #127405 - ↵Michael Goulet-39/+15
compiler-errors:uplift-predicate-emitting-relation, r=lcnr uplift `PredicateEmittingRelation` Small follow-up to #127333 r? lcnr
2024-07-06Rollup merge of #127386 - compiler-errors:uplift-outlives-components, r=lcnrMichael Goulet-273/+6
Uplift outlives components to `rustc_type_ir` We need this to uplift `push_outlives_components`, since the elaborator uses `push_outlives_components` to elaborate type outlives obligations and I want to uplift elaboration. This ends up reworking and inlining a fair portion of the `GenericArg::walk_shallow` function, whose only callsite was this one. I believe I got the logic correct, but may be worthwhile to look at it closely just in case. Unfortunately github was too dumb to understand that this is a rename + change -- I could also rework the git history to split the "copy the file over" part from the actual logical changes if that makes this easier to review. r? lcnr
2024-07-06Auto merge of #127388 - compiler-errors:elaboration-tweaks, r=lcnrbors-18/+29
Elaboration tweaks Removes `Filter::OnlySelfThatDefines` and reimplements `transitive_bounds_that_define_assoc_item` as a separate function, since I don't want to have to uplift that mode since it's both an implementation detail (only exists to avoid cycles in astconv) and requires exposing `Ident` as an associated type on `Interner`. r? lcnr
2024-07-06show fnsig's output when there is differenceyukang-8/+3
2024-07-06Import via rustc_type_ir::outlivesMichael Goulet-5/+3
We could use rustc_middle::ty::outlives I guess?
2024-07-06Uplift push_outlives_componentsMichael Goulet-270/+5
2024-07-06Uplift PredicateEmittingRelation firstMichael Goulet-39/+15
2024-07-06show unit output when there is only output diff in diagnosticsyukang-2/+9
2024-07-05Split out transitive_bounds_that_define_assoc_itemMichael Goulet-14/+25
2024-07-05Split SolverDelegate back out from InferCtxtLikeMichael Goulet-0/+173
2024-07-05Supertrait elaboration doesn't need to use PredicatesMichael Goulet-5/+5
2024-07-05Actually just make can_eq process obligations (almost) everywhereMichael Goulet-17/+3
2024-07-05Process alias-relate obligations when proving receiver_is_validMichael Goulet-0/+4
2024-07-04Use shorter span for float literal suggestionEsteban Küber-3/+3
2024-07-02Instance::resolve -> Instance::try_resolve, and other nitsMichael Goulet-1/+1
2024-07-01Auto merge of #126996 - oli-obk:do_not_count_errors, r=nnethercotebors-49/+37
Automatically taint InferCtxt when errors are emitted r? `@nnethercote` Basically `InferCtxt::dcx` now returns a `DiagCtxt` that refers back to the `Cell<Option<ErrorGuaranteed>>` of the `InferCtxt` and thus when invoking `Diag::emit`, and the diagnostic is an error, we taint the `InferCtxt` directly. That change on its own has no effect at all, because `InferCtxt` already tracks whether errors have been emitted by recording the global error count when it gets opened, and checking at the end whether the count changed. So I removed that error count check, which had a bit of fallout that I immediately fixed by invoking `InferCtxt::dcx` instead of `TyCtxt::dcx` in a bunch of places. The remaining new errors are because an error was reported in another query, and never bubbled up. I think they are minor enough for this to be ok, and sometimes it actually improves diagnostics, by not silencing useful diagnostics anymore. fixes #126485 (cc `@olafes)` There are more improvements we can do (like tainting in hir ty lowering), but I would rather do that in follow up PRs, because it requires some refactorings.
2024-06-27Make queries more explicitMichael Goulet-4/+4
2024-06-26Automatically taint InferCtxt when errors are emittedOli Scherer-32/+20
2024-06-26Restrict diagnostic context lifetime of InferCtxt to itself instead of TyCtxtOli Scherer-8/+8
2024-06-26Restrict diagnostic context lifetime of TypeErrCtxt to InferCtxt instead of ↵Oli Scherer-6/+6
TyCtxt
2024-06-26Restrict diagnostic context lifetime of FnCtxt to InferCtxt instead of TyCtxtOli Scherer-3/+3
2024-06-25Rollup merge of #126915 - SparkyPotato:fix-126903, r=compiler-errorsMatthias Krüger-2/+4
Don't suggest awaiting in closure patterns Fixes #126903. For ```rust async fn do_async() {} fn main() { Some(do_async()).map(|()| {}); } ``` the error is now ```rust error[E0308]: mismatched types --> src/main.rs:4:27 | 4 | Some(do_async()).map(|()| {}); | ^^ | | | expected future, found `()` | expected due to this | = note: expected opaque type `impl Future<Output = ()>` found unit type `()` ``` Ideally, if `main` were to be `async`, it should be ```rs error[E0308]: mismatched types --> src/main.rs:4:27 | 4 | Some(do_async()).map(|()| {}); | ^^ | | | expected future, found `()` | expected due to this | = note: expected opaque type `impl Future<Output = ()>` found unit type `()` help: consider `await`ing on the `Future` | 4 | Some(do_async().await).map(|()| {}); | ++++++ ``` However, this would mean `FnCtx::check_pat_top` would have to be called with an `origin_expr` in `rustc_hir_typeck::check::check_fn`, and that expr would have to be somehow plumbed through `FnCtxt::check_expr_closure` and closure signature deduction. I'm willing to work on the plumbing but unsure how to start.
2024-06-24don't suggest awaiting type expr patternsSparkyPotato-2/+4
2024-06-24Split out IntoIterator and non-Iterator constructors for ↵Michael Goulet-2/+2
AliasTy/AliasTerm/TraitRef/projection
2024-06-21Rename a bunch of thingsMichael Goulet-12/+12
2024-06-20Add blank lines after module-level `//!` comments.Nicholas Nethercote-0/+3
Most modules have such a blank line, but some don't. Inserting the blank line makes it clearer that the `//!` comments are describing the entire module, rather than the `use` declaration(s) that immediately follows.
2024-06-19Allow constraining opaque types during subtyping in the trait systemOli Scherer-2/+2
2024-06-18Auto merge of #126614 - compiler-errors:uplift-next-trait-solver, r=lcnrbors-145/+6
Uplift next trait solver to `rustc_next_trait_solver` 🎉 There's so many FIXMEs! Sorry! Ideally this merges with the FIXMEs and we track and squash them over the near future. Also, this still doesn't build on anything other than rustc. I still need to fix `feature = "nightly"` in `rustc_type_ir`, and remove and fix all the nightly feature usage in the new trait solver (notably: let-chains). Also, sorry `@lcnr` I know you asked for me to separate the commit where we `mv rustc_trait_selection/solve/... rustc_next_trait_solver/solve/...`, but I had already done all the work by that point. Luckily, `git` understands the file moves so it should still be relatively reviewable. If this is still very difficult to review, then I can do some rebasing magic to try to separate this out. Please let me know! r? lcnr
2024-06-18Remove redundant argument from `subdiagnostic` methodOli Scherer-18/+17
2024-06-18Use a dedicated type instead of a reference for the diagnostic contextOli Scherer-5/+6
This paves the way for tracking more state (e.g. error tainting) in the diagnostic context handle
2024-06-18SolverDelegateMichael Goulet-145/+6
2024-06-18Prefer `dcx` methods over fields or fields' methodsOli Scherer-1/+1
2024-06-16rustc_span: Minor improvementsVadim Petrochenkov-2/+2
Introduce `{IndexNewtype,SyntaxContext}::from_u16` for convenience because small indices are sometimes encoded as `u16`. Use `SpanData::span` instead of `Span::new` where appropriate. Add a clarifying comment about decoding span parents.
2024-06-15Rollup merge of #126496 - compiler-errors:more-generics, r=lcnrGuillaume Gomez-0/+4
Make proof tree probing and `Candidate`/`CandidateSource` generic over interner `<TyCtxt<'tcx>>` is ugly, but will become `<I>` when things actually become generic. r? lcnr
2024-06-15Rollup merge of #126354 - compiler-errors:variance, r=lcnrMatthias Krüger-35/+23
Use `Variance` glob imported variants everywhere Fully commit to using the globbed variance. Could be convinced the other way, and change this PR to not use the globbed variants anywhere, but I'd rather we do one or the other. r? lcnr
2024-06-14Make proof tree probing genericMichael Goulet-0/+4
2024-06-14Rollup merge of #124884 - bvanjoi:fix-124785, r=estebankMatthias Krüger-3/+15
place explicit lifetime bound after generic param Fixes #124785 An easy fix.
2024-06-13Address nitsMichael Goulet-29/+41
- Remove the ValuePairs glob import - Make DummyPairs -> ValuePairs::Dummy and make it bug more - Fix WC - Make interner return `impl IntoIterator`s
2024-06-13Fix some TODOsMichael Goulet-0/+8
2024-06-13Finish uplifting all of structural_traitsMichael Goulet-15/+106
2024-06-13Rework most of structural_traits to be Interner-agnosticMichael Goulet-1/+20
2024-06-12Rollup merge of #126353 - compiler-errors:move-match, r=lcnrJubilee-123/+0
Move `MatchAgainstFreshVars` to old solver Small change I noticed when trying to uplift the relations to the new trait solver.
2024-06-12Stop passing traitref/traitpredicate by refMichael Goulet-5/+4