-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #67803 - Centril:librustc_hir, r=Zoxc
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
- Loading branch information
Showing
139 changed files
with
1,104 additions
and
950 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
//! HIR datatypes. See the [rustc guide] for more info. | ||
//! | ||
//! [rustc guide]: https://rust-lang.github.io/rustc-guide/hir.html | ||
|
||
pub mod check_attr; | ||
pub use rustc_hir::def; | ||
pub mod exports; | ||
pub use rustc_hir::def_id; | ||
pub use rustc_hir::hir_id::*; | ||
pub mod intravisit; | ||
pub use rustc_hir::itemlikevisit; | ||
pub mod map; | ||
pub use rustc_hir::pat_util; | ||
pub use rustc_hir::print; | ||
pub mod upvars; | ||
|
||
pub use rustc_hir::BlockCheckMode::*; | ||
pub use rustc_hir::FunctionRetTy::*; | ||
pub use rustc_hir::PrimTy::*; | ||
pub use rustc_hir::UnOp::*; | ||
pub use rustc_hir::UnsafeSource::*; | ||
pub use rustc_hir::*; | ||
|
||
use crate::ty::query::Providers; | ||
|
||
pub fn provide(providers: &mut Providers<'_>) { | ||
check_attr::provide(providers); | ||
map::provide(providers); | ||
upvars::provide(providers); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
use crate::hir::def::Res; | ||
use crate::hir::def_id::DefIdMap; | ||
use crate::ty; | ||
|
||
use rustc_macros::HashStable; | ||
use rustc_span::Span; | ||
use syntax::ast; | ||
|
||
use std::fmt::Debug; | ||
|
||
/// This is the replacement export map. It maps a module to all of the exports | ||
/// within. | ||
pub type ExportMap<Id> = DefIdMap<Vec<Export<Id>>>; | ||
|
||
#[derive(Copy, Clone, Debug, RustcEncodable, RustcDecodable, HashStable)] | ||
pub struct Export<Id> { | ||
/// The name of the target. | ||
pub ident: ast::Ident, | ||
/// The resolution of the target. | ||
pub res: Res<Id>, | ||
/// The span of the target. | ||
pub span: Span, | ||
/// The visibility of the export. | ||
/// We include non-`pub` exports for hygienic macros that get used from extern crates. | ||
pub vis: ty::Visibility, | ||
} | ||
|
||
impl<Id> Export<Id> { | ||
pub fn map_id<R>(self, map: impl FnMut(Id) -> R) -> Export<R> { | ||
Export { ident: self.ident, res: self.res.map_id(map), span: self.span, vis: self.vis } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.