From a9e51f5f701d8104be0adfb50f5d409f8bf233ff Mon Sep 17 00:00:00 2001 From: Michael Sullivan Date: Tue, 25 Jun 2013 14:07:44 -0700 Subject: [PATCH] Make default method handling not choke on self region params. Closes #7341. --- src/librustc/middle/trans/callee.rs | 7 ++++++- src/libstd/vec.rs | 6 ++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/librustc/middle/trans/callee.rs b/src/librustc/middle/trans/callee.rs index 3405db8e52f6b..27f1c4d039da1 100644 --- a/src/librustc/middle/trans/callee.rs +++ b/src/librustc/middle/trans/callee.rs @@ -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() }; diff --git a/src/libstd/vec.rs b/src/libstd/vec.rs index aa4d632a48273..8555d99255d5a 100644 --- a/src/libstd/vec.rs +++ b/src/libstd/vec.rs @@ -2346,6 +2346,7 @@ impl FromIter for ~[T]{ } } +#[cfg(stage0)] impl> FromIterator for ~[A] { pub fn from_iterator(iterator: &mut T) -> ~[A] { let mut xs = ~[]; @@ -2356,7 +2357,8 @@ impl> FromIterator for ~[A] { } } -/* FIXME: #7341 - ICE + +#[cfg(not(stage0))] impl> FromIterator for ~[A] { pub fn from_iterator(iterator: &mut T) -> ~[A] { let (lower, _) = iterator.size_hint(); @@ -2367,7 +2369,7 @@ impl> FromIterator for ~[A] { xs } } -*/ + #[cfg(test)] mod tests {