diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rust/resolve/rust-ast-resolve-path.cc | 8 | ||||
-rw-r--r-- | gcc/rust/resolve/rust-ast-resolve-type.cc | 3 | ||||
-rw-r--r-- | gcc/rust/resolve/rust-forever-stack.hxx | 7 | ||||
-rw-r--r-- | gcc/testsuite/rust/compile/issue-3568.rs | 2 | ||||
-rw-r--r-- | gcc/testsuite/rust/compile/name_resolution9.rs | 4 | ||||
-rw-r--r-- | gcc/testsuite/rust/compile/self-path2.rs | 4 |
6 files changed, 13 insertions, 15 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; } diff --git a/gcc/testsuite/rust/compile/issue-3568.rs b/gcc/testsuite/rust/compile/issue-3568.rs index 222a174..fef43b5 100644 --- a/gcc/testsuite/rust/compile/issue-3568.rs +++ b/gcc/testsuite/rust/compile/issue-3568.rs @@ -4,4 +4,4 @@ mod foo { } pub use foo::super::foo::S as T; -// { dg-error ".super. can only be used in start position" "" { target *-*-* } .-1 } +// { dg-error ".super. in paths can only be used in start position" "" { target *-*-* } .-1 } diff --git a/gcc/testsuite/rust/compile/name_resolution9.rs b/gcc/testsuite/rust/compile/name_resolution9.rs index 93adb46..792b3bd 100644 --- a/gcc/testsuite/rust/compile/name_resolution9.rs +++ b/gcc/testsuite/rust/compile/name_resolution9.rs @@ -6,11 +6,11 @@ pub mod foo { super::super::super::foo!(); // { dg-error "too many leading .super. keywords" } // { dg-error "could not resolve macro invocation" "" { target *-*-* } .-1 } - super::crate::foo!(); // { dg-error "leading path segment .crate. can only be used" } + super::crate::foo!(); // { dg-error ".crate. in paths can only be used" } // { dg-error "could not resolve macro invocation" "" { target *-*-* } .-1 } - crate::foo::bar::super::foo!(); // { dg-error "leading path segment .super. can only be used" } + crate::foo::bar::super::foo!(); // { dg-error ".super. in paths can only be used" } // { dg-error "could not resolve macro invocation" "" { target *-*-* } .-1 } } } diff --git a/gcc/testsuite/rust/compile/self-path2.rs b/gcc/testsuite/rust/compile/self-path2.rs index 6441c33..d955ed0 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 "leading path segment .self. can only be used at the beginning of a path" "" { target *-*-* } .-1 } + // { dg-error ".self. in paths can only be used in start position" "" { target *-*-* } .-1 } } type a = foo; type b = crate::foo; type c = self::foo; type d = crate::self::foo; -// { dg-error "leading path segment .self. can only be used at the beginning of a path" "" { target *-*-* } .-1 } +// { dg-error ".self. in paths can only be used in start position" "" { target *-*-* } .-1 } |