Skip to content

Commit de30d1b

Browse files
authored
Rollup merge of rust-lang#140588 - jieyouxu:opt-error, r=petrochenkov
Adjust some ui tests re. target-dependent errors Alternatives to optional error annotations in rust-lang#140586: - Continue to ignore target-dependent additional errors in `tests/ui/panic-runtime/{two-panic-runtimes.rs,tests/ui/panic-runtime/want-abort-got-unwind.rs,tests/ui/panic-runtime/want-abort-got-unwind2.rs}` -- but explain why some targets have more errors than others. - Use `-Cpanic=abort` for `tests/ui/cfg/cfg_false_no_std-2.rs`. In that test, the panic strategy does not matter w.r.t. test intention. - Adjust FIXMEs in `tests/ui/debuginfo/debuginfo-type-name-layout-ice-94961-2.rs` to track it in rust-lang#140620. --- try-job: armhf-gnu try-job: test-various try-job: x86_64-msvc-1 try-job: i686-msvc-1 try-job: x86_64-mingw-1 try-job: aarch64-apple try-job: x86_64-apple-1
2 parents bddb015 + 48b72c5 commit de30d1b

File tree

5 files changed

+37
-22
lines changed

5 files changed

+37
-22
lines changed

tests/ui/cfg/cfg_false_no_std-2.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
// Error, the linked empty library is `no_std` and doesn't provide a panic handler.
22

3-
//@ dont-require-annotations: ERROR
43
//@ dont-check-compiler-stderr
4+
5+
// NOTE: fix a panic strategy to prevent differing errors subject to target's default panic strategy
6+
// which changes between targets. The specific panic strategy doesn't matter for test intention.
7+
//@ compile-flags: -Cpanic=abort
8+
59
//@ aux-build: cfg_false_lib_no_std_before.rs
610

711
#![no_std]
@@ -11,6 +15,3 @@ extern crate cfg_false_lib_no_std_before as _;
1115
fn main() {}
1216

1317
//~? ERROR `#[panic_handler]` function required, but not found
14-
// FIXME: This error is target-dependent, could be served by some "optional error" annotation
15-
// instead of `dont-require-annotations`.
16-
//FIXME~? ERROR unwinding panics are not supported without std

tests/ui/debuginfo/debuginfo-type-name-layout-ice-94961-2.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
//FIXME~ ERROR values of the type `[u8; usize::MAX]` are too big for the target architecture
1+
// ignore-tidy-linelength
2+
// FIXME(#140620)~ ERROR values of the type `[u8; usize::MAX]` are too big for the target architecture
3+
24
// Make sure the compiler does not ICE when trying to generate the debuginfo name of a type that
35
// causes a layout error.
46
// This version of the test already ICE'd before the commit that introduce the ICE described in
@@ -18,5 +20,5 @@ pub fn foo() -> usize {
1820
std::mem::size_of::<Foo<u8>>()
1921
}
2022

21-
// FIXME: the error is reported on different lines on different targets
22-
//FIXME~? ERROR values of the type `[u8; usize::MAX]` are too big for the target architecture
23+
// FIXME(#140620): the error is reported on different lines on different targets
24+
//FIXME(#140620)~? ERROR values of the type `[u8; usize::MAX]` are too big for the target architecture

tests/ui/panic-runtime/two-panic-runtimes.rs

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
// ignore-tidy-linelength
22
//@ build-fail
3-
//@ dont-require-annotations: ERROR
43
//@ dont-check-compiler-stderr
54
//@ aux-build:panic-runtime-unwind.rs
65
//@ aux-build:panic-runtime-unwind2.rs
76
//@ aux-build:panic-runtime-lang-items.rs
87

8+
// NOTE: there can be additional errors regarding trying to mix this crate if the precompiled target
9+
// (such as `wasm32-unknown-unknown` currently unconditionally defaulting to panic=abort) panic
10+
// strategy differs to abort, then involving a potentially-unwinding `panic_runtime_unwind` that
11+
// uses a different panic strategy. These errors are important but not to the test intention, which
12+
// is to check that trying to bring two panic runtimes (`panic_runtime_unwind`) and
13+
// (`panic_runtime_unwind2`) is prohibited. As such, the additional errors are not checked in this
14+
// test.
15+
//@ dont-require-annotations: ERROR
16+
917
#![no_std]
1018
#![no_main]
1119

