2013-09-25 23:46:14 -05:00
|
|
|
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
|
|
|
use std::num::FromPrimitive;
|
2015-01-08 04:54:35 -06:00
|
|
|
use std::isize;
|
2013-09-25 23:46:14 -05:00
|
|
|
|
2014-12-30 22:32:49 -06:00
|
|
|
#[derive(FromPrimitive)]
|
2015-01-08 04:54:35 -06:00
|
|
|
struct A { x: isize }
|
2013-09-25 23:46:14 -05:00
|
|
|
//~^^ ERROR `FromPrimitive` cannot be derived for structs
|
|
|
|
//~^^^ ERROR `FromPrimitive` cannot be derived for structs
|
|
|
|
|
2014-12-30 22:32:49 -06:00
|
|
|
#[derive(FromPrimitive)]
|
2015-01-08 04:54:35 -06:00
|
|
|
struct B(isize);
|
2013-09-25 23:46:14 -05:00
|
|
|
//~^^ ERROR `FromPrimitive` cannot be derived for structs
|
|
|
|
//~^^^ ERROR `FromPrimitive` cannot be derived for structs
|
|
|
|
|
2014-12-30 22:32:49 -06:00
|
|
|
#[derive(FromPrimitive)]
|
2015-01-08 05:02:42 -06:00
|
|
|
enum C { Foo(isize), Bar(usize) }
|
2015-10-01 10:47:27 -05:00
|
|
|
//~^^ ERROR `FromPrimitive` cannot be derived for enums with non-unit variants
|
|
|
|
//~^^^ ERROR `FromPrimitive` cannot be derived for enums with non-unit variants
|
2013-09-25 23:46:14 -05:00
|
|
|
|
2014-12-30 22:32:49 -06:00
|
|
|
#[derive(FromPrimitive)]
|
2015-01-08 04:54:35 -06:00
|
|
|
enum D { Baz { x: isize } }
|
2015-10-01 10:47:27 -05:00
|
|
|
//~^^ ERROR `FromPrimitive` cannot be derived for enums with non-unit variants
|
|
|
|
//~^^^ ERROR `FromPrimitive` cannot be derived for enums with non-unit variants
|
2013-09-25 23:46:14 -05:00
|
|
|
|
2013-09-29 02:04:28 -05:00
|
|
|
pub fn main() {}
|