Skip to content

Commit 925986a

Browse files
committed
Work around stack overflow with LLVM 18
This bisects to rust-lang/rust#120055. Running tests/exhaustive.rs (target/release/deps/exhaustive-e2f6c3a78f65e6a2) running 1 test thread 'test' has overflowed its stack fatal runtime error: stack overflow error: test failed, to rerun pass `--test exhaustive` Caused by: process didn't exit successfully: `target/release/deps/exhaustive-e2f6c3a78f65e6a2` (signal: 6, SIGABRT: process abort signal)
1 parent e7b203f commit 925986a

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

tests/exhaustive.rs

+14-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use clang_ast::{Id, Kind, SourceLocation, SourceRange};
88
use serde::de::IgnoredAny;
99
use serde_derive::Deserialize;
10+
use std::thread::Builder as ThreadBuilder;
1011

1112
pub type Node = clang_ast::Node<Clang>;
1213

@@ -4135,8 +4136,19 @@ fn default_true() -> bool {
41354136
#[rustversion::since(2023-04-29)]
41364137
const _: [(); std::mem::size_of::<Node>()] = [(); 1472];
41374138

4139+
fn with_much_stack(test: impl FnOnce() + Send + 'static) {
4140+
ThreadBuilder::new()
4141+
.stack_size(4 * 1024 * 1024)
4142+
.spawn(test)
4143+
.unwrap()
4144+
.join()
4145+
.unwrap();
4146+
}
4147+
41384148
#[test]
41394149
fn test() {
4140-
let json = clang_ast_test_suite::cxx_ast_json();
4141-
let _: Node = serde_json::from_slice(&json).unwrap();
4150+
with_much_stack(|| {
4151+
let json = clang_ast_test_suite::cxx_ast_json();
4152+
let _: Node = serde_json::from_slice(&json).unwrap();
4153+
});
41424154
}

0 commit comments

Comments
 (0)