Skip to content

Instantly share code, notes, and snippets.

@eholk
Created July 12, 2012 17:10
Show Gist options
  • Select an option

  • Save eholk/3099407 to your computer and use it in GitHub Desktop.

Select an option

Save eholk/3099407 to your computer and use it in GitHub Desktop.
// New view signature
pure fn view<T>(v: &a.[T], start: uint, end: uint) -> &a.[T]
// I get an error here
fn with_doc_data<T>(d: doc, f: fn(x: &[u8]) -> T) -> T {
ret f(vec::view::<u8>(*d.data, d.start, d.end));
}
// Here is the error
/Users/eholk/Documents/projects/mozilla/rust/src/libstd/ebml.rs:126:10: 126:51 error: reference is not valid outside of its lifetime, &<call at /Users/eholk/Documents/projects/mozilla/rust/src/libstd/ebml.rs:126:10: 126:51>
/Users/eholk/Documents/projects/mozilla/rust/src/libstd/ebml.rs:126 ret f(vec::view::<u8>(*d.data, d.start, d.end));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to previous error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment