diff options
author | Philip Herron <herron.philip@googlemail.com> | 2025-05-07 16:07:43 +0100 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2025-05-08 09:01:20 +0000 |
commit | fc6b54365731c2ebfa1974058c48772e03203fdd (patch) | |
tree | ef6a38b428a94f3695943799bbaa839d915a6e41 /gcc/fortran/parse.cc | |
parent | 11d46d45c3b61169b4466d7bcf2cabb7e79dbb07 (diff) | |
download | gcc-fc6b54365731c2ebfa1974058c48772e03203fdd.zip gcc-fc6b54365731c2ebfa1974058c48772e03203fdd.tar.gz gcc-fc6b54365731c2ebfa1974058c48772e03203fdd.tar.bz2 |
gccrs: Prevent passing generic arguments to impl traits in argument position
When using impl traits in argument position (APIT), they are desugared into generics,
and supplying explicit generic arguments is not allowed. This commit adds the error
diagnostic E0632 for attempting to pass generic arguments to impl traits, completing
the implementation of the APIT feature.
gcc/rust/ChangeLog:
* ast/rust-desugar-apit.cc: track if this is a impl-trait generic
* ast/rust-item.h (class TypeParam): add field to track if from impl trait
* hir/rust-ast-lower-type.cc (ASTLowerGenericParam::visit): likewise
* hir/tree/rust-hir-item.cc (TypeParam::TypeParam): upate hir as well
(TypeParam::operator=): likewise
* hir/tree/rust-hir-item.h (class TypeParam): likewise
* typecheck/rust-tyty-subst.cc (SubstitutionParamMapping::get_generic_param): add error
* typecheck/rust-tyty-subst.h: add const getter for the associated TypeParm
gcc/testsuite/ChangeLog:
* rust/compile/nr2/exclude: nr2 cant handle this
* rust/compile/impl_trait_generic_arg.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
Diffstat (limited to 'gcc/fortran/parse.cc')
0 files changed, 0 insertions, 0 deletions