summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty/context.rs
AgeCommit message (Collapse)AuthorLines
2022-12-08Rollup merge of #105423 - oli-obk:symbols, r=jackh726Matthias Krüger-2/+2
Use `Symbol` for the crate name instead of `String`/`str` It always got converted to a symbol anyway
2022-12-07Use `Symbol` for the crate name instead of `String`/`str`Oli Scherer-2/+2
2022-12-07Rollup merge of #105267 - compiler-errors:issue-104613, r=oli-obkMatthias Krüger-0/+8
Don't ICE in ExprUseVisitor on FRU for non-existent struct Fixes #104613 Fixes #105202
2022-12-06Rollup merge of #104898 - oli-obk:group_all_the_things, r=wesleywiserMatthias Krüger-56/+27
Put all cached values into a central struct instead of just the stable hash cc `@nnethercote` this allows re-use of the type for Predicate without duplicating all the logic for the non-hash cached fields
2022-12-05feed resolver_for_lowering instead of storing it in a fieldOli Scherer-10/+9
2022-12-05Allow arbitrary keys in feeding APIOli Scherer-7/+14
2022-12-04drive-by: move field_index to typeck resultsMichael Goulet-0/+8
2022-12-01Fill in `def_span` when creating def ids.Oli Scherer-1/+7
This makes sure that ICEing because of def ids created outside of ast lowering will be able to produce a query backtrace and not cause a double panic because of trying to call the `def_span` query
2022-11-30Auto merge of #104940 - cjgillot:query-feed-simple, r=oli-obkbors-10/+44
Allow to feed a value in another query's cache Restricted version of https://github.com/rust-lang/rust/pull/96840 A query can create new definitions. If those definitions are created after HIR lowering, they do not appear in the initial HIR map, and information for them cannot be provided in the normal pull-based way. In order to make those definitions useful, we allow to feed values as query results for the newly created definition. The API is as follows: ```rust let feed = tcx.create_def(<parent def id>, <DefPathData>); // `feed` is a TyCtxtFeed<'tcx>. // Access the created definition. let def_id: LocalDefId = feed.def_id; // Assign `my_query(def_id) := my_value`. feed.my_query(my_value). ``` This PR keeps the consistency checks introduced by https://github.com/rust-lang/rust/pull/96840, even if they are not reachable. This allows to extend the behaviour later without forgetting them. cc `@oli-obk` `@spastorino`
2022-11-30Generalize some InternedInSet implsOli Scherer-36/+6
2022-11-30Remove PredicateS typeOli Scherer-20/+21
2022-11-30Remove TySOli Scherer-18/+17
2022-11-30move WithCachedTypeInfo to rustc_type_irOli Scherer-1/+2
2022-11-30s/WithStableHash/WithCachedTypeInfo/Oli Scherer-15/+15
2022-11-29Auto merge of #94487 - oli-obk:stable_hash_ty, r=fee1-deadbors-23/+54
Also cache the stable hash of interned Predicates continuation of https://github.com/rust-lang/rust/pull/94299 This is a small perf improvement and shares more code between `Ty` and `Predicate`
2022-11-29Make TyCtxtFeed::def_id private.Camille GILLOT-4/+11
2022-11-29Only allow feeding a value to newly created definitions.Camille GILLOT-10/+37
2022-11-29Auto merge of #105012 - WaffleLapkin:into, r=oli-obkbors-22/+10
Make `tcx.mk_const` more permissive wrt `kind` argument (`impl Into`) r? `@oli-obk` you've asked for this >:)
2022-11-29Rollup merge of #104951 - Swatinem:async-kind, r=compiler-errorsMatthias Krüger-0/+5
Simplify checking for `GeneratorKind::Async` Adds a helper method around `generator_kind` that makes matching async constructs simpler.
2022-11-28Simplify checking for `GeneratorKind::Async`Arpad Borsos-0/+5
Adds a helper method around `generator_kind` that makes matching async constructs simpler.
2022-11-28Remove `tcx.mk_const_var`Maybe Waffle-20/+8
... `tcx.mk_const` can now be used instead
2022-11-28Make `tcx.mk_const` more permissive wrt `kind` argumentMaybe Waffle-2/+2
- Accept `impl Into` - Implement `From<>` for `ConstKind` Note: this adds a dependency on `derive_more` (MIT license). It allows to derive a lot of traits (like `From` here) that would be otherwise tedious to implement.
2022-11-28Rename `NestedMetaItem::[Ll]iteral` as `NestedMetaItem::[Ll]it`.Nicholas Nethercote-1/+1
We already use a mix of `Literal` and `Lit`. The latter is better because it is shorter without causing any ambiguity.
2022-11-28Rename `ast::Lit` as `ast::MetaItemLit`.Nicholas Nethercote-2/+3
2022-11-27Prefer doc comments over `//`-comments in compilerMaybe Waffle-18/+20
2022-11-25Auto merge of #99798 - JulianKnodt:ac1, r=BoxyUwUbors-0/+14
Add `ConstKind::Expr` Starting to implement `ty::ConstKind::Abstract`, most of the match cases are stubbed out, some I was unsure what to add, others I didn't want to add until a more complete implementation was ready. r? `@lcnr`
2022-11-25Cache Predicates' hash within themselvesOli Scherer-23/+54
2022-11-25Fix mk_const_listkadmin-1/+1
2022-11-25correctly intern `List<Const<'tcx>>`Boxy-1/+4
2022-11-25Add empty ConstKind::Abstractkadmin-0/+11
Initial pass at expr/abstract const/s Address comments Switch to using a list instead of &[ty::Const], rm `AbstractConst` Remove try_unify_abstract_consts Update comments Add edits Recurse more More edits Prevent equating associated consts Move failing test to ui Changes this test from incremental to ui, and mark it as failing and a known bug. Does not cause the compiler to ICE, so should be ok.
2022-11-25Introduce PredicateKind::ClauseSantiago Pastorino-2/+4
2022-11-24move things from rustc_target::abi to rustc_abihkalbasi-1/+1
2022-11-24make rustc_target usable outside of rustchkalbasi-2/+2
2022-11-22Use `tcx.require_lang_item` instead of unwrappingMaybe Waffle-1/+1
2022-11-21Stop passing the self-type as a separate argument.Oli Scherer-11/+10
2022-11-21Remove some unnecessary slicingOli Scherer-7/+7
2022-11-21Add helper to create the trait ref for a lang itemOli Scherer-0/+10
2022-11-21Allow iterators instead of requiring slices that will get turned into iteratorsOli Scherer-4/+10
2022-11-21Assert that various types have the right amount of generic args and fix the ↵Oli Scherer-0/+25
sites that used the wrong amount
2022-11-19drive-by: PolyExistentialPredicateMichael Goulet-17/+13
2022-11-13Make user_provided_sigs a LocalDefIdMap.Camille GILLOT-2/+2
2022-11-11Skip stable hashing without incremental.Camille GILLOT-1/+3
2022-11-11Use the interned stable hash as plain hash.Camille GILLOT-3/+1
2022-11-11Hash spans when interning.Camille GILLOT-6/+2
2022-11-08Rollup merge of #104132 - Rejyr:rustc_lint-function-lints, r=davidtwcoGuillaume Gomez-0/+1
fix: lint against lint functions Add `#[rustc_lint_diagnostics]` to lint functions missing them. From [this discussion](https://github.com/rust-lang/rust/pull/101138#issuecomment-1306379999). r? ```@davidtwco```
2022-11-08code cleanup with err.emit_unlessyukang-1/+1
2022-11-08add 'ty_error_with_guaranteed' and 'const_error_with_guaranteed'yukang-0/+16
2022-11-07fix: lint against lint functionsRejyr-0/+1
fix: lint against the functions `LintContext::{lookup_with_diagnostics,lookup,struct_span_lint,lint}`, `TyCtxt::struct_lint_node`, `LintLevelsBuilder::struct_lint`.
2022-11-06Auto merge of #103720 - crlf0710:most_translation_attr, r=compiler-errorsbors-1/+4
Lint against usages of `struct_span_lint_hir`. r? `@compiler-errors`
2022-11-04Refactor tcx mk_const parameters.Mateusz-5/+10