Skip to content

Commit 1b6d284

Browse files
committed
refactor derive-no-std test, add empty struct/enum
1 parent eabfc16 commit 1b6d284

File tree

2 files changed

+37
-14
lines changed

2 files changed

+37
-14
lines changed

src/test/run-pass-fulldeps/derive-no-std.rs renamed to src/test/auxiliary/derive-no-std.rs

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,33 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(rand, collections, rustc_private)]
12-
#![no_std]
11+
// no-prefer-dynamic
1312

14-
extern crate rand;
15-
extern crate serialize as rustc_serialize;
16-
extern crate collections;
13+
#![crate_type = "rlib"]
14+
#![no_std]
1715

1816
// Issue #16803
1917

2018
#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord,
2119
Debug, Default, Copy)]
22-
struct Foo {
23-
x: u32,
20+
pub struct Foo {
21+
pub x: u32,
2422
}
2523

2624
#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord,
2725
Debug, Copy)]
28-
enum Bar {
26+
pub enum Bar {
2927
Qux,
3028
Quux(u32),
3129
}
3230

33-
enum Baz { A=0, B=5, }
31+
#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord,
32+
Debug, Copy)]
33+
pub enum Void {}
34+
#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord,
35+
Debug, Copy)]
36+
pub struct Empty;
37+
#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord,
38+
Debug, Copy)]
39+
pub struct AlsoEmpty {}
3440

35-
fn main() {
36-
Foo { x: 0 };
37-
Bar::Quux(3);
38-
Baz::A;
39-
}

src/test/run-pass/derive-no-std.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// aux-build:derive-no-std.rs
12+
13+
extern crate derive_no_std;
14+
use derive_no_std::*;
15+
16+
fn main() {
17+
let f = Foo { x: 0 };
18+
assert_eq!(f.clone(), Foo::default());
19+
20+
assert!(Bar::Qux < Bar::Quux(42));
21+
}
22+

0 commit comments

Comments
 (0)