From 4464dcc7ce76dbd98be203b792cce89c1e5ab05f Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Fri, 12 May 2017 12:01:43 -0400 Subject: [PATCH] remove the cell from type flags completely --- src/librustc/ty/context.rs | 6 +++--- src/librustc/ty/flags.rs | 2 +- src/librustc/ty/fold.rs | 5 ++--- src/librustc/ty/mod.rs | 3 +-- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index b9355c264b3..5ee0b1c9e5e 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -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; diff --git a/src/librustc/ty/flags.rs b/src/librustc/ty/flags.rs index 686b99ba680..46afa6ee7d0 100644 --- a/src/librustc/ty/flags.rs +++ b/src/librustc/ty/flags.rs @@ -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); } diff --git a/src/librustc/ty/fold.rs b/src/librustc/ty/fold.rs index 6de3c018bda..c17a54f4f69 100644 --- a/src/librustc/ty/fold.rs +++ b/src/librustc/ty/fold.rs @@ -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 { diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index 8264809e9c9..897b28986a5 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -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, + pub flags: TypeFlags, // the maximal depth of any bound regions appearing in this type. region_depth: u32,