aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/resolve/rust-late-name-resolver-2.0.cc
diff options
context:
space:
mode:
authorOwen Avery <powerboat9.gamer@gmail.com>2025-01-21 17:02:35 -0500
committerP-E-P <32375388+P-E-P@users.noreply.github.com>2025-01-23 13:48:47 +0000
commit0a125366559a88a6daa1235a43d6f98651783cf0 (patch)
tree2798d4920444bff016d2fb83d5ceabbaaba9585c /gcc/rust/resolve/rust-late-name-resolver-2.0.cc
parent3638b0551e48f7a9b292409f750174727ea7a5e2 (diff)
downloadgcc-0a125366559a88a6daa1235a43d6f98651783cf0.zip
gcc-0a125366559a88a6daa1235a43d6f98651783cf0.tar.gz
gcc-0a125366559a88a6daa1235a43d6f98651783cf0.tar.bz2
Check for type paths nr2.0 can't handle yet
Some of our tests only work with name resolution 2.0 because the latter misinterprets type paths. This change should cause the compiler to error out if it would otherwise misinterpret a type path. A fix for type path resolution isn't included in this comment, since doing so would make it harder to track the meaningfulness of test regressions. gcc/rust/ChangeLog: * resolve/rust-late-name-resolver-2.0.cc (Late::visit): Error out if a type path has multiple segments, as we currently ignore every segment except the last. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Add entries. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
Diffstat (limited to 'gcc/rust/resolve/rust-late-name-resolver-2.0.cc')
-rw-r--r--gcc/rust/resolve/rust-late-name-resolver-2.0.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/rust/resolve/rust-late-name-resolver-2.0.cc b/gcc/rust/resolve/rust-late-name-resolver-2.0.cc
index a7408fb..7c69485 100644
--- a/gcc/rust/resolve/rust-late-name-resolver-2.0.cc
+++ b/gcc/rust/resolve/rust-late-name-resolver-2.0.cc
@@ -287,6 +287,14 @@ Late::visit (AST::TypePath &type)
// maybe we can overload `resolve_path<Namespace::Types>` to only do
// typepath-like path resolution? that sounds good
+ if (type.get_segments ().size () != 1)
+ {
+ rust_sorry_at (
+ type.get_locus (),
+ "name resolution 2.0 cannot resolve multi-segment type paths");
+ return;
+ }
+
auto str = type.get_segments ().back ()->get_ident_segment ().as_string ();
auto values = ctx.types.peek ().get_values ();