Skip to content

Commit

Permalink
Make default method handling not choke on self region params. Closes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
msullivan committed Jun 28, 2013
1 parent 050d0e6 commit a9e51f5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 6 additions & 1 deletion src/librustc/middle/trans/callee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() };


Expand Down
6 changes: 4 additions & 2 deletions src/libstd/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ~[];
Expand All @@ -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();
Expand All @@ -2367,7 +2369,7 @@ impl<A, T: Iterator<A>> FromIterator<A, T> for ~[A] {
xs
}
}
*/


#[cfg(test)]
mod tests {
Expand Down

0 comments on commit a9e51f5

Please sign in to comment.