about summary refs log tree commit diff
path: root/tests/ui/lint/dead-code/allow-or-expect-dead_code-114557-2.rs
blob: db23dcd5e5eb76a617392a392ec17778d1df13f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//@ check-pass

// this test checks that the `dead_code` lint is *NOT* being emitted
// for `foo` as `foo` is being used by `main`, and so the `#[expect]`
// is unfulfilled
//
// it also checks that the `dead_code` lint is also *NOT* emitted
// for `bar` as it's suppresed by the `#[expect]` on `bar`

#![warn(dead_code)] // to override compiletest

fn bar() {}

#[expect(dead_code)]
//~^ WARN this lint expectation is unfulfilled
fn foo() { bar() }

fn main() { foo() }