Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit fc2b29d

Browse files
committedFeb 22, 2018
Auto merge of #48411 - nikomatsakis:chalkify-canonical-query-mir, r=<try>
introduce canonical queries, use for normalization and dropck-outlives This branch adds in the concept of a **canonicalized trait query** and uses it for three specific operations: - `infcx.at(cause, param_env).normalize(type_foldable)` - normalizes all associated types in `type_foldable` - `tcx.normalize_erasing_regions(param_env, type_foldable)` - like normalize, but erases regions first and in the result; this leads to better caching - `infcx.at(cause, param_env).dropck_outlives(ty)` - produces the set of types that must be live when a value of type `ty` is dropped - used from dropck but also NLL outlives This is a kind of "first step" towards a more Chalk-ified approach. It leads to a **big** speedup for NLL, which is basically dominated by the dropck-outlives computation. Here are some timing measurements for the `syn` crate (pre-branch measurements coming soon): | Commit | NLL disabled | NLL enabled | | ------- | --- | --- | | Before my branch | 5.43s | 8.99s | | After my branch | 5.36s | 7.25s | (Note that NLL enabled still does *all the work* that NLL disabled does, so this is not really a way to compare the performance of NLL versus the AST-based borrow checker directly.) Since this affects all codepaths, I'd like to do a full perf run before we land anything. Also, this is not the "final point" for canonicalization etc. I think canonicalization can be made substantially faster, for one thing. But it seems like a reasonable starting point for a branch that's gotten a bit larger than I would have liked. **Commit convention:** First of all, this entire branch ought to be a "pure refactoring", I believe, not changing anything about external behavior. Second, I've tagged the most important commits with `[VIC]` (very important commit), so you can scan for those. =) r? @eddyb
2 parents 27a046e + 6d787d4 commit fc2b29d

File tree

104 files changed

+3422
-1646
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+3422
-1646
lines changed
 

‎src/Cargo.lock

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/librustc/dep_graph/dep_node.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,18 +60,17 @@
6060
//! user of the `DepNode` API of having to know how to compute the expected
6161
//! fingerprint for a given set of node parameters.
6262
63+
use ich::{Fingerprint, StableHashingContext};
64+
use infer::canonical::Canonical;
6365
use hir::def_id::{CrateNum, DefId, DefIndex, CRATE_DEF_INDEX};
6466
use hir::map::DefPathHash;
6567
use hir::{HirId, ItemLocalId};
66-
67-
use ich::Fingerprint;
68-
use ty::{TyCtxt, Instance, InstanceDef, ParamEnv, ParamEnvAnd, PolyTraitRef, Ty};
69-
use ty::subst::Substs;
7068
use rustc_data_structures::stable_hasher::{StableHasher, HashStable};
71-
use ich::StableHashingContext;
7269
use std::fmt;
7370
use std::hash::Hash;
7471
use syntax_pos::symbol::InternedString;
72+
use ty::{self, TyCtxt, Instance, InstanceDef, ParamEnv, ParamEnvAnd, PolyTraitRef, Ty};
73+
use ty::subst::Substs;
7574

7675
// erase!() just makes tokens go away. It's used to specify which macro argument
7776
// is repeated (i.e. which sub-expression of the macro we are in) but don't need
@@ -630,6 +629,8 @@ define_dep_nodes!( <'tcx>
630629
[] CompileCodegenUnit(InternedString),
631630
[input] OutputFilenames,
632631
[anon] NormalizeTy,
632+
[] NormalizeProjectionTy { ty: &'tcx Canonical<ParamEnvAnd<'tcx, ty::ProjectionTy<'tcx>>> },
633+
633634
// We use this for most things when incr. comp. is turned off.
634635
[] Null,
635636

0 commit comments

Comments
 (0)
Please sign in to comment.