Skip to content

Commit ff25fd6

Browse files
committed
lint: Add test for no_mangle
1 parent d2ab7d3 commit ff25fd6

File tree

2 files changed

+28
-7
lines changed

2 files changed

+28
-7
lines changed

src/libstd/rt/unwind.rs

+3-7
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,6 @@ pub mod eabi {
254254
}
255255

256256
#[no_mangle] // referenced from rust_try.ll
257-
#[allow(unexported_no_mangle)]
258257
pub extern "C" fn rust_eh_personality_catch(
259258
_version: c_int,
260259
actions: uw::_Unwind_Action,
@@ -293,7 +292,7 @@ pub mod eabi {
293292

294293
#[lang="eh_personality"]
295294
#[no_mangle] // referenced from rust_try.ll
296-
#[allow(unexported_no_mangle)]
295+
#[allow(private_no_mangle_fns)]
297296
pub extern "C" fn rust_eh_personality(
298297
version: c_int,
299298
actions: uw::_Unwind_Action,
@@ -309,7 +308,6 @@ pub mod eabi {
309308
}
310309

311310
#[no_mangle] // referenced from rust_try.ll
312-
#[allow(unexported_no_mangle)]
313311
pub extern "C" fn rust_eh_personality_catch(
314312
_version: c_int,
315313
actions: uw::_Unwind_Action,
@@ -348,7 +346,7 @@ pub mod eabi {
348346

349347
#[lang="eh_personality"]
350348
#[no_mangle] // referenced from rust_try.ll
351-
#[allow(unexported_no_mangle)]
349+
#[allow(private_no_mangle_fns)]
352350
extern "C" fn rust_eh_personality(
353351
state: uw::_Unwind_State,
354352
ue_header: *mut uw::_Unwind_Exception,
@@ -361,7 +359,6 @@ pub mod eabi {
361359
}
362360

363361
#[no_mangle] // referenced from rust_try.ll
364-
#[allow(unexported_no_mangle)]
365362
pub extern "C" fn rust_eh_personality_catch(
366363
state: uw::_Unwind_State,
367364
_ue_header: *mut uw::_Unwind_Exception,
@@ -439,7 +436,7 @@ pub mod eabi {
439436

440437
#[lang="eh_personality"]
441438
#[no_mangle] // referenced from rust_try.ll
442-
#[allow(unexported_no_mangle)]
439+
#[allow(private_no_mangle_fns)]
443440
extern "C" fn rust_eh_personality(
444441
exceptionRecord: *mut EXCEPTION_RECORD,
445442
establisherFrame: *mut c_void,
@@ -454,7 +451,6 @@ pub mod eabi {
454451
}
455452

456453
#[no_mangle] // referenced from rust_try.ll
457-
#[allow(unexported_no_mangle)]
458454
pub extern "C" fn rust_eh_personality_catch(
459455
exceptionRecord: *mut EXCEPTION_RECORD,
460456
establisherFrame: *mut c_void,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// compile-flags:-F private_no_mangle_fns
12+
13+
// FIXME(#19495) no_mangle'ing main ICE's.
14+
#[no_mangle]
15+
fn foo() { //~ ERROR function foo is marked #[no_mangle], but not exported
16+
}
17+
18+
#[no_mangle]
19+
pub fn bar() {
20+
}
21+
22+
fn main() {
23+
foo();
24+
bar();
25+
}

0 commit comments

Comments
 (0)