Closed
Description
It would be nice to have a lint, that detects any use of the unreachable!
macro without arguments.
This is useful for procedural macros, where only the following is shown
error: proc-macro derive panicked
--> tests/test_union.rs:3:10
|
3 | #[derive(ShortHand)]
| ^^^^^^^^^
|
= help: message: internal error: entered unreachable code
error: aborting due to previous error
error: could not compile `shorthand`.
To learn more, run the command again with --verbose.
This is fine, if you only have one or two uses of unreachable
, but it becomes very difficult in larger codebases, because you have to check every occurrence of unreachable
in the codebase.
Adding some text to the macro will be a lot more helpful!
unreachable!("ident is neither enable nor disable")
error: proc-macro derive panicked
--> tests/test_union.rs:3:10
|
3 | #[derive(ShortHand)]
| ^^^^^^^^^
|
= help: message: internal error: entered unreachable code: ident is neither enable nor disable
error: aborting due to previous error
error: could not compile `shorthand`.
To learn more, run the command again with --verbose.
I think panic!
in a proc-macro has the same issue.