aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/resolve
diff options
context:
space:
mode:
authorPhilip Herron <herron.philip@googlemail.com>2023-06-20 16:39:25 +0100
committerPhilip Herron <philip.herron@embecosm.com>2023-06-21 09:00:30 +0000
commit8e2619254f7f53d2637148a13e1d5c8e26447c41 (patch)
tree5e3aba1ceb56085794365150ca704711ec5d9c6d /gcc/rust/resolve
parent7bb7c2a44e6e2b3ea6f95891ee60e2b91cc8cd59 (diff)
downloadgcc-8e2619254f7f53d2637148a13e1d5c8e26447c41.zip
gcc-8e2619254f7f53d2637148a13e1d5c8e26447c41.tar.gz
gcc-8e2619254f7f53d2637148a13e1d5c8e26447c41.tar.bz2
gccrs: Fix generic argument tracking
When we do generic argument substitution we creating mappings of the HIR::GenericArgs argument to the TyTy::SubstitutionParam as a pointer. So for example when we have Generic Parameters <Self, T> and arguments <T, U> T0: Arguments: <Self=T, T=U> T1: Self -> replaced-with T T2: Arguments: <T=T, T=U> T3: T maps back to the replace Self->T T4: Arguments <T=T, T=T> Which is wrong but because we do a string comparison to find the argument mapping we cant reply on the pointer to the origin parameter mapping as the parameter will be updated resulting in bad mappings. This patch changes the Argument mappings to track the _original_ parameter type so that lookup's for the mappings use this symbol instead not the updated ones during substitution. Addresses #1893 gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_segments): simplify lookup of the respective predicate * typecheck/rust-tyty-subst.cc (SubstitutionArg::SubstitutionArg): track original parameter (SubstitutionArg::operator=): update copy ctor (SubstitutionArg::get_param_ty): use original param (SubstitutionArg::as_string): update as_string * typecheck/rust-tyty-subst.h: add new private field Signed-off-by: Philip Herron <herron.philip@googlemail.com>
Diffstat (limited to 'gcc/rust/resolve')
0 files changed, 0 insertions, 0 deletions