@@ -377,6 +377,11 @@ to Miri failing to detect cases of undefined behavior in a program.
377
377
* `-Zmiri-retag-fields` changes Stacked Borrows retagging to recurse into fields.
378
378
This means that references in fields of structs/enums/tuples/arrays/... are retagged,
379
379
and in particular, they are protected when passed as function arguments.
380
+ * `-Zmiri-retag-fields=<all|none|scalar>` controls when Stacked Borrows retagging recurses into
381
+ fields. `all` means it always recurses (like `-Zmiri-retag-fields`), `none` means it never
382
+ recurses (the default), `scalar` means it only recurses for types where we would also emit
383
+ ` noalias` annotations in the generated LLVM IR (types passed as indivudal scalars or pairs of
384
+ scalars).
380
385
* `-Zmiri-tag-gc=<blocks>` configures how often the pointer tag garbage collector runs. The default
381
386
is to search for and remove unreachable tags once every `10000` basic blocks. Setting this to
382
387
` 0` disables the garbage collector, which causes some programs to have explosive memory usage
@@ -435,11 +440,10 @@ Moreover, Miri recognizes some environment variables:
435
440
purpose.
436
441
* `MIRI_NO_STD` (recognized by `cargo miri` and the test suite) makes sure that the target's
437
442
sysroot is built without libstd. This allows testing and running no_std programs.
438
- * `MIRI_BLESS` (recognized by the test suite) overwrite all `stderr` and `stdout` files
439
- instead of checking whether the output matches.
440
- * `MIRI_SKIP_UI_CHECKS` (recognized by the test suite) don't check whether the
441
- ` stderr` or `stdout` files match the actual output. Useful for the rustc test suite
442
- which has subtle differences that we don't care about.
443
+ * `MIRI_BLESS` (recognized by the test suite and `cargo-miri-test/run-test.py`): overwrite all
444
+ ` stderr` and `stdout` files instead of checking whether the output matches.
445
+ * `MIRI_SKIP_UI_CHECKS` (recognized by the test suite): don't check whether the
446
+ ` stderr` or `stdout` files match the actual output.
443
447
444
448
The following environment variables are *internal* and must not be used by
445
449
anyone but Miri itself. They are used to communicate between different Miri
@@ -532,6 +536,27 @@ extern "Rust" {
532
536
/// This is internal and unstable and should not be used; we give it here
533
537
/// just to be complete.
534
538
fn miri_start_panic(payload : *mut u8) -> !;
539
+
540
+ /// Miri-provided extern function to get the internal unique identifier for the allocation that a pointer
541
+ /// points to. This is only useful as an input to `miri_print_stacks`, and it is a separate call because
542
+ /// getting a pointer to an allocation at runtime can change the borrow stacks in the allocation.
543
+ fn miri_get_alloc_id(ptr : *const ()) -> u64;
544
+
545
+ /// Miri-provided extern function to print (from the interpreter, not the program) the contents of all
546
+ /// borrow stacks in an allocation. The format of what this emits is unstable and may change at any time.
547
+ /// In particular, users should be aware that Miri will periodically attempt to garbage collect the
548
+ /// contents of all stacks. Callers of this function may wish to pass `-Zmiri-tag-gc=0` to disable the GC.
549
+ fn miri_print_stacks(alloc_id : u64);
550
+
551
+ /// Miri-provided extern function to print (from the interpreter, not the
552
+ /// program) the contents of a section of program memory, as bytes. Bytes
553
+ /// written using this function will emerge from the interpreter's stdout.
554
+ fn miri_write_to_stdout(bytes : &[u8]);
555
+
556
+ /// Miri-provided extern function to print (from the interpreter, not the
557
+ /// program) the contents of a section of program memory, as bytes. Bytes
558
+ /// written using this function will emerge from the interpreter's stderr.
559
+ fn miri_write_to_stderr(bytes : &[u8]);
535
560
}
536
561
```
537
562
0 commit comments