Jubilee Young
236fe33345
compiler: Directly use rustc_abi in metadata and middle
...
Stop reexporting ReprOptions from middle::ty
2024-11-03 13:38:47 -08:00
Ralf Jung
f76f128dc9
const-eval interning: accpt interior mutable pointers in final value (but keep rejecting mutable references)
2024-09-10 10:26:16 +02:00
Ralf Jung
5d5c97aad7
interpret: simplify pointer arithmetic logic
2024-08-01 14:25:19 +02:00
Ralf Jung
de78cb56b2
on a signed deref check, mention the right pointer in the error
2024-08-01 14:25:19 +02:00
Matthias Krüger
eb8114bad7
Rollup merge of #128277 - RalfJung:offset_from_wildcard, r=oli-obk
...
miri: fix offset_from behavior on wildcard pointers
offset_from wouldn't behave correctly when the "end" pointer was a wildcard pointer (result of an int2ptr cast) just at the end of the allocation. Fix that by expressing the "same allocation" check in terms of two `check_ptr_access_signed` instead of something specific to offset_from, which is both more canonical and works better with wildcard pointers.
The second commit just improves diagnostics: I wanted the "pointer is dangling (has no provenance)" message to say how many bytes of memory it expected to see (since if it were 0 bytes, this would actually be legal, so it's good to tell the user that it's not 0 bytes). And then I was annoying that the error looks so different for when you deref a dangling pointer vs an out-of-bounds pointer so I made them more similar.
Fixes https://github.com/rust-lang/miri/issues/3767
2024-07-29 11:42:34 +02:00
Nicholas Nethercote
84ac80f192
Reformat use
declarations.
...
The previous commit updated `rustfmt.toml` appropriately. This commit is
the outcome of running `x fmt --all` with the new formatting options.
2024-07-29 08:26:52 +10:00
Ralf Jung
f8ebe8d783
improve dangling/oob errors and make them more uniform
2024-07-27 21:12:54 +02:00
Nicholas Nethercote
7418aa1a07
Remove extern crate rustc_data_structures
from numerous crates.
2024-04-29 18:45:14 +10:00
Nicholas Nethercote
6ce258f657
Remove extern crate rustc_macros
from rustc_middle
.
2024-04-29 11:19:16 +10:00
Markus Reiter
a90cc05233
Replace NonZero::<_>::new
with NonZero::new
.
2024-02-15 08:09:42 +01:00
Markus Reiter
746a58d435
Use generic NonZero
internally.
2024-02-15 08:09:42 +01:00
Ralf Jung
2f1a8e2d7a
const-eval interner: from-scratch rewrite using mutability information from provenance rather than types
2024-01-22 09:28:00 +01:00
Ralf Jung
29c95e98e3
also print 'immutable' flag
2023-12-07 17:46:36 +01:00
Ralf Jung
cb86303342
ctfe interpreter: extend provenance so that it can track whether a pointer is immutable
2023-12-07 17:46:36 +01:00
Ralf Jung
fa5f13775a
interpret: make MemPlace, Place, Operand types private to the interpreter
2023-09-04 17:53:38 +02:00
David Tolnay
5bbf0a8306
Revert "Auto merge of #113166 - moulins:ref-niches-initial, r=oli-obk"
...
This reverts commit 557359f925
, reversing
changes made to 1e6c09a803
.
2023-07-21 22:35:57 -07:00
Moulins
39cfe70e4f
CTFE: move target_{i, u}size_{min, max)
to rustc_abi::TargetDataLayout
2023-07-21 03:31:47 +02:00
Josh Soref
e09d0d2a29
Spelling - compiler
...
* account
* achieved
* advising
* always
* ambiguous
* analysis
* annotations
* appropriate
* build
* candidates
* cascading
* category
* character
* clarification
* compound
* conceptually
* constituent
* consts
* convenience
* corresponds
* debruijn
* debug
* debugable
* debuggable
* deterministic
* discriminant
* display
* documentation
* doesn't
* ellipsis
* erroneous
* evaluability
* evaluate
* evaluation
* explicitly
* fallible
* fulfill
* getting
* has
* highlighting
* illustrative
* imported
* incompatible
* infringing
* initialized
* into
* intrinsic
* introduced
* javascript
* liveness
* metadata
* monomorphization
* nonexistent
* nontrivial
* obligation
* obligations
* offset
* opaque
* opportunities
* opt-in
* outlive
* overlapping
* paragraph
* parentheses
* poisson
* precisely
* predecessors
* predicates
* preexisting
* propagated
* really
* reentrant
* referent
* responsibility
* rustonomicon
* shortcircuit
* simplifiable
* simplifications
* specify
* stabilized
* structurally
* suggestibility
* translatable
* transmuting
* two
* unclosed
* uninhabited
* visibility
* volatile
* workaround
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-17 16:09:18 -04: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
91d25168cd
interpret: rename Pointer::from_addr → from_addr_invalid
2023-02-14 14:55:50 +01:00
KaDiWa
9bc69925cb
compiler: remove unnecessary imports and qualified paths
2022-12-10 18:45:34 +01:00
Ralf Jung
77071f7e3a
interpret: remove PartialOrd from a bunch of types that do not have or need a sensible order
2022-11-26 10:10:34 +01:00
Ralf Jung
2cef9e3d19
interpret: support for per-byte provenance
2022-11-06 14:17:10 +01:00
Rageking8
7122abaddf
more dupe word typos
2022-10-14 12:57:56 +08:00
Ralf Jung
c46e803aaf
improve OFFSET_IS_ADDR docs
2022-08-28 13:05:34 -04:00
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
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
46956f76ca
adjust dangling-int-ptr error message
2022-07-05 08:08:24 -04:00
Ralf Jung
c36572c11e
add AllocRange Debug impl; remove redundant AllocId Display impl
2022-07-02 11:41:16 -04:00
carbotaniuman
bd5fce65c6
Rustc changes for permissive provenance
2022-05-13 12:30:25 -05:00
Ralf Jung
c83241a7f9
avoid an unnecessary call to Pointer::into_parts, and caution against into_pointer_or_addr
2022-04-18 12:30:17 -04:00
Ralf Jung
3236092503
add method to get absolute address of a pointer (useful only for Miri)
2022-04-18 12:30:17 -04:00
Ralf Jung
c9e568f72e
avoid pairing up AllocId and PointerTag, which is redundant
2022-04-18 10:14:06 -04:00
Ralf Jung
a421cbbead
interpret: make isize::MAX the limit for dynamic value sizes
2022-03-31 08:57:45 -04:00
codehorseman
01dbfb3eb2
resolve the conflict in compiler/rustc_session/src/parse.rs
...
Signed-off-by: codehorseman <cricis@yeah.net>
2022-03-16 20:12:30 +08:00
Ralf Jung
07b64bfd3a
interpreter PointerArithmetic: use new Size helper methods
2021-09-11 12:21:10 -04:00
Ralf Jung
14de6ec8d8
CTFE: throw unsupported error when partially overwriting a pointer
2021-07-31 11:30:33 +02:00
Ralf Jung
bed3b965ae
miri: better ptr-out-of-bounds errors
2021-07-18 10:38:00 +02:00
Ralf Jung
efbee50600
avoid manual Debug impls by adding extra Provenance bounds to types
...
I wish the derive macro would support adding extra where clauses...
2021-07-16 20:02:14 +02:00
Ralf Jung
7c720ce612
get rid of incorrect erase_for_fmt
2021-07-16 10:09:56 +02:00
Ralf Jung
f4b61ba509
adjustions and cleanup to make Miri build again
2021-07-15 17:14:11 +02:00
Ralf Jung
71c166a0dc
use NonZeroU64 for AllocId to restore old type sizes
2021-07-14 18:17:49 +02:00
Ralf Jung
626605cea0
consistently treat None-tagged pointers as ints; get rid of some deprecated Scalar methods
2021-07-14 18:17:49 +02:00
Ralf Jung
d4f7dd6702
CTFE/Miri engine Pointer type overhaul: make Scalar-to-Pointer conversion infallible
...
This resolves all the problems we had around "normalizing" the representation of a Scalar in case it carries a Pointer value: we can just use Pointer if we want to have a value taht we are sure is already normalized.
2021-07-14 18:17:46 +02:00
Jacob Pratt
edf2e3725e
Use unsigned_abs throughout repository
2021-01-13 17:58:08 -05:00
mark
9e5f7d5631
mv compiler to compiler/
2020-08-30 18:45:07 +03:00