Commit Graph

124 Commits

Author SHA1 Message Date
Niko Matsakis
71ce2e7eb6 make Eq a true query 2018-06-26 10:59:40 -04:00
Niko Matsakis
1d664622b6 remove Canonicalization trait, which serves no purpose 2018-06-26 10:59:38 -04:00
Niko Matsakis
dfd33f5932 move make_query_response into method on infcx 2018-06-26 10:49:24 -04:00
bors
0b8d817404 Auto merge of #51433 - scalexm:finish-rules, r=nikomatsakis
[chalkify] Small refactoring and WF/FromEnv rules for types

r? @nikomatsakis
2018-06-22 01:17:52 +00:00
Eduard-Mihai Burtescu
5a5c7ded0d rustc: rename ty::maps to ty::query. 2018-06-14 18:05:12 +03:00
scalexm
6656c0f09f Add rules for type well-formedness 2018-06-07 14:38:23 +02:00
scalexm
0347b32a26 Refactor the chalkify lowering process 2018-06-04 18:21:14 +02:00
John Kåre Alsaker
b7aabaa3fc Update recursion limits 2018-06-01 14:56:01 +02:00
Matthew Jasper
b83daea479 Register outlives predicates from queries the right way around. 2018-05-31 20:40:25 +01:00
Niko Matsakis
8fd316f5b5 pacify the mercilous tidy 2018-05-24 12:01:28 -04:00
Niko Matsakis
6f425a9201 implement the chalk traits, albeit with many placeholders 2018-05-24 12:01:27 -04:00
Eduard-Mihai Burtescu
7e4d8718cb rustc: use intern_* instead of mk_* where possible. 2018-05-21 12:13:19 +03:00
Mark Simulacrum
54df1bf200
Rollup merge of #50818 - nnethercote:faster-normalize, r=nikomatsakis
Speed up `opt_normalize_projection_type`

`opt_normalize_projection_type` is hot in the serde and futures benchmarks in rustc-perf. These two patches speed up the execution of most runs for them by 2--4%.
2018-05-17 13:51:27 -06:00
Nicholas Nethercote
47bc774ab6 Avoid allocations in opt_normalize_projection_type.
This patch changes `opt_normalize_project_type` so it appends
obligations to a given obligations vector, instead of returning a new
obligations vector.

This change avoids lots of allocations. In the most extreme case, for a
clean "Check" build of serde it reduces the total number of allocations
by 20%.
2018-05-17 10:35:39 +10:00
varkor
39a68e9069 Clean up dropck_outlives PhantomData handling 2018-05-15 14:22:25 +01:00
varkor
0a9371ab77 Add mk_param_from_def 2018-05-15 14:22:25 +01:00
varkor
4bed895cab Pull common parameters into GenericParamDef
This leads to a lot of simplifications, as most code doesn't actually need to know about the specific lifetime/type data; rather, it's concerned with properties like name, index and def_id.
2018-05-15 14:21:32 +01:00
varkor
5e89312a22 Inline get_type 2018-05-15 14:21:32 +01:00
varkor
d62fc236f9 Refactor to address comments 2018-05-15 14:21:31 +01:00
varkor
b75f421ee9 Generalise more cases of explicit iteration of specific kinds 2018-05-15 14:21:03 +01:00
varkor
a9622dc5c6 Fix generics type parameter handling in miri 2018-05-15 14:20:19 +01:00
John Kåre Alsaker
710b4ad2a5 Store the GeneratorInterior in the new GeneratorSubsts 2018-05-08 16:21:58 +02:00
John Kåre Alsaker
0edc8f4270 Store generator movability outside GeneratorInterior 2018-05-08 16:21:58 +02:00
Felix S. Klock II
edb8d1c0d4 Conservatively assume dropping a generator touches its upvars, via locals' dtors.
This is meant to address rust-lang/rust#49918.

Review feedback: put back comment justifying skipping interior traversal.

Review feedback: dropck generators like trait objects: all their upvars must
outlive the generator itself, so just create a DtorckConstraint saying so.
2018-05-01 22:28:54 +02:00
bors
8a09bc6a77 Auto merge of #48995 - aravind-pg:canonical-query, r=nikomatsakis
Create a canonical trait query for `evaluate_obligation`

This builds on the canonical query machinery introduced in #48411 to introduce a new canonical trait query for `evaluate_obligation` in the trait selector. Also ports most callers of the original `evaluate_obligation` to the new system (except in coherence, which requires support for intercrate mode). Closes #48537.

