@@ -35,7 +35,8 @@ use chalk_ir::{
35
35
use either:: Either ;
36
36
use hir_def:: {
37
37
AdtId , AssocItemId , ConstId , DefWithBodyId , FieldId , FunctionId , GenericDefId , GenericParamId ,
38
- ImplId , ItemContainerId , Lookup , TraitId , TupleFieldId , TupleId , TypeAliasId , VariantId ,
38
+ ImplId , ItemContainerId , LocalFieldId , Lookup , TraitId , TupleFieldId , TupleId , TypeAliasId ,
39
+ VariantId ,
39
40
builtin_type:: { BuiltinInt , BuiltinType , BuiltinUint } ,
40
41
expr_store:: { Body , ExpressionStore , HygieneId , path:: Path } ,
41
42
hir:: { BindingAnnotation , BindingId , ExprId , ExprOrPatId , LabelId , PatId } ,
@@ -135,6 +136,10 @@ pub(crate) fn infer_query(db: &dyn HirDatabase, def: DefWithBodyId) -> Arc<Infer
135
136
Arc :: new ( ctx. resolve_all ( ) )
136
137
}
137
138
139
+ pub ( crate ) fn infer_cycle_result ( _: & dyn HirDatabase , _: DefWithBodyId ) -> Arc < InferenceResult > {
140
+ Arc :: new ( InferenceResult { has_errors : true , ..Default :: default ( ) } )
141
+ }
142
+
138
143
/// Fully normalize all the types found within `ty` in context of `owner` body definition.
139
144
///
140
145
/// This is appropriate to use only after type-check: it assumes
@@ -203,7 +208,7 @@ pub(crate) type InferResult<T> = Result<InferOk<T>, TypeError>;
203
208
pub enum InferenceDiagnostic {
204
209
NoSuchField {
205
210
field : ExprOrPatId ,
206
- private : bool ,
211
+ private : Option < LocalFieldId > ,
207
212
variant : VariantId ,
208
213
} ,
209
214
PrivateField {
@@ -558,6 +563,9 @@ impl InferenceResult {
558
563
ExprOrPatId :: PatId ( id) => self . type_of_pat . get ( id) ,
559
564
}
560
565
}
566
+ pub fn is_erroneous ( & self ) -> bool {
567
+ self . has_errors && self . type_of_expr . iter ( ) . count ( ) == 0
568
+ }
561
569
}
562
570
563
571
impl Index < ExprId > for InferenceResult {
0 commit comments