rollup merge of #21881: richo/lint-no-mangle-const
This renames the PrivateNoMangleFns lint to allow both to happen in a
single pass, since they do roughly the same work.
Closes #21856
Open questions:
[ ]: Do the tests actually pass (I'm running make check and running out the door now)
[ ]: Is the name of this lint ok. it seems to mostly be fine with [convention](cc53afbe5d/text/0344-conventions-galore.md (lints))
[ ]: I'm not super thrilled about the warning text
r? @kmcallister (Shamelessly nominating because you were looking at my other ticket)
This commit is contained in:
commit
8b8331ad09
3 changed files with 52 additions and 6 deletions
|
|
@ -8,17 +8,32 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// compile-flags:-F private_no_mangle_fns
|
||||
// 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]
|
||||
fn foo() { //~ ERROR function foo is marked #[no_mangle], but not exported
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[no_mangle]
|
||||
const FOO: u64 = 1; //~ ERROR const items should never be #[no_mangle]
|
||||
|
||||
#[no_mangle]
|
||||
pub const PUB_FOO: u64 = 1; //~ ERROR const items should never be #[no_mangle]
|
||||
|
||||
#[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