Skip to content

Can't use deriving with #![no_std] #16803

Closed
@kmcallister

Description

@kmcallister
#![no_std]

extern crate core;
extern crate native;

#[deriving(PartialEq)]
struct Foo;

fn main() { }

gives

foo.rs:6:12: 6:15 error: failed to resolve. Maybe a missing `extern crate std`?
foo.rs:6 #[deriving(PartialEq)]
                    ^~~
note: in expansion of #[deriving]
foo.rs:6:1: 6:23 note: expansion site
foo.rs:6:12: 6:21 error: attempt to implement a nonexistent trait `std::cmp::PartialEq`
foo.rs:6 #[deriving(PartialEq)]
                    ^~~~~~~~~
note: in expansion of #[deriving]
foo.rs:6:1: 6:23 note: expansion site
error: aborting due to 2 previous errors

requiring this workaround:

mod std {
    pub use core::cmp;
}

rustc 0.12.0-pre (e11cb5b 2014-08-20 16:25:53 +0000)

Metadata

Metadata

Assignees

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