- // Encodes something that corresponds to a single DepNode::GlobalMetaData
- // and registers the Fingerprint in the `metadata_hashes` map.
- pub fn tracked<'x, DATA, R>(&'x mut self,
- op: fn(&mut IsolatedEncoder<'x, 'a, 'tcx>, DATA) -> R,
- data: DATA)
- -> R {
- op(&mut IsolatedEncoder::new(self), data)
+ /// Emit the data for a `DefId` to the metadata. The function to
+ /// emit the data is `op`, and it will be given `data` as
+ /// arguments. This `record` function will call `op` to generate
+ /// the `Entry` (which may point to other encoded information)
+ /// and will then record the `Lazy<Entry>` for use in the index.
+ // FIXME(eddyb) remove this.
+ pub fn record<DATA>(&mut self,
+ id: DefId,
+ op: impl FnOnce(&mut Self, DATA) -> Entry<'tcx>,
+ data: DATA)
+ {
+ assert!(id.is_local());
+
+ let entry = op(self, data);
+ let entry = self.lazy(&entry);
+ self.entries_index.record(id, entry);