1 #![allow(dead_code, path_statements)]
2 #![deny(unused_attributes, unused_must_use)]
3 #![feature(asm_experimental_arch, stmt_expr_attributes, trait_alias)]
5 #[must_use] //~ ERROR `#[must_use]` has no effect
6 extern crate std as std2;
8 #[must_use] //~ ERROR `#[must_use]` has no effect
11 #[must_use] //~ ERROR `#[must_use]` has no effect
12 use std::arch::global_asm;
14 #[must_use] //~ ERROR `#[must_use]` has no effect
15 const CONST: usize = 4;
16 #[must_use] //~ ERROR `#[must_use]` has no effect
18 static STATIC: usize = 4;
33 #[must_use] //~ ERROR `#[must_use]` has no effect
47 #[must_use] //~ ERROR `#[must_use]` has no effect
49 #[link_name = "STATIC"]
50 #[must_use] //~ ERROR `#[must_use]` has no effect
51 static FOREIGN_STATIC: usize;
55 fn foreign_foo() -> i64;
58 #[must_use] //~ ERROR unused attribute
61 #[must_use] //~ ERROR `#[must_use]` has no effect
64 fn qux<#[must_use] T>(_: T) {} //~ ERROR `#[must_use]` has no effect
68 #[must_use] //~ ERROR `#[must_use]` has no effect
69 const ASSOC_CONST: usize = 4;
70 #[must_use] //~ ERROR `#[must_use]` has no effect
74 fn get_four(&self) -> usize {
79 #[must_use] //~ ERROR `#[must_use]` has no effect
84 #[must_use] //~ ERROR `#[must_use]` has no effect
87 #[must_use] //~ ERROR `#[must_use]` has no effect
88 macro_rules! cool_macro {
95 #[must_use] //~ ERROR `#[must_use]` has no effect
99 let x = #[must_use] //~ ERROR `#[must_use]` has no effect
103 X; //~ ERROR that must be used
104 Y::Z; //~ ERROR that must be used
105 U { unit: () }; //~ ERROR that must be used
106 U::method(); //~ ERROR that must be used
107 foo(); //~ ERROR that must be used
110 foreign_foo(); //~ ERROR that must be used
115 unsafe { FOREIGN_STATIC };
118 ().get_four(); //~ ERROR that must be used
121 #[must_use] //~ ERROR `#[must_use]` has no effect
126 struct PatternField {
129 let s = PatternField { #[must_use] foo: 123 }; //~ ERROR `#[must_use]` has no effect
130 let PatternField { #[must_use] foo } = s; //~ ERROR `#[must_use]` has no effect