about summary refs log tree commit diff
path: root/src/librustc_mir/util
AgeCommit message (Collapse)AuthorLines
2020-04-27Emit basic block ids for statements and terminators in MIR only in -Zverbose ↵Oliver Scherer-5/+5
mode
2020-04-26fmtRalf Jung-1/+1
2020-04-26print pointers more compactly when they are too bigRalf Jung-0/+4
2020-04-26sync alloc dump and pointer printingRalf Jung-11/+14
2020-04-26remove obsolete commentTshepang Lekhonkhobe-7/+0
2020-04-24Remove `Option` from the return type of `def_kind`.Eduard-Mihai Burtescu-4/+4
2020-04-24add a few more DefKindsmark-1/+1
make Map::def_kind take LocalDefId Co-Authored-By: Vadim Petrochenkov <vadim.petrochenkov@gmail.com> crates are DefKind::Mod
2020-04-23Modify `as_local_hir_id` to return a bare `HirId`marmeladema-1/+1
2020-04-23Modify `as_local_hir_id` to accept a `LocalDefId` instead of a `DefId`marmeladema-1/+1
2020-04-22Use `Body` everywhereDylan MacKenzie-6/+6
2020-04-19Dogfood more or_patterns in the compilerJosh Stone-3/+3
2020-04-17Minor fix and addition to doc commentsJOE1994-0/+1
1. Fixed doc comment of struct 'rustc_middle::mir::Location' Currently, the general explanation of the struct appears at the field explanation section. I moved and changed the doc comments slightly, so that the general explanation would appear in the proper location in docs. 2. Added doc comment explaining 'rustc_mir::util::pretty::write_mir_fn' Unlike other counterparts, brief explanation for this function was missing, so I added one. Thank you for reviewing this PR :)
2020-04-16don't clone types that are copy (clippy::clone_on_copy)Matthias Krüger-12/+12
2020-04-11Pass the `PlaceElem::Index` local to `visit_local`Jonas Schievink-12/+1
2020-04-09Use `Visitor` for `AlwaysLiveLocals`Dylan MacKenzie-14/+19
2020-04-09Add utility to find locals that don't use `Storage*` annotationsDylan MacKenzie-0/+43
2020-04-08Suggest move for closures and async blocks in more cases.Alex Aktsipetrov-1/+3
2020-04-04share more alloc printing code between Miri and MIR dumpingRalf Jung-26/+44
2020-04-02direct imports for langitem stuffMazdak Farrokhzad-1/+1
2020-04-02nix rustc_target::abi::* reexport in ty::layoutMazdak Farrokhzad-3/+4
2020-04-01Rollup merge of #70627 - spastorino:use-place-directly-its-copy, r=oli-obkMazdak Farrokhzad-40/+37
Use place directly its copy r? @oli-obk
2020-04-01Rollup merge of #70511 - ecstatic-morse:mir-dataflow-graphviz, r=davidtwcoMazdak Farrokhzad-4/+4
Add `-Z dump-mir-dataflow` flag for dumping dataflow results visualization Previously, to visualize the results of a MIR dataflow pass, one had to add a `#[rustc_mir(borrowck_graphviz_postflow)]` attribute to functions of interest. However, there is no way to specify this attribute on closures and generators, so it was impossible to view results for these MIR bodies. This PR adds a flag, `-Z dump-mir-dataflow`, which will output the dataflow results for any functions specified in `-Z dump-mir` to the output directory specified by `-Z dump-mir-dir`. This behavior is modeled on the `-Z dump-mir-graphviz` flag.
2020-03-31Use Place directly, it's Copy even more use casesSantiago Pastorino-20/+20
2020-03-31Use Place directly, it's Copy more use casesSantiago Pastorino-21/+18
2020-03-30Use if let instead of match when only matching a single variant ↵Matthias Krüger-5/+3
(clippy::single_match) Makes code more compact and reduces nestig.
2020-03-30rustc -> rustc_middle part 3 (rustfmt)Mazdak Farrokhzad-15/+17
2020-03-30rustc -> rustc_middle part 2Mazdak Farrokhzad-31/+31
2020-03-29Use `&` to do deref coercion for `ReadOnlyBodyAndCache`Dylan MacKenzie-1/+1
2020-03-29Make `Visitor::visit_body` take a simple `Body`Dylan MacKenzie-5/+4
2020-03-28`dump_enabled` takes a `DefId` instead of `MirSource`Dylan MacKenzie-4/+4
2020-03-26Enable `--bless`ing of MIR dumpsOliver Scherer-20/+262
2020-03-26borrowck diagnostics: address review comments.Mazdak Farrokhzad-4/+3
2020-03-25borrowck: prefer "value" over "`_`".Mazdak Farrokhzad-17/+17
2020-03-23Rollup merge of #70080 - anyska:mir-double-space, r=oli-obkMazdak Farrokhzad-1/+1
rustc_mir: remove extra space when pretty-printing MIR.
2020-03-21rustc: keep upvars tupled in {Closure,Generator}Substs.Eduard-Mihai Burtescu-4/+4
2020-03-17rustc_mir: remove extra space when pretty-printing MIR.Ana-Maria Mihalache-1/+1
2020-03-14Rollup merge of #69802 - matthiaskrgr:cl1ppy, r=Dylan-DPCYuki Okushi-7/+7
fix more clippy findings * reduce references on match patterns (clippy::match_ref_pats) * Use writeln!(fmt, "word") instead of write!(fmt, "word\n") (clippy::write_with_newline) * libtest: remove redundant argument to writeln!() (clippy::writeln_empty_string) * remove unneeded mutable references (cippy::unnecessary_mut_passed) * libtest: declare variables as floats instead of casting them (clippy::unnecessary_cast) * rustdoc: remove redundant static lifetimes (clippy::redundant_static_lifetimes) * call .as_deref() instead of .as_ref().map(Deref::deref) (clippy::option_as_ref_deref) * iterate over a maps values directly. (clippy::for_kv_map) * rustdoc: simplify boolean condition (clippy::nonminimal_bool) * Use ?-operator in more places (clippy::question_mark, had some false negatives fixed recently) * rustdoc: Use .any(p) instead of find(p).is_some(). (clippy::search_is_some) * rustdoc: don't call into_iter() on iterator. (clippy::identity_conversion)
2020-03-12Rollup merge of #69674 - mark-i-m:assoc-fn, r=matthewjasperMazdak Farrokhzad-1/+1
Rename DefKind::Method and TraitItemKind::Method r? @eddyb, @Centril, or @matthewjasper cc #69498 #60163
2020-03-07libtest: remove redundant argument to writeln!() (clippy::writeln_empty_string)Matthias Krüger-7/+7
2020-03-07Rollup merge of #69773 - matthiaskrgr:typos, r=petrochenkovMazdak Farrokhzad-2/+2
fix various typos
2020-03-07Rollup merge of #69782 - matthiaskrgr:redundant_field_name_rep, r=cramertjMazdak Farrokhzad-3/+3
Don't redundantly repeat field names (clippy::redundant_field_names)
2020-03-06Don't redundantly repeat field names (clippy::redundant_field_names)Matthias Krüger-3/+3
2020-03-06fix various typosMatthias Krüger-2/+2
2020-03-03DefKind::Method -> DefKind::AssocFnMark Mansi-1/+1
2020-03-03Use .next() instead of .nth(0) on iterators.Matthias Krüger-1/+1
2020-03-01Auto merge of #68943 - ecstatic-morse:no-useless-drop-on-enum-variants, ↵bors-15/+30
r=matthewjasper Skip `Drop` terminators for enum variants without drop glue Split out from #68528. When doing drop elaboration for an `enum` that may or may not be moved out of (an open drop), we check the discriminant of the `enum` to see whether the live variant has any drop flags and then check the drop flags to see whether we need to drop each field. Sometimes, however, the live variant has no move paths and thus no drop flags. In this case, we still emit a drop terminator for the entire enum after checking the enum discriminant. This drop shim will check the discriminant of the enum *again* and then drop the fields of the active variant. If the active variant has no drop glue, nothing will be done. This commit skips emitting the drop terminator during drop elaboration when the "otherwise" variants, those without move paths, have no drop glue. A common example of this scenario is when an `Option` is moved from, since `Option::None` never needs drop glue. Below is a fragment the pre-codegen CFG for `Option::unwrap_or` in which we check the drop flag (`_5`) for `self` (`_1`), before and after the change. Before: ![image](https://user-images.githubusercontent.com/29463364/74078927-52942380-49e5-11ea-8e34-4b9d6d94ef25.png) After: ![image](https://user-images.githubusercontent.com/29463364/74078945-78b9c380-49e5-11ea-8302-b043c4a7515a.png) This change doesn't do much on its own, but it is a prerequisite to get the perf gains from #68528. cc @arielb1
2020-02-29Rollup merge of #69567 - matthiaskrgr:useless_fmt, r=nagisaDylan DPC-1/+1
use .to_string() instead of format!() macro to create strings handles what is left after https://github.com/rust-lang/rust/pull/69541
2020-02-29use .to_string() instead of format!() macro to create stringsMatthias Krüger-1/+1
2020-02-28use is_empty() instead of len() == x to determine if structs are empty.Matthias Krüger-2/+2
2020-02-27don't use .into() to convert types into identical types.Matthias Krüger-1/+0
example: let s: String = format!("hello").into();