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)`.
This commit is contained in:
bors 2017-06-11 18:56:27 +00:00
commit e2eaef8497
1 changed files with 2 additions and 1 deletions

View File

@ -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.