// This represents the collection of all but one of the elements
// from an array at the path described by the move path index.
// Note that attached MovePathIndex should have mem_categorization
- // of InteriorElement (i.e. array dereference `.index(&FullRange)`).
+ // of InteriorElement (i.e. array dereference `&foo[]`).
AllButOneFrom(MovePathIndex),
}
let attrs : &[ast::Attribute];
attrs = match tcx.map.find(id) {
Some(ast_map::NodeItem(ref item)) =>
- item.attrs.index(&FullRange),
+ &item.attrs[],
Some(ast_map::NodeImplItem(&ast::MethodImplItem(ref m))) =>
- m.attrs.index(&FullRange),
+ &m.attrs[],
Some(ast_map::NodeTraitItem(&ast::ProvidedMethod(ref m))) =>
- m.attrs.index(&FullRange),
- _ => [].index(&FullRange),
+ &m.attrs[],
+ _ => &[][],
};
let span_err =
for (i, mpi) in vec_rc.iter().enumerate() {
let render = |&:| this.path_loan_path(*mpi).user_string(tcx);
if span_err {
- tcx.sess.span_err(sp, format!("{}: `{}`", kind, render()).index(&FullRange));
+ tcx.sess.span_err(sp, &format!("{}: `{}`", kind, render())[]);
}
if print {
println!("id:{} {}[{}] `{}`", id, kind, i, render());
for (i, f) in vec_rc.iter().enumerate() {
let render = |&:| f.loan_path_user_string(this, tcx);
if span_err {
- tcx.sess.span_err(sp, format!("{}: `{}`", kind, render()).index(&FullRange));
+ tcx.sess.span_err(sp, &format!("{}: `{}`", kind, render())[]);
}
if print {
println!("id:{} {}[{}] `{}`", id, kind, i, render());
// First, filter out duplicates
moved.sort();
moved.dedup();
- debug!("fragments 1 moved: {:?}", path_lps(moved.index(&FullRange)));
+ debug!("fragments 1 moved: {:?}", path_lps(&moved[]));
assigned.sort();
assigned.dedup();
- debug!("fragments 1 assigned: {:?}", path_lps(assigned.index(&FullRange)));
+ debug!("fragments 1 assigned: {:?}", path_lps(&assigned[]));
// Second, build parents from the moved and assigned.
for m in moved.iter() {
parents.sort();
parents.dedup();
- debug!("fragments 2 parents: {:?}", path_lps(parents.index(&FullRange)));
+ debug!("fragments 2 parents: {:?}", path_lps(&parents[]));
// Third, filter the moved and assigned fragments down to just the non-parents
- moved.retain(|f| non_member(*f, parents.index(&FullRange)));
- debug!("fragments 3 moved: {:?}", path_lps(moved.index(&FullRange)));
+ moved.retain(|f| non_member(*f, &parents[]));
+ debug!("fragments 3 moved: {:?}", path_lps(&moved[]));
- assigned.retain(|f| non_member(*f, parents.index(&FullRange)));
- debug!("fragments 3 assigned: {:?}", path_lps(assigned.index(&FullRange)));
+ assigned.retain(|f| non_member(*f, &parents[]));
+ debug!("fragments 3 assigned: {:?}", path_lps(&assigned[]));
// Fourth, build the leftover from the moved, assigned, and parents.
for m in moved.iter() {
unmoved.sort();
unmoved.dedup();
- debug!("fragments 4 unmoved: {:?}", frag_lps(unmoved.index(&FullRange)));
+ debug!("fragments 4 unmoved: {:?}", frag_lps(&unmoved[]));
// Fifth, filter the leftover fragments down to its core.
unmoved.retain(|f| match *f {
AllButOneFrom(_) => true,
- Just(mpi) => non_member(mpi, parents.index(&FullRange)) &&
- non_member(mpi, moved.index(&FullRange)) &&
- non_member(mpi, assigned.index(&FullRange))
+ Just(mpi) => non_member(mpi, &parents[]) &&
+ non_member(mpi, &moved[]) &&
+ non_member(mpi, &assigned[])
});
- debug!("fragments 5 unmoved: {:?}", frag_lps(unmoved.index(&FullRange)));
+ debug!("fragments 5 unmoved: {:?}", frag_lps(&unmoved[]));
// Swap contents back in.
fragments.unmoved_fragments = unmoved;
let msg = format!("type {} ({:?}) is not fragmentable",
parent_ty.repr(tcx), sty_and_variant_info);
let opt_span = origin_id.and_then(|id|tcx.map.opt_span(id));
- tcx.sess.opt_span_bug(opt_span, msg.index(&FullRange))
+ tcx.sess.opt_span_bug(opt_span, &msg[])
}
}
}