| Age | Commit message (Collapse) | Author | Lines |
|
MIR dump: print pointers consistently with Miri output
This makes MIR allocation dump pointer printing consistent with Miri output: both use hexadecimal offsets with a `0x` prefix. To save some space, MIR dump replaces the `alloc` prefix by `a` when necessary.
I also made AllocId/Pointer printing more consistent in their Debug/Display handling, and adjusted Display printing for Scalar a bit to avoid using decimal printing when we do not know the sign with which to interpret the value (IMO using decimal then is misleading).
|
|
|
|
|
|
share some common code for compile-time miri instances
Fixes https://github.com/rust-lang/rust/issues/71129
r? @oli-obk
|
|
|
|
|
|
|
|
|
|
[breaking change] Disallow statics initializing themselves
fixes #71078
Self-initialization is unsound because it breaks privacy assumptions that unsafe code can make. In
```rust
pub mod foo {
#[derive(Debug, Copy, Clone)]
pub struct Foo {
x: (),
}
}
pub static FOO: foo::Foo = FOO;
```
unsafe could could expect that ony functions inside the `foo` module were able to create a value of type `Foo`.
|
|
|
|
Miri Frame: use mir::Location to represent position in function
I only recently learned that `Location` exists, and it seems to perfectly fit what Miri needs to represent which statement we are currently executing. :)
r? @ecstatic-morse
|
|
|
|
Reading from the return place is fine
Const eval thinks that reading from local `_0` is UB, but it isn't. `_0` is just a normal local like any other, and codegen handles it that way too. The only special thing is that the `Return` terminator will read from it.
I've hit these errors while working on an NRVO pass that can merge other locals with `_0` in https://github.com/rust-lang/rust/pull/71003.
r? @oli-obk
|
|
Co-Authored-By: Ralf Jung <post@ralfj.de>
|
|
|
|
Remove `BodyAndCache`
...returning to the original approach using interior mutability within `Body`. This simplifies the API at the cost of some uncontended mutex locks when the parallel compiler is enabled.
The current API requires you to either have a mutable reference to `Body` (`&mut BodyAndCache`), or to compute the predecessor graph ahead of time by creating a `ReadOnlyBodyAndCache`. This is not a good fit for, e.g., the dataflow framework, which
1. does not mutate the MIR
2. only sometimes needs the predecessor graph (for backward dataflow problems)
|
|
|
|
Miri: mplace_access_checked: offer option to force different alignment on place
Required to solve https://github.com/rust-lang/miri/issues/1339 in https://github.com/rust-lang/miri/pull/1348.
r? @oli-obk
|
|
|
|
Detect mistyped associated consts in `Instance::resolve`.
*Based on #71049 to prevent redundant/misleading downstream errors.*
Fixes #70942 by refusing to resolve an associated `const` if it doesn't have the same type in the `impl` that it does in the `trait` (which we assume had errored, and `delay_span_bug` guards against bugs).
|
|
|
|
|
|
Mostly renamed allocations, but I'm not sure about the const prop tests
|
|
|
|
|
|
|
|
Copy its value to the `return_place` upon leaving a call frame
|
|
Make the necessary changes to support concurrency in Miri.
This pull request makes the necessary changes to the Rust compiler to allow Miri to support concurrency:
1. Move stack from the interpretation context (`InterpCx`) to machine, so that the machine can switch the stacks when it changes the thread being executed.
2. Add the callbacks that allow the machine to generate fresh allocation ids for each thread local allocation and to translate them back to original allocations when needed. This allows the machine to ensure the property that allocation ids are unique, which allows using a simpler representation of the memory.
r? @oli-obk
cc @RalfJung
|
|
|
|
|
|
|
|
Miri: fix typo
r? @oli-obk at least I think this should be "without", right?
|
|
Add `ConstKind::Error` and convert `ErrorHandled::Reported` to it.
By replicating the `ty::Error` approach to encoding "an error has occurred", all of the mechanisms that skip redundant/downstream errors are engaged and help out (see the reduction in test output).
This PR also adds `ErrorHandled::Linted` for the lint case because using `ErrorHandled::Reported` *without* having emitted an error that is *guaranteed* to stop compilation, is incorrect now.
r? @oli-obk cc @rust-lang/wg-const-eval @varkor @yodaldevoid
|
|
|
|
rustc_target::abi: add Primitive variant to FieldsShape.
Originally suggested by @eddyb.
|
|
reword Miri validity errors: undefined -> uninitialized
I don't think we say "undefined value" or anything like that anywhere in the docs or so, but we do use the term "uninitialized memory", so I think we should do the same here.
Longer-term, I think we should also internally rename "undef" to "uninit".
r? @oli-obk
|
|
|
|
|
|
|
|
|
|
and add an additional comment.
|
|
|
|
clippy::{filter_next,single_char_pattern,unit_arg,identity_conversion,nonminimal_bool}
|
|
|
|
thread locals without touching debug info; address other PR comments.
|
|
|
|
resolve_maybe_global_alloc, clarify comments.
|
|
|
|
|
|
Miri: expand frame hooks
This is needed to make https://github.com/rust-lang/miri/pull/1330 work.
r? @oli-obk @eddyb
|