rust/compiler/rustc_interface/src
bjorn3 1b0c0eb717 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
```
2022-01-15 14:48:00 +01:00
..
callbacks.rs Fix clippy lints 2021-10-01 23:17:19 +02:00
interface.rs Emit an error for --cfg=) 2022-01-01 05:21:36 +01:00
lib.rs Revert "Add rustc lint, warning when iterating over hashmaps" 2021-10-28 11:01:42 -04:00
passes.rs Deny mixing bin crate type with lib crate types 2022-01-15 14:48:00 +01:00
proc_macro_decls.rs Avoid more invocations of hir_crate query. 2021-09-29 23:16:47 +02:00
queries.rs Use OutputFilenames to generate output file for -Zllvm-time-trace 2021-12-13 00:00:00 +00:00
tests.rs Stabilize -Z symbol-mangling-version as -C symbol-mangling-version 2022-01-01 15:51:02 -08:00
util.rs Add Attribute::meta_kind 2021-12-26 16:56:34 +01:00