rust/src/libstd
Alex Crichton d7d7045374 rustc: Allow #[no_mangle] anywhere in a crate
This commit updates the compiler to allow the `#[no_mangle]` (and
`#[export_name]` attributes) to be located anywhere within a crate.
These attributes are unconditionally processed, causing the compiler to
always generate an exported symbol with the appropriate name.

After some discussion on #54135 it was found that not a great reason
this hasn't been allowed already, and it seems to match the behavior
that many expect! Previously the compiler would only export a
`#[no_mangle]` symbol if it were *publicly reachable*, meaning that it
itself is `pub` and it's otherwise publicly reachable from the root of
the crate. This new definition is that `#[no_mangle]` *is always
reachable*, no matter where it is in a crate or whether it has `pub` or
not.

This should make it much easier to declare an exported symbol with a
known and unique name, even when it's an internal implementation detail
of the crate itself. Note that these symbols will persist beyond LTO as
well, always making their way to the linker.

Along the way this commit removes the `private_no_mangle_functions` lint
(also for statics) as there's no longer any need to lint these
situations. Furthermore a good number of tests were updated now that
symbol visibility has been changed.

Closes #54135
2018-10-06 13:57:30 -07:00
..
collections Auto merge of #53804 - RalfJung:ptr-invalid, r=nagisa 2018-09-16 18:03:39 +00:00
ffi OsStr: Document that it's not NUL terminated 2018-09-17 21:10:36 -04:00
io Improve docs for std::io::Seek 2018-09-28 08:01:56 -04:00
net Rollup merge of #53522 - phungleson:fix-impl-from-for-addr, r=TimNN 2018-09-18 10:21:33 +02:00
os Move std::os::raw::c_void into libcore and re-export in libstd 2018-09-14 16:19:59 +01:00
prelude Reformat std prelude source to show it is the sum of core and alloc preludes 2018-07-07 23:16:27 +02:00
sync Fix Once perf regression 2018-09-29 11:07:48 +03:00
sys Switch wasm math symbols to their original names 2018-09-15 09:14:10 -07:00
sys_common Improve output if no_lookup_host_duplicates fails 2018-09-15 17:17:35 +02:00
tests Breaking change upgrades 2018-09-04 13:22:08 -06:00
thread Expand synchronization comments in park/unpark 2018-09-18 18:06:16 +01:00
alloc.rs Bump to 1.31.0 and bootstrap from 1.30 beta 2018-09-27 20:52:53 -07:00
ascii.rs Remove unstable and deprecated APIs 2018-07-30 18:18:23 +02:00
build.rs Add rustc SHA to released DWARF debuginfo 2018-09-10 10:10:38 -07:00
Cargo.toml Breaking change upgrades 2018-09-04 13:22:08 -06:00
env.rs make reference to dirs crate clickable in terminals 2018-07-12 12:48:10 +02:00
error.rs Correctly parenthesize dyn Error + 'static. 2018-08-21 00:58:52 +02:00
f32.rs Clarify rational behind current implementation of .mod_euc() 2018-06-26 13:09:56 +02:00
f64.rs Clarify rational behind current implementation of .mod_euc() 2018-06-26 13:09:56 +02:00
fs.rs Rollup merge of #53376 - frewsxcv:frewsxcv-copy, r=GuillaumeGomez 2018-09-07 15:26:30 +08:00
future.rs Remove spawning from task::Context 2018-09-19 15:01:19 -07:00
keyword_docs.rs Add struct keyword doc 2018-08-23 23:50:05 +02:00
lib.rs Bump to 1.31.0 and bootstrap from 1.30 beta 2018-09-27 20:52:53 -07:00
macros.rs Auto merge of #54317 - Centril:feature/dbg_macro, r=SimonSapin 2018-09-25 07:06:15 +00:00
memchr.rs Fix typos found by codespell. 2018-08-19 17:41:28 +02:00
num.rs Stabilize num::NonZeroU* 2018-05-16 19:11:31 +02:00
panic.rs Remove spawning from task::Context 2018-09-19 15:01:19 -07:00
panicking.rs rustc: Allow #[no_mangle] anywhere in a crate 2018-10-06 13:57:30 -07:00
path.rs Add links to std::char::REPLACEMENT_CHARACTER from docs. 2018-08-11 15:42:35 -04:00
primitive_docs.rs Fixed three small typos. 2018-09-23 23:47:52 -05:00
process.rs document the platform-specific behavior of Command::current_dir 2018-08-20 17:02:45 -04:00
rt.rs Deny bare trait objects in src/libstd. 2018-07-10 20:35:36 +02:00
time.rs Stabilize SystemTime::UNIX_EPOCH 2018-05-28 18:24:01 -06:00