diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-02-18 16:23:28 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-02-18 16:23:28 +0100 |
| commit | e3ded4fc4fa15f0b7acee429edf30e1e0cde26f8 (patch) | |
| tree | 55d6dc9b06fc459da34e45980eea5f1bb69db04d /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp | |
| parent | dd111262b2a18e532d700b67a8062faa286d1a36 (diff) | |
| parent | 0b5963023d9d3bdbbf27e9f92171047cf2a7f008 (diff) | |
| download | rust-e3ded4fc4fa15f0b7acee429edf30e1e0cde26f8.tar.gz rust-e3ded4fc4fa15f0b7acee429edf30e1e0cde26f8.zip | |
Rollup merge of #92933 - bjorn3:no_bin_lib_mixing, r=estebank
Deny mixing bin crate type with lib crate types
The produced library would get a main shim too which conflicts with the
main shim of the executable linking the library.
```
$ cat > main1.rs <<EOF
fn main() {}
pub fn bar() {}
EOF
$ cat > main2.rs <<EOF
extern crate main1;
fn main() {
main1::bar();
}
EOF
$ rustc --crate-type bin --crate-type lib main1.rs
$ rustc -L. main2.rs
error: linking with `cc` failed: exit status: 1
[...]
= note: /usr/bin/ld: /tmp/crate_bin_lib/libmain1.rlib(main1.main1.707747aa-cgu.0.rcgu.o): in function `main':
main1.707747aa-cgu.0:(.text.main+0x0): multiple definition of `main'; main2.main2.02a148fe-cgu.0.rcgu.o:main2.02a148fe-cgu.0:(.text.main+0x0): first defined here
collect2: error: ld returned 1 exit status
```
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
