Skip to content

Commit

Permalink
chore(GH-160): try fixing thread_local_initializer_can_be_made_const
Browse files Browse the repository at this point in the history
  • Loading branch information
JarvisCraft committed May 10, 2024
1 parent d7be675 commit d2cbc43
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,6 @@ manual_let_else = "allow"
# Something is broken about that lint, can't be allowed for
# codegenerated-stdlib block
similar_names = "allow"
# seems to produce false positives
thread_local_initializer_can_be_made_const = "allow"

#[profile.test]
#opt-level = 1
Expand Down
9 changes: 6 additions & 3 deletions crates/jrsonnet-evaluator/src/stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,19 @@ struct StackLimit {
}

#[cfg(feature = "nightly")]
#[allow(clippy::thread_local_initializer_can_be_made_const)]
#[thread_local]
static STACK_LIMIT: StackLimit = StackLimit {
max_stack_size: Cell::new(200),
current_depth: Cell::new(0),
};
#[cfg(not(feature = "nightly"))]
thread_local! {
static STACK_LIMIT: StackLimit = StackLimit {
max_stack_size: Cell::new(200),
current_depth: Cell::new(0),
static STACK_LIMIT: StackLimit = const {
StackLimit {
max_stack_size: Cell::new(200),
current_depth: Cell::new(0),
}
};
}

Expand Down

0 comments on commit d2cbc43

Please sign in to comment.