]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: nr2.0: Fix test self-path2.rs
authorOwen Avery <powerboat9.gamer@gmail.com>
Sun, 9 Feb 2025 20:16:59 +0000 (15:16 -0500)
committerArthur Cohen <arthur.cohen@embecosm.com>
Mon, 24 Mar 2025 12:30:42 +0000 (13:30 +0100)
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>
gcc/rust/resolve/rust-ast-resolve-path.cc
gcc/rust/resolve/rust-ast-resolve-type.cc
gcc/testsuite/rust/compile/nr2/exclude
gcc/testsuite/rust/compile/self-path2.rs

index 256159bc5cc5bcf3375b61b461cc054978737027..656b7e64bb73eadc6f19a97745f4c6232ab0990c 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2020-2025 Free Software Foundation, Inc.
+// Copyright (C) 2020-2024 Free Software Foundation, Inc.
 
 // This file is part of GCC.
 
@@ -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: %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 UNKNOWN_NODEID;
        }
@@ -192,7 +192,7 @@ ResolvePath::resolve_path (AST::PathInExpression &expr)
              else
                {
                  rust_error_at (segment.get_locus (),
-                                "Cannot find path %qs in this scope",
+                                "Cannot find path %<%s%> in this scope",
                                 segment.as_string ().c_str ());
                  return UNKNOWN_NODEID;
                }
@@ -212,7 +212,7 @@ ResolvePath::resolve_path (AST::PathInExpression &expr)
       else if (is_first_segment)
        {
          rust_error_at (segment.get_locus (), ErrorCode::E0433,
-                        "Cannot find path %qs in this scope",
+                        "Cannot find path %<%s%> in this scope",
                         segment.as_string ().c_str ());
          return UNKNOWN_NODEID;
        }
@@ -331,7 +331,7 @@ ResolvePath::resolve_path (AST::SimplePath &expr)
          else
            {
              rust_error_at (segment.get_locus (),
-                            "Cannot find path %qs in this scope",
+                            "Cannot find path %<%s%> in this scope",
                             segment.as_string ().c_str ());
              return UNKNOWN_NODEID;
            }
@@ -379,7 +379,7 @@ ResolvePath::resolve_path (AST::SimplePath &expr)
       if (resolved_node_id == UNKNOWN_NODEID)
        {
          rust_error_at (segment.get_locus (),
-                        "cannot find simple path segment %qs in this scope",
+                        "cannot find simple path segment %<%s%> in this scope",
                         segment.as_string ().c_str ());
          return UNKNOWN_NODEID;
        }
index af63898a5d274783f253127c88510ca5a310374f..87643d775ff436b2d8f6a563d814e523c3aa4736 100644 (file)
@@ -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;
            }
index a4bac9ac836585244c9a1fecec45061049bc1647..a2a833f90738710ab12a02fd6ed354d5ba76cd09 100644 (file)
@@ -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
index b9b82cae5a6a502a6e6223976f8da8c5b0e7bc7b..6441c3328f91b6cc1c041effb80e63182ed4f790 100644 (file)
@@ -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 }