|
3 | 3 | #![allow(rustc::usage_of_ty_tykind)]
|
4 | 4 |
|
5 | 5 | use crate::infer::canonical::Canonical;
|
6 |
| -use crate::ty::subst::{GenericArg, InternalSubsts, Subst, SubstsRef}; |
| 6 | +use crate::ty::subst::{GenericArg, InternalSubsts, SubstsRef}; |
7 | 7 | use crate::ty::visit::ValidateBoundVars;
|
8 | 8 | use crate::ty::InferTy::*;
|
9 | 9 | use crate::ty::{
|
@@ -551,7 +551,7 @@ impl<'tcx> GeneratorSubsts<'tcx> {
|
551 | 551 | layout.variant_fields.iter().map(move |variant| {
|
552 | 552 | variant
|
553 | 553 | .iter()
|
554 |
| - .map(move |field| EarlyBinder(layout.field_tys[*field]).subst(tcx, self.substs)) |
| 554 | + .map(move |field| ty::EarlyBinder(layout.field_tys[*field]).subst(tcx, self.substs)) |
555 | 555 | })
|
556 | 556 | }
|
557 | 557 |
|
@@ -915,77 +915,6 @@ impl<'tcx> PolyExistentialTraitRef<'tcx> {
|
915 | 915 | }
|
916 | 916 | }
|
917 | 917 |
|
918 |
| -#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] |
919 |
| -#[derive(Encodable, Decodable, HashStable)] |
920 |
| -pub struct EarlyBinder<T>(pub T); |
921 |
| - |
922 |
| -/// For early binders, you should first call `subst` before using any visitors. |
923 |
| -impl<'tcx, T> !TypeFoldable<'tcx> for ty::EarlyBinder<T> {} |
924 |
| -impl<'tcx, T> !TypeVisitable<'tcx> for ty::EarlyBinder<T> {} |
925 |
| - |
926 |
| -impl<T> EarlyBinder<T> { |
927 |
| - pub fn as_ref(&self) -> EarlyBinder<&T> { |
928 |
| - EarlyBinder(&self.0) |
929 |
| - } |
930 |
| - |
931 |
| - pub fn map_bound_ref<F, U>(&self, f: F) -> EarlyBinder<U> |
932 |
| - where |
933 |
| - F: FnOnce(&T) -> U, |
934 |
| - { |
935 |
| - self.as_ref().map_bound(f) |
936 |
| - } |
937 |
| - |
938 |
| - pub fn map_bound<F, U>(self, f: F) -> EarlyBinder<U> |
939 |
| - where |
940 |
| - F: FnOnce(T) -> U, |
941 |
| - { |
942 |
| - let value = f(self.0); |
943 |
| - EarlyBinder(value) |
944 |
| - } |
945 |
| - |
946 |
| - pub fn try_map_bound<F, U, E>(self, f: F) -> Result<EarlyBinder<U>, E> |
947 |
| - where |
948 |
| - F: FnOnce(T) -> Result<U, E>, |
949 |
| - { |
950 |
| - let value = f(self.0)?; |
951 |
| - Ok(EarlyBinder(value)) |
952 |
| - } |
953 |
| - |
954 |
| - pub fn rebind<U>(&self, value: U) -> EarlyBinder<U> { |
955 |
| - EarlyBinder(value) |
956 |
| - } |
957 |
| -} |
958 |
| - |
959 |
| -impl<T> EarlyBinder<Option<T>> { |
960 |
| - pub fn transpose(self) -> Option<EarlyBinder<T>> { |
961 |
| - self.0.map(|v| EarlyBinder(v)) |
962 |
| - } |
963 |
| -} |
964 |
| - |
965 |
| -impl<T, U> EarlyBinder<(T, U)> { |
966 |
| - pub fn transpose_tuple2(self) -> (EarlyBinder<T>, EarlyBinder<U>) { |
967 |
| - (EarlyBinder(self.0.0), EarlyBinder(self.0.1)) |
968 |
| - } |
969 |
| -} |
970 |
| - |
971 |
| -pub struct EarlyBinderIter<T> { |
972 |
| - t: T, |
973 |
| -} |
974 |
| - |
975 |
| -impl<T: IntoIterator> EarlyBinder<T> { |
976 |
| - pub fn transpose_iter(self) -> EarlyBinderIter<T::IntoIter> { |
977 |
| - EarlyBinderIter { t: self.0.into_iter() } |
978 |
| - } |
979 |
| -} |
980 |
| - |
981 |
| -impl<T: Iterator> Iterator for EarlyBinderIter<T> { |
982 |
| - type Item = EarlyBinder<T::Item>; |
983 |
| - |
984 |
| - fn next(&mut self) -> Option<Self::Item> { |
985 |
| - self.t.next().map(|i| EarlyBinder(i)) |
986 |
| - } |
987 |
| -} |
988 |
| - |
989 | 918 | #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, TyEncodable, TyDecodable)]
|
990 | 919 | #[derive(HashStable)]
|
991 | 920 | pub enum BoundVariableKind {
|
|
0 commit comments