about summary refs log tree commit diff
path: root/compiler/rustc_infer/src/infer
AgeCommit message (Collapse)AuthorLines
2024-07-29Use Vec in instantiate_binder_with_fresh_varsBryanskiy-24/+22
2024-07-29Reformat `use` declarations.Nicholas Nethercote-178/+167
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-22Get rid of can_eq_shallowMichael Goulet-12/+0
2024-07-21Move all error reporting into rustc_trait_selectionMichael Goulet-72/+31
2024-07-21Move need_type_info tooMichael Goulet-1298/+10
2024-07-21Make type_var_origin take a vidMichael Goulet-10/+4
2024-07-21Move some stuff to TypeErrCtxtMichael Goulet-6/+4
2024-07-18Remove tag field from relationsMichael Goulet-35/+16
2024-07-18valtree construction: keep track of which type was valtree-incompatibleRalf Jung-3/+3
2024-07-17Fix relationsMichael Goulet-16/+16
2024-07-15Move rustc_infer::infer::error_reporting to rustc_infer::error_reporting::inferMichael Goulet-7752/+4
2024-07-12Rollup merge of #127619 - compiler-errors:precise-capturing-better-sugg, ↵Jubilee-12/+109
r=oli-obk Suggest using precise capturing for hidden type that captures region Adjusts the "add `+ '_`" suggestion for opaques to instead suggest adding or reusing the `+ use<>` in the opaque. r? oli-obk or please re-roll if you're busy!
2024-07-11Make it translatable tooMichael Goulet-13/+10
2024-07-11Suggest using precise capturing for hidden type that captures regionMichael Goulet-12/+112
2024-07-11Avoid follow-up errors and ICEs after missing lifetime errors on data structuresOli Scherer-0/+3
2024-07-08Consolidate region error reporting in rustc_inferMichael Goulet-1263/+1268
2024-07-08Auto merge of #127438 - compiler-errors:compute-outlives-visitor, r=lcnrbors-22/+9
Make `push_outlives_components` into a `TypeVisitor` This involves removing the `visited: &mut SsoHashSet<GenericArg<'tcx>>` that is being passed around the `VerifyBoundCx`. The fact that we were using it when decomposing different type tests seems sketchy, so I don't think, though it may technically result in us registering more redundant outlives components 🤷 I did end up deleting some of the comments that referred back to RFC 1214 during this refactor. I can add them back if you think they were useful. r? lcnr
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-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-06show fnsig's output when there is differenceyukang-8/+3
2024-07-06Import via rustc_type_ir::outlivesMichael Goulet-4/+2
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 SolverDelegate back out from InferCtxtLikeMichael Goulet-0/+173
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-06-26Automatically taint InferCtxt when errors are emittedOli Scherer-28/+16
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.