about summary refs log tree commit diff
path: root/src/libsyntax/parse/lexer
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-12-06 01:36:51 +0000
committerbors <bors@rust-lang.org>2018-12-06 01:36:51 +0000
commit1839c144bc6db8c07945caacd449aa7f3a76cd47 (patch)
treee9bcbb9af70c5861b071456fce4071f22f75a01c /src/libsyntax/parse/lexer
parent4988b096e673204b91683dc693fc3eb6b2323e97 (diff)
parentf0f8aa9e05726bfbc065fa2504daf3232f29bc03 (diff)
downloadrust-1839c144bc6db8c07945caacd449aa7f3a76cd47.tar.gz
rust-1839c144bc6db8c07945caacd449aa7f3a76cd47.zip
Auto merge of #54517 - mcr431:53956-panic-on-include_bytes-of-own-file, r=michaelwoerister
53956 panic on include bytes of own file

fix #53956

When using `include_bytes!` on a source file in the project, compiler would panic on subsequent compilations because `expand_include_bytes` would overwrite files in the source_map with no source. This PR changes `expand_include_bytes` to check source_map and use the already existing src, if any.
Diffstat (limited to 'src/libsyntax/parse/lexer')
-rw-r--r--src/libsyntax/parse/lexer/mod.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs
index 0c8e81a0ee6..80227fdf82d 100644
--- a/src/libsyntax/parse/lexer/mod.rs
+++ b/src/libsyntax/parse/lexer/mod.rs
@@ -1900,7 +1900,7 @@ mod tests {
                  sess: &'a ParseSess,
                  teststr: String)
                  -> StringReader<'a> {
-        let sf = sm.new_source_file(PathBuf::from("zebra.rs").into(), teststr);
+        let sf = sm.new_source_file(PathBuf::from(teststr.clone()).into(), teststr);
         StringReader::new(sess, sf, None)
     }