summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty
AgeCommit message (Collapse)AuthorLines
2022-07-15Return a FxIndexSet in is_late_bound query.Camille GILLOT-1/+1
This return value is iterated upon by borrowck, hence the need to preserve a deterministic iteration order.
2022-07-15Only register hidden types for opaque types from the current crate, nothing ↵Oli Scherer-0/+1
else would work anyway.
2022-07-15Make `evaluate_obligation` not succeed unconditionally if it registered new ↵Oli Scherer-5/+0
hidden types for opaque types
2022-07-15pessimistically treat all function items as containing an opaque typeOli Scherer-0/+5
2022-05-14Auto merge of #96883 - jackh726:early-binder-2, r=oli-obkbors-36/+170
Add EarlyBinder Chalk has no concept of `Param` (https://github.com/rust-lang/chalk/blob/e0ade19d139bc784384acc6736cd960c91dd55a1/chalk-ir/src/lib.rs#L579) or `ReEarlyBound` (https://github.com/rust-lang/chalk/blob/e0ade19d139bc784384acc6736cd960c91dd55a1/chalk-ir/src/lib.rs#L1308). Everything is just "bound" - the equivalent of rustc's late-bound. It's not completely clear yet whether to move everything to the same time of binder in rustc or add `Param` and `ReEarlyBound` in Chalk. Either way, tracking when we have or haven't already substituted out these in rustc can be helpful. As a first step, I'm just adding a `EarlyBinder` newtype that is required to call `subst`. I also add a couple "transparent" `bound_*` wrappers around a couple query that are often immediately substituted. r? `@nikomatsakis`
2022-05-14Add rustc_on_unimplemented to SubstJack Huey-0/+1
2022-05-14Add bound_explicit_item_bounds and bound_item_boundsJack Huey-6/+42
2022-05-13Add bound_impl_trait_refJack Huey-4/+8
2022-05-13Add bound_fn_sigJack Huey-6/+30
2022-05-13Add bound_type_ofJack Huey-22/+28
2022-05-13Rollup merge of #96989 - cjgillot:defpath-use, r=davidtwcoMatthias Krüger-6/+2
Be more precise than DefPathData::Misc. This variant was used for two unrelated things. Let's make this cleaner.
2022-05-12Correct comment.Camille GILLOT-6/+2
2022-05-12Auto merge of #95562 - lcnr:attr-no-encode, r=davidtwcobors-27/+40
don't encode only locally used attrs Part of https://github.com/rust-lang/compiler-team/issues/505. We now filter builtin attributes before encoding them in the crate metadata in case they should only be used in the local crate. To prevent accidental misuse `get_attrs` now requires the caller to state which attribute they are interested in. For places where that isn't trivially possible, I've added a method `fn get_attrs_unchecked` which I intend to remove in a followup PR. After this pull request landed, we can then slowly move all attributes to only be used in the local crate while being certain that we don't accidentally try to access them from extern crates. cc https://github.com/rust-lang/rust/pull/94963#issuecomment-1082924289
2022-05-10Introduce EarlyBinderJack Huey-40/+103
2022-05-10Use lifetimes on type-alias-impl-trait used in function signatures to infer ↵Oli Scherer-1/+1
output type lifetimes
2022-05-10Auto merge of #94799 - lcnr:list-ty-perf, r=petrochenkovbors-7/+5
update `hash_stable` for `List<Ty<'tcx>>` cc https://github.com/rust-lang/rust/pull/93505#issuecomment-1047538798 this is the hottest part changed since the pre-merge perf run
2022-05-10update clippylcnr-1/+1
2022-05-10only_local: always check for misuselcnr-31/+37
2022-05-10Rollup merge of #96872 - RalfJung:layout-sanity, r=eddybDylan DPC-9/+127
make sure ScalarPair enums have ScalarPair variants; add some layout sanity checks `@eddyb` suggested that it might be reasonable for `ScalarPair` enums to simply adjust the ABI of their variants accordingly, such that the layout invariant Miri expects actually holds. This PR implements that. I should note though that I don't know much about this layout computation code and what non-Miri consumers expect from it, so tread with caution! I also added a function to sanity-check that computed layouts are internally consistent. This helped a lot in figuring out the final shape of this PR, though I am also not 100% sure that these sanity checks are the right ones. Cc `@oli-obk` Fixes https://github.com/rust-lang/rust/issues/96221
2022-05-10add check and don't encode `#[inline]`lcnr-0/+3
2022-05-10fix commentlcnr-3/+3
2022-05-10don't encode only locally used attrslcnr-0/+4
2022-05-09Auto merge of #96473 - lcnr:querify-codegen-fn-attrs, r=cjgillotbors-21/+45
store `codegen_fn_attrs` in crate metadata extracted from #95562 because the change isn't trivial.
2022-05-09also sanity-check Abi::Vector, and slight refactoringRalf Jung-26/+43
2022-05-09reviewlcnr-38/+24
2022-05-09only compute `codegen_fn_attrs` where neededlcnr-1/+38
2022-05-09make sure ScalarPair enums have ScalarPair variants; add some layout sanity ↵Ralf Jung-11/+112
checks
2022-05-09move `panic-in-drop=abort` check for `drop_in_place`lcnr-20/+21
Whether `drop_in_place` can abort does depend on the `panic-in-drop` option while compiling the current crate, not `core`
2022-05-08Remove subst_spannedJack Huey-38/+10
2022-05-07Auto merge of #96094 - Elliot-Roberts:fix_doctests, r=compiler-errorsbors-86/+95
Begin fixing all the broken doctests in `compiler/` Begins to fix #95994. All of them pass now but 24 of them I've marked with `ignore HELP (<explanation>)` (asking for help) as I'm unsure how to get them to work / if we should leave them as they are. There are also a few that I marked `ignore` that could maybe be made to work but seem less important. Each `ignore` has a rough "reason" for ignoring after it parentheses, with - `(pseudo-rust)` meaning "mostly rust-like but contains foreign syntax" - `(illustrative)` a somewhat catchall for either a fragment of rust that doesn't stand on its own (like a lone type), or abbreviated rust with ellipses and undeclared types that would get too cluttered if made compile-worthy. - `(not-rust)` stuff that isn't rust but benefits from the syntax highlighting, like MIR. - `(internal)` uses `rustc_*` code which would be difficult to make work with the testing setup. Those reason notes are a bit inconsistently applied and messy though. If that's important I can go through them again and try a more principled approach. When I run `rg '```ignore \(' .` on the repo, there look to be lots of different conventions other people have used for this sort of thing. I could try unifying them all if that would be helpful. I'm not sure if there was a better existing way to do this but I wrote my own script to help me run all the doctests and wade through the output. If that would be useful to anyone else, I put it here: https://github.com/Elliot-Roberts/rust_doctest_fixing_tool
2022-05-07Auto merge of #96531 - kckeiks:remove-item-like-visitor-from-rustc-typeck, ↵bors-1/+1
r=cjgillot Remove ItemLikeVisitor impls from rustc_typeck Issue #95004 cc `@cjgillot`
2022-05-06remove all usages of hir().def_kindMiguel Guarniz-1/+1
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-03Hide InlineConst's generic arg during printGary Guo-0/+4
The generic arg is for type inference only and shouldn't be exposed to users.
2022-05-02fix most compiler/ doctestsElliot Roberts-86/+95
2022-05-02rustc: Panic by default in `DefIdTree::parent`Vadim Petrochenkov-21/+37
Only crate root def-ids don't have a parent, and in majority of cases the argument of `DefIdTree::parent` cannot be a crate root. So we now panic by default in `parent` and introduce a new non-panicing function `opt_parent` for cases where the argument can be a crate root. Same applies to `local_parent`/`opt_local_parent`.
2022-04-30Save colon span to suggest bounds.Camille GILLOT-0/+13
2022-04-30Store all generic bounds as where predicates.Camille GILLOT-283/+110
2022-04-30Inline WhereClause into Generics.Camille GILLOT-24/+15
2022-04-28Auto merge of #95976 - b-naber:valtree-constval-conversion, r=oli-obkbors-4/+123
Implement Valtree to ConstValue conversion Once we start to use `ValTree`s in the type system we will need to be able to convert them into `ConstValue` instances, which we want to continue to use after MIR construction. r? `@oli-obk` cc `@RalfJung`
2022-04-27combine all unsized types and add another recursive call to process nested ↵b-naber-1/+1
unsized types correctly
2022-04-26TAITs are suggestableMichael Goulet-14/+24
2022-04-26Rollup merge of #94703 - kjetilkjeka:nvptx-kernel-args-abi2, r=nagisaGuillaume Gomez-0/+20
Fix codegen bug in "ptx-kernel" abi related to arg passing I found a codegen bug in the nvptx abi related to that args are passed as ptrs ([see comment](https://github.com/rust-lang/rust/issues/38788#issuecomment-1048999928)), this is not as specified in the [ptx-interoperability doc](https://docs.nvidia.com/cuda/ptx-writers-guide-to-interoperability/) or how C/C++ does it. It will also almost always fail in practice since device/host uses different memory spaces for most hardware. This PR fixes the bug and add tests for passing structs to ptx kernels. I observed that all nvptx assembly tests had been marked as [ignore a long time ago](https://github.com/rust-lang/rust/pull/59752#issuecomment-501713428). I'm not sure if the new one should be marked as ignore, it passed on my computer but it might fail if ptx-linker is missing on the server? I guess this is outside scope for this PR and should be looked at in a different issue/PR. I only fixed the nvptx64-nvidia-cuda target and not the potential code paths for the non-existing 32bit target. Even though 32bit nvptx is not a supported target there are still some code under the hood supporting codegen for 32 bit ptx. I was advised to create an MCP to find out if this code should be removed or updated. Perhaps ``@RDambrosio016`` would have interest in taking a quick look at this.
2022-04-26add hacky closure to struct_tail_with_normalize in order to allow us to walk ↵b-naber-4/+12
valtrees in lockstep with the type
2022-04-26Rollup merge of #96149 - est31:remove_unused_macro_matchers, r=petrochenkovDylan DPC-3/+0
Remove unused macro rules Removes rules of internal macros that weren't triggered.
2022-04-25Auto merge of #95604 - nbdd0121:used2, r=petrochenkovbors-1/+1
Generate synthetic object file to ensure all exported and used symbols participate in the linking Fix #50007 and #47384 This is the synthetic object file approach that I described in https://github.com/rust-lang/rust/pull/95363#issuecomment-1079932354, allowing all exported and used symbols to be linked while still allowing them to be GCed. Related #93791, #95363 r? `@petrochenkov` cc `@carbotaniuman`
2022-04-23Compute has_pub_restricted in the resolver.Camille GILLOT-0/+2
2022-04-23Drop vis in Item.Camille GILLOT-17/+1
2022-04-22Auto merge of #96197 - erikdesjardins:scalarpairenum, r=oli-obkbors-16/+21
Mark payload fields of ScalarPair enums as Scalar::Union when they're not always initialized Fixes #96158 r? `@RalfJung`
2022-04-21implement valtree -> constvalue conversionb-naber-0/+3
2022-04-21add helper methods on ValTreeb-naber-0/+16