Skip to content

Commit a5edf21

Browse files
committed
Add a test that uses a custom binary target
The custom target name contains the crate type `bin`.
1 parent b12bd38 commit a5edf21

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

tests/testsuite/custom_target.rs

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,50 @@ fn custom_target_dependency() {
130130

131131
p.cargo("build --lib --target custom-target.json -v").run();
132132
}
133+
134+
#[cargo_test]
135+
fn custom_bin_target() {
136+
if !is_nightly() {
137+
// Requires features no_core, lang_items
138+
return;
139+
}
140+
let p = project()
141+
.file(
142+
"src/main.rs",
143+
r#"
144+
#![feature(no_core)]
145+
#![feature(lang_items)]
146+
#![no_core]
147+
#![no_main]
148+
149+
#[lang = "sized"]
150+
pub trait Sized {
151+
// Empty.
152+
}
153+
#[lang = "copy"]
154+
pub trait Copy {
155+
// Empty.
156+
}
157+
"#,
158+
)
159+
.file(
160+
"custom-bin-target.json",
161+
r#"
162+
{
163+
"llvm-target": "x86_64-unknown-none-gnu",
164+
"data-layout": "e-m:e-i64:64-f80:128-n8:16:32:64-S128",
165+
"arch": "x86_64",
166+
"target-endian": "little",
167+
"target-pointer-width": "64",
168+
"target-c-int-width": "32",
169+
"os": "none",
170+
"linker-flavor": "ld.lld",
171+
"linker": "rust-lld",
172+
"executables": true
173+
}
174+
"#,
175+
)
176+
.build();
177+
178+
p.cargo("build --target custom-bin-target.json -v").run();
179+
}

0 commit comments

Comments
 (0)