forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#2690 - Nilstrieb:cargo-miri-smoke-test-ci-so-…
…that-cargo-miri-actually-works-kinda, r=RalfJung Test a small cargo-miri smoke test even in `run_tests_minimal` This makes sure that cargo-miri works on all targets. Implements the first step of rust-lang/miri#2685 (comment) to get that PR tested.
- Loading branch information
Showing
5 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[package] | ||
name = "no-std-smoke" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
|
||
[profile.dev] | ||
panic = 'abort' | ||
|
||
[profile.release] | ||
panic = 'abort' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copied from tests/pass/no-std.rs | ||
|
||
#![feature(start)] | ||
#![no_std] | ||
|
||
// Plumbing to let us use `writeln!` to host stdout: | ||
|
||
extern "Rust" { | ||
fn miri_write_to_stdout(bytes: &[u8]); | ||
} | ||
|
||
struct Host; | ||
|
||
use core::fmt::Write; | ||
|
||
impl Write for Host { | ||
fn write_str(&mut self, s: &str) -> core::fmt::Result { | ||
unsafe { | ||
miri_write_to_stdout(s.as_bytes()); | ||
} | ||
Ok(()) | ||
} | ||
} | ||
|
||
#[start] | ||
fn start(_: isize, _: *const *const u8) -> isize { | ||
writeln!(Host, "hello, world!").unwrap(); | ||
0 | ||
} | ||
|
||
#[panic_handler] | ||
fn panic_handler(_: &core::panic::PanicInfo) -> ! { | ||
loop {} | ||
} |