about summary refs log tree commit diff
path: root/compiler/rustc_infer/src
AgeCommit message (Collapse)AuthorLines
2021-08-26don't just compare `ty::Const`lcnr-0/+2
2021-08-26update `TypeFlags` to deal with missing ct substslcnr-2/+2
2021-08-26add `tcx` to `fn walk`lcnr-2/+2
2021-08-26make unevaluated const substs optionallcnr-23/+23
2021-08-26require a `tcx` for `TypeVisitor`lcnr-3/+24
2021-08-25Rollup merge of #88218 - Aaron1011:missing-method-dyn, r=nagisaLéo Lanteri Thauvin-6/+0
Remove `Session.trait_methods_not_found` Instead, avoid registering the problematic well-formed obligation to begin with. This removes global untracked mutable state, and avoids potential issues with incremental compilation.
2021-08-23Rollup merge of #88230 - steffahn:a_an, r=oli-obkMara Bos-6/+6
Fix typos “a”→“an” Fix typos in comments; found using a regex to find some easy instance of incorrect usage of a vs. an. While automation was used to find these, every change was checked manually. Changes in submodules get separate PRs: * https://github.com/rust-lang/stdarch/pull/1201 * https://github.com/rust-lang/cargo/pull/9821 * https://github.com/rust-lang/miri/pull/1874 * https://github.com/rust-lang/rls/pull/1746 * https://github.com/rust-analyzer/rust-analyzer/pull/9984 _folks @ rust-analyzer are fast at merging…_ * https://github.com/rust-analyzer/rust-analyzer/pull/9985 * https://github.com/rust-analyzer/rust-analyzer/pull/9987 * https://github.com/rust-analyzer/rust-analyzer/pull/9989 _For `clippy`, I don’t know if the changes should better better be moved to a PR to the original repo._ <hr> This has some overlap with #88226, but neither is a strict superset of the other. If you want multiple commits, I can split it up; in that case, make sure to suggest a criterion for splitting.
2021-08-22Auto merge of #88166 - BoxyUwU:const-equate-canon, r=lcnrbors-0/+16
canonicalize consts before calling try_unify_abstract_consts query Fixes #88022 Fixes #86953 Fixes #77708 Fixes #82034 Fixes #85031 these ICEs were all caused by calling the `try_unify_abstract_consts` query with inference vars in substs r? `@lcnr`
2021-08-22Fix more “a”/“an” typosFrank Steffahn-2/+2
2021-08-22Fix typos “a”→“an”Frank Steffahn-4/+4
2021-08-21Remove `Session.trait_methods_not_found`Aaron Hill-6/+0
Instead, avoid registering the problematic well-formed obligation to begin with. This removes global untracked mutable state, and avoids potential issues with incremental compilation.
2021-08-20move `fallback_if_possible` and friends to fallback.rsNiko Matsakis-23/+18
Along the way, simplify and document the logic more clearly.
2021-08-20move the `sub-unify` check and extend the documentation a bitNiko Matsakis-25/+46
I didn't like the sub-unify code executing when a predicate was ENQUEUED, that felt fragile. I would have preferred to move the sub-unify code so that it only occurred during generalization, but that impacted diagnostics, so having it also occur when we process subtype predicates felt pretty reasonable. (I guess we only need one or the other, but I kind of prefer both, since the generalizer ultimately feels like the *right* place to guarantee the properties we want.)
2021-08-19introduce a Coerce predicateNiko Matsakis-0/+34
2021-08-19introduce a `Diverging` enum instead of a boolNiko Matsakis-15/+27
2021-08-19move code to `InferCtxt` methodEllen-0/+16
2021-08-18Auto merge of #86700 - lqd:matthews-nll-hrtb-errors, r=nikomatsakisbors-6/+33
Matthew's work on improving NLL's "higher-ranked subtype error"s This PR rebases `@matthewjasper's` [branch](https://github.com/matthewjasper/rust/tree/nll-hrtb-errors) which has great work to fix the obscure higher-ranked subtype errors that are tracked in #57374. These are a blocker to turning full NLLs on, and doing some internal cleanups to remove some of the old region code. The goal is so `@nikomatsakis` can take a look at this early, and I'll then do my best to help do the changes and followup work to land this work, and move closer to turning off the migration mode. I've only updated the branch and made it compile, removed a warning or two. r? `@nikomatsakis` (Here's the [zulip topic to discuss this](https://rust-lang.zulipchat.com/#narrow/stream/122657-t-compiler.2Fwg-nll/topic/.2357374.3A.20improving.20higher-ranked.20subtype.20errors.20via.20.2386700) that Niko wanted)
2021-08-18Remove box syntax from rustc_inferest31-5/+4
2021-08-16Rollup merge of #88030 - fee1-dead:fixme, r=oli-obkMara Bos-1/+1
Assign FIXMEs to me and remove obsolete ones Also fixed capitalization of documentation We also don't need to transform predicates to be non-const since we basically ignore const predicates in non-const contexts. r? `````@oli-obk`````
2021-08-15Introduce hir::ExprKind::Let - Take 2Caio-18/+0
2021-08-15Report nicer errors for HRTB NLL errors from queriesMatthew Jasper-1/+17
2021-08-15Track causes for universes created during borrowckMatthew Jasper-1/+1
2021-08-15Show bound lifetimes when comparing types in diagnosticsMatthew Jasper-4/+15
2021-08-14Assign FIXMEs to me and remove obsolete onesDeadbeef-1/+1
Also fixed capitalization of documentation
2021-08-14Auto merge of #87375 - fee1-dead:move-constness-to-traitpred, r=oli-obkbors-1/+19
Try filtering out non-const impls when we expect const impls **TL;DR**: Associated types on const impls are now bounded; we now disallow calling a const function with bounds when the specified type param only has a non-const impl. r? `@oli-obk`
2021-08-13Point to where clause for GATsjackh726-4/+95
2021-08-13Pass constness to SelectionContextDeadbeef-0/+18
2021-08-13move Constness into TraitPredicateDeadbeef-1/+1
2021-08-06Document `with_opaque_type_inference`'s use cases.Oli Scherer-0/+4
2021-08-06Use existing type alias instead of manually writing itOli Scherer-4/+2
2021-08-06Store the `DefId` of the currently typechecked item in `InferCtxt`Oli Scherer-2/+21
This allows opaque type inference to check for defining uses without having to pass down that def id via function arguments to every method that could possibly cause an opaque type to be compared with a concrete type
2021-08-06Remove a field that is computed later anywayOli Scherer-23/+0
2021-08-06Move opaque type cache into `InferCtxt`Oli Scherer-0/+89
2021-08-03Do not suggest impl traits as type argumentsYuki Okushi-16/+4
2021-08-02Auto merge of #87628 - estebank:unmet-explicit-lifetime-bound, r=oli-obkbors-27/+97
Point at unmet explicit lifetime obligation bound r? `@oli-obk` Split off of #85799.
2021-08-02Rollup merge of #87673 - estebank:opaque-ty-mismatch, r=davidtwcoCameron Steffen-25/+43
Tweak opaque type mismatch error
2021-08-02Implement a `explicit_generic_args_with_impl_trait` feature gateGary Guo-1/+1
When this gate is enabled, explicit generic arguments can be specified even if `impl Trait` is used in argument position. Generic arguments can only be specified for explicit generic parameters but not for the synthetic type parameters from `impl Trait`
2021-07-31Tweak opaque type mismatch errorEsteban Küber-25/+43
2021-07-31Point at unmet explicit lifetime obligation boundEsteban Küber-27/+97
2021-07-24Auto merge of #86461 - crlf0710:rich_vtable, r=nikomatsakisbors-3/+3
Refactor vtable format for upcoming trait_upcasting feature. This modifies vtable format: 1. reordering occurrence order of methods coming from different traits 2. include `VPtr`s for supertraits where this vtable cannot be directly reused during trait upcasting. Also, during codegen, the vtables corresponding to these newly included `VPtr` will be requested and generated. For the cases where this vtable can directly used, now the super trait vtable has exactly the same content to some prefix of this one. r? `@bjorn3` cc `@RalfJung` cc `@rust-lang/wg-traits`
2021-07-22Rollup merge of #87281 - rust-lang:issue-81487, r=nikomatsakisGuillaume Gomez-0/+1
Normalize generic_ty before checking if bound is met Fixes #81487 r? `@nikomatsakis`
2021-07-22Auto merge of #87246 - rust-lang:placeholder-pretty, r=nikomatsakisbors-1/+1
When pretty printing, name placeholders as bound regions Split from #85499 When we see a placeholder that we are going to print, treat it as a bound var (and add it to a `for<...>`
2021-07-21Improve caching during trait evaluationAaron Hill-18/+22
Previously, we would 'forget' that we had `'static` regions in some place during trait evaluation. This lead to us producing `EvaluatedToOkModuloRegions` when we could have produced `EvaluatedToOk`, causing us to perform unnecessary work. This PR preserves `'static` regions when we canonicalize a predicate for `evaluate_obligation`, and when we 'freshen' a predicate during trait evaluation. Thie ensures that evaluating a predicate containing `'static` regions can produce `EvaluatedToOk` (assuming that we don't end up introducing any region dependencies during evaluation). Building off of this improved caching, we use `predicate_must_hold_considering_regions` during fulfillment of projection predicates to see if we can skip performing additional work. We already do this for trait predicates, but doing this for projection predicates lead to mixed performance results without the above caching improvements.
2021-07-21Rollup merge of #87206 - matthiaskrgr:clippy_collect, r=davidtwcoGuillaume Gomez-2/+2
avoid temporary vectors/reuse iterators Avoid collecting an interator just to re-iterate immediately. Rather reuse the previous iterator. (clippy::needless_collect)
2021-07-20Refactor vtable format.Charles Lew-3/+3
2021-07-20Auto merge of #87244 - jackh726:issue-71883, r=estebankbors-29/+136
Better diagnostics with mismatched types due to implicit static lifetime Fixes #78113 I think this is my first diagnostics PR...definitely happy to hear thoughts on the direction/implementation here. I was originally just trying to solve the error above, where the lifetime on a GAT was causing a cryptic "mismatched types" error. But as I was writing this, I realized that this (unintentionally) also applied to a different case: `wf-in-foreign-fn-decls-issue-80468.rs`. I'm not sure if this diagnostic should get a new error code, or even reuse an existing one. And, there might be some ways to make this even more generalized. Also, the error is a bit more lengthy and verbose than probably needed. So thoughts there are welcome too. This PR essentially ended up adding a new nice region error pass that triggers if a type doesn't match the self type of an impl which is selected because of a predicate because of an implicit static bound on that self type. r? `@estebank`
2021-07-19Better errors when we don't have implicit statics in trait objectsjackh726-31/+52
2021-07-19Better diagnostics when mismatched types due to implict static lifetimejackh726-14/+100
2021-07-19Normalize generic_ty before checking if bound is metjackh726-0/+1
2021-07-18Remove impl_trait_in_bindings handling on inference error reportingSantiago Pastorino-5/+2