add unresolved-assoc-item diagnostic

This commit is contained in:
Rose Hudson 2023-12-31 17:33:36 +00:00
parent cf52c4b2b3
commit 5878651e7e
6 changed files with 74 additions and 1 deletions

View file

@ -218,6 +218,9 @@ pub enum InferenceDiagnostic {
/// Contains the type the field resolves to
field_with_same_name: Option<Ty>,
},
UnresolvedAssocItem {
id: ExprOrPatId,
},
// FIXME: This should be emitted in body lowering
BreakOutsideOfLoop {
expr: ExprId,

View file

@ -340,6 +340,9 @@ impl InferenceContext<'_> {
},
);
let res = res.or(not_visible);
if res.is_none() {
self.push_diagnostic(InferenceDiagnostic::UnresolvedAssocItem { id });
}
let (item, visible) = res?;
let (def, container) = match item {