Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Remove dependency on rustc::ty from code_stats
  • Loading branch information
Mark-Simulacrum committed Aug 9, 2018
1 parent dea13b4 commit 7f138e1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
15 changes: 1 addition & 14 deletions src/librustc/session/code_stats.rs
Expand Up @@ -8,11 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use ty::AdtKind;
use ty::layout::{Align, Size};

use rustc_target::abi::{Align, Size};
use rustc_data_structures::fx::{FxHashSet};

use std::cmp::{self, Ordering};

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

impl From<AdtKind> for DataTypeKind {
fn from(kind: AdtKind) -> Self {
match kind {
AdtKind::Struct => DataTypeKind::Struct,
AdtKind::Enum => DataTypeKind::Enum,
AdtKind::Union => DataTypeKind::Union,
}
}
}

#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
pub enum DataTypeKind {
Struct,
Expand Down
11 changes: 11 additions & 0 deletions src/librustc/ty/mod.rs
Expand Up @@ -37,6 +37,7 @@ use ty::walk::TypeWalker;
use util::captures::Captures;
use util::nodemap::{NodeSet, DefIdMap, FxHashMap};
use arena::SyncDroplessArena;
use session::DataTypeKind;

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

impl Into<DataTypeKind> for AdtKind {
fn into(self) -> DataTypeKind {
match self {
AdtKind::Struct => DataTypeKind::Struct,
AdtKind::Union => DataTypeKind::Union,
AdtKind::Enum => DataTypeKind::Enum,
}
}
}

bitflags! {
#[derive(RustcEncodable, RustcDecodable, Default)]
pub struct ReprFlags: u8 {
Expand Down

0 comments on commit 7f138e1

Please sign in to comment.