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

rustc: Make CrateStore private to TyCtxt #44420

Merged
merged 2 commits into from
Sep 13, 2017

Conversation

alexcrichton
Copy link
Member

This commit makes the CrateStore object private to the ty/context.rs module and also absent on the Session itself.

cc #44390
cc #44341 (initial commit pulled and rebased from here)

@rust-highfive
Copy link
Collaborator

r? @arielb1

(rust_highfive has picked a reviewer for you, use r? to override)

@alexcrichton
Copy link
Member Author

r? @michaelwoerister

assert_eq!(cnum, LOCAL_CRATE);
Rc::new(tcx.cstore.crates_untracked())
};
providers.postorder_cnums = |tcx, cnum| {
Copy link
Member

@eddyb eddyb Sep 9, 2017

Choose a reason for hiding this comment

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

Oh, right, we can do this now! @nikomatsakis do you think we should move to this style more uniformly?

@@ -60,7 +60,7 @@ macro_rules! provide {

$tcx.dep_graph.read(dep_node);

let $cdata = $tcx.sess.cstore.crate_data_as_rc_any($def_id.krate);
let $cdata = $tcx.crate_data_as_rc_any($def_id.krate);
Copy link
Member

Choose a reason for hiding this comment

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

I was worried about this but I think it's fine - this will eventually be just a byte buffer that the query system interprets.

@eddyb
Copy link
Member

eddyb commented Sep 9, 2017

My only concern here is that the CrateStore is threaded through more places - that's related to the TyCtxt not existing yet, isn't it?

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, @alexcrichton!

r=me with that comment added and the remaining RustDoc build errors fixed.

self.cstore.metadata_encoding_version().to_vec()
}

pub fn crate_data_as_rc_any(self, cnum: CrateNum) -> Rc<Any> {
Copy link
Member

Choose a reason for hiding this comment

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

Ideally this would only be visible to the query system since it allows untracked access to crate store contents. Maybe you could add a comment "Do not use this unless you also provide proper dependency tracking" or something.

pub fn encode_metadata(self, link_meta: &LinkMeta, reachable: &NodeSet)
-> (EncodedMetadata, EncodedMetadataHashes)
{
self.cstore.encode_metadata(self, link_meta, reachable)
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure that metadata encoding even needs to be a method of CrateStore. It seems rather independent. But that's for another PR, I'd say.

@michaelwoerister
Copy link
Member

My only concern here is that the CrateStore is threaded through more places - that's related to the TyCtxt not existing yet, isn't it?

At least for some of the cases, yes.

@alexcrichton alexcrichton force-pushed the private-cstore branch 2 times, most recently from 77b51c5 to 8b9f84c Compare September 9, 2017 18:06
@alexcrichton
Copy link
Member Author

@bors: r=michaelwoerister

@bors
Copy link
Contributor

bors commented Sep 9, 2017

📌 Commit 8b9f84c has been approved by michaelwoerister

@bors
Copy link
Contributor

bors commented Sep 10, 2017

☔ The latest upstream changes (presumably #44418) made this pull request unmergeable. Please resolve the merge conflicts.

@alexcrichton
Copy link
Member Author

@bors: r=michaelwoerister

@bors
Copy link
Contributor

bors commented Sep 10, 2017

📌 Commit 224d47d has been approved by michaelwoerister

@frewsxcv
Copy link
Member

@bors rollup

frewsxcv added a commit to frewsxcv/rust that referenced this pull request Sep 11, 2017
…aelwoerister

rustc: Make `CrateStore` private to `TyCtxt`

This commit makes the `CrateStore` object private to the `ty/context.rs` module and also absent on the `Session` itself.

cc rust-lang#44390
cc rust-lang#44341 (initial commit pulled and rebased from here)
frewsxcv added a commit to frewsxcv/rust that referenced this pull request Sep 11, 2017
…aelwoerister

rustc: Make `CrateStore` private to `TyCtxt`

This commit makes the `CrateStore` object private to the `ty/context.rs` module and also absent on the `Session` itself.

cc rust-lang#44390
cc rust-lang#44341 (initial commit pulled and rebased from here)
@frewsxcv
Copy link
Member

nrc added a commit to rust-dev-tools/rls-rustc that referenced this pull request Sep 11, 2017
@alexcrichton
Copy link
Member Author

@bors: r=michaelwoerister

@bors
Copy link
Contributor

bors commented Sep 11, 2017

📌 Commit e283efa has been approved by michaelwoerister

@alexcrichton
Copy link
Member Author

@bors: rollup-

@bors
Copy link
Contributor

bors commented Sep 12, 2017

☔ The latest upstream changes (presumably #44275) made this pull request unmergeable. Please resolve the merge conflicts.

@alexcrichton
Copy link
Member Author

@bors: r=michaelwoerister

@bors
Copy link
Contributor

bors commented Sep 12, 2017

📌 Commit a4b6a97 has been approved by michaelwoerister

@bors
Copy link
Contributor

bors commented Sep 13, 2017

⌛ Testing commit a4b6a97 with merge dc93eb4...

bors added a commit that referenced this pull request Sep 13, 2017
rustc: Make `CrateStore` private to `TyCtxt`

This commit makes the `CrateStore` object private to the `ty/context.rs` module and also absent on the `Session` itself.

cc #44390
cc #44341 (initial commit pulled and rebased from here)
@bors
Copy link
Contributor

bors commented Sep 13, 2017

💔 Test failed - status-appveyor

This commit removes the `cstore_untracked` method, making the `CrateStore` trait
object entirely private to the `ty/context.rs` module.
@alexcrichton
Copy link
Member Author

@bors: r=michaelwoerister

@bors
Copy link
Contributor

bors commented Sep 13, 2017

📌 Commit 921750b has been approved by michaelwoerister

@bors
Copy link
Contributor

bors commented Sep 13, 2017

⌛ Testing commit 921750b with merge c3eccc6...

bors added a commit that referenced this pull request Sep 13, 2017
rustc: Make `CrateStore` private to `TyCtxt`

This commit makes the `CrateStore` object private to the `ty/context.rs` module and also absent on the `Session` itself.

cc #44390
cc #44341 (initial commit pulled and rebased from here)
@bors
Copy link
Contributor

bors commented Sep 13, 2017

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

@michaelwoerister
Copy link
Member

🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants