mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-17 05:25:37 +03:00
unsafe(no_mangle) in miri_start examples
This commit is contained in:
@@ -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.
|
||||
}
|
||||
|
||||
@@ -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 miri_start(argc: isize, argv: *const *const u8) -> isize",
|
||||
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\
|
||||
}"
|
||||
|
||||
@@ -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.
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user