@@ -1024,7 +1024,7 @@ impl<'a> InferenceContext<'a> {
10241024pub ( crate ) enum Expectation {
10251025 None ,
10261026 HasType ( Ty ) ,
1027- // Castable(Ty), // rustc has this, we currently just don't propagate an expectation for casts
1027+ Castable ( Ty ) ,
10281028 RValueLikeUnsized ( Ty ) ,
10291029}
10301030
@@ -1077,6 +1077,7 @@ impl Expectation {
10771077 match self {
10781078 Expectation :: None => Expectation :: None ,
10791079 Expectation :: HasType ( t) => Expectation :: HasType ( table. resolve_ty_shallow ( t) ) ,
1080+ Expectation :: Castable ( t) => Expectation :: Castable ( table. resolve_ty_shallow ( t) ) ,
10801081 Expectation :: RValueLikeUnsized ( t) => {
10811082 Expectation :: RValueLikeUnsized ( table. resolve_ty_shallow ( t) )
10821083 }
@@ -1086,17 +1087,18 @@ impl Expectation {
10861087 fn to_option ( & self , table : & mut unify:: InferenceTable < ' _ > ) -> Option < Ty > {
10871088 match self . resolve ( table) {
10881089 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) ,
10921093 }
10931094 }
10941095
10951096 fn only_has_type ( & self , table : & mut unify:: InferenceTable < ' _ > ) -> Option < Ty > {
10961097 match self {
10971098 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+ }
11001102 }
11011103 }
11021104
0 commit comments