about summary refs log tree commit diff
path: root/src/librustc_span/source_map.rs
AgeCommit message (Collapse)AuthorLines
2020-04-17Remove unused abs_path method from rustc_span::source_map::FileLoaderShea Levy-12/+0
2020-04-02Add hash of source files in debug infoArlo Siemsen-7/+12
* Adds either an MD5 or SHA1 hash to the debug info. * Adds new unstable option `-Z src-hash-algorithm` to control the hashing algorithm.
2020-03-25Rename `def_span` to `guess_head_span`Esteban Küber-1/+8
2020-03-23Rollup merge of #70199 - ↵Mazdak Farrokhzad-0/+7
pnkfelix:issue-68808-dont-turn-dummy-spans-into-invalid-lines, r=estebank Revised span-to-lines conversion to produce an empty vec on DUMMY_SP. This required revising some of the client code to stop relying on the returned set of lines being non-empty. Fix #68808
2020-03-23Update src/librustc_span/source_map.rsFelix S Klock II-1/+1
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2020-03-21remove redundant returns (clippy::needless_return)Matthias Krüger-4/+4
2020-03-20remove redundant returns (clippy::needless_return)Matthias Krüger-9/+7
2020-03-20Revised span-to-lines conversion to produce an empty vec on DUMMY_SP.Felix S. Klock II-0/+7
This required revising some of the client code to stop relying on the returned set of lines being non-empty.
2020-03-18Properly handle Spans that reference imported SourceFilesAaron Hill-3/+9
Previously, metadata encoding used DUMMY_SP to represent any spans that referenced an 'imported' SourceFile - e.g. a SourceFile from an upstream dependency. These leads to sub-optimal error messages in certain cases (see the included test). This PR changes how we encode and decode spans in crate metadata. We encode spans in one of two ways: * 'Local' spans, which reference non-imported SourceFiles, are encoded exactly as before. * 'Foreign' spans, which reference imported SourceFiles, are encoded with the CrateNum of their 'originating' crate. Additionally, their 'lo' and 'high' values are rebased on top of the 'originating' crate, which allows them to be used with the SourceMap data encoded for that crate. The `ExternalSource` enum is renamed to `ExternalSourceKind`. There is now a struct called `ExternalSource`, which holds an `ExternalSourceKind` along with the original line number information for the file. This is used during `Span` serialization to rebase spans onto their 'owning' crate.
2020-03-11Rollup merge of #69760 - Centril:parse-expr-improve, r=estebankMazdak Farrokhzad-0/+7
Improve expression & attribute parsing This PR includes misc improvements to expression and attribute parsing. 1. Some code simplifications 2. Better recovery for various block forms, e.g. `loop statements }` (missing `{` after `loop`). (See e.g., `block-no-opening-brace.rs` among others for examples.) 3. Added recovery for e.g., `unsafe $b` where `$b` refers to a `block` macro fragment. (See `bad-interpolated-block.rs` for examples.) 4. ^--- These are done so that code sharing in block parsing is increased. 5. Added recovery for e.g., `'label: loop { ... }` (See `labeled-no-colon-expr.rs`.) 6. Added recovery for e.g., `&'lifetime expr` (See `regions-out-of-scope-slice.rs`.) 7. Added recovery for e.g., `fn foo() = expr;` (See `fn-body-eq-expr-semi.rs`.) 8. Simplified attribute parsing code & slightly improved diagnostics. 9. Added recovery for e.g., `Box<('a) + Trait>`. 10. Added recovery for e.g, `if true #[attr] {} else #[attr] {} else #[attr] if true {}`. r? @estebank
2020-03-10error_block_no_opening_brace: handle closures betterMazdak Farrokhzad-0/+7
2020-03-10Store `TokenStream` in `rmeta::MacroDef`.Mazdak Farrokhzad-0/+6
This removes a hack from `load_macro_untracked` in which parsing is used.
2020-03-07Rollup merge of #69656 - matthiaskrgr:iter_nth_zero, r=oli-obkMazdak Farrokhzad-3/+3
Use .next() instead of .nth(0) on iterators.
2020-03-03use conditions directlyMatthias Krüger-1/+1
2020-03-03Use .next() instead of .nth(0) on iterators.Matthias Krüger-3/+3
2020-03-01Rollup merge of #69580 - matthiaskrgr:map_clone, r=CentrilYuki Okushi-1/+1
use .copied() instead of .map(|x| *x) on iterators
2020-02-29use .copied() instead of .map(|x| *x) on iteratorsMatthias Krüger-1/+1
2020-02-29use .iter() instead of .into_iter() on references.Matthias Krüger-2/+2
2020-02-18Fix race condition when allocating source files in SourceMapJohn Kåre Alsaker-13/+43
2020-02-06rustc_errors: split macro backtrace rendering from <*macros> hacks.Eduard-Mihai Burtescu-8/+0
2020-01-26rustc_span: return an impl Iterator instead of a Vec from macro_backtrace.Eduard-Mihai Burtescu-2/+1
2020-01-23unused-parens: implement for block return valuesTyler Lanphear-2/+2
2020-01-16Do not ICE on malformed suggestion spansEsteban Küber-4/+7
2020-01-10Fix `next_point` to be unicode awareEsteban Küber-1/+1
2020-01-08span_to_lines: account for DUMMY_SPMazdak Farrokhzad-2/+3
2019-12-30Rename directories for some crates from `syntax_x` to `rustc_x`Vadim Petrochenkov-0/+984
`syntax_expand` -> `rustc_expand` `syntax_pos` -> `rustc_span` `syntax_ext` -> `rustc_builtin_macros`