about summary refs log tree commit diff
path: root/compiler/rustc_infer
AgeCommit message (Collapse)AuthorLines
2023-12-15Add higher_ranked to relate submoduleMichael Goulet-8/+8
2023-12-15Move type relations into submodule in rustc_inferMichael Goulet-41/+42
2023-12-15banish hir::GenericBound::LangItemTraitMichael Goulet-18/+8
2023-12-15Annotate some bugsMichael Goulet-14/+28
2023-12-15unify query canonicalization modeAli MJ Al-Nasrawy-56/+27
2023-12-15Opportunistically resolve region var in canonicalizerMichael Goulet-15/+2
2023-12-14update use of feature flagslcnr-3/+3
2023-12-14Auto merge of #117749 - aliemjay:perf-canon-cache, r=lcnrbors-115/+123
cache param env canonicalization Canonicalize ParamEnv only once and store it. Then whenever we try to canonicalize `ParamEnvAnd<'tcx, T>` we only have to canonicalize `T` and then merge the results. Prelimiary results show ~3-4% savings in diesel and serde benchmarks. Best to review commits individually. Some commits have a short description. Initial implementation had a soundness bug (https://github.com/rust-lang/rust/pull/117749#issuecomment-1840453387) due to cache invalidation: - When canonicalizing `Ty<'?0>` we first try to resolve region variables in the current InferCtxt which may have a constraint `?0 == 'static`. This means that we register `Ty<'?0> => Canonical<Ty<'static>>` in the cache, which is obviously incorrect in another inference context. - This is fixed by not doing region resolution when canonicalizing the query *input* (vs. response), which is the only place where ParamEnv is used, and then in a later commit we *statically* guard against any form of inference variable resolution of the cached canonical ParamEnv's. r? `@ghost`
2023-12-14remove canonicalize_query_preserving_universesAli MJ Al-Nasrawy-47/+0
unused!
2023-12-14make infcx optional in canonicalizerAli MJ Al-Nasrawy-45/+35
This doesn't change behavior. It should prevent unintentional resolution of inference variables during canonicalization, which previously caused a soundness bug. See PR description for more.
2023-12-13Tweak `short_ty_string` to reduce number of filesEsteban Küber-57/+46
When shortening types and writing them to disk, make `short_ty_string` capable of reusing the same file, instead of writing a file per shortened type.
2023-12-13don't resolve regions in query inputAli MJ Al-Nasrawy-15/+15
fixes a soundness regression described in the PR description.
2023-12-13don't store OriginalQueryValues::universe_mapAli MJ Al-Nasrawy-0/+1
ParamEnv is canonicalized in *queries input* rather than query response. In such case we don't "preserve universes" of canonical variable. This means that `universe_map` always has the default value, which is wasteful to store in the cache.
2023-12-13global param_env canonicalization cacheAli MJ Al-Nasrawy-16/+80
2023-12-13Auto merge of #118500 - ZetaNumbers:tcx_hir_refactor, r=petrochenkovbors-17/+13
Move some methods from `tcx.hir()` to `tcx` https://github.com/rust-lang/rust/pull/118256#issuecomment-1826442834 Renamed: - find -> opt_hir_node - get -> hir_node - find_by_def_id -> opt_hir_node_by_def_id - get_by_def_id -> hir_node_by_def_id
2023-12-12Rollup merge of #118889 - matthiaskrgr:compl_2023_2, r=WaffleLapkinJubilee-1/+1
more clippy::complexity fixes redundant_guards redundant_slicing filter_next needless_borrowed_reference useless_format
2023-12-12more clippy::complexity fixesMatthias Krüger-1/+1
redundant_guards redundant_slicing filter_next needless_borrowed_reference useless_format
2023-12-12Move some methods from `tcx.hir()` to `tcx`zetanumbers-17/+13
Renamings: - find -> opt_hir_node - get -> hir_node - find_by_def_id -> opt_hir_node_by_def_id - get_by_def_id -> hir_node_by_def_id Fix rebase changes using removed methods Use `tcx.hir_node_by_def_id()` whenever possible in compiler Fix clippy errors Fix compiler Apply suggestions from code review Co-authored-by: Vadim Petrochenkov <vadim.petrochenkov@gmail.com> Add FIXME for `tcx.hir()` returned type about its removal Simplify with with `tcx.hir_node_by_def_id`
2023-12-12refactor writeback: emit normalization errors with new solverlcnr-27/+1
2023-12-12Auto merge of #118742 - lcnr:infer-var-cleanup, r=compiler-errorsbors-89/+33
refactor infer var storage cleanup the code, discovered while working on #118725
2023-12-11Auto merge of #118661 - fee1-dead-contrib:restore-const-partialEq, ↵bors-13/+7
r=compiler-errors Restore `const PartialEq` And thus fixes a number of tests. There is a bug that still needs to be fixed, so WIP for now. r? `@compiler-errors`
2023-12-10Auto merge of #118692 - surechen:remove_unused_imports, r=petrochenkovbors-1/+1
remove redundant imports detects redundant imports that can be eliminated. for #117772 : In order to facilitate review and modification, split the checking code and removing redundant imports code into two PR. r? `@petrochenkov`
2023-12-10Revert "Don't print host effect param in pretty path_generic_args"Deadbeef-13/+7
This reverts commit f1bf874fb13703d706fc8184407c6df12555d8e9.
2023-12-10remove redundant importssurechen-1/+1
detects redundant imports that can be eliminated. for #117772 : In order to facilitate review and modification, split the checking code and removing redundant imports code into two PR.
2023-12-09Don't print host effect param in pretty path_generic_argsMichael Goulet-7/+13
2023-12-08Rollup merge of #118730 - jyn514:cmp_refs, r=estebank,compiler-errorsMatthias Krüger-42/+52
recurse into refs when comparing tys for diagnostics before: ![image](https://github.com/rust-lang/rust/assets/23638587/bf6abd62-c7f3-4c09-a47e-31b6e129de19) after: ![image](https://github.com/rust-lang/rust/assets/23638587/b704d728-ddba-4204-aebe-c07dcbbcb55c) this diff from the test suite is also quite nice imo: ```diff `@@` -4,8 +4,8 `@@` error[E0308]: mismatched types LL | debug_assert_eq!(iter.next(), Some(value)); | ^^^^^^^^^^^ expected `Option<<I as Iterator>::Item>`, found `Option<&<I as Iterator>::Item>` | - = note: expected enum `Option<<I as Iterator>::Item>` - found enum `Option<&<I as Iterator>::Item>` + = note: expected enum `Option<_>` + found enum `Option<&_>` ```
2023-12-08Uplift canonicalizer into new trait solver crateMichael Goulet-22/+55
2023-12-08cleanup type variable storagelcnr-89/+33
2023-12-07recurse into refs when comparing tys for diagnosticsjyn-42/+52
2023-12-08update fixmelcnr-4/+3
2023-12-08implement and use `NormalizesTo`lcnr-26/+40
2023-12-07add unused `NormalizesTo` predicatelcnr-44/+26
2023-12-07avoid instantiating infer vars with inferlcnr-4/+9
2023-12-05Add print_trait_sugaredMichael Goulet-2/+2
2023-12-04cleanup and commentslcnr-26/+34
2023-12-04generalize: handle occurs check failure in aliaseslcnr-23/+120
2023-12-04do not fetch variance info during generalizationlcnr-1/+1
2023-12-02Use `Session::diagnostic` in more places.Nicholas Nethercote-12/+12
2023-12-02Rename `Handler::delay_good_path_bug` as `Handler::good_path_delayed_bug`.Nicholas Nethercote-1/+1
In line with the previous commits.
2023-12-02Rename `HandlerInner::delayed_span_bugs` as `HandlerInner::span_delayed_bugs`.Nicholas Nethercote-1/+1
For reasons similar to the previous commit.
2023-12-02Rename `HandlerInner::delay_span_bug` as `HandlerInner::span_delayed_bug`.Nicholas Nethercote-11/+11
Because the corresponding `Level` is `DelayedBug` and `span_delayed_bug` follows the pattern used everywhere else: `span_err`, `span_warning`, etc.
2023-11-29Rollup merge of #118269 - compiler-errors:poly, r=wesleywiserMatthias Krüger-22/+6
Unify `TraitRefs` and `PolyTraitRefs` in `ValuePairs` I did this recently with `FnSigs` and `PolyFnSigs` but didn't think to do it with `TraitRefs` and `PolyTraitRefs`.
2023-11-27Auto merge of #117200 - rmehri01:repeated_help, r=WaffleLapkinbors-3/+10
Don't add redundant help for object safety violations Fixes #117186 r? WaffleLapkin
2023-11-26move comment about local traitRyan Mehri-1/+2
2023-11-26don't add redundant help for object safety violationsRyan Mehri-3/+9
2023-11-26Rollup merge of #118302 - mu001999:dead_code/clean, r=cjgillotGuillaume Gomez-3/+0
Clean dead codes Clean dead codes detected by #118257
2023-11-26rustc: `hir().local_def_id_to_hir_id()` -> `tcx.local_def_id_to_hir_id()` ↵Vadim Petrochenkov-7/+7
cleanup
2023-11-26Clean dead codesr0cky-3/+0
2023-11-25Rollup merge of #118201 - compiler-errors:obligation-causes, r=cjgillotMichael Goulet-6/+0
Miscellaneous `ObligationCauseCode` cleanups Remove some dead code/unused `ObligationCauseCode`s.
2023-11-25Rollup merge of #118158 - nnethercote:reduce-fluent-boilerplate, ↵Michael Goulet-4/+1
r=compiler-errors Reduce fluent boilerplate Best reviewed one commit at a time. r? `@davidtwco`