This website requires JavaScript.
Explore
Help
Register
Sign In
mikros
/
rust
Watch
1
Star
0
Fork
0
You've already forked rust
Code
Issues
Pull Requests
Packages
Projects
Releases
Wiki
Activity
0a08841bb0
rust
/
src
/
test
/
ui
/
assert-eq-trailing-comma.rs
6 lines
50 B
Rust
Raw
Normal View
History
Unescape
Escape
tests: Add missing run-pass annotations
2019-07-26 16:54:25 -05:00
// run-pass
improve error message when two-arg assert_eq! receives a trailing comma Previously, `assert_eq!(left, right,)` (respectively, `assert_ne!(left, right,)`; note the trailing comma) would result in a confusing "requires at least a format string argument" error. In reality, a format string is optional, but the trailing comma puts us into the "match a token tree of zero or more tokens" branch of the macro (in order to support the optional format string), and passing the empty token tree into `format_args!` results in the confusing error. If instead we match a token tree of one or more tokens, we get a much more sensible "unexpected end of macro invocation" error. While we're here, fix up a stray space before a comma in the match guards. Resolves #39369.
2017-02-05 00:47:46 -06:00
fn
main
(
)
{
assert_eq!
(
1
,
1
,
)
;
}
Reference in New Issue
Copy Permalink