|
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,73 +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 |
| -impl<T> EarlyBinder<T> { |
923 |
| - pub fn as_ref(&self) -> EarlyBinder<&T> { |
924 |
| - EarlyBinder(&self.0) |
925 |
| - } |
926 |
| - |
927 |
| - pub fn map_bound_ref<F, U>(&self, f: F) -> EarlyBinder<U> |
928 |
| - where |
929 |
| - F: FnOnce(&T) -> U, |
930 |
| - { |
931 |
| - self.as_ref().map_bound(f) |
932 |
| - } |
933 |
| - |
934 |
| - pub fn map_bound<F, U>(self, f: F) -> EarlyBinder<U> |
935 |
| - where |
936 |
| - F: FnOnce(T) -> U, |
937 |
| - { |
938 |
| - let value = f(self.0); |
939 |
| - EarlyBinder(value) |
940 |
| - } |
941 |
| - |
942 |
| - pub fn try_map_bound<F, U, E>(self, f: F) -> Result<EarlyBinder<U>, E> |
943 |
| - where |
944 |
| - F: FnOnce(T) -> Result<U, E>, |
945 |
| - { |
946 |
| - let value = f(self.0)?; |
947 |
| - Ok(EarlyBinder(value)) |
948 |
| - } |
949 |
| - |
950 |
| - pub fn rebind<U>(&self, value: U) -> EarlyBinder<U> { |
951 |
| - EarlyBinder(value) |
952 |
| - } |
953 |
| -} |
954 |
| - |
955 |
| -impl<T> EarlyBinder<Option<T>> { |
956 |
| - pub fn transpose(self) -> Option<EarlyBinder<T>> { |
957 |
| - self.0.map(|v| EarlyBinder(v)) |
958 |
| - } |
959 |
| -} |
960 |
| - |
961 |
| -impl<T, U> EarlyBinder<(T, U)> { |
962 |
| - pub fn transpose_tuple2(self) -> (EarlyBinder<T>, EarlyBinder<U>) { |
963 |
| - (EarlyBinder(self.0.0), EarlyBinder(self.0.1)) |
964 |
| - } |
965 |
| -} |
966 |
| - |
967 |
| -pub struct EarlyBinderIter<T> { |
968 |
| - t: T, |
969 |
| -} |
970 |
| - |
971 |
| -impl<T: IntoIterator> EarlyBinder<T> { |
972 |
| - pub fn transpose_iter(self) -> EarlyBinderIter<T::IntoIter> { |
973 |
| - EarlyBinderIter { t: self.0.into_iter() } |
974 |
| - } |
975 |
| -} |
976 |
| - |
977 |
| -impl<T: Iterator> Iterator for EarlyBinderIter<T> { |
978 |
| - type Item = EarlyBinder<T::Item>; |
979 |
| - |
980 |
| - fn next(&mut self) -> Option<Self::Item> { |
981 |
| - self.t.next().map(|i| EarlyBinder(i)) |
982 |
| - } |
983 |
| -} |
984 |
| - |
985 | 918 | #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, TyEncodable, TyDecodable)]
|
986 | 919 | #[derive(HashStable)]
|
987 | 920 | pub enum BoundVariableKind {
|
|
0 commit comments