Commit Graph

1786 Commits

Author SHA1 Message Date
Andrew Cann
9b15ddb29e remove defaulting to unit
Types will no longer default to `()`, instead always defaulting to `!`.
This disables the associated warning and removes the flag from TyTuple
2018-03-14 12:44:51 +08:00
Niko Matsakis
6288faa3a3 trans_apply_param_substs => subst_and_normalize_erasing_regions
Consolidate `trans_apply_param_substs` and
`trans_apply_param_substs_env`. Also remove `trans_impl_self_ty`
2018-03-13 11:22:08 -04:00
Niko Matsakis
e4728e494e transition various normalization functions to the new methods
In particular:

- `fully_normalize_monormophic_ty` => `normalize_erasing_regions`
- `normalize_associated_type_in_env` => `normalize_erasing_regions`
- `fully_normalize_associated_types_in` => `normalize_erasing_regions`
- `erase_late_bound_regions_and_normalize` => `normalize_erasing_late_bound_regions`
2018-03-13 11:22:07 -04:00
Niko Matsakis
ca87d24467 introduce infcx.at(..).dropck_outlives(..) operaton [VIC]
Backed by a canonicalized query. This computes all the types/regions that need
to be live when the destructor runs (i.e., that the dtor may access).
2018-03-13 11:22:07 -04:00
Niko Matsakis
3a50b41da4 introduce infcx.at(..).normalize(..) operation [VIC]
It is backed by the new `normalize_projection_ty` query, which uses
canonicalization.
2018-03-13 11:22:05 -04:00
Oliver Schneider
0d88db1693
Reuse the query caching infrastructure for const eval 2018-03-13 16:21:54 +01:00
Niko Matsakis
993c1488cc add canonicalize method to InferCtxt [VIC] 2018-03-13 11:21:31 -04:00
Niko Matsakis
6d0f9319df refactor ParamEnv::empty(Reveal) into two distinct methods
- `ParamEnv::empty()` -- does not reveal all, good for typeck
- `ParamEnv::reveal_all()` -- does, good for trans
- `param_env.with_reveal_all()` -- converts an existing parameter environment
2018-03-13 11:21:30 -04:00
Niko Matsakis
652b3b71f3 random reformatting 2018-03-13 11:21:30 -04:00
bobtwinkles
9a5d61a840 Remove some commented out code
Left over from prior experimentation, no longer required.
2018-03-09 19:02:22 -05:00
bobtwinkles
2ed0f516dd Check for two_phase_borrows in the right place
Fix a small compilation issue after I missed a critical change after rebasing
yesterday (ref c933440)
2018-03-09 13:54:26 -05:00
bobtwinkles
03f198fcee Fix tests after two-phase borrow rewrite 2018-03-09 13:54:26 -05:00
bobtwinkles
e4e377f6e8 Remove unused field on BorrowData 2018-03-09 13:53:35 -05:00
bobtwinkles
47d75afd11 Complete re-implementation of 2-phase borrows
See #48431 for discussion as to why this was necessary and what we hoped to
accomplish. A brief summary:
   - the first implementation of 2-phase borrows was hard to limit in the way we
   wanted. That is, it was too good at accepting all 2-phase borrows rather than
   just autorefs =)
   - Numerous diagnostic regressions were introduced by 2-phase borrow support
   which were difficult to fix
2018-03-09 13:53:35 -05:00
bobtwinkles
047bec69b9 mir dataflow: change graphviz output
The new output format is perhaps a little more readable. As a bonus, we get
labels on the outgoing edges to more easily corroborate the dataflow with the
plain MIR graphviz output.
2018-03-09 13:53:35 -05:00
bobtwinkles
138365368a Finally start down the right path 2018-03-09 13:53:35 -05:00
bobtwinkles
580467d306 Rename BorrowData::location to BorrowData::reserve_location
in preparation for rewritting two phase borrow support
2018-03-09 13:51:39 -05:00
Manish Goregaokar
d7f44ac52c
Rollup merge of #48682 - spastorino:make_causal_lazy, r=nikomatsakis
[NLL] Make causal tracking lazy

Close #46590