r? @nikomatsakis
2018-04-27 03:53:39 +00:00
Aravind Gollakota
d5b2e90744 Retry canonical trait query in standard mode if overflow occurs
This is slightly hacky and hopefully only a somewhat temporary solution.
2018-04-26 20:28:30 -05:00
Aravind Gollakota
5cb0372160 Remove the stored obligation in OverflowError to simplify things
We will shortly refactor things so that it is no longer needed
2018-04-26 20:28:30 -05:00
Aravind Gollakota
e5535fc7dd Introduce trait query mode and use it to set overflow error handling policy in traits::select 2018-04-26 20:28:30 -05:00
Aravind Gollakota
3ab3a9f509 Create a canonical trait query for evaluate_obligation 2018-04-26 20:28:29 -05:00
Niko Matsakis
2a58875fa2 improved debug output 2018-04-26 13:31:24 -04:00
Tyler Mandry
98546f8b26 Make Binder's field private and clean up its usage 2018-04-24 22:12:07 -05:00
Niko Matsakis
2c5fbe2058 sort strings on output 2018-04-23 13:28:15 -04:00
Niko Matsakis
7fa3c8f445 eliminate the Lrc of a slice and just return the slice
Also, introduce `Clauses` and `Goals` type alises for readability.
2018-04-23 13:28:14 -04:00
Niko Matsakis
294cae22ee first draft of program_clauses_for_env
This computes the transitive closure of traits that appear in the
environment and then appends their clauses. It needs some work, but
it's in the right direction.
2018-04-23 13:28:14 -04:00
Niko Matsakis
7173fd78c6 in unit tests, use note to dump multiple program clauses
(rather than issuing multiple errors)

Also, reorder so that the annotations are considered "used" when the
lint runs.
2018-04-23 13:28:14 -04:00
Niko Matsakis
94639ca406 rustfmt lowering.rs 2018-04-23 13:28:14 -04:00
Niko Matsakis
c8a52850cf create a QueryRegionConstraint type
Chalk wants to be able to pass these constraints around. Also, the
form we were using in our existing queries was not as general as we
are going to need.
2018-04-23 13:28:14 -04:00
Fabian Zaiser
b7c4a57465 Rebase and fix conflicts. 2018-04-15 23:49:41 +02:00
Fabian Zaiser
de475582c4 Stop duplicating where clauses from impl's. 2018-04-15 23:32:58 +02:00
Fabian Zaiser
ecd41976fc Rebase and update code. 2018-04-15 23:32:58 +02:00
Fabian Zaiser
27393b1210 Improve function name. 2018-04-15 23:32:57 +02:00
Fabian Zaiser
5a73fd5e1f Implement Chalk lowering rule Normalize-From-Impl 2018-04-15 23:32:57 +02:00
bors
b8f60f3fc4 Auto merge of #49800 - ishitatsuyuki:intern-goal, r=nikomatsakis
traits: Implement interning for Goal and Clause

r? @nikomatsakis

Close #49054

Contains some refactoring for the interning mechanism, mainly aimed at reducing pain when changing types of interning map.

This should be mostly good, although I'm not sure with the naming of `Goal::from_poly_domain_goal`.
2018-04-13 13:09:40 +00:00
bors
6c537493d0 Auto merge of #49558 - Zoxc:sync-misc, r=michaelwoerister
Even more thread-safety changes

r? @michaelwoerister
2018-04-12 16:22:36 +00:00
Tatsuyuki Ishi
b15df80345 traits: Implement interning for Goal and Clause 2018-04-12 13:43:10 +09:00
bors
43e994c8b8 Auto merge of #49715 - Mark-Simulacrum:deny-warnings, r=alexcrichton
Move deny(warnings) into rustbuild

This permits easier iteration without having to worry about warnings
being denied.

Fixes #49517
2018-04-11 03:30:04 +00:00
John Kåre Alsaker
7aa7198b4b Make PerfStats thread-safe and remove unused fields 2018-04-10 14:40:25 +02:00
John Kåre Alsaker
cf3b7909fa Make recursion_limit and type_length_limit thread-safe 2018-04-10 14:39:57 +02:00
bors
a8a8d6b5bf Auto merge of #49435 - tmandry:rule-implied-bound-from-trait, r=nikomatsakis
chalkify: Implement lowering rule Implied-Bound-From-Trait

For #49177.

