File: attribute.rs

package info (click to toggle)
rust-auto-enums 0.8.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 852 kB
  • sloc: makefile: 2
file content (35 lines) | stat: -rw-r--r-- 833 bytes parent folder | download
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
32
33
34
35
// SPDX-License-Identifier: Apache-2.0 OR MIT

use auto_enums::auto_enum;

#[auto_enum(Iterator)]
fn unexpected_token_in_never(x: usize) -> impl Iterator<Item = i32> {
    match x {
        0 => 1..8,
        #[never(foo)] //~ ERROR unexpected token
        1 => panic!(),
        _ => (0..2).map(|x| x + 1),
    }
}

#[auto_enum(Iterator)]
fn unexpected_token_in_nested(x: usize) -> impl Iterator<Item = i32> {
    match x {
        0 => 1..8,
        #[nested(foo)] //~ ERROR unexpected token
        1 => panic!(),
        _ => (0..2).map(|x| x + 1),
    }
}

#[auto_enum(Iterator)]
fn removed_rec(x: usize) -> impl Iterator<Item = i32> {
    match x {
        0 => 1..8,
        #[rec] //~ ERROR #[rec] has been removed and replaced with #[nested]
        1 => panic!(),
        _ => (0..2).map(|x| x + 1),
    }
}

fn main() {}