cc @nikomatsakis
2018-03-08 11:25:56 -08: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
edc5f73433
Correct the shift overflow check in miri 2018-03-08 08:35:39 +01:00
Oliver Schneider
aedd4c61ea
Regenerate tests 2018-03-08 08:35:38 +01:00
Oliver Schneider
6cfda078bf
Use clearer name for integer bit width helper function 2018-03-08 08:35:38 +01:00
Oliver Schneider
eb18d39a04
Reuse Integer::from_attr 2018-03-08 08:35:38 +01:00
Oliver Schneider
3dc7e93db6
Generator assertions are unconditionally triggered 2018-03-08 08:35:38 +01:00
Oliver Schneider
47913ee8f4
Address review comments 2018-03-08 08:35:38 +01:00
Oliver Schneider
e8d357f070
Decide signdedness on the layout instead of the type 2018-03-08 08:35:37 +01:00
Oliver Schneider
df283df887
Don't use the undefined bytes of PrimVal::Bytes 2018-03-08 08:34:18 +01:00
Oliver Schneider
7218836500
Fix mozjs crater failure 2018-03-08 08:34:18 +01:00
Oliver Schneider
134c2910ec
Const eval will oom together with rustc now 2018-03-08 08:34:18 +01:00
Oliver Schneider
0ca4b45a0c
Step limit is now terminator limit 2018-03-08 08:34:17 +01:00
Oliver Schneider
d98a2b90b2
Rebase fallout 2018-03-08 08:34:17 +01:00
Oliver Schneider
2f0e077300
Report tcx errors with the span of the currently evaluating statement 2018-03-08 08:34:17 +01:00
Oliver Schneider
1e653aa96b
Report a best guess span if no stack is available anymore 2018-03-08 08:34:17 +01:00
Oliver Schneider
5b698a1040
Unregress error spans in constant errors 2018-03-08 08:34:17 +01:00
Oliver Schneider
f5cc5ca8c7
Remove dead code 2018-03-08 08:34:16 +01:00
Oliver Schneider
1f9d846a58
Add some documentation to pattern/const conversions 2018-03-08 08:34:16 +01:00
Oliver Schneider
b985399831
Reduce code duplication 2018-03-08 08:34:16 +01:00
Oliver Schneider
3c663d0607
Tidy fix 2018-03-08 08:34:16 +01:00
Oliver Schneider
8500c2fab2
Const eval error refactoring 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
65ed591197
Move the resource limits to the session in preparation for attributes configuring them 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
Oliver Schneider
600fcc7159
Report const eval errors at the correct span 2018-03-08 08:34:14 +01:00
Oliver Schneider
13c0dc56df
Only report bitshift lints on bitshift ops 2018-03-08 08:34:14 +01:00
Oliver Schneider
929a4cece5
Use IndexVec instead of FxHashMap 2018-03-08 08:34:14 +01:00
Oliver Schneider
8c8a433532
Merge const linting pass into const prop 2018-03-08 08:34:14 +01:00
Oliver Schneider
c568807989
Remove single field struct by just using the field 2018-03-08 08:34:13 +01:00
Oliver Schneider
4667346042
Remove the fragile const propagator and just do linting 2018-03-08 08:34:13 +01:00
Oliver Schneider
21554b96af
Fix ICE in const prop 2018-03-08 08:34:13 +01:00
Oliver Schneider
00c95b29bc
Revert all changes to the instcombine pass 2018-03-08 08:34:13 +01:00
Oliver Schneider
54615ec989
Split const prop into its own pass 2018-03-08 08:34:12 +01:00
Oliver Schneider
edb2af58e4
Don't use scary block reorderings 2018-03-08 08:34:12 +01:00
Oliver Schneider
5b247b9bbe
Report errors in statics during collecting instead of translating 2018-03-08 08:34:12 +01:00
Oliver Schneider
5125d58fcf
Simplify code around reading/writing ConstVals 2018-03-08 08:34:12 +01:00
Oliver Schneider
ef995bde50
Move the pattern checking code to hair 2018-03-08 08:34:11 +01:00
Oliver Schneider
bb81f9bdec
only export the two check* functions from check_match 2018-03-08 08:34:11 +01:00
Oliver Schneider
1543367624
The const_eval module is no more 2018-03-08 08:34:11 +01:00
Oliver Schneider
57f9e0e468
Move lit_to_const to pattern and remove the now-empty eval module 2018-03-08 08:34:11 +01:00
Oliver Schneider
b38e8af5eb
Remove unused function 2018-03-08 08:34:11 +01:00
Oliver Schneider
0e2da01b91
Move compare_const_vals out of eval 2018-03-08 08:34:11 +01:00
Oliver Schneider
b75a828e2b
Reduce noise in error reporting 2018-03-08 08:34:11 +01:00
Oliver Schneider
8a93972ba9
Use Mutability enum instead of bool 2018-03-08 08:34:11 +01:00
Oliver Schneider
9857eaa4df
Nuke ConstInt and Const*size 2018-03-08 08:34:10 +01:00
Oliver Schneider
3b8d2e0016
Rename ConstVal::to_u128 to to_raw_bits 2018-03-08 08:34:10 +01:00
Oliver Schneider
2f2c90e733
Destructure Rc wrapped ErrorKind in miri 2018-03-08 08:34:10 +01:00
Oliver Schneider
3d8c4d4fe9
Don't read from zero sized fields 2018-03-08 08:34:09 +01:00
Oliver Schneider
d26ebec81c
Hide the RefCell inside InterpretInterner
It was too easy to get this wrong
2018-03-08 08:34:09 +01:00
Oliver Schneider
37d8b9a86c
Don't borrow the interpret_interner for anything but a direct function call 2018-03-08 08:34:09 +01:00
Oliver Schneider
34772aad63
Allow writing mutable statics in miri by adding them to the Machine 2018-03-08 08:34:09 +01:00
Oliver Schneider
d3e2f48c8c
More const eval sanity checks (invalid slice fat pointers) 2018-03-08 08:34:08 +01:00
Oliver Schneider
f14e746b2f
Enable const prop to also evaluate constants, not just literals 2018-03-08 08:34:08 +01:00
Oliver Schneider
4caf6a92f3
Additional sanity assertion 2018-03-08 08:34:08 +01:00
Oliver Schneider
9d9a69d7fa
Print whether the stackframe is for a promoted 2018-03-08 08:34:08 +01:00
Oliver Schneider
7d2d4e3202
Add InterpretInterner to StableHashingContext for AllocId serialization 2018-03-08 08:34:08 +01:00
Oliver Schneider
246d05b624
Evaluate 128 lowering lang items manually 2018-03-08 08:34:07 +01:00
Oliver Schneider
b33e4e784e
Fully use miri in trans 2018-03-08 08:34:05 +01:00
Alexander Regueiro
b2b101befc
Prepare for using miri in trans 2018-03-08 08:09:01 +01:00
Oliver Schneider
28572d2c1f
Nuke the entire ctfe from orbit, it's the only way to be sure 2018-03-08 08:08:14 +01:00
Oliver Schneider
0b9db5716f
Resolve variant field access 2018-03-08 08:08:14 +01:00
Oliver Schneider
e97089dae3
Move librustc_const_eval to librustc_mir 2018-03-08 08:08:14 +01:00
Oliver Schneider
918b6d7633
Produce instead of pointers 2018-03-08 08:08:14 +01:00
Oliver Schneider
38b5ddd39b
Add a variant to ConstVal for storing miri results 2018-03-08 08:06:07 +01:00
Alex Crichton
b5bcb9a410 Merge branch 'incr_attr_queries' of https://github.com/wesleywiser/rust into update-cargo 2018-03-07 07:13:21 -08:00
Alex Crichton
62c8e255d1 Rollup merge of #48651 - PramodBisht:issues/48425, r=oli-obk
Fixed #48425 : Various functions taking a `TyCtxt` and a `Span` should be taking a `TyCtxtAt`

