Move it all into rustc_hir.
This commit is contained in:
parent
443a42a8d3
commit
d3b2385d40
16 changed files with 20 additions and 94 deletions
16
Cargo.lock
16
Cargo.lock
|
@ -3100,7 +3100,6 @@ dependencies = [
|
|||
"rustc_feature",
|
||||
"rustc_hir",
|
||||
"rustc_index",
|
||||
"rustc_lang_items",
|
||||
"rustc_macros",
|
||||
"rustc_session",
|
||||
"rustc_span",
|
||||
|
@ -3620,6 +3619,7 @@ version = "0.0.0"
|
|||
name = "rustc_hir"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"lazy_static 1.4.0",
|
||||
"rustc_ast_pretty",
|
||||
"rustc_data_structures",
|
||||
"rustc_errors",
|
||||
|
@ -3699,19 +3699,6 @@ dependencies = [
|
|||
"winapi 0.3.8",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc_lang_items"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"lazy_static 1.4.0",
|
||||
"rustc_data_structures",
|
||||
"rustc_hir",
|
||||
"rustc_macros",
|
||||
"rustc_span",
|
||||
"serialize",
|
||||
"syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc_lexer"
|
||||
version = "0.1.0"
|
||||
|
@ -3865,7 +3852,6 @@ dependencies = [
|
|||
"rustc_feature",
|
||||
"rustc_hir",
|
||||
"rustc_index",
|
||||
"rustc_lang_items",
|
||||
"rustc_session",
|
||||
"rustc_span",
|
||||
"rustc_target",
|
||||
|
|
|
@ -24,7 +24,6 @@ rustc_apfloat = { path = "../librustc_apfloat" }
|
|||
rustc_attr = { path = "../librustc_attr" }
|
||||
rustc_feature = { path = "../librustc_feature" }
|
||||
rustc_hir = { path = "../librustc_hir" }
|
||||
rustc_lang_items = { path = "../librustc_lang_items" }
|
||||
rustc_target = { path = "../librustc_target" }
|
||||
rustc_macros = { path = "../librustc_macros" }
|
||||
rustc_data_structures = { path = "../librustc_data_structures" }
|
||||
|
|
|
@ -107,8 +107,6 @@ impl<'ctx> rustc_hir::HashStableContext for StableHashingContext<'ctx> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'ctx> rustc_lang_items::HashStableContext for StableHashingContext<'ctx> {}
|
||||
|
||||
impl<'a> ToStableHashKey<StableHashingContext<'a>> for DefId {
|
||||
type KeyType = DefPathHash;
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ use crate::ty::{self, TyCtxt};
|
|||
use rustc_hir::def_id::DefId;
|
||||
use rustc_span::Span;
|
||||
|
||||
pub use rustc_lang_items::{LangItem, LanguageItems};
|
||||
pub use rustc_hir::{LangItem, LanguageItems};
|
||||
|
||||
impl<'tcx> TyCtxt<'tcx> {
|
||||
/// Returns the `DefId` for a given `LangItem`.
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
use crate::ty::TyCtxt;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_lang_items::{lang_items, LangItem};
|
||||
use rustc_hir::{lang_items, LangItem};
|
||||
use rustc_target::spec::PanicStrategy;
|
||||
|
||||
pub use rustc_lang_items::weak_lang_items::link_name;
|
||||
pub use rustc_hir::weak_lang_items::link_name;
|
||||
|
||||
impl<'tcx> TyCtxt<'tcx> {
|
||||
pub fn is_weak_lang_item(&self, item_def_id: DefId) -> bool {
|
||||
|
|
|
@ -19,4 +19,5 @@ rustc_span = { path = "../librustc_span" }
|
|||
rustc_errors = { path = "../librustc_errors" }
|
||||
rustc_serialize = { path = "../libserialize", package = "serialize" }
|
||||
syntax = { path = "../libsyntax" }
|
||||
lazy_static = "1"
|
||||
smallvec = { version = "1.0", features = ["union", "may_dangle"] }
|
||||
|
|
|
@ -9,11 +9,11 @@
|
|||
|
||||
pub use self::LangItem::*;
|
||||
|
||||
use crate::def_id::DefId;
|
||||
use crate::Target;
|
||||
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_macros::HashStable_Generic;
|
||||
use rustc_span::symbol::{sym, Symbol};
|
||||
use rustc_span::Span;
|
|
@ -17,9 +17,15 @@ mod hir;
|
|||
pub mod hir_id;
|
||||
pub mod intravisit;
|
||||
pub mod itemlikevisit;
|
||||
pub mod lang_items;
|
||||
pub mod pat_util;
|
||||
pub mod print;
|
||||
mod stable_hash_impls;
|
||||
mod target;
|
||||
pub mod weak_lang_items;
|
||||
|
||||
pub use hir::*;
|
||||
pub use hir_id::*;
|
||||
pub use lang_items::{LangItem, LanguageItems};
|
||||
pub use stable_hash_impls::HashStableContext;
|
||||
pub use target::{MethodKind, Target};
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
//! conflicts between multiple such attributes attached to the same
|
||||
//! item.
|
||||
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::{Item, ItemKind, TraitItem, TraitItemKind};
|
||||
use crate::hir;
|
||||
use crate::{Item, ItemKind, TraitItem, TraitItemKind};
|
||||
|
||||
use std::fmt::{self, Display};
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
//! Validity checking for weak lang items
|
||||
|
||||
use crate::def_id::DefId;
|
||||
use crate::{lang_items, LangItem, LanguageItems};
|
||||
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_span::symbol::{sym, Symbol};
|
||||
use syntax::ast;
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
[package]
|
||||
authors = ["The Rust Project Developers"]
|
||||
name = "rustc_lang_items"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
|
||||
[lib]
|
||||
name = "rustc_lang_items"
|
||||
path = "lib.rs"
|
||||
|
||||
[dependencies]
|
||||
lazy_static = "1"
|
||||
rustc_data_structures = { path = "../librustc_data_structures" }
|
||||
rustc_hir = { path = "../librustc_hir" }
|
||||
rustc_macros = { path = "../librustc_macros" }
|
||||
rustc_serialize = { path = "../libserialize", package = "serialize" }
|
||||
rustc_span = { path = "../librustc_span" }
|
||||
syntax = { path = "../libsyntax" }
|
|
@ -1,45 +0,0 @@
|
|||
macro_rules! enum_from_u32 {
|
||||
($(#[$attr:meta])* pub enum $name:ident {
|
||||
$($variant:ident = $e:expr,)*
|
||||
}) => {
|
||||
$(#[$attr])*
|
||||
pub enum $name {
|
||||
$($variant = $e),*
|
||||
}
|
||||
|
||||
impl $name {
|
||||
pub fn from_u32(u: u32) -> Option<$name> {
|
||||
$(if u == $name::$variant as u32 {
|
||||
return Some($name::$variant)
|
||||
})*
|
||||
None
|
||||
}
|
||||
}
|
||||
};
|
||||
($(#[$attr:meta])* pub enum $name:ident {
|
||||
$($variant:ident,)*
|
||||
}) => {
|
||||
$(#[$attr])*
|
||||
pub enum $name {
|
||||
$($variant,)*
|
||||
}
|
||||
|
||||
impl $name {
|
||||
pub fn from_u32(u: u32) -> Option<$name> {
|
||||
$(if u == $name::$variant as u32 {
|
||||
return Some($name::$variant)
|
||||
})*
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub mod lang_items;
|
||||
mod target;
|
||||
pub mod weak_lang_items;
|
||||
|
||||
pub use lang_items::{LangItem, LanguageItems};
|
||||
pub use target::{MethodKind, Target};
|
||||
|
||||
pub trait HashStableContext: rustc_hir::HashStableContext {}
|
|
@ -17,7 +17,6 @@ rustc_errors = { path = "../librustc_errors" }
|
|||
rustc_feature = { path = "../librustc_feature" }
|
||||
rustc_hir = { path = "../librustc_hir" }
|
||||
rustc_index = { path = "../librustc_index" }
|
||||
rustc_lang_items = { path = "../librustc_lang_items" }
|
||||
rustc_session = { path = "../librustc_session" }
|
||||
rustc_target = { path = "../librustc_target" }
|
||||
syntax = { path = "../libsyntax" }
|
||||
|
|
|
@ -14,7 +14,7 @@ use rustc_hir::def_id::DefId;
|
|||
use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor};
|
||||
use rustc_hir::DUMMY_HIR_ID;
|
||||
use rustc_hir::{self, HirId, Item, ItemKind, TraitItem};
|
||||
use rustc_lang_items::{MethodKind, Target};
|
||||
use rustc_hir::{MethodKind, Target};
|
||||
use rustc_session::lint::builtin::{CONFLICTING_REPR_HINTS, UNUSED_ATTRIBUTES};
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_span::Span;
|
||||
|
|
|
@ -16,8 +16,8 @@ use rustc_errors::struct_span_err;
|
|||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::{DefId, LOCAL_CRATE};
|
||||
use rustc_hir::itemlikevisit::ItemLikeVisitor;
|
||||
use rustc_lang_items::lang_items::{extract, ITEM_REFS};
|
||||
use rustc_lang_items::{LangItem, LanguageItems, Target};
|
||||
use rustc_hir::lang_items::{extract, ITEM_REFS};
|
||||
use rustc_hir::{LangItem, LanguageItems, Target};
|
||||
|
||||
use rustc::ty::query::Providers;
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ use rustc_data_structures::fx::FxHashSet;
|
|||
use rustc_errors::struct_span_err;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor};
|
||||
use rustc_lang_items::weak_lang_items::WEAK_ITEMS_REFS;
|
||||
use rustc_hir::weak_lang_items::WEAK_ITEMS_REFS;
|
||||
use rustc_span::symbol::Symbol;
|
||||
use rustc_span::Span;
|
||||
|
||||
|
@ -95,7 +95,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for Context<'a, 'tcx> {
|
|||
}
|
||||
|
||||
fn visit_foreign_item(&mut self, i: &hir::ForeignItem<'_>) {
|
||||
if let Some((lang_item, _)) = rustc_lang_items::lang_items::extract(&i.attrs) {
|
||||
if let Some((lang_item, _)) = hir::lang_items::extract(&i.attrs) {
|
||||
self.register(lang_item, i.span);
|
||||
}
|
||||
intravisit::walk_foreign_item(self, i)
|
||||
|
|
Loading…
Add table
Reference in a new issue