-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Conversation
r? @arielb1 (rust_highfive has picked a reviewer for you, use r? to override) |
assert_eq!(cnum, LOCAL_CRATE); | ||
Rc::new(tcx.cstore.crates_untracked()) | ||
}; | ||
providers.postorder_cnums = |tcx, cnum| { |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
My only concern here is that the |
There was a problem hiding this 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.
src/librustc/ty/context.rs
Outdated
self.cstore.metadata_encoding_version().to_vec() | ||
} | ||
|
||
pub fn crate_data_as_rc_any(self, cnum: CrateNum) -> Rc<Any> { |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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.
At least for some of the cases, yes. |
77b51c5
to
8b9f84c
Compare
@bors: r=michaelwoerister |
📌 Commit 8b9f84c has been approved by |
☔ The latest upstream changes (presumably #44418) made this pull request unmergeable. Please resolve the merge conflicts. |
8b9f84c
to
224d47d
Compare
@bors: r=michaelwoerister |
📌 Commit 224d47d has been approved by |
@bors rollup |
…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)
…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)
224d47d
to
6e834ac
Compare
6e834ac
to
e283efa
Compare
@bors: r=michaelwoerister |
📌 Commit e283efa has been approved by |
@bors: rollup- |
☔ The latest upstream changes (presumably #44275) made this pull request unmergeable. Please resolve the merge conflicts. |
…ulating CrateStore access in tcx.
e283efa
to
a4b6a97
Compare
@bors: r=michaelwoerister |
📌 Commit a4b6a97 has been approved by |
💔 Test failed - status-appveyor |
This commit removes the `cstore_untracked` method, making the `CrateStore` trait object entirely private to the `ty/context.rs` module.
a4b6a97
to
921750b
Compare
@bors: r=michaelwoerister |
📌 Commit 921750b has been approved by |
☀️ Test successful - status-appveyor, status-travis |
🎉 |
This commit makes the
CrateStore
object private to thety/context.rs
module and also absent on theSession
itself.cc #44390
cc #44341 (initial commit pulled and rebased from here)