Last active
August 29, 2015 14:10
-
-
Save japaric/a8df9fbee1a6f7f70dc1 to your computer and use it in GitHub Desktop.
reached the recursion limit during monomorphization
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(unboxed_closures)] | |
struct Struct; | |
#[cfg(error)] | |
impl Struct { | |
fn search<F>(&self, f: F) -> bool where F: FnMut(()) -> bool { | |
self.search(|t| f(t)) | |
} | |
} | |
#[cfg(not(error))] | |
impl Struct { | |
fn search(&self, f: |()| -> bool) -> bool { | |
self.search(|t| f(t)) | |
} | |
} | |
fn main() { | |
Struct.search(|_| true); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
impl<T> InternalNode<T> { | |
fn each_reverse<F>(&self, mut f: F) -> bool where F: FnMut(&uint, &T) -> bool { | |
let f: &mut FnMut(_, _) -> _ = &mut f; | |
for elt in self.children.iter().rev() { | |
match *elt { | |
Internal(ref x) => if !x.each_reverse(|i,t| f.call_mut((i,t))) { return false }, | |
External(k, ref v) => if !f.call_mut((&k, v)) { return false }, | |
Nothing => () | |
} | |
} | |
true | |
} | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` rust | |
/root/rust/src/libcollections/trie/map.rs:718:73: 718:74 error: cannot infer an appropriate lifetime for automatic coercion due to conflicting requirements | |
/root/rust/src/libcollections/trie/map.rs:718 Internal(ref x) => if !x.each_reverse(|i,t| f.call_mut((i,t))) { return false }, | |
^ | |
/root/rust/src/libcollections/trie/map.rs:719:43: 719:62 note: first, the lifetime cannot outlive the method call at 719:42... | |
/root/rust/src/libcollections/trie/map.rs:719 External(k, ref v) => if !f.call_mut((&k, v)) { return false }, | |
^~~~~~~~~~~~~~~~~~~ | |
/root/rust/src/libcollections/trie/map.rs:719:43: 719:62 note: ...so that type parameter instantiated with `(&uint, &T)`, will meet its declared lifetime bounds | |
/root/rust/src/libcollections/trie/map.rs:719 External(k, ref v) => if !f.call_mut((&k, v)) { return false }, | |
^~~~~~~~~~~~~~~~~~~ | |
/root/rust/src/libcollections/trie/map.rs:718:73: 718:74 note: but, the lifetime must be valid for the expression at 718:72... | |
/root/rust/src/libcollections/trie/map.rs:718 Internal(ref x) => if !x.each_reverse(|i,t| f.call_mut((i,t))) { return false }, | |
^ | |
/root/rust/src/libcollections/trie/map.rs:718:73: 718:74 note: ...so that auto-reference is valid at the time of borrow | |
/root/rust/src/libcollections/trie/map.rs:718 Internal(ref x) => if !x.each_reverse(|i,t| f.call_mut((i,t))) { return false }, | |
^ | |
/root/rust/src/libcollections/trie/map.rs:718:75: 718:76 error: cannot infer an appropriate lifetime for automatic coercion due to conflicting requirements | |
/root/rust/src/libcollections/trie/map.rs:718 Internal(ref x) => if !x.each_reverse(|i,t| f.call_mut((i,t))) { return false }, | |
^ | |
/root/rust/src/libcollections/trie/map.rs:719:43: 719:62 note: first, the lifetime cannot outlive the method call at 719:42... | |
/root/rust/src/libcollections/trie/map.rs:719 External(k, ref v) => if !f.call_mut((&k, v)) { return false }, | |
^~~~~~~~~~~~~~~~~~~ | |
/root/rust/src/libcollections/trie/map.rs:719:43: 719:62 note: ...so that type parameter instantiated with `(&uint, &T)`, will meet its declared lifetime bounds | |
/root/rust/src/libcollections/trie/map.rs:719 External(k, ref v) => if !f.call_mut((&k, v)) { return false }, | |
^~~~~~~~~~~~~~~~~~~ | |
/root/rust/src/libcollections/trie/map.rs:718:75: 718:76 note: but, the lifetime must be valid for the expression at 718:74... | |
/root/rust/src/libcollections/trie/map.rs:718 Internal(ref x) => if !x.each_reverse(|i,t| f.call_mut((i,t))) { return false }, | |
^ | |
/root/rust/src/libcollections/trie/map.rs:718:75: 718:76 note: ...so that auto-reference is valid at the time of borrow | |
/root/rust/src/libcollections/trie/map.rs:718 Internal(ref x) => if !x.each_reverse(|i,t| f.call_mut((i,t))) { return false }, | |
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
impl<T> InternalNode<T> { | |
fn each_reverse<F>(&self, mut f: F) -> bool where F: FnMut(&uint, &T) -> bool { | |
let f: Box<FnMut(_, _) -> _>= box f; | |
for elt in self.children.iter().rev() { | |
match *elt { | |
Internal(ref x) => if !x.each_reverse(|i,t| f.call_mut((i,t))) { return false }, | |
External(k, ref v) => if !f.call_mut((&k, v)) { return false }, | |
Nothing => () | |
} | |
} | |
true | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` rust | |
/root/rust/src/libcollections/trie/map.rs:718:73: 718:74 error: cannot infer an appropriate lifetime for automatic coercion due to conflicting requirements | |
/root/rust/src/libcollections/trie/map.rs:718 Internal(ref x) => if !x.each_reverse(|i,t| f.call_mut((i,t))) { return false }, | |
^ | |
/root/rust/src/libcollections/trie/map.rs:719:54: 719:62 note: first, the lifetime cannot outlive the expression at 719:53... | |
/root/rust/src/libcollections/trie/map.rs:719 External(k, ref v) => if !f.call_mut((&k, v)) { return false }, | |
^~~~~~~~ | |
/root/rust/src/libcollections/trie/map.rs:719:54: 719:62 note: ...so type `(&uint, &T)` of expression is valid during the expression | |
/root/rust/src/libcollections/trie/map.rs:719 External(k, ref v) => if !f.call_mut((&k, v)) { return false }, | |
^~~~~~~~ | |
/root/rust/src/libcollections/trie/map.rs:718:73: 718:74 note: but, the lifetime must be valid for the expression at 718:72... | |
/root/rust/src/libcollections/trie/map.rs:718 Internal(ref x) => if !x.each_reverse(|i,t| f.call_mut((i,t))) { return false }, | |
^ | |
/root/rust/src/libcollections/trie/map.rs:718:73: 718:74 note: ...so that auto-reference is valid at the time of borrow | |
/root/rust/src/libcollections/trie/map.rs:718 Internal(ref x) => if !x.each_reverse(|i,t| f.call_mut((i,t))) { return false }, | |
^ | |
/root/rust/src/libcollections/trie/map.rs:718:75: 718:76 error: cannot infer an appropriate lifetime for automatic coercion due to conflicting requirements | |
/root/rust/src/libcollections/trie/map.rs:718 Internal(ref x) => if !x.each_reverse(|i,t| f.call_mut((i,t))) { return false }, | |
^ | |
/root/rust/src/libcollections/trie/map.rs:719:43: 719:62 note: first, the lifetime cannot outlive the method call at 719:42... | |
/root/rust/src/libcollections/trie/map.rs:719 External(k, ref v) => if !f.call_mut((&k, v)) { return false }, | |
^~~~~~~~~~~~~~~~~~~ | |
/root/rust/src/libcollections/trie/map.rs:719:43: 719:62 note: ...so that type parameter instantiated with `(&uint, &T)`, will meet its declared lifetime bounds | |
/root/rust/src/libcollections/trie/map.rs:719 External(k, ref v) => if !f.call_mut((&k, v)) { return false }, | |
^~~~~~~~~~~~~~~~~~~ | |
/root/rust/src/libcollections/trie/map.rs:718:75: 718:76 note: but, the lifetime must be valid for the expression at 718:74... | |
/root/rust/src/libcollections/trie/map.rs:718 Internal(ref x) => if !x.each_reverse(|i,t| f.call_mut((i,t))) { return false }, | |
^ | |
/root/rust/src/libcollections/trie/map.rs:718:75: 718:76 note: ...so that auto-reference is valid at the time of borrow | |
/root/rust/src/libcollections/trie/map.rs:718 Internal(ref x) => if !x.each_reverse(|i,t| f.call_mut((i,t))) { return false }, | |
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
impl<T> InternalNode<T> { | |
fn each_reverse<F>(&self, mut f: F) -> bool where F: FnMut(&uint, &T) -> bool { | |
let f: &mut FnMut(&uint, &T) -> bool = &mut f; | |
for elt in self.children.iter().rev() { | |
match *elt { | |
Internal(ref x) => if !x.each_reverse(|i,t| f.call_mut((i,t))) { return false }, | |
External(k, ref v) => if !f.call_mut((&k, v)) { return false }, | |
Nothing => () | |
} | |
} | |
true | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` rust | |
/root/rust/src/libcollections/trie/map.rs:713:5: 724:6 error: reached the recursion limit during monomorphization | |
/root/rust/src/libcollections/trie/map.rs:713 fn each_reverse<F>(&self, mut f: F) -> bool where F: FnMut(&uint, &T) -> bool { | |
/root/rust/src/libcollections/trie/map.rs:714 let f: &mut FnMut(&uint, &T) -> bool = &mut f; | |
/root/rust/src/libcollections/trie/map.rs:715 | |
/root/rust/src/libcollections/trie/map.rs:716 for elt in self.children.iter().rev() { | |
/root/rust/src/libcollections/trie/map.rs:717 match *elt { | |
/root/rust/src/libcollections/trie/map.rs:718 Internal(ref x) => if !x.each_reverse(|i,t| f.call_mut((i,t))) { return false }, | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment