diff options
| author | bors <bors@rust-lang.org> | 2019-08-27 06:18:24 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-08-27 06:18:24 +0000 |
| commit | 7e0afdad28c4d1154176df6d35a14e738ec311af (patch) | |
| tree | db371f782f0f0a0170f0ce86d9da66b10276fd14 /src/libsyntax/parse/parser.rs | |
| parent | 0444b9f66acb5da23dc816e0d8eb59623ba9ea50 (diff) | |
| parent | 23116baff042880209c06e78a1fb48fb2b06c76a (diff) | |
| download | rust-7e0afdad28c4d1154176df6d35a14e738ec311af.tar.gz rust-7e0afdad28c4d1154176df6d35a14e738ec311af.zip | |
Auto merge of #63940 - Centril:rollup-47qe9gn, r=Centril
Rollup of 4 pull requests Successful merges: - #62600 (libtest: add --show-output flag to print stdout of successful tests) - #63698 (Fixed floating point issue with asinh function) - #63761 (Propagate spans and attributes from proc macro definitions) - #63917 (Error when generator trait is not found) Failed merges: r? @ghost
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 25ad2d4404c..2b20cb88796 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -375,10 +375,11 @@ impl<'a> Parser<'a> { if let Some(directory) = directory { parser.directory = directory; } else if !parser.token.span.is_dummy() { - if let FileName::Real(mut path) = - sess.source_map().span_to_unmapped_path(parser.token.span) { - path.pop(); - parser.directory.path = Cow::from(path); + if let Some(FileName::Real(path)) = + &sess.source_map().lookup_char_pos(parser.token.span.lo()).file.unmapped_path { + if let Some(directory_path) = path.parent() { + parser.directory.path = Cow::from(directory_path.to_path_buf()); + } } } |
