File: multiple-dead-codes-in-the-same-struct.rs

package info (click to toggle)
rustc 1.85.0%2Bdfsg3-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, forky, sid, trixie
  • size: 893,396 kB
  • sloc: xml: 158,127; python: 35,830; javascript: 19,497; cpp: 19,002; sh: 17,245; ansic: 13,127; asm: 4,376; makefile: 1,051; perl: 29; lisp: 29; ruby: 19; sql: 11
file content (33 lines) | stat: -rw-r--r-- 658 bytes parent folder | download | duplicates (6)
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
#![warn(dead_code)]

struct Bar {
    #[allow(dead_code)]
    a: usize,
    #[forbid(dead_code)]
    b: usize, //~ ERROR field `b` is never read
    #[deny(dead_code)]
    c: usize, //~ ERROR fields `c` and `e` are never read
    d: usize, //~ WARN fields `d`, `f`, and `g` are never read
    #[deny(dead_code)]
    e: usize,
    f: usize,
    g: usize,
    _h: usize,
}

// Issue 119267: this should not ICE.
#[derive(Debug)]
struct Foo(usize, #[allow(unused)] usize); //~ WARN struct `Foo` is never constructed

fn main() {
    Bar {
        a: 1,
        b: 1,
        c: 1,
        d: 1,
        e: 1,
        f: 1,
        g: 1,
        _h: 1,
    };
}