When anything other than a Lit::str is passed to a doc attribute, displaydoc will panic with "not implemented" instead of instructing the user to pass a literal
There are some reasonable usecases for non literals like include_str! to be used in doc attributes. It seems in a prior version, there was a more specific message, as seen in #36
What do y'all think of providing a more specific message instead of using a raw unimplemented! macro? Alternatively, a select list of macros like concat!, include_str! could be evaluated further, though of course this option is far more complex
Minimal reproduction
#[derive(Display)]
#[doc = include_str!("./hi.txt")]
struct Foo;
error: proc-macro derive panicked
--> tests/ui/non_string_doc_expr.rs:3:10
|
3 | #[derive(Display)]
| ^^^^^^^
|
= help: message: not implemented
When anything other than a
Lit::stris passed to a doc attribute, displaydoc will panic with "not implemented" instead of instructing the user to pass a literalThere are some reasonable usecases for non literals like
include_str!to be used in doc attributes. It seems in a prior version, there was a more specific message, as seen in #36What do y'all think of providing a more specific message instead of using a raw
unimplemented!macro? Alternatively, a select list of macros likeconcat!,include_str!could be evaluated further, though of course this option is far more complexMinimal reproduction