aboutsummaryrefslogtreecommitdiff
path: root/gcc
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
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')
-rw-r--r--gcc/rust/resolve/rust-late-name-resolver-2.0.cc8
-rw-r--r--gcc/testsuite/rust/compile/nr2/exclude15
2 files changed, 23 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 ();
diff --git a/gcc/testsuite/rust/compile/nr2/exclude b/gcc/testsuite/rust/compile/nr2/exclude
index d53c148..5cc7cf7 100644
--- a/gcc/testsuite/rust/compile/nr2/exclude
+++ b/gcc/testsuite/rust/compile/nr2/exclude
@@ -58,6 +58,7 @@ iterators1.rs
lookup_err1.rs
macros/mbe/macro13.rs
macros/mbe/macro15.rs
+macros/mbe/macro20.rs
macros/mbe/macro23.rs
macros/mbe/macro40.rs
macros/mbe/macro43.rs
@@ -151,4 +152,18 @@ derive_macro6.rs
issue-2987.rs
issue-3139-1.rs
issue-3139-3.rs
+issue-1019.rs
+issue-1034.rs
+issue-2019-1.rs
+issue-2019-2.rs
+issue-2019-3.rs
+issue-2105.rs
+issue-2190-1.rs
+issue-2190-2.rs
+issue-2304.rs
+issue-2747.rs
+issue-2953-1.rs
+issue-3030.rs
+traits12.rs
+try-trait.rs
# please don't delete the trailing newline