[gccrs COMMIT 2/2] gccrs: Fix missing unconstrained check to look at the full argument
gerris.rs@gmail.com
gerris.rs@gmail.com
Mon Aug 31 22:29:56 GMT 2026
From: Philip Herron <herron.philip@googlemail.com>
Fixes Rust-GCC/gccrs#4822
gcc/rust/ChangeLog:
* typecheck/rust-hir-type-check-base.cc (walk_type_to_constrain): prototype
(walk_types_to_constrain): make sure to walk the argument too
gcc/testsuite/ChangeLog:
* rust/compile/issue-4822.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
---
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/40ce8273c361de572b4c60bbabc11c9a2c1eb97b
The commit has been mentioned in the following issue(s):
- Rust-GCC/gccrs#4822: https://github.com/Rust-GCC/gccrs/issues/4822
The commit has been mentioned in the following pull-request(s):
- https://github.com/Rust-GCC/gccrs/pull/4825
gcc/rust/typecheck/rust-hir-type-check-base.cc | 5 ++++-
gcc/testsuite/rust/compile/issue-4822.rs | 11 +++++++++++
2 files changed, 15 insertions(+), 1 deletion(-)
create mode 100644 gcc/testsuite/rust/compile/issue-4822.rs
diff --git a/gcc/rust/typecheck/rust-hir-type-check-base.cc b/gcc/rust/typecheck/rust-hir-type-check-base.cc
index 97ff55400..b53232a57 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-base.cc
+++ b/gcc/rust/typecheck/rust-hir-type-check-base.cc
@@ -26,7 +26,6 @@
#include "rust-type-util.h"
#include "rust-attribute-values.h"
#include "rust-tyty.h"
-#include "tree.h"
namespace Rust {
namespace Resolver {
@@ -58,6 +57,9 @@ TypeCheckBase::ResolvePredicateFromBound (
is_qualified_type, is_super_trait);
}
+static void walk_type_to_constrain (std::set<HirId> &constrained_symbols,
+ TyTy::BaseType &r);
+
static void
walk_types_to_constrain (std::set<HirId> &constrained_symbols,
const TyTy::SubstitutionArgumentMappings &constraints)
@@ -70,6 +72,7 @@ walk_types_to_constrain (std::set<HirId> &constrained_symbols,
const auto p = arg->get_root ();
constrained_symbols.insert (p->get_ref ());
constrained_symbols.insert (p->get_ty_ref ());
+ walk_type_to_constrain (constrained_symbols, *arg);
if (p->has_substitutions_defined ())
{
diff --git a/gcc/testsuite/rust/compile/issue-4822.rs b/gcc/testsuite/rust/compile/issue-4822.rs
new file mode 100644
index 000000000..45641ad3c
--- /dev/null
+++ b/gcc/testsuite/rust/compile/issue-4822.rs
@@ -0,0 +1,11 @@
+#![feature(lang_items, no_core)]
+#![no_core]
+
+#[lang = "sized"]
+trait Sized {}
+
+trait PartialEq<Rhs> {}
+
+impl<A, B, const N: usize> PartialEq<[B; N]> for [A; N] {}
+
+fn main() {}
--
2.55.0
More information about the Gcc-rust
mailing list