about summary refs log tree commit diff
path: root/src/librustc/infer
AgeCommit message (Collapse)AuthorLines
2018-11-14capture_disjoint_fields(rust-lang#53488)Blitzerr-3/+3
Refactoring out the HirId of the UpvarId in another struct.
2018-11-14Wrap some query results in `Lrc`.Nicholas Nethercote-2/+2
So that the frequent clones in `try_get` are cheaper. Fixes #54274.
2018-11-13Auto merge of #55912 - kennytm:rollup, r=kennytmbors-1/+1
Rollup of 20 pull requests Successful merges: - #55136 (Remove short doc where it starts with a codeblock) - #55711 (Format BtreeMap::range_mut example) - #55722 (impl_stable_hash_for: support enums and tuple structs with generic parameters) - #55754 (Avoid converting bytes to UTF-8 strings to print, just pass bytes to stdout/err) - #55804 (rustdoc: don't inline `pub use some_crate` unless directly asked to) - #55805 (Move `static_assert!` into librustc_data_structures) - #55837 (Make PhantomData #[structural_match]) - #55840 (Fix TLS errors when downloading stage0) - #55843 (add FromIterator<A> to Box<[A]>) - #55858 (Small fixes on code blocks in rustdoc) - #55863 (Fix a typo in std::panic) - #55870 (Fix typos.) - #55874 (string: Add documentation for `From` impls) - #55879 (save-analysis: Don't panic for macro-generated use globs) - #55882 (Reference count `crate_inherent_impls`s return value.) - #55888 (miri: for uniformity, also move memory_deallocated to AllocationExtra) - #55889 (global allocators: add a few comments) - #55896 (Document optimizations enabled by FusedIterator) - #55905 (Change `Lit::short_name` to `Lit::literal_name`.) - #55908 (Fix their/there grammar nit)
2018-11-13fix various typos in doc commentsAndy Russell-9/+9
2018-11-13Instantiate all bound vars existentiallyscalexm-12/+12
2018-11-11Fix typos.Bruce Mitchener-1/+1
2018-11-11Rollup merge of #55745 - nnethercote:outlives_components-SmallVec, ↵Pietro Albini-10/+13
r=matthewjasper Convert `outlives_components`' return value to a `SmallVec` outparam. This avoids some allocations, reducing instruction counts by 1% on a couple of benchmarks.
2018-11-08Rollup merge of #55638 - ↵Mark Rousskov-0/+1
pnkfelix:issue-55608-ice-reempty-msg_span_from_free_region, r=estebank Fix ICE in msg_span_from_free_region on ReEmpty On an example like this: ```rust #![feature(conservative_impl_trait)] fn server() -> impl FilterBase2 { segment2(|| { loop { } }).map2(|| "") } trait FilterBase2 { fn map2<F>(self, _fn: F) -> Map2<F> where Self: Sized { loop { } } } struct Map2<F> { _func: F } impl<F> FilterBase2 for Map2<F> { } fn segment2<F>(_fn: F) -> Map2<F> where F: Fn() -> Result<(), ()> { loop { } } ``` we now, instead of ICE'ing, get a diagnostic like: ``` error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds --> issue-55608.rs:3:16 | 3 | fn server() -> impl FilterBase2 { | ^^^^^^^^^^^^^^^^ | = note: hidden type `Map2<[closure@issue-55608.rs:4:36: 4:41]>` captures an empty lifetime ``` Fix #55608
2018-11-08Use `SmallVec` outparams in several functions.Nicholas Nethercote-10/+13
This avoids some allocations, reducing instruction counts by 1% on a couple of benchmarks.
2018-11-07Rollup merge of #55734 - teresy:shorthand-fields, r=davidtwcokennytm-4/+4
refactor: use shorthand fields refactor: use shorthand for single fields everywhere (excluding tests).
2018-11-06refactor: use shorthand fieldsteresy-4/+4
2018-11-03Substitute binders directlyscalexm-12/+13
2018-11-03Rename `as_bound_var` to `assert_bound_var`scalexm-2/+2
2018-11-03Fix doc commentscalexm-1/+1
2018-11-03Extend `ty::fold::RegionReplacer` to `ty::fold::BoundVarReplacer`scalexm-75/+14
Use the new `BoundVarReplacer` to perform canonical substitutions.
2018-11-03Rename `Binder::no_late_bound_regions` to `Binder::no_bound_vars`scalexm-1/+1
2018-11-03Remove `ReCanonical` in favor of `ReLateBound`scalexm-50/+59
2018-11-03Adjust bound tys indices in canonicalizationscalexm-10/+52
2018-11-03Rename `BoundTyIndex` to `BoundVar`scalexm-19/+19
2018-11-03Shift both late bound regions and bound typesscalexm-3/+3
2018-11-03Move `BoundTy` to `ty::TyKind`scalexm-18/+12
2018-11-03Sidestep an ICE by providing *some* description for `ReEmpty` when it arises.Felix S. Klock II-0/+1
2018-11-02Auto merge of #55305 - nikomatsakis:universes-refactor-3, r=scalexmbors-330/+247
universes refactor 3 Some more refactorings from my universe branch. These are getting a bit more "invasive" -- they start to plumb the universe information through the canonicalization process. As of yet though I don't **believe** this branch changes our behavior in any notable way, though I'm marking the branch as `WIP` to give myself a chance to verify this. r? @scalexm
2018-10-31kill old-style-lub warningsNiko Matsakis-300/+4
2018-10-30Rollup merge of #55205 - ljedrz:faster_fxhashmap/set_population, r=estebankkennytm-4/+1
Improve a few cases of collecting to an FxHash(Map/Set) Either use `collect` or procure specified capacity when possible.
2018-10-29Improve a few cases of collecting to an FxHash(Map/Set)ljedrz-4/+1
2018-10-27back out bogus `Ok`-wrapping suggestion on `?` arm type mismatchZack M. Davis-11/+1
This suggestion was introduced in #51938 / 6cc78bf8d7 (while introducing different language for type errors coming from `?` rather than a `match`), but it has a lot of false-positives (as repeatedly reported in Issues #52537, #52598, #54578, #55336), and incorrect suggestions carry more badness than marginal good suggestions do goodness. Just get rid of it (unless and until someone figures out how to do it correctly). Resolves #52537, resolves #54578.
2018-10-27distinguish user-type annotations from other annotationsNiko Matsakis-0/+37
In particular, we don't want to preserve the universes for the `'_` variables that appear in there. And we don't expect to find any placeholders, which justifies this as harmless. (In particular, if you have a query like `Foo(!1, !2, ?3)`, then you care about the universe of `?3`, since it may control whether `?3 = !1` and `?3 = !2` is a valid answer. But without any placeholders, we don't really care: any placeholders that would appear in the output must therefore come from some fresh universe anyway.)
2018-10-27when canonicalizing query responses, preserve infer-var universesNiko Matsakis-9/+38
2018-10-27extend query response to potentially contain fresh universesNiko Matsakis-28/+141
The idea here is that an incoming query may refer to some universes, and they query response may contain fresh universes that go beyond those. When we instantiate the query response in the caller's scope, therefore, we map those new universes into fresh universes for the caller.
2018-10-27allow canonicalized regions to carry universe and track max-universeNiko Matsakis-8/+42
But.. we don't really use it for anything right now.
2018-10-26Rollup merge of #55358 - sinkuu:redundant_clone2, r=estebankkennytm-3/+3
Remove redundant clone (2)
2018-10-26Rollup merge of #55258 - Aaron1011:fix/rustdoc-blanket, r=GuillaumeGomezkennytm-1/+12
Fix Rustdoc ICE when checking blanket impls Fixes #55001, #54744 Previously, SelectionContext would unconditionally cache the selection result for an obligation. This worked fine for most users of SelectionContext, but it caused an issue when used by Rustdoc's blanket impl finder. The issue occured when SelectionContext chose a ParamCandidate which contained inference variables. Since inference variables can change between calls to select(), it's not safe to cache the selection result - the chosen candidate might not be applicable for future results, leading to an ICE when we try to run confirmation. This commit prevents SelectionContext from caching any ParamCandidate that contains inference variables. This should always be completely safe, as trait selection should never depend on a particular result being cached. I've also added some extra debug!() statements, which I found helpful in tracking down this bug.
2018-10-26Remove redundant cloneShotaro Yamada-3/+3
2018-10-24port the relate-types code from NLL type-check into a type-opNiko Matsakis-0/+22
Add regression tests for #55219 and #55241 Also another test where a duplicate-like error appears to have been suppressed; I'm not 100% sure why this output changes, though I could imagine that some duplicate suppression is enabled by this PR.
2018-10-22Fix Rustdoc ICE when checking blanket implsAaron Hill-1/+12
Fixes #55001, #54744 Previously, SelectionContext would unconditionally cache the selection result for an obligation. This worked fine for most users of SelectionContext, but it caused an issue when used by Rustdoc's blanket impl finder. The issue occured when SelectionContext chose a ParamCandidate which contained inference variables. Since inference variables can change between calls to select(), it's not safe to cache the selection result - the chosen candidate might not be applicable for future results, leading to an ICE when we try to run confirmation. This commit prevents SelectionContext from caching any ParamCandidate that contains inference variables. This should always be completely safe, as trait selection should never depend on a particular result being cached. I've also added some extra debug!() statements, which I found helpful in tracking down this bug.
2018-10-20Rename InferTy::CanonicalTy to BoundTy and add DebruijnIndex to variant typeFabian Drinck-14/+22
2018-10-20Rename CanonicalVar to BoundTyIndexFabian Drinck-19/+19
2018-10-20Auto merge of #55114 - oli-obk:fx#map, r=nikomatsakisbors-20/+16
Deprecate the `FxHashMap()` and `FxHashSet()` constructor function hack
2018-10-19suppress duplicate -- or near duplicate -- type test errorsNiko Matsakis-1/+1
2018-10-19Prefer `Default::default` over `FxHash*::default` in struct constructorsOliver Scherer-16/+12
2018-10-19Deprecate the `FxHashMap()` and `FxHashSet()` constructor function hackOliver Scherer-9/+9
2018-10-19remove outdated assertionNiko Matsakis-8/+1
This dates from the days before we instantiated user types with inference variables.
2018-10-15move `force_instantiate_unchecked` to be local to `nll_relate` codeNiko Matsakis-59/+61
2018-10-15extract `type_relate` into the inference context as `nll_relate`Niko Matsakis-1/+677
The name is not great. Nor is the existence of this code great. It should be merged with the main "type relating code" at some point.
2018-10-15make `instantiate_canonical_with_fresh_inference_vars` public againNiko Matsakis-4/+1
This used to be public, then I made it private in a previous PR, but there really wasn't a strong need for that.
2018-10-15add `force_instantiate_unchecked` methodNiko Matsakis-0/+59
2018-10-15remove the sub/super terminology for universesNiko Matsakis-9/+6
Instead, we talk about: - creating the "next" universe - universes "extending" one another - and `u1.can_name(u2)`, meaning that `u1` contains all names from `u2`
2018-10-15pacify the mercilous tidy with rustfmtNiko Matsakis-11/+7
2018-10-15hide `SmallCanonicalVarValues` in `OriginalQueryValues` structNiko Matsakis-32/+51