Skip to content

Commit d30bd5f

Browse files
committed
Remove recursion_limit special casing in tests
1 parent 2e13684 commit d30bd5f

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

crates/hir-def/src/body/tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ fn your_stack_belongs_to_me() {
5252
cov_mark::check!(your_stack_belongs_to_me);
5353
lower(
5454
r#"
55+
#![recursion_limit = "32"]
5556
macro_rules! n_nuple {
5657
($e:tt) => ();
5758
($($rest:tt)*) => {{
@@ -68,6 +69,7 @@ fn your_stack_belongs_to_me2() {
6869
cov_mark::check!(overflow_but_not_me);
6970
lower(
7071
r#"
72+
#![recursion_limit = "32"]
7173
macro_rules! foo {
7274
() => {{ foo!(); foo!(); }}
7375
}
@@ -78,8 +80,6 @@ fn main() { foo!(); }
7880

7981
#[test]
8082
fn recursion_limit() {
81-
cov_mark::check!(your_stack_belongs_to_me);
82-
8383
lower(
8484
r#"
8585
#![recursion_limit = "2"]

crates/hir-def/src/nameres/collector.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1451,13 +1451,7 @@ impl DefCollector<'_> {
14511451
depth: usize,
14521452
container: ItemContainerId,
14531453
) {
1454-
let recursion_limit = self.def_map.recursion_limit() as usize;
1455-
let recursion_limit = Limit::new(if cfg!(test) {
1456-
// Without this, `body::tests::your_stack_belongs_to_me` stack-overflows in debug
1457-
std::cmp::min(32, recursion_limit)
1458-
} else {
1459-
recursion_limit
1460-
});
1454+
let recursion_limit = Limit::new(self.def_map.recursion_limit() as usize);
14611455
if recursion_limit.check(depth).is_err() {
14621456
cov_mark::hit!(macro_expansion_overflow);
14631457
tracing::warn!("macro expansion is too deep");

0 commit comments

Comments
 (0)