summary refs log tree commit diff
path: root/compiler/rustc_middle/src
AgeCommit message (Collapse)AuthorLines
2023-05-31add FIXMElcnr-0/+5
2023-05-31unique borrows are mutating useslcnr-7/+3
2023-05-25update recursion depth in `confirm_candidate`lcnr-3/+20
(cherry picked from commit 1708ad65a45fa39aa177c5f015415a9440c18912)
2023-04-14Rollup merge of #110299 - kylematsuda:earlybinder-impl-subject, ↵Matthias Krüger-10/+6
r=compiler-errors Switch to `EarlyBinder` for `impl_subject` query Part of the work to finish https://github.com/rust-lang/rust/issues/105779. Several queries `X` have a `bound_X` variant that wraps the output in `EarlyBinder`. This adds `EarlyBinder` to the return type of the `impl_subject` query and removes `bound_impl_subject`. r? ```@lcnr```
2023-04-14Auto merge of #110160 - petrochenkov:notagain2, r=cjgillotbors-9/+25
resolve: Pre-compute non-reexport module children Instead of repeating the same logic by walking HIR during metadata encoding. The only difference is that we are no longer encoding `macro_rules` items, but we never currently need them as a part of this list. They can be encoded separately if this need ever arises. `module_reexports` is also un-querified, because I don't see any reasons to make it a query, only overhead.
2023-04-13make impl_subject more readableKyle Matsuda-6/+4
2023-04-13make tcx.impl_subject return EarlyBinder, remove bound_impl_subject, rename ↵Kyle Matsuda-10/+8
usages of bound_impl_subject to impl_subject
2023-04-13Rollup merge of #110233 - nbdd0121:intrinsic, r=tmiaskoMatthias Krüger-2/+3
Make rust-intrinsic ABI unwindable Fix #104451, fix https://github.com/rust-lang/miri/issues/2839 r? `@RalfJung`
2023-04-13Rollup merge of #110218 - nnethercote:rm-ToRegionVid, r=compiler-errorsMatthias Krüger-80/+5
Remove `ToRegionVid` r? ```@compiler-errors```
2023-04-13Remove some unused type folders.Nicholas Nethercote-77/+2
I'm surprised the compiler doesn't warn about these. It appears having an `impl` on a struct is enough to avoid a warning about it never being constructed.
2023-04-13Make `Region::as_var` infallible.Nicholas Nethercote-3/+3
It's what all the call sites require.
2023-04-13Auto merge of #109466 - davidlattimore:inline-arg-via-var-debug-info, ↵bors-0/+6
r=wesleywiser Preserve argument indexes when inlining MIR We store argument indexes on VarDebugInfo. Unlike the previous method of relying on the variable index to know whether a variable is an argument, this survives MIR inlining. We also no longer check if var.source_info.scope is the outermost scope. When a function gets inlined, the arguments to the inner function will no longer be in the outermost scope. What we care about though is whether they were in the outermost scope prior to inlining, which we know by whether we assigned an argument index. Fixes #83217 I considered using `Option<NonZeroU16>` instead of `Option<u16>` to store the index. I didn't because `TypeFoldable` isn't implemented for `NonZeroU16` and because it looks like due to padding, it currently wouldn't make any difference. But I indexed from 1 anyway because (a) it'll make it easier if later it becomes worthwhile to use a `NonZeroU16` and because the arguments were previously indexed from 1, so it made for a smaller change. This is my first PR on rust-lang/rust, so apologies if I've gotten anything not quite right.
2023-04-12Rollup merge of #110175 - nnethercote:symbol-cleanups, r=jackh726Matthias Krüger-5/+10
Symbol cleanups r? ```@jackh726``` cc ```@b-naber```
2023-04-12Rollup merge of #110153 - DaniPopes:compiler-typos, r=NilstriebMatthias Krüger-8/+8
Fix typos in compiler I ran [`typos -w compiler`](https://github.com/crate-ci/typos) to fix typos in the `compiler` directory. Refs #110150
2023-04-12Make rust-intrinsic ABI unwindableGary Guo-2/+3
Stick `#[rustc_nounwind]` to all except `const_eval_select` to undo the change for all other intrinsics.
2023-04-12resolve: Pre-compute non-reexport module childrenVadim Petrochenkov-9/+25
Instead of repeating the same logic by walking HIR during metadata encoding. The only difference is that we are no longer encoding `macro_rules` items, but we never currently need them as a part of this list. They can be encoded separately if this need ever arises. `module_reexports` is also un-querified, because I don't see any reasons to make it a query, only overhead.
2023-04-12Auto merge of #107614 - ↵bors-4/+10
compiler-errors:allow-elaborator-to-filter-only-super-traits, r=oli-obk Split implied and super predicate queries, then allow elaborator to filter only supertraits Split the `super_predicates_of` query into a new `implied_predicates_of` query. The former now only returns the *real* supertraits of a trait alias, and the latter now returns the implied predicates (which include all of the `where` clauses of the trait alias). The behavior of these queries is identical for regular traits. Now that the two queries are split, we can add a new filter method to the elaborator, `filter_only_self()`, which can be used in instances that we need only the *supertrait* predicates, such as during the elaboration used in closure signature deduction. This toggles the usage of `super_predicates_of` instead of `implied_predicates_of` during elaboration of a trait predicate. This supersedes #104745, and fixes the four independent bugs identified in that PR. Fixes #104719 Fixes #106238 Fixes #110023 Fixes #109514 r? types
2023-04-11Rollup merge of #110126 - compiler-errors:new-solver-safe-transmute, r=oli-obkMichael Goulet-0/+3
Support safe transmute in new solver Basically copies the same implementation as the old solver, but instead of looking for param types, we look for type or const placeholders.
2023-04-11Split implied and super predicate queriesMichael Goulet-0/+6
2023-04-11Split super_predicates_that_define_assoc_type query from super_predicates_ofMichael Goulet-4/+4
2023-04-11Add `sym::anon`.Nicholas Nethercote-1/+1
2023-04-11Introduce `Region::get_name_or_anon`.Nicholas Nethercote-5/+10
For a common pattern.
2023-04-11Preserve argument indexes when inlining MIRDavid Lattimore-0/+6
We store argument indexes on VarDebugInfo. Unlike the previous method of relying on the variable index to know whether a variable is an argument, this survives MIR inlining. We also no longer check if var.source_info.scope is the outermost scope. When a function gets inlined, the arguments to the inner function will no longer be in the outermost scope. What we care about though is whether they were in the outermost scope prior to inlining, which we know by whether we assigned an argument index.
2023-04-11Auto merge of #109778 - petrochenkov:allkind, r=cjgillotbors-3/+18
rustc_middle: Document which exactly `DefId`s don't have `DefKind`s I don't currently have time to investigate when and how to create these missing HIR nodes, but if someone else could do that it would be great.
2023-04-10Fix typos in compilerDaniPopes-8/+8
2023-04-10Auto merge of #108698 - IntQuant:issue-100717-infer-6, r=davidtwcobors-8/+24
Migrating rustc_infer to session diagnostics (part 5) `@rustbot` label +A-translation cc https://github.com/rust-lang/rust/issues/100717
2023-04-10Support safe transmute in new solverMichael Goulet-0/+3
2023-04-10Call `into_diagnostic_arg` on Binder's contained value directly.IQuant-3/+21
2023-04-10Rollup merge of #110124 - Nilstrieb:📎-told-me-so, r=compiler-errorsDylan DPC-40/+37
Some clippy fixes in the compiler Best reviewed commit-by-commit 📎.
2023-04-10review + some small stufflcnr-3/+13
2023-04-10prioritize param-env candidateslcnr-0/+12
2023-04-09fixup! Improve `Allocation::hashNilstrieb-1/+1
2023-04-09Convert manual loop into `while let`Nilstrieb-11/+1
2023-04-09Remove identity castsNilstrieb-6/+6
2023-04-09Fix some clippy::complexityNilstrieb-5/+5
2023-04-09Improve `Allocation::hashNilstrieb-9/+17
Exhaustively destructure and ignore `()`
2023-04-09Delete useless loopNilstrieb-9/+8
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-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