Skip to content

Commit b2ee088

Browse files
authored
Rollup merge of #111052 - nnethercote:fix-ice-test, r=Nilstrieb
Fix problems with backtraces in two ui tests. `default-backtrace-ice.rs` started started failing for me recently, because on my Ubuntu 23.04 system there are 100 stack frames, and the current stack filtering pattern doesn't match on a stack frame with a three digit number. `issue-86800.rs` can also be improved, backtrace-wise. r? `@Nilstrieb`
2 parents 18d4e22 + f20738d commit b2ee088

File tree

4 files changed

+23
-20
lines changed

4 files changed

+23
-20
lines changed

tests/ui/impl-trait/issues/issue-86800.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
#![feature(type_alias_impl_trait)]
22

33
// edition:2021
4-
// unset-rustc-env:RUST_BACKTRACE
54
// compile-flags:-Z treat-err-as-bug=1
6-
// error-pattern:stack backtrace:
5+
// error-pattern: aborting due to `-Z treat-err-as-bug=1`
76
// failure-status:101
8-
// normalize-stderr-test "note: .*" -> ""
9-
// normalize-stderr-test "thread 'rustc' .*" -> ""
10-
// normalize-stderr-test " +[0-9]+:.*\n" -> ""
11-
// normalize-stderr-test " +at .*\n" -> ""
7+
// normalize-stderr-test ".*note: .*\n\n" -> ""
8+
// normalize-stderr-test "thread 'rustc' panicked.*\n" -> ""
9+
// rustc-env:RUST_BACKTRACE=0
1210

1311
use std::future::Future;
1412

+1-13
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,12 @@
11
error: unconstrained opaque type
2-
--> $DIR/issue-86800.rs:33:34
2+
--> $DIR/issue-86800.rs:31:34
33
|
44
LL | type TransactionFuture<'__, O> = impl '__ + Future<Output = TransactionResult<O>>;
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
7-
=
8-
9-
10-
stack backtrace:
11-
127
error: the compiler unexpectedly panicked. this is a bug.
138

14-
15-
16-
17-
18-
19-
209
query stack during panic:
2110
#0 [type_of] computing type of `TransactionFuture::{opaque#0}`
2211
#1 [check_mod_item_types] checking item types in top-level module
23-
#2 [analysis] running analysis passes on this crate
2412
end of query stack

tests/ui/panics/default-backtrace-ice.rs

+13-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,20 @@
22
// compile-flags:-Z treat-err-as-bug=1
33
// error-pattern:stack backtrace:
44
// failure-status:101
5+
// ignore-msvc
56
// normalize-stderr-test "note: .*" -> ""
67
// normalize-stderr-test "thread 'rustc' .*" -> ""
7-
// normalize-stderr-test " .*\n" -> ""
8+
// normalize-stderr-test " +\d+:.*__rust_begin_short_backtrace.*" -> "(begin_short_backtrace)"
9+
// normalize-stderr-test " +\d+:.*__rust_end_short_backtrace.*" -> "(end_short_backtrace)"
10+
// normalize-stderr-test " +\d+:.*\n" -> ""
11+
// normalize-stderr-test " +at .*\n" -> ""
12+
//
13+
// This test makes sure that full backtraces are used for ICEs when
14+
// RUST_BACKTRACE is not set. It does this by checking for the presence of
15+
// `__rust_{begin,end}_short_backtrace` markers, which only appear in full
16+
// backtraces. The rest of the backtrace is filtered out.
17+
//
18+
// Ignored on msvc becaue the `__rust_{begin,end}_short_backtrace` symbols
19+
// aren't reliable.
820

921
fn main() { missing_ident; }

tests/ui/panics/default-backtrace-ice.stderr

+5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
error[E0425]: cannot find value `missing_ident` in this scope
2+
--> $DIR/default-backtrace-ice.rs:21:13
3+
|
24
LL | fn main() { missing_ident; }
5+
| ^^^^^^^^^^^^^ not found in this scope
36

47

58
stack backtrace:
9+
(end_short_backtrace)
10+
(begin_short_backtrace)
611

712
error: the compiler unexpectedly panicked. this is a bug.
813

0 commit comments

Comments
 (0)