add tracking issue and feature-gate and run-make tests
This commit is contained in:
parent
4c7e277340
commit
bc1bd8a609
3 changed files with 44 additions and 0 deletions
15
src/test/compile-fail/feature-gate-used.rs
Normal file
15
src/test/compile-fail/feature-gate-used.rs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2017 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.
|
||||
|
||||
#[used]
|
||||
fn foo() {}
|
||||
//~^^ ERROR the `#[used]` attribute is an experimental feature
|
||||
|
||||
fn main() {}
|
||||
12
src/test/run-make/used/Makefile
Normal file
12
src/test/run-make/used/Makefile
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
-include ../tools.mk
|
||||
|
||||
ifdef IS_WINDOWS
|
||||
# Do nothing on MSVC.
|
||||
all:
|
||||
exit 0
|
||||
else
|
||||
all:
|
||||
$(RUSTC) -C opt-level=3 --emit=obj used.rs
|
||||
nm -C used.o | grep FOO
|
||||
nm -C used.o | grep -v BAR
|
||||
endif
|
||||
17
src/test/run-make/used/used.rs
Normal file
17
src/test/run-make/used/used.rs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
// Copyright 2017 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.
|
||||
|
||||
#![crate_type = "lib"]
|
||||
#![feature(used)]
|
||||
|
||||
#[used]
|
||||
static FOO: u32 = 0;
|
||||
|
||||
static BAR: u32 = 0;
|
||||
Loading…
Add table
Add a link
Reference in a new issue