diff --git a/impl/Cargo.toml b/impl/Cargo.toml index a52ab74f..16fdb9a8 100644 --- a/impl/Cargo.toml +++ b/impl/Cargo.toml @@ -25,7 +25,7 @@ proc-macro = true [dependencies] proc-macro2 = "1.0" quote = "1.0" -syn = "2.0" +syn = "2.0.45" convert_case = { version = "0.6", optional = true } unicode-xid = { version = "0.2.2", optional = true } diff --git a/tests/debug.rs b/tests/debug.rs index d2ca8776..9b1e45a8 100644 --- a/tests/debug.rs +++ b/tests/debug.rs @@ -1914,3 +1914,21 @@ mod generic { } } } + +// See: https://github.com/JelteF/derive_more/issues/301 +mod complex_enum_syntax { + #[cfg(not(feature = "std"))] + use alloc::{boxed::Box, format}; + + use derive_more::Debug; + + #[derive(Debug)] + enum Enum { + A = if cfg!(unix) { 2 } else { 3 }, + } + + #[test] + fn assert() { + assert_eq!(format!("{:?}", Enum::A), "A"); + } +}