]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: typecheck: Add note about erorring out on additional trait bounds.
authorArthur Cohen <arthur.cohen@embecosm.com>
Wed, 25 Dec 2024 11:07:17 +0000 (11:07 +0000)
committerArthur Cohen <arthur.cohen@embecosm.com>
Fri, 21 Mar 2025 11:55:43 +0000 (12:55 +0100)
If additional trait bounds aren't auto traits, then the typechecker
must error out (Rust-GCC#3008)

gcc/rust/ChangeLog:

* typecheck/rust-hir-type-check-type.cc: Add TODO note.

gcc/rust/typecheck/rust-hir-type-check-type.cc

index e9859a71f8323098388a5c478762c9a39dafd62c..e9207effafb7c2b99b315e37692e5efaef04b384 100644 (file)
@@ -757,6 +757,11 @@ TypeCheckType::visit (HIR::TraitObjectType &type)
   std::vector<TyTy::TypeBoundPredicate> specified_bounds;
   for (auto &bound : type.get_type_param_bounds ())
     {
+      // TODO: here we need to check if there are additional bounds that aren't
+      // auto traits. this is an error. for example, `dyn A + Sized + Sync` is
+      // okay, because Sized and Sync are both auto traits but `dyn A + Copy +
+      // Clone` is not okay and should error out.
+
       if (bound->get_bound_type ()
          != HIR::TypeParamBound::BoundType::TRAITBOUND)
        continue;