about summary refs log tree commit diff
path: root/compiler/rustc_middle
AgeCommit message (Collapse)AuthorLines
2023-10-05Auto merge of #116417 - ouz-a:trait_type_detective, r=compiler-errorsbors-23/+2
Remove is global hack In attempt to fix https://github.com/rust-lang/rust/issues/114057 we found several issues with how compiler computes layouts, this change removes `is_global` from `and` to stop impl from being shadowed. In depth conversation can be read here https://rust-lang.zulipchat.com/#narrow/stream/146212-t-compiler.2Fconst-eval/topic/Getting.20different.20types.20from.20almost.20same.20inputs This is a fix candidate opened for performance run. r? `@lcnr`
2023-10-05remove is global hackOğuz Ağcayazı-23/+2
2023-10-05Auto merge of #116427 - cjgillot:no-internal, r=oli-obkbors-35/+3
Remove mir::LocalDecl::internal. It does not serve any purpose, as we don't have typeck-based generator witnesses any more.
2023-10-04Auto merge of #116370 - nnethercote:more-arena-stuff, r=cjgillotbors-6/+8
Remove the `TypedArena::alloc_from_iter` specialization. It was added in #78569. It's complicated and doesn't actually help performance. r? `@cjgillot`
2023-10-04Remove mir::LocalDecl::internal.Camille GILLOT-35/+3
2023-10-03Auto merge of #115301 - Zalathar:regions-vec, r=davidtwcobors-15/+8
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-03Rollup merge of #116261 - lcnr:wf-only-clause, r=davidtwcoMatthias Krüger-9/+18
a small wf and clause cleanup - remove `Clause::from_projection_clause`, instead use `ToPredicate` - change `predicate_obligations` to directly take a `Clause` - remove some unnecessary `&` - use clause in `min_specialization` checks where easily applicable
2023-10-03Auto merge of #116376 - matthiaskrgr:rollup-b3d14gq, r=matthiaskrgrbors-6/+6
Rollup of 5 pull requests Successful merges: - #115863 (Add check_unused_messages in tidy) - #116210 (Ensure that `~const` trait bounds on associated functions are in const traits or impls) - #116358 (Rename both of the `Match` relations) - #116371 (Remove unused features from `rustc_llvm`.) - #116374 (Print normalized ty) r? `@ghost` `@rustbot` modify labels: rollup
2023-10-03Auto merge of #115025 - ouz-a:ouz_testing, r=lcnrbors-3/+34
Make subtyping explicit in MIR This adds new mir-opt that pushes new `ProjectionElem` called `ProjectionElem::Subtype(T)` to `Rvalue` of a subtyped assignment so we can unsoundness issues like https://github.com/rust-lang/rust/issues/107205 Addresses https://github.com/rust-lang/rust/issues/112651 r? `@lcnr`
2023-10-03Optimize some `alloc_from_iter` call sites.Nicholas Nethercote-6/+8
There's no need to collect an iterator into a `Vec`, or to call `into_iter` at the call sites.
2023-10-03coverage: Remove `next_id` methods from counter/expression IDsZalathar-10/+0
When these methods were originally written, I wasn't aware that `newtype_index!` already supports addition with ordinary numbers, without needing to unwrap and re-wrap.
2023-10-03coverage: Let each coverage statement hold a vector of code regionsZalathar-5/+8
This makes it possible for a `StatementKind::Coverage` to hold more than one code region, but that capability is not yet used.
2023-10-02Rename both of the Match relationsMichael Goulet-6/+6
2023-10-02have better explanation for `relate_types`ouz-a-5/+12
2023-10-02Add docs, remove code, change subtyper codeouz-a-1/+19
2023-10-02subtyping_projectionsouz-a-1/+7
2023-10-02`skip_binder` to `instantiate_identity`lcnr-2/+7
2023-10-01Auto merge of #116281 - Nadrieril:eager-const-eval, r=cjgillotbors-1/+10
Cleanup number handling in match exhaustiveness Doing a little bit of cleanup; handling number constants was somewhat messy. In particular, this: - evals float consts once instead of repetitively - reduces `Constructor` from 88 bytes to 56 (`mir::Const` is big!) The `fast_try_eval_bits` function was mostly constructed from inlining existing code but I don't fully understand it; I don't follow how consts work and are evaluated very well.
2023-10-01Move `eval_bits` optimization upstreamNadrieril-1/+10
2023-09-30Auto merge of #116254 - WaffleLapkin:nicen-traversal, r=cjgillotbors-72/+45
Assorted improvements for `rustc_middle::mir::traversal` r? `@cjgillot` I'm not _entirely_ sure about all changes, although I do like all of them. If you'd like I can drop some commits. Best reviewed on a commit-by-commit basis, I think, since they are fairly isolated.
2023-09-29Remove deleted docs + better link together MIR traversing docsMaybe Waffle-2/+37
2023-09-29a small wf and clause cleanuplcnr-9/+18
2023-09-28Use `and_then` instead of while let chain to clarify `iter` scopeMaybe Waffle-1/+1
2023-09-28Remove unnecessary `&mut/ref mut` pairMaybe Waffle-1/+1
2023-09-28Don't resolve basic block data in `Postorder`Maybe Waffle-7/+6
The only usage immediately throws out the data, so.
2023-09-28`(&mut iter)` -> `iter.by_ref()`Maybe Waffle-1/+1
2023-09-28Simplify `Postorder::next`Maybe Waffle-6/+4
2023-09-28Remove `ReversePostorder` altogetherMaybe Waffle-58/+0
It was not used anywhere, instead we directly reverse postorder.
2023-09-28Remove outdated commentMaybe Waffle-2/+1
There is no `reset` anymore
2023-09-28Add a mir validation check to prevent OpaqueCast after analysis passes finishOli Scherer-0/+1
2023-09-28Rollup merge of #116211 - matthiaskrgr:clippy3, r=compiler-errorsMatthias Krüger-2/+2
more clippy complextity fixes redundant_guards, useless_format, clone_on_copy
2023-09-27fix clippy::{redundant_guards, useless_format}Matthias Krüger-2/+2
2023-09-27Auto merge of #109597 - cjgillot:gvn, r=oli-obkbors-1/+1
Implement a global value numbering MIR optimization The aim of this pass is to avoid repeated computations by reusing past assignments. It is based on an analysis of SSA locals, in order to perform a restricted form of common subexpression elimination. By opportunity, this pass allows for some simplifications by combining assignments. For instance, this pass could be able to see through projections of aggregates to directly reuse the aggregate field (not in this PR). We handle references by assigning a different "provenance" index to each `Ref`/`AddressOf` rvalue. This ensure that we do not spuriously merge borrows that should not be merged. Meanwhile, we consider all the derefs of an immutable reference to a freeze type to give the same value: ```rust _a = *_b // _b is &Freeze _c = *_b // replaced by _c = _a ```
2023-09-27Auto merge of #115887 - RalfJung:pat, r=oli-obkbors-6/+10
thir::pattern: update some comments and error type names Follow-up to [these comments](https://github.com/rust-lang/rust/pull/105750#pullrequestreview-1629697578). Please carefully fact-check, I'm new to this area of the compiler!
2023-09-27Auto merge of #116163 - compiler-errors:lazyness, r=oli-obkbors-15/+21
Don't store lazyness in `DefKind::TyAlias` 1. Don't store lazyness of a type alias in its `DefKind`, but instead via a query. 2. This allows us to treat type aliases as lazy if `#[feature(lazy_type_alias)]` *OR* if the alias contains a TAIT, rather than having checks for both in separate parts of the codebase. r? `@oli-obk` cc `@fmease`
2023-09-26subst -> instantiatelcnr-24/+12
2023-09-26Don't store lazyness in DefKindMichael Goulet-15/+21
2023-09-24Remove span from BrAnon.Camille GILLOT-12/+11
2023-09-24Add global value numbering pass.Camille GILLOT-1/+1
2023-09-23Remove GeneratorWitness and rename GeneratorWitnessMIR.Camille GILLOT-79/+26
2023-09-23Enable drop_tracking_mir by default.Camille GILLOT-82/+2
2023-09-23Auto merge of #116081 - compiler-errors:closure-captures-sized, r=cjgillotbors-0/+4
Check that closure/generator's interior/capture types are sized check that closure upvars and generator interiors are sized. this check is only necessary when `unsized_fn_params` or `unsized_locals` is enabled, so only check if those are active. Fixes #93622 Fixes #61335 Fixes #68543
2023-09-23Auto merge of #116052 - oli-obk:ceci_nest_pas_une_query, r=WaffleLapkinbors-11/+97
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-23Check types live across yields in generators tooMichael Goulet-1/+3
2023-09-23Check that closure's by-value captures are sizedMichael Goulet-0/+2
2023-09-22Merge `ExternProviders` into the general `Providers` structOli Scherer-0/+1
2023-09-22Have a single struct for queries and hookOli Scherer-0/+23
2023-09-22Auto merge of #115696 - RalfJung:closure-ty-print, r=oli-obkbors-11/+11
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-22Rollup merge of #116049 - RalfJung:future-incompat, r=NilstriebMatthias Krüger-3/+6
give FutureIncompatibilityReason variants more explicit names Also make the `reason` field mandatory when declaring a lint, to make sure this is a deliberate decision.
2023-09-22Rollup merge of #116041 - compiler-errors:rigid-note, r=RalfJungMatthias Krüger-0/+5
Add note to `is_known_rigid` Adds a note requested by `@RalfJung` in https://github.com/rust-lang/rust/pull/114941#discussion_r1329963704 Let me know if there are any other fns that need documentation, I could throw them into this PR too :)