Closed
Description
It seems that #[deriving(Show)]
has stopped defining the Show
trait for structs.
In the code below, if I remove the #[cfg(skip)]
before the explicit Show derivation, the program runs correctly.
$ cargo --version
cargo 0.0.1-pre-nightly (8c01b6b 2015-01-08 20:52:43 +0000)
$ rustc --version
rustc 1.0.0-nightly (44a287e6e 2015-01-08 17:03:40 -0800)
$ cat src/main.rs
use std::fmt::{Error, Formatter, Show};
#[deriving(Show)]
struct Stuff;
#[cfg(skip)]
impl Show for Stuff {
fn fmt(&self, f: &mut Formatter) -> Result<(), Error> {
f.write_str("Stuff()")
}
}
fn main() {
let x = Stuff;
assert_eq!(format!("{:?}", x), "Stuff()");
}
$ cargo run --verbose
Compiling bug v0.0.1 (file:///home/jimb/rust/bug)
Running `rustc /home/jimb/rust/bug/src/main.rs --crate-name bug --crate-type bin -g --out-dir /home/jimb/rust/bug/target --emit=dep-info,link -L dependency=/home/jimb/rust/bug/target -L dependency=/home/jimb/rust/bug/target/deps`
/home/jimb/rust/bug/src/main.rs:15:32: 15:33 error: the trait `core::fmt::Show` is not implemented for the type `Stuff`
/home/jimb/rust/bug/src/main.rs:15 assert_eq!(format!("{:?}", x), "Stuff()");
^
note: in expansion of format_args!
<std macros>:2:28: 2:61 note: expansion site
<std macros>:1:1: 2:63 note: in expansion of format!
/home/jimb/rust/bug/src/main.rs:15:16: 15:35 note: expansion site
<std macros>:1:1: 9:39 note: in expansion of assert_eq!
/home/jimb/rust/bug/src/main.rs:15:5: 15:47 note: expansion site
error: aborting due to previous error
Could not compile `bug`.
Caused by:
Process didn't exit successfully: `rustc /home/jimb/rust/bug/src/main.rs --crate-name bug --crate-type bin -g --out-dir /home/jimb/rust/bug/target --emit=dep-info,link -L dependency=/home/jimb/rust/bug/target -L dependency=/home/jimb/rust/bug/target/deps` (status=101)
$
Metadata
Metadata
Assignees
Labels
No labels