public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] The number of required substituions is offset from the already substituted
@ 2022-06-08 11:41 Thomas Schwinge
0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2022-06-08 11:41 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:b538aa91056a10b31c54580316c49c764f884d67
commit b538aa91056a10b31c54580316c49c764f884d67
Author: Philip Herron <philip.herron@embecosm.com>
Date: Thu Oct 21 18:27:37 2021 +0100
The number of required substituions is offset from the already substituted
When doing HIR::GenericArgs substitutions we must offset from the already
partially substituted arguments.
Diff:
---
gcc/rust/typecheck/rust-tyty.cc | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/gcc/rust/typecheck/rust-tyty.cc b/gcc/rust/typecheck/rust-tyty.cc
index f08d8cb200d..a361653bc0c 100644
--- a/gcc/rust/typecheck/rust-tyty.cc
+++ b/gcc/rust/typecheck/rust-tyty.cc
@@ -357,7 +357,9 @@ SubstitutionRef::get_mappings_from_generic_args (HIR::GenericArgs &args)
return SubstitutionArgumentMappings::error ();
}
- if (args.get_type_args ().size () > substitutions.size ())
+ // for inherited arguments
+ size_t offs = used_arguments.size ();
+ if (args.get_type_args ().size () + offs > substitutions.size ())
{
RichLocation r (args.get_locus ());
r.add_range (substitutions.front ().get_param_locus ());
@@ -369,7 +371,7 @@ SubstitutionRef::get_mappings_from_generic_args (HIR::GenericArgs &args)
return SubstitutionArgumentMappings::error ();
}
- if (args.get_type_args ().size () < min_required_substitutions ())
+ if (args.get_type_args ().size () + offs < min_required_substitutions ())
{
RichLocation r (args.get_locus ());
r.add_range (substitutions.front ().get_param_locus ());
@@ -381,9 +383,6 @@ SubstitutionRef::get_mappings_from_generic_args (HIR::GenericArgs &args)
return SubstitutionArgumentMappings::error ();
}
- // for inherited arguments
- size_t offs = used_arguments.size ();
-
std::vector<SubstitutionArg> mappings;
for (auto &arg : args.get_type_args ())
{
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-06-08 11:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-08 11:41 [gcc/devel/rust/master] The number of required substituions is offset from the already substituted Thomas Schwinge
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).