public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-8599] gccrs: TyTy: refactor to new API
@ 2024-01-30 12:00 Arthur Cohen
  0 siblings, 0 replies; only message in thread
From: Arthur Cohen @ 2024-01-30 12:00 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:7eaef4f5b19a6e5298ce63218a0af791f54f8102

commit r14-8599-g7eaef4f5b19a6e5298ce63218a0af791f54f8102
Author: Jakub Dupak <dev@jakubdupak.com>
Date:   Sun Dec 3 11:15:06 2023 +0100

    gccrs: TyTy: refactor to new API
    
    gcc/rust/ChangeLog:
    
            * typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path): Refactor.
    
    Signed-off-by: Jakub Dupak <dev@jakubdupak.com>

Diff:
---
 gcc/rust/typecheck/rust-hir-type-check-type.cc | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/gcc/rust/typecheck/rust-hir-type-check-type.cc b/gcc/rust/typecheck/rust-hir-type-check-type.cc
index 62a17769c3fe..951920138cb8 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-type.cc
+++ b/gcc/rust/typecheck/rust-hir-type-check-type.cc
@@ -442,14 +442,9 @@ TypeCheckType::resolve_root_path (HIR::TypePath &path, size_t *offset,
       root_tyty = lookup;
 
       // this enforces the proper get_segments checks to take place
-      bool is_adt = root_tyty->get_kind () == TyTy::TypeKind::ADT;
-      if (is_adt)
-	{
-	  const TyTy::ADTType &adt
-	    = *static_cast<const TyTy::ADTType *> (root_tyty);
-	  if (adt.is_enum ())
-	    return root_tyty;
-	}
+      auto *maybe_adt = root_tyty->try_as<const TyTy::ADTType> ();
+      if (maybe_adt && maybe_adt->is_enum ())
+	return root_tyty;
     }
 
   return root_tyty;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-01-30 12:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-30 12:00 [gcc r14-8599] gccrs: TyTy: refactor to new API Arthur Cohen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).