Skip to content

Commit 7f138e1

Browse files
Remove dependency on rustc::ty from code_stats
1 parent dea13b4 commit 7f138e1

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

src/librustc/session/code_stats.rs

+1-14
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use ty::AdtKind;
12-
use ty::layout::{Align, Size};
13-
11+
use rustc_target::abi::{Align, Size};
1412
use rustc_data_structures::fx::{FxHashSet};
15-
1613
use std::cmp::{self, Ordering};
1714

1815
#[derive(Clone, PartialEq, Eq, Hash, Debug)]
@@ -38,16 +35,6 @@ pub struct FieldInfo {
3835
pub align: u64,
3936
}
4037

41-
impl From<AdtKind> for DataTypeKind {
42-
fn from(kind: AdtKind) -> Self {
43-
match kind {
44-
AdtKind::Struct => DataTypeKind::Struct,
45-
AdtKind::Enum => DataTypeKind::Enum,
46-
AdtKind::Union => DataTypeKind::Union,
47-
}
48-
}
49-
}
50-
5138
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
5239
pub enum DataTypeKind {
5340
Struct,

src/librustc/ty/mod.rs

+11
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ use ty::walk::TypeWalker;
3737
use util::captures::Captures;
3838
use util::nodemap::{NodeSet, DefIdMap, FxHashMap};
3939
use arena::SyncDroplessArena;
40+
use session::DataTypeKind;
4041

4142
use serialize::{self, Encodable, Encoder};
4243
use std::cell::RefCell;
@@ -1810,6 +1811,16 @@ impl<'a> HashStable<StableHashingContext<'a>> for AdtDef {
18101811
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
18111812
pub enum AdtKind { Struct, Union, Enum }
18121813

1814+
impl Into<DataTypeKind> for AdtKind {
1815+
fn into(self) -> DataTypeKind {
1816+
match self {
1817+
AdtKind::Struct => DataTypeKind::Struct,
1818+
AdtKind::Union => DataTypeKind::Union,
1819+
AdtKind::Enum => DataTypeKind::Enum,
1820+
}
1821+
}
1822+
}
1823+
18131824
bitflags! {
18141825
#[derive(RustcEncodable, RustcDecodable, Default)]
18151826
pub struct ReprFlags: u8 {

0 commit comments

Comments
 (0)