Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly handle Spans that reference imported SourceFiles #68941

Merged
merged 1 commit into from
Mar 19, 2020

Commits on Mar 19, 2020

  1. 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.
    Aaron1011 committed Mar 19, 2020
    Configuration menu
    Copy the full SHA
    5e28561 View commit details
    Browse the repository at this point in the history