diff options
author | Philip Herron <herron.philip@googlemail.com> | 2025-04-02 21:02:44 +0100 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2025-04-04 08:19:30 +0000 |
commit | 8022ca11ed991cba51843c3226e4de9c2b795ecc (patch) | |
tree | a391150055591aa9dceb54e233bae4b4af6ab6f8 /gcc/rust/resolve | |
parent | 314090971a51037bb77e36b46c7a10652b9e6c3f (diff) | |
download | gcc-8022ca11ed991cba51843c3226e4de9c2b795ecc.zip gcc-8022ca11ed991cba51843c3226e4de9c2b795ecc.tar.gz gcc-8022ca11ed991cba51843c3226e4de9c2b795ecc.tar.bz2 |
gccrs: Fix ICE when hitting invalid types for generics
We need to check upfront if the type is valid or not. Then
error with a decent message.
Fixes Rust-GCC#3643
Fixes Rust-GCC#3646
Fixes Rust-GCC#3654
Fixes Rust-GCC#3663
Fixes Rust-GCC#3671
gcc/rust/ChangeLog:
* resolve/rust-ast-resolve-type.cc (ResolveRelativeTypePath::go): fix error msg
* typecheck/rust-substitution-mapper.cc (SubstMapper::Resolve): add validation
(SubstMapper::valid_type): new check
(SubstMapper::visit): check if can resolve
* typecheck/rust-substitution-mapper.h: new prototype
gcc/testsuite/ChangeLog:
* rust/compile/nr2/exclude: nr2 is missing type path error
* rust/compile/issue-3643.rs: New test.
* rust/compile/issue-3646.rs: New test.
* rust/compile/issue-3654.rs: New test.
* rust/compile/issue-3663.rs: New test.
* rust/compile/issue-3671.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
Diffstat (limited to 'gcc/rust/resolve')
-rw-r--r-- | gcc/rust/resolve/rust-ast-resolve-type.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/rust/resolve/rust-ast-resolve-type.cc b/gcc/rust/resolve/rust-ast-resolve-type.cc index c1c4022..135504e 100644 --- a/gcc/rust/resolve/rust-ast-resolve-type.cc +++ b/gcc/rust/resolve/rust-ast-resolve-type.cc @@ -357,7 +357,7 @@ ResolveRelativeTypePath::go (AST::TypePath &path, NodeId &resolved_node_id) { rust_error_at (segment->get_locus (), ErrorCode::E0412, "could not resolve type path %qs", - segment->as_string ().c_str ()); + segment->get_ident_segment ().as_string ().c_str ()); return false; } } |