aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorOwen Avery <powerboat9.gamer@gmail.com>2025-02-09 15:16:59 -0500
committerP-E-P <32375388+P-E-P@users.noreply.github.com>2025-03-19 11:20:29 +0000
commitc27eac3b5778d65ab14ac2db723763d26859f91a (patch)
tree50d14cba73e832d59e1b1d664f7c0f374f81ab73 /gcc
parent2c05d5858b708c6615430e5d01dc93f278e50dbc (diff)
downloadgcc-c27eac3b5778d65ab14ac2db723763d26859f91a.zip
gcc-c27eac3b5778d65ab14ac2db723763d26859f91a.tar.gz
gcc-c27eac3b5778d65ab14ac2db723763d26859f91a.tar.bz2
nr2.0: Fix test self-path2.rs
gcc/rust/ChangeLog: * resolve/rust-ast-resolve-path.cc (ResolvePath::resolve_path): Adjust the error message for a lower self segment in the middle of a path. * resolve/rust-ast-resolve-type.cc (ResolveRelativeTypePath::go): Likewise. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove self-path2.rs * rust/compile/self-path2.rs: Adjust expected errors. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/rust/resolve/rust-ast-resolve-path.cc4
-rw-r--r--gcc/rust/resolve/rust-ast-resolve-type.cc4
-rw-r--r--gcc/testsuite/rust/compile/nr2/exclude1
-rw-r--r--gcc/testsuite/rust/compile/self-path2.rs4
4 files changed, 6 insertions, 7 deletions
diff --git a/gcc/rust/resolve/rust-ast-resolve-path.cc b/gcc/rust/resolve/rust-ast-resolve-path.cc
index 9fefc0f..656b7e6 100644
--- a/gcc/rust/resolve/rust-ast-resolve-path.cc
+++ b/gcc/rust/resolve/rust-ast-resolve-path.cc
@@ -68,8 +68,8 @@ ResolvePath::resolve_path (AST::PathInExpression &expr)
if (in_middle_of_path && segment.is_lower_self_seg ())
{
rust_error_at (segment.get_locus (), ErrorCode::E0433,
- "failed to resolve: %<%s%> in paths can only be used "
- "in start position",
+ "leading path segment %qs can only be used at the "
+ "beginning of a path",
segment.as_string ().c_str ());
return UNKNOWN_NODEID;
}
diff --git a/gcc/rust/resolve/rust-ast-resolve-type.cc b/gcc/rust/resolve/rust-ast-resolve-type.cc
index 22af563..2432917 100644
--- a/gcc/rust/resolve/rust-ast-resolve-type.cc
+++ b/gcc/rust/resolve/rust-ast-resolve-type.cc
@@ -176,8 +176,8 @@ ResolveRelativeTypePath::go (AST::TypePath &path, NodeId &resolved_node_id)
if (in_middle_of_path && segment->is_lower_self_seg ())
{
rust_error_at (segment->get_locus (), ErrorCode::E0433,
- "failed to resolve: %qs in paths can only be used "
- "in start position",
+ "leading path segment %qs can only be used at the "
+ "beginning of a path",
segment->as_string ().c_str ());
return false;
}
diff --git a/gcc/testsuite/rust/compile/nr2/exclude b/gcc/testsuite/rust/compile/nr2/exclude
index a4bac9a..a2a833f 100644
--- a/gcc/testsuite/rust/compile/nr2/exclude
+++ b/gcc/testsuite/rust/compile/nr2/exclude
@@ -28,7 +28,6 @@ pub_restricted_2.rs
pub_restricted_3.rs
redef_error2.rs
redef_error5.rs
-self-path2.rs
sizeof-stray-infer-var-bug.rs
struct-expr-parse.rs
undeclared_label.rs
diff --git a/gcc/testsuite/rust/compile/self-path2.rs b/gcc/testsuite/rust/compile/self-path2.rs
index b9b82ca..6441c33 100644
--- a/gcc/testsuite/rust/compile/self-path2.rs
+++ b/gcc/testsuite/rust/compile/self-path2.rs
@@ -11,11 +11,11 @@ fn baz() {
crate::bar();
crate::self::foo();
- // { dg-error "failed to resolve: .self. in paths can only be used in start position" "" { target *-*-* } .-1 }
+ // { dg-error "leading path segment .self. can only be used at the beginning of a path" "" { target *-*-* } .-1 }
}
type a = foo;
type b = crate::foo;
type c = self::foo;
type d = crate::self::foo;
-// { dg-error "failed to resolve: .self. in paths can only be used in start position" "" { target *-*-* } .-1 }
+// { dg-error "leading path segment .self. can only be used at the beginning of a path" "" { target *-*-* } .-1 }