Ralf Jung
763e3131cc
don't ICE when encountering an extern type field during validation
2024-06-22 17:39:01 +02:00
Ralf Jung
4c208ac233
use is_none_or in some places in the compiler
2024-06-12 16:20:07 +02:00
Ralf Jung
d5fb8257e7
interpret: do not ICE on padded non-pow2 SIMD vectors
2024-06-09 11:54:23 +02:00
Ralf Jung
e8379c9598
interpret: get rid of 'mir lifetime everywhere
2024-05-27 08:25:57 +02:00
Nicholas Nethercote
7a5d814a04
Remove #[macro_use] extern crate tracing from rustc_const_eval.
2024-05-23 18:02:38 +10:00
Nicholas Nethercote
4497d345a8
Remove extern crate rustc_middle from rustc_const_eval.
...
This requires exporting the interpreter macros so they can be used with
`use crate::interpret::*`.
2024-05-13 08:02:14 +10:00
Ralf Jung
4497990dff
remove some frame parameters that are no longer needed
2024-03-09 18:28:14 +01:00
Ralf Jung
29db7890ba
interpret/visitor: ensure we only see normalized types
2024-02-10 17:00:24 +01:00
Ralf Jung
1025a12b64
interpret: project_downcast: do not ICE for uninhabited variants
2024-01-26 09:01:56 +01:00
Oli Scherer
1f398abcb6
const prop nonsense eliminated
2024-01-23 16:34:43 +00:00
Ralf Jung
5d87d8307f
interpret: extend comment on the inhabitedness check in downcast
2023-12-14 09:50:47 +01:00
Ralf Jung
9ef1e35166
reject projecting to fields whose offset we cannot compute
2023-12-12 08:15:17 +01:00
Ralf Jung
ef15a8182b
codegen, miri: fix computing the offset of an unsized field in a packed struct
2023-12-03 08:26:51 +01:00
klensy
aff6c741d4
remove unused pub fn
2023-11-23 14:11:02 +03:00
Ralf Jung
f3f9b795bd
place evaluation: require the original pointer to be aligned if an access happens
2023-10-15 18:13:31 +02:00
Ralf Jung
ea9a24e32e
avoid re-checking the offset while iterating an array/slice
2023-10-15 18:12:46 +02:00
Ralf Jung
b1ebf002c3
don't UB on dangling ptr deref, instead check inbounds on projections
2023-10-15 18:12:46 +02:00
ouz-a
cd7f471931
Add docs, remove code, change subtyper code
2023-10-02 23:39:44 +03:00
ouz-a
3148e6a993
subtyping_projections
2023-10-02 23:37:49 +03:00
Oli Scherer
2d4201f7c6
Skip reinterning if nothing changed
2023-09-28 16:13:38 +00:00
Oli Scherer
6ea2db7c2d
Strip OpaqueCast during RevealAll.
2023-09-28 16:13:38 +00:00
Ralf Jung
fa5f13775a
interpret: make MemPlace, Place, Operand types private to the interpreter
2023-09-04 17:53:38 +02:00
Ralf Jung
7cdeff266c
a bit of meta-related cleanup on Projectable
2023-08-30 13:46:55 +02:00
Ralf Jung
bdd5855b8e
interpret: fix projecting into an unsized field of a local
...
new invariant: Place::Local never refers to something unsized
2023-08-30 13:43:34 +02:00
Ralf Jung
efd54ccf5a
interpret: use ConstPropNonsense for more const-prop induced issues
2023-08-06 15:20:03 +02:00
Ralf Jung
7d5886504c
rename deref_operand → deref_pointer and some Miri helper functions
2023-08-01 13:40:29 +02:00
Ralf Jung
00fb45dccd
interpret: make write functions generic over the place type
2023-07-25 22:33:58 +02:00
Ralf Jung
a2bcafa500
interpret: refactor projection code to work on a common trait, and use that for visitors
2023-07-25 14:30:58 +02:00
Ralf Jung
a593de4fab
interpret: support projecting into Place::Local without force_allocation
2023-07-24 15:35:47 +02:00
Boxy
12138b8e5e
Move TyCtxt::mk_x to Ty::new_x where applicable
2023-07-05 20:27:07 +01:00
Oli Scherer
38b7cdf393
Use target instead of machine for mir interpreter integer handling.
...
The naming of `machine` only makes sense from a mir interpreter internals perspective, but outside users talk about the `target` platform
2023-02-15 08:56:18 +00:00
Ralf Jung
158894464c
interpret: add read_machine_[ui]size convenience methods
2022-12-12 11:10:19 +01:00
Maybe Waffle
1d42936b18
Prefer doc comments over //-comments in compiler
2022-11-27 11:19:04 +00:00
Ralf Jung
4101889786
interpret: use Either over Result when it is not representing an error condition
2022-11-18 10:18:32 +01:00
Oli Scherer
40e2de8c41
Revert "Revert "Rollup merge of #98582 - oli-obk:unconstrained_opaque_type, r=estebank""
...
This reverts commit 4a742a691e .
2022-09-16 11:36:39 +00:00
Dezhi Wu
b1430fb7ca
Fix a bunch of typo
...
This PR will fix some typos detected by [typos].
I only picked the ones I was sure were spelling errors to fix, mostly in
the comments.
[typos]: https://github.com/crate-ci/typos
2022-08-31 18:24:55 +08:00
Dylan DPC
81f3841cfb
Rollup merge of #101101 - RalfJung:read-pointer-as-bytes, r=oli-obk
...
interpret: make read-pointer-as-bytes a CTFE-only error with extra information
Next step in the reaction to https://github.com/rust-lang/rust/issues/99923 . Also teaches Miri to implicitly strip provenance in more situations when transmuting pointers to integers, which fixes https://github.com/rust-lang/miri/issues/2456 .
Pointer-to-int transmutation during CTFE now produces a message like this:
```
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
```
r? ``@oli-obk``
2022-08-30 11:26:51 +05:30
Ralf Jung
2e172473da
interpret: make read-pointer-as-bytes *always* work in Miri
...
and show some extra information when it happens in CTFE
2022-08-27 18:37:44 -04:00
Ralf Jung
4173e971b8
remove an ineffective check in const_prop
2022-08-27 08:53:04 -04:00
bors
a7468c60f8
Auto merge of #99472 - RalfJung:provenance, r=oli-obk
...
interpret: rename Tag/PointerTag to Prov/Provenance
We were pretty inconsistent with calling this the "tag" vs the "provenance" of the pointer; I think we should consistently call it "provenance".
r? `@oli-obk`
2022-07-20 16:56:31 +00:00
Oli Scherer
4a742a691e
Revert "Rollup merge of #98582 - oli-obk:unconstrained_opaque_type, r=estebank"
...
This reverts commit 6f8fb911ad , reversing
changes made to 7210e46dc6 .
2022-07-20 07:55:58 +00:00
Ralf Jung
0ec3269db8
interpret: rename Tag/PointerTag to Prov/Provenance
...
Let's avoid using two different terms for the same thing -- let's just call it "provenance" everywhere.
In Miri, provenance consists of an AllocId and an SbTag (Stacked Borrows tag), which made this even more confusing.
2022-07-19 15:38:32 -04:00
Ralf Jung
213a25d975
interpret: make some large types not Copy
2022-07-18 13:57:35 -04:00
Matthias Krüger
fa298beb79
Rollup merge of #99259 - RalfJung:visit-a-place, r=oli-obk
...
interpret/visitor: support visiting with a PlaceTy
Finally we can visit a `PlaceTy` in a way that will only do `force_allocation` when needed ti visit a field. :)
r? `@oli-obk`
2022-07-16 22:30:51 +02:00
Ralf Jung
c4cb043f06
interpret/visitor: support visiting with a PlaceTy
2022-07-15 11:54:20 -04:00
Oli Scherer
84a444a1f4
Introduce opaque type to hidden type projection
2022-07-15 15:49:22 +00:00
Ralf Jung
ab225ade1e
interpret: refactor projection handling code
...
Moves our projection handling code into a common file, and avoids the use of a
general mplace-based fallback function by have more specialized implementations.
mplace_index (and the other slice-related functions) could be more efficient by
copy-pasting the body of operand_index. Or we could do some trait magic to share
the code between them. But for now this is probably fine.
2022-07-11 22:50:46 -04:00