diff options
| author | bors <bors@rust-lang.org> | 2018-04-30 17:30:55 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-04-30 17:30:55 +0000 |
| commit | 17841cc97ac950312355403b6cfe11b916e242a6 (patch) | |
| tree | 5bd04ce4f05ca35b78d7612b13bf3a15f4e49655 /src/test/compile-fail | |
| parent | 4745092d608e65ec869c0ebdb27c535f27606ea4 (diff) | |
| parent | 6166f20571aeadc3e0790ab79b642b0a1d41169d (diff) | |
| download | rust-17841cc97ac950312355403b6cfe11b916e242a6.tar.gz rust-17841cc97ac950312355403b6cfe11b916e242a6.zip | |
Auto merge of #50345 - kennytm:rollup, r=kennytm
Rollup of 7 pull requests Successful merges: - #50233 (Make `Vec::new` a `const fn`) - #50312 (Add more links in panic docs) - #50316 (Fix some broken links in docs.) - #50325 (Add a few more tests for proc macro feature gating) - #50327 (Display correct unused field suggestion for nested struct patterns) - #50330 (check that #[used] is used only on statics) - #50344 (Update Cargo to 2018-04-28 122fd5be5201913d42e219e132d6569493583bca) Failed merges:
Diffstat (limited to 'src/test/compile-fail')
| -rw-r--r-- | src/test/compile-fail/used.rs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/test/compile-fail/used.rs b/src/test/compile-fail/used.rs new file mode 100644 index 00000000000..f170d9c25f5 --- /dev/null +++ b/src/test/compile-fail/used.rs @@ -0,0 +1,28 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(used)] + +#[used] +static FOO: u32 = 0; // OK + +#[used] //~ ERROR attribute must be applied to a `static` variable +fn foo() {} + +#[used] //~ ERROR attribute must be applied to a `static` variable +struct Foo {} + +#[used] //~ ERROR attribute must be applied to a `static` variable +trait Bar {} + +#[used] //~ ERROR attribute must be applied to a `static` variable +impl Bar for Foo {} + +fn main() {} |
