rust/library/core
Guillaume Gomez 16481a2857
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.
2021-02-17 20:38:00 +01:00
..
benches Add more benchmarks 2021-01-08 09:50:35 +00:00
src Rollup merge of #82169 - not-an-aardvark:assert-lazy-format-expressions, r=sfackler 2021-02-17 20:38:00 +01:00
tests stabilize partition_point 2021-02-12 21:57:17 +09:00
Cargo.toml mv std libs to library/ 2020-07-27 19:51:13 -05:00