rust/src/test/ui/feature-gate
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
..
duplicate-features.rs Turn the duplicate feature lint into an error 2018-08-05 15:54:49 +01:00
duplicate-features.stderr Turn the duplicate feature lint into an error 2018-08-05 15:54:49 +01:00
issue-43106-gating-of-bench.rs Feature gate non-builtin attributes in inner attribute position 2018-09-10 03:35:47 +03:00
issue-43106-gating-of-bench.stderr Add backticks to main not found errors. 2018-03-14 12:23:29 -07:00
issue-43106-gating-of-builtin-attrs.rs rustc: Allow #[no_mangle] anywhere in a crate 2018-10-06 13:57:30 -07:00
issue-43106-gating-of-builtin-attrs.stderr rustc: Allow #[no_mangle] anywhere in a crate 2018-10-06 13:57:30 -07:00
issue-43106-gating-of-deprecated.rs Migrate a few feature gate tests to ui 2017-12-07 10:14:39 +01:00
issue-43106-gating-of-deprecated.stderr Update tests 2018-03-16 11:52:46 +01:00
issue-43106-gating-of-derive-2.rs Migrate a few feature gate tests to ui 2017-12-07 10:14:39 +01:00
issue-43106-gating-of-derive-2.stderr Update UI tests 2018-02-26 20:24:02 +03:00
issue-43106-gating-of-derive.rs Migrate a few feature gate tests to ui 2017-12-07 10:14:39 +01:00
issue-43106-gating-of-derive.stderr Update UI tests 2018-02-26 20:24:02 +03:00
issue-43106-gating-of-inline.rs Allow #[inline] on closures 2018-04-27 12:34:01 +02:00
issue-43106-gating-of-inline.stderr Allow #[inline] on closures 2018-04-27 12:34:01 +02:00
issue-43106-gating-of-macro_escape.rs Rename must-compile-successfully into compile-pass 2018-04-13 23:28:03 +02:00
issue-43106-gating-of-macro_escape.stderr Add empty main() to tests where it is missing. 2018-03-14 12:23:28 -07:00
issue-43106-gating-of-macro_use.rs Migrate a few feature gate tests to ui 2017-12-07 10:14:39 +01:00
issue-43106-gating-of-macro_use.stderr Update UI tests 2018-02-26 20:24:02 +03:00
issue-43106-gating-of-proc_macro_derive.rs Add empty main() to tests where it is missing. 2018-03-14 12:23:28 -07:00
issue-43106-gating-of-proc_macro_derive.stderr Add empty main() to tests where it is missing. 2018-03-14 12:23:28 -07:00
issue-43106-gating-of-rustc_deprecated.rs Add empty main() to tests where it is missing. 2018-03-14 12:23:28 -07:00
issue-43106-gating-of-rustc_deprecated.stderr Add empty main() to tests where it is missing. 2018-03-14 12:23:28 -07:00
issue-43106-gating-of-stable.rs Add empty main() to tests where it is missing. 2018-03-14 12:23:28 -07:00
issue-43106-gating-of-stable.stderr Add empty main() to tests where it is missing. 2018-03-14 12:23:28 -07:00
issue-43106-gating-of-test.rs Add backticks to main not found errors. 2018-03-14 12:23:29 -07:00
issue-43106-gating-of-test.stderr Add backticks to main not found errors. 2018-03-14 12:23:29 -07:00
issue-43106-gating-of-unstable.rs Add empty main() to tests where it is missing. 2018-03-14 12:23:28 -07:00
issue-43106-gating-of-unstable.stderr Add empty main() to tests where it is missing. 2018-03-14 12:23:28 -07:00
issue-49983-see-issue-0.rs don't see issue #0 2018-04-15 11:12:33 -07:00
issue-49983-see-issue-0.stderr don't see issue #0 2018-04-15 11:12:33 -07:00
stability-attribute-consistency.rs Add a test for feature attribute consistency 2018-08-05 15:54:49 +01:00
stability-attribute-consistency.stderr Add a test for feature attribute consistency 2018-08-05 15:54:49 +01:00
unknown-feature.rs Convert unknown_features lint into an error 2018-08-05 15:54:49 +01:00
unknown-feature.stderr Convert unknown_features lint into an error 2018-08-05 15:54:49 +01:00