Ok(ty)
}
- fn cached_predicate_for_shorthand<F>(
- &mut self,
- shorthand: usize,
- or_insert_with: F,
- ) -> Result<ty::Predicate<'tcx>, Self::Error>
- where
- F: FnOnce(&mut Self) -> Result<ty::Predicate<'tcx>, Self::Error>,
- {
- let tcx = self.tcx();
-
- let key = ty::CReaderCacheKey { cnum: self.cdata().cnum, pos: shorthand };
-
- if let Some(&pred) = tcx.pred_rcache.borrow().get(&key) {
- return Ok(pred);
- }
-
- let pred = or_insert_with(self)?;
- tcx.pred_rcache.borrow_mut().insert(key, pred);
- Ok(pred)
- }
-
fn with_position<F, R>(&mut self, pos: usize, f: F) -> R
where
F: FnOnce(&mut Self) -> R,
.tables
.inferred_outlives
.get(self, item_id)
- .map(|predicates| predicates.decode((self, tcx)))
+ .map(|predicates| tcx.arena.alloc_from_iter(predicates.decode((self, tcx))))
.unwrap_or_default()
}
self.root.tables.super_predicates.get(self, item_id).unwrap().decode((self, tcx))
}
+ fn get_explicit_item_bounds(
+ &self,
+ item_id: DefIndex,
+ tcx: TyCtxt<'tcx>,
+ ) -> &'tcx [(ty::Predicate<'tcx>, Span)] {
+ self.root
+ .tables
+ .explicit_item_bounds
+ .get(self, item_id)
+ .map(|bounds| tcx.arena.alloc_from_iter(bounds.decode((self, tcx))))
+ .unwrap_or_default()
+ }
+
fn get_generics(&self, item_id: DefIndex, sess: &Session) -> ty::Generics {
self.root.tables.generics.get(self, item_id).unwrap().decode((self, sess))
}
self.root.tables.impl_trait_ref.get(self, id).map(|tr| tr.decode((self, tcx)))
}
+ fn get_expn_that_defined(&self, id: DefIndex, sess: &Session) -> ExpnId {
+ self.root.tables.expn_that_defined.get(self, id).unwrap().decode((self, sess))
+ }
+
/// Iterates over all the stability attributes in the given crate.
fn get_lib_features(&self, tcx: TyCtxt<'tcx>) -> &'tcx [(Symbol, Option<Symbol>)] {
// FIXME: For a proc macro crate, not sure whether we should return the "host"