Commit graph

381 commits

Author SHA1 Message Date
Alexander Regueiro
fd48ca20d3 Apply suggestions from code review
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-09-07 16:27:20 +01:00
Alexander Regueiro
c1d29ee3c7 Aggregation of cosmetic changes made during work on REPL PRs: librustc 2019-09-07 16:27:19 +01:00
Mazdak Farrokhzad
afb6a7002d
Rollup merge of #64202 - alexreg:rush-pr-1, r=Centril
Fixed grammar/style in some error messages

Factored out from hacking on rustc for work on the REPL.

r? @Centril
2019-09-06 19:00:49 +02:00
Oliver Scherer
39bfb3626c Fix miri 2019-09-06 11:10:53 +02:00
Alexander Regueiro
022d9c8eb5 Fixed grammar/style in error messages and reblessed tests. 2019-09-06 03:46:08 +01:00
bors
b50520835f Auto merge of #63561 - HeroicKatora:alloc-private-bytes, r=oli-obk
Make Allocation::bytes private

Fixes #62931.

Direct immutable access to the bytes is still possible but redirected through the new method `raw_bytes_with_undef_and_ptr`, similar to `get_bytes_with_undef_and_ptr` but without requiring an interpretation context and not doing *any* relocation or bounds checks. The `size` of the allocation is stored separately which makes access as `Size` and `usize` more ergonomic.

cc: @RalfJung
2019-09-02 22:07:40 +00:00
Andreas Molzer
f3c435eb78 Reorder AllocationDefinedness members
This improves the clarity of the documentation a bit since they can
reference each other when reading the member docs in sequence.
2019-08-31 21:21:29 +02:00
Andreas Molzer
823c3b9845 Improve documentation around allocation accessors 2019-08-31 17:19:01 +02:00
Andreas Molzer
bee2d3748e Move relocation range copies into allocation 2019-08-30 04:17:18 +02:00
Andreas Molzer
6fe31fefd8 Make allocation relocation field private 2019-08-29 20:02:21 +02:00
Andreas Molzer
85d6b7b9d3 Address naming and comments from reviews 2019-08-28 03:58:42 +02:00
Andreas Molzer
7b941e368f Expose encapsulated undef mask as immutable 2019-08-21 10:55:16 +02:00
Andreas Molzer
d8c5bc7ec6 Replace usage of alloc.bytes in interpret
There is now a dedicate `len` method which avoids the need to access the
bytes. Access the length as `Size` can also be done by a direct member.
The constructors guarantee that these representations are convertable.

