ref trace_origins,
ref same_regions) => {
if !same_regions.is_empty() {
- self.report_processed_errors(var_origins[],
- trace_origins[],
- same_regions[]);
+ self.report_processed_errors(var_origins.index(&FullRange),
+ trace_origins.index(&FullRange),
+ same_regions.index(&FullRange));
}
}
}
}
}
let pe = ProcessedErrors(var_origins, trace_origins, same_regions);
- debug!("errors processed: {}", pe);
+ debug!("errors processed: {:?}", pe);
processed_errors.push(pe);
}
return processed_errors;
sub: Region,
sup: Region)
-> Option<FreeRegionsFromSameFn> {
- debug!("free_regions_from_same_fn(sub={}, sup={})", sub, sup);
+ debug!("free_regions_from_same_fn(sub={:?}, sup={:?})", sub, sup);
let (scope_id, fr1, fr2) = match (sub, sup) {
(ReFree(fr1), ReFree(fr2)) => {
if fr1.scope != fr2.scope {
format!("{}: {} ({})",
message_root_str,
expected_found_str,
- ty::type_err_to_str(self.tcx, terr))[]);
+ ty::type_err_to_str(self.tcx, terr)).index(&FullRange));
match trace.origin {
infer::MatchExpressionArm(_, arm_span) =>
// Does the required lifetime have a nice name we can print?
self.tcx.sess.span_err(
origin.span(),
- format!("{} may not live long enough", labeled_user_string)[]);
+ format!("{} may not live long enough", labeled_user_string).index(&FullRange));
self.tcx.sess.span_help(
origin.span(),
format!(
"consider adding an explicit lifetime bound `{}: {}`...",
bound_kind.user_string(self.tcx),
- sub.user_string(self.tcx))[]);
+ sub.user_string(self.tcx)).index(&FullRange));
}
ty::ReStatic => {
// Does the required lifetime have a nice name we can print?
self.tcx.sess.span_err(
origin.span(),
- format!("{} may not live long enough", labeled_user_string)[]);
+ format!("{} may not live long enough", labeled_user_string).index(&FullRange));
self.tcx.sess.span_help(
origin.span(),
format!(
"consider adding an explicit lifetime bound `{}: 'static`...",
- bound_kind.user_string(self.tcx))[]);
+ bound_kind.user_string(self.tcx)).index(&FullRange));
}
_ => {
origin.span(),
format!(
"{} may not live long enough",
- labeled_user_string)[]);
+ labeled_user_string).index(&FullRange));
self.tcx.sess.span_help(
origin.span(),
format!(
"consider adding an explicit lifetime bound for `{}`",
- bound_kind.user_string(self.tcx))[]);
+ bound_kind.user_string(self.tcx)).index(&FullRange));
note_and_explain_region(
self.tcx,
- format!("{} must be valid for ", labeled_user_string)[],
+ format!("{} must be valid for ", labeled_user_string).index(&FullRange),
sub,
"...");
}
ty::local_var_name_str(self.tcx,
upvar_id.var_id)
.get()
- .to_string())[]);
+ .to_string()).index(&FullRange));
note_and_explain_region(
self.tcx,
"...the borrowed pointer is valid for ",
ty::local_var_name_str(self.tcx,
upvar_id.var_id)
.get()
- .to_string())[],
+ .to_string()).index(&FullRange),
sup,
"");
}
outlive the enclosing closure",
ty::local_var_name_str(self.tcx,
id).get()
- .to_string())[]);
+ .to_string()).index(&FullRange));
note_and_explain_region(
self.tcx,
"captured variable is valid for ",
span,
format!("the type `{}` does not fulfill the \
required lifetime",
- self.ty_to_string(ty))[]);
+ self.ty_to_string(ty)).index(&FullRange));
note_and_explain_region(self.tcx,
"type must outlive ",
sub,
span,
format!("the type `{}` (provided as the value of \
a type parameter) is not valid at this point",
- self.ty_to_string(ty))[]);
+ self.ty_to_string(ty)).index(&FullRange));
note_and_explain_region(self.tcx,
"type must outlive ",
sub,
span,
format!("type of expression contains references \
that are not valid during the expression: `{}`",
- self.ty_to_string(t))[]);
+ self.ty_to_string(t)).index(&FullRange));
note_and_explain_region(
self.tcx,
"type is only valid for ",
span,
format!("in type `{}`, reference has a longer lifetime \
than the data it references",
- self.ty_to_string(ty))[]);
+ self.ty_to_string(ty)).index(&FullRange));
note_and_explain_region(
self.tcx,
"the pointer is valid for ",
let (fn_decl, generics, unsafety, ident, expl_self, span)
= node_inner.expect("expect item fn");
let taken = lifetimes_in_scope(self.tcx, scope_id);
- let life_giver = LifeGiver::with_taken(taken[]);
+ let life_giver = LifeGiver::with_taken(taken.index(&FullRange));
let rebuilder = Rebuilder::new(self.tcx, fn_decl, expl_self,
generics, same_regions, &life_giver);
let (fn_decl, expl_self, generics) = rebuilder.rebuild();
}
expl_self_opt = self.rebuild_expl_self(expl_self_opt, lifetime,
&anon_nums, ®ion_names);
- inputs = self.rebuild_args_ty(inputs[], lifetime,
+ inputs = self.rebuild_args_ty(inputs.index(&FullRange), lifetime,
&anon_nums, ®ion_names);
output = self.rebuild_output(&output, lifetime, &anon_nums, ®ion_names);
ty_params = self.rebuild_ty_params(ty_params, lifetime,
names.push(lt_name);
}
names.sort();
- let name = token::str_to_ident(names[0][]).name;
+ let name = token::str_to_ident(names[0].index(&FullRange)).name;
return (name_to_dummy_lifetime(name), Kept);
}
return (self.life_giver.give_lifetime(), Fresh);
.sess
.fatal(format!(
"unbound path {}",
- pprust::path_to_string(path))[])
+ pprust::path_to_string(path)).index(&FullRange))
}
Some(&d) => d
};
opt_explicit_self, generics);
let msg = format!("consider using an explicit lifetime \
parameter as shown: {}", suggested_fn);
- self.tcx.sess.span_help(span, msg[]);
+ self.tcx.sess.span_help(span, msg.index(&FullRange));
}
fn report_inference_failure(&self,
var_origin.span(),
format!("cannot infer an appropriate lifetime{} \
due to conflicting requirements",
- var_description)[]);
+ var_description).index(&FullRange));
}
fn note_region_origin(&self, origin: &SubregionOrigin<'tcx>) {
self.tcx.sess.span_note(
trace.origin.span(),
format!("...so that {} ({})",
- desc, values_str)[]);
+ desc, values_str).index(&FullRange));
}
None => {
// Really should avoid printing this error at
// doing right now. - nmatsakis
self.tcx.sess.span_note(
trace.origin.span(),
- format!("...so that {}", desc)[]);
+ format!("...so that {}", desc).index(&FullRange));
}
}
}
"...so that closure can access `{}`",
ty::local_var_name_str(self.tcx, upvar_id.var_id)
.get()
- .to_string())[])
+ .to_string()).index(&FullRange))
}
infer::InfStackClosure(span) => {
self.tcx.sess.span_note(
does not outlive the enclosing closure",
ty::local_var_name_str(
self.tcx,
- id).get().to_string())[]);
+ id).get().to_string()).index(&FullRange));
}
infer::IndexSlice(span) => {
self.tcx.sess.span_note(
span,
format!("...so type `{}` of expression is valid during the \
expression",
- self.ty_to_string(t))[]);
+ self.ty_to_string(t)).index(&FullRange));
}
infer::BindingTypeIsNotValidAtDecl(span) => {
self.tcx.sess.span_note(
span,
format!("...so that the reference type `{}` \
does not outlive the data it points at",
- self.ty_to_string(ty))[]);
+ self.ty_to_string(ty)).index(&FullRange));
}
infer::RelateParamBound(span, t) => {
self.tcx.sess.span_note(
span,
format!("...so that the type `{}` \
will meet the declared lifetime bounds",
- self.ty_to_string(t))[]);
+ self.ty_to_string(t)).index(&FullRange));
}
infer::RelateDefaultParamBound(span, t) => {
self.tcx.sess.span_note(
format!("...so that type parameter \
instantiated with `{}`, \
will meet its declared lifetime bounds",
- self.ty_to_string(t))[]);
+ self.ty_to_string(t)).index(&FullRange));
}
infer::RelateRegionParamBound(span) => {
self.tcx.sess.span_note(
span,
format!("...so that the declared lifetime parameter bounds \
- are satisfied")[]);
+ are satisfied").index(&FullRange));
}
}
}
Some(node) => match node {
ast_map::NodeItem(item) => match item.node {
ast::ItemFn(_, _, _, ref gen, _) => {
- taken.push_all(gen.lifetimes[]);
+ taken.push_all(gen.lifetimes.index(&FullRange));
None
},
_ => None
ast_map::NodeImplItem(ii) => {
match *ii {
ast::MethodImplItem(ref m) => {
- taken.push_all(m.pe_generics().lifetimes[]);
+ taken.push_all(m.pe_generics().lifetimes.index(&FullRange));
Some(m.id)
}
ast::TypeImplItem(_) => None,
let mut lifetime;
loop {
let mut s = String::from_str("'");
- s.push_str(num_to_string(self.counter.get())[]);
+ s.push_str(num_to_string(self.counter.get()).index(&FullRange));
if !self.taken.contains(&s) {
lifetime = name_to_dummy_lifetime(
- token::str_to_ident(s[]).name);
+ token::str_to_ident(s.index(&FullRange)).name);
self.generated.borrow_mut().push(lifetime);
break;
}