Skip to content

Instantly share code, notes, and snippets.

@rrichardson
Created March 27, 2012 21:22
Show Gist options
  • Save rrichardson/2220377 to your computer and use it in GitHub Desktop.
Save rrichardson/2220377 to your computer and use it in GitHub Desktop.
this
fn readZip(fname: str) -> io::reader unsafe {
let mode= "r";
let fptr = str::as_c_str(fname) {|f| str::as_c_str(mode) { |m| libc::popen(f, m) }; };
io::FILE_reader(fptr, true);
}
fn main() {
let rd = readZip("unzip -p \*.zip");
}
///////////
import.rs:9:34: 9:87 error: in function anon, not all control paths return a value
import.rs:9 let fptr = str::as_c_str(fname) {|f| str::as_c_str(mode) { |m| libc::popen(f, m) }; };
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: internal compiler error unexpected failure
note: The compiler hit an unexpected failure path. This is a bug. Try running with RUST_LOG=rustc=0,::rt::backtrace to get further details and report the results to github.com/mozilla/rust/issues
@rrichardson
Copy link
Author

import.rs:7:37: 11:1 error: in function readZip, not all control paths return a value
import.rs:7 fn readZip(fname: str) -> io::reader unsafe {
import.rs:8 let mode= "r";
import.rs:9 let fptr = str::as_c_str(fname) {|f| str::as_c_str(mode) { |m| libc::popen(f, m) } };
import.rs:10 io::FILE_reader(fptr, true);
import.rs:11 }
import.rs:7:26: 7:36 error: see declared return type of 'io::reader'
import.rs:7 fn readZip(fname: str) -> io::reader unsafe {
^~~~~~~~~~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment