aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust
diff options
context:
space:
mode:
authorPhilip Herron <herron.philip@googlemail.com>2024-02-03 11:34:30 +0000
committerArthur Cohen <arthur.cohen@embecosm.com>2024-02-07 12:40:23 +0100
commitf1d0b22c79316d8ee403c83be55ef45186bea38a (patch)
tree62dfc3d3006155ebef7211c55181749146d2f30f /gcc/rust
parent1c649ac36f1eab8094fb0a697c001e064c031ac1 (diff)
downloadgcc-f1d0b22c79316d8ee403c83be55ef45186bea38a.zip
gcc-f1d0b22c79316d8ee403c83be55ef45186bea38a.tar.gz
gcc-f1d0b22c79316d8ee403c83be55ef45186bea38a.tar.bz2
gccrs: remove old generics hack to reuse generic symbols from previous seg
This patch introduces one regression because generics are getting better understood over time. The code here used to apply generics with the same symbol from previous segments which was a bit of a hack with out limited inference variable support. The regression looks like it will be related to another issue which needs to default integer inference variables much more aggresivly to default integer. Fixes #2723 gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_segments): remove hack gcc/testsuite/ChangeLog: * rust/compile/issue-1773.rs: Moved to... * rust/compile/issue-1773.rs.bak: ...here. * rust/compile/issue-2723-1.rs: New test. * rust/compile/issue-2723-2.rs: New test.
Diffstat (limited to 'gcc/rust')
-rw-r--r--gcc/rust/typecheck/rust-hir-type-check-path.cc21
1 files changed, 2 insertions, 19 deletions
diff --git a/gcc/rust/typecheck/rust-hir-type-check-path.cc b/gcc/rust/typecheck/rust-hir-type-check-path.cc
index ea7d842..ad31fb7 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-path.cc
+++ b/gcc/rust/typecheck/rust-hir-type-check-path.cc
@@ -456,27 +456,10 @@ TypeCheckExpr::resolve_segments (NodeId root_resolved_node_id,
}
}
- if (tyseg->needs_generic_substitutions ())
- {
- if (!prev_segment->needs_generic_substitutions ())
- {
- auto used_args_in_prev_segment
- = GetUsedSubstArgs::From (prev_segment);
-
- if (!used_args_in_prev_segment.is_error ())
- {
- if (SubstMapperInternal::mappings_are_bound (
- tyseg, used_args_in_prev_segment))
- {
- tyseg = SubstMapperInternal::Resolve (
- tyseg, used_args_in_prev_segment);
- }
- }
- }
- }
-
if (seg.has_generic_args ())
{
+ rust_debug_loc (seg.get_locus (), "applying segment generics: %s",
+ tyseg->as_string ().c_str ());
tyseg
= SubstMapper::Resolve (tyseg, expr_locus, &seg.get_generic_args (),
context->regions_from_generic_args (