// Does this have parameters? Used to determine whether substitution is
// required.
/// Does this have `Param`?
- const HAS_TY_PARAM = 1 << 0;
+ const HAS_KNOWN_TY_PARAM = 1 << 0;
/// Does this have `ReEarlyBound`?
- const HAS_RE_PARAM = 1 << 1;
+ const HAS_KNOWN_RE_PARAM = 1 << 1;
/// Does this have `ConstKind::Param`?
- const HAS_CT_PARAM = 1 << 2;
+ const HAS_KNOWN_CT_PARAM = 1 << 2;
- const NEEDS_SUBST = TypeFlags::HAS_TY_PARAM.bits
- | TypeFlags::HAS_RE_PARAM.bits
- | TypeFlags::HAS_CT_PARAM.bits;
+ const KNOWN_NEEDS_SUBST = TypeFlags::HAS_KNOWN_TY_PARAM.bits
+ | TypeFlags::HAS_KNOWN_RE_PARAM.bits
+ | TypeFlags::HAS_KNOWN_CT_PARAM.bits;
/// Does this have `Infer`?
- const HAS_TY_INFER = 1 << 3;
+ const HAS_TY_INFER = 1 << 3;
/// Does this have `ReVar`?
- const HAS_RE_INFER = 1 << 4;
+ const HAS_RE_INFER = 1 << 4;
/// Does this have `ConstKind::Infer`?
- const HAS_CT_INFER = 1 << 5;
+ const HAS_CT_INFER = 1 << 5;
/// Does this have inference variables? Used to determine whether
/// inference is required.
- const NEEDS_INFER = TypeFlags::HAS_TY_INFER.bits
- | TypeFlags::HAS_RE_INFER.bits
- | TypeFlags::HAS_CT_INFER.bits;
+ const NEEDS_INFER = TypeFlags::HAS_TY_INFER.bits
+ | TypeFlags::HAS_RE_INFER.bits
+ | TypeFlags::HAS_CT_INFER.bits;
/// Does this have `Placeholder`?
- const HAS_TY_PLACEHOLDER = 1 << 6;
+ const HAS_TY_PLACEHOLDER = 1 << 6;
/// Does this have `RePlaceholder`?
- const HAS_RE_PLACEHOLDER = 1 << 7;
+ const HAS_RE_PLACEHOLDER = 1 << 7;
/// Does this have `ConstKind::Placeholder`?
- const HAS_CT_PLACEHOLDER = 1 << 8;
+ const HAS_CT_PLACEHOLDER = 1 << 8;
/// `true` if there are "names" of regions and so forth
/// that are local to a particular fn/inferctxt
- const HAS_FREE_LOCAL_REGIONS = 1 << 9;
+ const HAS_KNOWN_FREE_LOCAL_REGIONS = 1 << 9;
/// `true` if there are "names" of types and regions and so forth
/// that are local to a particular fn
- const HAS_FREE_LOCAL_NAMES = TypeFlags::HAS_TY_PARAM.bits
- | TypeFlags::HAS_CT_PARAM.bits
- | TypeFlags::HAS_TY_INFER.bits
- | TypeFlags::HAS_CT_INFER.bits
- | TypeFlags::HAS_TY_PLACEHOLDER.bits
- | TypeFlags::HAS_CT_PLACEHOLDER.bits
- // We consider 'freshened' types and constants
- // to depend on a particular fn.
- // The freshening process throws away information,
- // which can make things unsuitable for use in a global
- // cache. Note that there is no 'fresh lifetime' flag -
- // freshening replaces all lifetimes with `ReErased`,
- // which is different from how types/const are freshened.
- | TypeFlags::HAS_TY_FRESH.bits
- | TypeFlags::HAS_CT_FRESH.bits
- | TypeFlags::HAS_FREE_LOCAL_REGIONS.bits;
+ const HAS_KNOWN_FREE_LOCAL_NAMES = TypeFlags::HAS_KNOWN_TY_PARAM.bits
+ | TypeFlags::HAS_KNOWN_CT_PARAM.bits
+ | TypeFlags::HAS_TY_INFER.bits
+ | TypeFlags::HAS_CT_INFER.bits
+ | TypeFlags::HAS_TY_PLACEHOLDER.bits
+ | TypeFlags::HAS_CT_PLACEHOLDER.bits
+ // We consider 'freshened' types and constants
+ // to depend on a particular fn.
+ // The freshening process throws away information,
+ // which can make things unsuitable for use in a global
+ // cache. Note that there is no 'fresh lifetime' flag -
+ // freshening replaces all lifetimes with `ReErased`,
+ // which is different from how types/const are freshened.
+ | TypeFlags::HAS_TY_FRESH.bits
+ | TypeFlags::HAS_CT_FRESH.bits
+ | TypeFlags::HAS_KNOWN_FREE_LOCAL_REGIONS.bits;
+
+ const HAS_POTENTIAL_FREE_LOCAL_NAMES = TypeFlags::HAS_KNOWN_FREE_LOCAL_NAMES.bits
+ | TypeFlags::HAS_UNKNOWN_DEFAULT_CONST_SUBSTS.bits;
/// Does this have `Projection`?
- const HAS_TY_PROJECTION = 1 << 10;
+ const HAS_TY_PROJECTION = 1 << 10;
/// Does this have `Opaque`?
- const HAS_TY_OPAQUE = 1 << 11;
+ const HAS_TY_OPAQUE = 1 << 11;
/// Does this have `ConstKind::Unevaluated`?
- const HAS_CT_PROJECTION = 1 << 12;
+ const HAS_CT_PROJECTION = 1 << 12;
/// Could this type be normalized further?
- const HAS_PROJECTION = TypeFlags::HAS_TY_PROJECTION.bits
- | TypeFlags::HAS_TY_OPAQUE.bits
- | TypeFlags::HAS_CT_PROJECTION.bits;
+ const HAS_PROJECTION = TypeFlags::HAS_TY_PROJECTION.bits
+ | TypeFlags::HAS_TY_OPAQUE.bits
+ | TypeFlags::HAS_CT_PROJECTION.bits;
/// Is an error type/const reachable?
- const HAS_ERROR = 1 << 13;
+ const HAS_ERROR = 1 << 13;
/// Does this have any region that "appears free" in the type?
/// Basically anything but `ReLateBound` and `ReErased`.
- const HAS_FREE_REGIONS = 1 << 14;
+ const HAS_KNOWN_FREE_REGIONS = 1 << 14;
+
+ const HAS_POTENTIAL_FREE_REGIONS = TypeFlags::HAS_KNOWN_FREE_REGIONS.bits
+ | TypeFlags::HAS_UNKNOWN_DEFAULT_CONST_SUBSTS.bits;
/// Does this have any `ReLateBound` regions? Used to check
/// if a global bound is safe to evaluate.
- const HAS_RE_LATE_BOUND = 1 << 15;
+ const HAS_RE_LATE_BOUND = 1 << 15;
/// Does this have any `ReErased` regions?
- const HAS_RE_ERASED = 1 << 16;
+ const HAS_RE_ERASED = 1 << 16;
/// Does this value have parameters/placeholders/inference variables which could be
/// replaced later, in a way that would change the results of `impl` specialization?
- const STILL_FURTHER_SPECIALIZABLE = 1 << 17;
+ ///
+ /// Note that this flag being set is not a guarantee, as it is also
+ /// set if there are any anon consts with unknown default substs.
+ const STILL_FURTHER_SPECIALIZABLE = 1 << 17;
/// Does this value have `InferTy::FreshTy/FreshIntTy/FreshFloatTy`?
- const HAS_TY_FRESH = 1 << 18;
+ const HAS_TY_FRESH = 1 << 18;
/// Does this value have `InferConst::Fresh`?
- const HAS_CT_FRESH = 1 << 19;
+ const HAS_CT_FRESH = 1 << 19;
+
+ /// Does this value have unknown default anon const substs.
+ ///
+ /// For more details refer to...
+ /// FIXME(@lcnr): ask me for now, still have to write all of this.
+ const HAS_UNKNOWN_DEFAULT_CONST_SUBSTS = 1 << 20;
+ /// Flags which can be influenced by default anon const substs.
+ const MAY_NEED_DEFAULT_CONST_SUBSTS = TypeFlags::HAS_KNOWN_RE_PARAM.bits
+ | TypeFlags::HAS_KNOWN_TY_PARAM.bits
+ | TypeFlags::HAS_KNOWN_CT_PARAM.bits
+ | TypeFlags::HAS_KNOWN_FREE_LOCAL_REGIONS.bits
+ | TypeFlags::HAS_KNOWN_FREE_REGIONS.bits;
+
}
}