]> 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)
committerArthur Cohen <arthur.cohen@embecosm.com>
Mon, 28 Apr 2025 14:18:54 +0000 (16:18 +0200)
commita79bad18a1e83a731731fa621128ca16931c72b1
tree14f3bc5201b97a9cca9074ddaef0aacace6643fa
parent201d5ac8ff38d687a89ef86f3174d744b5296a34
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