Commit graph

187 commits

Author SHA1 Message Date
Ralf Jung
7677d1f771 const_prop: only call error_to_const_error if we are actually showing something 2019-08-27 22:18:25 +02:00
Wesley Wiser
f13faf58d9 Remove eval_promoted const-prop hack 2019-08-22 06:36:30 -04:00
Wesley Wiser
73814654b2 Move promoted out of mir::Body 2019-08-22 06:36:30 -04:00
Ralf Jung
3edf099266 make both unary_op and binary_op fully typed, including a return type 2019-08-17 12:56:44 +02:00
Mazdak Farrokhzad
dda33cad38
Rollup merge of #62760 - chansuke:dedupe-error-messages, r=zackmdavis
Deduplicate error messages in `librsctc_mir`

Deduplicated the error messages in `librustc_mir`. #62022
2019-08-14 04:18:35 +02: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
bors
a457433456 Auto merge of #63234 - Centril:rollup-h9t731z, r=Centril
Rollup of 5 pull requests

Successful merges:

 - #62954 (Fix typo in Delimited::open_tt)
 - #63146 (Cleanup syntax::attr)
 - #63218 (rustbuild: RISC-V is no longer an experimental LLVM target)
 - #63227 (dead_code: Properly inspect fields in struct patterns with type relative paths)
 - #63229 (A bit of Miri error cleanup)

Failed merges:

r? @ghost
2019-08-03 12:20:42 +00: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
e590b849b8 CTFE: simplify Value type by not checking for alignment 2019-08-02 23:02:53 +02:00
Ralf Jung
7885fac7e9 improve error when CTFE does ptr-int-cast; update tests 2019-08-02 23:01:53 +02:00
Ralf Jung
48b87c6f27 operator: implement binary_op strictly by first checking the type, then dispatching further; call ptr_op machine hook only for pointer types 2019-08-02 22:33:36 +02:00
Saleem Jaffer
152f0d347e code review fixes 2019-07-31 12:48:54 +05:30
chansuke
a1df1329ce Deduplicate some error messages 2019-07-31 00:43:08 +09:00
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
5bb06b3acb code review fixes 2019-07-29 20:26:25 +05:30
Saleem Jaffer
9f8b099846 code review fixes 2019-07-29 20:17:52 +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
307798aa38 fixing fallout due to InterpError refactor 2019-07-29 13:35:09 +05:30
bors
d36b7f6944 Auto merge of #62322 - wesleywiser:promoted_query, r=oli-obk
Add a query to get the `promoted`s for a `mir::Body`

This is a builidng block toward removing a lot of duplicated code
between miri and the cosnt-propagator pass.

See this thread for more info:
https://rust-lang.zulipchat.com/#narrow/stream/189540-t-compiler.2Fwg-mir-opt/topic/Using.20.60InterpCx.60.20more/near/169030661

r? @spastorino but feel free to hand it off to somebody else
2019-07-16 12:19:35 +00:00
Ralf Jung
1938edb4d9 remove some no-longer-needed methods 2019-07-06 12:59:11 +02:00
Ralf Jung
9007296a20 Add check_mplace_ptr convenience method; provide ptr-normalization methods 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.
2019-07-06 12:46:08 +02:00
Mazdak Farrokhzad
0383be8577
Rollup merge of #62264 - RalfJung:inline-forcing, r=zackmdavis
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
2019-07-06 02:37:58 +02:00
Mazdak Farrokhzad
182248a466
Rollup merge of #62245 - RalfJung:miri-extra-fn, r=eddyb,zackmdavis
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
2019-07-06 02:37:54 +02:00
Ralf Jung
317c6ac129 use get_size_and_align to test if an allocation is live 2019-07-04 10:45:31 +02:00
Ralf Jung
5612feb513 add machine hook to handle calls to 'extra' function values 2019-07-04 10:38:54 +02:00
Ralf Jung
1297a274a3 Add basic support for "other" kinds of values for function pointers, determined by the machine instance.
So far, however, calling such a function will fail.
2019-07-04 10:38:54 +02:00
Ralf Jung
127610b7c4 Go back to just passing MemoryExtra to the machine-level allocation hooks
This is needed to avoid doing unnecessary global alloc_map lookups
2019-07-04 10:31:13 +02:00
Ralf Jung
8ad28cd2cb Machine: make self-like parameters come first 2019-07-04 10:10:08 +02:00
Christian Poveda
e45bbaf48c Fix merge conflicts 2019-07-04 01:45:29 -05:00
Wesley Wiser
57c98d3392 Add a query to get the promoteds for a mir::Body
This is a builidng block toward removing a lot of duplicated code
between miri and the cosnt-propagator pass.

