InferredTerm(InferredIndex),
}
-impl<'a> fmt::Show for VarianceTerm<'a> {
+impl<'a> fmt::Debug for VarianceTerm<'a> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
- ConstantTerm(c1) => write!(f, "{}", c1),
- TransformTerm(v1, v2) => write!(f, "({} \u{00D7} {})", v1, v2),
+ ConstantTerm(c1) => write!(f, "{:?}", c1),
+ TransformTerm(v1, v2) => write!(f, "({:?} \u{00D7} {:?})", v1, v2),
InferredTerm(id) => write!(f, "[{}]", { let InferredIndex(i) = id; i })
}
}
let mut terms_cx = TermsContext {
tcx: tcx,
arena: arena,
- inferred_map: NodeMap::new(),
+ inferred_map: NodeMap(),
inferred_infos: Vec::new(),
// cache and share the variance struct used for items with
assert!(newly_added);
debug!("add_inferred(item_id={}, \
- kind={}, \
+ kind={:?}, \
index={}, \
param_id={},
- inf_index={})",
+ inf_index={:?})",
item_id, kind, index, param_id, inf_index);
}
struct ConstraintContext<'a, 'tcx: 'a> {
terms_cx: TermsContext<'a, 'tcx>,
- // These are the def-id of the std::kinds::marker::InvariantType,
- // std::kinds::marker::InvariantLifetime, and so on. The arrays
+ // These are the def-id of the std::marker::InvariantType,
+ // std::marker::InvariantLifetime, and so on. The arrays
// are indexed by the `ParamKind` (type, lifetime, self). Note
// that there are no marker types for self, so the entries for
// self are always None.
match self.terms_cx.inferred_map.get(¶m_id) {
Some(&index) => index,
None => {
- self.tcx().sess.bug(format!(
+ self.tcx().sess.bug(&format!(
"no inferred index entry for {}",
- self.tcx().map.node_to_string(param_id)).index(&FullRange));
+ self.tcx().map.node_to_string(param_id))[]);
}
}
}
fn add_constraint(&mut self,
InferredIndex(index): InferredIndex,
variance: VarianceTermPtr<'a>) {
- debug!("add_constraint(index={}, variance={})",
- index, variance.to_string());
+ debug!("add_constraint(index={}, variance={:?})",
+ index, variance);
self.constraints.push(Constraint { inferred: InferredIndex(index),
variance: variance });
}
ty::ty_infer(..) | ty::ty_err => {
self.tcx().sess.bug(
- format!("unexpected type encountered in \
+ &format!("unexpected type encountered in \
variance inference: {}",
- ty.repr(self.tcx())).index(&FullRange));
+ ty.repr(self.tcx()))[]);
}
}
}
region_param_defs: &[ty::RegionParameterDef],
substs: &subst::Substs<'tcx>,
variance: VarianceTermPtr<'a>) {
- debug!("add_constraints_from_substs(def_id={})", def_id);
+ debug!("add_constraints_from_substs(def_id={:?})", def_id);
for p in type_param_defs.iter() {
let variance_decl =
// regions when visiting member types or method types.
self.tcx()
.sess
- .bug(format!("unexpected region encountered in variance \
+ .bug(&format!("unexpected region encountered in variance \
inference: {}",
- region.repr(self.tcx())).index(&FullRange));
+ region.repr(self.tcx()))[]);
}
}
}
let new_value = glb(variance, old_value);
if old_value != new_value {
debug!("Updating inferred {} (node {}) \
- from {} to {} due to {}",
+ from {:?} to {:?} due to {:?}",
inferred,
self.terms_cx
.inferred_infos[inferred]
.param_id,
old_value,
new_value,
- term.to_string());
+ term);
self.solutions[inferred] = new_value;
changed = true;
inferred_infos[index].item_id == item_id {
let info = &inferred_infos[index];
let variance = solutions[index];
- debug!("Index {} Info {} / {} / {} Variance {}",
+ debug!("Index {} Info {} / {:?} / {:?} Variance {:?}",
index, info.index, info.kind, info.space, variance);
match info.kind {
TypeParam => {
// attribute and report an error with various results if found.
if ty::has_attr(tcx, item_def_id, "rustc_variance") {
let found = item_variances.repr(tcx);
- tcx.sess.span_err(tcx.map.span(item_id), found.index(&FullRange));
+ tcx.sess.span_err(tcx.map.span(item_id), &found[]);
}
let newly_added = tcx.item_variance_map.borrow_mut()