[gcc r14-7460] gccrs: cleanup query_compile to reuse destructure call

Arthur Cohen cohenarthur@gcc.gnu.org
Tue Jan 16 17:36:39 GMT 2024


https://gcc.gnu.org/g:3a360b9481fe5a09053872e99a5c18de15e3968f

commit r14-7460-g3a360b9481fe5a09053872e99a5c18de15e3968f
Author: Philip Herron <herron.philip@googlemail.com>
Date:   Tue Apr 4 15:34:03 2023 +0100

    gccrs: cleanup query_compile to reuse destructure call
    
    gcc/rust/ChangeLog:
    
            * backend/rust-compile-resolve-path.cc (HIRCompileBase::query_compile): call destructure
    
    Signed-off-by: Philip Herron <herron.philip@googlemail.com>

Diff:
---
 gcc/rust/backend/rust-compile-resolve-path.cc | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/gcc/rust/backend/rust-compile-resolve-path.cc b/gcc/rust/backend/rust-compile-resolve-path.cc
index 382a30caa1b..f9c509df2c3 100644
--- a/gcc/rust/backend/rust-compile-resolve-path.cc
+++ b/gcc/rust/backend/rust-compile-resolve-path.cc
@@ -248,12 +248,7 @@ HIRCompileBase::query_compile (HirId ref, TyTy::BaseType *lookup,
 	  ok = ctx->get_tyctx ()->lookup_receiver (mappings.get_hirid (),
 						   &receiver);
 	  rust_assert (ok);
-
-	  if (receiver->get_kind () == TyTy::TypeKind::PARAM)
-	    {
-	      TyTy::ParamType *p = static_cast<TyTy::ParamType *> (receiver);
-	      receiver = p->resolve ();
-	    }
+	  receiver = receiver->destructure ();
 
 	  // the type resolver can only resolve type bounds to their trait
 	  // item so its up to us to figure out if this path should resolve


More information about the Gcc-cvs mailing list