From: Arthur Cohen Date: Wed, 25 Dec 2024 11:07:17 +0000 (+0000) Subject: gccrs: typecheck: Add note about erorring out on additional trait bounds. X-Git-Tag: basepoints/gcc-16~974 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=36dfbd985e7060bafc78aca8b85f9d71dac503c3;p=thirdparty%2Fgcc.git gccrs: typecheck: Add note about erorring out on additional trait bounds. 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. --- diff --git a/gcc/rust/typecheck/rust-hir-type-check-type.cc b/gcc/rust/typecheck/rust-hir-type-check-type.cc index e9859a71f83..e9207effafb 100644 --- a/gcc/rust/typecheck/rust-hir-type-check-type.cc +++ b/gcc/rust/typecheck/rust-hir-type-check-type.cc @@ -757,6 +757,11 @@ TypeCheckType::visit (HIR::TraitObjectType &type) std::vector 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;