Skip to content

Commit a9e51f5

Browse files
committed
Make default method handling not choke on self region params. Closes #7341.
1 parent 050d0e6 commit a9e51f5

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/librustc/middle/trans/callee.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,12 @@ pub fn trans_fn_ref_with_vtables(
233233
// Polytype of the function item (may have type params)
234234
let fn_tpt = ty::lookup_item_type(tcx, def_id);
235235

236-
let substs = ty::substs { self_r: None, self_ty: None,
236+
// For simplicity, we want to use the Subst trait when composing
237+
// substitutions for default methods. The subst trait does
238+
// substitutions with regions, though, so we put a dummy self
239+
// region parameter in to keep it from failing. This is a hack.
240+
let substs = ty::substs { self_r: Some(ty::re_empty),
241+
self_ty: None,
237242
tps: /*bad*/ type_params.to_owned() };
238243

239244

src/libstd/vec.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -2346,6 +2346,7 @@ impl<T> FromIter<T> for ~[T]{
23462346
}
23472347
}
23482348

2349+
#[cfg(stage0)]
23492350
impl<A, T: Iterator<A>> FromIterator<A, T> for ~[A] {
23502351
pub fn from_iterator(iterator: &mut T) -> ~[A] {
23512352
let mut xs = ~[];
@@ -2356,7 +2357,8 @@ impl<A, T: Iterator<A>> FromIterator<A, T> for ~[A] {
23562357
}
23572358
}
23582359

2359-
/* FIXME: #7341 - ICE
2360+
2361+
#[cfg(not(stage0))]
23602362
impl<A, T: Iterator<A>> FromIterator<A, T> for ~[A] {
23612363
pub fn from_iterator(iterator: &mut T) -> ~[A] {
23622364
let (lower, _) = iterator.size_hint();
@@ -2367,7 +2369,7 @@ impl<A, T: Iterator<A>> FromIterator<A, T> for ~[A] {
23672369
xs
23682370
}
23692371
}
2370-
*/
2372+
23712373

23722374
#[cfg(test)]
23732375
mod tests {

0 commit comments

Comments
 (0)