about summary refs log tree commit diff
path: root/src/librustc/traits/query
AgeCommit message (Collapse)AuthorLines
2018-08-22Remove Ty prefix from ↵varkor-20/+20
Ty{Adt|Array|Slice|RawPtr|Ref|FnDef|FnPtr|Dynamic|Closure|Generator|GeneratorWitness|Never|Tuple|Projection|Anon|Infer|Error}
2018-08-21change `make_query_outlives` to take an iteratorNiko Matsakis-2/+7
2018-08-21Rollup merge of #53496 - matthiaskrgr:codespell_08_2018, r=varkorkennytm-1/+1
Fix typos found by codespell.
2018-08-19Auto merge of #52953 - dsciarra:mv-codemap-sourcemap, r=petrochenkovbors-3/+3
Rename CodeMap/FileMap to SourceMap/SourceFile A first renaming for #51574
2018-08-19Auto merge of #53316 - tristanburgess:52895_existential_type_ICE, r=oli-obkbors-9/+36
52985: cause cycle err on inf trait normalization Issue: #52985 - If an existential type is defined, but no user code infers the concrete type behind the existential type, normalization would infinitely recurse on this existential type which is only defined in terms of itself. - Instead of raising an inf recurse error, we cause a cycle error to help highlight that the issue is that the type is only defined in terms of itself. - Three known potential improvements: - If type folding itself was exposed as a query, used by normalization and other mechanisms, cases that would cause infinite recursion would automatically cause a cycle error. - The span for the cycle error should be improved to point to user code that fails to allow inference of the concrete type of the existential type, assuming that this error occurs because no user code can allow inference the concrete type. - A mechanism to extend the cycle error with a helpful note would be nice. Currently, the error is built and maintained by src/librustc/ty/query/plumbing, with no known way to extend the information that the error gets built with. r? @oli-obk
2018-08-19mv (mod) codemap source_mapDonato Sciarra-3/+3
2018-08-19Fix typos found by codespell.Matthias Krüger-1/+1
2018-08-19Auto merge of #53248 - nikomatsakis:nll-trivial-sized-predicate, r=eddybbors-2/+16
skip trivial `Sized` predicates This came to about a 2% win for me in cargo. Small, but hey. r? @eddyb
2018-08-1352985: cause cycle err on inf trait normalizationTristan Burgess-9/+36
- If an existential type is defined, but no user code infers the concrete type behind the existential type, normalization would infinitely recurse on this existential type which is only defined in terms of itself. - Instead of raising an inf recurse error, we cause a cycle error to help highlight that the issue is that the type is only defined in terms of itself. - Three known potential improvements: - If type folding itself was exposed as a query, used by normalization and other mechanisms, cases that would cause infinite recursion would automatically cause a cycle error. - The span for the cycle error should be improved to point to user code that fails to allow inference of the concrete type of the existential type, assuming that this error occurs because no user code can allow inference the concrete type. - A mechanism to extend the cycle error with a helpful note would be nice. Currently, the error is built and maintained by src/librustc/ty/query/plumbing, with no known way to extend the information that the error gets built with.
2018-08-12unions are not always trivially dropableRalf Jung-5/+3
Fixes #52786
2018-08-10skip trivial `T: Sized` predicatesNiko Matsakis-2/+16
2018-08-07Avoid unnecessary pattern matching against Option and Resultljedrz-1/+1
2018-07-31assert no region obligations on entering custom type opNiko Matsakis-0/+13
Fixes #51649
2018-07-25Change ManuallyDrop from an union to a struct and make it a lang item.Eduard-Mihai Burtescu-1/+4
2018-07-21use proper body-id and span when solving obligationsNiko Matsakis-2/+2
2018-07-21skip no-op obligations and add a little debug outputNiko Matsakis-1/+3
2018-07-21Convert implied_outlives_bounds to a queryTyler Mandry-0/+170
2018-07-17Avoid most allocations in `Canonicalizer`.Nicholas Nethercote-6/+15
Extra allocations are a significant cost of NLL, and the most common ones come from within `Canonicalizer`. In particular, `canonical_var()` contains this code: indices .entry(kind) .or_insert_with(|| { let cvar1 = variables.push(info); let cvar2 = var_values.push(kind); assert_eq!(cvar1, cvar2); cvar1 }) .clone() `variables` and `var_values` are `Vec`s. `indices` is a `HashMap` used to track what elements have been inserted into `var_values`. If `kind` hasn't been seen before, `indices`, `variables` and `var_values` all get a new element. (The number of elements in each container is always the same.) This results in lots of allocations. In practice, most of the time these containers only end up holding a few elements. This PR changes them to avoid heap allocations in the common case, by changing the `Vec`s to `SmallVec`s and only using `indices` once enough elements are present. (When the number of elements is small, a direct linear search of `var_values` is as good or better than a hashmap lookup.) The changes to `variables` are straightforward and contained within `Canonicalizer`. The changes to `indices` are more complex but also contained within `Canonicalizer`. The changes to `var_values` are more intrusive because they require defining a new type `SmallCanonicalVarValues` -- which is to `CanonicalVarValues` as `SmallVec` is to `Vec -- and passing stack-allocated values of that type in from outside. All this speeds up a number of NLL "check" builds, the best by 2%.
2018-06-28Rebase falloutOliver Schneider-1/+1
2018-06-28Merge `ConstVal` and `ConstValue`Oliver Schneider-1/+1
2018-06-28Move everything over from `middle::const_val` to `mir::interpret`Oliver Schneider-2/+1
2018-06-28Auto merge of #51538 - nikomatsakis:nll-perf-examination, r=eddybbors-88/+798
convert NLL ops to caches This is a extension of <https://github.com/rust-lang/rust/pull/51460>. It uses a lot more caching than we used to do. This caching is not yet as efficient as it could be, but I'm curious to see the current perf results. This is the high-level idea: in the MIR type checker, use [canonicalized queries](https://rust-lang-nursery.github.io/rustc-guide/traits/canonical-queries.html) for all the major operations. This is helpful because the MIR type check is operating in a context where all types are fully known (mostly, anyway) but regions are completely renumbered. This means we often wind up with duplicate queries like `Foo<'1, '2> :Bar` and `Foo<'3, '4>: Bar`. Canonicalized queries let us re-use the results. By the final commit in this PR, we can essentially just "read off" the resulting region relations and add them to the NLL type check.
2018-06-27rustfmt various filesNiko Matsakis-5/+9
2018-06-27change the `enter_canonical_trait_query` method to give a fulfill cxNiko Matsakis-1/+1
2018-06-27update commentsNiko Matsakis-3/+15
2018-06-27rename `prequery` to `try_fast_path`Niko Matsakis-7/+7
2018-06-27pull out `ParamEnvAnd` and remove `QueryKey`Niko Matsakis-153/+150
2018-06-27rename to `shrink_to_tcx_lifetime`Niko Matsakis-13/+13
2018-06-27improve comments on `dropck_outlives`Niko Matsakis-0/+15
2018-06-27rename `upcast` to `cast_to_tcx_lifetime` and improve commentNiko Matsakis-16/+21
2018-06-26convert query-type-op to create query-region-constraint directlyNiko Matsakis-148/+133
2018-06-26convert `dropck_outlives` type-op to use the queryNiko Matsakis-32/+67
2018-06-26introduce `QueryKey` separationNiko Matsakis-3/+27
2018-06-26transition to `Fallible`Niko Matsakis-33/+55
2018-06-26introduce `Normalizable` trait for things directly normalizableNiko Matsakis-41/+180
2018-06-26convert `prove_predicate` into a queryNiko Matsakis-14/+38
2018-06-26convert `predicates` to operate on 1 predicate at a timeNiko Matsakis-19/+12
2018-06-26make `Subtype` a true queryNiko Matsakis-13/+41
2018-06-26make `Eq` a true queryNiko Matsakis-22/+13
2018-06-26introduce `canonicalize_hr_query_hack`Niko Matsakis-1/+5
As the comment explains, this is needed to prevent subtype from going awry in higher-ranked cases, due to #33684. The proper fix here is introducing universes (#48536).
2018-06-26move `type_op` into `rustc`Niko Matsakis-0/+495
2018-06-26remove `Canonicalization` trait, which serves no purposeNiko Matsakis-42/+5
2018-06-26rename `instantiate_query_result`Niko Matsakis-2/+2
2018-06-26make one `Canonicalize` impl for `QueryResult`Niko Matsakis-28/+2
This lets us simplify a few type aliases.
2018-06-26improve `trivial_case` handlingNiko Matsakis-1/+1
2018-06-26Use proper debugging statements for infinite recursion assertionOliver Schneider-3/+3
2018-06-07Add existential type definitonsOliver Schneider-0/+5
2018-06-02Fix typos of 'ambiguous'Jon Purdy-1/+1
2018-05-17Rename trans to codegen everywhere.Irina Popa-2/+2
2018-04-30make needs_infer specific to inference variablesNiko Matsakis-1/+1
Notably, excluding ReSkolemized