rust/compiler
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
..
rustc
rustc_abi Fix `rustc_abi` build on stable 2024-01-16 21:15:31 +01:00
rustc_arena Invert diagnostic lints. 2024-02-06 13:12:33 +11:00
rustc_ast Rollup merge of #121109 - nnethercote:TyKind-Err-guar-2, r=oli-obk 2024-02-16 00:27:32 +01:00
rustc_ast_lowering Move trait into attr so it's greppable 2024-02-16 15:07:37 +00:00
rustc_ast_passes Add an `ErrorGuaranteed` to `ast::TyKind::Err`. 2024-02-15 09:35:11 +11:00
rustc_ast_pretty Rollup merge of #121109 - nnethercote:TyKind-Err-guar-2, r=oli-obk 2024-02-16 00:27:32 +01:00
rustc_attr Use generic `NonZero` internally. 2024-02-15 08:09:42 +01:00
rustc_baked_icu_data Bump cfg(bootstrap)s 2023-11-15 19:41:28 -05:00
rustc_borrowck Rollup merge of #121085 - davidtwco:always-eager-diagnostics, r=nnethercote 2024-02-17 18:47:40 +01:00
rustc_builtin_macros Add `ErrorGuaranteed` to `ast::LitKind::Err`, `token::LitKind::Err`. 2024-02-15 14:46:08 +11:00
rustc_codegen_cranelift Auto merge of #121034 - obeis:improve-static-mut-ref, r=RalfJung 2024-02-18 08:00:34 +00:00
rustc_codegen_gcc Auto merge of #121034 - obeis:improve-static-mut-ref, r=RalfJung 2024-02-18 08:00:34 +00:00
rustc_codegen_llvm Rollup merge of #121209 - nnethercote:infallible-join_codegen, r=bjorn3 2024-02-17 18:47:42 +01:00
rustc_codegen_ssa Auto merge of #121265 - klensy:bump-18-02-24, r=Mark-Simulacrum 2024-02-18 16:54:15 +00:00
rustc_const_eval Rollup merge of #121085 - davidtwco:always-eager-diagnostics, r=nnethercote 2024-02-17 18:47:40 +01:00
rustc_data_structures Auto merge of #121265 - klensy:bump-18-02-24, r=Mark-Simulacrum 2024-02-18 16:54:15 +00:00
rustc_driver Bump cfg(bootstrap)s 2023-11-15 19:41:28 -05:00
rustc_driver_impl windows bump to 0.52 2024-02-18 16:02:16 +03:00
rustc_error_codes Improve wording of static_mut_ref 2024-02-18 06:01:40 +03:00
rustc_error_messages errors: only eagerly translate subdiagnostics 2024-02-15 10:34:41 +00:00
rustc_errors Auto merge of #121265 - klensy:bump-18-02-24, r=Mark-Simulacrum 2024-02-18 16:54:15 +00:00
rustc_expand Auto merge of #119673 - petrochenkov:dialoc5, r=compiler-errors,cjgillot 2024-02-18 20:51:16 +00:00
rustc_feature Auto merge of #120500 - oli-obk:intrinsics2.0, r=WaffleLapkin 2024-02-16 09:53:01 +00:00
rustc_fluent_macro Invert diagnostic lints. 2024-02-06 13:12:33 +11:00
rustc_fs_util Invert diagnostic lints. 2024-02-06 13:12:33 +11:00
rustc_graphviz Invert diagnostic lints. 2024-02-06 13:12:33 +11:00
rustc_hir Add more checks for `unnamed_field` during HIR analysis 2024-02-17 15:12:33 +00:00
rustc_hir_analysis Rollup merge of #121247 - scottmcm:intrinsic-reminder, r=petrochenkov 2024-02-18 18:54:33 +01:00
rustc_hir_pretty Lower anonymous structs or unions to HIR 2024-02-12 12:47:23 +08:00
rustc_hir_typeck Auto merge of #117772 - surechen:for_117448, r=petrochenkov 2024-02-18 13:56:07 +00:00
rustc_incremental Use better heuristic for printing Cargo specific diagnostics 2024-02-17 16:49:01 +01:00
rustc_index Invert diagnostic lints. 2024-02-06 13:12:33 +11:00
rustc_index_macros Step all bootstrap cfgs forward 2024-02-08 07:44:34 -05:00
rustc_infer 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
rustc_interface Rollup merge of #121209 - nnethercote:infallible-join_codegen, r=bjorn3 2024-02-17 18:47:42 +01:00
rustc_lexer Invert diagnostic lints. 2024-02-06 13:12:33 +11:00
rustc_lint Auto merge of #121034 - obeis:improve-static-mut-ref, r=RalfJung 2024-02-18 08:00:34 +00:00
rustc_lint_defs Improve wording of static_mut_ref 2024-02-18 06:01:40 +03:00
rustc_llvm Pin `cc` version 2024-02-13 21:13:06 +00:00
rustc_log Invert diagnostic lints. 2024-02-06 13:12:33 +11:00
rustc_macros Rollup merge of #121085 - davidtwco:always-eager-diagnostics, r=nnethercote 2024-02-17 18:47:40 +01:00
rustc_metadata 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
rustc_middle 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
rustc_mir_build Rollup merge of #121085 - davidtwco:always-eager-diagnostics, r=nnethercote 2024-02-17 18:47:40 +01:00
rustc_mir_dataflow Auto merge of #120500 - oli-obk:intrinsics2.0, r=WaffleLapkin 2024-02-16 09:53:01 +00:00
rustc_mir_transform Remove const_prop.rs 2024-02-18 15:31:44 +05:30
rustc_monomorphize Auto merge of #120500 - oli-obk:intrinsics2.0, r=WaffleLapkin 2024-02-16 09:53:01 +00:00
rustc_next_trait_solver Move visitable bounds up into interner 2024-02-13 15:53:15 +00:00
rustc_parse Rollup merge of #121237 - Urgau:better-cargo-heuristic, r=compiler-errors 2024-02-18 05:10:18 +01:00
rustc_parse_format remove a couple of redundant clones 2024-02-17 12:46:18 +01:00
rustc_passes Auto merge of #120486 - reitermarkus:use-generic-nonzero, r=dtolnay 2024-02-16 07:46:31 +00:00
rustc_pattern_analysis Auto merge of #120991 - matthiaskrgr:rollup-f8kw2st, r=matthiaskrgr 2024-02-13 00:31:53 +00:00
rustc_privacy Dejargnonize subst 2024-02-12 15:46:35 +09:00
rustc_query_impl Replace `NonZero::<_>::new` with `NonZero::new`. 2024-02-15 08:09:42 +01:00
rustc_query_system Use generic `NonZero` internally. 2024-02-15 08:09:42 +01:00
rustc_resolve 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
rustc_serialize Replace `NonZero::<_>::new` with `NonZero::new`. 2024-02-15 08:09:42 +01:00
rustc_session Auto merge of #121265 - klensy:bump-18-02-24, r=Mark-Simulacrum 2024-02-18 16:54:15 +00:00
rustc_smir Rollup merge of #120982 - momvart:smir-61-foreign_kind, r=oli-obk 2024-02-15 09:20:18 +01:00
rustc_span Auto merge of #119673 - petrochenkov:dialoc5, r=compiler-errors,cjgillot 2024-02-18 20:51:16 +00:00
rustc_symbol_mangling Rollup merge of #120958 - ShoyuVanilla:remove-subst, r=oli-obk 2024-02-12 23:18:54 +01:00
rustc_target Rollup merge of #121210 - madsmtm:fix-target-abi-i386-apple-ios, r=workingjubilee 2024-02-17 18:47:42 +01:00
rustc_trait_selection Rollup merge of #121100 - estebank:issue-71252, r=compiler-errors 2024-02-18 05:10:16 +01:00
rustc_traits Dejargnonize subst 2024-02-12 15:46:35 +09:00
rustc_transmute Invert diagnostic lints. 2024-02-06 13:12:33 +11:00
rustc_ty_utils Auto merge of #120500 - oli-obk:intrinsics2.0, r=WaffleLapkin 2024-02-16 09:53:01 +00:00
rustc_type_ir Move visitable bounds up into interner 2024-02-13 15:53:15 +00:00
stable_mir Rollup merge of #120982 - momvart:smir-61-foreign_kind, r=oli-obk 2024-02-15 09:20:18 +01:00