about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty/context.rs
AgeCommit message (Collapse)AuthorLines
2023-12-20resolve: Eagerly feed closure visibilitiesVadim Petrochenkov-4/+21
Also factor out all tcx-dependent operations performed for every created definition into `TyCtxt::create_def`
2023-12-15Fix commentsMichael Goulet-4/+0
2023-12-15Don't pass lint back out of lint decoratorMichael Goulet-8/+6
2023-12-15Rollup merge of #118888 - compiler-errors:uplift-more-things, r=jackh726Matthias Krüger-8/+1
Uplift `TypeAndMut` and `ClosureKind` to `rustc_type_ir` Uplifts `TypeAndMut` and `ClosureKind` I know I said I was just going to get rid of `TypeAndMut` (https://github.com/rust-lang/types-team/issues/124) but I think this is much simpler, lol r? `@jackh726` or `@lcnr`
2023-12-14Move special methods from ClosureKind back into rustcMichael Goulet-24/+0
2023-12-14rename `-Ztrait-solver` to `-Znext-solver`lcnr-6/+2
2023-12-14Auto merge of #117749 - aliemjay:perf-canon-cache, r=lcnrbors-1/+4
cache param env canonicalization Canonicalize ParamEnv only once and store it. Then whenever we try to canonicalize `ParamEnvAnd<'tcx, T>` we only have to canonicalize `T` and then merge the results. Prelimiary results show ~3-4% savings in diesel and serde benchmarks. Best to review commits individually. Some commits have a short description. Initial implementation had a soundness bug (https://github.com/rust-lang/rust/pull/117749#issuecomment-1840453387) due to cache invalidation: - When canonicalizing `Ty<'?0>` we first try to resolve region variables in the current InferCtxt which may have a constraint `?0 == 'static`. This means that we register `Ty<'?0> => Canonical<Ty<'static>>` in the cache, which is obviously incorrect in another inference context. - This is fixed by not doing region resolution when canonicalizing the query *input* (vs. response), which is the only place where ParamEnv is used, and then in a later commit we *statically* guard against any form of inference variable resolution of the cached canonical ParamEnv's. r? `@ghost`
2023-12-13global param_env canonicalization cacheAli MJ Al-Nasrawy-1/+4
2023-12-12Uplift TypeAndMutMichael Goulet-8/+1
2023-12-12Uplift ClosureKindMichael Goulet-0/+24
2023-12-12Move some methods from `tcx.hir()` to `tcx`zetanumbers-6/+5
Renamings: - find -> opt_hir_node - get -> hir_node - find_by_def_id -> opt_hir_node_by_def_id - get_by_def_id -> hir_node_by_def_id Fix rebase changes using removed methods Use `tcx.hir_node_by_def_id()` whenever possible in compiler Fix clippy errors Fix compiler Apply suggestions from code review Co-authored-by: Vadim Petrochenkov <vadim.petrochenkov@gmail.com> Add FIXME for `tcx.hir()` returned type about its removal Simplify with with `tcx.hir_node_by_def_id`
2023-12-09Auto merge of #118763 - matthiaskrgr:rollup-mgyf5hp, r=matthiaskrgrbors-0/+25
Rollup of 6 pull requests Successful merges: - #117586 (Uplift the (new solver) canonicalizer into `rustc_next_trait_solver`) - #118502 (fix: correct the arg for 'suggest to use associated function syntax' diagnostic) - #118694 (Add instance evaluation and methods to read an allocation in StableMIR) - #118715 (privacy: visit trait def id of projections) - #118730 (recurse into refs when comparing tys for diagnostics) - #118736 (temporarily revert "ice on ambguity in mir typeck") r? `@ghost` `@rustbot` modify labels: rollup
2023-12-08Rollup merge of #117586 - compiler-errors:the-canonicalizer, r=lcnrMatthias Krüger-0/+25
Uplift the (new solver) canonicalizer into `rustc_next_trait_solver` Uplifts the new trait solver's canonicalizer into a new crate called `rustc_next_trait_solver`. The crate name is literally a bikeshed-avoidance name, so let's not block this PR on that -- renames are welcome later. There are a host of other changes that were required to make this possible: * Expose a `ConstTy` trait to get the `Interner::Ty` from a `Interner::Const`. * Expose some constructor methods to construct `Bound` variants. These are currently methods defined on the interner themselves, but they could be pulled into traits later. * Expose a `IntoKind` trait to turn a `Ty`/`Const`/`Region` into their corresponding `*Kind`s. * Some minor tweaks to other APIs in `rustc_type_ir`. The canonicalizer code itself is best reviewed **with whitespace ignored.** r? ``@lcnr``
2023-12-08Auto merge of #117681 - Zoxc:tcx-sync, r=compiler-errorsbors-1/+13
Explicitly implement `DynSync` and `DynSend` for `TyCtxt` This is an attempt to short circuit trait resolution. It should get a perf run for bootstrap impact.
2023-12-08FeedbackMichael Goulet-21/+10
- Take more things by self, not &self - Clone more things - Rework namespacing so we can use `ty::` in the canonicalizer
2023-12-08Uplift canonicalizer into new trait solver crateMichael Goulet-0/+36
2023-12-08Implement `async gen` blocksMichael Goulet-1/+6
2023-12-07Explicitly implement `DynSync` and `DynSend` for `TyCtxt`John Kåre Alsaker-1/+13
2023-12-07add unused `NormalizesTo` predicatelcnr-0/+1
2023-12-05Remove `#[rustc_host]`, use internal desugaringDeadbeef-1/+1
2023-12-03rustc: Harmonize `DefKind` and `DefPathData`Vadim Petrochenkov-1/+2
`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-02Rename `HandlerInner::delay_span_bug` as `HandlerInner::span_delayed_bug`.Nicholas Nethercote-2/+4
Because the corresponding `Level` is `DelayedBug` and `span_delayed_bug` follows the pattern used everywhere else: `span_err`, `span_warning`, etc.
2023-11-28resolve: Feed the `def_kind` query immediately on `DefId` creationVadim Petrochenkov-0/+5
2023-11-26Auto merge of #118319 - GuillaumeGomez:rollup-vte50yq, r=GuillaumeGomezbors-0/+4
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-0/+4
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-0/+4
2023-11-26rustc: `hir().local_def_id_to_hir_id()` -> `tcx.local_def_id_to_hir_id()` ↵Vadim Petrochenkov-2/+2
cleanup
2023-11-22Call FileEncoder::finish in rmeta encodingBen Kimock-0/+4
2023-11-22Cache flags for ty::ConstMichael Goulet-8/+44
2023-11-20Uplift InferConst to rustc_type_irMichael Goulet-1/+0
2023-11-20Use InferTy from rustc_type_ir unconditionallyMichael Goulet-4/+3
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-14finish `RegionKind` renamelcnr-19/+15
- `ReFree` -> `ReLateParam` - `ReEarlyBound` -> `ReEarlyParam`
2023-11-13rename `ReLateBound` to `ReBound`lcnr-2/+2
other changes: - `Region::new_late_bound` -> `Region::new_bound` - `Region::is_late_bound` -> `Region::is_bound`
2023-11-04No lifetime on PlaceholderConstMichael Goulet-1/+1
2023-10-31Enums in offset_of: update based on est31, scottmcm & llogiq reviewGeorge Bateman-4/+4
2023-10-31Support enum variants in offset_of!George Bateman-1/+12
2023-10-27Make `gen` blocks implement the `Iterator` traitOli Scherer-0/+11
2023-10-25Rollup merge of #117008 - compiler-errors:canonical, r=lcnrMatthias Krüger-1/+2
Uplift `Canonical` to `rustc_type_ir` I plan on moving the new trait solver's canonicalizer into either `rustc_type_ir` or a child crate. One dependency on this is lifting `Canonical<V>` to `rustc_type_ir` so we can actually name the canonicalized values. I may also later lift `CanonicalVarInfo` into the new trait solver. I can't really tell what other changes need to be done, but I'm just putting this up sooner than later since I'm almost certain it'll need to be done regardless of other design choices. There are a couple of warts introduced by this PR, since we no longer can define inherent `Canonical` impls in `rustc_middle` -- see the changes to: * `compiler/rustc_trait_selection/src/traits/query/normalize.rs` * `compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs` r? lcnr
2023-10-25Uplift Canonical to rustc_type_irMichael Goulet-1/+2
2023-10-25Rollup merge of #117136 - compiler-errors:defid-list, r=oli-obkMatthias Krüger-0/+10
Intern `LocalDefId` list from `opaque_types_defined_by` query r? oli-obk
2023-10-25Auto merge of #116993 - compiler-errors:clause-kind, r=jackh726bors-2/+15
Uplift `ClauseKind` and `PredicateKind` into `rustc_type_ir` Uplift `ClauseKind` and `PredicateKind` into `rustc_type_ir`. Blocked on #116951 r? `@ghost`
2023-10-24Get rid of 'tcx on ConstVid, EffectVidMichael Goulet-1/+1
2023-10-24Intern LocalDefId list from opaque queryMichael Goulet-0/+10
2023-10-20Uplift ClauseKind and PredicateKindMichael Goulet-2/+15
2023-10-20s/generator/coroutine/Oli Scherer-4/+4
2023-10-20s/Generator/Coroutine/Oli Scherer-3/+3
2023-10-20Adjust importsMichael Goulet-1/+1
2023-10-19Uplift movability and mutability, the simple wayMichael Goulet-7/+1