Skip to content

Commit d3b2385

Browse files
committed
Move it all into rustc_hir.
1 parent 443a42a commit d3b2385

16 files changed

+20
-94
lines changed

Cargo.lock

+1-15
Original file line numberDiff line numberDiff line change
@@ -3100,7 +3100,6 @@ dependencies = [
31003100
"rustc_feature",
31013101
"rustc_hir",
31023102
"rustc_index",
3103-
"rustc_lang_items",
31043103
"rustc_macros",
31053104
"rustc_session",
31063105
"rustc_span",
@@ -3620,6 +3619,7 @@ version = "0.0.0"
36203619
name = "rustc_hir"
36213620
version = "0.0.0"
36223621
dependencies = [
3622+
"lazy_static 1.4.0",
36233623
"rustc_ast_pretty",
36243624
"rustc_data_structures",
36253625
"rustc_errors",
@@ -3699,19 +3699,6 @@ dependencies = [
36993699
"winapi 0.3.8",
37003700
]
37013701

3702-
[[package]]
3703-
name = "rustc_lang_items"
3704-
version = "0.0.0"
3705-
dependencies = [
3706-
"lazy_static 1.4.0",
3707-
"rustc_data_structures",
3708-
"rustc_hir",
3709-
"rustc_macros",
3710-
"rustc_span",
3711-
"serialize",
3712-
"syntax",
3713-
]
3714-
37153702
[[package]]
37163703
name = "rustc_lexer"
37173704
version = "0.1.0"
@@ -3865,7 +3852,6 @@ dependencies = [
38653852
"rustc_feature",
38663853
"rustc_hir",
38673854
"rustc_index",
3868-
"rustc_lang_items",
38693855
"rustc_session",
38703856
"rustc_span",
38713857
"rustc_target",

src/librustc/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ rustc_apfloat = { path = "../librustc_apfloat" }
2424
rustc_attr = { path = "../librustc_attr" }
2525
rustc_feature = { path = "../librustc_feature" }
2626
rustc_hir = { path = "../librustc_hir" }
27-
rustc_lang_items = { path = "../librustc_lang_items" }
2827
rustc_target = { path = "../librustc_target" }
2928
rustc_macros = { path = "../librustc_macros" }
3029
rustc_data_structures = { path = "../librustc_data_structures" }

src/librustc/ich/impls_hir.rs

-2
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,6 @@ impl<'ctx> rustc_hir::HashStableContext for StableHashingContext<'ctx> {
107107
}
108108
}
109109

110-
impl<'ctx> rustc_lang_items::HashStableContext for StableHashingContext<'ctx> {}
111-
112110
impl<'a> ToStableHashKey<StableHashingContext<'a>> for DefId {
113111
type KeyType = DefPathHash;
114112

src/librustc/middle/lang_items.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use crate::ty::{self, TyCtxt};
1414
use rustc_hir::def_id::DefId;
1515
use rustc_span::Span;
1616

17-
pub use rustc_lang_items::{LangItem, LanguageItems};
17+
pub use rustc_hir::{LangItem, LanguageItems};
1818

1919
impl<'tcx> TyCtxt<'tcx> {
2020
/// Returns the `DefId` for a given `LangItem`.

src/librustc/middle/weak_lang_items.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
33
use crate::ty::TyCtxt;
44
use rustc_hir::def_id::DefId;
5-
use rustc_lang_items::{lang_items, LangItem};
5+
use rustc_hir::{lang_items, LangItem};
66
use rustc_target::spec::PanicStrategy;
77

8-
pub use rustc_lang_items::weak_lang_items::link_name;
8+
pub use rustc_hir::weak_lang_items::link_name;
99

1010
impl<'tcx> TyCtxt<'tcx> {
1111
pub fn is_weak_lang_item(&self, item_def_id: DefId) -> bool {

src/librustc_hir/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,5 @@ rustc_span = { path = "../librustc_span" }
1919
rustc_errors = { path = "../librustc_errors" }
2020
rustc_serialize = { path = "../libserialize", package = "serialize" }
2121
syntax = { path = "../libsyntax" }
22+
lazy_static = "1"
2223
smallvec = { version = "1.0", features = ["union", "may_dangle"] }

src/librustc_lang_items/lang_items.rs renamed to src/librustc_hir/lang_items.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
1010
pub use self::LangItem::*;
1111

12+
use crate::def_id::DefId;
1213
use crate::Target;
1314

1415
use rustc_data_structures::fx::FxHashMap;
1516
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
16-
use rustc_hir::def_id::DefId;
1717
use rustc_macros::HashStable_Generic;
1818
use rustc_span::symbol::{sym, Symbol};
1919
use rustc_span::Span;

src/librustc_hir/lib.rs

+6
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,15 @@ mod hir;
1717
pub mod hir_id;
1818
pub mod intravisit;
1919
pub mod itemlikevisit;
20+
pub mod lang_items;
2021
pub mod pat_util;
2122
pub mod print;
2223
mod stable_hash_impls;
24+
mod target;
25+
pub mod weak_lang_items;
26+
2327
pub use hir::*;
2428
pub use hir_id::*;
29+
pub use lang_items::{LangItem, LanguageItems};
2530
pub use stable_hash_impls::HashStableContext;
31+
pub use target::{MethodKind, Target};

src/librustc_lang_items/target.rs renamed to src/librustc_hir/target.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
//! conflicts between multiple such attributes attached to the same
55
//! item.
66
7-
use rustc_hir as hir;
8-
use rustc_hir::{Item, ItemKind, TraitItem, TraitItemKind};
7+
use crate::hir;
8+
use crate::{Item, ItemKind, TraitItem, TraitItemKind};
99

1010
use std::fmt::{self, Display};
1111

src/librustc_lang_items/weak_lang_items.rs renamed to src/librustc_hir/weak_lang_items.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
//! Validity checking for weak lang items
22
3+
use crate::def_id::DefId;
34
use crate::{lang_items, LangItem, LanguageItems};
45

56
use rustc_data_structures::fx::FxHashMap;
6-
use rustc_hir::def_id::DefId;
77
use rustc_span::symbol::{sym, Symbol};
88
use syntax::ast;
99

src/librustc_lang_items/Cargo.toml

-18
This file was deleted.

src/librustc_lang_items/lib.rs

-45
This file was deleted.

src/librustc_passes/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ rustc_errors = { path = "../librustc_errors" }
1717
rustc_feature = { path = "../librustc_feature" }
1818
rustc_hir = { path = "../librustc_hir" }
1919
rustc_index = { path = "../librustc_index" }
20-
rustc_lang_items = { path = "../librustc_lang_items" }
2120
rustc_session = { path = "../librustc_session" }
2221
rustc_target = { path = "../librustc_target" }
2322
syntax = { path = "../libsyntax" }

src/librustc_passes/check_attr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use rustc_hir::def_id::DefId;
1414
use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor};
1515
use rustc_hir::DUMMY_HIR_ID;
1616
use rustc_hir::{self, HirId, Item, ItemKind, TraitItem};
17-
use rustc_lang_items::{MethodKind, Target};
17+
use rustc_hir::{MethodKind, Target};
1818
use rustc_session::lint::builtin::{CONFLICTING_REPR_HINTS, UNUSED_ATTRIBUTES};
1919
use rustc_span::symbol::sym;
2020
use rustc_span::Span;

src/librustc_passes/lang_items.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ use rustc_errors::struct_span_err;
1616
use rustc_hir as hir;
1717
use rustc_hir::def_id::{DefId, LOCAL_CRATE};
1818
use rustc_hir::itemlikevisit::ItemLikeVisitor;
19-
use rustc_lang_items::lang_items::{extract, ITEM_REFS};
20-
use rustc_lang_items::{LangItem, LanguageItems, Target};
19+
use rustc_hir::lang_items::{extract, ITEM_REFS};
20+
use rustc_hir::{LangItem, LanguageItems, Target};
2121

2222
use rustc::ty::query::Providers;
2323

src/librustc_passes/weak_lang_items.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use rustc_data_structures::fx::FxHashSet;
1010
use rustc_errors::struct_span_err;
1111
use rustc_hir as hir;
1212
use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor};
13-
use rustc_lang_items::weak_lang_items::WEAK_ITEMS_REFS;
13+
use rustc_hir::weak_lang_items::WEAK_ITEMS_REFS;
1414
use rustc_span::symbol::Symbol;
1515
use rustc_span::Span;
1616

@@ -95,7 +95,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for Context<'a, 'tcx> {
9595
}
9696

9797
fn visit_foreign_item(&mut self, i: &hir::ForeignItem<'_>) {
98-
if let Some((lang_item, _)) = rustc_lang_items::lang_items::extract(&i.attrs) {
98+
if let Some((lang_item, _)) = hir::lang_items::extract(&i.attrs) {
9999
self.register(lang_item, i.span);
100100
}
101101
intravisit::walk_foreign_item(self, i)

0 commit comments

Comments
 (0)