]> git.lizzy.rs Git - rust.git/blob - src/test/ui/lint/outer-forbid.rs
Rollup merge of #87180 - notriddle:notriddle/sidebar-keyboard-mobile, r=GuillaumeGomez
[rust.git] / src / test / 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)] //~ ERROR incompatible with previous
21 //~^ ERROR incompatible with previous
22 //~| WARNING this was previously accepted by the compiler
23 //~| WARNING this was previously accepted by the compiler
24 fn foo() {}
25
26 #[allow(unused)] //~ ERROR incompatible with previous
27 //~^ WARNING this was previously accepted by the compiler
28 fn bar() {}
29
30 #[allow(nonstandard_style)] //~ ERROR incompatible with previous
31 fn main() {
32     println!("hello forbidden world")
33 }