From 42f49fa7da2f0ec8f7625e191d4bf7a7c54dd3af Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Fri, 4 Feb 2022 10:28:02 +0100 Subject: Fix '-Wformat-diag' issue in 'TypeCheckPattern::visit (HIR::TupleStructPattern &pattern)' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- gcc/rust/typecheck/rust-hir-type-check-pattern.cc | 2 +- gcc/testsuite/rust/compile/match5.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc') diff --git a/gcc/rust/typecheck/rust-hir-type-check-pattern.cc b/gcc/rust/typecheck/rust-hir-type-check-pattern.cc index 524ef46..e4ec49b 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 6f3d6e4..a5f934d 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'" } } } -- cgit v1.1