about summary refs log tree commit diff
path: root/library/std/src/sys/unix/stack_overflow.rs
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2021-02-17 20:38:00 +0100
committerGitHub <noreply@github.com>2021-02-17 20:38:00 +0100
commit16481a285733f004ab9c5573c1e7fd5b602b3ddd (patch)
tree9e71eb79ade91c6e7633b163b389450246a830fd /library/std/src/sys/unix/stack_overflow.rs
parent13730e90bde2e55efa31b127e2175d5e90772044 (diff)
parent15197cbc61450bd19328387ad9a04500e35d7086 (diff)
downloadrust-16481a285733f004ab9c5573c1e7fd5b602b3ddd.tar.gz
rust-16481a285733f004ab9c5573c1e7fd5b602b3ddd.zip
Rollup merge of #82169 - not-an-aardvark:assert-lazy-format-expressions, r=sfackler
Document that `assert!` format arguments are evaluated lazily

It can be useful to do some computation in `assert!` format arguments, in order to get better error messages. For example:

```rust
assert!(
    some_condition,
    "The state is invalid. Details: {}",
    expensive_call_to_get_debugging_info(),
);
```

It seems like `assert!` only evaluates the format arguments if the assertion fails, which is useful but doesn't appear to be documented anywhere. This PR documents the behavior and adds some tests.
Diffstat (limited to 'library/std/src/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions