diff --git a/src/tools/opt-dist/src/tests.rs b/src/tools/opt-dist/src/tests.rs index b5dfd2fc5af..46b0a543802 100644 --- a/src/tools/opt-dist/src/tests.rs +++ b/src/tools/opt-dist/src/tests.rs @@ -96,7 +96,7 @@ pub fn run_tests(env: &Environment) -> anyhow::Result<()> { "tests/pretty", "tests/run-pass-valgrind", "tests/ui", - "tests/crases", + "tests/crashes", ]; for test_path in env.skipped_tests() { args.extend(["--skip", test_path]); diff --git a/tests/crashes/122909.rs b/tests/crashes/122909.rs new file mode 100644 index 00000000000..344fcd88010 --- /dev/null +++ b/tests/crashes/122909.rs @@ -0,0 +1,15 @@ +//@ compile-flags: -Zpolymorphize=on -Zinline-mir=yes +//@ known-bug: #12345 + + +use std::sync::{Arc, Context, Weak}; + +pub struct WeakOnce(); +impl WeakOnce { + extern "rust-call" fn try_get(&self) -> Option> {} + + pub fn get(&self) -> Arc { + self.try_get() + .unwrap_or_else(|| panic!("Singleton {} not available", std::any::type_name::())) + } +} diff --git a/tests/crashes/README.md b/tests/crashes/README.md new file mode 100644 index 00000000000..28346b26e37 --- /dev/null +++ b/tests/crashes/README.md @@ -0,0 +1,13 @@ +This is serves as a collection of crashes so that accidental ICE fixes are tracked. +This was formally done at https://github.com/rust-lang/glacier but doing it inside +the rustc testsuite is more convenient. + +It is imperative that a test in the suite causes an internal compiler error/panic +or makes rustc crash in some other way. +Accepted exit codes are: 101 (may be expanded later) + +When adding crashes from https://github.com/rust-lang/rust/issues, the +issue number should be noted in the file name (12345.rs should suffice) +and perhaps also inside the file via `//@ known-bug #4321` + +If you happen to fix one of the crashes, please move it to `tests/ui`! :) diff --git a/tests/crashes/no-ice.rs b/tests/crashes/no-ice.rs deleted file mode 100644 index da0f5d925d1..00000000000 --- a/tests/crashes/no-ice.rs +++ /dev/null @@ -1 +0,0 @@ -pub fn main() {}