@@ -10,13 +10,14 @@ use hir_def::{expr::ExprId, lang_item::LangItemTarget};
10
10
11
11
use crate :: {
12
12
autoderef,
13
- infer:: { Adjust , Adjustment , AutoBorrow , InferResult , PointerCast , TypeMismatch } ,
14
- static_lifetime, Canonical , DomainGoal , FnPointer , FnSig , Interner , Solution , Substitution , Ty ,
15
- TyBuilder , TyExt , TyKind ,
13
+ infer:: {
14
+ Adjust , Adjustment , AutoBorrow , InferOk , InferResult , InferenceContext , PointerCast ,
15
+ TypeError , TypeMismatch ,
16
+ } ,
17
+ static_lifetime, Canonical , DomainGoal , FnPointer , FnSig , InEnvironment , Interner , Solution ,
18
+ Substitution , Ty , TyBuilder , TyExt , TyKind ,
16
19
} ;
17
20
18
- use super :: { InEnvironment , InferOk , InferenceContext , TypeError } ;
19
-
20
21
pub ( crate ) type CoerceResult = Result < InferOk < ( Vec < Adjustment > , Ty ) > , TypeError > ;
21
22
22
23
/// Do not require any adjustments, i.e. coerce `x -> x`.
@@ -36,6 +37,7 @@ fn success(
36
37
) -> CoerceResult {
37
38
Ok ( InferOk { goals, value : ( adj, target) } )
38
39
}
40
+
39
41
#[ derive( Clone , Debug ) ]
40
42
pub ( super ) struct CoerceMany {
41
43
expected_ty : Ty ,
@@ -171,12 +173,8 @@ impl<'a> InferenceContext<'a> {
171
173
172
174
// Examine the supertype and consider auto-borrowing.
173
175
match to_ty. kind ( & Interner ) {
174
- TyKind :: Raw ( mt, _) => {
175
- return self . coerce_ptr ( from_ty, to_ty, * mt) ;
176
- }
177
- TyKind :: Ref ( mt, _, _) => {
178
- return self . coerce_ref ( from_ty, to_ty, * mt) ;
179
- }
176
+ TyKind :: Raw ( mt, _) => return self . coerce_ptr ( from_ty, to_ty, * mt) ,
177
+ TyKind :: Ref ( mt, _, _) => return self . coerce_ref ( from_ty, to_ty, * mt) ,
180
178
_ => { }
181
179
}
182
180
@@ -337,7 +335,7 @@ impl<'a> InferenceContext<'a> {
337
335
return Err ( err) ;
338
336
}
339
337
} ;
340
- // FIXME: record overloarded deref adjustments
338
+ // FIXME: record overloaded deref adjustments
341
339
success (
342
340
vec ! [ Adjustment { kind: Adjust :: Borrow ( AutoBorrow :: Ref ( to_mt) ) , target: ty. clone( ) } ] ,
343
341
ty,
0 commit comments