about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty
AgeCommit message (Collapse)AuthorLines
2023-12-05Remove `#[rustc_host]`, use internal desugaringDeadbeef-1/+1
2023-12-03rustc: Harmonize `DefKind` and `DefPathData`Vadim Petrochenkov-5/+6
`DefPathData::(ClosureExpr,ImplTrait)` are renamed to match `DefKind::(Closure,OpaqueTy)`. `DefPathData::ImplTraitAssocTy` is replaced with `DefPathData::TypeNS(kw::Empty)` because both correspond to `DefKind::AssocTy`. It's possible that introducing `(DefKind,DefPathData)::AssocOpaqueTy` could be a better solution, but that would be a much more invasive change. Const generic parameters introduced for effects are moved from `DefPathData::TypeNS` to `DefPathData::ValueNS`, because constants are values. `DefPathData` is no longer passed to `create_def` functions to avoid redundancy.
2023-12-02fix an ICE when a valtree failed to evaluateRalf Jung-2/+10
2023-12-02Auto merge of #118470 - nnethercote:cleanup-error-handlers, r=compiler-errorsbors-16/+18
Cleanup error handlers Mostly by making function naming more consistent. More to do after this, but this is enough for one PR. r? compiler-errors
2023-12-02Rename `LayoutCalculator::delay_bug` as `LayoutCalculator::delayed_bug`.Nicholas Nethercote-1/+1
To match with the previous commits.
2023-12-02Rename `Handler::delay_good_path_bug` as `Handler::good_path_delayed_bug`.Nicholas Nethercote-1/+1
In line with the previous commits.
2023-12-02Rename `HandlerInner::delay_span_bug` as `HandlerInner::span_delayed_bug`.Nicholas Nethercote-14/+16
Because the corresponding `Level` is `DelayedBug` and `span_delayed_bug` follows the pattern used everywhere else: `span_err`, `span_warning`, etc.
2023-12-01vis note for no pub reexports glob importbohan-0/+17
2023-11-28Add with_opt_const_effect_param helper, simplifyMichael Goulet-0/+17
2023-11-28Fix PartialEq args when #[const_trait] is enabledMichael Goulet-0/+34
2023-11-28resolve: Feed the `def_kind` query immediately on `DefId` creationVadim Petrochenkov-3/+5
2023-11-27Rollup merge of #118340 - compiler-errors:tweaks, r=lqdTakayuki Maeda-10/+10
Use helper functions in `pretty.rs` instead of accessing the `Cell`s manually Pulled this out of another PR that I never landed.
2023-11-26Use helpersMichael Goulet-10/+10
2023-11-26Auto merge of #118316 - Mark-Simulacrum:delete-copy-to-upvars, r=cjgillotbors-0/+7
Remove borrowck Upvar duplication This cuts out an extra allocation and copying over from the already cached closure capture information.
2023-11-26Remove Upvar duplicationMark Rousskov-0/+7
This cuts out an extra allocation and copying over from the already cached closure capture information.
2023-11-26Auto merge of #118319 - GuillaumeGomez:rollup-vte50yq, r=GuillaumeGomezbors-15/+20
Rollup of 4 pull requests Successful merges: - #118296 (rustdoc: replace `elemIsInParent` with `Node.contains`) - #118302 (Clean dead codes) - #118311 (merge `DefKind::Coroutine` into `Defkind::Closure`) - #118318 (Remove myself from users on vacation) r? `@ghost` `@rustbot` modify labels: rollup
2023-11-26Rollup merge of #118311 - bvanjoi:merge_coroutinue_into_closure, r=petrochenkovGuillaume Gomez-15/+20
merge `DefKind::Coroutine` into `Defkind::Closure` Related to #118188 We no longer need to be concerned about the precise type whether it's `DefKind::Closure` or `DefKind::Coroutine`. Furthermore, thanks for the great work done by `@petrochenkov` on investigating https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Why.20does.20it.20hang.20when.20querying.20.EF.BB.BF.60opt_def_kind.60.3F r? `@petrochenkov`
2023-11-26Auto merge of #117301 - saethlin:finish-rmeta-encoding, r=WaffleLapkinbors-0/+4
Call FileEncoder::finish in rmeta encoding Fixes https://github.com/rust-lang/rust/issues/117254 The bug here was that rmeta encoding never called FileEncoder::finish. Now it does. Most of the changes here are needed to support that, since rmeta encoding wants to finish _then_ access the File in the encoder, so finish can't move out. I tried adding a `cfg(debug_assertions)` exploding Drop impl to FileEncoder that checked for finish being called before dropping, but fatal errors cause unwinding so this isn't really possible. If we encounter a fatal error with a dirty FileEncoder, the Drop impl ICEs even though the implementation is correct. If we try to paper over that by wrapping FileEncoder in ManuallyDrop then that just erases the fact that Drop automatically checks that we call finish on all paths. I also changed the name of DepGraph::encode to DepGraph::finish_encoding, because that's what it does and it makes the fact that it is the path to FileEncoder::finish less confusing. r? `@WaffleLapkin`
2023-11-26merge `DefKind::Coroutine` into `DefKind::Closure`bohan-15/+20
2023-11-26rustc: `hir().local_def_id_to_hir_id()` -> `tcx.local_def_id_to_hir_id()` ↵Vadim Petrochenkov-6/+6
cleanup
2023-11-25Rollup merge of #118288 - compiler-errors:is_some_and, r=lqd,dtolnayMichael Goulet-1/+1
Use `is_{some,ok}_and` more in the compiler slightly more fluent-reading code
2023-11-25Rollup merge of #117871 - klensy:unused-pub, r=cjgillotGuillaume Gomez-59/+0
remove unused pub fns This removes some unused `pub fn`; also fixes few obsoleted fn names or added fixmes with reminders to update them.
2023-11-25is_{some,ok}_andMichael Goulet-1/+1
2023-11-25Remove mir::Const::from_anon_constMichael Goulet-0/+4
2023-11-24Separate Nan/Inf floats with _Michael Goulet-2/+5
2023-11-24Auto merge of #118189 - compiler-errors:cache-flags-for-const, r=nnethercotebors-32/+81
Cache flags for `ty::Const` Not sure if this has been attempted yet, but worth a shot. It does make the code simpler in `rustc_type_ir`, since we can assume that consts have a `flags` method that is no-cost. r? `@ghost`
2023-11-23few moreklensy-17/+0
2023-11-23remove unused pub fnklensy-42/+0
2023-11-22Call FileEncoder::finish in rmeta encodingBen Kimock-0/+4
2023-11-22Cache flags for ty::ConstMichael Goulet-32/+81
2023-11-22Auto merge of #118120 - compiler-errors:closure-kind, r=lcnrbors-12/+0
Remove `PredicateKind::ClosureKind` We don't need the `ClosureKind` predicate kind -- instead, `Fn`-family trait goals are left as ambiguous, and we only need to make progress on `FnOnce` projection goals for inference purposes. This is similar to how we do confirmation of `Fn`-family trait and projection goals in the new trait solver, which also doesn't use the `ClosureKind` predicate. Some hacky logic is added in the second commit so that we can keep the error messages the same.
2023-11-22Replace `no_ord_impl` with `orderable`.Nicholas Nethercote-0/+1
Similar to the previous commit, this replaces `newtype_index`'s opt-out `no_ord_impl` attribute with the opt-in `orderable` attribute.
2023-11-22Replace `custom_encodable` with `encodable`.Nicholas Nethercote-0/+2
By default, `newtype_index!` types get a default `Encodable`/`Decodable` impl. You can opt out of this with `custom_encodable`. Opting out is the opposite to how Rust normally works with autogenerated (derived) impls. This commit inverts the behaviour, replacing `custom_encodable` with `encodable` which opts into the default `Encodable`/`Decodable` impl. Only 23 of the 59 `newtype_index!` occurrences need `encodable`. Even better, there were eight crates with a dependency on `rustc_serialize` just from unused default `Encodable`/`Decodable` impls. This commit removes that dependency from those eight crates.
2023-11-22Auto merge of #117582 - compiler-errors:uplift-canonical-var, r=jackh726bors-7/+44
Uplift `CanonicalVarInfo` and friends into `rustc_type_ir` Depends on #117580 and #117578 Uplift `CanonicalVarInfo` and friends into `rustc_type_ir` so they can be consumed by an interner-agnostic `Canonicalizer` implementation for the new trait solver ❤️ r? `@ghost`
2023-11-21Fix `clippy::needless_borrow` in the compilerNilstrieb-34/+32
`x clippy compiler -Aclippy::all -Wclippy::needless_borrow --fix`. Then I had to remove a few unnecessary parens and muts that were exposed now.
2023-11-21Remove ClosureKind predicate kindMichael Goulet-12/+0
2023-11-21Uplift CanonicalVarInfo and friendsMichael Goulet-0/+42
2023-11-21Uplift BoundVarMichael Goulet-7/+2
2023-11-21Auto merge of #118107 - matthiaskrgr:rollup-k5bfkfr, r=matthiaskrgrbors-82/+7
Rollup of 8 pull requests Successful merges: - #117327 (Add documentation for some queries) - #117835 (Note about object lifetime defaults in does not live long enough error) - #117851 (Uplift `InferConst` to `rustc_type_ir`) - #117973 (test: Add test for async-move in 2015 Rust proc macro) - #117992 (Don't require intercrate mode for negative coherence) - #118010 (Typeck break expr even if break is illegal) - #118026 (Don't consider regions in `deref_into_dyn_supertrait` lint) - #118089 (intercrate_ambiguity_causes: handle self ty infer + reservation impls) r? `@ghost` `@rustbot` modify labels: rollup
2023-11-20Rollup merge of #117851 - compiler-errors:uplift-infer-const, r=spastorinoMatthias Krüger-81/+5
Uplift `InferConst` to `rustc_type_ir` We need this in `rustc_type_ir` because the canonicalizer must understand the difference between a const vid and an effect vid. In that way, it's not an implementation detail of the representation of an infer const, but just part of the type ir. If we find out later on that it's better to leave the representation up to the consumer of `rustc_type_ir`, we could abstract `InferConst` (and probably `InferTy` as well) with some traits, but I don't see the benefit of that indirection currently.
2023-11-20Unify defined_lib_features and lib_features queriesMichael Goulet-0/+1
2023-11-20Uplift InferConst to rustc_type_irMichael Goulet-77/+2
2023-11-20Use InferTy from rustc_type_ir unconditionallyMichael Goulet-4/+3
2023-11-19Add documentation for some queriesNilstrieb-1/+2
2023-11-17Auto merge of #117944 - lcnr:region-refactor-uwu, r=BoxyUwUbors-9/+13
some additional region refactorings the commits are selfcontained ✨ r? `@BoxyUwU`
2023-11-17Auto merge of #117278 - lcnr:try-normalize-ty, r=compiler-errorsbors-0/+22
new solver normalization improvements cool beans At the core of this PR is a `try_normalize_ty` which stops for rigid aliases by using `commit_if_ok`. Reworks alias-relate to fully normalize both the lhs and rhs and then equate the resulting rigid (or inference) types. This fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/68 by avoiding the exponential blowup. Also supersedes #116369 by only defining opaque types if the hidden type is rigid. I removed the stability check in `EvalCtxt::evaluate_goal` due to https://github.com/rust-lang/trait-system-refactor-initiative/issues/75. While I personally have opinions on how to fix it, that still requires further t-types/`@nikomatsakis` buy-in, so I removed that for now. Once we've decided on our approach there, we can revert this commit. r? `@compiler-errors`
2023-11-17rename bound region instantiationlcnr-9/+13
- `erase_late_bound_regions` -> `instantiate_bound_regions_with_erased` - `replace_late_bound_regions_X` -> `instantiate_bound_regions_X`
2023-11-17Move `lint_store` from `GlobalCtxt` to `Session`.Nicholas Nethercote-10/+1
This was made possible by the removal of plugin support, which simplified lint store creation. This simplifies the places in rustc and rustdoc that call `describe_lints`, which are early on. The lint store is now built before those places, so they don't have to create their own lint store for temporary use, they can just use the main one.
2023-11-15Auto merge of #117908 - lcnr:region-kind-rename, r=BoxyUwUbors-80/+85
finish `RegionKind` renaming second step of https://github.com/rust-lang/types-team/issues/95 continues the work from #117876. While working on this and I encountered a bunch of further cleanup which I'll either open a tracking issue for or will do in a separate PR: - rewrite the `RegionKind` docs, they still talk about `ReEmpty` and are generally out of date - rename `DescriptionCtx` to `DescriptionCtxt` - what is `CheckRegions::Bound`? - `collect_late_bound_regions` et al - `erase_late_bound_regions` -> `instantiate_bound_regions_with_erased`? - `EraseEarlyRegions` visitor should be removed, feels duplicate r? `@BoxyUwU`
2023-11-14Auto merge of #117849 - compiler-errors:cycle, r=cjgillotbors-5/+5
make `LayoutError::Cycle` carry `ErrorGuaranteed` Addresses a FIXME, and also I think it's wise for error variants to carry their `ErrorGuaranteed` -- makes it easier to use that `ErrorGuaranteed` for creating, e.g. `TyKind::Error` and other error kinds. Splitting out from #117703.