lint: Warn about no-mangled statics that are not exported
This commit is contained in:
parent
51ed1ecefd
commit
73d5d89567
2 changed files with 24 additions and 1 deletions
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue