about summary refs log tree commit diff
path: root/src/librustc_mir/transform
AgeCommit message (Collapse)AuthorLines
2018-08-30Made std::intrinsics::transmute() const fn.thedarkula-0/+12
2018-08-29make ptr_op finally reponsible for all ops involving pointers; make ValTy ↵Ralf Jung-11/+17
constructor private Also remove public OpTy constructors, but a pub(crate) constructor remains
2018-08-29re-do argument passing one more time to finally be saneRalf Jung-1/+3
2018-08-29Auto merge of #53671 - RalfJung:miri-refactor, r=oli-obkbors-5/+18
Miri engine cleanup * Unify the two maps in memory to store the allocation and its kind together. * Share the handling of statics between CTFE and miri: The miri engine always uses "lazy" `AllocType::Static` when encountering a static. Acessing that static invokes CTFE (no matter the machine). The machine only has any influence when writing to a static, which CTFE outright rejects (but miri makes a copy-on-write). * Add an `AllocId` to by-ref consts so miri can use them as operands without making copies. * Move responsibilities around for the `eval_fn_call` machine hook: The hook just has to find the MIR (or entirely take care of everything); pushing the new stack frame is taken care of by the miri engine. * Expose the intrinsics and lang items implemented by CTFE so miri does not have to reimplement them. * Allow Machine to hook into foreign statics (used by miri to get rid of some other hacks). * Clean up function calling. * Switch const sanity check to work on operands, not mplaces. * Move const_eval out of rustc_mir::interpret, to make sure that it does not access private implementation details. In particular, we can finally make `eval_operand` take `&self`. :-) Should be merged after https://github.com/rust-lang/rust/pull/53609, across which I will rebase.
2018-08-28fix const_prop detecting unary neg underflowsRalf Jung-1/+15
2018-08-28address nitsRalf Jung-1/+1
2018-08-28Use FxHash{Map,Set} instead of the default Hash{Map,Set} everywhere in rustc.Eduard-Mihai Burtescu-12/+17
2018-08-28Auto merge of #53314 - nikomatsakis:nll-invert-liveness, r=pnkfelixbors-5/+1
NLL: experiment with inverting liveness I got inspired to see what would happen here. Fixes #52460 r? @pnkfelix
2018-08-27Rename hir::map::NodeKind to hir::Nodevarkor-5/+5
2018-08-27Remove path prefixes from NodeKindvarkor-1/+2
2018-08-27Rename hir::map::Node to hir::map::NodeKindvarkor-4/+4
2018-08-27kill dead code from `util/liveness`Niko Matsakis-5/+1
2018-08-27switch validation to use operand, not mplaceRalf Jung-3/+2
this means we can get rid of the public allocate_op, and make OpTy only constructible in librustc_mir
2018-08-27Auto merge of #53656 - nnethercote:HybridIdxSet-tweaks, r=nikomatsakisbors-2/+2
`HybridIdxSet` tweaks A couple of tweaks to `HybridIdxSet`. r? @nikomatsakis
2018-08-25Properly prevent the promotion of unstable const fnsOliver Schneider-3/+1
2018-08-24support user-given types in adtsNiko Matsakis-2/+2
2018-08-24add a `user_ty` annotation to `Constant`Niko Matsakis-1/+4
2018-08-24Introduce `UnionIntoIdxSet` and `SubtractFromIdxSet` traits.Nicholas Nethercote-2/+2
They let `union()`, `union_sparse()` and `union_hybrid()` be merged. Likewise for subtract()`, `subtract_sparse()` and `subtract_hybrid()`.
2018-08-23Auto merge of #53520 - nnethercote:merge-IdxSet-IdxSetBuf, r=nikomatsakisbors-16/+16
Merge `IdxSet` and `IdxSetBuf` Because it simplifies things. @r? nikomatsakis
2018-08-22Auto merge of #52011 - ↵bors-3/+25
oli-obk:dont_you_hate_it_too_when_everything_panics_constantly, r=eddyb Allow panicking with string literal messages inside constants r? @eddyb cc https://github.com/rust-lang/rust/issues/51999 we can't implement things like `panic!("foo: {}", x)` right now because we can't call trait methods (most notably `Display::fmt`) inside constants. Also most of these impls probably have loops and conditions, so it's messy anyway. But hey `panic!("foo")` works at least. cc @japaric got any test ideas for `#![no_std]`?
2018-08-22Allow panicking with string literal messages inside constantsOliver Schneider-3/+25
2018-08-22Remove Ty prefix from Ty{Bool|Char|Int|Uint|Float|Str}varkor-2/+2
2018-08-22Remove Ty prefix from ↵varkor-21/+21
Ty{Adt|Array|Slice|RawPtr|Ref|FnDef|FnPtr|Dynamic|Closure|Generator|GeneratorWitness|Never|Tuple|Projection|Anon|Infer|Error}
2018-08-22Rename ty::TyVariants to ty::TyKindvarkor-5/+5
2018-08-22Rename ty::Slice to ty::Listvarkor-2/+2
2018-08-22miri/CTFE refactorRalf Jung-47/+51
* 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-21Rollup merge of #53496 - matthiaskrgr:codespell_08_2018, r=varkorkennytm-10/+10
Fix typos found by codespell.
2018-08-20Remove IdxSet typedef and Rename {,Hybrid}IdxSetBuf as {,Hybrid}IdxSet.Nicholas Nethercote-16/+16
Now that the `Buf` vs. non-`Buf` distinction has been removed, it makes sense to drop the `Buf` suffix and use the shorter names everywhere.
2018-08-19mv codemap() source_map()Donato Sciarra-2/+2
2018-08-19mv (mod) codemap source_mapDonato Sciarra-1/+1
2018-08-19Fix typos found by codespell.Matthias Krüger-10/+10
2018-08-16Speed up NLL with `HybridIdxSetBuf`.Nicholas Nethercote-10/+10
`HybridIdxSetBuf` is a sparse-when-small but dense-when-large index set that is very efficient for sets that (a) have few elements, (b) have large `universe_size` values, and (c) are cleared frequently. Which makes it perfect for the `gen_set` and `kill_set` sets used by the new borrow checker. This patch reduces the execution time of the five slowest NLL benchmarks by 55%, 21%, 16%, 10% and 9%. It also reduces the max-rss of three benchmarks by 53%, 33%, and 9%.
2018-08-08Auto merge of #53163 - oli-obk:const_prop_ice, r=nikomatsakisbors-5/+0
Remove an overly pedantic and wrong assertion fixes #53157 fixes #53087
2018-08-07Remove an overly pedantic and wrong assertionOliver Schneider-5/+0
2018-08-07Make sure the feature gate actually works and never allows promoting these ↵Oliver Schneider-19/+21
operations
2018-08-07Also put comparing raw pointers behind a feature gateOliver Schneider-7/+6
2018-08-07Don't accidentally promote union access in MIROliver Schneider-1/+1
2018-08-07Use the correct feature gate nameOliver Schneider-2/+2
2018-08-07Place unions, pointer casts and pointer derefs behind extra feature gatesOliver Schneider-60/+37
2018-08-04Normalize DebugInfoLevel to standard styleMark Rousskov-2/+2
2018-08-03Auto merge of #52712 - oli-obk:const_eval_cleanups, r=RalfJungbors-11/+15
Reintroduce `Undef` and properly check constant value sizes r? @RalfJung cc @eddyb basically all kinds of silent failures that never occurred are assertions now
2018-08-01Rollup merge of #52915 - Zoxc:refine-gen-borrow-analysis, r=eddybPietro Albini-1/+2
Don't count MIR locals as borrowed after StorageDead when finding locals live across a yield terminator This should fix https://github.com/rust-lang/rust/issues/52792. r? @eddyb
2018-08-01Address stylistic review comments and rebase falloutOliver Schneider-2/+2
2018-08-01Reintroduce `Undef` and properly check constant value sizesOliver Schneider-9/+13
2018-08-01Split out growth functionality into BitVector typeMark Rousskov-14/+14
2018-07-31Don't count MIR locals as borrowed after StorageDead when finding locals ↵John Kåre Alsaker-1/+2
live across a yield terminator
2018-07-30Auto merge of #52830 - matthewjasper:bootstrap-prep, r=matthewjasperbors-1/+1
[NLL] Fix some things for bootstrap Some changes that are required when bootstrapping rustc with NLL enabled. * Remove a bunch of unused `mut`s that aren't needed, but the existing lint doesn't catch. * Rewrite a function call to satisfy NLL borrowck. Note that the borrow is two-phase, but gets activated immediately by an unsizing coercion. cc #51823
2018-07-30Auto merge of #52805 - ljedrz:format_str_literal, r=petrochenkovbors-4/+4
Don't format!() string literals Prefer `to_string()` to `format!()` take 2, this time targetting string literals. In some cases (`&format!("...")` -> `"..."`) also removes allocations. Occurences of `format!("")` are changed to `String::new()`.
2018-07-29Auto merge of #52738 - ljedrz:push_to_extend, r=eddybbors-4/+3
Replace push loops with extend() where possible Or set the vector capacity where I couldn't do it. According to my [simple benchmark](https://gist.github.com/ljedrz/568e97621b749849684c1da71c27dceb) `extend`ing a vector can be over **10 times** faster than `push`ing to it in a loop: 10 elements (6.1 times faster): ``` test bench_extension ... bench: 75 ns/iter (+/- 23) test bench_push_loop ... bench: 458 ns/iter (+/- 142) ``` 100 elements (11.12 times faster): ``` test bench_extension ... bench: 87 ns/iter (+/- 26) test bench_push_loop ... bench: 968 ns/iter (+/- 3,528) ``` 1000 elements (11.04 times faster): ``` test bench_extension ... bench: 311 ns/iter (+/- 9) test bench_push_loop ... bench: 3,436 ns/iter (+/- 233) ``` Seems like a good idea to use `extend` as much as possible.
2018-07-29Sanity-check all constantsOliver Schneider-32/+36