summaryrefslogtreecommitdiffstats
path: root/third_party/rust/num-derive/src/test.rs
blob: c4cd7fe5283834629c6ad776a2e36536755fdf55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//! This module uses doc-tests on modules for `compile_fail`

// We need "syn/full" to parse macros.
// Use `--nocapture` to check the quality of the error message.
#[cfg(not(feature = "full-syntax"))]
/// ```compile_fail
/// macro_rules! get_an_isize {
///     () => (0_isize)
/// }
///
/// #[derive(num_derive::FromPrimitive)]
/// pub enum CLikeEnum {
///     VarA = get_an_isize!(), // error without "syn/full"
///     VarB = 2,
/// }
/// ```
mod issue16 {}

#[cfg(feature = "full-syntax")]
/// ```
/// macro_rules! get_an_isize {
///     () => (0_isize)
/// }
///
/// #[derive(num_derive::FromPrimitive)]
/// pub enum CLikeEnum {
///     VarA = get_an_isize!(), // ok with "syn/full"
///     VarB = 2,
/// }
/// ```
mod issue16 {}