Auto merge of #116548 - nnethercote:assert-long-condition, r=matthewjasper
Improve handling of assertion failures with very long conditions It's not perfectly clear what the best behaviour is here, but I think this is an improvement. r? `@matthewjasper` cc `@m-ou-se`
This commit is contained in:
commit
091bb74e7e
@ -85,7 +85,7 @@ pub fn expand_assert<'cx>(
|
||||
DUMMY_SP,
|
||||
Symbol::intern(&format!(
|
||||
"assertion failed: {}",
|
||||
pprust::expr_to_string(&cond_expr).escape_debug()
|
||||
pprust::expr_to_string(&cond_expr)
|
||||
)),
|
||||
)],
|
||||
);
|
||||
|
9
tests/ui/macros/assert-long-condition.rs
Normal file
9
tests/ui/macros/assert-long-condition.rs
Normal file
@ -0,0 +1,9 @@
|
||||
// run-fail
|
||||
// check-run-results
|
||||
// exec-env:RUST_BACKTRACE=0
|
||||
// ignore-emscripten no processes
|
||||
// ignore-tidy-linelength
|
||||
|
||||
fn main() {
|
||||
assert!(1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 == 0);
|
||||
}
|
4
tests/ui/macros/assert-long-condition.run.stderr
Normal file
4
tests/ui/macros/assert-long-condition.run.stderr
Normal file
@ -0,0 +1,4 @@
|
||||
thread 'main' panicked at $DIR/assert-long-condition.rs:8:5:
|
||||
assertion failed: 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18
|
||||
+ 19 + 20 + 21 + 22 + 23 + 24 + 25 == 0
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
Loading…
x
Reference in New Issue
Block a user