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

Extract rustc_hir out of rustc #67803

Merged
merged 20 commits into from
Jan 5, 2020
Merged

Extract rustc_hir out of rustc #67803

merged 20 commits into from
Jan 5, 2020

Conversation

Centril
Copy link
Contributor

@Centril Centril commented Jan 2, 2020

The new crate contains:

pub mod def;
pub mod def_id;
mod hir;
pub mod hir_id;
pub mod itemlikevisit;
pub mod pat_util;
pub mod print;
mod stable_hash_impls;

pub use hir::*;
pub use hir_id::*;
pub use stable_hash_impls::HashStableContext;

Remains to be done in follow-up PRs:

cc #65031

r? @Zoxc

@rust-highfive

This comment has been minimized.

@rust-highfive

This comment has been minimized.

@Centril Centril added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 2, 2020
@bors

This comment has been minimized.

impl<'a> HashStable<StableHashingContext<'a>> for ast::Attribute {
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
impl<'ctx> syntax::HashStableContext for StableHashingContext<'ctx> {
fn hash_attr(&mut self, attr: &ast::Attribute, hasher: &mut StableHasher) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be better to have a is_ignored_attr method on syntax::HashStableContext and move the impl to syntax.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This doesn't work out well unfortunately. I'm only able to move one of the impls, but not the impl<AstCtx: crate::HashStableContext> HashStable<AstCtx> for [ast::Attribute] { one because it becomes orphaned (including with specialization). So I would prefer to have those impls in one place and this file is the only way to do that I think.

sugar.hash_stable(hcx, hasher);
}
hir::VisibilityKind::Restricted { ref path, hir_id } => {
hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| {
Copy link
Contributor

Choose a reason for hiding this comment

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

You could add with_node_id_hashing_mode and while_hashing_hir_bodies to rustc_hir::HashStableContext then you wouldn't need to keep all the impls here.

@Zoxc
Copy link
Contributor

Zoxc commented Jan 4, 2020

@bors r+ p=5 rollup=never

@bors
Copy link
Contributor

bors commented Jan 4, 2020

📌 Commit cdf32e1 has been approved by Zoxc

@bors bors 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 4, 2020
@bors
Copy link
Contributor

bors commented Jan 4, 2020

⌛ Testing commit cdf32e1 with merge 7494250...

bors added a commit that referenced this pull request Jan 4, 2020
Extract `rustc_hir` out of `rustc`

The new crate contains:
```rust
pub mod def;
pub mod def_id;
mod hir;
pub mod hir_id;
pub mod itemlikevisit;
pub mod pat_util;
pub mod print;
mod stable_hash_impls;

pub use hir::*;
pub use hir_id::*;
pub use stable_hash_impls::HashStableContext;
```

Remains to be done in follow-up PRs:

- Move `rustc::hir::map` into `rustc_hir_map` -- this has to be a separate crate due to the `dep_graph` (blocked on #67761).

- Move references to `rustc::hir` to `rustc_hir` where possible.

cc #65031

r? @Zoxc
@bors
Copy link
Contributor

bors commented Jan 5, 2020

☀️ Test successful - checks-azure
Approved by: Zoxc
Pushing 7494250 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jan 5, 2020
@bors bors merged commit cdf32e1 into rust-lang:master Jan 5, 2020
@Centril Centril deleted the librustc_hir branch January 5, 2020 01:19
JohnTitor added a commit to JohnTitor/rust-clippy that referenced this pull request Jan 5, 2020
matthiaskrgr added a commit to matthiaskrgr/rust-clippy that referenced this pull request Jan 5, 2020
JohnTitor added a commit to JohnTitor/rust-clippy that referenced this pull request Jan 5, 2020
bors added a commit to rust-lang/rust-clippy that referenced this pull request Jan 5, 2020
bors added a commit to rust-lang/rust-clippy that referenced this pull request Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. 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.

4 participants