Commit Graph

102 Commits

Author SHA1 Message Date
csmoe
cf11729787 rename Substs to InternalSubsts
Change-Id: I3fa00e999a2ee4eb72db1fdf53a8633b49176a18
2019-02-27 00:39:13 +08:00
bors
ea43c3c688 Auto merge of #58561 - ljedrz:HirIdify_some_nodes, r=Zoxc
Remove NodeId from some HIR nodes

The next iteration of https://github.com/rust-lang/rust/pull/57578.

Removes `NodeId` from:

- [x] `Lifetime`
- [x] `Ty`
- [x] `GenericParam`
- [x] `WhereClause`
- [x] `WhereEqPredicate`
- [x] `MacroDef`
- [x] `Block`
- [x] `Expr`

r? @Zoxc
2019-02-26 06:13:27 +00:00
ljedrz
021a140dcd hir: remove NodeId from Block 2019-02-24 17:09:26 +01:00
Oliver Scherer
4fdeb2da74 Add eval prefix to clarify what the function does 2019-02-16 14:56:07 +01:00
Oliver Scherer
235a6b7d06 Expose const -> op functions that don't allow violiting const eval invariants 2019-02-16 12:32:22 +01:00
Ralf Jung
b376ae6671 make bin_op and unary_op APIs consistently work on ImmTy 2019-02-13 10:14:56 +01:00
Ralf Jung
e73f96abe7 make OpTy.op private, and ImmTy.imm public instead 2019-02-13 10:14:56 +01:00
Ralf Jung
2708946787 pass full InstanceDef to run_passes 2019-02-09 12:11:12 +01:00
Taiki Endo
725af30809 librustc_mir => 2018 2019-02-08 06:28:15 +09:00
Oliver Scherer
f6da141b5f Span fixup 2019-01-22 17:22:30 +01:00
Oliver Scherer
a59eabbc36 Get rid of the fake stack frame 2019-01-22 17:22:29 +01:00
Oliver Scherer
089c4039c6 Pacify tidy 2019-01-01 20:05:02 +01:00
Oliver Scherer
bb9f717a80 const_to_op is now lazy_const_to_op 2019-01-01 20:05:02 +01:00
Oliver Scherer
b903cb9d60 Move the Unevaluated constant arm upwards in the type structure 2019-01-01 20:05:02 +01:00
Mark Rousskov
2a663555dd Remove licenses 2018-12-25 21:08:33 -07:00
Ralf Jung
81a45e2038 miri: allocation is infallible 2018-12-19 14:11:01 +01:00
Alexander Regueiro
ee89c088b0 Various minor/cosmetic improvements to code 2018-12-07 23:53:34 +00:00
John Kåre Alsaker
a70babed03 Use a function to access the Hir map to be able to turn it into a query later 2018-12-06 17:24:36 +01:00
bors
b51632e3f0 Auto merge of #56070 - oli-obk:const_let, r=eddyb
Allow assignments in const contexts

fixes https://github.com/rust-lang/rust/issues/54098
fixes https://github.com/rust-lang/rust/issues/51251
fixes https://github.com/rust-lang/rust/issues/52613
2018-11-26 08:17:36 +00:00
Ralf Jung
ba82f54b04 use RawConst in miri 2018-11-19 22:42:46 +01:00
Ralf Jung
b50c1b243e Make const_eval_raw query return just an AllocId 2018-11-19 22:42:46 +01:00
Oliver Scherer
59eff14120 Also catch static mutation at evaluation time 2018-11-19 16:46:03 +01:00
Oliver Scherer
df10965dc0 Prevent ICE in const-prop array oob check 2018-11-08 20:15:13 +01:00
Ralf Jung
c905497766 miri: binary_op_val -> binary_op_imm 2018-11-05 09:10:48 +01:00
Eduard-Mihai Burtescu
d00d42d079 rustc_target: pass contexts by reference, not value. 2018-11-04 20:33:57 +02:00
Oliver Scherer
e8a22b692a Rename Value to Immediate for miri 2018-11-02 16:56:59 +01:00
Ralf Jung
aaa505af02 remove some unused CTFE error variants 2018-10-28 11:33:33 +01:00
Ralf Jung
02a42382f6 rename env var to control ctfe backtraces, and make it usually show the backtrace delayed
The env var is now RUST_CTFE_BACKTRACE.  Similar to RUST_BACKTRACE, it usually
only prints a backtrace when the error actually surfaces, not when it happens.
This makes a difference when we catch errors.

As per @oli-obk's request, one can set RUST_CTFE_BACKTRACE=immediate to get the
backtrace shown immediately.
2018-10-28 11:33:27 +01:00
David Wood
6208bd8e03
Refactor and add PlaceContext::AscribeUserTy.
This commit refactors `PlaceContext` to split it into four different
smaller enums based on if the context represents a mutating use,
non-mutating use, maybe-mutating use or a non-use (this is based on the
recommendation from @oli-obk on Zulip[1]).

