about summary refs log tree commit diff
path: root/src/librustc_span/source_map.rs
AgeCommit message (Collapse)AuthorLines
2020-08-30mv compiler to compiler/mark-1097/+0
2020-08-15replaced log with tracingGurpreet Singh-1/+1
2020-08-14Rework `rustc_serialize`Matthew Jasper-2/+2
- Move the type parameter from `encode` and `decode` methods to the trait. - Remove `UseSpecialized(En|De)codable` traits. - Remove blanket impls for references. - Add `RefDecodable` trait to allow deserializing to arena-allocated references safely. - Remove ability to (de)serialize HIR. - Create proc-macros `(Ty)?(En|De)codable` to help implement these new traits.
2020-06-29Serialize all foreign `SourceFile`s into proc-macro crate metadataAaron Hill-2/+41
Normally, we encode a `Span` that references a foreign `SourceFile` by encoding information about the foreign crate. When we decode this `Span`, we lookup the foreign crate in order to decode the `SourceFile`. However, this approach does not work for proc-macro crates. When we load a proc-macro crate, we do not deserialzie any of its dependencies (since a proc-macro crate can only export proc-macros). This means that we cannot serialize a reference to an upstream crate, since the associated metadata will not be available when we try to deserialize it. This commit modifies foreign span handling so that we treat all foreign `SourceFile`s as local `SourceFile`s when serializing a proc-macro. All `SourceFile`s will be stored into the metadata of a proc-macro crate, allowing us to cotinue to deserialize a proc-macro crate without needing to load any of its dependencies. Since the number of foreign `SourceFile`s that we load during a compilation session may be very large, we only serialize a `SourceFile` if we have also serialized a `Span` which requires it.
2020-06-10Migrate to numeric associated constsLzu Tao-3/+1
2020-05-29Use the virtual name for libstd files in StableSourceFileId and also in theFelix S. Klock II-1/+10
encoded build artifacts. Fix #70924.
2020-05-29Split payload of FileName::Real to track both real and virutalized paths.Felix S. Klock II-8/+17
Such splits arise from metadata refs into libstd. This way, we can (in a follow on commit) continue to emit the virtual name into things like the like the StableSourceFileId that ends up in incremetnal build artifacts, while still using the devirtualized file path when we want to access the file. Note that this commit is intended to be a refactoring; the actual fix to the bug in question is in a follow-on commit.
2020-05-29`StableSourceFileId::new_from_pieces` does not need to be public.Felix S. Klock II-1/+1
(and I want to discourage further use of it if possible.)
2020-05-16break out earlier on empty snippetcsmoe-8/+17
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`