Skip to content

Commit 4d28a82

Browse files
ty.flags -> ty.flags()
1 parent 085e417 commit 4d28a82

File tree

8 files changed

+23
-11
lines changed

8 files changed

+23
-11
lines changed

compiler/rustc_infer/src/infer/canonical/canonicalizer.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for Canonicalizer<'cx, 'tcx> {
418418
| ty::Foreign(..)
419419
| ty::Param(..)
420420
| ty::Opaque(..) => {
421-
if t.flags.intersects(self.needs_canonical_flags) {
421+
if t.flags().intersects(self.needs_canonical_flags) {
422422
t.super_fold_with(self)
423423
} else {
424424
t

compiler/rustc_middle/src/ty/context.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1828,9 +1828,9 @@ macro_rules! sty_debug_print {
18281828
ty::Error(_) => /* unimportant */ continue,
18291829
$(ty::$variant(..) => &mut $variant,)*
18301830
};
1831-
let lt = t.flags.intersects(ty::TypeFlags::HAS_RE_INFER);
1832-
let ty = t.flags.intersects(ty::TypeFlags::HAS_TY_INFER);
1833-
let ct = t.flags.intersects(ty::TypeFlags::HAS_CT_INFER);
1831+
let lt = t.flags().intersects(ty::TypeFlags::HAS_RE_INFER);
1832+
let ty = t.flags().intersects(ty::TypeFlags::HAS_TY_INFER);
1833+
let ct = t.flags().intersects(ty::TypeFlags::HAS_CT_INFER);
18341834

18351835
variant.total += 1;
18361836
total.total += 1;

compiler/rustc_middle/src/ty/flags.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ impl FlagComputation {
253253
}
254254

255255
fn add_ty(&mut self, ty: Ty<'_>) {
256-
self.add_flags(ty.flags);
256+
self.add_flags(ty.flags());
257257
self.add_exclusive_binder(ty.outer_exclusive_binder);
258258
}
259259

compiler/rustc_middle/src/ty/fold.rs

+8-3
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ impl<'tcx> TyCtxt<'tcx> {
352352

353353
fn visit_ty(&mut self, ty: Ty<'tcx>) -> bool {
354354
// We're only interested in types involving regions
355-
if ty.flags.intersects(TypeFlags::HAS_FREE_REGIONS) {
355+
if ty.flags().intersects(TypeFlags::HAS_FREE_REGIONS) {
356356
ty.super_visit_with(self)
357357
} else {
358358
false // keep visiting
@@ -922,8 +922,13 @@ struct HasTypeFlagsVisitor {
922922

923923
impl<'tcx> TypeVisitor<'tcx> for HasTypeFlagsVisitor {
924924
fn visit_ty(&mut self, t: Ty<'_>) -> bool {
925-
debug!("HasTypeFlagsVisitor: t={:?} t.flags={:?} self.flags={:?}", t, t.flags, self.flags);
926-
t.flags.intersects(self.flags)
925+
debug!(
926+
"HasTypeFlagsVisitor: t={:?} t.flags={:?} self.flags={:?}",
927+
t,
928+
t.flags(),
929+
self.flags
930+
);
931+
t.flags().intersects(self.flags)
927932
}
928933

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

compiler/rustc_middle/src/ty/mod.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,9 @@ pub struct TyS<'tcx> {
583583
/// This field shouldn't be used directly and may be removed in the future.
584584
/// Use `TyS::kind()` instead.
585585
kind: TyKind<'tcx>,
586-
pub flags: TypeFlags,
586+
/// This field shouldn't be used directly and may be removed in the future.
587+
/// Use `TyS::flags()` instead.
588+
flags: TypeFlags,
587589

588590
/// This is a kind of confusing thing: it stores the smallest
589591
/// binder such that

compiler/rustc_middle/src/ty/sty.rs

+5
Original file line numberDiff line numberDiff line change
@@ -1748,6 +1748,11 @@ impl<'tcx> TyS<'tcx> {
17481748
&self.kind
17491749
}
17501750

1751+
#[inline(always)]
1752+
pub fn flags(&self) -> TypeFlags {
1753+
self.flags
1754+
}
1755+
17511756
#[inline]
17521757
pub fn is_unit(&self) -> bool {
17531758
match self.kind() {

compiler/rustc_trait_selection/src/opaque_types.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@ where
708708

709709
fn visit_ty(&mut self, ty: Ty<'tcx>) -> bool {
710710
// We're only interested in types involving regions
711-
if !ty.flags.intersects(ty::TypeFlags::HAS_FREE_REGIONS) {
711+
if !ty.flags().intersects(ty::TypeFlags::HAS_FREE_REGIONS) {
712712
return false; // keep visiting
713713
}
714714

src/tools/clippy/clippy_lints/src/non_copy_const.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ fn verify_ty_bound<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>, source: Source) {
128128
diag.span_label(const_kw_span, "make this a static item (maybe with lazy_static)");
129129
},
130130
Source::Assoc { ty: ty_span, .. } => {
131-
if ty.flags.intersects(TypeFlags::HAS_FREE_LOCAL_NAMES) {
131+
if ty.flags().intersects(TypeFlags::HAS_FREE_LOCAL_NAMES) {
132132
diag.span_label(ty_span, &format!("consider requiring `{}` to be `Copy`", ty));
133133
}
134134
},

0 commit comments

Comments
 (0)