about summary refs log tree commit diff
path: root/src/librustc_mir/transform
AgeCommit message (Collapse)AuthorLines
2019-02-02hir: add HirId to main Hir nodesljedrz-1/+1
2019-01-31Add a forever unstable opt-out of const qualification checksOliver Scherer-2/+27
2019-01-29Only store the result of mir_borrowck for closuresJohn Kåre Alsaker-2/+2
2019-01-27Update generator transform and generated function signatureWim Looman-0/+45
2019-01-22Span fixupOliver Scherer-1/+1
2019-01-22Get rid of the fake stack frameOliver Scherer-4/+2
2019-01-21Declare some unconst operations as unsafe in const fnOliver Scherer-20/+77
2019-01-21Differentiate between closure and function bodiesOliver Scherer-8/+5
2019-01-18Remove delay_span_bug from qualify_min_const_fnPhilipp Hansch-7/+1
This is causing issues with a new Clippy lint that will be able to detect possible const functions. As per https://github.com/rust-lang/rust-clippy/pull/3648#discussion_r247927450
2019-01-13Auto merge of #57568 - Centril:rollup, r=Centrilbors-1/+1
Rollup of 16 pull requests Successful merges: - #57351 (Don't actually create a full MIR stack frame when not needed) - #57353 (Optimise floating point `is_finite` (2x) and `is_infinite` (1.6x).) - #57412 (Improve the wording) - #57436 (save-analysis: use a fallback when access levels couldn't be computed) - #57453 (lldb_batchmode.py: try `import _thread` for Python 3) - #57454 (Some cleanups for core::fmt) - #57461 (Change `String` to `&'static str` in `ParseResult::Failure`.) - #57473 (std: Render large exit codes as hex on Windows) - #57474 (save-analysis: Get path def from parent in case there's no def for the path itself.) - #57494 (Speed up item_bodies for large match statements involving regions) - #57496 (re-do docs for core::cmp) - #57508 (rustdoc: Allow inlining of reexported crates and crate items) - #57547 (Use `ptr::eq` where applicable) - #57557 (resolve: Mark extern crate items as used in more cases) - #57560 (hygiene: Do not treat `Self` ctor as a local variable) - #57564 (Update the const fn tracking issue to the new metabug) Failed merges: r? @ghost
2019-01-13const stabilize .Mazdak Farrokhzad-0/+3
2019-01-13Update the const fn tracking issue to the new metabugvarkor-1/+1
2019-01-12Rollup merge of #57175 - oli-obk:const_let_stabilization, r=nikomatsakisMazdak Farrokhzad-214/+51
Stabilize `let` bindings and destructuring in constants and const fn r? @Centril This PR stabilizes the following features in constants and `const` functions: * irrefutable destructuring patterns (e.g. `const fn foo((x, y): (u8, u8)) { ... }`) * `let` bindings (e.g. `let x = 1;`) * mutable `let` bindings (e.g. `let mut x = 1;`) * assignment (e.g. `x = y`) and assignment operator (e.g. `x += y`) expressions, even where the assignment target is a projection (e.g. a struct field or index operation like `x[3] = 42`) * expression statements (e.g. `3;`) This PR does explicitly *not* stabilize: * mutable references (i.e. `&mut T`) * dereferencing mutable references * refutable patterns (e.g. `Some(x)`) * operations on `UnsafeCell` types (as that would need raw pointers and mutable references and such, not because it is explicitly forbidden. We can't explicitly forbid it as such values are OK as long as they aren't mutated.) * We are not stabilizing `let` bindings in constants that use `&&` and `||` short circuiting operations. These are treated as `&` and `|` inside `const` and `static` items right now. If we stopped treating them as `&` and `|` after stabilizing `let` bindings, we'd break code like `let mut x = false; false && { x = true; false };`. So to use `let` bindings in constants you need to change `&&` and `||` to `&` and `|` respectively.
2019-01-12Auto merge of #57234 - Centril:const-stabilizations-2, r=oli-obkbors-7/+30
Const-stabilize `const_int_ops` + `const_ip` r? @oli-obk ## Note for relnotes: This PR includes https://github.com/rust-lang/rust/pull/57105. I've added T-lang since this affects intrinsics and the operational semantics of Rust's `const fn` fragment. ## Stable APIs proposed for constification + `const_int_ops`: + `count_ones` + `count_zeros` + `leading_zeros` + `trailing_zeros` + `swap_bytes` + `from_be` + `from_le` + `to_be` + `to_le` + `const_ip` + `Ipv4Addr::new` ## Unstable APIs constified + `const_int_conversion`: + `reverse_bits`
2019-01-11Remove unneeded but benign changeOliver Scherer-1/+0
2019-01-09Fix irrefutable slice patterns in const fnOliver Scherer-6/+3
2019-01-09Stabilize `let` bindings and destructuring in constants and const fnOliver Scherer-208/+49
2019-01-06Remove unused codeShotaro Yamada-30/+0
2019-01-05Rollup merge of #57342 - phansch:make_public, r=Centrilkennytm-1/+1
librustc_mir: Make qualify_min_const_fn module public Trying to write a `const_fn` lint for Clippy. @oli-obk suggested [here][link] to use the `is_min_const_fn` function from the `qualify_min_const_fn` module. However, the module is currently private and this commit makes it public. I lack any historical knowledge of the development of the `const_fn` feature, so I'm not sure if it was private on purpose or not. fwiw, all modules are already public except `qualify_min_const_fn`. r? @oli-obk [link]: https://github.com/rust-lang/rust-clippy/issues/2440#issuecomment-446109978
2019-01-04librustc_mir: Make qualify_min_const_fn module publicPhilipp Hansch-1/+1
Trying to write a `const_fn` lint for Clippy. @oli-obk suggested [here][link] to use the `is_min_const_fn` function from the `qualify_min_const_fn` module. However, the module is currently private and this commit makes it public. I lack any historical knowledge of the development of the `const_fn` feature, so I'm not sure if it was private on purpose or not. fwiw, all modules are already public except `qualify_min_const_fn`. [link]: https://github.com/rust-lang/rust-clippy/issues/2440#issuecomment-446109978
2019-01-04Auto merge of #56723 - oli-obk:lazy_const, r=nikomatsakisbors-18/+22
Don't emit `Unevaluated` from `const_eval` cc @eddyb @RalfJung
2019-01-02rename `type_moves_by_default` to `type_is_copy_modulo_regions`Niko Matsakis-2/+5
2019-01-01Pacify tidyOliver Scherer-1/+2
2019-01-01Undo a few - now unnecessary - changesOliver Scherer-2/+1
2019-01-01Simplify bit inspection of a constantOliver Scherer-14/+10
2019-01-01`const_to_op` is now `lazy_const_to_op`Oliver Scherer-2/+2
2019-01-01Add `unwrap_usize` to `LazyConst`, tooOliver Scherer-6/+5
2019-01-01Move the `Unevaluated` constant arm upwards in the type structureOliver Scherer-25/+34
2018-12-31const-stabilize const_int_ops + reverse_bitsMazdak Farrokhzad-0/+5
2018-12-31qualify_min_const_fn: improve note.Mazdak Farrokhzad-1/+2
2018-12-31stabilize const_int_rotateMazdak Farrokhzad-5/+7
2018-12-31stabilize const_int_wrapping.Mazdak Farrokhzad-7/+22
2018-12-30Refactor `UserTypeAnnotation`.David Wood-0/+1
This commit refactors the `UserTypeAnnotation` type to be referred to by an index within `UserTypeProjection`. `UserTypeAnnotation` is instead kept in an `IndexVec` within the `Mir` struct. Further, instead of `UserTypeAnnotation` containing canonicalized types, it now contains normal types and the entire `UserTypeAnnotation` is canonicalized. To support this, the type was moved from the `rustc::mir` module to `rustc::ty` module.
2018-12-25Remove licensesMark Rousskov-240/+0
2018-12-23Rollup merge of #57067 - Centril:stabilize-min_const_unsafe_fn, r=oli-obkMazdak Farrokhzad-28/+1
Stabilize min_const_unsafe_fn in 1.33 Fixes #55607 r? @oli-obk
2018-12-23Rollup merge of #56916 - oli-obk:static_mut_beta_regression, r=davidtwcoMazdak Farrokhzad-1/+1
Fix mutable references in `static mut` fixes #56903
2018-12-23stabilize min_const_unsafe_fn in 1.33.Mazdak Farrokhzad-28/+1
2018-12-23Rollup merge of #56981 - RalfJung:miri-infallible-alloc, r=oli-obkkennytm-1/+1
miri: allocation is infallible
2018-12-21Fix a recently introduces regressionOliver Scherer-1/+1
2018-12-20Auto merge of #56741 - RalfJung:retag-to-raw, r=oli-obkbors-42/+31
treat ref-to-raw cast like a reborrow: do a special kind of retag r? @oli-obk Cc @nikomatsakis
2018-12-20Auto merge of #56649 - davidtwco:issue-46589, r=pnkfelixbors-6/+6
MIR borrowck doesn't accept the example of iterating and updating a mutable reference Fixes #46589. r? @pnkfelix or @nikomatsakis
2018-12-19miri: allocation is infallibleRalf Jung-1/+1
2018-12-18Auto merge of #56160 - oli-obk:const_fn_let, r=nikomatsakisbors-5/+41
Fix various aspects around `let` bindings inside const functions * forbid `let` bindings in const contexts that use short circuiting operators * harden analysis code against derefs of mutable references Initially this PR was about stabilizing `let` bindings, but too many flaws were exposed that need some more testing on nightly
2018-12-18treat ref-to-raw cast like a reborrow: do a special kind of retagRalf Jung-42/+31
2018-12-18Explain that lack of short circuiting support in constants is temporaryOliver Scherer-1/+4
2018-12-18Properly worded diagnostic messageOliver Scherer-1/+1
2018-12-17Add required lifetime parameter to BitDenotation.David Wood-6/+6
This avoids all sorts of confusing issues with using both `dest_place` and `self` in the `propagate_call_return` function in the `BitDenotation` implementation for `Borrows`.
2018-12-17Auto merge of #56764 - sinkuu:simpcfg_bb0, r=matthewjasperbors-1/+26
mir-opt: Make SimplifyCfg collapse goto chains starting from bb0 `SimplifyCfg` pass was not able to collapse goto chains starting from bb0, leaving MIR like this: ``` bb0: { goto -> bb1; } ```
2018-12-13Make SimplifyCfg collapse goto chains from bb0Shotaro Yamada-1/+26
2018-12-12Manually inline trivial functionOliver Scherer-9/+5