]> git.lizzy.rs Git - rust.git/blob - src/test/ui/conditional-compilation/cfg-attr-multi-true.rs
Do not complain about missing `fn main()` in some cases
[rust.git] / src / test / ui / conditional-compilation / cfg-attr-multi-true.rs
1 // Test that cfg_attr with multiple attributes actually emits both attributes.
2 // This is done by emitting two attributes that cause new warnings, and then
3 // triggering those warnings.
4
5 // build-pass (FIXME(62277): could be check-pass?)
6
7 #![warn(unused_must_use)]
8
9 #[cfg_attr(all(), deprecated, must_use)]
10 struct MustUseDeprecated {}
11
12 impl MustUseDeprecated { //~ warning: use of deprecated item
13     fn new() -> MustUseDeprecated { //~ warning: use of deprecated item
14         MustUseDeprecated {} //~ warning: use of deprecated item
15     }
16 }
17
18 fn main() {
19     MustUseDeprecated::new(); //~ warning: use of deprecated item
20     //| warning: unused `MustUseDeprecated` that must be used
21 }