Hi @oli-obk
I have done some code refactoring to fix #48425, Please let me know if anything else is required on this.
2018-03-07 07:09:52 -08:00
Wesley Wiser
368e586a3d Add linkage to TransFnAttrs
Part of #47320
2018-03-06 20:19:39 -05:00
Wesley Wiser
39f9d23b65 Add flag for rustc_std_internal_symbol attribute
Part of #47320
2018-03-06 20:18:51 -05:00
Wesley Wiser
97b30f0961 Replace attr::contains_name(..., "cold")
Part of #47320
2018-03-06 19:58:02 -05:00
Wesley Wiser
4f840a683a Add inline to TransFnAttrs
Part of #47320
2018-03-06 19:58:02 -05:00
Santiago Pastorino
52a47d4c02
Run rustfmt over modified files 2018-03-06 18:03:09 -03:00
Santiago Pastorino
4b12ded889
mir is already a reference 2018-03-06 18:03:09 -03:00
Santiago Pastorino
c85c5a0423
Make causal tracking lazy 2018-03-06 18:03:05 -03:00
bors
2789b067da Auto merge of #48768 - kennytm:rollup, r=kennytm
Rollup of 14 pull requests

- Successful merges: #48403, #48432, #48546, #48573, #48590, #48657, #48727, #48732, #48753, #48754, #48761, #48474, #48507, #47463
- Failed merges:
2018-03-06 15:01:21 +00:00