rust/src/test/ui/span
Aaron Hill 5e2856122a
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.
2020-03-18 23:56:42 -04:00
..
auxiliary Properly handle Spans that reference imported SourceFiles 2020-03-18 23:56:42 -04:00
borrowck-borrow-overloaded-auto-deref-mut.rs Remove licenses 2018-12-25 21:08:33 -07:00
borrowck-borrow-overloaded-auto-deref-mut.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
borrowck-borrow-overloaded-deref-mut.rs Remove licenses 2018-12-25 21:08:33 -07:00
borrowck-borrow-overloaded-deref-mut.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
borrowck-call-is-borrow-issue-12224.rs Update tests for changes to cannot move errors 2019-06-03 14:55:29 +01:00
borrowck-call-is-borrow-issue-12224.stderr Update tests for changes to cannot move errors 2019-06-03 14:55:29 +01:00
borrowck-call-method-from-mut-aliasable.rs Remove licenses 2018-12-25 21:08:33 -07:00
borrowck-call-method-from-mut-aliasable.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
borrowck-fn-in-const-b.rs Remove licenses 2018-12-25 21:08:33 -07:00
borrowck-fn-in-const-b.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
borrowck-let-suggestion-suffixes.rs update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
borrowck-let-suggestion-suffixes.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
borrowck-object-mutability.rs Update ui test suite to use dyn 2019-05-29 00:57:31 -04:00
borrowck-object-mutability.stderr Update ui test suite to use dyn 2019-05-29 00:57:31 -04:00
borrowck-ref-into-rvalue.rs update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
borrowck-ref-into-rvalue.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
coerce-suggestions.rs Remove licenses 2018-12-25 21:08:33 -07:00
coerce-suggestions.stderr rustc_macros: don't limit the -Zmacro-backtrace suggestion to extern macros. 2020-02-06 21:46:38 +02:00
destructor-restrictions.rs Remove licenses 2018-12-25 21:08:33 -07:00
destructor-restrictions.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
dropck-object-cycle.rs Update ui test suite to use dyn 2019-05-29 00:57:31 -04:00
dropck-object-cycle.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
dropck_arr_cycle_checked.rs update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
dropck_arr_cycle_checked.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
dropck_direct_cycle_with_drop.rs Remove licenses 2018-12-25 21:08:33 -07:00
dropck_direct_cycle_with_drop.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
dropck_misc_variants.rs Remove licenses 2018-12-25 21:08:33 -07:00
dropck_misc_variants.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
dropck_vec_cycle_checked.rs update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
dropck_vec_cycle_checked.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
E0046.rs Remove licenses 2018-12-25 21:08:33 -07:00
E0046.stderr Remove licenses 2018-12-25 21:08:33 -07:00
E0057.rs Remove licenses 2018-12-25 21:08:33 -07:00
E0057.stderr On mismatched argument count point at arguments 2020-02-11 12:42:00 -08:00
E0072.rs Remove licenses 2018-12-25 21:08:33 -07:00
E0072.stderr Update tests 2019-03-11 23:10:26 +03:00
E0204.rs Remove licenses 2018-12-25 21:08:33 -07:00
E0204.stderr rustc_macros: don't limit the -Zmacro-backtrace suggestion to extern macros. 2020-02-06 21:46:38 +02:00
E0493.rs Remove licenses 2018-12-25 21:08:33 -07:00
E0493.stderr update tests 2019-09-30 13:47:12 +02:00
E0535.rs Remove licenses 2018-12-25 21:08:33 -07:00
E0535.stderr Update tests 2019-03-11 23:10:26 +03:00
E0536.rs Remove licenses 2018-12-25 21:08:33 -07:00
E0536.stderr Update tests 2019-03-11 23:10:26 +03:00
E0537.rs Remove licenses 2018-12-25 21:08:33 -07:00
E0537.stderr Update tests 2019-03-11 23:10:26 +03:00
gated-features-attr-spans.rs Make sure feature gate errors are recoverable (take 2) 2019-01-06 14:58:17 +03:00
gated-features-attr-spans.stderr --bless --compare-mode=nll 2020-02-09 20:43:49 +01:00
impl-wrong-item-for-trait.rs Remove licenses 2018-12-25 21:08:33 -07:00
impl-wrong-item-for-trait.stderr review comment 2020-02-08 21:08:59 -08:00
import-ty-params.rs Remove licenses 2018-12-25 21:08:33 -07:00
import-ty-params.stderr Update tests 2019-03-11 23:10:26 +03:00
issue-7575.rs Unify output of "variant not found" errors 2020-01-08 08:05:31 -08:00
issue-7575.stderr Do not suggest duplicate bounds 2020-02-02 18:38:23 +09:00
issue-11925.rs update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
issue-11925.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
issue-15480.rs update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
issue-15480.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
issue-23338-locals-die-before-temps-of-body.rs Remove licenses 2018-12-25 21:08:33 -07:00
issue-23338-locals-die-before-temps-of-body.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
issue-23729.rs Remove licenses 2018-12-25 21:08:33 -07:00
issue-23729.stderr Suggest missing item from trait in impl 2019-11-06 10:00:59 -08:00
issue-23827.rs Remove licenses 2018-12-25 21:08:33 -07:00
issue-23827.stderr Suggest missing item from trait in impl 2019-11-06 10:00:59 -08:00
issue-24356.rs Remove unnecessary ignore-tidy-linelength 2019-04-23 11:42:14 +01:00
issue-24356.stderr Suggest missing item from trait in impl 2019-11-06 10:00:59 -08:00
issue-24690.rs Use check-pass in ui tests where appropriate 2019-11-04 16:03:46 +01:00
issue-24690.stderr Normalise notes with the/is 2020-01-24 16:24:50 +00:00
issue-24805-dropck-child-has-items-via-parent.rs Remove licenses 2018-12-25 21:08:33 -07:00
issue-24805-dropck-child-has-items-via-parent.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
issue-24805-dropck-trait-has-items.rs Remove licenses 2018-12-25 21:08:33 -07:00
issue-24805-dropck-trait-has-items.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
issue-24895-copy-clone-dropck.rs Remove licenses 2018-12-25 21:08:33 -07:00
issue-24895-copy-clone-dropck.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
issue-25199.rs Update ui test suite to use dyn 2019-05-29 00:57:31 -04:00
issue-25199.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
issue-26656.rs Update ui test suite to use dyn 2019-05-29 00:57:31 -04:00
issue-26656.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
issue-27522.rs Refer to "self type" instead of "receiver type" 2019-09-02 19:07:04 -07:00
issue-27522.stderr Refer to "self type" instead of "receiver type" 2019-09-02 19:07:04 -07:00
issue-29106.rs Remove licenses 2018-12-25 21:08:33 -07:00
issue-29106.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
issue-29595.rs Remove licenses 2018-12-25 21:08:33 -07:00
issue-29595.stderr Use span label instead of note for cause in E0631 2019-08-31 00:14:23 -07:00
issue-33884.rs Remove licenses 2018-12-25 21:08:33 -07:00
issue-33884.stderr rustc_macros: don't limit the -Zmacro-backtrace suggestion to extern macros. 2020-02-06 21:46:38 +02:00
issue-34264.rs Remove licenses 2018-12-25 21:08:33 -07:00
issue-34264.stderr On mismatched argument count point at arguments 2020-02-11 12:42:00 -08:00
issue-35987.rs Remove licenses 2018-12-25 21:08:33 -07:00
issue-35987.stderr Increase spacing for suggestions in diagnostics 2019-10-24 12:26:01 -07:00
issue-36530.rs Remove #[feature(custom_attribute)] 2019-11-09 17:50:51 +03:00
issue-36530.stderr --bless --compare-mode=nll 2020-02-09 20:43:49 +01:00
issue-36537.rs Remove licenses 2018-12-25 21:08:33 -07:00
issue-36537.stderr Evaluate borrow and struct expressions in into 2019-11-11 22:06:54 +00:00
issue-37767.rs Remove licenses 2018-12-25 21:08:33 -07:00
issue-37767.stderr Use structured suggestion for disambiguating method calls 2019-12-11 17:42:28 -08:00
issue-39018.rs Update tests 2019-12-12 20:56:14 +01:00
issue-39018.stderr Do not emit note suggesting to implement trait to foreign type 2020-02-17 15:21:36 +01:00
issue-39698.rs Remove licenses 2018-12-25 21:08:33 -07:00
issue-39698.stderr Remove licenses 2018-12-25 21:08:33 -07:00
issue-40157.rs Remove licenses 2018-12-25 21:08:33 -07:00
issue-40157.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
issue-42234-unknown-receiver-type.rs Point at method call when type annotations are needed 2019-12-10 12:02:18 -08:00
issue-42234-unknown-receiver-type.stderr Add more context for type parameters 2019-12-11 17:18:43 -08:00
issue-43927-non-ADT-derive.rs Update tests 2020-01-09 21:23:12 +03:00
issue-43927-non-ADT-derive.stderr Update tests 2020-01-09 21:23:12 +03:00
issue28498-reject-ex1.rs update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
issue28498-reject-ex1.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
issue28498-reject-lifetime-param.rs Remove feature gate dropck_parametricity completely 2019-07-11 18:44:56 +00:00
issue28498-reject-lifetime-param.stderr Remove feature gate dropck_parametricity completely 2019-07-11 18:44:56 +00:00
issue28498-reject-passed-to-fn.rs Remove feature gate dropck_parametricity completely 2019-07-11 18:44:56 +00:00
issue28498-reject-passed-to-fn.stderr Remove feature gate dropck_parametricity completely 2019-07-11 18:44:56 +00:00
issue28498-reject-trait-bound.rs Remove feature gate dropck_parametricity completely 2019-07-11 18:44:56 +00:00
issue28498-reject-trait-bound.stderr Remove feature gate dropck_parametricity completely 2019-07-11 18:44:56 +00:00
lint-unused-unsafe.rs Remove licenses 2018-12-25 21:08:33 -07:00
lint-unused-unsafe.stderr Normalise notes with the/is 2020-01-24 16:24:50 +00:00
macro-span-replacement.rs Migrate compile-pass annotations to build-pass 2019-07-03 06:30:28 +09:00
macro-span-replacement.stderr rustc_macros: don't limit the -Zmacro-backtrace suggestion to extern macros. 2020-02-06 21:46:38 +02:00
macro-ty-params.rs derive: avoid parse_in_attr 2019-12-06 20:37:59 +01:00
macro-ty-params.stderr derive: avoid parse_in_attr 2019-12-06 20:37:59 +01:00
method-and-field-eager-resolution.rs Remove licenses 2018-12-25 21:08:33 -07:00
method-and-field-eager-resolution.stderr Remove licenses 2018-12-25 21:08:33 -07:00
missing-unit-argument.rs Remove licenses 2018-12-25 21:08:33 -07:00
missing-unit-argument.stderr On mismatched argument count point at arguments 2020-02-11 12:42:00 -08:00
move-closure.rs Remove licenses 2018-12-25 21:08:33 -07:00
move-closure.stderr Point at type in let assignment on type errors 2019-11-21 19:24:31 -08:00
multiline-span-E0072.rs Remove licenses 2018-12-25 21:08:33 -07:00
multiline-span-E0072.stderr Update tests 2019-03-11 23:10:26 +03:00
multiline-span-simple.rs Remove licenses 2018-12-25 21:08:33 -07:00
multiline-span-simple.stderr Update tests 2019-03-11 23:10:26 +03:00
multispan-import-lint.rs Migrate compile-pass annotations to build-pass 2019-07-03 06:30:28 +09:00
multispan-import-lint.stderr Normalise notes with the/is 2020-01-24 16:24:50 +00:00
mut-arg-hint.rs update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
mut-arg-hint.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
mut-ptr-cant-outlive-ref.rs Remove licenses 2018-12-25 21:08:33 -07:00
mut-ptr-cant-outlive-ref.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
non-existing-module-import.rs Remove licenses 2018-12-25 21:08:33 -07:00
non-existing-module-import.stderr Update tests 2019-03-11 23:10:26 +03:00
pub-struct-field.rs Remove licenses 2018-12-25 21:08:33 -07:00
pub-struct-field.stderr Update tests 2019-03-11 23:10:26 +03:00
range-2.rs Remove licenses 2018-12-25 21:08:33 -07:00
range-2.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
recursive-type-field.rs Remove licenses 2018-12-25 21:08:33 -07:00
recursive-type-field.stderr Update tests 2019-03-11 23:10:26 +03:00
regionck-unboxed-closure-lifetimes.rs Remove licenses 2018-12-25 21:08:33 -07:00
regionck-unboxed-closure-lifetimes.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
regions-close-over-borrowed-ref-in-obj.rs Update ui test suite to use dyn 2019-05-29 00:57:31 -04:00
regions-close-over-borrowed-ref-in-obj.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
regions-close-over-type-parameter-2.rs Update ui test suite to use dyn 2019-05-29 00:57:31 -04:00
regions-close-over-type-parameter-2.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
regions-escape-loop-via-variable.rs Remove licenses 2018-12-25 21:08:33 -07:00
regions-escape-loop-via-variable.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
regions-escape-loop-via-vec.rs update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
regions-escape-loop-via-vec.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
regions-infer-borrow-scope-within-loop.rs Remove licenses 2018-12-25 21:08:33 -07:00
regions-infer-borrow-scope-within-loop.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
send-is-not-static-ensures-scoping.rs Update ui test suite to use dyn 2019-05-29 00:57:31 -04:00
send-is-not-static-ensures-scoping.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
send-is-not-static-std-sync-2.rs Remove licenses 2018-12-25 21:08:33 -07:00
send-is-not-static-std-sync-2.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
send-is-not-static-std-sync.rs Remove licenses 2018-12-25 21:08:33 -07:00
send-is-not-static-std-sync.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
slice-borrow.rs update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
slice-borrow.stderr rustc_macros: don't limit the -Zmacro-backtrace suggestion to extern macros. 2020-02-06 21:46:38 +02:00
suggestion-non-ascii.rs Remove double trailing newlines 2019-04-22 16:57:01 +01:00
suggestion-non-ascii.stderr Update tests 2019-03-11 23:10:26 +03:00
transitive-dep-span.rs Properly handle Spans that reference imported SourceFiles 2020-03-18 23:56:42 -04:00
transitive-dep-span.stderr Properly handle Spans that reference imported SourceFiles 2020-03-18 23:56:42 -04:00
type-annotations-needed-expr.rs Point at method call on missing annotation error 2019-08-25 13:39:11 -07:00
type-annotations-needed-expr.stderr update tests 2020-03-12 15:47:36 -05:00
type-binding.rs Remove licenses 2018-12-25 21:08:33 -07:00
type-binding.stderr Fix suggestion span for typo in associated type name 2019-12-24 22:25:45 -08:00
typo-suggestion.rs Remove licenses 2018-12-25 21:08:33 -07:00
typo-suggestion.stderr Update tests 2019-03-11 23:10:26 +03:00
unused-warning-point-at-identifier.rs Use ident instead of def_span in dead-code pass 2019-10-26 21:42:52 -04:00
unused-warning-point-at-identifier.stderr Normalise notes with the/is 2020-01-24 16:24:50 +00:00
vec-must-not-hide-type-from-dropck.rs Remove licenses 2018-12-25 21:08:33 -07:00
vec-must-not-hide-type-from-dropck.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
vec_refs_data_with_early_death.rs Remove licenses 2018-12-25 21:08:33 -07:00
vec_refs_data_with_early_death.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
visibility-ty-params.rs Do not abort compilation if expansion produces errors 2018-12-27 15:51:36 +03:00
visibility-ty-params.stderr Update ui tests 2019-10-30 14:49:53 +01:00
wf-method-late-bound-regions.rs Remove licenses 2018-12-25 21:08:33 -07:00
wf-method-late-bound-regions.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00