diff --git a/gcc/rust/typecheck/rust-tyty-subst.cc b/gcc/rust/typecheck/rust-tyty-subst.cc index 5a753566d48..71d41d6f796 100644 --- a/gcc/rust/typecheck/rust-tyty-subst.cc +++ b/gcc/rust/typecheck/rust-tyty-subst.cc @@ -589,6 +589,17 @@ SubstitutionRef::get_used_arguments () const return used_arguments; } +tl::optional<SubstitutionArg> +SubstitutionRef::get_arg_at (size_t i) const +{ + auto param_ty = get_substs ().at (i).get_param_ty (); + SubstitutionArg arg = SubstitutionArg::error (); + get_used_arguments ().get_argument_for_symbol (param_ty, &arg); + if (arg.is_error ()) + return tl::nullopt; + return arg; +} + const RegionConstraints & SubstitutionRef::get_region_constraints () const {