Skip to content

Commit

Permalink
test #[derive(FromPrimitive)] triggers custom-derive error
Browse files Browse the repository at this point in the history
  • Loading branch information
durka committed Feb 4, 2016
1 parent f6e22e5 commit 45e716e
Showing 1 changed file with 4 additions and 23 deletions.
27 changes: 4 additions & 23 deletions src/test/compile-fail/deriving-primitive.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
Expand All @@ -8,27 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use std::num::FromPrimitive;
use std::isize;
#[derive(FromPrimitive)] //~ERROR `#[derive]` for custom traits is not stable
enum Foo {}

#[derive(FromPrimitive)]
struct A { x: isize }
//~^^ ERROR `FromPrimitive` cannot be derived for structs
//~^^^ ERROR `FromPrimitive` cannot be derived for structs
fn main() {}

#[derive(FromPrimitive)]
struct B(isize);
//~^^ ERROR `FromPrimitive` cannot be derived for structs
//~^^^ ERROR `FromPrimitive` cannot be derived for structs

#[derive(FromPrimitive)]
enum C { Foo(isize), Bar(usize) }
//~^^ ERROR `FromPrimitive` cannot be derived for enums with non-unit variants
//~^^^ ERROR `FromPrimitive` cannot be derived for enums with non-unit variants

#[derive(FromPrimitive)]
enum D { Baz { x: isize } }
//~^^ ERROR `FromPrimitive` cannot be derived for enums with non-unit variants
//~^^^ ERROR `FromPrimitive` cannot be derived for enums with non-unit variants

pub fn main() {}

0 comments on commit 45e716e

Please sign in to comment.