about summary refs log tree commit diff
path: root/compiler/rustc_middle/src
AgeCommit message (Collapse)AuthorLines
2022-07-11use PlaceRef::iter_projections to fix old FIXMERose Hudson-5/+3
I added this function in 53481a5a8fde83ed1a5d7e8302be028a4c7d8da5
2022-07-11Hide niches in SIMD types, tooOli Scherer-6/+1
2022-07-11More obvious closure nameOli Scherer-4/+4
2022-07-10Rollup merge of #99103 - TaKO8Ki:avoid-&str-to-string-conversions, r=oli-obkMatthias Krüger-5/+3
Avoid some `&str` to `String` conversions This patch removes some `&str` to `String` conversions.
2022-07-10avoid some `&str` to `String` conversionsTakayuki Maeda-5/+3
2022-07-09Auto merge of #98957 - RalfJung:zst-are-different, r=lcnr,oli-obkbors-46/+44
don't allow ZST in ScalarInt There are several indications that we should not ZST as a ScalarInt: - We had two ways to have ZST valtrees, either an empty `Branch` or a `Leaf` with a ZST in it. `ValTree::zst()` used the former, but the latter could possibly arise as well. - Likewise, the interpreter had `Immediate::Uninit` and `Immediate::Scalar(Scalar::ZST)`. - LLVM codegen already had to special-case ZST ScalarInt. So I propose we stop using ScalarInt to represent ZST (which are clearly not integers). Instead, we can add new ZST variants to those types that did not have other variants which could be used for this purpose. Based on https://github.com/rust-lang/rust/pull/98831. Only the commits starting from "don't allow ZST in ScalarInt" are new. r? `@oli-obk`
2022-07-09tweak names and output and blessRalf Jung-7/+15
2022-07-09review feedbackRalf Jung-13/+7
2022-07-09don't allow ZST in ScalarIntRalf Jung-41/+37
There are several indications that we should not ZST as a ScalarInt: - We had two ways to have ZST valtrees, either an empty `Branch` or a `Leaf` with a ZST in it. `ValTree::zst()` used the former, but the latter could possibly arise as well. - Likewise, the interpreter had `Immediate::Uninit` and `Immediate::Scalar(Scalar::ZST)`. - LLVM codegen already had to special-case ZST ScalarInt. So instead add new ZST variants to those types that did not have other variants which could be used for this purpose.
2022-07-09Rollup merge of #99050 - JakobDegen:storage-docs, r=tmiaskoMatthias Krüger-13/+13
Clarify MIR semantics of storage statements Seems worthwhile to start closing out some of the less controversial open questions about MIR semantics. Hopefully this is fairly non-controversial - it's what we implement already, and I see no reason to do anything more restrictive. cc ``@tmiasko`` who commented on this when it was discussed in the original PR that added these docs.
2022-07-09Auto merge of #99028 - tmiasko:inline, r=estebankbors-0/+8
Miscellaneous inlining improvements Add `#[inline]` to a few trivial non-generic methods from a perf report that otherwise wouldn't be candidates for inlining.
2022-07-08Clarify MIR semantics of storage statementsJakob Degen-13/+13
2022-07-08fixes post rebaseJane Losare-Lusby-0/+2
2022-07-08Support unstable moves via stable in unstable itemsJane Lusby-4/+13
2022-07-08Auto merge of #98614 - oli-obk:take_unsound_opaque_types, r=wesleywiserbors-4/+15
don't succeed `evaluate_obligation` query if new opaque types were registered fixes #98608 fixes #98604 The root cause of all this is that in type flag computation we entirely ignore nongeneric things like struct fields and the signature of function items. So if a flag had to be set for a struct if it is set for a field, that will only happen if the field is generic, as only the generic parameters are checked. I now believe we cannot use type flags to handle opaque types. They seem like the wrong tool for this. Instead, this PR replaces the previous logic by adding a new variant of `EvaluatedToOk`: `EvaluatedToOkModuloOpaqueTypes`, which says that there were some opaque types that got hidden types bound, but that binding may not have been legal (because we don't know if the opaque type was in its defining scope or not).
2022-07-08Create a custom layout path for UnsafeCell instead of piggy backing on the ↵Oli Scherer-21/+39
layout_scalar_valid_range logic
2022-07-08Only register hidden types for opaque types from the current crate, nothing ↵Oli Scherer-0/+1
else would work anyway.
2022-07-08Rollup merge of #98794 - compiler-errors:conflicting-param-env, ↵Dylan DPC-1/+9
r=michaelwoerister Highlight conflicting param-env candidates This could probably be further improved by noting _why_ equivalent param-env candidates (modulo regions) leads to ambiguity. Fixes #98786
2022-07-08Add `SourceScope::inlined_instance`Tomasz Miąsko-0/+16
2022-07-08Rollup merge of #99019 - pierwill:doc-mir-statement, r=cjgillotMatthias Krüger-1/+4
Add doc comments in `rustc_middle::mir`
2022-07-08Rollup merge of #98795 - jackh726:lexical_region_resolve_cleanup, ↵Matthias Krüger-0/+13
r=compiler-errors A few cleanups Each commit is (mostly) self-explanatory. These changes have come as I try to remove `ReEmpty` (#98559).
2022-07-08Highlight conflicting param-env candidatesMichael Goulet-1/+9
2022-07-08Auto merge of #98482 - cjgillot:short-struct-span-closure, r=estebankbors-0/+1
Shorten def_span of closures to just their header Continuation of https://github.com/rust-lang/rust/pull/93967.
2022-07-07Add bound_const_param_defaultJack Huey-2/+6
2022-07-07Move EarlyBinder calls in rustc_typeck::outlives a bit further upJack Huey-0/+4
2022-07-07Move is_free and is_free_or_static to Region, change resolve_var to ↵Jack Huey-0/+13
resolve_region, and remove RootEmptyRegion
2022-07-07Auto merge of #99024 - matthiaskrgr:rollup-8ygpcpg, r=matthiaskrgrbors-90/+89
Rollup of 9 pull requests Successful merges: - #97917 (Implement ExitCodeExt for Windows) - #98844 (Reword comments and rename HIR visiting methods.) - #98979 (interpret: use AllocRange in UninitByteAccess) - #98986 (Fix missing word in comment) - #98994 (replace process exit with more detailed exit in src/bootstrap/*.rs) - #98995 (Add a test for #80471) - #99002 (suggest adding a derive for #[default] applied to variants) - #99004 (Add a test for #70408) - #99017 (Replace boolean argument for print_where_clause with an enum to make code more clear) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-07-07Miscellaneous inlining improvementsTomasz Miąsko-0/+8
Add `#[inline]` to a few trivial non-generic methods from a perf report that otherwise wouldn't be candidates for inlining.
2022-07-07Rollup merge of #98979 - RalfJung:more-alloc-range, r=oli-obkMatthias Krüger-60/+51
interpret: use AllocRange in UninitByteAccess also use nice new format string syntax in `interpret/error.rs`, and use the `#` flag to add `0x` prefixes where applicable. r? ``@oli-obk``
2022-07-07Rollup merge of #98844 - cjgillot:deep-visit, r=jyn514Matthias Krüger-30/+38
Reword comments and rename HIR visiting methods. Sparked by this discussion in [zulip](https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Confused.20by.20comment.20on.20.60deep_visit_item_likes_in_module.60) r? ``@jyn514`` ``@camsteffen``
2022-07-07Auto merge of #95573 - cjgillot:lower-query, r=michaelwoeristerbors-73/+140
Make lowering a query Split from https://github.com/rust-lang/rust/pull/88186. This PR refactors the relationship between lowering and the resolver outputs in order to make lowering itself a query. In a first part, lowering is changed to avoid modifying resolver outputs, by maintaining its own data structures for creating new `NodeId`s and so. Then, the `TyCtxt` is modified to allow creating new `LocalDefId`s from inside it. This is done by: - enclosing `Definitions` in a lock, so as to allow modification; - creating a query `register_def` whose purpose is to declare a `LocalDefId` to the query system. See `TyCtxt::create_def` and `TyCtxt::iter_local_def_id` for more detailed explanations of the design.
2022-07-07Add doc comments in `rustc_middle::mir`pierwill-1/+4
2022-07-07Reword comments and rename HIR visiting methods.Camille GILLOT-30/+38
2022-07-07`UnsafeCell` now has no niches, ever.Oli Scherer-31/+38
2022-07-07not knowing about opaque types is worse than not knowing about regions, make ↵Oli Scherer-2/+2
sure we don't accidentally mark something as ok-modulo-regions if there are opaque types involved
2022-07-07Shorten span for closures.Camille GILLOT-0/+1
2022-07-07Move `dominators` from Body to BasicBlocksTomasz Miąsko-6/+7
2022-07-07Move `switch_sources` from Body to BasicBlocksTomasz Miąsko-8/+0
2022-07-07Move `predecessors` from Body to BasicBlocksTomasz Miąsko-7/+1
2022-07-07Move `is_cfg_cyclic` from Body to BasicBlocksTomasz Miąsko-6/+0
2022-07-07Make MIR basic blocks field publicTomasz Miąsko-154/+169
This makes it possible to mutably borrow different fields of the MIR body without resorting to methods like `basic_blocks_local_decls_mut_and_var_debug_info`. To preserve validity of control flow graph caches in the presence of modifications, a new struct `BasicBlocks` wraps together basic blocks and control flow graph caches. The `BasicBlocks` dereferences to `IndexVec<BasicBlock, BasicBlockData>`. On the other hand a mutable access requires explicit `as_mut()` call.
2022-07-07Auto merge of #98487 - cjgillot:variance-nohir, r=wesleywiserbors-0/+9
Do not fetch HIR to compute variances. Everything can be done using higher-level queries. This simplifies the code, and should allow better incremental caching.
2022-07-06record LocalDefId of closureMiguel Guarniz-8/+4
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-07-06gather body ownersMiguel Guarniz-16/+95
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-07-06Remove dead code.Camille GILLOT-15/+0
2022-07-06Reword create_def comment.Camille GILLOT-6/+13
2022-07-06Use a dedicated DepKind for the forever-red node.Camille GILLOT-0/+4
2022-07-06Comment untracked_crate.Camille GILLOT-0/+2
2022-07-06Create a forever red node and use it to force side effects.Camille GILLOT-24/+6
2022-07-06Make AST lowering a query.Camille GILLOT-7/+19