Unnamed repository; edit this file 'description' to name the repository.
hir: use hir::Variant in DuplicateField, not VariantId
Per review: do not expose hir-ty/hir-def types outside hir. Convert the lower-level VariantId to the public Variant wrapper at the inference-diagnostic boundary.
Onyeka Obi 2 weeks ago
parent 5e757fd · commit e8a8c5b
-rw-r--r--crates/hir/src/diagnostics.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/hir/src/diagnostics.rs b/crates/hir/src/diagnostics.rs
index cfc59fc383..b34c7b20c3 100644
--- a/crates/hir/src/diagnostics.rs
+++ b/crates/hir/src/diagnostics.rs
@@ -31,7 +31,7 @@ use syntax::{
};
use triomphe::Arc;
-use crate::{AssocItem, Field, Function, GenericDef, Local, Trait, Type};
+use crate::{AssocItem, Field, Function, GenericDef, Local, Trait, Type, Variant};
pub use hir_def::VariantId;
pub use hir_ty::{
@@ -271,7 +271,7 @@ pub struct NoSuchField {
#[derive(Debug)]
pub struct DuplicateField {
pub field: InFile<AstPtr<Either<ast::RecordExprField, ast::RecordPatField>>>,
- pub variant: VariantId,
+ pub variant: Variant,
}
#[derive(Debug)]
@@ -778,7 +778,7 @@ impl<'db> AnyDiagnostic<'db> {
}
ExprOrPatId::PatId(pat) => source_map.pat_field_syntax(pat),
};
- DuplicateField { field: expr_or_pat, variant }.into()
+ DuplicateField { field: expr_or_pat, variant: variant.into() }.into()
}
&InferenceDiagnostic::MismatchedArgCount { call_expr, expected, found } => {
MismatchedArgCount { call_expr: expr_syntax(call_expr)?, expected, found }.into()