unsafe(no_mangle) in miri_start examples

This commit is contained in:
primoly 2025-04-27 13:49:51 +02:00
parent ea9037e165
commit 15c4e40928
3 changed files with 4 additions and 4 deletions

View file

@ -489,7 +489,7 @@ Miri knows where it is supposed to start execution:
```rust
#[cfg(miri)]
#[no_mangle]
#[unsafe(no_mangle)]
fn miri_start(argc: isize, argv: *const *const u8) -> isize {
// Call the actual start function that your project implements, based on your target's conventions.
}

View file

@ -106,7 +106,7 @@ fn entry_fn(tcx: TyCtxt<'_>) -> (DefId, MiriEntryFnType) {
} else {
tcx.dcx().fatal(
"`miri_start` must have the following signature:\n\
fn miri_start(argc: isize, argv: *const *const u8) -> isize",
fn miri_start(argc: isize, argv: *const *const u8) -> isize",
);
}
} else {
@ -115,7 +115,7 @@ fn entry_fn(tcx: TyCtxt<'_>) -> (DefId, MiriEntryFnType) {
Alternatively, you can export a `miri_start` function:\n\
\n\
#[cfg(miri)]\n\
#[no_mangle]\n\
#[unsafe(no_mangle)]\n\
fn miri_start(argc: isize, argv: *const *const u8) -> isize {\
\n // Call the actual start function that your project implements, based on your target's conventions.\n\
}"

View file

@ -2,7 +2,7 @@ error: Miri can only run programs that have a main function.
Alternatively, you can export a `miri_start` function:
#[cfg(miri)]
#[no_mangle]
#[unsafe(no_mangle)]
fn miri_start(argc: isize, argv: *const *const u8) -> isize {
// Call the actual start function that your project implements, based on your target's conventions.
}