expected->get_name ().c_str (), expr->get_name ().c_str ());
}
+void
+UnifyRules::emit_abi_mismatch (const TyTy::FnType &expected,
+ const TyTy::FnType &got) const
+{
+ RichLocation r (locus);
+ r.add_range (lhs.get_locus ());
+ r.add_range (rhs.get_locus ());
+ rust_error_at (r, "mistached abi %<%s%> got %<%s%>",
+ get_string_from_abi (expected.get_abi ()).c_str (),
+ get_string_from_abi (got.get_abi ()).c_str ());
+}
+
TyTy::BaseType *
UnifyRules::go ()
{
return new TyTy::ErrorType (0);
}
+ // ABI match? see
+ // https://gcc-rust.zulipchat.com/#narrow/stream/266897-general/topic/extern.20blocks/near/346416045
+ if (ltype->get_abi () != type.get_abi ())
+ {
+ if (emit_error)
+ {
+ emit_abi_mismatch (*ltype, type);
+ }
+ return new TyTy::ErrorType (0);
+ }
+
+ // DEF Id match? see https://github.com/Rust-GCC/gccrs/issues/2053
+
return ltype->clone ();
}
break;
std::vector<InferenceSite> &infers);
void emit_type_mismatch () const;
+ void emit_abi_mismatch (const TyTy::FnType &expected,
+ const TyTy::FnType &got) const;
TyTy::BaseType *go ();