diff options
| author | Ellen <supbscripter@gmail.com> | 2022-01-12 03:19:52 +0000 |
|---|---|---|
| committer | Ellen <supbscripter@gmail.com> | 2022-01-15 01:16:55 +0000 |
| commit | 71bbb603f4108bc1f0bc8c8395ec725bb66e7802 (patch) | |
| tree | 668ba88d044cebf908cedfcd9a3479f401fa86f3 /compiler/rustc_middle/src/ty/flags.rs | |
| parent | b0ec3e09a996f2cb35be7710fd1003c3c38f1667 (diff) | |
| download | rust-71bbb603f4108bc1f0bc8c8395ec725bb66e7802.tar.gz rust-71bbb603f4108bc1f0bc8c8395ec725bb66e7802.zip | |
initial revert
Diffstat (limited to 'compiler/rustc_middle/src/ty/flags.rs')
| -rw-r--r-- | compiler/rustc_middle/src/ty/flags.rs | 34 |
1 files changed, 6 insertions, 28 deletions
diff --git a/compiler/rustc_middle/src/ty/flags.rs b/compiler/rustc_middle/src/ty/flags.rs index 617c522ac81..cc858771b42 100644 --- a/compiler/rustc_middle/src/ty/flags.rs +++ b/compiler/rustc_middle/src/ty/flags.rs @@ -34,12 +34,6 @@ impl FlagComputation { result.flags } - pub fn for_unevaluated_const(uv: ty::Unevaluated<'_>) -> TypeFlags { - let mut result = FlagComputation::new(); - result.add_unevaluated_const(uv); - result.flags - } - fn add_flags(&mut self, flags: TypeFlags) { self.flags = self.flags | flags; } @@ -97,7 +91,7 @@ impl FlagComputation { &ty::Error(_) => self.add_flags(TypeFlags::HAS_ERROR), &ty::Param(_) => { - self.add_flags(TypeFlags::HAS_KNOWN_TY_PARAM); + self.add_flags(TypeFlags::HAS_TY_PARAM); self.add_flags(TypeFlags::STILL_FURTHER_SPECIALIZABLE); } @@ -252,8 +246,8 @@ impl FlagComputation { ty::PredicateKind::ClosureKind(_def_id, substs, _kind) => { self.add_substs(substs); } - ty::PredicateKind::ConstEvaluatable(uv) => { - self.add_unevaluated_const(uv); + ty::PredicateKind::ConstEvaluatable(_def_id, substs) => { + self.add_substs(substs); } ty::PredicateKind::ConstEquate(expected, found) => { self.add_const(expected); @@ -298,7 +292,7 @@ impl FlagComputation { self.add_bound_var(debruijn); } ty::ConstKind::Param(_) => { - self.add_flags(TypeFlags::HAS_KNOWN_CT_PARAM); + self.add_flags(TypeFlags::HAS_CT_PARAM); self.add_flags(TypeFlags::STILL_FURTHER_SPECIALIZABLE); } ty::ConstKind::Placeholder(_) => { @@ -310,24 +304,8 @@ impl FlagComputation { } } - fn add_unevaluated_const<P>(&mut self, ct: ty::Unevaluated<'_, P>) { - // The generic arguments of unevaluated consts are a bit special, - // see the `rustc-dev-guide` for more information. - // - // FIXME(@lcnr): Actually add a link here. - if let Some(substs) = ct.substs_ { - // If they are available, we treat them as ordinary generic arguments. - self.add_substs(substs); - } else { - // Otherwise, we add `HAS_UNKNOWN_DEFAULT_CONST_SUBSTS` to signify - // that our const may potentially refer to generic parameters. - // - // Note that depending on which generic parameters are actually - // used in this constant, we may not actually refer to any generic - // parameters at all. - self.add_flags(TypeFlags::STILL_FURTHER_SPECIALIZABLE); - self.add_flags(TypeFlags::HAS_UNKNOWN_DEFAULT_CONST_SUBSTS); - } + fn add_unevaluated_const(&mut self, ct: ty::Unevaluated<'_>) { + self.add_substs(ct.substs); self.add_flags(TypeFlags::HAS_CT_PROJECTION); } |
