Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

transition borrowck to visit all **bodies** and not item-likes #39927

Merged
merged 16 commits into from
Mar 3, 2017

Conversation

nikomatsakis
Copy link
Contributor

This is a better structure for incremental compilation and also more compatible with the eventual borrowck mir. It also fixes #38520 as a drive-by fix.

r? @eddyb

@eddyb
Copy link
Member

eddyb commented Feb 18, 2017

@bors r+

@bors
Copy link
Contributor

bors commented Feb 18, 2017

📌 Commit 4ca1f02 has been approved by eddyb

@nikomatsakis nikomatsakis force-pushed the incr-comp-skip-borrowck-2 branch 2 times, most recently from d38b5f7 to d83d83e Compare February 18, 2017 12:34
@nikomatsakis
Copy link
Contributor Author

@bors r=eddyb

@bors
Copy link
Contributor

bors commented Feb 18, 2017

📌 Commit d83d83e has been approved by eddyb

@nikomatsakis
Copy link
Contributor Author

@bors r-

@nikomatsakis nikomatsakis force-pushed the incr-comp-skip-borrowck-2 branch 2 times, most recently from aabf3df to 7770e9a Compare February 20, 2017 02:58
@@ -168,43 +168,48 @@ impl<'hir> MapEntry<'hir> {
})
}

fn is_body_owner(self, node_id: NodeId) -> bool {
fn associated_body(self) -> Option<BodyId> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have at least two, if not three, reimplementations of this, seems so obvious in retrospect!

@@ -78,9 +79,30 @@ pub fn visit_all_item_likes_in_krate<'a, 'tcx, V, F>(tcx: TyCtxt<'a, 'tcx, 'tcx>
pub fn visit_all_bodies_in_krate<'a, 'tcx, C>(tcx: TyCtxt<'a, 'tcx, 'tcx>, callback: C)
where C: Fn(/* body_owner */ DefId, /* body id */ hir::BodyId),
{
// NB: we use a visitor here rather than walking the keys of the
// hashmap so as to ensure we visit the bodies "in order".
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, first off, the hashmap should maybe be replaced with a BTreeMap.
But also, you don't want HIR lowering node IDs to matter... what if it was keyed by the owner's DefIndex?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either way, BTreeMap might be enough to fix your problem here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried that first, but it still came in what seemed to me to be a surprising order in some cases. But maybe I'll switch it back to a btree-map and just adjust the reference files.

Still, I was thinking that longer term it might be a better idea to have some vector stored in the crate of the preferred "visit order".

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, and I'd be fine sorting by Span or something (so the HIR visit order doesn't matter).

@nikomatsakis
Copy link
Contributor Author

I did a crater run of an earlier draft of this branch. Result: 4 false positives, but no regressions found.

@nikomatsakis
Copy link
Contributor Author

@bors r=eddyb

@bors
Copy link
Contributor

bors commented Feb 21, 2017

📌 Commit fed58f3 has been approved by eddyb

@nikomatsakis
Copy link
Contributor Author

@bors r-

I want to wait for my new crater run to complete, actually. And maybe @eddyb wants to take a peek anyhow.

Copy link
Member

@eddyb eddyb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me

@nikomatsakis
Copy link
Contributor Author

A revised crater run revealed only timeouts (7 of them).

@nikomatsakis
Copy link
Contributor Author

@bors r=eddyb

@bors
Copy link
Contributor

bors commented Feb 22, 2017

📌 Commit fed58f3 has been approved by eddyb

frewsxcv added a commit to frewsxcv/rust that referenced this pull request Feb 24, 2017
…k-2, r=eddyb

transition borrowck to visit all **bodies** and not item-likes

This is a better structure for incremental compilation and also more compatible with the eventual borrowck mir. It also fixes rust-lang#38520 as a drive-by fix.

r? @eddyb
bors added a commit that referenced this pull request Feb 24, 2017
Rollup of 17 pull requests

- Successful merges: #39777, #39815, #39845, #39886, #39892, #39903, #39905, #39914, #39927, #39940, #40010, #40030, #40048, #40050, #40052, #40060, #40071
- Failed merges:
bors added a commit that referenced this pull request Feb 25, 2017
@@ -550,43 +548,6 @@ impl<'a, 'tcx> Visitor<'tcx> for CheckItemTypesVisitor<'a, 'tcx> {
}
}

impl<'a, 'tcx> ItemLikeVisitor<'tcx> for CheckItemBodiesVisitor<'a, 'tcx> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should also remove the item_tables queries from CheckItemTypesVisitor (the rest of which belongs in collect IMO).

@nikomatsakis
Copy link
Contributor Author

@eddyb see latest commit, which I think is what you meant

@nikomatsakis
Copy link
Contributor Author

@bors r=eddyb

@bors
Copy link
Contributor

bors commented Feb 28, 2017

📌 Commit f704ef5 has been approved by eddyb

@bors
Copy link
Contributor

bors commented Feb 28, 2017

⌛ Testing commit f704ef5 with merge a1f6823...

@bors
Copy link
Contributor

bors commented Feb 28, 2017

💔 Test failed - status-appveyor

@alexcrichton
Copy link
Member

alexcrichton commented Feb 28, 2017 via email

@nikomatsakis
Copy link
Contributor Author

@alexcrichton thanks for staying on top of these ... almost every time I find one, you've already tagged it...

@bors
Copy link
Contributor

bors commented Mar 1, 2017

⌛ Testing commit f704ef5 with merge 53f60d5...

@bors
Copy link
Contributor

bors commented Mar 1, 2017

💔 Test failed - status-appveyor

@arielb1
Copy link
Contributor

arielb1 commented Mar 1, 2017

actual failure:

compile-fail\issue-29184.rs
{"message":"src\\librustc\\hir\\map/mod.rs:379: local_def_id: no entry for `10`, which has a map of `Some(EntryExpr(NodeId(9), expr(10: 92)))`","code":null,"level":"error: internal compiler error","spans":[],"children":[],"rendered":null}

@nikomatsakis
Copy link
Contributor Author

@eddyb r? the last commit

@eddyb
Copy link
Member

eddyb commented Mar 1, 2017

@bors r+

@bors
Copy link
Contributor

bors commented Mar 1, 2017

📌 Commit d572aa2 has been approved by eddyb

@bors
Copy link
Contributor

bors commented Mar 3, 2017

⌛ Testing commit d572aa2 with merge 06c63f6...

bors added a commit that referenced this pull request Mar 3, 2017
transition borrowck to visit all **bodies** and not item-likes

This is a better structure for incremental compilation and also more compatible with the eventual borrowck mir. It also fixes #38520 as a drive-by fix.

r? @eddyb
@bors
Copy link
Contributor

bors commented Mar 3, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: eddyb
Pushing 06c63f6 to master...

@bors bors merged commit d572aa2 into rust-lang:master Mar 3, 2017
@@ -180,23 +181,6 @@ impl<'a, 'gcx: 'tcx, 'tcx> MutVisitor<'tcx> for GlobalizeMir<'a, 'gcx> {
///////////////////////////////////////////////////////////////////////////
// BuildMir -- walks a crate, looking for fn items and methods to build MIR from
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems this comment refers to the removed BuildMir struct.
Should it also be removed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

illegal moves permitted in statics and constants
6 participants