[gcc r14-7667] gccrs: Remove obsolete error diagnostic

Arthur Cohen cohenarthur@gcc.gnu.org
Tue Jan 16 17:52:04 GMT 2024


https://gcc.gnu.org/g:61e8ba9015a734ee6c9a12eec4764a1f73d130d3

commit r14-7667-g61e8ba9015a734ee6c9a12eec4764a1f73d130d3
Author: TieWay59 <tieway59@foxmail.com>
Date:   Sat May 13 15:49:42 2023 +0800

    gccrs: Remove obsolete error diagnostic
    
    fixes https://github.com/Rust-GCC/gccrs/issues/2064
    
    Remove every `{ dg-error "failed to type resolve expression" }`
    annotation that causes a failure when running the testsuite.
    
    gcc/rust/ChangeLog:
    
            * typecheck/rust-hir-type-check-expr.cc: Remove obsolete error diagnostic
    
    gcc/testsuite/ChangeLog:
    
            * rust/compile/break1.rs: remove dg-error "failed to type resolve expression"
            * rust/compile/break2.rs: Likewise
            * rust/compile/cfg2.rs: Likewise
            * rust/compile/continue1.rs: Likewise
            * rust/compile/generics4.rs: Likewise
            * rust/compile/generics6.rs: Likewise
            * rust/compile/generics7.rs: Likewise
            * rust/compile/issue-2029.rs: Likewise
            * rust/compile/issue-2139.rs: Likewise
            * rust/compile/issue-2190-1.rs: Likewise
            * rust/compile/issue-925.rs: Likewise
            * rust/compile/method1.rs: Likewise
            * rust/compile/shadow1.rs: Likewise
            * rust/compile/type-bindings1.rs: Likewise
            * rust/compile/unary_negation.rs: Likewise
            * rust/compile/unary_not.rs: Likewise
            * rust/compile/unconstrained_type_param.rs: Likewise
            * rust/compile/usize1.rs: Likewise
    
    Signed-off-by: Taiwei Wu <tieway59@foxmail.com>

Diff:
---
 gcc/rust/typecheck/rust-hir-type-check-expr.cc         | 8 +-------
 gcc/testsuite/rust/compile/break1.rs                   | 1 -
 gcc/testsuite/rust/compile/break2.rs                   | 1 -
 gcc/testsuite/rust/compile/cfg2.rs                     | 1 -
 gcc/testsuite/rust/compile/continue1.rs                | 1 -
 gcc/testsuite/rust/compile/generics4.rs                | 6 +-----
 gcc/testsuite/rust/compile/generics6.rs                | 4 +---
 gcc/testsuite/rust/compile/generics7.rs                | 1 -
 gcc/testsuite/rust/compile/issue-2029.rs               | 1 -
 gcc/testsuite/rust/compile/issue-2139.rs               | 1 -
 gcc/testsuite/rust/compile/issue-2190-1.rs             | 1 -
 gcc/testsuite/rust/compile/issue-925.rs                | 1 -
 gcc/testsuite/rust/compile/method1.rs                  | 1 -
 gcc/testsuite/rust/compile/shadow1.rs                  | 1 -
 gcc/testsuite/rust/compile/type-bindings1.rs           | 4 +---
 gcc/testsuite/rust/compile/unary_negation.rs           | 1 -
 gcc/testsuite/rust/compile/unary_not.rs                | 1 -
 gcc/testsuite/rust/compile/unconstrained_type_param.rs | 1 -
 gcc/testsuite/rust/compile/usize1.rs                   | 1 -
 19 files changed, 4 insertions(+), 33 deletions(-)

diff --git a/gcc/rust/typecheck/rust-hir-type-check-expr.cc b/gcc/rust/typecheck/rust-hir-type-check-expr.cc
index 101ed082a27..8bbbc224c8d 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-expr.cc
+++ b/gcc/rust/typecheck/rust-hir-type-check-expr.cc
@@ -41,13 +41,7 @@ TypeCheckExpr::Resolve (HIR::Expr *expr)
   expr->accept_vis (resolver);
 
   if (resolver.infered == nullptr)
