summary refs log tree commit diff
path: root/src/librustc_mir/transform
AgeCommit message (Collapse)AuthorLines
2018-09-04Properly prevent the promotion of unstable const fnsOliver Schneider-3/+1
2018-08-25Remove an overly pedantic and wrong assertionOliver Schneider-5/+0
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
2018-07-29Remove unused `mut`sMatthew Jasper-1/+1
2018-07-29Replace push loops with collect() and extend() where possibleljedrz-4/+3
2018-07-28Don't format!() string literalsljedrz-4/+4
2018-07-27Use slices where a vector is not necessaryljedrz-1/+1
2018-07-27Auto merge of #52681 - pnkfelix:z-borrowck-migrate, r=nikomatsakisbors-1/+14
Add `-Z borrowck=migrate` This adds `-Z borrowck=migrate`, which represents the way we want to migrate to NLL under Rust versions to come. It also hooks this new mode into `--edition 2018`, which means we're officially turning NLL on in the 2018 edition. The basic idea of `-Z borrowck=migrate` that there are cases where NLL is fixing old soundness bugs in the borrow-checker, but in order to avoid just breaking code by immediately rejecting the programs that hit those soundness bugs, we instead use the following strategy: If your code is accepted by NLL, then we accept it. If your code is rejected by both NLL and the old AST-borrowck, then we reject it. If your code is rejected by NLL but accepted by the old AST-borrowck, then we emit the new NLL errors as **warnings**. These warnings will be turned into hard errors in the future, and they say so in these diagnostics. Fix #46908
2018-07-26Auto merge of #52735 - Mark-Simulacrum:rollup, r=Mark-Simulacrumbors-11/+93
Rollup of 16 pull requests Successful merges: - #52558 (Add tests for ICEs which no longer repro) - #52610 (Clarify what a task is) - #52617 (Don't match on region kinds when reporting NLL errors) - #52635 (Fix #[linkage] propagation though generic functions) - #52647 (Suggest to take and ignore args while closure args count mismatching) - #52649 (Point spans to inner elements of format strings) - #52654 (Format linker args in a way that works for gcc and ld) - #52667 (update the stdsimd submodule) - #52674 (Impl Executor for Box<E: Executor>) - #52690 (ARM: expose `rclass` and `dsp` target features) - #52692 (Improve readability in a few sorts) - #52695 (Hide some lints which are not quite right the way they are reported to the user) - #52718 (State default capacity for BufReader/BufWriter) - #52721 (std::ops::Try impl for std::task::Poll) - #52723 (rustc: Register crates under their real names) - #52734 (sparc ABI issue - structure returning from function is returned in 64bit registers (with tests)) Failed merges: - #52678 ([NLL] Use better spans in some errors) r? @ghost
2018-07-26Allow elaborate_drops to progress under errors that come up during ↵Felix S. Klock II-1/+14
borrowck=migrate.
2018-07-25Hide some lints which are not quite right the way they are reported to the userOliver Schneider-11/+93
2018-07-25parameterize `BitVector` and `BitMatrix` by their index typesNiko Matsakis-28/+35
2018-07-23Promoteds are statics and statics have a place, not just a valueOliver Schneider-136/+86
2018-07-21Auto merge of #52115 - Dylan-DPC:feature/nll-liveness-regions, r=nikomatsakisbors-15/+26
only compute liveness for variables whose types include regions Closes #52034 r? @nikomatsakis
2018-07-20Auto merge of #52498 - oli-obk:const_prop, r=nikomatsakisbors-14/+34
Const propagate casts fixes #49760 So... This fixes the original issue about the missing warnings. But our test suite contains fun things like ```rust fn foo() {} assert_eq!(foo as i16, foo as usize as i16); ``` Which, will result in > a raw memory access tried to access part of a pointer value as raw bytes on both sides of the assertion. Because well... that's exactly what's going on! We're ripping out 16 bits of a pointer.
2018-07-20move NllLivenessMap and LocalWithRegion to liveness_mapdylan_DPC-8/+8
2018-07-19make liveness generic over set of local variablesNiko Matsakis-7/+18
We used to hardcode that we wanted the liveness of *all* variables. This can now be configured by selecting an alternative index type V and providing a (partial) map from locals to that new type V.
2018-07-19add trait structs and other changes from V to localdylan_DPC-26/+26
2018-07-19add generic parameterdylan_DPC-26/+26
2018-07-18Const-propagate castsOliver Schneider-14/+34
2018-07-18Auto merge of #52364 - ljedrz:mir_remove_clone, r=RalfJungbors-10/+11
Remove a clone in mir/transform/add_validation Remove a clone of `mir.local_decls`.
2018-07-16ItemKindcsmoe-1/+1
2018-07-16ExprKindcsmoe-1/+1
2018-07-15Remove a clone in mir/transform/add_validation.ljedrz-10/+11
2018-07-11fix typoRalf Jung-2/+2
2018-07-10improve error message shown for unsafe operations: explain why undefined ↵Ralf Jung-15/+43
behavior could arise Inspired by @gnzlbg at https://github.com/rust-lang/rust/issues/46043#issuecomment-381544673
2018-07-05Do not run AST borrowck when -Zborrowck=mirSantiago Pastorino-1/+4
2018-07-04Remove rustc_mir_borrowck attribute and use rustc_mir insteadSantiago Pastorino-1/+1
2018-06-30Minor refactoring.Alexander Regueiro-24/+21
2018-06-30Loosened rules involving statics mentioning other statics.Alexander Regueiro-97/+26
Updated tests accordingly.
2018-06-28Turn the use of erroneous constants into errors againOliver Schneider-4/+17
2018-06-28Don't const propagate the body of constantsOliver Schneider-1/+4
2018-06-28Merge `ConstVal` and `ConstValue`Oliver Schneider-45/+8
2018-06-28Move everything over from `middle::const_val` to `mir::interpret`Oliver Schneider-2/+2
2018-06-28Move the Lrc outside the error type and name the fieldsOliver Schneider-1/+2
2018-06-28Eliminate old CTFE's `ErrKind`Oliver Schneider-2/+2
2018-06-21Parse async fn header.Without Boats-2/+2
This is gated on edition 2018 & the `async_await` feature gate. The parser will accept `async fn` and `async unsafe fn` as fn items. Along the same lines as `const fn`, only `async unsafe fn` is permitted, not `unsafe async fn`.The parser will not accept `async` functions as trait methods. To do a little code clean up, four fields of the function type struct have been merged into the new `FnHeader` struct: constness, asyncness, unsafety, and ABI. Also, a small bug in HIR printing is fixed: it previously printed `const unsafe fn` as `unsafe const fn`, which is grammatically incorrect.
2018-06-19Thread info about form of variable bindings, including spans of arg types, ↵Felix S. Klock II-3/+3
down into `mir::LocalDecls`. As a drive-by: the ref_for_guards created by `fn declare_binding` should not have been tagged as user_variables in the first place. These secret internal locals are *pointers* to user variables, but themselves are not such (IMO. For now at least.)
2018-06-14rustc: rename ty::maps to ty::query.Eduard-Mihai Burtescu-6/+5
2018-06-05Add source information the const propagation of placesOliver Schneider-4/+5
2018-06-05Refactor the const eval diagnostic APIOliver Schneider-37/+64
2018-06-05Propagate uses of constants correctly so that array index checks workFabian Zaiser-10/+0
2018-06-04Auto merge of #51307 - oli-obk:miri_fixes, r=eddybbors-19/+5
ScalarPairs are offset==0 field + other non-zst field r? @eddyb fixes #51300
2018-06-04Simplify value field accessOliver Schneider-3/+3
2018-06-03Do not promote union field accessesOliver Schneider-2/+8
2018-06-02Correctly access ScalarPair fields during const evalOliver Schneider-19/+5
2018-06-02Specify that packed types must derive, not implement, CopyMark Simulacrum-2/+2