@@ -35,7 +35,8 @@ use chalk_ir::{
3535use either:: Either ;
3636use hir_def:: {
3737 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 ,
3940 builtin_type:: { BuiltinInt , BuiltinType , BuiltinUint } ,
4041 expr_store:: { Body , ExpressionStore , HygieneId , path:: Path } ,
4142 hir:: { BindingAnnotation , BindingId , ExprId , ExprOrPatId , LabelId , PatId } ,
@@ -135,6 +136,10 @@ pub(crate) fn infer_query(db: &dyn HirDatabase, def: DefWithBodyId) -> Arc<Infer
135136 Arc :: new ( ctx. resolve_all ( ) )
136137}
137138
139+ pub ( crate ) fn infer_cycle_result ( _: & dyn HirDatabase , _: DefWithBodyId ) -> Arc < InferenceResult > {
140+ Arc :: new ( InferenceResult { has_errors : true , ..Default :: default ( ) } )
141+ }
142+
138143/// Fully normalize all the types found within `ty` in context of `owner` body definition.
139144///
140145/// This is appropriate to use only after type-check: it assumes
@@ -203,7 +208,7 @@ pub(crate) type InferResult<T> = Result<InferOk<T>, TypeError>;
203208pub enum InferenceDiagnostic {
204209 NoSuchField {
205210 field : ExprOrPatId ,
206- private : bool ,
211+ private : Option < LocalFieldId > ,
207212 variant : VariantId ,
208213 } ,
209214 PrivateField {
@@ -558,6 +563,9 @@ impl InferenceResult {
558563 ExprOrPatId :: PatId ( id) => self . type_of_pat . get ( id) ,
559564 }
560565 }
566+ pub fn is_erroneous ( & self ) -> bool {
567+ self . has_errors && self . type_of_expr . iter ( ) . count ( ) == 0
568+ }
561569}
562570
563571impl Index < ExprId > for InferenceResult {
0 commit comments