Skip to content

Commit d6e70df

Browse files
committed
crashes: add another test showing that everything works fine when we need compile-flags to repro an ice and add README
1 parent 7b05360 commit d6e70df

File tree

4 files changed

+29
-2
lines changed

4 files changed

+29
-2
lines changed

src/tools/opt-dist/src/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ llvm-config = "{llvm_config}"
9696
"tests/pretty",
9797
"tests/run-pass-valgrind",
9898
"tests/ui",
99-
"tests/crases",
99+
"tests/crashes",
100100
];
101101
for test_path in env.skipped_tests() {
102102
args.extend(["--skip", test_path]);

tests/crashes/122909.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//@ compile-flags: -Zpolymorphize=on -Zinline-mir=yes
2+
//@ known-bug: #12345
3+
4+
5+
use std::sync::{Arc, Context, Weak};
6+
7+
pub struct WeakOnce<T>();
8+
impl<T> WeakOnce<T> {
9+
extern "rust-call" fn try_get(&self) -> Option<Arc<T>> {}
10+
11+
pub fn get(&self) -> Arc<T> {
12+
self.try_get()
13+
.unwrap_or_else(|| panic!("Singleton {} not available", std::any::type_name::<T>()))
14+
}
15+
}

tests/crashes/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
This is serves as a collection of crashes so that accidental ICE fixes are tracked.
2+
This was formally done at https://github.com/rust-lang/glacier but doing it inside
3+
the rustc testsuite is more convenient.
4+
5+
It is imperative that a test in the suite causes an internal compiler error/panic
6+
or makes rustc crash in some other way.
7+
Accepted exit codes are: 101 (may be expanded later)
8+
9+
When adding crashes from https://github.com/rust-lang/rust/issues, the
10+
issue number should be noted in the file name (12345.rs should suffice)
11+
and perhaps also inside the file via `//@ known-bug #4321`
12+
13+
If you happen to fix one of the crashes, please move it to `tests/ui`! :)

tests/crashes/no-ice.rs

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)