Skip to content

Rust Reference still talks about #[deriving(...)], instead of #[derive(...)] #20984

Closed

Description

@jimblandy

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)
$

Activity

  1. jimblandy commented on Jan 12, 2015

    @jimblandy
    ContributorAuthor

    Ah, sorry. This is a doc issue. #[derive(Show)] works. The Rust reference still describes deriving.

  2. changed the title [-]#[deriving(Show)] doesn't derive Show[/-] [+]Rust Reference still talks about #[deriving(...)], instead of #[derive(...)][/+] on Jan 12, 2015
  3. nrc commented on Jan 12, 2015

    @nrc
    Member
  4. added a commit that references this issue on Nov 29, 2018
    1a3523a
  5. added a commit that references this issue on Mar 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions