rust/src/libcore
bors 410d807e46 Auto merge of #39554 - zackmdavis:assert_eq_has_a_terrible_error_message_when_given_a_trailing_comma, r=BurntSushi
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.

-----

**Before:**
```
$ rustc scratch.rs
error: requires at least a format string argument
 --> scratch.rs:2:5
  |
2 |     assert_eq!(1, 2,);
  |     ^^^^^^^^^^^^^^^^^^
  |
  = note: this error originates in a macro outside of the current crate

error: aborting due to previous error
```

**After:**
```
$ ./build/x86_64-unknown-linux-gnu/stage1/bin/rustc scratch.rs
error: unexpected end of macro invocation
 --> scratch.rs:2:20
  |
2 |     assert_eq!(1, 2,);
  |                    ^
```
2017-02-12 03:34:57 +00:00
..
benches Extract collections benchmarks to libcollections/benches 2017-02-06 21:38:47 +11:00
fmt name anonymous fn parameters in libcore traits 2017-02-09 22:31:21 +01:00
hash Bump version, upgrade bootstrap 2017-02-03 13:25:46 -08:00
iter iterator docs: Move paragraph about discarding; clarify "consumed" 2017-02-10 01:35:29 -05:00
num Auto merge of #39408 - ollie27:i128_try_from, r=alexcrichton 2017-02-05 16:57:29 +00:00
prelude Run rustfmt on libcore/prelude folder 2016-10-16 22:13:04 +05:30
str name anonymous fn parameters in libcore traits 2017-02-09 22:31:21 +01:00
sync Revert "Add 128-bit atomics" 2017-02-06 10:39:14 -08:00
any.rs Change to_owned to to_string in docs 2017-01-13 01:57:48 +01:00
array.rs std: Correct stability attributes for some implementations 2016-10-01 23:58:14 +01:00
borrow.rs Use #[prelude_import] in libcore. 2016-08-24 22:12:23 +00:00
Cargo.toml Extract collections benchmarks to libcollections/benches 2017-02-06 21:38:47 +11:00
cell.rs Update cell docs 2017-02-01 22:51:52 -05:00
char.rs Fix a few impl stability attributes 2017-01-29 13:31:47 +00:00
char_private.rs Fix fmt::Debug for strings, e.g. for Chinese characters 2016-11-18 14:45:59 +01:00
clone.rs Bump version, upgrade bootstrap 2017-02-03 13:25:46 -08:00
cmp.rs Bump version, upgrade bootstrap 2017-02-03 13:25:46 -08:00
convert.rs Add a name for the parameter to TryFrom::try_from. 2017-02-02 17:40:44 -08:00
default.rs Bump version, upgrade bootstrap 2017-02-03 13:25:46 -08:00
internal_macros.rs Fix a few impl stability attributes 2017-01-29 13:31:47 +00:00
intrinsics.rs Clarify zero-value behavior of ctlz/cttz intrinsics. 2016-12-15 12:55:41 -05:00
iter_private.rs Expand .zip() specialization to .map() and .cloned() 2016-10-17 10:58:21 +02:00
lib.rs Bump version, upgrade bootstrap 2017-02-03 13:25:46 -08:00
macros.rs improve error message when two-arg assert_eq! receives a trailing comma 2017-02-06 22:33:09 -08:00
marker.rs Remove Reflect 2017-01-24 23:22:44 +01:00
mem.rs Add missing urls for mem module 2016-11-11 18:50:54 +01:00
nonzero.rs Bump version, upgrade bootstrap 2017-02-03 13:25:46 -08:00
ops.rs name anonymous fn parameters in libcore traits 2017-02-09 22:31:21 +01:00
option.rs Rollup merge of #39289 - shahn:option_entry, r=alexcrichton 2017-02-05 09:14:42 -05:00
panicking.rs Mark all extern functions as nounwind 2015-09-14 11:36:09 +02:00
ptr.rs std: Stabilize APIs for the 1.16.0 release 2017-01-25 16:43:01 -08:00
raw.rs Clean up std::raw docs 2016-08-05 17:52:37 -04:00
result.rs std: Stabilize APIs for the 1.16.0 release 2017-01-25 16:43:01 -08:00
slice.rs Remove unnecessary specialization for [u8] 2017-02-08 18:03:10 +01:00
tuple.rs Remove macro work-around. 2016-11-12 12:47:13 -07:00