about summary refs log tree commit diff
path: root/tests/ui/lint/deny-inside-forbid-ignored.rs
blob: b14a3e94bb55b502d57d62db87143516046d849e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
//! Ensure that using deny inside forbid is treated as a no-op, and does not override the level to
//! deny.

//@ revisions: source_only cli_forbid cli_forbid_warnings
//@[cli_forbid] compile-flags: -F unsafe_code
//@[cli_forbid_warnings] compile-flags: -F warnings

#[forbid(unsafe_code)] // NO UNSAFE CODE IN HERE!!
fn main() {
    #[deny(unsafe_code)] // m-m-maybe we can have unsafe code in here?
    {
        #[allow(unsafe_code)] // let's have some unsafe code in here
        //~^ ERROR allow(unsafe_code) incompatible with previous forbid
        //~| ERROR allow(unsafe_code) incompatible with previous forbid
        {
            unsafe { /* ≽^•⩊•^≼ */ }
            //~^ ERROR usage of an `unsafe` block
        }
    }
}