public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] Fix '-Wformat-diag' issue in 'TypeCheckPattern::visit (HIR::TupleStructPattern &pattern)'
@ 2022-06-08 12:03 Thomas Schwinge
  0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2022-06-08 12:03 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:42f49fa7da2f0ec8f7625e191d4bf7a7c54dd3af

commit 42f49fa7da2f0ec8f7625e191d4bf7a7c54dd3af
Author: Thomas Schwinge <thomas@codesourcery.com>
Date:   Fri Feb 4 10:28:02 2022 +0100

    Fix '-Wformat-diag' issue in 'TypeCheckPattern::visit (HIR::TupleStructPattern &pattern)'
    
    It's alread now diagnosed, non-fatal warning:
    
        [...]/source-gcc/gcc/rust/typecheck/rust-hir-type-check-pattern.cc: In member function ‘virtual void Rust::Resolver::TypeCheckPattern::visit(Rust::HIR::TupleStructPattern&)’:
        [...]/source-gcc/gcc/rust/typecheck/rust-hir-type-check-pattern.cc:61:69: warning: unquoted operator ‘::’ in format [-Wformat-diag]
            61 |         "expected tuple struct or tuple variant, found %s variant %s::%s",
               |                                                                     ^~
    
    A later merge from GCC upstream will bring in
    commit 34ba4275dcf5162efb9b634e4665734766faf4e3
    "Enable -Werror=format-diag during bootstrap", which then causes:
    
        [...]/source-gcc/gcc/rust/typecheck/rust-hir-type-check-pattern.cc: In member function ‘virtual void Rust::Resolver::TypeCheckPattern::visit(Rust::HIR::TupleStructPattern&)’:
        [...]/source-gcc/gcc/rust/typecheck/rust-hir-type-check-pattern.cc:61:69: error: unquoted operator ‘::’ in format [-Werror=format-diag]
           61 |         "expected tuple struct or tuple variant, found %s variant %s::%s",
              |                                                                     ^~
        cc1plus: all warnings being treated as errors
        make[3]: *** [rust/rust-hir-type-check-pattern.o] Error 1

Diff:
---
 gcc/rust/typecheck/rust-hir-type-check-pattern.cc | 2 +-
 gcc/testsuite/rust/compile/match5.rs              | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/rust/typecheck/rust-hir-type-check-pattern.cc b/gcc/rust/typecheck/rust-hir-type-check-pattern.cc
index 524ef4664cc..e4ec49bc5c1 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-pattern.cc
+++ b/gcc/rust/typecheck/rust-hir-type-check-pattern.cc
@@ -58,7 +58,7 @@ TypeCheckPattern::visit (HIR::TupleStructPattern &pattern)
 
       rust_error_at (
 	pattern.get_locus (),
-	"expected tuple struct or tuple variant, found %s variant %s::%s",
+	"expected tuple struct or tuple variant, found %s variant %<%s::%s%>",
 	variant_type.c_str (), adt->get_name ().c_str (),
 	variant->get_identifier ().c_str ());
       return;
diff --git a/gcc/testsuite/rust/compile/match5.rs b/gcc/testsuite/rust/compile/match5.rs
index 6f3d6e4c46a..a5f934d6aeb 100644
--- a/gcc/testsuite/rust/compile/match5.rs
+++ b/gcc/testsuite/rust/compile/match5.rs
@@ -10,6 +10,6 @@ fn inspect(f: Foo) {
         Foo::A => {}
         Foo::B => {}
         Foo::C(a) => {}
-        Foo::D(x, y) => {} // { dg-error "expected tuple struct or tuple variant, found struct variant Foo::D" }
+        Foo::D(x, y) => {} // { dg-error "expected tuple struct or tuple variant, found struct variant 'Foo::D'" }
     }
 }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-06-08 12:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-08 12:03 [gcc/devel/rust/master] Fix '-Wformat-diag' issue in 'TypeCheckPattern::visit (HIR::TupleStructPattern &pattern)' Thomas Schwinge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).