aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/resolve
diff options
context:
space:
mode:
authorOwen Avery <powerboat9.gamer@gmail.com>2025-04-17 16:51:21 -0400
committerP-E-P <32375388+P-E-P@users.noreply.github.com>2025-04-18 15:34:51 +0000
commit47d55fe8cb022d11b7899f8e93761a61ee38c583 (patch)
tree3752ed49eb6f739910660969393b413e735837e6 /gcc/rust/resolve
parentf81ec04bfde4e771998b44dd5c685069d1229652 (diff)
downloadgcc-47d55fe8cb022d11b7899f8e93761a61ee38c583.zip
gcc-47d55fe8cb022d11b7899f8e93761a61ee38c583.tar.gz
gcc-47d55fe8cb022d11b7899f8e93761a61ee38c583.tar.bz2
Adjust segment start position errors
gcc/rust/ChangeLog: * resolve/rust-ast-resolve-path.cc (ResolvePath::resolve_path): Adjust error messages. * resolve/rust-ast-resolve-type.cc (ResolveRelativeTypePath::go): Likewise. * resolve/rust-forever-stack.hxx (check_leading_kw_at_start): Likewise. gcc/testsuite/ChangeLog: * rust/compile/issue-3568.rs: Adjust expected errors. * rust/compile/name_resolution9.rs: Likewise. * rust/compile/self-path2.rs: Likewise. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
Diffstat (limited to 'gcc/rust/resolve')
-rw-r--r--gcc/rust/resolve/rust-ast-resolve-path.cc8
-rw-r--r--gcc/rust/resolve/rust-ast-resolve-type.cc3
-rw-r--r--gcc/rust/resolve/rust-forever-stack.hxx7
3 files changed, 8 insertions, 10 deletions
diff --git a/gcc/rust/resolve/rust-ast-resolve-path.cc b/gcc/rust/resolve/rust-ast-resolve-path.cc
index 530926d..fb6715d 100644
--- a/gcc/rust/resolve/rust-ast-resolve-path.cc
+++ b/gcc/rust/resolve/rust-ast-resolve-path.cc
@@ -68,8 +68,7 @@ ResolvePath::resolve_path (AST::PathInExpression &expr)
if (in_middle_of_path && segment.is_lower_self_seg ())
{
rust_error_at (segment.get_locus (), ErrorCode::E0433,
- "leading path segment %qs can only be used at the "
- "beginning of a path",
+ "%qs in paths can only be used in start position",
segment.as_string ().c_str ());
return UNKNOWN_NODEID;
}
@@ -372,8 +371,9 @@ ResolvePath::resolve_path (AST::SimplePath &expr)
{
if (!is_first_segment)
{
- rust_error_at (segment.get_locus (),
- "%<super%> can only be used in start position");
+ rust_error_at (
+ segment.get_locus (), ErrorCode::E0433,
+ "%<super%> in paths can only be used in start position");
return UNKNOWN_NODEID;
}
if (module_scope_id == crate_scope_id)
diff --git a/gcc/rust/resolve/rust-ast-resolve-type.cc b/gcc/rust/resolve/rust-ast-resolve-type.cc
index 135504e..8df6b95 100644
--- a/gcc/rust/resolve/rust-ast-resolve-type.cc
+++ b/gcc/rust/resolve/rust-ast-resolve-type.cc
@@ -176,8 +176,7 @@ 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,
- "leading path segment %qs can only be used at the "
- "beginning of a path",
+ "%qs in paths can only be used in start position",
segment->as_string ().c_str ());
return false;
}
diff --git a/gcc/rust/resolve/rust-forever-stack.hxx b/gcc/rust/resolve/rust-forever-stack.hxx
index 947b72f..6d92e2b 100644
--- a/gcc/rust/resolve/rust-forever-stack.hxx
+++ b/gcc/rust/resolve/rust-forever-stack.hxx
@@ -401,10 +401,9 @@ static inline bool
check_leading_kw_at_start (const S &segment, bool condition)
{
if (condition)
- rust_error_at (
- segment.get_locus (), ErrorCode::E0433,
- "leading path segment %qs can only be used at the beginning of a path",
- segment.as_string ().c_str ());
+ rust_error_at (segment.get_locus (), ErrorCode::E0433,
+ "%qs in paths can only be used in start position",
+ segment.as_string ().c_str ());
return condition;
}