-
-
Notifications
You must be signed in to change notification settings - Fork 203
Closed
Description
When we have our own custom write! macro with a different declaration than the std one in scope, the Error derive fails (playground):
use thiserror::Error;
use std::io;
/// Our custom write macro
#[macro_export]
macro_rules! write {
($dst:expr, [$($arg:expr),+ $(,)?]) => {{
let result = $dst.write_fmt($crate::format_args!($($arg),+));
result
}}
}
#[derive(Error, Debug)]
pub enum FormatModuleError {
#[error("io error: {0}")]
IoError(io::Error),
}error: no rules expected the token `"io error: {field__0}"`
--> src/lib.rs:16:13
|
6 | macro_rules! write {
| ------------------ when calling this macro
...
16 | #[error("io error: {0}")]
| ^^^^^^^^^^^^^^^ no rules expected this token in macro call
|
note: while trying to match `[`
--> src/lib.rs:7:17
|
7 | ($dst:expr, [$($arg:expr),+ $(,)?]) => {{
| ^Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels