Skip to content

Commit 56602aa

Browse files
committed
fix bug #15703
1 parent 0185041 commit 56602aa

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/cargo/util/toml/targets.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -972,15 +972,14 @@ fn target_path_not_found_error_message(
972972
}
973973
_ => unreachable!("invalid target kind: {}", kind),
974974
}
975-
target_path.push(name);
976975

977976
let target_path_file = {
978977
let mut path = target_path.clone();
979-
path.set_extension("rs");
978+
path.push(format!("{name}.rs"));
980979
path
981980
};
982981
let target_path_subdir = {
983-
target_path.push("main.rs");
982+
target_path.extend([name, "main.rs"]);
984983
target_path
985984
};
986985
return [target_path_file, target_path_subdir];

tests/testsuite/bad_config.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3072,7 +3072,7 @@ fn bad_bin_name() {
30723072
[ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml`
30733073
30743074
Caused by:
3075-
can't find `bin.rs` bin at `src/bin/bin.rs` or `src/bin/bin.rs/main.rs`. Please specify bin.path if you want to use a non-default path.
3075+
can't find `bin.rs` bin at `src/bin/bin.rs.rs` or `src/bin/bin.rs/main.rs`. Please specify bin.path if you want to use a non-default path.
30763076
30773077
"#]])
30783078
.run();
@@ -3087,7 +3087,7 @@ fn bad_example_name() {
30873087
[ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml`
30883088
30893089
Caused by:
3090-
can't find `example.rs` example at `examples/example.rs` or `examples/example.rs/main.rs`. Please specify example.path if you want to use a non-default path.
3090+
can't find `example.rs` example at `examples/example.rs.rs` or `examples/example.rs/main.rs`. Please specify example.path if you want to use a non-default path.
30913091
30923092
"#]])
30933093
.run();
@@ -3102,7 +3102,7 @@ fn bad_test_name() {
31023102
[ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml`
31033103
31043104
Caused by:
3105-
can't find `test.rs` test at `tests/test.rs` or `tests/test.rs/main.rs`. Please specify test.path if you want to use a non-default path.
3105+
can't find `test.rs` test at `tests/test.rs.rs` or `tests/test.rs/main.rs`. Please specify test.path if you want to use a non-default path.
31063106
31073107
"#]])
31083108
.run();
@@ -3117,7 +3117,7 @@ fn bad_bench_name() {
31173117
[ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml`
31183118
31193119
Caused by:
3120-
can't find `bench.rs` bench at `benches/bench.rs` or `benches/bench.rs/main.rs`. Please specify bench.path if you want to use a non-default path.
3120+
can't find `bench.rs` bench at `benches/bench.rs.rs` or `benches/bench.rs/main.rs`. Please specify bench.path if you want to use a non-default path.
31213121
31223122
"#]])
31233123
.run();

0 commit comments

Comments
 (0)