| Age | Commit message (Collapse) | Author | Lines |
|
|
|
avoid rightwards drift
|
|
|
|
|
|
|
|
Don't access a static just for its size and alignment
cc @RalfJung
fixes #62189
|
|
Remove support for -Zlower-128bit-ops
It is broken and unused
cc https://github.com/rust-lang/rust/issues/58969
blocked https://github.com/rust-lang-nursery/compiler-builtins/pull/302 (removes definitions of the lang items removed in this PR)
r? @alexcrichton
|
|
Co-Authored-By: Ralf Jung <post@ralfj.de>
|
|
Co-Authored-By: Ralf Jung <post@ralfj.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
more specific errors in src/librustc/mir/interpret/error.rs
Implements [this](https://github.com/rust-rfcs/const-eval/issues/4)
|
|
|
|
|
|
|
|
|
|
It is broken and unused
|
|
miri validation: better error messages for dangling references
Cc @oli-obk
|
|
|
|
|
|
|
|
pnkfelix:issue-60431-make-struct-tail-normalize-when-possible, r=eddyb
Make struct_tail normalize when possible
As noted in commit message: this replaces the existing methods to extract the struct tail(s) with new entry points that make the handling of normalization explicit.
Most of the places that call `struct_tail` are during codegen, post type-checking, and therefore they can get away with using `tcx.normalize_erasing_regions` (this is the entry point `struct_tail_erasing_lifetimes`)
For other cases that may arise, one can use the core method, which is parameterized over the normalization `Ty -> Ty` closure (`struct_tail_with_normalize`).
Or one can use the trivial entry point that does not normalization (`struct_tail_without_normalization`)
----
I spent a little while trying to make a test that exposed the bug via `impl Trait` rather than a projection, but I failed to find something that tripped up the current nightly `rustc`.
* I have *not* spent any time trying to make tests that trip up the other places where `struct_tail` was previously being called. While I do think the task of making such tests could be worthwhile, I am simply running out of time. (Its also possible that the layout code is always the first point called, and thus it may be pointless to try to come up with such tests.)
I also spent a little time discussing with @eddyb where this code should live. They suggested moving `struct_tail` and its sibling `struct_lockstep_tails` to the `LayoutCx`. But in the interest of time, I have left that refactoring (which may be questionable at this point) to a follow-up task.
----
Fix #60431
|
|
normalization.
The old struct tail functions did not deal with `<T as Trait>::A` and `impl
Trait`, at least not explicitly. (We didn't notice this bug before because it
is only exposed when the tail (post deep normalization) is not `Sized`, so it
was a rare case to deal with.)
For post type-checking (i.e. during codegen), there is now
`struct_tail_erasing_lifetimes` and `struct_lockstep_tails_erasing_lifetimes`,
which each take an additional `ParamEnv` argument to drive normalization.
For pre type-checking cases where normalization is not needed, there is
`struct_tail_without_normalization`. (Currently, the only instance of this is
`Expectation::rvalue_hint`.)
All of these new entrypoints work by calling out to common helper routines.
The helpers are parameterized over a closure that handles the normalization.
|
|
Miri: Provide pointer forcing methods for MemPlace and Op
These are useful when one wants to to a lot of work with some place or operand and not to int-to-ptr casts all the time. In particular, this is needed to fix some test failures in Miri: we need to normalize before starting a visitor that walks a run-time value, so that we can later be sure (during the visitor walk) that we have a proper `Pointer`.
Also see the Miri side at https://github.com/rust-lang/miri/pull/830.
Cc @eddyb @oli-obk
|
|
https://github.com/rust-lang/rust/issues/60532
r? @alexreg
|
|
Normalziation does not work well for dyamically sized types
|
|
|
|
|
|
for mplace and op to avoid repeated int-to-ptr casting during validation.
Also change Memory::copy to work on `Pointer` instead of `Scalar`.
Also rename some methods from to_* to assert_* that will panic if their precondition is not met.
|
|
Fix perf regression from Miri Machine trait changes
Maybe this fixes the perf regression that https://github.com/rust-lang/rust/pull/62003 seemingly introduced?
Cc @nnethercote
|
|
forward read_c_str method from Memory to Alloc
This is more convenient to call when one starts with a `Scalar` (which is the common case).
`read_c_str` is only used in Miri.
|
|
Miri engine: support extra function (pointer) values
We want to add basic support for `dlsym` in Miri (needed to run the latest version of `getrandom`). For that to work, `dlsym` needs to return *something* that can be stored in a function pointer and later called.
So we add a new `ExtraFnVal` type to the `Machine` trait, and enable Miri's memory to associate allocation IDs with such values, so that `create_fn_alloc` and `get_fn` can work on *both* `Instance` (this is used for "normal" function pointers) and `ExtraFnVal`.
Cc @oli-obk
|
|
|
|
the error that actually gets shown a bit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
determined by the machine instance.
So far, however, calling such a function will fail.
|
|
This is needed to avoid doing unnecessary global alloc_map lookups
|
|
|
|
|
|
miri realloc: do not require giving old size+align
|