Skip to content

Commit 5a93250

Browse files
authored
Rollup merge of #59696 - michaelwoerister:fix-issue-59137, r=alexcrichton
Remove invalid assertion back::link::from add_upstream_rust_crates(). This removes a misplaced assertion. The function containing the assertion is actually only ever called for upstream crates that are not considered for LTO, so we don't care whether upstream code has been merged in by LTO or not. Fixes #59137 r? @alexcrichton
2 parents 85bc735 + a6e802a commit 5a93250

File tree

4 files changed

+20
-4
lines changed

4 files changed

+20
-4
lines changed

src/librustc_codegen_llvm/back/link.rs

-4
Original file line numberDiff line numberDiff line change
@@ -1396,10 +1396,6 @@ fn add_upstream_rust_crates(cmd: &mut dyn Linker,
13961396

13971397
// Same thing as above, but for dynamic crates instead of static crates.
13981398
fn add_dynamic_crate(cmd: &mut dyn Linker, sess: &Session, cratepath: &Path) {
1399-
// If we're performing LTO, then it should have been previously required
1400-
// that all upstream rust dependencies were available in an rlib format.
1401-
assert!(!are_upstream_rust_objects_already_included(sess));
1402-
14031399
// Just need to tell the linker about where the library lives and
14041400
// what its name is
14051401
let parent = cratepath.parent();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
-include ../tools.mk
2+
3+
# Test that we don't run into an assertion when using a Rust dylib dependency
4+
# while compiling with full LTO.
5+
# See https://github.com/rust-lang/rust/issues/59137
6+
7+
all:
8+
$(RUSTC) a_dylib.rs --crate-type=dylib -C prefer-dynamic
9+
$(RUSTC) main.rs -C lto
10+
$(call RUN,main)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
pub fn foo() {
3+
println!("bar");
4+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
extern crate a_dylib;
3+
4+
fn main() {
5+
a_dylib::foo();
6+
}

0 commit comments

Comments
 (0)