TODO:
- [x] Implement where clauses besides trait and projection predicates
- [x] Is the output of the `lower_trait_higher_rank` test correct?
- [ ] Remove `Self::Trait` from the query `tcx.predicates_of(<trait_id>).predicates`
- [ ] Consider moving tests to compile-fail to make them more manageable
2018-04-10 00:32:54 +00:00
Mark Simulacrum
c115cc655c Move deny(warnings) into rustbuild
This permits easier iteration without having to worry about warnings
being denied.

Fixes #49517
2018-04-08 16:59:14 -06:00
bors
8c2d7b2da3 Auto merge of #49661 - alexcrichton:bump-bootstrap, r=nikomatsakis
Bump the bootstrap compiler to 1.26.0 beta

Holy cow that's a lot of `cfg(stage0)` removed and a lot of new stable language
features!
2018-04-07 11:58:38 +00:00
Tyler Mandry
7ac35eaa12 chalkify: Implement Rule Implied-Bound-From-Trait 2018-04-06 13:05:45 -05:00
Alex Crichton
72ac3ebf68 Rollup merge of #49497 - scalexm:hrtb, r=nikomatsakis
Chalkify - Tweak `Clause` definition and HRTBs

r? @nikomatsakis
2018-04-05 11:18:16 -07:00
Alex Crichton
8958815916 Bump the bootstrap compiler to 1.26.0 beta
Holy cow that's a lot of `cfg(stage0)` removed and a lot of new stable language
features!
2018-04-05 07:13:45 -07:00
Alexandre Martin
1074a22905
Fix comment 2018-04-02 22:25:22 +02:00
scalexm
71dc1626bd Tweak Clause definition and HRTBs 2018-03-30 10:29:01 +02:00
Taylor Cramer
e6e6bd27d5 Stabilize underscore lifetimes 2018-03-29 00:27:50 +02:00
Taylor Cramer
3c65f53620 Stabilize match_default_bindings
This includes a submodule update to rustfmt
in order to allow a stable feature declaration.
2018-03-28 11:13:13 +02:00
bors
9c9424de51 Auto merge of #49202 - csmoe:trait_engine, r=nikomatsakis
Introduce trait engine

address #48895 step 1: introduce trait engine
2018-03-27 14:31:43 +00:00
Alex Crichton
4b31b5bda7 Rollup merge of #49030 - Zoxc:misc, r=michaelwoerister
Misc changes from my parallel rustc branch

r? @michaelwoerister
2018-03-23 10:16:09 -07:00
csmoe
0c4062a94d import trait engine to typeck 2018-03-23 09:22:07 +08:00
varkor
b8c75d98f9 Implement Rule Implemented-From-Env
This extends the Chalk lowering pass with the "Implemented-From-Env" rule for generating program clauses from a trait definition as part of #49177.
2018-03-20 15:13:44 +00:00
varkor
de9e665248 Improve comments for Rule Implemented-From-Impl 2018-03-20 15:11:26 +00:00
bors
7c396ebd0b Auto merge of #48985 - scalexm:lowering, r=nikomatsakis
MVP for chalkification

r? @nikomatsakis
2018-03-18 07:35:43 +00:00
John Kåre Alsaker
697d3bee96 Replace Rc with Lrc 2018-03-17 23:01:54 +01:00
Alexandre Martin
ef3b4e1f5b
Fix tidy 2018-03-15 23:20:06 +01:00
Niko Matsakis
4eaa85d3be
add xref to rust-guide 2018-03-15 14:27:00 -04:00
scalexm
e8f3ed5db2 Add documentation 2018-03-14 15:19:17 +01:00
scalexm
2bbd16de13 Move code into librustc_traits 2018-03-14 14:45:30 +01:00
Andrew Cann
b1526ca384 Fixes after rebase 2018-03-14 12:45:14 +08:00
Niko Matsakis
fc04c41a40 add a debug assertion that only outlives-oblig. result from norm. 2018-03-13 11:22:08 -04:00
Niko Matsakis
211d9ad7db introduce tcx.normalize_erasing_regions(..) operaton [VIC] 2018-03-13 11:22:07 -04:00
Niko Matsakis
ca87d24467 introduce infcx.at(..).dropck_outlives(..) operaton [VIC]
Backed by a canonicalized query. This computes all the types/regions that need
to be live when the destructor runs (i.e., that the dtor may access).
2018-03-13 11:22:07 -04:00
Niko Matsakis
3a50b41da4 introduce infcx.at(..).normalize(..) operation [VIC]
It is backed by the new `normalize_projection_ty` query, which uses
canonicalization.
2018-03-13 11:22:05 -04:00