summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty
AgeCommit message (Collapse)AuthorLines
2023-04-14Rollup merge of #110299 - kylematsuda:earlybinder-impl-subject, ↵Matthias Krüger-4/+0
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-3/+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 tcx.impl_subject return EarlyBinder, remove bound_impl_subject, rename ↵Kyle Matsuda-4/+0
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-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-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-1/+1
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-3/+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-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-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-10Fix typos in compilerDaniPopes-1/+1
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-09Remove identity castsNilstrieb-2/+2
2023-04-09Fix some clippy::complexityNilstrieb-2/+2
2023-04-09Auto merge of #109500 - petrochenkov:modchainld, r=oli-obkbors-1/+1
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-1/+1
2023-04-07Add feature gatekadmin-7/+9
2023-04-07Add a size assertion for `RegionKind`.Nicholas Nethercote-4/+11
2023-04-06Remove u32 on BoundTyKind::AnonJack Huey-9/+5
2023-04-06Remove index from BrAnonJack Huey-13/+7
2023-04-06Remove expect_anon and expect_anon_placeholder in favor of varJack Huey-18/+0
2023-04-06Use BoundTy and BoundRegion instead of kind of PlaceholderTy and ↵Jack Huey-11/+18
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/+23
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-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-06Don't rely on `Debug` impl for `Erased`John Kåre Alsaker-0/+1
2023-04-06Erase query cache valuesJohn Kåre Alsaker-12/+22
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-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-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-03Auto merge of #109819 - scottmcm:index-slice, r=WaffleLapkinbors-2/+2
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-03fix(middle): emit error rather than delay bug when reaching limitbohan-5/+9
2023-04-02Use `&IndexSlice` instead of `&IndexVec` where possibleScott McMurray-2/+2
All the same reasons as for `[T]`: more general, less pointer chasing, and `&mut IndexSlice` emphasizes that it doesn't change *length*.
2023-04-01use and_then/flat_map for map().flatten()Matthias Krüger-1/+1
2023-03-31Auto merge of #109762 - scottmcm:variantdef-indexvec, r=WaffleLapkinbors-25/+26
Update `ty::VariantDef` to use `IndexVec<FieldIdx, FieldDef>` And while doing the updates for that, also uses `FieldIdx` in `ProjectionKind::Field` and `TypeckResults::field_indices`. There's more places that could use it (like `rustc_const_eval` and `LayoutS`), but I tried to keep this PR from exploding to *even more* places. Part 2/? of https://github.com/rust-lang/compiler-team/issues/606
2023-03-31Auto merge of #109750 - compiler-errors:deep-reject-less-permissive-num-var, ↵bors-0/+4
r=lcnr numeric vars can only be unified with numerical types in deep reject Don't consider numeric vars (int and float vars) to unify with non-numeric types during deep reject. This helps us reject incompatible impls sooner.
2023-03-30Auto merge of #109740 - ↵bors-1/+5
compiler-errors:new-solver-deep-reject-placeholder-consts, r=lcnr Don't ICE on placeholder consts in deep reject Since we canonicalize const params into placeholder consts, we need to be able to handle them during deep reject. r? `@lcnr` (though maybe `@oli-obk` can look at this one too, if he wants 😸) Fixes compiler-errors/next-solver-hir-issues#10
2023-03-30Update `ty::VariantDef` to use `IndexVec<FieldIdx, FieldDef>`Scott McMurray-25/+26
And while doing the updates for that, also uses `FieldIdx` in `ProjectionKind::Field` and `TypeckResults::field_indices`. There's more places that could use it (like `rustc_const_eval` and `LayoutS`), but I tried to keep this PR from exploding to *even more* places. Part 2/? of https://github.com/rust-lang/compiler-team/issues/606
2023-03-30deep reject only unify numeric var with concrete numericMichael Goulet-0/+4