aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/rust/typecheck/rust-hir-type-check-expr.h6
-rw-r--r--gcc/testsuite/rust/compile/torture/bools_eq.rs18
2 files changed, 20 insertions, 4 deletions
diff --git a/gcc/rust/typecheck/rust-hir-type-check-expr.h b/gcc/rust/typecheck/rust-hir-type-check-expr.h
index d88cb0b..a833822 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-expr.h
+++ b/gcc/rust/typecheck/rust-hir-type-check-expr.h
@@ -630,10 +630,8 @@ public:
if (result == nullptr || result->get_kind () == TyTy::TypeKind::ERROR)
return;
- // we expect this to be
- infered = new TyTy::BoolType (expr.get_mappings ().get_hirid ());
- infered->append_reference (lhs->get_ref ());
- infered->append_reference (rhs->get_ref ());
+ bool ok = context->lookup_builtin ("bool", &infered);
+ rust_assert (ok);
}
void visit (HIR::LazyBooleanExpr &expr) override
diff --git a/gcc/testsuite/rust/compile/torture/bools_eq.rs b/gcc/testsuite/rust/compile/torture/bools_eq.rs
new file mode 100644
index 0000000..965127b
--- /dev/null
+++ b/gcc/testsuite/rust/compile/torture/bools_eq.rs
@@ -0,0 +1,18 @@
+extern "C"
+{
+ fn abort ();
+}
+
+fn beq (a: bool, b: bool) -> bool
+{
+ let bools_eq = a == b;
+ bools_eq
+}
+
+pub fn main ()
+{
+ let a = true;
+ let b = false;
+ let r = beq (a, b);
+ if r { unsafe { abort (); } }
+}