See this thread for more info:
https://rust-lang.zulipchat.com/#narrow/stream/189540-t-compiler.2Fwg-mir-opt/topic/Using.20.60InterpCx.60.20more/near/169030661
2019-07-02 20:52:58 -04:00
Christian Poveda
e32b8eb00a Remove default bound for Machine::MemoryExtra 2019-06-29 09:29:56 -05:00
Christian Poveda
e475539096 Add MemoryExtra in InterpretCx constructor params 2019-06-29 09:29:56 -05:00
Ralf Jung
fc918a395a rename InterpretCx -> InterpCx
That's more consistent with InterpResult and InterpError.
2019-06-27 13:23:34 +02:00
Mazdak Farrokhzad
c5e6069194
Rollup merge of #62055 - matthewjasper:fix-error-counting, r=pnkfelix
Fix error counting

Count duplicate errors for `track_errors` and other error counting checks.
Add FIXMEs to make it clear that we should be moving away from this kind of logic.

Closes #61663
2019-06-25 17:15:31 +02:00
Matthew Jasper
95a32157af Count all errors for track_errors 2019-06-22 15:36:24 +01:00
bors
38cd9489f7 Auto merge of #61959 - oli-obk:const_field_ice, r=eddyb
Fix a hash collision issue on the `const_field` query

fixes #61530
2019-06-21 10:16:14 +00:00
Christian Poveda
e152c38f65 Fix merge issues 2019-06-20 17:01:48 -05:00
Christian Poveda
752a1a4668 Updated tag methods for consistency 2019-06-20 16:52:17 -05:00
Oliver Scherer
811b996e58 Change ByRef to a struct variant to clarify its fields via names 2019-06-19 19:43:13 +02:00
Oliver Scherer
23a1ebb3fc Remove the AllocId from ByRef values
`ByRef` const values have no identity beyond their value, we should not treat them as having identity. The `AllocId` often differed between equal constants, because of the way that the miri-engine evaluates constants.
2019-06-19 15:58:51 +02:00
Oliver Scherer
fb37bf0037 Weave the alignment through ByRef 2019-06-19 09:53:32 +02:00
Oliver Scherer
921f0d9ca9 Outright ignore any alignment in const_field 2019-06-19 09:52:36 +02:00
Oliver Scherer
13f35de19d Elaborate on a comment 2019-06-19 09:52:35 +02:00
Oliver Scherer
870a6dc230 Don't ICE when pattern matching packed structs 2019-06-19 09:52:35 +02:00
Oliver Scherer
4b6f3868b3 Make interning explicitly care about types and the mutability of memory 2019-06-19 09:52:35 +02:00
Eduard-Mihai Burtescu
f3f9d6dfd9 Unify all uses of 'gcx and 'tcx. 2019-06-14 18:58:23 +03:00
Eduard-Mihai Burtescu
fff08cb043 Run rustfmt --file-lines ... for changes from previous commits. 2019-06-12 13:38:28 +03:00
Eduard-Mihai Burtescu
17cdd356da rustc: replace TyCtxt<'tcx, 'gcx, 'tcx> with TyCtxt<'gcx, 'tcx>. 2019-06-12 13:38:27 +03:00