Skip to content

Commit 8b5f1f2

Browse files
committed
gccrs: fix ice when setting up regions
num regions is based on the used arguments of regions which can be less than the substutions requirements. So lets check for that and allow anon regions to be created for them. Fixes #3605 gcc/rust/ChangeLog: * typecheck/rust-tyty-subst.h: check for min range gcc/testsuite/ChangeLog: * rust/compile/issue-3605.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
1 parent 6130523 commit 8b5f1f2

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

gcc/rust/typecheck/rust-tyty-subst.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ class RegionParamList
125125
std::vector<Region> subst)
126126
{
127127
RegionParamList list (num_regions);
128-
for (size_t i = 0; i < subst.size (); i++)
128+
for (size_t i = 0; i < MIN (num_regions, subst.size ()); i++)
129129
list.regions.at (i) = subst.at (i);
130130
for (size_t i = subst.size (); i < num_regions; i++)
131131
{
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
enum Foo<'a> {}
2+
3+
enum Bar<'a> {
4+
in_band_def_explicit_impl(Foo<'a>),
5+
}

0 commit comments

Comments
 (0)