From: bors Date: Thu, 2 Feb 2017 02:15:05 +0000 (+0000) Subject: Auto merge of #3609 - jmatraszek:build_proper_binary, r=alexcrichton X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2^2^2^2^2^2^2~22^2~9^2~182 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=2b63c4fde3e025076ce84c1ace6fbdf5e1a4d68b;p=cargo.git Auto merge of #3609 - jmatraszek:build_proper_binary, r=alexcrichton Fix building multiple binaries that do not have path spacified in Cargo.toml When multiple binaries are specified in Cargo.toml, the binaries that do not have `path` specified are build from `src/main.rs`. Discovered here: https://github.com/rust-lang-nursery/thanks/pull/40#issuecomment-275493045. This was caused by setting for a binary a main layout here https://github.com/rust-lang/cargo/blob/master/src/cargo/util/toml.rs#L478, which caused `normalize` to not fallback to default binary path here https://github.com/rust-lang/cargo/blob/master/src/cargo/util/toml.rs#L1149 (as `bin.path` was always `Some("/path/to/main.rs")`. Added a test and fixed this by not using `layout.main()`, so right now for bins without `path` specified we fallback to default path inferred from bin's name (e.g. `src/bin/foo.rs`), test if the file exists and only if it doesn't -- fallback to `src/main.rs`. I do not have any knowledge about Cargo's design, so I am not sure if this is the proper place to test for file existence. --- 2b63c4fde3e025076ce84c1ace6fbdf5e1a4d68b