Skip to content

Commit 4464dcc

Browse files
committed
remove the cell from type flags completely
1 parent b46c1a9 commit 4464dcc

File tree

4 files changed

+7
-9
lines changed

4 files changed

+7
-9
lines changed

src/librustc/ty/context.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ impl<'gcx: 'tcx, 'tcx> CtxtInterners<'tcx> {
138138
let flags = super::flags::FlagComputation::for_sty(&st);
139139
let ty_struct = TyS {
140140
sty: st,
141-
flags: Cell::new(flags.flags),
141+
flags: flags.flags,
142142
region_depth: flags.depth,
143143
};
144144

@@ -978,8 +978,8 @@ macro_rules! sty_debug_print {
978978
ty::TyError => /* unimportant */ continue,
979979
$(ty::$variant(..) => &mut $variant,)*
980980
};
981-
let region = t.flags.get().intersects(ty::TypeFlags::HAS_RE_INFER);
982-
let ty = t.flags.get().intersects(ty::TypeFlags::HAS_TY_INFER);
981+
let region = t.flags.intersects(ty::TypeFlags::HAS_RE_INFER);
982+
let ty = t.flags.intersects(ty::TypeFlags::HAS_TY_INFER);
983983

984984
variant.total += 1;
985985
total.total += 1;

src/librustc/ty/flags.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ impl FlagComputation {
167167
}
168168

169169
fn add_ty(&mut self, ty: Ty) {
170-
self.add_flags(ty.flags.get());
170+
self.add_flags(ty.flags);
171171
self.add_depth(ty.region_depth);
172172
}
173173

src/librustc/ty/fold.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -625,9 +625,8 @@ struct HasTypeFlagsVisitor {
625625

626626
impl<'tcx> TypeVisitor<'tcx> for HasTypeFlagsVisitor {
627627
fn visit_ty(&mut self, t: Ty) -> bool {
628-
let flags = t.flags.get();
629-
debug!("HasTypeFlagsVisitor: t={:?} t.flags={:?} self.flags={:?}", t, flags, self.flags);
630-
flags.intersects(self.flags)
628+
debug!("HasTypeFlagsVisitor: t={:?} t.flags={:?} self.flags={:?}", t, t.flags, self.flags);
629+
t.flags.intersects(self.flags)
631630
}
632631

633632
fn visit_region(&mut self, r: ty::Region<'tcx>) -> bool {

src/librustc/ty/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ use util::common::ErrorReported;
3535
use util::nodemap::{NodeSet, DefIdMap, FxHashMap, FxHashSet};
3636

3737
use serialize::{self, Encodable, Encoder};
38-
use std::cell::Cell;
3938
use std::collections::BTreeMap;
4039
use std::cmp;
4140
use std::fmt;
@@ -516,7 +515,7 @@ bitflags! {
516515

517516
pub struct TyS<'tcx> {
518517
pub sty: TypeVariants<'tcx>,
519-
pub flags: Cell<TypeFlags>,
518+
pub flags: TypeFlags,
520519

521520
// the maximal depth of any bound regions appearing in this type.
522521
region_depth: u32,

0 commit comments

Comments
 (0)