Add new type-mismatch diagnostic

This commit is contained in:
Florian Diebold 2022-03-20 16:26:48 +01:00
parent 2d30dd67d3
commit ab3313b1cb
7 changed files with 151 additions and 81 deletions

View file

@ -28,7 +28,6 @@ macro_rules! diagnostics {
}
diagnostics![
AddReferenceHere,
BreakOutsideOfLoop,
InactiveCode,
IncorrectCase,
@ -38,11 +37,10 @@ diagnostics![
MismatchedArgCount,
MissingFields,
MissingMatchArms,
MissingOkOrSomeInTailExpr,
MissingUnsafe,
NoSuchField,
RemoveThisSemicolon,
ReplaceFilterMapNextWithFindMap,
TypeMismatch,
UnimplementedBuiltinMacro,
UnresolvedExternCrate,
UnresolvedImport,
@ -147,19 +145,6 @@ pub struct MismatchedArgCount {
pub found: usize,
}
#[derive(Debug)]
pub struct RemoveThisSemicolon {
pub expr: InFile<AstPtr<ast::Expr>>,
}
#[derive(Debug)]
pub struct MissingOkOrSomeInTailExpr {
pub expr: InFile<AstPtr<ast::Expr>>,
// `Some` or `Ok` depending on whether the return type is Result or Option
pub required: String,
pub expected: Type,
}
#[derive(Debug)]
pub struct MissingMatchArms {
pub file: HirFileId,
@ -167,9 +152,10 @@ pub struct MissingMatchArms {
}
#[derive(Debug)]
pub struct AddReferenceHere {
pub struct TypeMismatch {
pub expr: InFile<AstPtr<ast::Expr>>,
pub mutability: Mutability,
pub expected: Type,
pub actual: Type,
}
pub use hir_ty::diagnostics::IncorrectCase;