]> git.ipfire.org Git - thirdparty/gcc.git/commit
rust: fix ICE during name resolution for impls on unit-types
authorPhilip Herron <herron.philip@googlemail.com>
Fri, 20 Sep 2024 16:38:14 +0000 (17:38 +0100)
committerPhilip Herron <philip.herron@embecosm.com>
Fri, 27 Sep 2024 11:55:56 +0000 (11:55 +0000)
commit18422c9c386ca49f8427cdd26a882749603d6da8
tree3827d8dfce1764e47243a06f273bacb26d102929
parentc6a479fb9312b9166ca94a588aa85c9172f5ae19
rust: fix ICE during name resolution for impls on unit-types

The canonical paths need to support unit-types which are technically a
TupleType with no fields. This handles this case and adds an unreachable.

Fixes #3036

gcc/rust/ChangeLog:

* resolve/rust-ast-resolve-type.cc (ResolveTypeToCanonicalPath::visit): add unit-type catch
* resolve/rust-ast-resolve-type.h: likewise

gcc/testsuite/ChangeLog:

* rust/compile/nr2/exclude: nr2 cant handle this
* rust/compile/issue-3036.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
gcc/rust/resolve/rust-ast-resolve-type.cc
gcc/rust/resolve/rust-ast-resolve-type.h
gcc/testsuite/rust/compile/issue-3036.rs [new file with mode: 0644]
gcc/testsuite/rust/compile/nr2/exclude