Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upintroduce canonical queries, use for normalization and dropck-outlives #48411
Conversation
rust-highfive
assigned
eddyb
Feb 21, 2018
rust-highfive
added
the
S-waiting-on-review
label
Feb 21, 2018
eddyb
reviewed
Feb 21, 2018
| let cause = ObligationCause::dummy(); | ||
| match infcx.at(&cause, param_env).normalize(&value) { | ||
| Ok(Normalized { value: normalized_value, obligations: _ }) => { | ||
| // ^^^^^^^^^^^ |
This comment has been minimized.
This comment has been minimized.
eddyb
Feb 21, 2018
Member
How certain is this? Can you assert that this holds, or would that be too expensive?
This comment has been minimized.
This comment has been minimized.
nikomatsakis
Feb 21, 2018
Author
Contributor
Hmm. It's probably worth asserting, or maybe refactoring the types to prove it.
eddyb
reviewed
Feb 21, 2018
| @@ -104,7 +103,7 @@ pub struct FunctionCx<'a, 'tcx:'a> { | |||
|
|
|||
| impl<'a, 'tcx> FunctionCx<'a, 'tcx> { | |||
| pub fn monomorphize<T>(&self, value: &T) -> T | |||
| where T: TransNormalize<'tcx> | |||
| where T: TypeFoldable<'tcx> | |||
| { | |||
| self.cx.tcx.trans_apply_param_substs(self.param_substs, value) | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
r=me with nits and build failure addressed |
nikomatsakis
referenced this pull request
Feb 22, 2018
Open
🛠 improve canonicalization by using a hashing scheme #48417
This comment has been minimized.
This comment has been minimized.
|
@bors try I'd like to do a perf run. |
This comment has been minimized.
This comment has been minimized.
bors
added a commit
that referenced
this pull request
Feb 22, 2018
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
cc @rust-lang/release -- I'd like to request a perf run. try build completed, not sure what other steps I need to do. |
pietroalbini
added
S-waiting-on-author
and removed
S-waiting-on-review
labels
Feb 22, 2018
This comment has been minimized.
This comment has been minimized.
|
I'll run it soon, for now just always ping me |
This comment has been minimized.
This comment has been minimized.
|
Perf started |
This comment has been minimized.
This comment has been minimized.
|
Here are the results: Also archived here, since I've noticed that perf links tend to go stale: http://smallcultfollowing.com/pr-48411/rustc%20performance%20data.htm (instructions) |
This comment has been minimized.
This comment has been minimized.
Major changes (>10%)Got worse:
Got better
Medium changes (3-10%)
Got better:
Small changes (<3%)
|
This comment has been minimized.
This comment has been minimized.
|
I'll try to take a look at |
This comment has been minimized.
This comment has been minimized.
|
@bors try |
This comment has been minimized.
This comment has been minimized.
|
|
nikomatsakis
force-pushed the
nikomatsakis:chalkify-canonical-query-mir
branch
2 times, most recently
from
0e84c2d
to
41d762f
Feb 23, 2018
This comment has been minimized.
This comment has been minimized.
|
@bors try |
bors
added a commit
that referenced
this pull request
Feb 24, 2018
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
Perf started for 251f865. |
This comment has been minimized.
This comment has been minimized.
|
@Mark-Simulacrum when I try to compare,I get errors about not having results for 063deba ... am I doing something wrong ? =) |
nikomatsakis
added some commits
Mar 9, 2018
nikomatsakis
force-pushed the
nikomatsakis:chalkify-canonical-query-mir
branch
from
fbaf9cb
to
17c4103
Mar 13, 2018
This comment has been minimized.
This comment has been minimized.
|
@bors r=eddyb |
This comment has been minimized.
This comment has been minimized.
|
|
bors
added
S-waiting-on-bors
and removed
S-waiting-on-author
labels
Mar 13, 2018
alexcrichton
referenced this pull request
Mar 13, 2018
Merged
Update sccache to its master branch #48647
This comment has been minimized.
This comment has been minimized.
bors
added a commit
that referenced
this pull request
Mar 13, 2018
nikomatsakis
referenced this pull request
Mar 13, 2018
Merged
NLL should identify and respect the lifetime annotations that the user wrote #48482
This comment has been minimized.
This comment has been minimized.
|
|
bors
merged commit 17c4103
into
rust-lang:master
Mar 13, 2018
This was referenced Mar 13, 2018
aravind-pg
referenced this pull request
Mar 13, 2018
Merged
Create a canonical trait query for `evaluate_obligation` #48995
nikomatsakis
referenced this pull request
Mar 13, 2018
Closed
NLL should identify and respect the lifetime annotations that the user wrote #47184
bors
added a commit
that referenced
this pull request
Mar 20, 2018
bors
added a commit
that referenced
this pull request
Mar 20, 2018
davidtwco
referenced this pull request
Apr 3, 2018
Closed
NLL breaks functions with intermingled lifetimes in return type when returned value is a (non-borrowed) associated type #49354
pietroalbini
referenced this pull request
Apr 17, 2018
Closed
[ICE] librustc_traits/normalize_erasing_regions.rs:46: could not fully normalize `...` #49685
bors
added a commit
that referenced
this pull request
Apr 27, 2018
This comment has been minimized.
This comment has been minimized.
|
FWIW, this (specifically, short-circuit |
nikomatsakis commentedFeb 21, 2018
•
edited
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)type_foldabletcx.normalize_erasing_regions(param_env, type_foldable)infcx.at(cause, param_env).dropck_outlives(ty)tyis droppedThis 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
syncrate (pre-branch measurements coming soon):(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