about summary refs log tree commit diff
path: root/compiler/rustc_infer/src
AgeCommit message (Collapse)AuthorLines
2022-02-01add a rustc::query_stability lintlcnr-0/+1
2022-01-31Add ValuePairs::Terms & Fix compile errorkadmin-10/+4
And use correct substs.
2022-01-31Rollup merge of #90277 - pierwill:fix-70258-inference-terms, r=jackh726Matthias Krüger-1/+1
Improve terminology around "after typeck" Closes #70258.
2022-01-28Only suggest 1-tuple if expected and found types matchRob Pilling-20/+28
2022-01-28Handle existing parentheses when suggesting trailing-tuple-commaRob Pilling-8/+21
2022-01-28Replace span suggestion with multipartRob Pilling-12/+8
2022-01-28Suggest 1-tuple parentheses, without existing parensRob Pilling-10/+10
2022-01-28Remove generalization over projectionkadmin-2/+26
Instead, just use a term everywhere.
2022-01-26do not register infer var for GAT projection in opaqueMichael Goulet-7/+9
2022-01-25Auto merge of #93095 - Aaron1011:remove-assoc-ident, r=cjgillotbors-4/+4
Store a `Symbol` instead of an `Ident` in `AssocItem` This is the same idea as #92533, but for `AssocItem` instead of `VariantDef`/`FieldDef`. With this change, we no longer have any uses of `#[stable_hasher(project(...))]`
2022-01-21Remove a span from hir::ExprKind::MethodCallCameron Steffen-5/+5
2022-01-19Store a `Symbol` instead of an `Ident` in `AssocItem`Aaron Hill-4/+4
This is the same idea as #92533, but for `AssocItem` instead of `VariantDef`/`FieldDef`. With this change, we no longer have any uses of `#[stable_hasher(project(...))]`
2022-01-19Simplify error reporting code, remove await point wordingTyler Mandry-131/+33
2022-01-19NiceRegionError: Use written return type for async fnTyler Mandry-25/+34
2022-01-19Properly account for binders in get_impl_future_output_tyTyler Mandry-11/+18
2022-01-18Auto merge of #87648 - JulianKnodt:const_eq_constrain, r=oli-obkbors-6/+7
allow eq constraints on associated constants Updates #70256 (cc `@varkor,` `@Centril)`
2022-01-18Rollup merge of #92640 - compiler-errors:array-deref-on-newtype, r=lcnrMatthias Krüger-6/+3
Fix ICEs related to `Deref<Target=[T; N]>` on newtypes 1. Stash a const infer's type into the canonical var during canonicalization, so we can recreate the fresh const infer with that same type. For example, given `[T; _]` we know `_` is a `usize`. If we go from infer => canonical => infer, we shouldn't forget that variable is a usize. Fixes #92626 Fixes #83704 2. Don't stash the autoderef'd slice type that we get from method lookup, but instead recreate it during method confirmation. We need to do this because the type we receive back after picking the method references a type variable that does not exist after probing is done. Fixes #92637 ... A better solution for the second issue would be to actually _properly_ implement `Deref` for `[T; N]` instead of fixing this autoderef hack to stop leaking inference variables. But I actually looked into this, and there are many complications with const impls.
2022-01-17Add term to ExistentialProjectionkadmin-6/+2
Also prevent ICE when adding a const in associated const equality.
2022-01-17Update term for use in more placeskadmin-8/+3
Replace use of `ty()` on term and use it in more places. This will allow more flexibility in the future, but slightly worried it allows items which are consts which only accept types.
2022-01-17Use Term in ProjectionPredicatekadmin-9/+19
ProjectionPredicate should be able to handle both associated types and consts so this adds the first step of that. It mainly just pipes types all the way down, not entirely sure how to handle consts, but hopefully that'll come with time.
2022-01-16Only suggest char literal for single-character stringschordtoll-1/+1
2022-01-16Replace NestedVisitorMap with NestedFilterCameron Steffen-22/+18
2022-01-16Rollup merge of #92710 - jackh726:issue-92280, r=nikomatsakisMatthias Krüger-5/+16
Include Projections when elaborating TypeOutlives Fixes #92280 In `Elaborator`, we elaborate that `Foo<<Bar as Baz>::Assoc>: 'a` -> `<Bar as Baz>::Assoc: 'a`. This is the same rule that would be applied to any other `Param`. If there are escaping vars, we continue to do nothing. r? `@nikomatsakis`
2022-01-16Auto merge of #92805 - BoxyUwU:revert-lazy-anon-const-substs, r=lcnrbors-63/+28
partially revertish `lazily "compute" anon const default substs` reverts #87280 except for some of the changes around `ty::Unevaluated` having a visitor and a generic for promoted why revert: <https://github.com/rust-lang/rust/pull/92805#issuecomment-1010736049> r? `@lcnr`
2022-01-15Reduce use of local_def_id_to_hir_id.Camille GILLOT-15/+8
2022-01-15Return a LocalDefId in get_parent_item.Camille GILLOT-7/+8
2022-01-15Rollup merge of #92743 - bjorn3:less_symbol_intern, r=camelidMatthias Krüger-4/+4
Use pre-interned symbols in a couple of places Re-open of https://github.com/rust-lang/rust/pull/92733 as bors glitched.
2022-01-15Rollup merge of #92191 - jackh726:issue-89352, r=nikomatsakisMatthias Krüger-1/+1
Prefer projection candidates instead of param_env candidates for Sized predicates Fixes #89352 Also includes some drive by logging and verbose printing changes that I found useful when debugging this, but I can remove this if needed. This is a little hacky - but imo no more than the rest of `candidate_should_be_dropped_in_favor_of`. Importantly, in a Chalk-like world, both candidates should be completely compatible. r? ```@nikomatsakis```
2022-01-15attempt to re-add `ty::Unevaluated` visitor and friendsEllen-6/+3
2022-01-15initial revertEllen-66/+34
2022-01-14Rollup merge of #92045 - oli-obk:cleanup, r=petrochenkovMatthias Krüger-32/+36
Don't fall back to crate-level opaque type definitions. That would just hide bugs, as it works accidentally if the opaque type is defined at the crate level. Only works after #90948 which worked by accident for our entire test suite.
2022-01-13Rollup merge of #92006 - oli-obk:welcome_opaque_types_into_the_fold, ↵Matthias Krüger-4/+16
r=nikomatsakis Welcome opaque types into the fold r? ```@nikomatsakis``` because idk who else to bug on the type_op changes The commits have explanations in them. The TLDR is that * 5c4600227329a273c0c6c844e4a10ce650ead601 stops the "recurse and replace" scheme that replaces opaque types with their canonical inference var by just doing that ahead of time * bdeeb07bf6400622074f04ca2523dac1512ab662 does not affect anything on master afaict, but since opaque types generate obligations when instantiated, and lazy TAIT instantiates opaque types *everywhere*, we need to properly handle obligations here instead of just hoping no problematic obligations ever come up.
2022-01-12Canonicalize const variables correctlyMichael Goulet-6/+3
2022-01-12Don't fall back to crate-level opaque type definitions.Oli Scherer-32/+36
That would just hide bugs, as it works accidentally if the opaque type is defined at the crate level.
2022-01-11Auto merge of #92533 - Aaron1011:variant-symbol, r=petrochenkovbors-1/+1
Store a `Symbol` instead of an `Ident` in `VariantDef`/`FieldDef` The field is also renamed from `ident` to `name`. In most cases, we don't actually need the `Span`. A new `ident` method is added to `VariantDef` and `FieldDef`, which constructs the full `Ident` using `tcx.def_ident_span()`. This method is used in the cases where we actually need an `Ident`. This makes incremental compilation properly track changes to the `Span`, without all of the invalidations caused by storing a `Span` directly via an `Ident`.
2022-01-11Store a `Symbol` instead of an `Ident` in `VariantDef`/`FieldDef`Aaron Hill-1/+1
The field is also renamed from `ident` to `name. In most cases, we don't actually need the `Span`. A new `ident` method is added to `VariantDef` and `FieldDef`, which constructs the full `Ident` using `tcx.def_ident_span()`. This method is used in the cases where we actually need an `Ident`. This makes incremental compilation properly track changes to the `Span`, without all of the invalidations caused by storing a `Span` directly via an `Ident`.
2022-01-10Use pre-interned symbols in a couple of placesbjorn3-4/+4
2022-01-10Elaborate param_env predicates when checking if type outlives involving ↵Jack Huey-5/+16
projection holds
2022-01-09eplace usages of vec![].into_iter with [].into_iterLucas Kent-8/+5
2022-01-03Suggest changing quotes when str/char type mismatchchordtoll-3/+38
2021-12-29Refactor variance diagnostics to work with more typesAaron Hill-2/+3
Instead of special-casing mutable pointers/references, we now support general generic types (currently, we handle `ty::Ref`, `ty::RawPtr`, and `ty::Adt`) When a `ty::Adt` is involved, we show an additional note explaining which of the type's generic parameters is invariant (e.g. the `T` in `Cell<T>`). Currently, we don't explain *why* a particular generic parameter ends up becoming invariant. In the general case, this could require printing a long 'backtrace' of types, so doing this would be more suitable for a follow-up PR. We still only handle the case where our variance switches to `ty::Invariant`.
2021-12-22When obligation is a sized predicate, prefer projection or object candidates ↵Jack Huey-1/+1
instead of param_env candidates
2021-12-20Eliminate `ObligationCauseData`.Nicholas Nethercote-27/+27
This makes `Obligation` two words bigger, but avoids allocating a lot of the time. I previously tried this in #73983 and it didn't help much, but local timings look more promising now.
2021-12-19Rollup merge of #91878 - LegionMammal978:less-inband-infer, r=Aaron1011Matthias Krüger-49/+48
Remove `in_band_lifetimes` from `rustc_infer` See #91867 for more information. This crate actually had a typo `'ctx` in one of its functions: ```diff -pub fn same_type_modulo_infer(a: Ty<'tcx>, b: Ty<'ctx>) -> bool { +pub fn same_type_modulo_infer<'tcx>(a: Ty<'tcx>, b: Ty<'tcx>) -> bool { ``` Also, I wasn't entirely sure about the lifetimes in `suggest_new_region_bound`: ```diff pub fn suggest_new_region_bound( - tcx: TyCtxt<'tcx>, + tcx: TyCtxt<'_>, err: &mut DiagnosticBuilder<'_>, fn_returns: Vec<&rustc_hir::Ty<'_>>, ``` Should all of those lifetimes really be distinct?
2021-12-19Auto merge of #91957 - nnethercote:rm-SymbolStr, r=oli-obkbors-2/+1
Remove `SymbolStr` This was originally proposed in https://github.com/rust-lang/rust/pull/74554#discussion_r466203544. As well as removing the icky `SymbolStr` type, it allows the removal of a lot of `&` and `*` occurrences. Best reviewed one commit at a time. r? `@oli-obk`
2021-12-18Re-introduce concept of projection cache 'completion'Aaron Hill-3/+69
Instead of clearing out the cache entirely, we store the intermediate evaluation result into the cache entry. This accomplishes several things: * We avoid the performance hit associated with re-evaluating the sub-obligations * We avoid causing issues with incremental compilation, since the final evaluation result is always the same * We avoid affecting other uses of the same `InferCtxt` which might care about 'side effects' from processing the sub-obligations (e,g. region constraints). Only code that is specifically aware of the new 'complete' code is affected
2021-12-18Rollup merge of #92022 - woodenarrow:br_expected_bool, r=estebankMatthias Krüger-4/+4
Eliminate duplicate codes of expected_found_bool The function expected_found_bool is the same as ExpectedFound::new. So use ExpectedFound::new to replace expected_found_bool to eliminate duplicate codes. ![image](https://user-images.githubusercontent.com/95843988/146486722-c910eccd-a36c-4dc5-8b36-214aab058e38.png)
2021-12-17Eliminate duplicate codes of expected_found_boollzh-4/+4
2021-12-17Fix typo in "new region bound" suggestionEsteban Kuber-1/+1
The lifetime name shoud always appear in text surrounded by `.
2021-12-16Eagerly instantiate opaque typesOli Scherer-6/+4