Skip to content

Commit 15c4e40

Browse files
committed
unsafe(no_mangle) in miri_start examples
1 parent ea9037e commit 15c4e40

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/tools/miri/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ Miri knows where it is supposed to start execution:
489489

490490
```rust
491491
#[cfg(miri)]
492-
#[no_mangle]
492+
#[unsafe(no_mangle)]
493493
fn miri_start(argc: isize, argv: *const *const u8) -> isize {
494494
// Call the actual start function that your project implements, based on your target's conventions.
495495
}

src/tools/miri/src/bin/miri.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ fn entry_fn(tcx: TyCtxt<'_>) -> (DefId, MiriEntryFnType) {
106106
} else {
107107
tcx.dcx().fatal(
108108
"`miri_start` must have the following signature:\n\
109-
fn miri_start(argc: isize, argv: *const *const u8) -> isize",
109+
fn miri_start(argc: isize, argv: *const *const u8) -> isize",
110110
);
111111
}
112112
} else {
@@ -115,7 +115,7 @@ fn entry_fn(tcx: TyCtxt<'_>) -> (DefId, MiriEntryFnType) {
115115
Alternatively, you can export a `miri_start` function:\n\
116116
\n\
117117
#[cfg(miri)]\n\
118-
#[no_mangle]\n\
118+
#[unsafe(no_mangle)]\n\
119119
fn miri_start(argc: isize, argv: *const *const u8) -> isize {\
120120
\n // Call the actual start function that your project implements, based on your target's conventions.\n\
121121
}"

src/tools/miri/tests/fail/no_main.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error: Miri can only run programs that have a main function.
22
Alternatively, you can export a `miri_start` function:
33

44
#[cfg(miri)]
5-
#[no_mangle]
5+
#[unsafe(no_mangle)]
66
fn miri_start(argc: isize, argv: *const *const u8) -> isize {
77
// Call the actual start function that your project implements, based on your target's conventions.
88
}

0 commit comments

Comments
 (0)