From 7b3d1b775fbfc0bc297eaefa707e50c2d256ce5e Mon Sep 17 00:00:00 2001
From: yukang <moorekang@gmail.com>
Date: Sun, 30 Jul 2023 15:49:57 +0800
Subject: [PATCH] normalize backtrace error messages

---
 tests/ui/const-generics/late-bound-vars/in_closure.rs      | 5 +++--
 tests/ui/const-generics/late-bound-vars/in_closure.stderr  | 4 +---
 tests/ui/const-generics/late-bound-vars/simple.rs          | 1 +
 tests/ui/generic-associated-types/issue-90014-tait2.rs     | 3 ++-
 tests/ui/generic-associated-types/issue-90014-tait2.stderr | 4 ++--
 5 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/tests/ui/const-generics/late-bound-vars/in_closure.rs b/tests/ui/const-generics/late-bound-vars/in_closure.rs
index 43dedc561ef..235d147c7ec 100644
--- a/tests/ui/const-generics/late-bound-vars/in_closure.rs
+++ b/tests/ui/const-generics/late-bound-vars/in_closure.rs
@@ -13,10 +13,11 @@
 // normalize-stderr-test "\s\d{1,}: .*\n" -> ""
 // normalize-stderr-test "\s at .*\n" -> ""
 // normalize-stderr-test ".*note: Some details.*\n" -> ""
-// normalize-stderr-test "\n\n[ ]*\n" -> ""
+// normalize-stderr-test "\n[ ]*\n" -> ""
 // normalize-stderr-test "compiler/.*: projection" -> "projection"
-// this should run-pass
 // normalize-stderr-test ".*omitted \d{1,} frame.*\n" -> ""
+// normalize-stderr-test "error: [\s\n]*query stack during panic:\n" -> ""
+// this should run-pass
 
 #![feature(generic_const_exprs)]
 #![allow(incomplete_features)]
diff --git a/tests/ui/const-generics/late-bound-vars/in_closure.stderr b/tests/ui/const-generics/late-bound-vars/in_closure.stderr
index 9dc5ea1f16a..ac406bf2bb1 100644
--- a/tests/ui/const-generics/late-bound-vars/in_closure.stderr
+++ b/tests/ui/const-generics/late-bound-vars/in_closure.stderr
@@ -1,4 +1,3 @@
-error: query stack during panic:
 #0 [mir_borrowck] borrow-checking `test::{closure#0}::{constant#1}`
 #1 [mir_drops_elaborated_and_const_checked] elaborating drops for `test::{closure#0}::{constant#1}`
 #2 [mir_for_ctfe] caching mir of `test::{closure#0}::{constant#1}` for CTFE
@@ -8,5 +7,4 @@ error: query stack during panic:
 #6 [typeck] type-checking `test`
 #7 [analysis] running analysis passes on this crate
 end of query stack
-error: aborting due to previous error
-
+error: aborting due to previous error
\ No newline at end of file
diff --git a/tests/ui/const-generics/late-bound-vars/simple.rs b/tests/ui/const-generics/late-bound-vars/simple.rs
index 30fc36209fe..411a974cef9 100644
--- a/tests/ui/const-generics/late-bound-vars/simple.rs
+++ b/tests/ui/const-generics/late-bound-vars/simple.rs
@@ -16,6 +16,7 @@
 // normalize-stderr-test "\n\n[ ]*\n" -> ""
 // normalize-stderr-test "compiler/.*: projection" -> "projection"
 // normalize-stderr-test ".*omitted \d{1,} frame.*\n" -> ""
+// normalize-stderr-test "error: [\s\n]*query stack" -> "error: query stack"
 
 #![feature(generic_const_exprs)]
 #![allow(incomplete_features)]
diff --git a/tests/ui/generic-associated-types/issue-90014-tait2.rs b/tests/ui/generic-associated-types/issue-90014-tait2.rs
index f541285fd1b..8da3baeb17a 100644
--- a/tests/ui/generic-associated-types/issue-90014-tait2.rs
+++ b/tests/ui/generic-associated-types/issue-90014-tait2.rs
@@ -19,7 +19,8 @@
 // normalize-stderr-test "\n\n[ ]*\n" -> ""
 // normalize-stderr-test "compiler/.*: projection" -> "projection"
 // normalize-stderr-test ".*omitted \d{1,} frame.*\n" -> ""
-
+// normalize-stderr-test "error: [\s\n]*query stack" -> "error: query stack"
+// normalize-stderr-test "[\n\s]*\nquery stack during panic:" -> "query stack during panic:"
 // edition:2018
 
 #![feature(type_alias_impl_trait)]
diff --git a/tests/ui/generic-associated-types/issue-90014-tait2.stderr b/tests/ui/generic-associated-types/issue-90014-tait2.stderr
index 65227005036..2538eb46dfa 100644
--- a/tests/ui/generic-associated-types/issue-90014-tait2.stderr
+++ b/tests/ui/generic-associated-types/issue-90014-tait2.stderr
@@ -1,9 +1,9 @@
 error: 
-  --> $DIR/issue-90014-tait2.rs:43:27
+  --> $DIR/issue-90014-tait2.rs:44:27
    |
 LL |     fn make_fut(&self) -> Box<dyn for<'a> Trait<'a, Thing = Fut<'a>>> {
    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^query stack during panic:
-#0 [typeck] type-checking `<impl at $DIR/issue-90014-tait2.rs:42:1: 42:13>::make_fut`
+#0 [typeck] type-checking `<impl at $DIR/issue-90014-tait2.rs:43:1: 43:13>::make_fut`
 #1 [type_of] computing type of `Fut::{opaque#0}`
 #2 [check_mod_item_types] checking item types in top-level module
 #3 [analysis] running analysis passes on this crate