954 Commits

Author SHA1 Message Date
Ariel Ben-Yehuda
ce0ca76380 pacify the merciless tidy 2017-08-01 11:57:26 +03:00
Ralf Jung
584d823bf2 Handle closures. Add some more tests. 2017-07-31 20:00:20 -07:00
Ralf Jung
e73d3145f5 fix AddValidation on methods 2017-07-31 18:33:45 -07:00
Ralf Jung
26ca0d1b3a tidy 2017-07-31 16:15:37 -07:00
Ralf Jung
5e426e1068 optionally only emit basic validation for functions containing unsafe block / unsafe function 2017-07-31 15:46:36 -07:00
Ariel Ben-Yehuda
5b99523de9 rustc_mir::transform::simplify - remove nops first
Removing nops can allow more basic blocks to be merged, but merging
basic blocks can't allow for more nops to be removed, so we should
remove nops first.

This doesn't matter *that* much, because normally we run SimplifyCfg
several times, but there's no reason not to do it.
2017-08-01 00:12:31 +03:00
Ariel Ben-Yehuda
85c102757a rustc_mir: don't build unused unwind cleanup blocks
The unused blocks are removed by SimplifyCfg, but they can cause a
significant performance slowdown before they are removed.
2017-08-01 00:12:30 +03:00
Ariel Ben-Yehuda
1447daa01d remove the span field from diverge_cleanup 2017-08-01 00:12:30 +03:00
Ralf Jung
6135461f9a CleanEndRegions: use default impl where possible 2017-07-31 13:21:10 -07:00
Paul Faria
5b2f6c7302 Consume MirVisitor changes and use more accurate spans for region renumbering 2017-07-30 16:01:02 -04:00
Ralf Jung
6641415e87 do not use doc comments inside functions 2017-07-30 10:29:15 -07:00
Paul Faria
d2fc06e7f6 Renumber regions as the first step of the non-lexical lifetimes inference 2017-07-30 12:09:35 -04:00
Ralf Jung
7ec50dfee3 also release/validate around non-Misc casts 2017-07-30 01:11:59 -07:00
Ralf Jung
b934506e68 Reorder passes so that AddValidation can run after ElaborateDrops 2017-07-30 01:11:59 -07:00
Ralf Jung
04f962adc3 after a Ref, only acquire the Deref'd destination 2017-07-30 01:11:59 -07:00
Ralf Jung
b6816b2b56 please the tidy 2017-07-30 01:11:59 -07:00
Ralf Jung
23cd90ed41 add -Z flag for AddValidation pass 2017-07-30 01:11:59 -07:00
Ralf Jung
e869cf2be7 make ValidationOperand generic so that we can reuse it in miri with a different Lvalue type 2017-07-30 01:11:59 -07:00
Ralf Jung
60096b9e82 when suspending, we need to specify for which lifetime to recover
This matters if the lvalues that is suspended involves Deref'ing a reference --
that reference's lifetime will then not be in the type any more
2017-07-30 01:11:59 -07:00
Ralf Jung
511b88cdce only emit Suspend validation for mutable paths 2017-07-30 01:11:59 -07:00
Ralf Jung
24a2ac9e46 add_validation: handle drop 2017-07-30 01:11:59 -07:00
Ralf Jung
82786b2fe1 emit validation for function calls and Ref 2017-07-30 01:11:59 -07:00
Ralf Jung
33585f4fe1 CleanEndRegions: do not clean regions that occur in types in validation statements 2017-07-30 01:11:59 -07:00
Ralf Jung
735ace977c add a pass for validation commands; for now just emit the initial AcquireValid 2017-07-30 01:11:59 -07:00
Ralf Jung
5264103de4 add new instructions for asserting when values are valid, and to describe when we can rely on them being locked in memory 2017-07-30 01:11:59 -07:00
Mark Simulacrum
5b85f650cf Rollup merge of #43512 - arielb1:untyped-move-paths, r=eddyb
erase types in the move-path abstract domain

