Ok(ty::GenericPredicates {
parent: Decodable::decode(decoder)?,
predicates: (0..decoder.read_usize()?).map(|_| {
- // Handle shorthands first, if we have an usize > 0x80.
- let predicate = if decoder.positioned_at_shorthand() {
- let pos = decoder.read_usize()?;
- assert!(pos >= SHORTHAND_OFFSET);
- let shorthand = pos - SHORTHAND_OFFSET;
-
- decoder.with_position(shorthand, ty::Predicate::decode)
- } else {
- ty::Predicate::decode(decoder)
- }?;
- Ok((predicate, Decodable::decode(decoder)?))
- })
- .collect::<Result<Vec<_>, _>>()?,
+ // Handle shorthands first, if we have an usize > 0x80.
+ let predicate = if decoder.positioned_at_shorthand() {
+ let pos = decoder.read_usize()?;
+ assert!(pos >= SHORTHAND_OFFSET);
+ let shorthand = pos - SHORTHAND_OFFSET;
+
+ decoder.with_position(shorthand, ty::Predicate::decode)
+ } else {
+ ty::Predicate::decode(decoder)
+ }?;
+ Ok((predicate, Decodable::decode(decoder)?))
+ })
+ .collect::<Result<Vec<_>, _>>()?,
})
}
#[inline]
pub fn decode_allocation<'a, 'tcx, D>(decoder: &mut D)
- -> Result<&'tcx Allocation, D::Error>
+ -> Result<&'tcx Allocation, D::Error>
where D: TyDecoder<'a, 'tcx>,
'tcx: 'a,
{
// types/regions in the global interner
if local as *const _ as usize == global as *const _ as usize {
bug!("Attempted to intern `{:?}` which contains \
- inference types/regions in the global type context",
- &ty_struct);
+ inference types/regions in the global type context",
+ &ty_struct);
}
// Don't be &mut TyS.
bug!("node {} with HirId::owner {:?} cannot be placed in \
TypeckTables with local_id_root {:?}",
- tcx.hir.node_to_string(node_id),
- DefId::local(hir_id.owner),
- local_id_root)
+ tcx.hir.node_to_string(node_id),
+ DefId::local(hir_id.owner),
+ local_id_root)
});
}
} else {
}
pub fn pat_adjustments_mut(&mut self)
- -> LocalTableInContextMut<'_, Vec<Ty<'tcx>>> {
+ -> LocalTableInContextMut<'_, Vec<Ty<'tcx>>> {
LocalTableInContextMut {
local_id_root: self.local_id_root,
data: &mut self.pat_adjustments,
let hir_id = hir.node_to_hir_id(k);
let map = trait_map.entry(hir_id.owner).or_default();
Lrc::get_mut(map).unwrap()
- .insert(hir_id.local_id,
- Lrc::new(StableVec::new(v)));
+ .insert(hir_id.local_id,
+ Lrc::new(StableVec::new(v)));
}
let gcx = &GlobalCtxt {
};
$(let mut $variant = total;)*
-
for &Interned(t) in tcx.interners.type_.borrow().iter() {
let variant = match t.sty {
ty::Bool | ty::Char | ty::Int(..) | ty::Uint(..) |
}
println!("Ty interner total ty region both");
$(println!(" {:18}: {uses:6} {usespc:4.1}%, \
-{ty:4.1}% {region:5.1}% {both:4.1}%",
+ {ty:4.1}% {region:5.1}% {both:4.1}%",
stringify!($variant),
uses = $variant.total,
usespc = $variant.total as f64 * 100.0 / total.total as f64,
both = $variant.both_infer as f64 * 100.0 / total.total as f64);
)*
println!(" total {uses:6} \
-{ty:4.1}% {region:5.1}% {both:4.1}%",
+ {ty:4.1}% {region:5.1}% {both:4.1}%",
uses = total.total,
ty = total.ty_infer as f64 * 100.0 / total.total as f64,
region = total.region_infer as f64 * 100.0 / total.total as f64,
}
pub fn mk_closure(self, closure_id: DefId, closure_substs: ClosureSubsts<'tcx>)
- -> Ty<'tcx> {
+ -> Ty<'tcx> {
self.mk_ty(Closure(closure_id, closure_substs))
}
}
pub fn mk_ty_param(self,
- index: u32,
- name: InternedString) -> Ty<'tcx> {
+ index: u32,
+ name: InternedString) -> Ty<'tcx> {
self.mk_ty(Param(ParamTy { idx: index, name: name }))
}
#[inline]
fn try_load_from_disk<'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
- id: SerializedDepNodeIndex)
- -> Option<Self::Value> {
+ id: SerializedDepNodeIndex)
+ -> Option<Self::Value> {
tcx.queries.on_disk_cache.try_load_query_result(tcx, id)
}
}
}).collect::<FxHashMap<_,_>>();
let map_size = prev_cnums.iter()
- .map(|&(cnum, ..)| cnum)
- .max()
- .unwrap_or(0) + 1;
+ .map(|&(cnum, ..)| cnum)
+ .max()
+ .unwrap_or(0) + 1;
let mut map = IndexVec::new();
map.resize(map_size as usize, None);
}
}
-
//- DECODING -------------------------------------------------------------------
/// A decoder that can read the incr. comp. cache. It is similar to the one
file_index_to_file.borrow_mut().entry(index).or_insert_with(|| {
let stable_id = file_index_to_stable_id[&index];
source_map.source_file_by_stable_id(stable_id)
- .expect("Failed to lookup SourceFile in new context.")
+ .expect("Failed to lookup SourceFile in new context.")
}).clone()
}
}
struct CacheEncoder<'enc, 'a, 'tcx, E>
where E: 'enc + ty_codec::TyEncoder,
- 'tcx: 'a,
+ 'tcx: 'a,
{
tcx: TyCtxt<'a, 'tcx, 'tcx>,
encoder: &'enc mut E,
let (file_lo, line_lo, col_lo) = match self.source_map
.byte_pos_to_line_and_col(span_data.lo) {
Some(pos) => pos,
- None => {
- return TAG_INVALID_SPAN.encode(self);
- }
+ None => return TAG_INVALID_SPAN.encode(self)
};
if !file_lo.contains(span_data.hi) {
let prev_dep_node_index =
self.dep_graph.prev_dep_node_index_of(dep_node);
let result = Q::try_load_from_disk(self.global_tcx(),
- prev_dep_node_index);
+ prev_dep_node_index);
// We always expect to find a cached result for things that
// can be forced from DepNode.
debug_assert!(!dep_node.kind.can_reconstruct_query_key() ||
- result.is_some(),
- "Missing on-disk cache entry for {:?}",
- dep_node);
+ result.is_some(),
+ "Missing on-disk cache entry for {:?}",
+ dep_node);
result
} else {
// Some things are never cached on disk.
assert!(Some(self.dep_graph.fingerprint_of(dep_node_index)) ==
self.dep_graph.prev_fingerprint_of(dep_node),
"Fingerprint for green query instance not loaded \
- from cache: {:?}", dep_node);
+ from cache: {:?}", dep_node);
debug!("BEGIN verify_ich({:?})", dep_node);
let mut hcx = self.create_stable_hashing_context();
// (see for example #48923)
assert!(!self.dep_graph.dep_node_exists(&dep_node),
"Forcing query with already existing DepNode.\n\
- - query-key: {:?}\n\
- - dep-node: {:?}",
+ - query-key: {:?}\n\
+ - dep-node: {:?}",
key, dep_node);
profq_msg!(self, ProfileQueriesMsg::ProviderBegin);