Commit graph

392 commits

Author SHA1 Message Date
Wesley Wiser
4e58e2e3a3 Work around for #64506 2019-09-27 20:11:13 -04:00
Wesley Wiser
bc17936c8a [const-prop] Replace eval_place() with use of InterpCx 2019-09-27 20:11:12 -04:00
varkor
bea3d67c77 Rename subst::Kind to subst::GenericArg 2019-09-26 11:48:05 +01:00
Tyler Mandry
dbce655eda
Rollup merge of #64503 - RalfJung:miri-retag, r=oli-obk
rename Allocation::retag -> with_tags_and_extra

This is more consistent with `Pointer::with_tag`. Also, "retag" is a [term from Stacked Borrows](https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md#retagging) with a [corresponding Machine hook](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/interpret/machine/trait.Machine.html#method.retag), and this function has nothing to do with that other use of the term.

r? @oli-obk
2019-09-17 21:27:23 -07:00
Tyler Mandry
f8b6e26cfb
Rollup merge of #64541 - RalfJung:miri-errors, r=oli-obk
document Miri error categories

r? @oli-obk
2019-09-17 14:10:55 -07:00
Oliver Scherer
0de9485038 Get rid of special const intrinsic query in favour of const_eval 2019-09-17 16:31:55 +02:00
Ralf Jung
e8d858ef3c rename Allocation::retag -> with_tags_and_extra 2019-09-17 09:29:06 +02:00
Ralf Jung
daafeb35b7 document Miri error categories 2019-09-17 08:58:51 +02:00
Mazdak Farrokhzad
45baedb14b
Rollup merge of #64116 - ZeGentzy:patch-1, r=oli-obk
Fix minor typo in docs.

This comment is prolly refering to the comment in [const_eval_raw_provider](https://github.com/rust-lang/rust/pull/64116/files#diff-e0b58bb6712edaa8595ad7237542c958R616), not itself.
2019-09-14 16:42:20 +02:00
Hal Gentz
094af9743b
Update value.rs 2019-09-13 20:37:38 -06:00
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
Hal Gentz
7589d3a400
Update other doc.
Value was renamed to Operand in ad2de8b4ee
ScalarPair to Slice in fe50b4eb1d

Not familiar enough with rustc's source to know if the comment is even still applicable.
2019-09-03 01:54:48 -06: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