diff options
| author | bors <bors@rust-lang.org> | 2016-06-16 12:13:25 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-06-16 12:13:25 -0700 |
| commit | 18f28719efd4268bcd8747b65810646e86901155 (patch) | |
| tree | 2e900cdc81e46221e491b50480076c6cac3c72cc /src/libsyntax/parse | |
| parent | 12b6345bc2d0cc02d81bc712682b3c77346acc15 (diff) | |
| parent | 24e7491660845e52240afc36acf332b92547b0a1 (diff) | |
| download | rust-18f28719efd4268bcd8747b65810646e86901155.tar.gz rust-18f28719efd4268bcd8747b65810646e86901155.zip | |
Auto merge of #34187 - luser:extern-crate-abspaths, r=michaelwoerister
Add an abs_path member to FileMap, use it when writing debug info. Fixes #34179. When items are inlined from extern crates, the filename in the debug info is taken from the FileMap that's serialized in the rlib metadata. Currently this is just FileMap.name, which is whatever path is passed to rustc. Since libcore and libstd are built by invoking rustc with relative paths, they wind up with relative paths in the rlib, and when linked into a binary the debug info uses relative paths for the names, but since the compilation directory for the final binary, tools trying to read source filenames will wind up with bad paths. We noticed this in Firefox with source filenames from libcore/libstd having bad paths. This change stores an absolute path in FileMap.abs_path, and uses that if available for writing debug info. This is not going to magically make debuggers able to find the source, but it will at least provide sensible paths.
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/lexer/comments.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/parse/lexer/mod.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/parse/mod.rs | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/src/libsyntax/parse/lexer/comments.rs b/src/libsyntax/parse/lexer/comments.rs index 629edced804..06d255d5c0f 100644 --- a/src/libsyntax/parse/lexer/comments.rs +++ b/src/libsyntax/parse/lexer/comments.rs @@ -346,7 +346,7 @@ pub fn gather_comments_and_literals(span_diagnostic: &errors::Handler, srdr.read_to_end(&mut src).unwrap(); let src = String::from_utf8(src).unwrap(); let cm = CodeMap::new(); - let filemap = cm.new_filemap(path, src); + let filemap = cm.new_filemap(path, None, src); let mut rdr = lexer::StringReader::new_raw(span_diagnostic, filemap); let mut comments: Vec<Comment> = Vec::new(); diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs index da62e5286d4..d78a81dec83 100644 --- a/src/libsyntax/parse/lexer/mod.rs +++ b/src/libsyntax/parse/lexer/mod.rs @@ -1695,7 +1695,7 @@ mod tests { span_handler: &'a errors::Handler, teststr: String) -> StringReader<'a> { - let fm = cm.new_filemap("zebra.rs".to_string(), teststr); + let fm = cm.new_filemap("zebra.rs".to_string(), None, teststr); StringReader::new(span_handler, fm) } diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index 2a9bcfd658c..2e4d46bc983 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -178,7 +178,7 @@ pub fn new_parser_from_source_str<'a>(sess: &'a ParseSess, name: String, source: String) -> Parser<'a> { - filemap_to_parser(sess, sess.codemap().new_filemap(name, source), cfg) + filemap_to_parser(sess, sess.codemap().new_filemap(name, None, source), cfg) } /// Create a new parser, handling errors as appropriate |
