diff options
| author | bors <bors@rust-lang.org> | 2017-06-11 18:56:27 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2017-06-11 18:56:27 +0000 |
| commit | e2eaef8497bd212694840515a568d592b17d0e07 (patch) | |
| tree | 86b81d0d0821a4786e2518a82c5d70d1ca0a3f4e /src/libcore | |
| parent | 27650ee8ab612cc3d5f4e3439b56b3a352177f44 (diff) | |
| parent | f51771939ba5b36ec89b9f0b51c2cbda51164676 (diff) | |
| download | rust-e2eaef8497bd212694840515a568d592b17d0e07.tar.gz rust-e2eaef8497bd212694840515a568d592b17d0e07.zip | |
Auto merge of #42155 - seanmonstar:unimplemented, r=sfackler
core: allow messages in unimplemented!() macro
This makes `unimplemented!()` match `unreachable!()`, allowing a message and possible formatting to be provided to better explain what and/or why something is not implemented.
I've used this myself in hyper for a while, include the type and method name, to better help while prototyping new modules, like `unimplemented!("Conn::poll_complete")`, or `unimplemented!("Conn::poll; state={:?}", state)`.
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/macros.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs index 99000a031fe..d68fad4972c 100644 --- a/src/libcore/macros.rs +++ b/src/libcore/macros.rs @@ -550,7 +550,8 @@ macro_rules! unreachable { #[macro_export] #[stable(feature = "rust1", since = "1.0.0")] macro_rules! unimplemented { - () => (panic!("not yet implemented")) + () => (panic!("not yet implemented")); + ($($arg:tt)+) => (panic!("not yet implemented: {}", format_args!($($arg)*))); } /// Built-in macros to the compiler itself. |
