From 256188dca6e2e74473003c9d5e49a37e396b6527 Mon Sep 17 00:00:00 2001 From: Owen Avery Date: Sun, 22 Oct 2023 23:13:15 -0400 Subject: [PATCH] Fix enum discriminant type gcc/rust/ChangeLog: * backend/rust-compile-type.cc (TyTyResolveCompile::get_implicit_enumeral_node_type): Make enumeral type equivalent to isize. Signed-off-by: Owen Avery --- gcc/rust/backend/rust-compile-type.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gcc/rust/backend/rust-compile-type.cc b/gcc/rust/backend/rust-compile-type.cc index 232f965bd7a4..9ca65b331267 100644 --- a/gcc/rust/backend/rust-compile-type.cc +++ b/gcc/rust/backend/rust-compile-type.cc @@ -79,9 +79,10 @@ TyTyResolveCompile::get_implicit_enumeral_node_type (Context *ctx) static tree enum_node = NULL_TREE; if (enum_node == NULL_TREE) { - enum_node - = Backend::named_type ("enumeral", Backend::integer_type (false, 64), - BUILTINS_LOCATION); + // equivalent to isize + enum_node = Backend::named_type ( + "enumeral", Backend::integer_type (false, Backend::get_pointer_size ()), + BUILTINS_LOCATION); } return enum_node; }