about summary refs log tree commit diff
path: root/compiler/rustc_middle/src
AgeCommit message (Collapse)AuthorLines
2023-04-17Auto merge of #110367 - saethlin:no-truncations, r=oli-obkbors-1/+1
Remove some suspicious cast truncations These truncations were added a long time ago, and as best I can tell without a perf justification. And with rust-lang/rust#110410 it has become perf-neutral to not truncate anymore. We worked hard for all these bits, let's use them.
2023-04-16Remove some unnecessary hash truncationsBen Kimock-1/+1
2023-04-16Remove #[alloc_error_handler] from the compiler and libraryAmanieu d'Antras-11/+0
2023-04-16Auto merge of #110405 - fee1-dead-contrib:rollup-9rkree6, r=fee1-deadbors-5/+181
Rollup of 4 pull requests Successful merges: - #110397 (Move some utils out of `rustc_const_eval`) - #110398 (use matches! macro in more places) - #110400 (more clippy fixes: clippy::{iter_cloned_collect, unwarp_or_else_defau…) - #110402 (Remove the loop in `Align::from_bytes`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-04-16Rollup merge of #110345 - nnethercote:rm-Super-impls-for-Region, ↵fee1-dead-21/+4
r=compiler-errors Remove `TypeSuper{Foldable,Visitable}` impls for `Region`. These traits exist so that folders/visitors can recurse into types of interest: binders, types, regions, predicates, and consts. But `Region` is non-recursive and cannot contain other types of interest, so its methods in these traits are trivial. This commit inlines and removes those trivial methods. r? `@compiler-errors`
2023-04-16Rollup merge of #109665 - fee1-dead-contrib:rm-remap-queries, r=oli-obkfee1-dead-53/+0
Remove `remap_env_constness` in queries This removes some of the complexities with const traits. #88119 used to be caused by this but was fixed by `param_env = param_env.without_const()`.
2023-04-16Move some utils out of `rustc_const_eval`Nilstrieb-5/+181
This allows us to get rid of the `rustc_const_eval->rustc_borrowck` dependency edge which was delaying the compilation of borrowck. The added utils in `rustc_middle` are small and should not affect compile times there.
2023-04-16Various minor Idx-related tweaksScott McMurray-0/+10
Nothing particularly exciting here, but a couple of things I noticed as I was looking for more index conversions to simplify.
2023-04-16Rollup merge of #110387 - nnethercote:rm-use-rustc_hir-as-ast, r=fee1-deadfee1-dead-7/+7
Don't `use rustc_hir as ast`(!) It makes for confusing code. This was introduced in a large commit in #67886 that rearranged a lot of `use` statements. I suspect it was an accident.
2023-04-16Don't `use rustc_hir as ast`(!)Nicholas Nethercote-7/+7
It makes for confusing code. This was introduced in a large commit in #67886 that rearranged a lot of `use` statements. I suspect it was an accident.
2023-04-16Simplify `CloneLiftImpls` and `TrivialTypeTraversalImpls`.Nicholas Nethercote-41/+20
They both allow for a lifetime other than `'tcx`, but this isn't needed.
2023-04-16Remove `TypeSuper{Foldable,Visitable}` impls for `Region`.Nicholas Nethercote-21/+4
These traits exist so that folders/visitors can recurse into types of interest: binders, types, regions, predicates, and consts. But `Region` is non-recursive and cannot contain other types of interest, so its methods in these traits are trivial. This commit inlines and removes those trivial methods.
2023-04-14Use `ptr::Alignment` for extra coolness pointsMaybe Waffle-4/+7
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-12Lift `Pointer`'s requirement for the pointer to be thinMaybe Waffle-17/+14
fat pointers rule!
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-11Bless tagged pointers (comply to strict provenance)Maybe Waffle-9/+7
2023-04-11Add `bits_for` helper for tagged pointers & fixup docsMaybe Waffle-1/+2
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