Skip to content

Commit c27eac3

Browse files
powerboat9P-E-P
authored andcommitted
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 <[email protected]>
1 parent 2c05d58 commit c27eac3

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

gcc/rust/resolve/rust-ast-resolve-path.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ ResolvePath::resolve_path (AST::PathInExpression &expr)
6868
if (in_middle_of_path && segment.is_lower_self_seg ())
6969
{
7070
rust_error_at (segment.get_locus (), ErrorCode::E0433,
71-
"failed to resolve: %<%s%> in paths can only be used "
72-
"in start position",
71+
"leading path segment %qs can only be used at the "
72+
"beginning of a path",
7373
segment.as_string ().c_str ());
7474
return UNKNOWN_NODEID;
7575
}

gcc/rust/resolve/rust-ast-resolve-type.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,8 @@ ResolveRelativeTypePath::go (AST::TypePath &path, NodeId &resolved_node_id)
176176
if (in_middle_of_path && segment->is_lower_self_seg ())
177177
{
178178
rust_error_at (segment->get_locus (), ErrorCode::E0433,
179-
"failed to resolve: %qs in paths can only be used "
180-
"in start position",
179+
"leading path segment %qs can only be used at the "
180+
"beginning of a path",
181181
segment->as_string ().c_str ());
182182
return false;
183183
}

gcc/testsuite/rust/compile/nr2/exclude

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ pub_restricted_2.rs
2828
pub_restricted_3.rs
2929
redef_error2.rs
3030
redef_error5.rs
31-
self-path2.rs
3231
sizeof-stray-infer-var-bug.rs
3332
struct-expr-parse.rs
3433
undeclared_label.rs

gcc/testsuite/rust/compile/self-path2.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ fn baz() {
1111
crate::bar();
1212

1313
crate::self::foo();
14-
// { dg-error "failed to resolve: .self. in paths can only be used in start position" "" { target *-*-* } .-1 }
14+
// { dg-error "leading path segment .self. can only be used at the beginning of a path" "" { target *-*-* } .-1 }
1515
}
1616

1717
type a = foo;
1818
type b = crate::foo;
1919
type c = self::foo;
2020
type d = crate::self::foo;
21-
// { dg-error "failed to resolve: .self. in paths can only be used in start position" "" { target *-*-* } .-1 }
21+
// { dg-error "leading path segment .self. can only be used at the beginning of a path" "" { target *-*-* } .-1 }

0 commit comments

Comments
 (0)