From: Philip Herron <[email protected]>
There is a simple upfront check on ADT's we can check that def-id's match
before continuing to unify them.
gcc/rust/ChangeLog:
* typecheck/rust-unify.cc (UnifyRules::expect_adt): check defid
Signed-off-by: Philip Herron <[email protected]>
---
This change was merged into the gccrs repository and is posted here for
upstream visibility and potential drive-by review, as requested by GCC
release managers.
Each commit email contains a link to its details on github from where you can
find the Pull-Request and associated discussions.
Commit on github:
https://github.com/Rust-GCC/gccrs/commit/52a1e948dba4b04740d5aed8ee0afea399509eae
The commit has NOT been mentioned in any issue.
The commit has been mentioned in the following pull-request(s):
- https://github.com/Rust-GCC/gccrs/pull/4663
gcc/rust/typecheck/rust-unify.cc | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/gcc/rust/typecheck/rust-unify.cc b/gcc/rust/typecheck/rust-unify.cc
index 719e21f44..32aebff52 100644
--- a/gcc/rust/typecheck/rust-unify.cc
+++ b/gcc/rust/typecheck/rust-unify.cc
@@ -591,6 +591,11 @@ UnifyRules::expect_adt (TyTy::ADTType *ltype,
TyTy::BaseType *rtype)
return unify_error_type_node ();
}
+ if (ltype->get_id () != type.get_id ())
+ {
+ return unify_error_type_node ();
+ }
+
if (ltype->get_identifier ().compare (type.get_identifier ()) != 0)
{
return unify_error_type_node ();
base-commit: 206d052f0c25feb613d28fcd71877db7db089c14
--
2.54.0