crashes: add another test showing that everything works fine when we need compile-flags to repro an ice and add README

This commit is contained in:
Matthias Krüger 2024-03-24 13:07:30 +01:00
parent 7b05360a1e
commit d6e70df1a2
4 changed files with 29 additions and 2 deletions

View File

@ -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]);

15
tests/crashes/122909.rs Normal file
View File

@ -0,0 +1,15 @@
//@ compile-flags: -Zpolymorphize=on -Zinline-mir=yes
//@ known-bug: #12345
use std::sync::{Arc, Context, Weak};
pub struct WeakOnce<T>();
impl<T> WeakOnce<T> {
extern "rust-call" fn try_get(&self) -> Option<Arc<T>> {}
pub fn get(&self) -> Arc<T> {
self.try_get()
.unwrap_or_else(|| panic!("Singleton {} not available", std::any::type_name::<T>()))
}
}

13
tests/crashes/README.md Normal file
View File

@ -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`! :)

View File

@ -1 +0,0 @@
pub fn main() {}