]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Adjust type path resolution error message
authorOwen Avery <powerboat9.gamer@gmail.com>
Mon, 10 Feb 2025 02:42:21 +0000 (21:42 -0500)
committerArthur Cohen <arthur.cohen@embecosm.com>
Mon, 24 Mar 2025 12:07:11 +0000 (13:07 +0100)
gcc/rust/ChangeLog:

* resolve/rust-ast-resolve-type.cc
(ResolveRelativeTypePath::go): Adjust error message to match
the 2.0 name resolver.

gcc/testsuite/ChangeLog:

* rust/compile/additional-trait-bounds2.rs: Adjust expected
errors.
* rust/compile/const_generics_4.rs: Likewise.
* rust/compile/const_generics_7.rs: Likewise.
* rust/compile/generic-default1.rs: Likewise.
* rust/compile/generics5.rs: Likewise.
* rust/compile/generics9.rs: Likewise.
* rust/compile/issue-2423.rs: Likewise.
* rust/compile/method2.rs: Likewise.
* rust/compile/nr2/exclude: Remove entries.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
gcc/rust/resolve/rust-ast-resolve-type.cc
gcc/testsuite/rust/compile/additional-trait-bounds2.rs
gcc/testsuite/rust/compile/const_generics_4.rs
gcc/testsuite/rust/compile/const_generics_7.rs
gcc/testsuite/rust/compile/generic-default1.rs
gcc/testsuite/rust/compile/generics5.rs
gcc/testsuite/rust/compile/generics9.rs
gcc/testsuite/rust/compile/issue-2423.rs
gcc/testsuite/rust/compile/method2.rs
gcc/testsuite/rust/compile/nr2/exclude

index f0e5468a2451e8e2c55a787b0ce4a64e791d22b1..af63898a5d274783f253127c88510ca5a310374f 100644 (file)
@@ -316,7 +316,7 @@ ResolveRelativeTypePath::go (AST::TypePath &path, NodeId &resolved_node_id)
       else if (is_first_segment)
        {
          rust_error_at (segment->get_locus (), ErrorCode::E0412,
-                        "failed to resolve TypePath: %s in this scope",
+                        "could not resolve type path %qs",
                         segment->as_string ().c_str ());
          return false;
        }
index 843228ae9a64d25975062085b420587fc49f06d1..1c49b750319af9bbe37490f129340707dffbe7c3 100644 (file)
@@ -6,4 +6,4 @@ pub unsafe auto trait Sync {}
 
 trait A {}
 
-impl dyn A + Send + Sync + NonExist {} // { dg-error "failed to resolve TypePath: NonExist in this scope" }
+impl dyn A + Send + Sync + NonExist {} // { dg-error "could not resolve type path .NonExist." }
index b364d3bb738af1afcdee637badeaa289303e66f0..2766e4ca3c5863a51e0b41ef37683c72b50af044 100644 (file)
@@ -4,4 +4,4 @@ const P: usize = 14;
 
 struct Foo<const N: usize = { M }>; // { dg-error "cannot find value .M. in this scope" }
 struct Bar<const N: usize = { P }>;
-struct Baz<const N: NotAType = { P }>; // { dg-error "failed to resolve TypePath: NotAType in this scope" }
+struct Baz<const N: NotAType = { P }>; // { dg-error "could not resolve type path .NotAType." }
index 2c128db92ea0196ffb5e2bf04fa2fb149395eb03..dad4c21f84acdeac1d804f5a4996ea1289a9ae79 100644 (file)
@@ -1,17 +1,17 @@
 struct S<const N: usize>;
 
