diff --git a/src/librustc_driver/pretty.rs b/src/librustc_driver/pretty.rs index 8c84e561e31..0a093887c50 100644 --- a/src/librustc_driver/pretty.rs +++ b/src/librustc_driver/pretty.rs @@ -757,6 +757,7 @@ fn get_source(input: &Input, sess: &Session) -> (Vec, String) { let src_name = driver::source_name(input); let src = sess.codemap() .get_filemap(&src_name) + .unwrap() .src .as_ref() .unwrap() diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index ca8708fdc83..3b13bf2fc50 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -1191,13 +1191,13 @@ impl CodeMap { } } - pub fn get_filemap(&self, filename: &str) -> Rc { + pub fn get_filemap(&self, filename: &str) -> Option> { for fm in self.files.borrow().iter() { if filename == fm.name { - return fm.clone(); + return Some(fm.clone()); } } - panic!("asking for {} which we don't know about", filename); + None } /// For a global BytePos compute the local offset within the containing FileMap