aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust
diff options
context:
space:
mode:
authorPhilip Herron <herron.philip@googlemail.com>2023-06-14 12:11:38 +0100
committerPhilip Herron <philip.herron@embecosm.com>2023-06-14 15:30:31 +0000
commitb028c7ece2ad67236e55a38b776c0bf70408a53e (patch)
tree75df66e6a72f5e4d0dc0c0c811ad88239eb1827e /gcc/rust
parentd1e10de0014401a1e31ba87003cdcf157439cae3 (diff)
downloadgcc-b028c7ece2ad67236e55a38b776c0bf70408a53e.zip
gcc-b028c7ece2ad67236e55a38b776c0bf70408a53e.tar.gz
gcc-b028c7ece2ad67236e55a38b776c0bf70408a53e.tar.bz2
gccrs: we can't check the bounds involving empty placeholder types
We use placeholders for assoicated types on traits but if we are unifying types against a placeholder its not possible to check the bounds as the placeholder does not have enough information yet at this point to determine if bounds will or won't be satisfied. That check will occur when associated types and generics are setup. Fixes #2036 gcc/rust/ChangeLog: * typecheck/rust-unify.cc (UnifyRules::go): dont check bounds on placeholders gcc/testsuite/ChangeLog: * rust/compile/issue-2036.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
Diffstat (limited to 'gcc/rust')
-rw-r--r--gcc/rust/typecheck/rust-unify.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/rust/typecheck/rust-unify.cc b/gcc/rust/typecheck/rust-unify.cc
index d7c5c18..ea1b582 100644
--- a/gcc/rust/typecheck/rust-unify.cc
+++ b/gcc/rust/typecheck/rust-unify.cc
@@ -151,7 +151,11 @@ UnifyRules::go ()
rtype->debug_str ().c_str ());
// check bounds
- bool should_check_bounds = !ltype->is_equal (*rtype);
+ bool ltype_is_placeholder = ltype->get_kind () == TyTy::TypeKind::PLACEHOLDER;
+ bool rtype_is_placeholder = rtype->get_kind () == TyTy::TypeKind::PLACEHOLDER;
+ bool types_equal = ltype->is_equal (*rtype);
+ bool should_check_bounds
+ = !types_equal && !(ltype_is_placeholder || rtype_is_placeholder);
if (should_check_bounds)
{
if (ltype->num_specified_bounds () > 0)