Skip to content

Commit

Permalink
add tracking issue and feature-gate and run-make tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Jorge Aparicio committed Apr 5, 2017
1 parent 4c7e277 commit bc1bd8a
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/test/compile-fail/feature-gate-used.rs
@@ -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 changes: 12 additions & 0 deletions src/test/run-make/used/Makefile
@@ -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 changes: 17 additions & 0 deletions src/test/run-make/used/used.rs
@@ -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;

0 comments on commit bc1bd8a

Please sign in to comment.