diff options
| author | Aaron Hill <aa1ronham@gmail.com> | 2020-02-07 14:02:24 -0500 |
|---|---|---|
| committer | Aaron Hill <aa1ronham@gmail.com> | 2020-03-18 23:56:42 -0400 |
| commit | 5e2856122a42a9e148d9d583561f7b07037bd3bc (patch) | |
| tree | 1994fb8f06bf0bb08c3dc451f3da8cda67950f59 /src/test/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs | |
| parent | 57e1da59cd0761330b4ea8d47b16340a78eeafa9 (diff) | |
| download | rust-5e2856122a42a9e148d9d583561f7b07037bd3bc.tar.gz rust-5e2856122a42a9e148d9d583561f7b07037bd3bc.zip | |
Properly handle Spans that reference imported SourceFiles
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.
Diffstat (limited to 'src/test/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs')
0 files changed, 0 insertions, 0 deletions