Leaving types unerased would lead to 2 types with a different "name"
getting different move-paths, which would cause major brokenness (see
e.g. #42903).

This does not fix any *known* issue, but is required if we want to use
abs_domain with non-erased regions (because the same can easily
have different names). cc @RalfJung.

r? @eddyb
2017-07-29 18:03:54 -06:00
Alex Crichton
9285a61413 Remove IsGenerator in favor of a boolean
No need to be mixed!
2017-07-28 13:24:28 -07:00
Alex Crichton
06ce77cb39 Merge remote-tracking branch 'origin/master' into gen 2017-07-28 13:07:15 -07:00
John Kåre Alsaker
416096d0fd Update comment 2017-07-28 15:47:55 +02:00
John Kåre Alsaker
0a8b81a568 Ignore drop check bools when testing for legal generator types 2017-07-28 15:46:27 +02:00
John Kåre Alsaker
14c747678e Fix a string literal 2017-07-28 15:46:27 +02:00
John Kåre Alsaker
cbdb18650e Add some comments 2017-07-28 15:46:26 +02:00
Alex Crichton
09a5d319ab Remove support for gen arg 2017-07-28 15:46:26 +02:00
John Kåre Alsaker
93172045c8 Fix a bug with yielding subtypes of the yield type. 2017-07-28 15:46:25 +02:00
John Kåre Alsaker
21f2d259e0 Consider StorageDead and StorageLive as gens for liveness analysis 2017-07-28 15:46:24 +02:00
John Kåre Alsaker
df608e710c Rename suspend to yield 2017-07-28 15:46:24 +02:00
John Kåre Alsaker
075fd364d0 Ensure upvars are dropped when generators have never been resumed 2017-07-28 15:46:23 +02:00
Alex Crichton
17c749f3ee Fix tidy warnings 2017-07-28 15:46:23 +02:00
John Kåre Alsaker
d861982ca6 Generator literal support 2017-07-28 15:46:23 +02:00
bors
e2b5d7e6b3 Auto merge of #43324 - Nashenas88:visit_locations, r=arielb1
Provide positional information when visiting ty, substs and closure_substs in MIR

This will enable the region renumbering portion of #43234 (non-lexical lifetimes). @nikomatsakis's current plan [here](https://gist.github.com/nikomatsakis/dfc27b28cd024eb25054b52bb11082f2) shows that we need spans of the original code to create new region variables, e.g. `self.infcx.next_region_var(infer::MiscVariable(span))`. The current visitor impls did not pass positional information (`Location` in some, `Span` and `SourceInfo` for others) for all types. I did not expand this to all visits, just the ones necessary for the above-mentioned plan.
2017-07-28 12:55:12 +00:00
bors
7167843748 Auto merge of #43505 - eddyb:poly-const-eval-layout-of, r=nikomatsakis
rustc_const_eval: always require Substs and a ParamEnv.

Fixes #43357 by tracking the `Substs` and `ParamEnv` for const-evaluation in generic contexts.
2017-07-28 08:01:02 +00:00
Paul Faria
4b9acad7c6 Squash Span into SourceInfo and rename enum and its inner types 2017-07-27 19:43:05 -04:00
Ariel Ben-Yehuda
e268ddf52d erase types in the move-path abstract domain
Leaving types unerased would lead to 2 types with a different "name"
getting different move-paths, which would cause major brokenness (see
e.g. #42903).

This does not fix any *known* issue, but is required if we want to use
abs_domain with non-erased regions (because the same can easily
have different names). cc @RalfJung.
2017-07-27 23:14:41 +03:00
Eduard-Mihai Burtescu
60cf5428b3 rustc_const_eval: keep track of the appropriate ParamEnv. 2017-07-27 20:59:40 +03:00
Eduard-Mihai Burtescu
4c900c5248 rustc_const_eval: always require correct Substs. 2017-07-27 12:22:26 +03:00
Mark Simulacrum
b5b7266b78 Rollup merge of #42959 - SimonSapin:nonzero-checked, r=sfackler
Make the "main" constructors of NonZero/Shared/Unique return Option

Per discussion in https://github.com/rust-lang/rust/issues/27730#issuecomment-303939441.

This is a breaking change to unstable APIs.

The old behavior is still available under the name `new_unchecked`. Note that only that one can be `const fn`, since `if` is currently not allowed in constant contexts.

In the case of `NonZero` this requires adding a new `is_zero` method to the `Zeroable` trait. I mildly dislike this, but it’s not much worse than having a `Zeroable` trait in the first place. `Zeroable` and `NonZero` are both unstable, this can be reworked later.
2017-07-26 06:15:01 -06:00
Alex Crichton
9010567dcc Bump master to 1.21.0
This commit bumps the master branch's version to 1.21.0 and also updates the
bootstrap compiler from the freshly minted beta release.
2017-07-25 07:03:19 -07:00
Bruce Mitchener
539df8121b Fix some doc/comment typos. 2017-07-23 22:48:01 +07:00
Simon Sapin
06e130fb24 Use checked NonZero constructor in MIR move path indices
… to protect against UB in the unlikely case that `idx + 1` overflows.
2017-07-22 20:38:40 +02:00
Simon Sapin
0a08ad0443 Rename {NonZero,Shared,Unique}::new to new_unchecked 2017-07-22 20:38:16 +02:00