diff options
author | Thomas Schwinge <thomas@codesourcery.com> | 2022-02-04 10:28:02 +0100 |
---|---|---|
committer | Thomas Schwinge <thomas@codesourcery.com> | 2022-02-04 13:52:31 +0100 |
commit | 42f49fa7da2f0ec8f7625e191d4bf7a7c54dd3af (patch) | |
tree | ce339b9058e85e4ddcf5eb9656906e2c77206196 | |
parent | 83bfbf0746c87b641754697a3c8e9f7a7cb08aa9 (diff) | |
download | gcc-42f49fa7da2f0ec8f7625e191d4bf7a7c54dd3af.zip gcc-42f49fa7da2f0ec8f7625e191d4bf7a7c54dd3af.tar.gz gcc-42f49fa7da2f0ec8f7625e191d4bf7a7c54dd3af.tar.bz2 |
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
-rw-r--r-- | gcc/rust/typecheck/rust-hir-type-check-pattern.cc | 2 | ||||
-rw-r--r-- | 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 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'" } } } |