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

Replace uses of DepGraph.in_ignore with DepGraph.with_ignore #47087

Merged
merged 1 commit into from
Jan 11, 2018

Conversation

Zoxc
Copy link
Contributor

@Zoxc Zoxc commented Dec 31, 2017

I currently plan to track tasks in thread local storage. Ignoring things in a closure ensures that the ignore tasks do not overlap the beginning or end of any other task. The TLS API will also use a closure to change a TLS value, so having the ignore task be a closure also helps there.

It also adds assert_ignored which is used before a TyCtxt is created. Instead of adding a new ignore task this simply ensures that we are in a context where reads are ignored.

r? @michaelwoerister

tcx.dep_graph.with_ignore(|| {
let mut visitor = SymbolNamesTest { tcx: tcx };
// FIXME(#37712) could use ItemLikeVisitor if trait items were item-like
tcx.hir.krate().visit_all_item_likes(&mut visitor.as_deep_visitor());
Copy link
Member

Choose a reason for hiding this comment

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

[00:04:05] tidy error: /checkout/src/librustc_trans/symbol_names_test.rs:36: tab character
[00:04:05] tidy error: /checkout/src/librustc_trans/symbol_names_test.rs:37: tab character
[00:04:05] tidy error: /checkout/src/librustc_trans/symbol_names_test.rs:38: tab character

@kennytm kennytm added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 31, 2017
Copy link
Member

@michaelwoerister michaelwoerister left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, @Zoxc! We wanted to get rid of in_ignore() for a while.

I would prefer it though to just use with_ignore() instead of assert_ignored(). Less opportunity to get something wrong. And remove in_ignore() completely if possible.

@Zoxc
Copy link
Contributor Author

Zoxc commented Jan 3, 2018

I do not want to create any DepGraph tasks before a TyCtxt is created, hence the use of assert_ignored.

@michaelwoerister
Copy link
Member

I'm wondering if we can instead move DepGraph and HIR map creation into TyCtxt::create_and_enter(). That would also solve the empty_task() case from the other PR.

cc @eddyb

@eddyb
Copy link
Member

eddyb commented Jan 3, 2018

Maybe, yeah.

Copy link
Member

@michaelwoerister michaelwoerister left a comment

Choose a reason for hiding this comment

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

I'm OK with going with the assert_ignored() approach. r=me with the EvalAlways nit addressed.

if let Some(ref data) = self.data {
match data.current.borrow_mut().task_stack.last_mut() {
Some(&mut OpenTask::Ignore) |
Some(&mut OpenTask::EvalAlways { .. }) | None => {
Copy link
Member

Choose a reason for hiding this comment

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

EvalAlways is conceptually not ignored. I'd remove this case.

Copy link
Member

Choose a reason for hiding this comment

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

Also, you should be able to do non-mutable access here, right?

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 copied the ignored cases from read_index. Why is EvalAlways ignored there then?

Copy link
Member

Choose a reason for hiding this comment

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

Because we artificial add a single edge to DepNode::Krate when the task finishes. This single edge will detect any change made to the crate or any upstream crates.

@kennytm kennytm added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 9, 2018
@Zoxc
Copy link
Contributor Author

Zoxc commented Jan 9, 2018

@michaelwoerister I addressed your comments

@kennytm kennytm added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 9, 2018
@michaelwoerister
Copy link
Member

Thanks, @Zoxc!

@bors r+

@bors
Copy link
Contributor

bors commented Jan 10, 2018

📌 Commit 9508922 has been approved by michaelwoerister

@kennytm kennytm added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 10, 2018
@bors
Copy link
Contributor

bors commented Jan 10, 2018

⌛ Testing commit 9508922 with merge 3686fc73958238f97ba6d75735017e14a7c6cbc8...

@bors
Copy link
Contributor

bors commented Jan 10, 2018

💔 Test failed - status-appveyor

@michaelwoerister
Copy link
Member

@rust-lang/infra, is this AppVeyor being slow at the moment?

@kennytm
Copy link
Member

kennytm commented Jan 10, 2018

@bors retry #46903

AppVeyor has been slow for the whole 2018 so far unfortunately.

@bors
Copy link
Contributor

bors commented Jan 11, 2018

⌛ Testing commit 9508922 with merge 619ced0...

bors added a commit that referenced this pull request Jan 11, 2018
Replace uses of DepGraph.in_ignore with DepGraph.with_ignore

I currently plan to track tasks in thread local storage. Ignoring things in a closure ensures that the ignore tasks do not overlap the beginning or end of any other task. The TLS API will also use a closure to change a TLS value, so having the ignore task be a closure also helps there.

It also adds `assert_ignored` which is used before a `TyCtxt` is created. Instead of adding a new ignore task this simply ensures that we are in a context where reads are ignored.

r? @michaelwoerister
@bors
Copy link
Contributor

bors commented Jan 11, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: michaelwoerister
Pushing 619ced0 to master...

@bors bors merged commit 9508922 into rust-lang:master Jan 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants