rust/tests/ui/rust-2018
bors 2bf78d12d3 Auto merge of #119673 - petrochenkov:dialoc5, r=compiler-errors,cjgillot
macro_rules: Preserve all metavariable spans in a global side table

This PR preserves spans of `tt` metavariables used to pass tokens to declarative macros.
Such metavariable spans can then be used in span combination operations like `Span::to` to improve all kinds of diagnostics.

Spans of non-`tt` metavariables are currently kept in nonterminal tokens, but the long term plan is remove all nonterminal tokens from rustc parser and rely on the proc macro model with invisible delimiters (#114647, #67062).
In particular, `NtIdent` nonterminal (corresponding to `ident` metavariables) becomes easy to remove when this PR lands (#119412 does it).

The metavariable spans are kept in a global side table keyed by `Span`s of original tokens.
The alternative to the side table is keeping them in `SpanData` instead, but the performance regressions would be large because any spans from tokens passed to declarative macros would stop being inline and would work through span interner instead, and the penalty would be paid even if we never use the metavar span for the given original span.
(But also see the comment on `fn maybe_use_metavar_location` describing the map collision issues with the side table approach.)

There are also other alternatives - keeping the metavar span in `Token` or `TokenTree`, but associating it with `Span` itsel is the most natural choice because metavar spans are used in span combining operations, and those operations are not necessarily tied to tokens.
2024-02-18 20:51:16 +00:00
..
auxiliary [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
uniform-paths [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
async-ident-allowed.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
async-ident-allowed.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
async-ident.fixed [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
async-ident.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
async-ident.stderr
dyn-keyword.fixed [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
dyn-keyword.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
dyn-keyword.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
dyn-trait-compatibility.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
dyn-trait-compatibility.stderr
edition-lint-fully-qualified-paths.fixed [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
edition-lint-fully-qualified-paths.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
edition-lint-fully-qualified-paths.stderr Remove edition umbrella features. 2023-12-10 13:03:28 -08:00
edition-lint-infer-outlives-macro.fixed macro_rules: Preserve all metavariable spans in a global side table 2024-02-18 11:19:24 +03:00
edition-lint-infer-outlives-macro.rs macro_rules: Preserve all metavariable spans in a global side table 2024-02-18 11:19:24 +03:00
edition-lint-infer-outlives-macro.stderr macro_rules: Preserve all metavariable spans in a global side table 2024-02-18 11:19:24 +03:00
edition-lint-infer-outlives-multispan.rs
edition-lint-infer-outlives-multispan.stderr Fix duplicate labels emitted in render_multispan_macro_backtrace() 2023-10-19 08:03:40 +05:30
edition-lint-infer-outlives.fixed [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
edition-lint-infer-outlives.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
edition-lint-infer-outlives.stderr Fix explicit-outlives-requirements lint span 2023-06-13 23:04:00 -07:00
edition-lint-nested-empty-paths.fixed [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
edition-lint-nested-empty-paths.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
edition-lint-nested-empty-paths.stderr Remove edition umbrella features. 2023-12-10 13:03:28 -08:00
edition-lint-nested-paths.fixed [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
edition-lint-nested-paths.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
edition-lint-nested-paths.stderr Remove edition umbrella features. 2023-12-10 13:03:28 -08:00
edition-lint-paths-2018.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
edition-lint-paths.fixed [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
edition-lint-paths.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
edition-lint-paths.stderr Remove edition umbrella features. 2023-12-10 13:03:28 -08:00
edition-lint-uninferable-outlives.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
extern-crate-idiomatic-in-2018.fixed [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
extern-crate-idiomatic-in-2018.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
extern-crate-idiomatic-in-2018.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
extern-crate-idiomatic.fixed [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
extern-crate-idiomatic.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
extern-crate-referenced-by-self-path.fixed [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
extern-crate-referenced-by-self-path.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
extern-crate-rename.fixed [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
extern-crate-rename.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
extern-crate-rename.stderr Remove edition umbrella features. 2023-12-10 13:03:28 -08:00
extern-crate-submod.fixed [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
extern-crate-submod.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
extern-crate-submod.stderr Remove edition umbrella features. 2023-12-10 13:03:28 -08:00
future-proofing-locals.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
future-proofing-locals.stderr
issue-51008-1.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-51008.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-52202-use-suggestions.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-52202-use-suggestions.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
issue-54006.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-54006.stderr Supress unhelpful diagnostics for unresolved top level attributes 2024-01-29 17:43:07 +08:00
issue-54400-unused-extern-crate-attr-span.fixed [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-54400-unused-extern-crate-attr-span.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-54400-unused-extern-crate-attr-span.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
local-path-suggestions-2015.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
local-path-suggestions-2015.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
local-path-suggestions-2018.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
local-path-suggestions-2018.stderr
macro-use-warned-against.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
macro-use-warned-against.stderr
proc-macro-crate-in-paths.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
remove-extern-crate.fixed By tracking import use types to check whether it is scope uses or the other situations like module-relative uses, we can do more accurate redundant import checking. 2024-02-18 16:38:11 +08:00
remove-extern-crate.rs By tracking import use types to check whether it is scope uses or the other situations like module-relative uses, we can do more accurate redundant import checking. 2024-02-18 16:38:11 +08:00
remove-extern-crate.stderr By tracking import use types to check whether it is scope uses or the other situations like module-relative uses, we can do more accurate redundant import checking. 2024-02-18 16:38:11 +08:00
suggestions-not-always-applicable.fixed [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
suggestions-not-always-applicable.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
trait-import-suggestions.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
trait-import-suggestions.stderr Special-case item attributes in the suggestion output 2023-04-12 22:50:10 +00:00
try-ident.fixed [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
try-ident.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
try-ident.stderr
try-macro.fixed [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
try-macro.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
try-macro.stderr
unresolved-asterisk-imports.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
unresolved-asterisk-imports.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00