]> git.lizzy.rs Git - rust.git/blob - tests/ui/lint/outer-forbid.rs
Rollup merge of #106889 - scottmcm:windows-mut, r=cuviper
[rust.git] / tests / ui / lint / outer-forbid.rs
1 // Forbidding a group (here, `unused`) overrules subsequent allowance of both
2 // the group, and an individual lint in the group (here, `unused_variables`);
3 // and, forbidding an individual lint (here, `non_snake_case`) overrules
4 // subsequent allowance of a lint group containing it (here, `nonstandard_style`). See
5 // Issue #42873.
6
7 // If you turn off deduplicate diagnostics (which rustc turns on by default but
8 // compiletest turns off when it runs ui tests), then the errors are
9 // (unfortunately) repeated here because the checking is done as we read in the
10 // errors, and currently that happens two or three different times, depending on
11 // compiler flags.
12 //
13 // The test is much cleaner if we deduplicate, though.
14
15 // compile-flags: -Z deduplicate-diagnostics=yes
16
17 #![forbid(unused, non_snake_case)]
18 #![forbid(forbidden_lint_groups)]
19
20 #[allow(unused_variables)]
21 //~^ ERROR incompatible with previous
22 //~| WARNING this was previously accepted by the compiler
23 fn foo() {}
24
25 #[allow(unused)] //~ ERROR incompatible with previous
26 //~^ WARNING this was previously accepted by the compiler
27 fn bar() {}
28
29 #[allow(nonstandard_style)] //~ ERROR incompatible with previous
30 fn main() {
31     println!("hello forbidden world")
32 }