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/ext | |
| 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/ext')
| -rw-r--r-- | src/libsyntax/ext/source_util.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs index 3e375e1798d..fd229d77966 100644 --- a/src/libsyntax/ext/source_util.rs +++ b/src/libsyntax/ext/source_util.rs @@ -154,7 +154,7 @@ pub fn expand_include_str(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) // dependency information let filename = format!("{}", file.display()); let interned = token::intern_and_get_ident(&src[..]); - cx.codemap().new_filemap_and_lines(&filename, &src); + cx.codemap().new_filemap_and_lines(&filename, None, &src); base::MacEager::expr(cx.expr_str(sp, interned)) } @@ -185,7 +185,7 @@ pub fn expand_include_bytes(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) // Add this input file to the code map to make it available as // dependency information, but don't enter it's contents let filename = format!("{}", file.display()); - cx.codemap().new_filemap_and_lines(&filename, ""); + cx.codemap().new_filemap_and_lines(&filename, None, ""); base::MacEager::expr(cx.expr_lit(sp, ast::LitKind::ByteStr(Rc::new(bytes)))) } |
