about summary refs log tree commit diff
path: root/src/test/debuginfo/enum-thinlto.rs
diff options
context:
space:
mode:
authorTeddy Katz <teddy.katz@gmail.com>2021-02-15 21:06:00 -0500
committerTeddy Katz <teddy.katz@gmail.com>2021-02-16 00:55:46 -0500
commitcb653b100c43118beed5bbd84cd8b832362a355f (patch)
treef757f0999c3f9622ef81bf8a07a228d48fc810f5 /src/test/debuginfo/enum-thinlto.rs
parentd1206f950ffb76c76e1b74a19ae33c2b7d949454 (diff)
downloadrust-cb653b100c43118beed5bbd84cd8b832362a355f.tar.gz
rust-cb653b100c43118beed5bbd84cd8b832362a355f.zip
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 'src/test/debuginfo/enum-thinlto.rs')
0 files changed, 0 insertions, 0 deletions