-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #68277 - michaelwoerister:re-export-dylib-instances, r=…
…alexcrichton Make sure that all upstream generics get re-exported from Rust dylibs. This PR contains a fix for #67276. Rust dylibs would not re-export all generic instances when compiling with `-Zshare-generics=on` (=default for debug builds) which could lead to situations where the compiler expected certain generic instances to be available but then the linker would not find them. ### TODO - [x] Write a regression test based on the description [here](#67276 (comment)). - [x] Find out if this also fixes other issues related to #64319. r? @alexcrichton ~~(once the TODOs are done)~~ cc @pnkfelix @alexkornitzer
- Loading branch information
Showing
16 changed files
with
267 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
-include ../../run-make-fulldeps/tools.mk | ||
|
||
# Different optimization levels imply different values for `-Zshare-generics`, | ||
# so try out a whole bunch of combinations to make sure everything is compatible | ||
all: | ||
# First up, try some defaults | ||
$(RUSTC) --crate-type rlib foo.rs | ||
$(RUSTC) --crate-type dylib bar.rs -C opt-level=3 | ||
|
||
# Next try mixing up some things explicitly | ||
$(RUSTC) --crate-type rlib foo.rs -Z share-generics=no | ||
$(RUSTC) --crate-type dylib bar.rs -Z share-generics=no | ||
$(RUSTC) --crate-type rlib foo.rs -Z share-generics=no | ||
$(RUSTC) --crate-type dylib bar.rs -Z share-generics=yes | ||
$(RUSTC) --crate-type rlib foo.rs -Z share-generics=yes | ||
$(RUSTC) --crate-type dylib bar.rs -Z share-generics=no | ||
$(RUSTC) --crate-type rlib foo.rs -Z share-generics=yes | ||
$(RUSTC) --crate-type dylib bar.rs -Z share-generics=yes | ||
|
||
# Now combine a whole bunch of options together | ||
$(RUSTC) --crate-type rlib foo.rs | ||
$(RUSTC) --crate-type dylib bar.rs | ||
$(RUSTC) --crate-type dylib bar.rs -Z share-generics=no | ||
$(RUSTC) --crate-type dylib bar.rs -Z share-generics=yes | ||
$(RUSTC) --crate-type dylib bar.rs -C opt-level=1 | ||
$(RUSTC) --crate-type dylib bar.rs -C opt-level=1 -Z share-generics=no | ||
$(RUSTC) --crate-type dylib bar.rs -C opt-level=1 -Z share-generics=yes | ||
$(RUSTC) --crate-type dylib bar.rs -C opt-level=2 | ||
$(RUSTC) --crate-type dylib bar.rs -C opt-level=2 -Z share-generics=no | ||
$(RUSTC) --crate-type dylib bar.rs -C opt-level=2 -Z share-generics=yes | ||
$(RUSTC) --crate-type dylib bar.rs -C opt-level=3 | ||
$(RUSTC) --crate-type dylib bar.rs -C opt-level=3 -Z share-generics=no | ||
$(RUSTC) --crate-type dylib bar.rs -C opt-level=3 -Z share-generics=yes | ||
$(RUSTC) --crate-type dylib bar.rs -C opt-level=s | ||
$(RUSTC) --crate-type dylib bar.rs -C opt-level=s -Z share-generics=no | ||
$(RUSTC) --crate-type dylib bar.rs -C opt-level=s -Z share-generics=yes | ||
$(RUSTC) --crate-type dylib bar.rs -C opt-level=z | ||
$(RUSTC) --crate-type dylib bar.rs -C opt-level=z -Z share-generics=no | ||
$(RUSTC) --crate-type dylib bar.rs -C opt-level=z -Z share-generics=yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
extern crate foo; | ||
|
||
pub fn bar() { | ||
foo::foo(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
pub fn foo() { | ||
bar::<usize>(); | ||
} | ||
|
||
pub fn bar<T>() { | ||
baz(); | ||
} | ||
|
||
fn baz() {} |
Oops, something went wrong.