-pub fn foo<const N: FooBar>() {} // { dg-error "failed to resolve" }
-type Foo<const N: FooBar> = S<N>; // { dg-error "failed to resolve" }
-struct Foo2<const N: FooBar>; // { dg-error "failed to resolve" }
-enum Foo3<const N: FooBar> { // { dg-error "failed to resolve" }
+pub fn foo<const N: FooBar>() {} // { dg-error "could not resolve" }
+type Foo<const N: FooBar> = S<N>; // { dg-error "could not resolve" }
+struct Foo2<const N: FooBar>; // { dg-error "could not resolve" }
+enum Foo3<const N: FooBar> { // { dg-error "could not resolve" }
     Foo,
     Bar,
 }
-union Foo4<const N: FooBar> { // { dg-error "failed to resolve" }
+union Foo4<const N: FooBar> { // { dg-error "could not resolve" }
     a: usize,
     b: i32,
 }
-trait Fooable<const N: FooBar> {} // { dg-error "failed to resolve" }
+trait Fooable<const N: FooBar> {} // { dg-error "could not resolve" }
 
 trait Traitable {}
-impl<const N: FooBar> Traitable for Foo2<N> {} // { dg-error "failed to resolve" }
+impl<const N: FooBar> Traitable for Foo2<N> {} // { dg-error "could not resolve" }
index 0a132bf5d6bf2c51314fbacd49419617b8642132..41556406bc6c96bca9204a005b76eb33697c4134 100644 (file)
@@ -1,5 +1,5 @@
 struct Foo<A = i321>(A);
-// { dg-error "failed to resolve TypePath: i321" "" { target *-*-* } .-1 }
+// { dg-error "could not resolve type path .i321." "" { target *-*-* } .-1 }
 
 fn main() {
     let a;
index 6c847b5a29b5ed57cac2a2cfe1bfbbe19c863e6f..f86103807953e4e5bf53eabbc9797472804ef871 100644 (file)
@@ -3,7 +3,7 @@ struct GenericStruct<T>(T, usize);
 fn main() {
     let a2;
     a2 = GenericStruct::<i8, T>(1, 456);
-    // { dg-error "failed to resolve TypePath: T" "" { target *-*-* } .-1 }
+    // { dg-error "could not resolve type path .T." "" { target *-*-* } .-1 }
 
     let b2: i32 = a2.0;
     let c2: usize = a2.1;
index 3766703431eca114b84bac2a8e5e80123202fdbb..3c787aa75027e09afcce0d01179d289530b24129 100644 (file)
@@ -1,5 +1,5 @@
 struct Foo<A, B = (A, B)>(A, B);
-// { dg-error "failed to resolve TypePath: B" "" { target *-*-* } .-1 }
+// { dg-error "could not resolve type path .B." "" { target *-*-* } .-1 }
 
 fn main() {
     let a: Foo<bool>;
index ae7897c11709ded84d9f7e062241ceae15bf1ed4..6fcd32f8836ffc5cdf419304e885a0bf0ec302d2 100644 (file)
@@ -1,14 +1,14 @@
 impl NonExistant {
-    // { dg-error "failed to resolve" "" { target *-*-* } .-1 }
+    // { dg-error "could not resolve" "" { target *-*-* } .-1 }
     fn test() {}
 }
 
 impl NotFound for NonExistant {
-    // { dg-error "failed to resolve" "" { target *-*-* } .-1 }
+    // { dg-error "could not resolve" "" { target *-*-* } .-1 }
     fn test() {}
 }
 
 trait A {}
 
 impl A for NotFound {}
-// { dg-error "failed to resolve" "" { target *-*-* } .-1 }
+// { dg-error "could not resolve" "" { target *-*-* } .-1 }
index c8699f77c6ab55d418bf638601f3bad06d5cbd05..961a03990e4ac2d7f590101e57f68825876b8079 100644 (file)
@@ -12,5 +12,5 @@ fn main() {
 
     let b;
     b = a.test::<asfasfr>(false);
-    // { dg-error "failed to resolve TypePath: asfasfr" "" { target *-*-* } .-1 }
+    // { dg-error "could not resolve type path .asfasfr." "" { target *-*-* } .-1 }
 }
index 345b1d516ef4d098795a9c71183a02b60932443e..6e17eca1c20fce70f72b5834926010e14ee9c7d4 100644 (file)
@@ -4,11 +4,8 @@ cfg1.rs
 complex-path1.rs
 const_generics_3.rs
 const_generics_4.rs
-const_generics_7.rs
 derive_macro1.rs
 feature_rust_attri0.rs
-generic-default1.rs
-generics5.rs
 generics9.rs
 issue-1483.rs
 issue-1786.rs
@@ -28,7 +25,6 @@ macros/mbe/macro43.rs
 macros/mbe/macro44.rs
 macros/mbe/macro6.rs
 macros/mbe/macro_use1.rs
-method2.rs
 multiple_bindings1.rs
 multiple_bindings2.rs
 nested_macro_use1.rs
@@ -58,9 +54,7 @@ issue-3033.rs
 issue-3009.rs
 issue-2953-2.rs
 issue-2905-2.rs
-issue-2423.rs
 issue-266.rs
-additional-trait-bounds2.rs
 derive_clone_enum1.rs
 derive_clone_enum2.rs
 derive_clone_enum3.rs