rust/library
Mara 04045cc83f
Rollup merge of #82770 - m-ou-se:assert-match, r=joshtriplett
Add assert_matches macro.

This adds `assert_matches!(expression, pattern)`.

Unlike the other asserts, this one ~~consumes the expression~~ may consume the expression, to be able to match the pattern. (It could add a `&` implicitly, but that's noticable in the pattern, and will make a consuming guard impossible.)

See https://github.com/rust-lang/rust/issues/62633#issuecomment-790737853

This re-uses the same `left: .. right: ..` output as the `assert_eq` and `assert_ne` macros, but with the pattern as the right part:

assert_eq:
```
assertion failed: `(left == right)`
  left: `Some("asdf")`,
 right: `None`
```
assert_matches:
```
assertion failed: `(left matches right)`
  left: `Ok("asdf")`,
 right: `Err(_)`
```

cc ```@cuviper```
2021-03-05 10:57:23 +01:00
..
alloc Rollup merge of #82764 - m-ou-se:map-try-insert, r=Amanieu 2021-03-05 10:57:22 +01:00
backtrace@af078ecc0b
core Rollup merge of #82770 - m-ou-se:assert-match, r=joshtriplett 2021-03-05 10:57:23 +01:00
panic_abort
panic_unwind Revert stabilizing integer::BITS. 2021-02-03 22:23:58 +01:00
proc_macro impl PartialEq<Punct> for char; symmetry for #78636 2021-02-19 17:28:19 -08:00
profiler_builtins Build newly added InstrProfilingVersionVar.c file 2021-03-01 23:35:35 +01:00
rtstartup
rustc-std-workspace-alloc
rustc-std-workspace-core
rustc-std-workspace-std
std Rollup merge of #82770 - m-ou-se:assert-match, r=joshtriplett 2021-03-05 10:57:23 +01:00
stdarch@9c732a56f6
term Allow/fix non_fmt_panic in tests. 2021-02-03 23:15:45 +01:00
test Auto merge of #82350 - ehuss:test-chapter, r=jyn514 2021-02-28 09:18:27 +00:00
unwind Remove the x86_64-rumprun-netbsd target 2021-02-27 17:55:22 +02:00