-    {
-      // FIXME
-      // this is an internal error message for debugging and should be removed
-      // at some point
-      rust_error_at (expr->get_locus (), "failed to type resolve expression");
-      return new TyTy::ErrorType (expr->get_mappings ().get_hirid ());
-    }
+    return new TyTy::ErrorType (expr->get_mappings ().get_hirid ());
 
   auto ref = expr->get_mappings ().get_hirid ();
   resolver.infered->set_ref (ref);
diff --git a/gcc/testsuite/rust/compile/break1.rs b/gcc/testsuite/rust/compile/break1.rs
index 91cabffa894..e33077f6e2a 100644
--- a/gcc/testsuite/rust/compile/break1.rs
+++ b/gcc/testsuite/rust/compile/break1.rs
@@ -2,5 +2,4 @@ fn main() {
     let a;
     a = 1;
     break a; // { dg-error "cannot 'break' outside of a loop" }
-    // { dg-error "failed to type resolve expression" "" { target *-*-* } .-1 }
 }
diff --git a/gcc/testsuite/rust/compile/break2.rs b/gcc/testsuite/rust/compile/break2.rs
index 5ac806aeb9e..7d580316932 100644
--- a/gcc/testsuite/rust/compile/break2.rs
+++ b/gcc/testsuite/rust/compile/break2.rs
@@ -6,7 +6,6 @@ fn main() {
     while b > 10 {
         if (b == 2) {
             break b;  // { dg-error "can only break with a value inside 'loop'" }
-            // { dg-error "failed to type resolve expression" "" { target *-*-* } .-1 }
         }
         c = a + b;
         a = b;
diff --git a/gcc/testsuite/rust/compile/cfg2.rs b/gcc/testsuite/rust/compile/cfg2.rs
index 939384c5b7d..e4c90d96dd4 100644
--- a/gcc/testsuite/rust/compile/cfg2.rs
+++ b/gcc/testsuite/rust/compile/cfg2.rs
@@ -9,5 +9,4 @@ fn main() {
     let a = Foo;
     a.test();
     // { dg-error "failed to resolve method for .test." "" { target *-*-* } .-1 }
-    // { dg-error "failed to type resolve expression" "" { target *-*-* } .-2 }
 }
diff --git a/gcc/testsuite/rust/compile/continue1.rs b/gcc/testsuite/rust/compile/continue1.rs
index 994312b52cc..f1b58f69271 100644
--- a/gcc/testsuite/rust/compile/continue1.rs
+++ b/gcc/testsuite/rust/compile/continue1.rs
@@ -4,7 +4,6 @@ fn main() {
 
     let _fib = {
         continue; // { dg-error "cannot 'continue' outside of a loop" }
-        // { dg-error "failed to type resolve expression" "" { target *-*-* } .-1 }
         123
     };
 }
diff --git a/gcc/testsuite/rust/compile/generics4.rs b/gcc/testsuite/rust/compile/generics4.rs
index 8af13586a37..e8fe23cd268 100644
--- a/gcc/testsuite/rust/compile/generics4.rs
+++ b/gcc/testsuite/rust/compile/generics4.rs
@@ -3,14 +3,10 @@ struct GenericStruct<T>(T, usize);
 fn main() {
     let a2;
     a2 = GenericStruct::<i8, i32>(1, 456); // { dg-error "generic item takes at most 1 type arguments but 2 were supplied" }
-                                           // { dg-error {failed to type resolve expression} "" { target *-*-* } .-1 }
-                                           // { dg-error {Failed to resolve expression of function call} "" { target *-*-* } .-2 }
-                                           // { duplicate _dg-error {failed to type resolve expression} "" { target *-*-* } .-3 }
+                                           // { dg-error {Failed to resolve expression of function call} "" { target *-*-* } .-1 }
 
     let b2: i32 = a2.0;
     // { dg-error {Expected Tuple or ADT got: T\?} "" { target *-*-* } .-1 }
-    // { dg-error {failed to type resolve expression} "" { target *-*-* } .-2 }
     let c2: usize = a2.1;
     // { dg-error {Expected Tuple or ADT got: T\?} "" { target *-*-* } .-1 }
-    // { dg-error {failed to type resolve expression} "" { target *-*-* } .-2 }
 }
diff --git a/gcc/testsuite/rust/compile/generics6.rs b/gcc/testsuite/rust/compile/generics6.rs
index 3b81e1bbee1..ad5b682d0ba 100644
--- a/gcc/testsuite/rust/compile/generics6.rs
+++ b/gcc/testsuite/rust/compile/generics6.rs
@@ -24,8 +24,6 @@ impl Foo<f32> {
 
 fn main() {
     let a: i32 = Foo::test(); // { dg-error "multiple applicable items in scope for: test" }
-    // { dg-error {failed to type resolve expression} "" { target *-*-* } .-1 }
-    // { dg-error {Failed to resolve expression of function call} "" { target *-*-* } .-2 }
-    // { duplicate _dg-error {failed to type resolve expression} "" { target *-*-* } .-3 }
+    // { dg-error {Failed to resolve expression of function call} "" { target *-*-* } .-1 }
 }
 
diff --git a/gcc/testsuite/rust/compile/generics7.rs b/gcc/testsuite/rust/compile/generics7.rs
index 2789c30ee38..aeb91a6fb41 100644
--- a/gcc/testsuite/rust/compile/generics7.rs
+++ b/gcc/testsuite/rust/compile/generics7.rs
@@ -24,5 +24,4 @@ fn main() {
     let a = Foo { a: 123 };
     a.bar();
     // { dg-error "multiple candidates found for method .bar." "" { target *-*-* } .-1 }
-    // { dg-error "failed to type resolve expression" "" { target *-*-* } .-2 }
 }
diff --git a/gcc/testsuite/rust/compile/issue-2029.rs b/gcc/testsuite/rust/compile/issue-2029.rs
index 80af2289256..78569631eb1 100644
--- a/gcc/testsuite/rust/compile/issue-2029.rs
+++ b/gcc/testsuite/rust/compile/issue-2029.rs
@@ -5,7 +5,6 @@ fn foo(_: usize) -> Foo {
 
 fn main() {
     match Foo(true) {
-        // { dg-error "failed to type resolve expression" "" { target *-*-* } .-1 }
         foo(x)
         // { dg-error "expected tuple struct/variant, found" "" { target *-*-* } .-1 }
         => ()
diff --git a/gcc/testsuite/rust/compile/issue-2139.rs b/gcc/testsuite/rust/compile/issue-2139.rs
index 780ed58d5cc..77bf78d13a7 100644
--- a/gcc/testsuite/rust/compile/issue-2139.rs
+++ b/gcc/testsuite/rust/compile/issue-2139.rs
@@ -12,5 +12,4 @@ fn main() {
     let a: u16 = 123;
     a.foo();
     // { dg-error "failed to resolve method for .foo." "" { target *-*-* } .-1 }
-    // { dg-error "failed to type resolve expression" "" { target *-*-* } .-2 }
 }
diff --git a/gcc/testsuite/rust/compile/issue-2190-1.rs b/gcc/testsuite/rust/compile/issue-2190-1.rs
index 85091b22e3b..3e43e541049 100644
--- a/gcc/testsuite/rust/compile/issue-2190-1.rs
+++ b/gcc/testsuite/rust/compile/issue-2190-1.rs
@@ -7,5 +7,4 @@ trait Deref {
 fn foo<T: Deref<Target = i32>>(t: &T) -> i32 {
     t.max(2)
     // { dg-error "failed to resolve method for .max." "" { target *-*-* } .-1 }
-    // { dg-error "failed to type resolve expression" "" { target *-*-* } .-2 }
 }
diff --git a/gcc/testsuite/rust/compile/issue-925.rs b/gcc/testsuite/rust/compile/issue-925.rs
index f6c071958f4..930b192c3d3 100644
--- a/gcc/testsuite/rust/compile/issue-925.rs
+++ b/gcc/testsuite/rust/compile/issue-925.rs
@@ -19,5 +19,4 @@ fn test() {
     let a = S;
     a.foo();
     // { dg-error "multiple candidates found for method .foo." "" { target *-*-* } .-1 }
-    // { dg-error "failed to type resolve expression" "" { target *-*-* } .-2 }
 }
diff --git a/gcc/testsuite/rust/compile/method1.rs b/gcc/testsuite/rust/compile/method1.rs
index 18652406085..d371bf271f8 100644
--- a/gcc/testsuite/rust/compile/method1.rs
+++ b/gcc/testsuite/rust/compile/method1.rs
@@ -9,5 +9,4 @@ pub fn main() {
 
     a.test();
     // { dg-error "failed to resolve method for .test." "" { target *-*-* } .-1 }
-    // { dg-error {failed to type resolve expression} "" { target *-*-* } .-2 }
 }
diff --git a/gcc/testsuite/rust/compile/shadow1.rs b/gcc/testsuite/rust/compile/shadow1.rs
index 77410e932da..cef972adf33 100644
--- a/gcc/testsuite/rust/compile/shadow1.rs
+++ b/gcc/testsuite/rust/compile/shadow1.rs
@@ -3,5 +3,4 @@ fn main() {
     let mut x;
     x = true;
     x = x + 2; // { dg-error "cannot apply this operator to types bool and <integer>"  }
-               // { dg-error {failed to type resolve expression} "" { target *-*-* } .-1 }
 }
diff --git a/gcc/testsuite/rust/compile/type-bindings1.rs b/gcc/testsuite/rust/compile/type-bindings1.rs
index ad85ed97ecb..dc0e274fdd5 100644
--- a/gcc/testsuite/rust/compile/type-bindings1.rs
+++ b/gcc/testsuite/rust/compile/type-bindings1.rs
@@ -4,7 +4,5 @@ fn main() {
     let a;
     a = Foo::<A = i32, B = f32>(123f32);
     // { dg-error "associated type bindings are not allowed here" "" { target *-*-* } .-1 }
-    // { dg-error {failed to type resolve expression} "" { target *-*-* } .-2 }
-    // { dg-error {Failed to resolve expression of function call} "" { target *-*-* } .-3 }
-    // { duplicate _dg-error {failed to type resolve expression} "" { target *-*-* } .-4 }
+    // { dg-error {Failed to resolve expression of function call} "" { target *-*-* } .-2 }
 }
diff --git a/gcc/testsuite/rust/compile/unary_negation.rs b/gcc/testsuite/rust/compile/unary_negation.rs
index 848643f0bd2..bb59d19eed8 100644
--- a/gcc/testsuite/rust/compile/unary_negation.rs
+++ b/gcc/testsuite/rust/compile/unary_negation.rs
@@ -5,5 +5,4 @@ fn main() {
     let d: i32 = !3;
 
     let e: f32 = -true; // // { dg-error "cannot apply unary - to bool" }
-    // { dg-error {failed to type resolve expression} "" { target *-*-* } .-1 }
 }
diff --git a/gcc/testsuite/rust/compile/unary_not.rs b/gcc/testsuite/rust/compile/unary_not.rs
index b0a3dafbbd0..7e4de3dc030 100644
--- a/gcc/testsuite/rust/compile/unary_not.rs
+++ b/gcc/testsuite/rust/compile/unary_not.rs
@@ -5,5 +5,4 @@ fn main() {
     let d: i32 = !3;
 
     let e: f32 = !5f32; // { dg-error "cannot apply unary '!' to f32" }
-    // { dg-error {failed to type resolve expression} "" { target *-*-* } .-1 }
 }
diff --git a/gcc/testsuite/rust/compile/unconstrained_type_param.rs b/gcc/testsuite/rust/compile/unconstrained_type_param.rs
index 9f3db93a5e7..a510332f167 100644
--- a/gcc/testsuite/rust/compile/unconstrained_type_param.rs
+++ b/gcc/testsuite/rust/compile/unconstrained_type_param.rs
@@ -11,5 +11,4 @@ fn main() {
     let a = Foo::test();
     // { dg-error "expected" "" { target *-*-* } .-1 }
     // { dg-error "Failed to resolve expression of function call" "" { target *-*-* } .-2 }
-    // { dg-error "failed to type resolve expression" "" { target *-*-* } .-3 }
 }
diff --git a/gcc/testsuite/rust/compile/usize1.rs b/gcc/testsuite/rust/compile/usize1.rs
index b1c8fe86473..36cb99b5574 100644
--- a/gcc/testsuite/rust/compile/usize1.rs
+++ b/gcc/testsuite/rust/compile/usize1.rs
@@ -2,5 +2,4 @@ fn main() {
     let a = [1, 2, 3];
     let b: u32 = 1;
     let c = a[b]; // { dg-error "the type ...integer..CAPACITY.. cannot be indexed by .u32." }
-                  // { dg-error {failed to type resolve expression} "" { target *-*-* } .-1 }
 }


More information about the Gcc-cvs mailing list