This commit then introduces a `PlaceContext::AscribeUserTy` variant.
`StatementKind::AscribeUserTy` is now correctly mapped to
`PlaceContext::AscribeUserTy` instead of `PlaceContext::Validate`.
`PlaceContext::AscribeUserTy` can also now be correctly categorized as a
non-use which fixes an issue with constant promotion in statics after a
cast introduces a `AscribeUserTy` statement.

[1]: https://rust-lang.zulipchat.com/#narrow/stream/122657-wg-nll/subject/.2355288.20cast.20fails.20to.20promote.20to.20'static/near/136536949
2018-10-27 12:11:37 +02:00
Oliver Schneider
b4ee38ede3 Don't extend hir::Def when there's already a dedicated "function-like" detector 2018-10-25 16:47:35 +02:00
Oliver Schneider
7fdf06cdde Report const eval error inside the query 2018-10-25 16:46:19 +02:00
Ralf Jung
616cb6356f miri engine: also check return type before calling function 2018-10-09 13:08:00 +02:00
Ralf Jung
d62aa3e085 move ScalarMaybeUndef into the miri engine 2018-09-30 13:09:26 +02:00
Ralf Jung
c16336a014 move loop detector constants to the module that uses them; make lifetime order in ConstPropagator consistent with Memory 2018-09-20 11:57:45 +02:00
Ralf Jung
018d128325 rename evaluator -> interpreter to make eddyb happy 2018-09-20 10:36:25 +02:00
Ralf Jung
169f7911e9 move CTFE engine snapshot state out of miri engine into CTFE machine instance 2018-09-20 10:12:21 +02:00
bors
968d95e940 Auto merge of #53903 - GabrielMajeri:opt-miri-array-slice, r=oli-obk
Optimize miri checking of integer array/slices

This pull request implements the optimization described in #53845 (the  `E-easy` part of that issue, not the refactoring). Instead of checking every element of an integral array, we can check the whole memory range at once.

r? @RalfJung
2018-09-08 17:36:09 +00:00
Gabriel Majeri
82cde902c5 Optimize miri checking of integer array/slices
Instead of checking every element, we can check the whole memory
range at once.
2018-09-08 07:13:19 +03:00
Niko Matsakis
5aee959e9f make field always private, add From impls 2018-09-07 11:37:46 -04:00
Ralf Jung
1d498d5a43 make ptr_op finally reponsible for all ops involving pointers; make ValTy constructor private
Also remove public OpTy constructors, but a pub(crate) constructor remains
2018-08-29 08:44:37 +02:00
Ralf Jung
ec056d5188 re-do argument passing one more time to finally be sane 2018-08-29 08:44:37 +02:00
Ralf Jung
506dd7058c fix const_prop detecting unary neg underflows 2018-08-28 19:57:05 +02:00
Ralf Jung
f96208ca5b address nits 2018-08-28 19:57:05 +02:00
Ralf Jung
035c69f658 switch validation to use operand, not mplace
this means we can get rid of the public allocate_op, and make OpTy only
constructible in librustc_mir
2018-08-27 18:12:49 +02:00
Oliver Schneider
bb78426ca8 Allow panicking with string literal messages inside constants 2018-08-22 18:28:57 +02:00
Ralf Jung
ad2de8b4ee miri/CTFE refactor
* Value gets renamed to Operand, so that now interpret::{Place, Operand} are the
  "dynamic" versions of mir::{Place, Operand}.
* Operand and Place share the data for their "stuff is in memory"-base in a new
  type, MemPlace.  This also makes it possible to give some more precise types
  in other areas.  Both Operand and MemPlace have methods available to project
  into fields (and other kinds of projections) without causing further
  allocations.
* The type for "a Scalar or a ScalarPair" is called Value, and again used to
  give some more precise types.
* All of these have versions with an attached layout, so that we can more often
  drag the layout along instead of recomputing it.  This lets us get rid of
  `PlaceExtra::Downcast`.  MPlaceTy and PlaceTy can only be constructed
  in place.rs, making sure the layout is handled properly.
  (The same should eventually be done for ValTy and OpTy.)
* All the high-level functions to write typed memory take a Place, and live in
  place.rs.  All the high-level typed functions to read typed memory take an
  Operand, and live in operands.rs.
2018-08-22 09:06:28 +02:00
Donato Sciarra
82607d2cf3 mv (mod) codemap source_map 2018-08-19 23:01:00 +02:00
Oliver Schneider
afcbc2e90f Remove an overly pedantic and wrong assertion 2018-08-07 18:37:50 +02:00
Oliver Schneider
c53aa2989a Address stylistic review comments and rebase fallout 2018-08-01 15:29:35 +02:00
Oliver Schneider
c6c06854c0 Reintroduce Undef and properly check constant value sizes 2018-08-01 15:29:35 +02:00