rust/compiler/rustc_metadata/src
bors b14fd2359f Auto merge of #113695 - bjorn3:fix_rlib_cdylib_metadata_handling, r=pnkfelix,petrochenkov
Verify that all crate sources are in sync

This ensures that rustc will not attempt to link against a cdylib as if it is a rust dylib when an rlib for the same crate is available. Previously rustc didn't actually check if any further formats of a crate which has been loaded are of the same version and if they are actually valid. This caused a cdylib to be interpreted as rust dylib as soon as the corresponding rlib was loaded. As cdylibs don't export any rust symbols, linking would fail if rustc decides to link against the cdylib rather than the rlib.

Two crates depended on the previous behavior by separately compiling a test crate as both rlib and dylib. These have been changed to capture their original spirit to the best of my ability while still working when rustc verifies that all crates are in sync. It is unlikely that build systems depend on the current behavior and in any case we are taking a lot of measures to ensure that any change to either the source or the compilation options (including crate type) results in rustc rejecting it as incompatible. We merely didn't do this check here for now obsolete perf reasons.

Fixes https://github.com/rust-lang/rust/issues/10786
Fixes https://github.com/rust-lang/rust/issues/82151
Fixes https://github.com/rust-lang/rust/issues/82972
Closes https://github.com/bevy-cheatbook/bevy-cheatbook/issues/114
2023-07-20 09:00:10 +00:00
..
rmeta Auto merge of #113865 - Dylan-DPC:rollup-pt960bk, r=Dylan-DPC 2023-07-19 18:17:59 +00:00
creader.rs Re-format let-else per rustfmt update 2023-07-12 21:49:27 -04:00
dependency_format.rs Add unstable feature flags 2023-04-19 18:55:11 +00:00
errors.rs Revert "Suggest x build library for a custom toolchain that fails to load core" 2023-07-03 12:48:52 +00:00
foreign_modules.rs Do not fetch HIR in native_libs. 2023-07-17 07:37:03 +00:00
fs.rs fix 2023-06-06 17:54:34 -04:00
lib.rs s/drain_filter/extract_if/ for Vec, Btree{Map,Set} and LinkedList 2023-06-14 09:28:54 +02:00
locator.rs Fix review comments 2023-07-19 14:53:26 +00:00
native_libs.rs Do not fetch HIR in native_libs. 2023-07-17 07:37:03 +00:00