lint: Warn about no-mangled statics that are not exported

This commit is contained in:
Richo Healey 2015-02-02 22:03:39 -08:00
parent 51ed1ecefd
commit 73d5d89567
2 changed files with 24 additions and 1 deletions

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// compile-flags:-F private_no_mangle_fns -F no_mangle_const_items
// compile-flags:-F private_no_mangle_fns -F no_mangle_const_items -F private_no_mangle_statics
// FIXME(#19495) no_mangle'ing main ICE's.
#[no_mangle]
@ -26,6 +26,14 @@ pub const PUB_FOO: u64 = 1; //~ ERROR const items should never be #[no_mangle]
pub fn bar() {
}
#[no_mangle]
pub static BAR: u64 = 1;
#[allow(dead_code)]
#[no_mangle]
static PRIVATE_BAR: u64 = 1; //~ ERROR static PRIVATE_BAR is marked #[no_mangle], but not exported
fn main() {
foo();
bar();