rust/compiler/rustc_query_impl/src
bors c97b539e40 Auto merge of #104940 - cjgillot:query-feed-simple, r=oli-obk
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-30 17:20:14 +00:00
..
lib.rs Unsupported query error now specifies if its unsupported for local or external crate 2022-11-24 19:05:17 +05:30
on_disk_cache.rs Make inferred_outlives_crate return Clause 2022-11-29 12:01:58 -03:00
plumbing.rs Sanity check computed value for feeable queries. 2022-11-29 18:42:23 +00:00
profiling_support.rs Remove one lifetime from QueryKeyStringBuilder 2022-11-06 13:10:35 +01:00
README.md

For more information about how the query system works, see the rustc dev guide.