rust/src/test/ui/lint/reasons-forbidden.rs
Vadim Petrochenkov 642669c74d Update tests
2020-01-09 21:23:12 +03:00

30 lines
999 B
Rust

#![feature(lint_reasons)]
#![forbid(
unsafe_code,
//~^ NOTE `forbid` level set here
//~| NOTE `forbid` level set here
//~| NOTE `forbid` level set here
reason = "our errors & omissions insurance policy doesn't cover unsafe Rust"
)]
use std::ptr;
fn main() {
let a_billion_dollar_mistake = ptr::null();
#[allow(unsafe_code)]
//~^ ERROR allow(unsafe_code) overruled by outer forbid(unsafe_code)
//~| ERROR allow(unsafe_code) overruled by outer forbid(unsafe_code)
//~| ERROR allow(unsafe_code) overruled by outer forbid(unsafe_code)
//~| NOTE overruled by previous forbid
//~| NOTE overruled by previous forbid
//~| NOTE overruled by previous forbid
//~| NOTE our errors & omissions insurance policy doesn't cover unsafe Rust
//~| NOTE our errors & omissions insurance policy doesn't cover unsafe Rust
//~| NOTE our errors & omissions insurance policy doesn't cover unsafe Rust
unsafe {
*a_billion_dollar_mistake
}
}