test(build-std): make mock-std closer to real world

`test_std_on_unsupported_target` never really succeed to build those targets, due to

* local rustup may not have `{aarch64,x86_64}-unknown-none` installed.
* `core` and `compiler-builtins` mock crate are not `no_std` nor `no_core`
* the dummy `main.rs` uses `println!` and is not `no_std`.

This commit make it compile, if you have those targets installed.
This commit is contained in:
Weihang Lo 2024-12-05 10:30:23 -05:00
parent 05f54fdc34
commit fbb5b90fe0
No known key found for this signature in database
GPG Key ID: D7DBF189825E82E7
3 changed files with 8 additions and 6 deletions

View File

@ -1 +1 @@
// intentionally blank
#![no_std]

View File

@ -1,3 +1,4 @@
#![no_std]
#![feature(staged_api)]
#![stable(since = "1.0.0", feature = "dummy")]

View File

@ -395,12 +395,13 @@ fn test_std_on_unsupported_target() {
let p = project()
.file(
"src/main.rs",
"src/lib.rs",
r#"
fn main() {
println!("hello");
}
"#,
#![no_std]
pub fn foo() {
assert_eq!(u8::MIN, 0);
}
"#,
)
.build();