Skip to content

Commit

Permalink
Auto merge of #42155 - seanmonstar:unimplemented, r=sfackler
Browse files Browse the repository at this point in the history
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)`.
  • Loading branch information
bors committed Jun 11, 2017
2 parents 27650ee + f517719 commit e2eaef8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/libcore/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit e2eaef8

Please sign in to comment.