diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2016-05-27 10:02:45 +0530 |
|---|---|---|
| committer | Manish Goregaokar <manishsmail@gmail.com> | 2016-05-27 10:02:45 +0530 |
| commit | 63dfbdbc1bc1ace106a525682f77b3d08af9ad71 (patch) | |
| tree | 7e1af7784abe1ebab1c219d13e1a57439eb91996 /src/libsyntax | |
| parent | 7905452f083ab5ac3008dfe6727048e70bbeb142 (diff) | |
| parent | 3bef085ea8da749c234fb4afc749810a5b9c6c16 (diff) | |
| download | rust-63dfbdbc1bc1ace106a525682f77b3d08af9ad71.tar.gz rust-63dfbdbc1bc1ace106a525682f77b3d08af9ad71.zip | |
Rollup merge of #33839 - kamalmarhubi:codemape-get-filemap-option, r=nmatsakis
This is more idiomatic, putting the caller in charge of whether or not to panic.
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/codemap.rs | 6 |
1 files changed, 3 insertions, 3 deletions
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<FileMap> { + pub fn get_filemap(&self, filename: &str) -> Option<Rc<FileMap>> { 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 |
