]> git.ipfire.org Git - thirdparty/gcc.git/commit
gccrs: Fix ICE in struct expressions
authorPhilip Herron <herron.philip@googlemail.com>
Thu, 17 Apr 2025 13:38:04 +0000 (14:38 +0100)
committerPhilip Herron <philip.herron@embecosm.com>
Fri, 18 Apr 2025 09:45:18 +0000 (09:45 +0000)
commite77b7c22ab159f967fc2e0bca59468d0df08a023
tree6cde3d0cf1238c9f2acea46854bb42285ded8d92
parent5a2d06037c7e0b0f06543db17b8376b6a6fceeb3
gccrs: Fix ICE in struct expressions

The error handling here was done long ago when we didnt know how to do
any error handling very well. This removed bad fatal_errors and adds in
some nice rich_location error diagnostics instead.

Fixes Rust-GCC#3628

gcc/rust/ChangeLog:

* typecheck/rust-hir-type-check-struct-field.h: keep reference to parent expression
* typecheck/rust-hir-type-check-struct.cc (TypeCheckStructExpr::TypeCheckStructExpr):
update ctor
(TypeCheckStructExpr::resolve): remove bad rust_fatal_errors
(TypeCheckStructExpr::visit): cleanup errors

gcc/testsuite/ChangeLog:

* rust/compile/macros/mbe/macro-issue2983_2984.rs: cleanup error diagnotics
* rust/compile/struct_init1.rs: likewise
* rust/compile/issue-3628.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
gcc/rust/typecheck/rust-hir-type-check-struct-field.h
gcc/rust/typecheck/rust-hir-type-check-struct.cc
gcc/testsuite/rust/compile/issue-3628.rs [new file with mode: 0644]
gcc/testsuite/rust/compile/macros/mbe/macro-issue2983_2984.rs
gcc/testsuite/rust/compile/struct_init1.rs