You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On rustc 1.43.1 stable, the following code results in error[E0425]: cannot find value `_0` in this scope:
use thiserror::Error;macro_rules! decl_error {($($Variant:ident($Value:ident)),*) => {
#[derive(Debug,Error)]// <- E0425 herepubenumFoo{
$(
#[error("{0:?}")]
$Variant($Value),)*}};}decl_error!(Foo(u8),Bar(u16),Baz(u32));// For comparison, normal usage does not result in errors.#[derive(Debug,Error)]pubenumBar{#[error("{0:?}")]Foo(u8),#[error("{0:?}")]Bar(u16),#[error("{0:?}")]Baz(u32)}
Curiously, the output of cargo-expand seems fine. Any possibility of a bug in rustc?
Thanks for the nice repro. You are right that this is due to a compiler bug (rust-lang/rust#43081) but I've published a workaround in thiserror 1.0.18.
On rustc 1.43.1 stable, the following code results in
error[E0425]: cannot find value `_0` in this scope
:Curiously, the output of
cargo-expand
seems fine. Any possibility of a bug in rustc?Output of cargo-expand
The text was updated successfully, but these errors were encountered: