-
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
Extract rustc_hir
out of rustc
#67803
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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) { |
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 think it would be better to have a is_ignored_attr
method on syntax::HashStableContext
and move the impl to syntax
.
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.
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| { |
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.
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.
Also fix fallout wrt. HashStable.
@bors r+ p=5 rollup=never |
📌 Commit cdf32e1 has been approved by |
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
☀️ Test successful - checks-azure |
Rustup to rust-lang/rust#67803 and rust-lang/rust#67137 changelog: none
Rustup to rust-lang/rust#67803 and rust-lang/rust#67137 changelog: none
The new crate contains:
Remains to be done in follow-up PRs:
Move
rustc::hir::map
intorustc_hir_map
-- this has to be a separate crate due to thedep_graph
(blocked on Move the dep_graph construction to a dedicated crate. #67761).Move references to
rustc::hir
torustc_hir
where possible.cc #65031
r? @Zoxc