Access which relies on the bytes, such as snapshot, can use direct raw
access by reference as it does not care about undef and relocations or
properly checks them seperately.
2019-08-21 10:55:16 +02:00
bors
cdff918955 Auto merge of #63670 - Dante-Broggi:patch-2, r=Centril
Size has a ::zero
2019-08-19 05:12:58 +00:00
Dante-Broggi
d64f06ce31 size has a zero 2019-08-17 16:09:49 -04:00
Dante-Broggi
a7c34f1ce9 fix typos 2019-08-17 15:36:28 -04:00
Andreas Molzer
98cff69289 Move copy of undef_mask into allocation
This also means that the compressed representation chosen may be
optimized together with any changes to the undef_mask.
2019-08-17 19:58:15 +02:00
Andreas Molzer
2228b3f086 Derive HashStable for Allocation
Requires a manual implementation for Relocations since dereferencing to
SortedMap is not always implemented but that one is far more trivial.
Added fields could otherwise be silently forgotten since private fields
make destructing outside the module possible only with `..` pattern
which would then also be applicable to newly added public fields.
2019-08-17 19:58:15 +02:00
Andreas Molzer
9b9eecf964 Store allocation size, make bytes, undef_mask private
Direct access to the bytes was previously a problem (#62931) where
components would read their contents without properly checking
relocations and/or definedness.

Making bytes private instead of purely renaming them also helps in
allowing amendments to their allocation scheme (such as eliding
allocation for undef of constant regions).
2019-08-17 18:43:02 +02:00
Mazdak Farrokhzad
c358476c1b
Rollup merge of #63075 - RalfJung:deref-checks, r=oli-obk
Miri: Check that a ptr is aligned and inbounds already when evaluating `*`

This syncs Miri with what the Nomicon and the Reference say, and resolves https://github.com/rust-lang/miri/issues/447.

Also this would not have worked without https://github.com/rust-lang/rust/pull/62982 due to new cycles. ;)

r? @oli-obk
2019-08-14 22:56:20 +02:00
Ralf Jung
440a5c8100 rename RUST_CTFE_BACKTRACE to RUSTC_CTFE_BACKTRACE 2019-08-10 16:37:40 +02:00
bors
5421d94960 Auto merge of #63152 - estebank:big-array, r=oli-obk
Always error on `SizeOverflow` during mir evaluation

Fix #55878, fix #25116.

r? @oli-obk
2019-08-07 04:28:08 +00:00
bors
4be0675589 Auto merge of #63079 - RalfJung:ctfe-no-align, r=oli-obk
CTFE: simplify ConstValue by not checking for alignment

I hope the test suite actually covers the problematic cases here?

r? @oli-obk

Fixes https://github.com/rust-lang/rust/issues/61952
2019-08-05 08:16:51 +00:00
Esteban Küber
bdd79b849e tweak output and tests 2019-08-04 12:23:05 -07:00
Ralf Jung
b9d4c759f3 AssumptionNotHeld is used only once in Miri and never caught... remove from enum 2019-08-04 11:59:14 +02:00
Ralf Jung
18daa766f0 move AssumptionNotHeld to UB 2019-08-04 11:21:41 +02:00
Esteban Küber
2c5684208c avoid mutable state and override main message 2019-08-03 13:37:44 -07:00
Ralf Jung
89a370db0f add variant for experimental UB (like Stacked Borrows) 2019-08-03 20:36:05 +02:00
Ralf Jung
fe08d9e2d2 also add macros for free-form error messages 2019-08-03 20:35:52 +02:00
Ralf Jung
1e24c73ae5 dedup free-form Unsupported errors; add macros for free-form UB and Unsupported cases 2019-08-02 23:41:24 +02:00
Ralf Jung
1b132a2f41 be less British 2019-08-02 23:31:21 +02:00
Ralf Jung
e590b849b8 CTFE: simplify Value type by not checking for alignment 2019-08-02 23:02:53 +02:00
Esteban Küber
d3da411a08 Nicer labels for type layout errors 2019-08-02 12:33:58 -07:00
Esteban Küber
58bd8786e8 Do not lint on SizeOverflow, always error 2019-08-02 12:31:31 -07:00
Esteban Küber
83b5eb9615 Always error on SizeOverflow during mir evaluation 2019-08-02 12:30:46 -07:00
Saleem Jaffer
00d32e8687 code review fixes 2019-08-01 12:13:49 +05:30
Saleem Jaffer
0c4513e8ed code review fixes 2019-08-01 09:49:01 +05:30
Saleem Jaffer
c17d11fb39 code review fixes 2019-07-31 18:14:49 +05:30
Saleem Jaffer
152f0d347e code review fixes 2019-07-31 12:48:54 +05:30
Saleem Jaffer
5585445a33 throw_X macros use err_X macros 2019-07-30 20:36:17 +05:30
Saleem Jaffer
35417e722b renaming throw_err_* to throw_* 2019-07-30 20:18:50 +05:30
Saleem Jaffer
fc5df1dfbf renaming err to err_unsup 2019-07-30 16:08:32 +05:30
Saleem Jaffer
69daf844da adding throw_ and err_ macros for InterpError 2019-07-30 15:25:12 +05:30
Saleem Jaffer
2a33fbff22 addding an interp_error module 2019-07-30 13:18:36 +05:30
Saleem Jaffer
9f8b099846 code review fixes 2019-07-29 20:17:52 +05:30
Saleem Jaffer
03d47be8f0 code review fixes 2019-07-29 13:41:32 +05:30
Saleem Jaffer
654519d3c5 use PanicInfo and UnsupportedOpInfo 2019-07-29 13:35:59 +05:30
Saleem Jaffer
8e9d0faff2 adding a err macro for each of the InterpError variants 2019-07-29 13:35:59 +05:30
Saleem Jaffer
9782b373b3 implementing Debug for UnsupportedInfo 2019-07-29 13:35:10 +05:30
Saleem Jaffer
307798aa38 fixing fallout due to InterpError refactor 2019-07-29 13:35:09 +05:30