rust/src/test/ui/hygiene
Aaron Hill 334373324d
Serialize all foreign SourceFiles into proc-macro crate metadata
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-29 21:45:42 -04:00
..
auxiliary Make use of hygiene in AST passes 2019-09-05 15:07:16 +01:00
arguments.rs
arguments.stderr Update tests 2019-03-11 23:10:26 +03:00
assoc_item_ctxt.rs
assoc_item_ctxt.stderr rustc_macros: don't limit the -Zmacro-backtrace suggestion to extern macros. 2020-02-06 21:46:38 +02:00
assoc_ty_bindings.rs use dyn Trait more in tests 2020-02-10 17:42:09 +01:00
cross-crate-codegen-attrs.rs Stop emulating cross-crate hygiene with gensyms 2019-08-17 08:59:36 +01:00
dollar-crate-modern.rs Make error and warning annotations mandatory in UI tests 2019-11-10 21:01:02 +01:00
duplicate_lifetimes.rs Disallow duplicate lifetime parameters with legacy hygiene 2019-07-28 13:33:51 +01:00
duplicate_lifetimes.stderr rustc_macros: don't limit the -Zmacro-backtrace suggestion to extern macros. 2020-02-06 21:46:38 +02:00
eager-from-opaque-2.rs Add a regression test for issue #63460 2019-08-21 12:53:11 +03:00
eager-from-opaque.rs expand: Do not do questionable span adjustment before eagerly expanding an expression 2019-08-21 11:53:39 +03:00
expansion-info-reset.rs Change all run-pass hygiene tests to ui tests 2019-07-16 21:20:39 +01:00
expansion-info-reset.stderr Increase spacing for suggestions in diagnostics 2019-10-24 12:26:01 -07:00
extern-prelude-from-opaque-fail.rs Add a regression test for #44692 2019-07-11 00:35:01 +03:00
extern-prelude-from-opaque-fail.stderr rustc_macros: don't limit the -Zmacro-backtrace suggestion to extern macros. 2020-02-06 21:46:38 +02:00
fields-definition.rs
fields-definition.stderr parser: token -> normalized_token, nonnormalized_token -> token 2020-02-24 13:04:13 +03:00
fields-move.rs
fields-move.stderr rustc_macros: don't limit the -Zmacro-backtrace suggestion to extern macros. 2020-02-06 21:46:38 +02:00
fields-numeric-borrowck.rs
fields-numeric-borrowck.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
fields.rs
fields.stderr Normalize wording of privacy access labels 2020-03-22 15:36:54 -07:00
for-loop.rs
for-loop.stderr Update tests 2019-03-11 23:10:26 +03:00
format-args.rs Remove gensym from format_args 2019-08-05 23:50:47 +01:00
generate-mod.rs #[rustc_transparent_macro] -> #[rustc_macro_transparency = ...] 2019-07-06 16:59:08 +03:00
generate-mod.stderr rustc_macros: don't limit the -Zmacro-backtrace suggestion to extern macros. 2020-02-06 21:46:38 +02:00
generic_params.rs Make error and warning annotations mandatory in UI tests 2019-11-10 21:01:02 +01:00
generic_params.stderr adjust tests 2020-05-09 14:40:17 +02:00
globs.rs
globs.stderr Prefer accessible paths in 'use' suggestions 2020-06-21 18:49:39 +03:00
hygiene-dodging-1.rs Change all run-pass hygiene tests to ui tests 2019-07-16 21:20:39 +01:00
hygiene.rs Change all run-pass hygiene tests to ui tests 2019-07-16 21:20:39 +01:00
hygienic-label-1.rs
hygienic-label-1.stderr rustc_macros: don't limit the -Zmacro-backtrace suggestion to extern macros. 2020-02-06 21:46:38 +02:00
hygienic-label-2.rs
hygienic-label-2.stderr tweak unresolved label suggestion 2019-04-04 10:04:48 -04:00
hygienic-label-3.rs
hygienic-label-3.stderr rustc_macros: don't limit the -Zmacro-backtrace suggestion to extern macros. 2020-02-06 21:46:38 +02:00
hygienic-label-4.rs
hygienic-label-4.stderr tweak unresolved label suggestion 2019-04-04 10:04:48 -04:00
hygienic-labels-in-let.rs Cleaned up unused labels 2019-11-15 16:31:30 -08:00
hygienic-labels-in-let.stderr rustc: Add a warning count upon completion 2020-04-11 16:15:24 +02:00
hygienic-labels.rs Cleaned up unused labels 2019-11-15 16:31:30 -08:00
hygienic-labels.stderr rustc: Add a warning count upon completion 2020-04-11 16:15:24 +02:00
impl_items.rs
impl_items.stderr Normalize wording of privacy access labels 2020-03-22 15:36:54 -07:00
intercrate.rs
intercrate.stderr Normalize wording of privacy access labels 2020-03-22 15:36:54 -07:00
issue-44128.rs Change all run-pass hygiene tests to ui tests 2019-07-16 21:20:39 +01:00
issue-47311.rs Change all run-pass hygiene tests to ui tests 2019-07-16 21:20:39 +01:00
issue-47312.rs Change all run-pass hygiene tests to ui tests 2019-07-16 21:20:39 +01:00
issue-61574-const-parameters.rs Make error and warning annotations mandatory in UI tests 2019-11-10 21:01:02 +01:00
issue-61574-const-parameters.stderr adjust tests 2020-05-09 14:40:17 +02:00
items.rs Change all run-pass hygiene tests to ui tests 2019-07-16 21:20:39 +01:00
legacy_interaction.rs Change all run-pass hygiene tests to ui tests 2019-07-16 21:20:39 +01:00
lexical.rs Change all run-pass hygiene tests to ui tests 2019-07-16 21:20:39 +01:00
local_inner_macros.rs Change all run-pass hygiene tests to ui tests 2019-07-16 21:20:39 +01:00
macro-metavars-legacy.rs Make macro metavars respect (non-)hygiene 2020-03-16 17:13:48 +00:00
macro-metavars-transparent.rs Make macro metavars respect (non-)hygiene 2020-03-16 17:13:48 +00:00
missing-self-diag.rs Emit a better diagnostic when function actually has a 'self' parameter 2020-05-17 19:04:13 -04:00
missing-self-diag.stderr Emit a better diagnostic when function actually has a 'self' parameter 2020-05-17 19:04:13 -04:00
nested_macro_privacy.rs
nested_macro_privacy.stderr Add span label to primary error span 2020-03-22 11:18:06 -07:00
no_implicit_prelude-2018.rs resolve: Remove ! from "cannot find" diagnostics for macros 2019-09-15 13:22:07 +03:00
no_implicit_prelude-2018.stderr resolve: Remove ! from "cannot find" diagnostics for macros 2019-09-15 13:22:07 +03:00
no_implicit_prelude.rs resolve: Remove ! from "cannot find" diagnostics for macros 2019-09-15 13:22:07 +03:00
no_implicit_prelude.stderr Remove noisy suggestion of hash_map #72642 2020-06-09 08:49:05 +05:30
pattern-macro.rs
pattern-macro.stderr Update tests 2019-03-11 23:10:26 +03:00
prelude-import-hygiene.rs Make use of hygiene in AST passes 2019-09-05 15:07:16 +01:00
privacy-early.rs resolve: Move late resolution into a separate visitor 2019-08-10 13:15:15 +03:00
privacy-early.stderr rustc_macros: don't limit the -Zmacro-backtrace suggestion to extern macros. 2020-02-06 21:46:38 +02:00
privacy.rs
privacy.stderr Normalize wording of privacy access labels 2020-03-22 15:36:54 -07:00
rustc-macro-transparency.rs resolve: Attempt to resolve unresolved paths in macro namespace 2019-07-18 13:42:45 +03:00
rustc-macro-transparency.stderr Normalize wording of privacy access labels 2020-03-22 15:36:54 -07:00
specialization.rs Change all run-pass hygiene tests to ui tests 2019-07-16 21:20:39 +01:00
stdlib-prelude-from-opaque-early.rs resolve: Fix access to extern and stdlib prelude from opaque macros 2019-07-11 00:12:08 +03:00
stdlib-prelude-from-opaque-late.rs resolve: Fix access to extern and stdlib prelude from opaque macros 2019-07-11 00:12:08 +03:00
trait_items-2.rs Change all run-pass hygiene tests to ui tests 2019-07-16 21:20:39 +01:00
trait_items.rs Unify output of "variant not found" errors 2020-01-08 08:05:31 -08:00
trait_items.stderr rustc_macros: don't limit the -Zmacro-backtrace suggestion to extern macros. 2020-02-06 21:46:38 +02:00
transparent-basic.rs Change all run-pass hygiene tests to ui tests 2019-07-16 21:20:39 +01:00
unpretty-debug.rs Make pretty-expanded-hygiene a ui test 2019-07-16 21:23:29 +01:00
unpretty-debug.stdout Serialize all foreign SourceFiles into proc-macro crate metadata 2020-06-29 21:45:42 -04:00
wrap_unhygienic_example.rs Change all run-pass hygiene tests to ui tests 2019-07-16 21:20:39 +01:00
xcrate.rs Change all run-pass hygiene tests to ui tests 2019-07-16 21:20:39 +01:00