about summary refs log tree commit diff
path: root/src/librustc_mir
AgeCommit message (Collapse)AuthorLines
2019-01-13Rollup merge of #57564 - varkor:update-const_fn-tracking-issue, r=CentrilMazdak Farrokhzad-2/+2
Update the const fn tracking issue to the new metabug The new `const fn` tracking issue is #57563. We don't want to point to a closed issue in the diagnostics (or FIXMEs), so these have been updated (from the old issue, #24111). r? @Centril
2019-01-13Rollup merge of #57351 - oli-obk:cheap_const_ops, r=RalfJungMazdak Farrokhzad-14/+36
Don't actually create a full MIR stack frame when not needed r? @dotdash This should significantly reduce overhead during const propagation and reduce overhead *after* copy propagation (cc https://github.com/rust-lang/rust/issues/36673)
2019-01-13Update the const fn tracking issue to the new metabugvarkor-2/+2
2019-01-12Auto merge of #57542 - Centril:rollup, r=Centrilbors-272/+94
Rollup of 26 pull requests Successful merges: - #56425 (Redo the docs for Vec::set_len) - #56906 (Issue #56905) - #57042 (Don't call `FieldPlacement::count` when count is too large) - #57175 (Stabilize `let` bindings and destructuring in constants and const fn) - #57192 (Change std::error::Error trait documentation to talk about `source` instead of `cause`) - #57296 (Fixed the link to the ? operator) - #57368 (Use CMAKE_{C,CXX}_COMPILER_LAUNCHER for ccache) - #57400 (Rustdoc: update Source Serif Pro and replace Heuristica italic) - #57417 (rustdoc: use text-based doctest parsing if a macro is wrapping main) - #57433 (Add link destination for `read-ownership`) - #57434 (Remove `CrateNum::Invalid`.) - #57441 (Supporting backtrace for x86_64-fortanix-unknown-sgx.) - #57450 (actually take a slice in this example) - #57459 (Reference tracking issue for inherent associated types in diagnostic) - #57463 (docs: Fix some 'second-edition' links) - #57466 (Remove outdated comment) - #57493 (use structured suggestion when casting a reference) - #57498 (make note of one more normalization that Paths do) - #57499 (note that FromStr does not work for borrowed types) - #57505 (Remove submodule step from README) - #57510 (Add a profiles section to the manifest) - #57511 (Fix undefined behavior) - #57519 (Correct RELEASES.md for 1.32.0) - #57522 (don't unwrap unexpected tokens in `format!`) - #57530 (Fixing a typographical error.) - #57535 (Stabilise irrefutable if-let and while-let patterns) Failed merges: r? @ghost
2019-01-12Rollup merge of #57535 - varkor:stabilise-if-while-let-patterns, r=CentrilMazdak Farrokhzad-39/+18
Stabilise irrefutable if-let and while-let patterns This stabilises RFC 2086 (https://github.com/rust-lang/rust/issues/44495). This replaces https://github.com/rust-lang/rust/pull/55639, as we want to stabilise this in time for the beta cut-off. Closes https://github.com/rust-lang/rust/pull/55639. r? @Centril
2019-01-12Rollup merge of #57530 - insideoutclub:master, r=estebankMazdak Farrokhzad-1/+1
Fixing a typographical error.
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-12Rollup merge of #56906 - blitzerr:master, r=nikomatsakisMazdak Farrokhzad-18/+24
Issue #56905 Adding a map to TypeckTables to get the list of all the Upvars given a closureID. This is help us get rid of the recurring pattern in the codebase of iterating over the free vars using with_freevars.
2019-01-12Auto merge of #57532 - Centril:stabilize-2175, r=varkorbors-1/+1
Stabilize #![feature(if_while_or_patterns)] r? @varkor Per https://github.com/rust-lang/rust/issues/56212#issue-384085857. Leading `|` is also accepted per the comment in the stabilization proposal.
2019-01-12Stabilise irrefutable if-let and while-let patternsvarkor-39/+18
This stabilises RFC 2086 (https://github.com/rust-lang/rust/issues/44495). Co-Authored-By: Sebastian Malton <sebastian@malton.name>
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-11stabilize top level or-pats in if/while let.Mazdak Farrokhzad-1/+1
2019-01-11Fixing a typographical error.David Sanders-1/+1
2019-01-11Remove unneeded but benign changeOliver Scherer-1/+0
2019-01-09Not seeing the forest because there are too many trees in the wayOliver Scherer-1/+1
2019-01-09Explain the arguments of the `mk_*_eval_cx` functionsOliver Scherer-0/+13
2019-01-09Document the `mk_*_eval_cx` functionsOliver Scherer-2/+10
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-08addressing Niko's commentsBlitzerr-32/+36
2019-01-08[Cleanup] This is the first in the series of removals of with_freevars usage.Blitzerr-38/+39
Currently, there are many places in rustc, where we use with_freevars to iterate over freevars of a closure. The problem with this is the argument to with_freevars is a NodeId and this will get in the way of our eventual goal of solving for issue (#53488), sub-issue (#56905)
2019-01-08Some more refactoring.Blitzerr-0/+1
Change the key of UpvarListMap from DefId to ast::NodeId
2019-01-08Auto merge of #56638 - matthewjasper:remove-ref-region, r=nikomatsakisbors-55/+34
Remove some `Region`s from HAIR Use `ReErased` for any regions that need to be created in RValue::Ref in MIR generation. We will change them to all to `ReVar` before borrow checking anyway. r? @nikomatsakis
2019-01-08Make `mk_eval_cx` private to const evalOliver Scherer-1/+1
2019-01-08Manually push a stack frame where no valid frame is neededOliver Scherer-35/+12
2019-01-07Auto merge of #57304 - davidtwco:issue-57280, r=nikomatsakisbors-4/+63
NLL: Fix bug in associated constant type annotations. Fixes #57280. This PR reverses the variance used when relating types from the type annotation of an associated constant - this matches the behaviour of the lexical borrow checker and fixes a bug whereby matching a `&'a str` against a `&'static str` would produce an error. r? @nikomatsakis
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-05Rollup merge of #57249 - frewsxcv:frewsxcv-second-edition, r=KodrAuskennytm-2/+2
Fix broken links to second edition TRPL. Fixes https://github.com/rust-lang/rust/issues/57104. Remove `second-edition/` from TRPL hyperlinks.
2019-01-05Rollup merge of #57219 - matthewjasper:mir-cleanup, r=nikomatsakiskennytm-14/+0
Remove some unused code Closes #57096
2019-01-05Remove `Region` from HAIRMatthew Jasper-55/+34
Use `ReErased` for any regions that need to be created in RValue::Ref in MIR generation.
2019-01-05Don't actually create a full MIR stack frame when not neededOliver Scherer-3/+27
2019-01-05Auto merge of #57099 - davidtwco:issue-57098, r=nikomatsakisbors-39/+43
NLL: Add closure cannot be moved note. Fixes #57098. This PR extends existing logic for checking whether a closure that is `FnOnce` and therefore moves variables that it captures from the environment has already been invoked when being invoked again. Now, this logic will also check whether the closure is being moved after previously being moved or invoked and add an appropriate note. r? @pnkfelix
2019-01-05Auto merge of #56837 - arielb1:nonprincipal-trait-objects, r=nikomatsakisbors-22/+33
Add support for trait-objects without a principal The hard-error version of #56481 - should be merged after we do something about the `traitobject` crate. Fixes #33140. Fixes #57057. r? @nikomatsakis
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-171/+224
Don't emit `Unevaluated` from `const_eval` cc @eddyb @RalfJung
2019-01-04add support for principal-less trait object typesAriel Ben-Yehuda-22/+33
should be a pure refactoring.
2019-01-03Fix bug in associated constant type annotations.David Wood-4/+63
This commit reverses the variance used when relating types from the type annotation of an associated constant - this matches the behaviour of the lexical borrow checker and fixes a bug whereby matching a `&'a str` against a `&'static str` would produce an error.
2019-01-03Auto merge of #55517 - nikomatsakis:universes, r=scalexmbors-21/+33
Universes This PR transitions the compiler to use **universes** instead of the **leak-check**. It is marked as [WIP] for a few reasons: - The diagnostics at present are terrible =) - This changes the behavior of coherence, regressing some things that used to compile The goals of this PR at present are: - To start getting some eyes on the code - To do a crater run - To see the full travis results (due to https://github.com/rust-lang/rust/issues/52452, I am not able to run the full test suite locally anymore at present) The first few commits in the PR are changing how `evaluate` treats regions. We now track whether region comparisons occurred, reverting the "staticized" query approach that @arielb1 put in. The problem with "staticized" queries is that it relied on the leak-check to get higher-ranked things correct, and we are removing the leak-check in this PR series, so that caused problems. You can see at the end a collection of test updates. Mostly we behave the same but with atrocious diagnostics, but there are a number of cases where we used to error and now no longer do, as well as single case where we used to **not** error but we now do (the coherence-subtyping change). (Note: it would be possible to do a version of leak-check that propagates universe information and recover the old behavior. I am reluctant to do so because I'd like to leave us room to get more precise -- e.g., I want to eventually handle things like `exists<'a> { for<'b> { if ('a: 'b) { 'a: 'b } } }` which presently the leak-check cannot cope with etc. Also because it seems more consistent to me: most folks I've talked to expect the new behavior and are surprised to learn that binding sites were so significant before when it comes to coherence. One question is, though, to what extent are people relying on this in the wild?)
2019-01-03Auto merge of #56507 - nikomatsakis:polonius-integrate, r=MatthewJasperbors-5/+47
polonius tweaks - bump polonius to 0.6.0 - fix 2-phase-borrow activations r? @matthewjasper
2019-01-02rename `type_moves_by_default` to `type_is_copy_modulo_regions`Niko Matsakis-14/+21
2019-01-02generalize region highlights into a structNiko Matsakis-7/+12
2019-01-02Add missing 'static bound for the Machine traitMatthew Jasper-1/+1
2019-01-02Wf-check the output type of a function in MIR-typeckMatthew Jasper-1/+1
2019-01-02adopt polonius-engine 0.6.2Niko Matsakis-1/+1
Also datafrog 2.0.1, which works around a rustdoc bug
2019-01-02generate invalidations from 2-phase-borrow activationsNiko Matsakis-4/+46
2019-01-01rebase falloutOliver Scherer-14/+28
2019-01-01Pacify tidyOliver Scherer-1/+2
2019-01-01Undo a few - now unnecessary - changesOliver Scherer-4/+2
2019-01-01Simplify bit inspection of a constantOliver Scherer-14/+10