about summary refs log tree commit diff
path: root/compiler/rustc_middle/src
AgeCommit message (Collapse)AuthorLines
2023-04-09Auto merge of #109500 - petrochenkov:modchainld, r=oli-obkbors-4/+28
resolve: Preserve reexport chains in `ModChild`ren This may be potentially useful for - avoiding uses of `hir::ItemKind::Use` (which usually lead to correctness issues) - preserving documentation comments on all reexports, including those from other crates - preserving and checking stability/deprecation info on reexports - all kinds of diagnostics The second commit then migrates some hacky logic from rustdoc to `module_reexports` to make it simpler and more correct. Ideally rustdoc should use `module_reexports` immediately at the top level, so `hir::ItemKind::Use`s are never used. The second commit also fixes issues with https://github.com/rust-lang/rust/pull/109330 and therefore Fixes https://github.com/rust-lang/rust/issues/109631 Fixes https://github.com/rust-lang/rust/issues/109614 Fixes https://github.com/rust-lang/rust/issues/109424
2023-04-08Auto merge of #106281 - JulianKnodt:transmute_const_generics, r=b-naberbors-0/+95
Add ability to transmute (somewhat) with generic consts in arrays Previously if the expression contained generic consts and did not have a directly equivalent type, transmuting the type in this way was forbidden, despite the two sizes being identical. Instead, we should be able to lazily tell if the two consts are identical, and if so allow them to be transmuted. This is done by normalizing the forms of expressions into sorted order of multiplied terms, which is not generic over all expressions, but should handle most cases. This allows for some _basic_ transmutations between types that are equivalent in size without requiring additional stack space at runtime. I only see one other location at which `SizeSkeleton` is being used, and it checks for equality so this shouldn't affect anywhere else that I can tell. See [this Stackoverflow post](https://stackoverflow.com/questions/73085012/transmute-nested-const-generic-array-rust) for what was previously necessary to convert between types. This PR makes converting nested `T -> [T; 1]` transmutes possible, and `[uB*2; N] -> [uB; N * 2]` possible as well. I'm not sure whether this is something that would be wanted, and if it is it definitely should not be insta-stable, so I'd add a feature gate.
2023-04-08rustc_middle: Remove `Option` from `module_reexports` queryVadim Petrochenkov-2/+2
2023-04-08resolve: Preserve reexport chains in `ModChild`renVadim Petrochenkov-2/+26
This may be potentially useful for - avoiding uses of `hir::ItemKind::Use` - preserving documentation comments on all reexports - preserving and checking stability/deprecation info on reexports - all kinds of diagnostics
2023-04-08Remove `remap_env_constness` in queriesDeadbeef-53/+0
2023-04-07Add feature gatekadmin-7/+9
2023-04-07Auto merge of #110036 - jackh726:placeholder_boundvar, r=nnethercotebors-64/+48
Remove u32 on BrAnon and BoundTyKind::Anon in favor of BoundVar on Placeholder types r? `@nnethercote` Better alternative to #110025
2023-04-07Add a size assertion for `RegionKind`.Nicholas Nethercote-4/+11
2023-04-07Auto merge of #102906 - nbdd0121:mir, r=wesleywiser,tmiaskobors-107/+194
Refactor unwind in MIR This makes unwinding from current `Option<BasicBlock>` into ```rust enum UnwindAction { Continue, Cleanup(BasicBlock), Unreachable, Terminate, } ``` cc `@JakobDegen` `@RalfJung` `@Amanieu`
2023-04-06Remove u32 on BoundTyKind::AnonJack Huey-9/+5
2023-04-06Remove index from BrAnonJack Huey-18/+10
2023-04-06Remove expect_anon and expect_anon_placeholder in favor of varJack Huey-24/+4
2023-04-06Use BoundTy and BoundRegion instead of kind of PlaceholderTy and ↵Jack Huey-14/+23
PlaceholderRegion
2023-04-06Auto merge of #110012 - matthiaskrgr:rollup-sgmm5xv, r=matthiaskrgrbors-2/+0
Rollup of 7 pull requests Successful merges: - #109395 (Fix issue when there are multiple candidates for edit_distance_with_substrings) - #109755 (Implement support for `GeneratorWitnessMIR` in new solver) - #109782 (Don't leave a comma at the start of argument list when removing arguments) - #109977 (rustdoc: avoid including line numbers in Google SERP snippets) - #109980 (Derive String's PartialEq implementation) - #109984 (Remove f32 & f64 from MemDecoder/MemEncoder) - #110004 (add `dont_check_failure_status` option in the compiler test) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-04-06Rollup merge of #109984 - scottmcm:less-float, r=NilstriebMatthias Krüger-2/+0
Remove f32 & f64 from MemDecoder/MemEncoder r? ```@Nilstrieb``` since they said (maybe joked) on discord that it's a bug if the compiler uses f32 anywhere 🙃
2023-04-06Auto merge of #109333 - Zoxc:erase-query-cache-values, r=cjgillotbors-12/+362
Erase query cache values This replaces most concrete query values `V` with `MaybeUninit<[u8; { size_of::<V>() }]>` without introducing dynamic dispatch like https://github.com/rust-lang/rust/pull/108638 does. This is split out of https://github.com/rust-lang/rust/pull/108638 so the performance impact of only this change can be measured. r? `@cjgillot`
2023-04-06Auto merge of #108504 - cjgillot:thir-pattern, r=compiler-errors,Nilstriebbors-7/+67
Check pattern refutability on THIR The current `check_match` query is based on HIR, but partially re-lowers HIR into THIR. This PR proposed to use the results of the `thir_body` query to check matches, instead of re-building THIR. Most of the diagnostic changes are spans getting shorter, or commas/semicolons not getting removed. This PR degrades the diagnostic for confusing constants in patterns (`let A = foo()` where `A` resolves to a `const A` somewhere): it does not point ot the definition of `const A` any more.
2023-04-06Address review feedbackGary Guo-10/+11
2023-04-06Rename `Abort` terminator to `Terminate`Gary Guo-13/+59
Unify terminology used in unwind action and terminator, and reflect the fact that a nounwind panic is triggered instead of an immediate abort is triggered for this terminator.
2023-04-06Add `UnwindAction::Terminate`Gary Guo-0/+7
2023-04-06Add `UnwindAction::Unreachable`Gary Guo-18/+36
This also makes eval machine's `StackPopUnwind` redundant so that is replaced.
2023-04-06Refactor unwind from Option to a new enumGary Guo-88/+103
2023-04-06Remove f32 & f64 from MemDecoder/MemEncoderScott McMurray-2/+0
2023-04-06Auto merge of #109915 - scottmcm:layout-indexvec, r=oli-obkbors-1/+2
Use `FieldIdx` in `FieldsShape` Finally got to the main motivating example from https://github.com/rust-lang/compiler-team/issues/606 :)
2023-04-06Fully erase query valuesJohn Kåre Alsaker-15/+135
2023-04-06Address commentsJohn Kåre Alsaker-1/+3
2023-04-06Avoid the assertion in `erase`John Kåre Alsaker-8/+8
2023-04-06Don't rely on `Debug` impl for `Erased`John Kåre Alsaker-10/+2
2023-04-06Erase query cache valuesJohn Kåre Alsaker-12/+248
2023-04-05Auto merge of #109966 - JohnTitor:rollup-eoqjr5j, r=JohnTitorbors-3/+3
Rollup of 6 pull requests Successful merges: - #107236 (Add T-bootstrap label to tools) - #109847 (Only create graphviz nodes for reachable MIR bb's) - #109848 (submodule detection for proper fix on #96188) - #109932 (Source code scrollbar) - #109952 (Move comment about python2 closer to the place it's used) - #109956 (Tweak debug outputs to make debugging new solver easier) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-04-05Rollup merge of #109956 - compiler-errors:tweak-debug-outputs, r=oli-obkYuki Okushi-3/+3
Tweak debug outputs to make debugging new solver easier 1. Move the fields that are "most important" (I know this is subjective) to the beginning of the structs. For goals, I typically care more about the predicate than the param-env (which is significantly longer in debug output). For canonicalized things, I typically care more about what is *being* canonicalized. For a canonical response, I typically care about the response -- or at least, it's typically useful to put it first since it's short and affects the whether the solver recurses or not... 2. Add some more debug and instrument calls to functions to add more structure to tracing lines. r? `@oli-obk` or `@BoxyUwU` (since I think `@lcnr` is on holiday)
2023-04-05Auto merge of #109117 - oli-obk:locks, r=michaelwoeristerbors-1/+2
Avoid a few locks We can use atomics or datastructures tuned for specific access patterns instead of locks. This may be an improvement for parallel rustc, but it's mostly a cleanup making various datastructures only usable in the way they are used right now (append data, never mutate), instead of having a general purpose lock.
2023-04-05Tweak debug outputs to make debugging new solver easierMichael Goulet-3/+3
2023-04-04Use `FieldIdx` in `FieldsShape`Scott McMurray-1/+2
Finally got to the main motivating example from the MCP :)
2023-04-04Rollup merge of #109938 - oli-obk:try_norm, r=compiler-errorsMichael Goulet-3/+3
Move a const-prop-lint specific hack from mir interpret to const-prop-lint and make it fallible fixes #109743 This hack didn't need to live in the mir interpreter. For const-prop-lint it is entirely correct to avoid doing any const prop if normalization fails at this stage. Most likely we couldn't const propagate anything anyway, and if revealing was needed (so opaque types were involved), we wouldn't want to be too smart and leak the hidden type anyway.
2023-04-04Rollup merge of #109901 - cjgillot:validate-debuginfo, r=b-naberMichael Goulet-7/+17
Enforce VarDebugInfo::Place in MIR validation.
2023-04-04A more general implementation of `IntoDiagnosticArg` for `Binder` (Also ↵IQuant-13/+11
removes `DiagArg`, as it's no longer necessary)
2023-04-04Move a const-prop-lint specific hack from mir interpret to const-prop-lint ↵Oli Scherer-3/+3
and make it fallible
2023-04-04Remove a fishy Clone implOli Scherer-1/+2
2023-04-04Add ability to transmute with generic constskadmin-0/+93
Previously if the expression contained generic consts and did not have a directly equivalent type, transmuting the type in this way was forbidden, despite the two sizes being identical. Instead, we should be able to lazily tell if the two consts are identical, and if so allow them to be transmuted.
2023-04-04Remove intercrate and mark_ambiguous from RelationMichael Goulet-30/+10
2023-04-03Enforce VarDebugInfo::Place in MIR validation.Camille GILLOT-7/+17
2023-04-03Auto merge of #109819 - scottmcm:index-slice, r=WaffleLapkinbors-18/+25
Use `&IndexSlice` instead of `&IndexVec` where possible All the same reasons as for `[T]`: more general, less pointer chasing, and `&mut IndexSlice` emphasizes that it doesn't change *length*. r? `@ghost`
2023-04-03Hide warning.Camille GILLOT-2/+2
2023-04-03Add Span to StmtKind::Let.Camille GILLOT-2/+62
2023-04-03Make check_match take a LocalDefId.Camille GILLOT-3/+3
2023-04-03fix(middle): emit error rather than delay bug when reaching limitbohan-5/+17
2023-04-02Use `&IndexSlice` instead of `&IndexVec` where possibleScott McMurray-18/+25
All the same reasons as for `[T]`: more general, less pointer chasing, and `&mut IndexSlice` emphasizes that it doesn't change *length*.
2023-04-02Auto merge of #109849 - scottmcm:more-fieldidx-rebase, r=oli-obkbors-3/+4
Use `FieldIdx` in various things related to aggregates Shrank `AggregateKind` by 8 bytes on x64, since the active field of a union is tracked as an `Option<FieldIdx>` instead of `Option<usize>`. Part 3/? of https://github.com/rust-lang/compiler-team/issues/606 [`IndexSlice`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_index/vec/struct.IndexVec.html#deref-methods-IndexSlice%3CI,+T%3E) was added in https://github.com/rust-lang/rust/pull/109787
2023-04-01Use `FieldIdx` in various things related to aggregatesScott McMurray-3/+4
Shrank `AggregateKind` by 8 bytes on x64, since the active field of a union is tracked as an `Option<FieldIdx>` instead of `Option<usize>`.