Make default method handling not choke on self region params. Closes #7341.

This commit is contained in:
Michael Sullivan 2013-06-25 14:07:44 -07:00
parent 050d0e6b29
commit a9e51f5f70
2 changed files with 10 additions and 3 deletions

View File

@ -233,7 +233,12 @@ pub fn trans_fn_ref_with_vtables(
// Polytype of the function item (may have type params)
let fn_tpt = ty::lookup_item_type(tcx, def_id);
let substs = ty::substs { self_r: None, self_ty: None,
// For simplicity, we want to use the Subst trait when composing
// substitutions for default methods. The subst trait does
// substitutions with regions, though, so we put a dummy self
// region parameter in to keep it from failing. This is a hack.
let substs = ty::substs { self_r: Some(ty::re_empty),
self_ty: None,
tps: /*bad*/ type_params.to_owned() };

View File

@ -2346,6 +2346,7 @@ impl<T> FromIter<T> for ~[T]{
}
}
#[cfg(stage0)]
impl<A, T: Iterator<A>> FromIterator<A, T> for ~[A] {
pub fn from_iterator(iterator: &mut T) -> ~[A] {
let mut xs = ~[];
@ -2356,7 +2357,8 @@ impl<A, T: Iterator<A>> FromIterator<A, T> for ~[A] {
}
}
/* FIXME: #7341 - ICE
#[cfg(not(stage0))]
impl<A, T: Iterator<A>> FromIterator<A, T> for ~[A] {
pub fn from_iterator(iterator: &mut T) -> ~[A] {
let (lower, _) = iterator.size_hint();
@ -2367,7 +2369,7 @@ impl<A, T: Iterator<A>> FromIterator<A, T> for ~[A] {
xs
}
}
*/
#[cfg(test)]
mod tests {