about summary refs log tree commit diff
path: root/compiler/rustc_infer/src/infer
AgeCommit message (Collapse)AuthorLines
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-4/+4
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-13Point to where clause for GATsjackh726-4/+94
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-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-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
2021-07-18When pretty printing, name placeholders as bound regionsjackh726-1/+1
2021-07-17Some perf optimizations and loggingjackh726-0/+1
2021-07-17avoid temporary vectorsMatthias Krüger-2/+2
Avoid collecting an interator just to re-iterate immediately. Rather reuse the previous iterator. (clippy::needless_collect)
2021-07-04remove unused OptionNiko Matsakis-18/+11
2021-06-17Auto merge of #86164 - FabianWolff:issue-86053, r=davidtwcobors-25/+34
Handle C-variadic arguments properly when reporting region errors This pull request fixes #86053. The issue is that for a C-variadic function ```rust #![feature(c_variadic)] unsafe extern "C" fn foo(_: (), ...) {} ``` `foo`'s signature will contain only the first parameter (and have `c_variadic` set to `true`), whereas its body has a second argument (a `hir::Pat` for the `...`). The code for reporting region errors iterates over the body's parameters and tries to fetch the corresponding parameter from the signature; this causes an out-of-bounds ICE for the `...` (though not in the example above, because there are no region errors to report). I have simply restricted the iteration over the body parameters to exclude `...`, which is fine because `...` cannot cause a region error.
2021-06-14Use the now available implementation of `IntoIterator` for arraysLeSeulArtichaut-1/+1
2021-06-09Handle C-variadic arguments properly when reporting region errorsFabian Wolff-25/+34
2021-06-07Suggest a trailing comma if a 1-tuple is expectedFabian Wolff-1/+28
2021-06-06Add variance-related information to lifetime error messagesAaron Hill-14/+60
2021-06-02Restrict access to crate_name.Camille GILLOT-1/+1
Also remove original_crate_name, which had the exact same implementation
2021-06-01Revert "Reduce the amount of untracked state in TyCtxt"Camille Gillot-1/+1
2021-05-30Restrict access to crate_name.Camille GILLOT-1/+1
Also remove original_crate_name, which had the exact same implementation
2021-05-15Add comments to opportunistic resolve functionsJack Huey-0/+4
2021-05-15Missed a couple thingsJack Huey-10/+1
2021-05-15Revert to only using opportunistic_resolve_vars for existing placesJack Huey-9/+33
2021-05-14Store Option<Region> as value for RegionVidJack Huey-46/+55
2021-05-14Make the UnifyValue for RegionVid ()Jack Huey-4/+3
2021-05-12Don't suggest adding `'static` lifetime to argumentsAaron Hill-6/+10
Fixes #69350 This is almost always the wrong this to do
2021-05-12Auto merge of #83813 - cbeuw:remap-std, r=michaelwoeristerbors-5/+11
Fix `--remap-path-prefix` not correctly remapping `rust-src` component paths and unify handling of path mapping with virtualized paths This PR fixes #73167 ("Binaries end up containing path to the rust-src component despite `--remap-path-prefix`") by preventing real local filesystem paths from reaching compilation output if the path is supposed to be remapped. `RealFileName::Named` introduced in #72767 is now renamed as `LocalPath`, because this variant wraps a (most likely) valid local filesystem path. `RealFileName::Devirtualized` is renamed as `Remapped` to be used for remapped path from a real path via `--remap-path-prefix` argument, as well as real path inferred from a virtualized (during compiler bootstrapping) `/rustc/...` path. The `local_path` field is now an `Option<PathBuf>`, as it will be set to `None` before serialisation, so it never reaches any build output. Attempting to serialise a non-`None` `local_path` will cause an assertion faliure. When a path is remapped, a `RealFileName::Remapped` variant is created. The original path is preserved in `local_path` field and the remapped path is saved in `virtual_name` field. Previously, the `local_path` is directly modified which goes against its purpose of "suitable for reading from the file system on the local host". `rustc_span::SourceFile`'s fields `unmapped_path` (introduced by #44940) and `name_was_remapped` (introduced by #41508 when `--remap-path-prefix` feature originally added) are removed, as these two pieces of information can be inferred from the `name` field: if it's anything other than a `FileName::Real(_)`, or if it is a `FileName::Real(RealFileName::LocalPath(_))`, then clearly `name_was_remapped` would've been false and `unmapped_path` would've been `None`. If it is a `FileName::Real(RealFileName::Remapped{local_path, virtual_name})`, then `name_was_remapped` would've been true and `unmapped_path` would've been `Some(local_path)`. cc `@eddyb` who implemented `/rustc/...` path devirtualisation
2021-05-06remove unused variantlcnr-6/+0
2021-05-05Use local and remapped paths where appropriateAndy Wang-5/+11