]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Fix ICE during path probe
authorPhilip Herron <herron.philip@googlemail.com>
Mon, 3 Feb 2025 15:15:40 +0000 (15:15 +0000)
committerArthur Cohen <arthur.cohen@embecosm.com>
Mon, 24 Mar 2025 12:07:01 +0000 (13:07 +0100)
It is valid for the query to fail here so its valid to not assert here.

gcc/rust/ChangeLog:

* typecheck/rust-hir-path-probe.cc (PathProbeType::visit): remove assertion

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
gcc/rust/typecheck/rust-hir-path-probe.cc

index 1148b24b0107ef41360e4f16b3003c0a4bf6f9d7..0465d2f5786f5191371b34b34f2e283ef3fb4c5e 100644 (file)
@@ -212,8 +212,8 @@ PathProbeType::visit (HIR::TypeAlias &alias)
     {
       HirId tyid = alias.get_mappings ().get_hirid ();
       TyTy::BaseType *ty = nullptr;
-      bool ok = query_type (tyid, &ty);
-      rust_assert (ok);
+      if (!query_type (tyid, &ty))
+       return;
 
       PathProbeCandidate::ImplItemCandidate impl_item_candidate{&alias,
                                                                current_impl};
@@ -232,8 +232,8 @@ PathProbeType::visit (HIR::ConstantItem &constant)
     {
       HirId tyid = constant.get_mappings ().get_hirid ();
       TyTy::BaseType *ty = nullptr;
-      bool ok = query_type (tyid, &ty);
-      rust_assert (ok);
+      if (!query_type (tyid, &ty))
+       return;
 
       PathProbeCandidate::ImplItemCandidate impl_item_candidate{&constant,
                                                                current_impl};
@@ -252,8 +252,8 @@ PathProbeType::visit (HIR::Function &function)
     {
       HirId tyid = function.get_mappings ().get_hirid ();
       TyTy::BaseType *ty = nullptr;
-      bool ok = query_type (tyid, &ty);
-      rust_assert (ok);
+      if (!query_type (tyid, &ty))
+       return;
 
       PathProbeCandidate::ImplItemCandidate impl_item_candidate{&function,
                                                                current_impl};