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
Oliver Schneider
9377041de9
Sanity-check all constants
2018-07-29 20:22:15 +02:00
Oliver Schneider
ef5fba0067
Hide some lints which are not quite right the way they are reported to the user
2018-07-25 13:05:05 +02:00
Oliver Schneider
de511438cd
Promoteds are statics and statics have a place, not just a value
2018-07-23 09:51:30 +02:00
Oliver Schneider
9329957d32
Const-propagate casts
2018-07-18 18:52:43 +02:00
Oliver Schneider
4d473300a2
Turn the use of erroneous constants into errors again
2018-06-28 11:04:26 +02:00
Oliver Schneider
4eea1a4e5e
Don't const propagate the body of constants
2018-06-28 11:04:25 +02:00
Oliver Schneider
4bb9648b27
Merge ConstVal
and ConstValue
2018-06-28 11:04:25 +02:00
Oliver Schneider
05994779ea
Move everything over from middle::const_val
to mir::interpret
2018-06-28 11:02:31 +02:00
Oliver Schneider
6005b0ad2f
Move the Lrc outside the error type and name the fields
2018-06-28 11:01:35 +02:00
Oliver Schneider
6f8fe4eaef
Eliminate old CTFE's ErrKind
2018-06-28 11:01:35 +02:00
Oliver Schneider
8a74be6684
Add source information the const propagation of places
2018-06-05 20:49:47 +02:00
Oliver Schneider
5c0d1355f2
Refactor the const eval diagnostic API
2018-06-05 20:49:46 +02:00
Fabian Zaiser
589f9a87a8
Propagate uses of constants correctly so that array index checks work
2018-06-05 10:35:44 +02:00
Oliver Schneider
f7eedfab8e
Simplify value field access
2018-06-04 14:50:29 +02:00
Oliver Schneider
47f37d67f1
Correctly access ScalarPair fields during const eval
2018-06-02 23:34:25 +02:00
Eduard-Mihai Burtescu
ca1ac6b6fb
rustc: rename mir::SourceScopeInfo to mir::SourceScopeLocalData.
2018-05-30 20:30:09 +03:00
Eduard-Mihai Burtescu
85d44c4276
rustc: rename mir::VisibilityScope to mir::SourceScope.
2018-05-30 20:30:09 +03:00
Oliver Schneider
cc60a22b10
Get rid of scalar_size
2018-05-24 20:49:37 +02:00
Oliver Schneider
f82256e473
primval -> scalar rename
2018-05-24 20:49:37 +02:00
Oliver Schneider
64a75ecc80
change Value::Bytes
to Value::Bits
2018-05-24 20:49:37 +02:00
Oliver Schneider
ef2177cffc
Rename ByVal(Pair) to Scalar(Pair)
2018-05-24 20:47:35 +02:00
Oliver Schneider
1606e137e7
Rename PrimVal to Scalar
2018-05-24 20:47:35 +02:00
varkor
15d2759d90
Rename has_type_parameters
to requires_monomorphization
2018-05-15 14:20:19 +01:00
varkor
a9622dc5c6
Fix generics type parameter handling in miri
2018-05-15 14:20:19 +01:00
John Kåre Alsaker
fdd9787777
Introduce ConstValue and use it instead of miri's Value for constant values
2018-05-11 13:01:44 +02:00
Oliver Schneider
01158eaec6
Unify MIR assert messages and const eval errors
2018-04-30 18:29:15 +02:00
Oliver Schneider
cefcf0548e
Merge ConstMathError into EvalErrorKind
2018-04-30 18:18:33 +02:00
Irina Popa
7a5147616b
rustc_target: move LayoutOf's type parameter to an associated type.
2018-04-26 16:50:28 +03:00
Oliver Schneider
a406af885d
Only warn on erroneous promoted constants
2018-04-15 15:08:37 +02:00
Oliver Schneider
c0fc6a8b6b
simplify constant value pair field access
2018-03-08 08:35:39 +01:00
Oliver Schneider
b5ace9a906
Unify the const folding errors
...
before they differed depending on whether optimizations were on or not
2018-03-08 08:35:39 +01:00
Oliver Schneider
3dc7e93db6
Generator assertions are unconditionally triggered
2018-03-08 08:35:38 +01:00
Oliver Schneider
df283df887
Don't use the undefined bytes of PrimVal::Bytes
2018-03-08 08:34:18 +01:00
Oliver Schneider
5b698a1040
Unregress error spans in constant errors
2018-03-08 08:34:17 +01:00
Oliver Schneider
3c663d0607
Tidy fix
2018-03-08 08:34:16 +01:00
Oliver Schneider
8c53d54b98
Update tests
2018-03-08 08:34:16 +01:00
Oliver Schneider
d2f363ba89
Report all errors other than those about insufficient type information
2018-03-08 08:34:15 +01:00
Oliver Schneider
64fbf5d5ad
Compute the ParamEnv only once and use it to call tcx.const_eval
2018-03-08 08:34:15 +01:00
Oliver Schneider
dde68dcfe5
Can only const prop temporaries
...
Variables might error in branches that are not reachable due to the variable value.
2018-03-08 08:34:15 +01:00
Oliver Schneider
1561b4ad50
Simplify const propagator by removing unused code paths
2018-03-08 08:34:15 +01:00
Oliver Schneider
411fcf58fd
Rename OptimizationFinder and don't propagate any borrows
2018-03-08 08:34:15 +01:00
Oliver Schneider
57ae890265
Simplify const prop checks through PlaceContext
2018-03-08 08:34:15 +01:00
Oliver Schneider
0462d092d2
Figure out const propgatable locals in a single pass
2018-03-08 08:34:14 +01:00
Oliver Schneider
ceb634a732
Update tests
2018-03-08 08:34:14 +01:00