@@ -1024,7 +1024,7 @@ impl<'a> InferenceContext<'a> {
1024
1024
pub ( crate ) enum Expectation {
1025
1025
None ,
1026
1026
HasType ( Ty ) ,
1027
- // Castable(Ty), // rustc has this, we currently just don't propagate an expectation for casts
1027
+ Castable ( Ty ) ,
1028
1028
RValueLikeUnsized ( Ty ) ,
1029
1029
}
1030
1030
@@ -1077,6 +1077,7 @@ impl Expectation {
1077
1077
match self {
1078
1078
Expectation :: None => Expectation :: None ,
1079
1079
Expectation :: HasType ( t) => Expectation :: HasType ( table. resolve_ty_shallow ( t) ) ,
1080
+ Expectation :: Castable ( t) => Expectation :: Castable ( table. resolve_ty_shallow ( t) ) ,
1080
1081
Expectation :: RValueLikeUnsized ( t) => {
1081
1082
Expectation :: RValueLikeUnsized ( table. resolve_ty_shallow ( t) )
1082
1083
}
@@ -1086,17 +1087,18 @@ impl Expectation {
1086
1087
fn to_option ( & self , table : & mut unify:: InferenceTable < ' _ > ) -> Option < Ty > {
1087
1088
match self . resolve ( table) {
1088
1089
Expectation :: None => None ,
1089
- Expectation :: HasType ( t) |
1090
- // Expectation::Castable(t) |
1091
- Expectation :: RValueLikeUnsized ( t) => Some ( t) ,
1090
+ Expectation :: HasType ( t)
1091
+ | Expectation :: Castable ( t)
1092
+ | Expectation :: RValueLikeUnsized ( t) => Some ( t) ,
1092
1093
}
1093
1094
}
1094
1095
1095
1096
fn only_has_type ( & self , table : & mut unify:: InferenceTable < ' _ > ) -> Option < Ty > {
1096
1097
match self {
1097
1098
Expectation :: HasType ( t) => Some ( table. resolve_ty_shallow ( t) ) ,
1098
- // Expectation::Castable(_) |
1099
- Expectation :: RValueLikeUnsized ( _) | Expectation :: None => None ,
1099
+ Expectation :: Castable ( _) | Expectation :: RValueLikeUnsized ( _) | Expectation :: None => {
1100
+ None
1101
+ }
1100
1102
}
1101
1103
}
1102
1104
0 commit comments