@@ -16,7 +24,3 @@ extern crate panic_runtime_lang_items;
1624
fn main() {}
1725

1826
//~? ERROR cannot link together two panic runtimes: panic_runtime_unwind and panic_runtime_unwind2
19-
// FIXME: These errors are target-dependent, could be served by some "optional error" annotation
20-
// instead of `dont-require-annotations`.
21-
//FIXME~? ERROR the linked panic runtime `panic_runtime_unwind2` is not compiled with this crate's panic strategy `abort`
22-
//FIXME~? ERROR the crate `panic_runtime_unwind` requires panic strategy `unwind` which is incompatible with this crate's strategy of `abort`

tests/ui/panic-runtime/want-abort-got-unwind.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
// ignore-tidy-linelength
22
//@ build-fail
3-
//@ dont-require-annotations: ERROR
43
//@ dont-check-compiler-stderr
54
//@ aux-build:panic-runtime-unwind.rs
65
//@ compile-flags:-C panic=abort
76

7+
// NOTE: depending on the target's default panic strategy, there can be additional errors that
8+
// complain about linking two panic runtimes (e.g. precompiled `panic_unwind` if target default
9+
// panic strategy is unwind, in addition to `panic_runtime_unwind`). These additional errors will
10+
// not be observed on targets whose default panic strategy is abort, where `panic_abort` is linked
11+
// in instead.
12+
//@ dont-require-annotations: ERROR
13+
814
extern crate panic_runtime_unwind;
915

1016
fn main() {}
1117

1218
//~? ERROR the linked panic runtime `panic_runtime_unwind` is not compiled with this crate's panic strategy `abort`
13-
// FIXME: These errors are target-dependent, could be served by some "optional error" annotation
14-
// instead of `dont-require-annotations`.
15-
//FIXME~? ERROR cannot link together two panic runtimes: panic_unwind and panic_runtime_unwind
16-
//FIXME~? ERROR the crate `panic_unwind` requires panic strategy `unwind` which is incompatible with this crate's strategy of `abort`

tests/ui/panic-runtime/want-abort-got-unwind2.rs

+11-5
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
11
// ignore-tidy-linelength
22
//@ build-fail
3-
//@ dont-require-annotations: ERROR
43
//@ dont-check-compiler-stderr
54
//@ aux-build:panic-runtime-unwind.rs
65
//@ aux-build:wants-panic-runtime-unwind.rs
76
//@ compile-flags:-C panic=abort
87

8+
// Like `want-abort-got-unwind.rs`, this version checks that if the root binary wants abort panic
9+
// runtime, that the compiler rejects a setup where a dependency crate in the dependency DAG
10+
// transitively provides an unwind panic runtime (which also is built with `-Cpanic=unwind`, making
11+
// that potentially-unwinding).
12+
13+
// NOTE: similar to `want-abort-got-unwind.rs`, there can be additional errors if the target default
14+
// panic strategy is unwind, because then the precompiled `panic_unwind` would also be linked in,
15+
// duplicating `panic_runtime_unwind` (transitively). But those additional errors are not important
16+
// to test intention.
17+
//@ dont-require-annotations: ERROR
18+
919
extern crate wants_panic_runtime_unwind;
1020

1121
fn main() {}
1222

1323
//~? ERROR the linked panic runtime `panic_runtime_unwind` is not compiled with this crate's panic strategy `abort`
14-
// FIXME: These errors are target-dependent, could be served by some "optional error" annotation
15-
// instead of `dont-require-annotations`.
16-
//FIXME~? ERROR cannot link together two panic runtimes: panic_unwind and panic_runtime_unwind
17-
//FIXME~? ERROR the crate `panic_unwind` requires panic strategy `unwind` which is incompatible with this crate's strategy of `abort`

0 commit comments

Comments
 (0)