From 3733dcc72d3b8504ab812990b30e17bd5f0afd5b Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Mon, 25 Mar 2024 14:19:07 +0000 Subject: [PATCH 1/2] Add needs-unwind annotations to a couple of tests --- .../rustc_codegen_cranelift/scripts/test_rustc_tests.sh | 6 ------ tests/run-make/libtest-junit/Makefile | 1 + tests/ui/asm/may_unwind.rs | 1 + tests/ui/stable-mir-print/basic_function.rs | 1 + 4 files changed, 3 insertions(+), 6 deletions(-) diff --git a/compiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh b/compiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh index 9b360fb3036..7f47fd972c4 100755 --- a/compiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh +++ b/compiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh @@ -41,12 +41,6 @@ rm tests/ui/parser/unclosed-delimiter-in-dep.rs # submodule contains //~ERROR # missing features # ================ -# requires stack unwinding -# FIXME add needs-unwind to these tests -rm -r tests/run-make/libtest-junit -rm tests/ui/asm/may_unwind.rs -rm tests/ui/stable-mir-print/basic_function.rs - # extra warning about -Cpanic=abort for proc macros rm tests/ui/proc-macro/crt-static.rs rm tests/ui/proc-macro/proc-macro-deprecated-attr.rs diff --git a/tests/run-make/libtest-junit/Makefile b/tests/run-make/libtest-junit/Makefile index d97cafccf1f..26e56242dd2 100644 --- a/tests/run-make/libtest-junit/Makefile +++ b/tests/run-make/libtest-junit/Makefile @@ -1,4 +1,5 @@ # ignore-cross-compile +# needs-unwind contains should_panic test include ../tools.mk # Test expected libtest's junit output diff --git a/tests/ui/asm/may_unwind.rs b/tests/ui/asm/may_unwind.rs index 216408b3873..1d4f50d5fe8 100644 --- a/tests/ui/asm/may_unwind.rs +++ b/tests/ui/asm/may_unwind.rs @@ -1,5 +1,6 @@ //@ run-pass //@ needs-asm-support +//@ needs-unwind #![feature(asm_unwind)] diff --git a/tests/ui/stable-mir-print/basic_function.rs b/tests/ui/stable-mir-print/basic_function.rs index deefef63bdb..5f582ece6fb 100644 --- a/tests/ui/stable-mir-print/basic_function.rs +++ b/tests/ui/stable-mir-print/basic_function.rs @@ -1,6 +1,7 @@ //@ compile-flags: -Z unpretty=stable-mir -Z mir-opt-level=3 //@ check-pass //@ only-x86_64 +//@ needs-unwind unwind edges are different with panic=abort fn foo(i: i32) -> i32 { i + 1 From 5f5dcaefe648390e2d5763c8f6480bba0ffb55bb Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Mon, 25 Mar 2024 14:24:08 +0000 Subject: [PATCH 2/2] Add needs-unwind for proc macro tests Rustc gives a warning when compiling proc macros with panic=abort. --- .../rustc_codegen_cranelift/scripts/test_rustc_tests.sh | 9 --------- tests/ui/proc-macro/allowed-signatures.rs | 3 ++- tests/ui/proc-macro/crt-static.rs | 1 + .../proc-macro/no-mangle-in-proc-macro-issue-111888.rs | 1 + tests/ui/proc-macro/no-missing-docs.rs | 1 + tests/ui/proc-macro/proc-macro-deprecated-attr.rs | 1 + tests/ui/proc-macro/quote-debug.rs | 1 + tests/ui/proc-macro/quote-debug.stdout | 1 + tests/ui/rust-2018/proc-macro-crate-in-paths.rs | 1 + 9 files changed, 9 insertions(+), 10 deletions(-) diff --git a/compiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh b/compiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh index 7f47fd972c4..b6651fa2891 100755 --- a/compiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh +++ b/compiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh @@ -41,15 +41,6 @@ rm tests/ui/parser/unclosed-delimiter-in-dep.rs # submodule contains //~ERROR # missing features # ================ -# extra warning about -Cpanic=abort for proc macros -rm tests/ui/proc-macro/crt-static.rs -rm tests/ui/proc-macro/proc-macro-deprecated-attr.rs -rm tests/ui/proc-macro/quote-debug.rs -rm tests/ui/proc-macro/no-missing-docs.rs -rm tests/ui/rust-2018/proc-macro-crate-in-paths.rs -rm tests/ui/proc-macro/allowed-signatures.rs -rm tests/ui/proc-macro/no-mangle-in-proc-macro-issue-111888.rs - # vendor intrinsics rm tests/ui/simd/array-type.rs # "Index argument for `simd_insert` is not a constant" rm tests/ui/asm/x86_64/evex512-implicit-feature.rs # unimplemented AVX512 x86 vendor intrinsic diff --git a/tests/ui/proc-macro/allowed-signatures.rs b/tests/ui/proc-macro/allowed-signatures.rs index 8dede3f50b5..c70d62ab57b 100644 --- a/tests/ui/proc-macro/allowed-signatures.rs +++ b/tests/ui/proc-macro/allowed-signatures.rs @@ -1,6 +1,7 @@ //@ check-pass //@ force-host //@ no-prefer-dynamic +//@ needs-unwind compiling proc macros with panic=abort causes a warning #![crate_type = "proc-macro"] #![allow(private_interfaces)] @@ -9,7 +10,7 @@ #[proc_macro] pub fn foo(t: T) -> TokenStream { - TokenStream::new() + TokenStream::new() } trait Project { diff --git a/tests/ui/proc-macro/crt-static.rs b/tests/ui/proc-macro/crt-static.rs index 0874c4e8a38..0255d26254e 100644 --- a/tests/ui/proc-macro/crt-static.rs +++ b/tests/ui/proc-macro/crt-static.rs @@ -7,6 +7,7 @@ //@ force-host //@ no-prefer-dynamic //@ needs-dynamic-linking +//@ needs-unwind compiling proc macros with panic=abort causes a warning #![crate_type = "proc-macro"] diff --git a/tests/ui/proc-macro/no-mangle-in-proc-macro-issue-111888.rs b/tests/ui/proc-macro/no-mangle-in-proc-macro-issue-111888.rs index e04d45bbd0d..1424754f0ca 100644 --- a/tests/ui/proc-macro/no-mangle-in-proc-macro-issue-111888.rs +++ b/tests/ui/proc-macro/no-mangle-in-proc-macro-issue-111888.rs @@ -1,6 +1,7 @@ //@ build-pass //@ force-host //@ no-prefer-dynamic +//@ needs-unwind compiling proc macros with panic=abort causes a warning //@ aux-build:exports_no_mangle.rs #![crate_type = "proc-macro"] diff --git a/tests/ui/proc-macro/no-missing-docs.rs b/tests/ui/proc-macro/no-missing-docs.rs index 124af9bea75..49d9ead340b 100644 --- a/tests/ui/proc-macro/no-missing-docs.rs +++ b/tests/ui/proc-macro/no-missing-docs.rs @@ -4,6 +4,7 @@ //@ build-pass (FIXME(62277): could be check-pass?) //@ force-host //@ no-prefer-dynamic +//@ needs-unwind compiling proc macros with panic=abort causes a warning #![crate_type = "proc-macro"] #![deny(missing_docs)] diff --git a/tests/ui/proc-macro/proc-macro-deprecated-attr.rs b/tests/ui/proc-macro/proc-macro-deprecated-attr.rs index 5e06a1c6cf8..85e930bf7f5 100644 --- a/tests/ui/proc-macro/proc-macro-deprecated-attr.rs +++ b/tests/ui/proc-macro/proc-macro-deprecated-attr.rs @@ -1,6 +1,7 @@ //@ check-pass //@ force-host //@ no-prefer-dynamic +//@ needs-unwind compiling proc macros with panic=abort causes a warning #![deny(deprecated)] diff --git a/tests/ui/proc-macro/quote-debug.rs b/tests/ui/proc-macro/quote-debug.rs index f1593b505f9..11d144d609f 100644 --- a/tests/ui/proc-macro/quote-debug.rs +++ b/tests/ui/proc-macro/quote-debug.rs @@ -2,6 +2,7 @@ //@ force-host //@ no-prefer-dynamic //@ compile-flags: -Z unpretty=expanded +//@ needs-unwind compiling proc macros with panic=abort causes a warning // // This file is not actually used as a proc-macro - instead, // it's just used to show the output of the `quote!` macro diff --git a/tests/ui/proc-macro/quote-debug.stdout b/tests/ui/proc-macro/quote-debug.stdout index 51f34423366..d84b4e051e8 100644 --- a/tests/ui/proc-macro/quote-debug.stdout +++ b/tests/ui/proc-macro/quote-debug.stdout @@ -4,6 +4,7 @@ //@ force-host //@ no-prefer-dynamic //@ compile-flags: -Z unpretty=expanded +//@ needs-unwind compiling proc macros with panic=abort causes a warning // // This file is not actually used as a proc-macro - instead, // it's just used to show the output of the `quote!` macro diff --git a/tests/ui/rust-2018/proc-macro-crate-in-paths.rs b/tests/ui/rust-2018/proc-macro-crate-in-paths.rs index ce29fc51a4f..e5a4b7a9d5c 100644 --- a/tests/ui/rust-2018/proc-macro-crate-in-paths.rs +++ b/tests/ui/rust-2018/proc-macro-crate-in-paths.rs @@ -1,6 +1,7 @@ //@ build-pass (FIXME(62277): could be check-pass?) //@ force-host //@ no-prefer-dynamic +//@ needs-unwind compiling proc macros with panic=abort causes a warning #![crate_type = "proc-macro"] #![deny(rust_2018_compatibility)]