diff options
author | Philip Herron <herron.philip@googlemail.com> | 2025-05-05 21:07:20 +0100 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2025-05-07 12:04:19 +0000 |
commit | ef44f649655dcbba63b925c06e923ed1aefd6678 (patch) | |
tree | 2df1721f870a7d3d1266347a5333d24f82ce3e1a /gcc/rust/parse/rust-parse-impl.h | |
parent | 5599bf49cdf6d89f7e1f4e13b150b43d2cf6dca3 (diff) | |
download | gcc-ef44f649655dcbba63b925c06e923ed1aefd6678.zip gcc-ef44f649655dcbba63b925c06e923ed1aefd6678.tar.gz gcc-ef44f649655dcbba63b925c06e923ed1aefd6678.tar.bz2 |
gccrs: Emit error diagnostic for bad impl type usage
Rust only allows impl traits to be used in the return position of
functions.
Fixes Rust-GCC#1485
gcc/rust/ChangeLog:
* hir/rust-ast-lower-implitem.cc (ASTLowerImplItem::visit): allow impl type
* hir/rust-ast-lower-item.cc (ASTLoweringItem::visit): likewise
* hir/rust-ast-lower-type.cc (ASTLoweringType::ASTLoweringType): new flag for impl trait
(ASTLoweringType::translate): pass flag
(ASTLoweringType::visit): track impl trait tag
(ASTLoweringType::emit_impl_trait_error): new diagnostic
* hir/rust-ast-lower-type.h: add new field
gcc/testsuite/ChangeLog:
* rust/compile/impl_trait_diag.rs: New test.
* rust/compile/issue-1485.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
Diffstat (limited to 'gcc/rust/parse/rust-parse-impl.h')
0 files changed, 0 insertions, 0 deletions