Skip to content

Commit e2eaef8

Browse files
committed
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)`.
2 parents 27650ee + f517719 commit e2eaef8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/libcore/macros.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,8 @@ macro_rules! unreachable {
550550
#[macro_export]
551551
#[stable(feature = "rust1", since = "1.0.0")]
552552
macro_rules! unimplemented {
553-
() => (panic!("not yet implemented"))
553+
() => (panic!("not yet implemented"));
554+
($($arg:tt)+) => (panic!("not yet implemented: {}", format_args!($($arg)*)));
554555
}
555556

556557
/// Built-in macros to the compiler itself.

0 commit comments

Comments
 (0)