rust/src/test/run-make-fulldeps
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
..
a-b-a-linker-guard rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
alloc-extern-crates rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
allow-non-lint-warnings-cmdline rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
allow-warnings-cmdline-stability Fix stage 2 tests 2018-08-05 15:54:49 +01:00
archive-duplicate-names rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
atomic-lock-free Move some implementations of Clone and Copy to libcore 2018-03-26 21:52:58 -04:00
bare-outfile rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
c-dynamic-dylib rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
c-dynamic-rlib rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
c-link-to-rust-dylib rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
c-link-to-rust-staticlib rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
c-static-dylib rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
c-static-rlib rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
cat-and-grep-sanity-check rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
cdylib rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
cdylib-fewer-symbols rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
codegen-options-parsing Allow for opting out of ThinLTO and clean up LTO related cli flag handling. 2018-09-05 12:52:17 +02:00
compile-stdin rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
compiler-lookup-paths rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
compiler-lookup-paths-2 rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
compiler-rt-works-on-mingw rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
crate-data-smoke rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
crate-name-priority rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
cross-lang-lto Fix some run-make tests after object file naming has changed. 2018-08-15 13:47:39 +02:00
cross-lang-lto-upstream-rlibs Address review comments for #53031 and fix some merge fallout. 2018-08-08 13:40:23 +02:00
debug-assertions rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
dep-info rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
dep-info-doesnt-run-much rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
dep-info-spaces rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
duplicate-output-flavors rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
dylib-chain rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
emit rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
emit-stack-sizes don't run the test on macOS 2018-09-26 16:22:52 +02:00
error-found-staticlib-instead-crate rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
error-writing-dependencies rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
exit-code fix exit-code test so the lint fires again 2018-08-04 22:20:45 -05:00
extern-diff-internal-name rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
extern-flag-disambiguates rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
extern-flag-fun rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
extern-flag-rename-transitive rustc: Register crates under their real names 2018-07-25 18:04:19 -07:00
extern-fn-generic rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
extern-fn-mangle rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
extern-fn-reachable rustc: Allow #[no_mangle] anywhere in a crate 2018-10-06 13:57:30 -07:00
extern-fn-struct-passing-abi rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
extern-fn-with-extern-types rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
extern-fn-with-packed-struct rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
extern-fn-with-union rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
extern-multiple-copies rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
extern-multiple-copies2 rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
extern-overrides-distribution rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
extern-prelude Stabilize crate_in_paths, extern_absolute_paths and extern_prelude on all editions. 2018-09-22 09:26:40 +03:00
extra-filename-with-temp-outputs Fix some run-make tests after object file naming has changed. 2018-08-15 13:47:39 +02:00
fpic rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
hir-tree Fix typos found by codespell. 2018-08-19 17:41:28 +02:00
hotplug_codegen_backend Normalize variants of CrateType to standard style 2018-08-04 06:53:15 -06:00
include_bytes_deps rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
inline-always-many-cgu rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
interdependent-c-libraries rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
intrinsic-unreachable rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
invalid-library rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
invalid-staticlib rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
issue-7349 Rename trans to codegen everywhere. 2018-05-17 15:08:30 +03:00
issue-11908 rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
issue-14500 rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
issue-14698 rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
issue-15460 rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
issue-18943 rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
issue-19371 mv (mod) codemap source_map 2018-08-19 23:01:00 +02:00
issue-20626 rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
issue-22131 rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
issue-24445 rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
issue-25581 rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
issue-26006 rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
issue-26092 rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
issue-28595 rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
issue-28766 rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
issue-30063 rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
issue-33329 rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
issue-35164 rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
issue-36710 Add a test for issue 36710. 2018-05-31 12:01:50 +02:00
issue-37839 rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
issue-37893 rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
issue-38237 rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
issue-40535 rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
issue-46239 rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
issue-51671 stabilize #[panic_handler] 2018-09-07 13:27:30 +02:00
issue-53964 crates that provide a panic_handler are exempt from unused_extern_crates 2018-09-06 21:24:33 +02:00
issues-41478-43796 rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
libs-and-bins rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
libs-through-symlinks rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
libtest-json Fix tests for json formatting 2018-08-31 16:30:05 -05:00
link-arg rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
link-cfg rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
link-path-order Fix stage 2 tests 2018-08-05 15:54:49 +01:00
linkage-attr-on-static rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
linker-output-non-utf8 rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
llvm-pass bump minimum LLVM version to 5.0 2018-07-09 11:35:52 +02:00
long-linker-command-lines rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
long-linker-command-lines-cmd-exe rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
longjmp-across-rust rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
ls-metadata rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
lto-no-link-whole-rlib rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
lto-readonly-lib rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
lto-smoke Allow for opting out of ThinLTO and clean up LTO related cli flag handling. 2018-09-05 12:52:17 +02:00
lto-smoke-c rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
manual-crate-name rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
manual-link rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
many-crates-but-no-match rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
metadata-flag-frobs-symbols rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
min-global-align rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
mismatching-target-triples rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
missing-crate-dependency rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
mixing-deps rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
mixing-formats rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
mixing-libs rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
msvc-opt-minsize rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
multiple-emits rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
no-builtins-lto rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
no-duplicate-libs rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
no-integrated-as rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
no-intermediate-extras rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
obey-crate-type-flag rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
output-filename-conflicts-with-directory rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
output-filename-overwrites-input rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
output-type-permutations rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
output-with-hyphens rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
panic-impl-transitive stabilize #[panic_handler] 2018-09-07 13:27:30 +02:00
pgo-gen Upgrade to LLVM's master branch (LLVM 7) 2018-07-10 13:43:01 -07:00
pgo-gen-lto Upgrade to LLVM's master branch (LLVM 7) 2018-07-10 13:43:01 -07:00
prefer-dylib rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
prefer-rlib rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
pretty-expanded rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
pretty-expanded-hygiene rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
pretty-print-path-suffix rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
pretty-print-to-file rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
print-cfg rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
print-target-list rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
profile rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
prune-link-args rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
relocation-model rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
relro-levels rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
reproducible-build rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
resolve-rename Run make tests for file resolution 2018-03-28 11:38:32 -07:00
rlib-chain rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
rustc-macro-dep-files rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
rustdoc-error-lines Fix typos found by codespell. 2018-08-19 17:41:28 +02:00
rustdoc-output-path rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
sanitizer-address rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
sanitizer-cdylib-link Fix typos found by codespell. 2018-08-19 17:41:28 +02:00
sanitizer-dylib-link Fix typos found by codespell. 2018-08-19 17:41:28 +02:00
sanitizer-invalid-cratetype rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
sanitizer-invalid-target rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
sanitizer-leak rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
sanitizer-memory rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
sanitizer-staticlib-link rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
save-analysis rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
save-analysis-fail rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
save-analysis-rfc2126 rustc_resolve: don't allow ::crate_name to bypass extern_prelude. 2018-09-15 22:48:10 +03:00
sepcomp-cci-copies rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
sepcomp-inlining rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
sepcomp-separate rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
simd-ffi Move some implementations of Clone and Copy to libcore 2018-03-26 21:52:58 -04:00
simple-dylib rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
simple-rlib rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
stable-symbol-names rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
static-dylib-by-default rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
static-nobundle rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
static-unwinding rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
staticlib-blank-lib rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
std-core-cycle Remove some '#[feature]' attributes for stabilized features 2018-06-11 13:48:57 -07:00
stdin-non-utf8 rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
suspicious-library rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
symbol-visibility Update run-make/symbol-visibility to also cover shared-generics 2018-04-06 12:14:08 +02:00
symbols-include-type-name rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
symlinked-extern rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
symlinked-libraries rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
symlinked-rlib rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
sysroot-crates-are-unstable rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
target-cpu-native Fix warnings about the native target-cpu 2018-08-28 13:32:11 -07:00
target-specs Don't silently ignore invalid data in target spec 2018-07-13 10:14:16 -07:00
target-without-atomic-cas update run-pass test 2018-07-05 20:18:19 -05:00
test-harness rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
treat-err-as-bug rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
type-mismatch-same-crate-name rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
use-extern-for-plugins rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
use-suggestions-rust-2018 add test for the suggestion from prelude 2018-08-27 14:12:31 +00:00
used stabilize #[used] 2018-09-09 15:43:28 +02:00
version rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
volatile-intrinsics Add unaligned volatile intrinsics 2018-07-14 23:28:39 +01:00
weird-output-filenames rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
windows-spawn rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
windows-subsystem rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
tools.mk Add a test for issue 36710. 2018-05-31 12:01:50 +02:00