about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/mir/pretty.rs
AgeCommit message (Collapse)AuthorLines
2023-12-10remove redundant importssurechen-8/+3
detects redundant imports that can be eliminated. for #117772 : In order to facilitate review and modification, split the checking code and removing redundant imports code into two PR.
2023-12-07ctfe interpreter: extend provenance so that it can track whether a pointer ↵Ralf Jung-2/+2
is immutable
2023-11-17Rollup merge of #117549 - DaniPopes:more-copied, r=b-naberMatthias Krüger-1/+1
Use `copied` instead of manual `map`
2023-11-08rename `BorrowKind::Shallow` to `Fake`lcnr-1/+1
also adds some comments
2023-11-03compiler: use `copied` instead of manual `map`DaniPopes-1/+1
2023-11-01Rename hook.Camille GILLOT-1/+1
2023-10-29Rename a few remaining references to abort terminatorTomasz Miąsko-1/+1
Follow up to e3f2edc75bf2becb57d7d770bba20606da1c4224
2023-10-21Make `ty::print::Printer` take `&mut self` instead of `self`Nilstrieb-6/+6
This simplifies the code by removing all the `self` assignments and makes the flow of data clearer - always into the printer. Especially in v0 mangling, which already used `&mut self` in some places, it gets a lot more uniform.
2023-10-20s/generator/coroutine/Oli Scherer-5/+5
2023-10-20s/Generator/Coroutine/Oli Scherer-4/+4
2023-10-18coverage: Store expression data in function coverage infoZalathar-1/+4
Even though expression details are now stored in the info structure, we still need to inject `ExpressionUsed` statements into MIR, because if one is missing during codegen then we know that it was optimized out and we can remap all of its associated code regions to zero.
2023-10-18coverage: Store all of a function's mappings in function coverage infoZalathar-7/+19
Previously, mappings were attached to individual coverage statements in MIR. That necessitated special handling in MIR optimizations to avoid deleting those statements, since otherwise codegen would be unable to reassemble the original list of mappings. With this change, a function's list of mappings is now attached to its MIR body, and survives intact even if individual statements are deleted by optimizations.
2023-10-03Auto merge of #115301 - Zalathar:regions-vec, r=davidtwcobors-4/+7
coverage: Allow each coverage statement to have multiple code regions The original implementation of coverage instrumentation was built around the assumption that a coverage counter/expression would be associated with *up to one* code region. When it was discovered that *multiple* regions would sometimes need to share a counter, a workaround was found: for the remaining regions, the instrumentor would create a fresh expression that adds zero to the existing counter/expression. That got the job done, but resulted in some awkward code, and produces unnecessarily complicated coverage maps in the final binary. --- This PR removes that tension by changing `StatementKind::Coverage`'s code region field from `Option<CodeRegion>` to `Vec<CodeRegion>`. The changes on the codegen side are fairly straightforward. As long as each `CoverageKind::Counter` only injects one `llvm.instrprof.increment`, the rest of coverage codegen is happy to handle multiple regions mapped to the same counter/expression, with only minor option-to-vec adjustments. On the instrumentor/mir-transform side, we can get rid of the code that creates extra (x + 0) expressions. Instead we gather all of the code regions associated with a single BCB, and inject them all into one coverage statement. --- There are several patches here but they can be divided in to three phases: - Preparatory work - Actually switching over to multiple regions per coverage statement - Cleaning up So viewing the patches individually may be easier.
2023-10-03coverage: Let each coverage statement hold a vector of code regionsZalathar-4/+7
This makes it possible for a `StatementKind::Coverage` to hold more than one code region, but that capability is not yet used.
2023-10-02have better explanation for `relate_types`ouz-a-1/+1
2023-10-02Add docs, remove code, change subtyper codeouz-a-0/+4
2023-09-27fix clippy::{redundant_guards, useless_format}Matthias Krüger-2/+2
2023-09-23Auto merge of #116052 - oli-obk:ceci_nest_pas_une_query, r=WaffleLapkinbors-1/+1
Add a way to decouple the implementation and the declaration of a TyCtxt method. properly addresses https://github.com/rust-lang/rust/pull/115819 accepted MCP: https://github.com/rust-lang/compiler-team/issues/395
2023-09-22Auto merge of #115696 - RalfJung:closure-ty-print, r=oli-obkbors-3/+3
adjust how closure/generator types are printed I saw `&[closure@$DIR/issue-20862.rs:2:5]` and I thought it is a slice type, because that's usually what `&[_]` is... it took me a while to realize that this is just a confusing printer and actually there's no slice. Let's use something that cannot be mistaken for a regular type.
2023-09-22Add a way to decouple the implementation and the declaration of a TyCtxt method.Oli Scherer-1/+1
2023-09-21adjust how closure/generator types and rvalues are printedRalf Jung-3/+3
2023-09-21rename mir::Constant -> mir::ConstOperand, mir::ConstKind -> mir::ConstRalf Jung-14/+41
2023-09-19move ConstValue into mirRalf Jung-2/+2
this way we have mir::ConstValue and ty::ValTree as reasonably parallel
2023-09-19organize mir pretty.rs and move more things into it; move statement-related ↵Ralf Jung-246/+762
things out of mir/mod.rs
2023-09-19use pretty_print_const_value from MIR constant 'extra' printingRalf Jung-126/+132
2023-09-19move some MIR const pretty-printing into pretty.rsRalf Jung-0/+153
2023-09-14cleanup op_to_const a bit; rename ConstValue::ByRef → IndirectRalf Jung-2/+6
2023-09-14use AllocId instead of Allocation in ConstValue::ByRefRalf Jung-7/+7
2023-09-11Disentangle `Debug` and `Display` for `Ty`.Nicholas Nethercote-4/+6
The `Debug` impl for `Ty` just calls the `Display` impl for `Ty`. This is surprising and annoying. In particular, it means `Debug` doesn't show as much information as `Debug` for `TyKind` does. And `Debug` is used in some user-facing error messages, which seems bad. This commit changes the `Debug` impl for `Ty` to call the `Debug` impl for `TyKind`. It also does a number of follow-up changes to preserve existing output, many of which involve inserting `with_no_trimmed_paths!` calls. It also adds `Display` impls for `UserType` and `Canonical`. Some tests have changes to expected output: - Those that use the `rustc_abi(debug)` attribute. - Those that use the `EMIT_MIR` annotation. In each case the output is slightly uglier than before. This isn't ideal, but it's pretty weird (particularly for the attribute) that the output is using `Debug` in the first place. They're fairly obscure attributes (I hadn't heard of them) so I'm not worried by this. For `async-is-unwindsafe.stderr`, there is one line that now lacks a full path. This is a consistency improvement, because all the other mentions of `Context` in this test lack a path.
2023-09-05Refactor how MIR represents composite debuginfo.Camille GILLOT-4/+1
2023-08-17Revert "Implement references VarDebugInfo."Camille GILLOT-7/+2
This reverts commit 2ec007191348ef7cc13eb55e44e007b02cf75cf3.
2023-07-30inline format!() args up to and including rustc_middleMatthias Krüger-47/+42
2023-07-14refactor(rustc_middle): Substs -> GenericArgMahdi Dibaiee-6/+6
2023-06-15Remove comments from mir-opt MIR dumpsBen Kimock-50/+71
2023-06-01Use translatable diagnostics in `rustc_const_eval`Deadbeef-1/+1
2023-05-13Implement references VarDebugInfo.Camille GILLOT-2/+7
2023-04-24Split `{Idx, IndexVec, IndexSlice}` into their own modulesMaybe Waffle-1/+1
2023-04-20Remove WithOptconstParam.Camille GILLOT-8/+3
2023-03-11Address the new odd backticks tidy lint in compiler/est31-0/+1
2023-02-20Allow non-`Box` allocations in preparation for aligned const allocations for ↵Rune Tynan-11/+11
miri. Credit to emarteca for the code.
2023-01-31Review changesMaybe Waffle-1/+1
2023-01-30Use `Mutability::{is_mut, is_not}`Maybe Waffle-1/+1
2022-12-20rustc: Remove needless lifetimesJeremy Stucki-2/+2
2022-12-18use &str / String literals instead of format!()Matthias Krüger-4/+4
2022-12-01Create `format_args` as late as possibleOli Scherer-17/+15
2022-11-25Add empty ConstKind::Abstractkadmin-0/+1
Initial pass at expr/abstract const/s Address comments Switch to using a list instead of &[ty::Const], rm `AbstractConst` Remove try_unify_abstract_consts Update comments Add edits Recurse more More edits Prevent equating associated consts Move failing test to ui Changes this test from incremental to ui, and mark it as failing and a known bug. Does not cause the compiler to ICE, so should be ok.
2022-11-14assert that we are (de)seiralizing ProvenanceMap correctlyRalf Jung-2/+2
2022-11-06move InitMask to its own moduleRalf Jung-5/+11
2022-11-06interpret: support for per-byte provenanceRalf Jung-6/+16
2022-09-22introduce mir::Unevaluatedb-naber-2/+1