remove the cell from type flags completely

This commit is contained in:
Niko Matsakis 2017-05-12 12:01:43 -04:00
parent b46c1a95d0
commit 4464dcc7ce
4 changed files with 7 additions and 9 deletions

View File

@ -138,7 +138,7 @@ impl<'gcx: 'tcx, 'tcx> CtxtInterners<'tcx> {
let flags = super::flags::FlagComputation::for_sty(&st);
let ty_struct = TyS {
sty: st,
flags: Cell::new(flags.flags),
flags: flags.flags,
region_depth: flags.depth,
};
@ -978,8 +978,8 @@ macro_rules! sty_debug_print {
ty::TyError => /* unimportant */ continue,
$(ty::$variant(..) => &mut $variant,)*
};
let region = t.flags.get().intersects(ty::TypeFlags::HAS_RE_INFER);
let ty = t.flags.get().intersects(ty::TypeFlags::HAS_TY_INFER);
let region = t.flags.intersects(ty::TypeFlags::HAS_RE_INFER);
let ty = t.flags.intersects(ty::TypeFlags::HAS_TY_INFER);
variant.total += 1;
total.total += 1;

View File

@ -167,7 +167,7 @@ impl FlagComputation {
}
fn add_ty(&mut self, ty: Ty) {
self.add_flags(ty.flags.get());
self.add_flags(ty.flags);
self.add_depth(ty.region_depth);
}

View File

@ -625,9 +625,8 @@ struct HasTypeFlagsVisitor {
impl<'tcx> TypeVisitor<'tcx> for HasTypeFlagsVisitor {
fn visit_ty(&mut self, t: Ty) -> bool {
let flags = t.flags.get();
debug!("HasTypeFlagsVisitor: t={:?} t.flags={:?} self.flags={:?}", t, flags, self.flags);
flags.intersects(self.flags)
debug!("HasTypeFlagsVisitor: t={:?} t.flags={:?} self.flags={:?}", t, t.flags, self.flags);
t.flags.intersects(self.flags)
}
fn visit_region(&mut self, r: ty::Region<'tcx>) -> bool {

View File

@ -35,7 +35,6 @@ use util::common::ErrorReported;
use util::nodemap::{NodeSet, DefIdMap, FxHashMap, FxHashSet};
use serialize::{self, Encodable, Encoder};
use std::cell::Cell;
use std::collections::BTreeMap;
use std::cmp;
use std::fmt;
@ -516,7 +515,7 @@ bitflags! {
pub struct TyS<'tcx> {
pub sty: TypeVariants<'tcx>,
pub flags: Cell<TypeFlags>,
pub flags: TypeFlags,
// the maximal depth of any bound regions appearing in this type.
region_depth: u32,