rust/compiler
bors 8fe0c753f2 Auto merge of #128006 - tgross35:missing-fragment-specifier-e2024, r=petrochenkov
Make `missing_fragment_specifier` an error in edition 2024

`missing_fragment_specifier` has been a future compatibility warning since 2017. Uplifting it to an unconditional hard error was attempted in 2020, but eventually reverted due to fallout.

Make it an error only in edition >= 2024, leaving the lint for older editions. This change will make it easier to support more macro syntax that relies on usage of `$`.

Fixes <https://github.com/rust-lang/rust/issues/40107>

---

It is rather late for the edition but since this change is relatively small, it seems worth at least bringing up. This follows a brief [Zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/268952-edition/topic/.60.20DBD.20-.3E.20hard.20error) (cc `@tmandry).`

Making this an edition-dependent lint has come up before but there was not a strong motivation. I am proposing it at this time because this would simplify the [named macro capture groups](https://github.com/rust-lang/rfcs/pull/3649) RFC, which has had mildly positive response, and makes use of new `$` syntax in the matcher. The proposed syntax currently parses as metavariables without a fragment specifier; this warning is raised, but there are no errors.

It is obviously not known that this specific RFC will eventually be accepted, but forbidding `missing_fragment_specifier` should make it easier to support any new syntax in the future that makes use of `$` in different ways. The syntax conflict is also not impossible to overcome, but making it clear that unnamed metavariables are rejected makes things more straightforward and should allow for better diagnostics.

`@Mark-Simulacrum` suggested making this forbid-by-default instead of an error at https://github.com/rust-lang/rust/issues/40107#issuecomment-761727885, but I don't think this would allow the same level of syntax flexibility.

It is also possible to reconsider making this an unconditional error since four years have elapsed since the previous attempt, but this seems likely to hit the same pitfalls. (Possibly worth a crater run?)

Tracking:

- https://github.com/rust-lang/rust/issues/128143
2024-07-27 12:35:18 +00:00
..
rustc The rustc crate feature is called jemalloc 2024-07-15 13:01:20 -04:00
rustc_abi Rollup merge of #127769 - compiler-errors:ed-2024-dep, r=oli-obk 2024-07-17 16:22:31 +02:00
rustc_arena Use tidy to sort crate attributes for all compiler crates. 2024-06-12 15:49:10 +10:00
rustc_ast Auto merge of #128195 - matthiaskrgr:rollup-195dfdf, r=matthiaskrgr 2024-07-25 18:05:00 +00:00
rustc_ast_ir Use dep: for crate dependencies 2024-07-15 12:40:10 -04:00
rustc_ast_lowering Rollup merge of #128226 - oli-obk:option_vs_empty_slice, r=petrochenkov 2024-07-26 19:03:07 -04:00
rustc_ast_passes Support ?Trait bounds in supertraits and dyn Trait under a feature gate 2024-07-25 20:53:33 +03:00
rustc_ast_pretty centralize turning asm flags into human readable names 2024-07-24 15:27:18 +02:00
rustc_attr Use a dedicated type instead of a reference for the diagnostic context 2024-06-18 15:42:11 +00:00
rustc_baked_icu_data Use tidy to sort crate attributes for all compiler crates. 2024-06-12 15:49:10 +10:00
rustc_borrowck Suppress useless clone suggestion 2024-07-26 12:53:55 -04:00
rustc_builtin_macros Use Cow<'static, str> for InlineAsmTemplatePiece::String 2024-07-24 21:11:55 +01:00
rustc_codegen_cranelift Use Cow<'static, str> for InlineAsmTemplatePiece::String 2024-07-24 21:11:55 +01:00
rustc_codegen_gcc Format cg_gcc with same formatting parameters 2024-07-17 20:22:07 +02:00
rustc_codegen_llvm LLVM: LLVM-20.0 removes MMX types 2024-07-25 17:58:37 +00:00
rustc_codegen_ssa Auto merge of #124905 - reitermarkus:u32-from-char-opt, r=scottmcm 2024-07-27 09:34:26 +00:00
rustc_const_eval Rollup merge of #127950 - nnethercote:rustfmt-skip-on-use-decls, r=cuviper 2024-07-26 00:57:21 +02:00
rustc_data_structures Use dep: for crate dependencies 2024-07-15 12:40:10 -04:00
rustc_driver Use tidy to sort crate attributes for all compiler crates. 2024-06-12 15:49:10 +10:00
rustc_driver_impl Move codegen_and_build_linker from Queries to Linker 2024-07-01 11:00:49 +00:00
rustc_error_codes Rollup merge of #126994 - Alexendoo:explain-markdown, r=tgross35 2024-07-23 19:42:35 +02:00
rustc_error_messages Use tidy to sort crate attributes for all compiler crates. 2024-06-12 15:49:10 +10:00
rustc_errors Rollup merge of #127528 - estebank:ascii-control-chars, r=oli-obk 2024-07-25 04:43:19 +02:00
rustc_expand Make missing_fragment_specifier an error in edition 2024 2024-07-27 05:33:24 -04:00
rustc_feature Support ?Trait bounds in supertraits and dyn Trait under a feature gate 2024-07-25 20:53:33 +03:00
rustc_fluent_macro Avoid ref when using format! in compiler 2024-07-19 14:52:07 -04:00
rustc_fs_util Remove useless tidy-alphabetical markers. 2024-06-20 09:23:20 +10:00
rustc_graphviz Use tidy to sort crate attributes for all compiler crates. 2024-06-12 15:49:10 +10:00
rustc_hir Auto merge of #121676 - Bryanskiy:polarity, r=petrochenkov 2024-07-26 20:14:16 +00:00
rustc_hir_analysis Auto merge of #121676 - Bryanskiy:polarity, r=petrochenkov 2024-07-26 20:14:16 +00:00
rustc_hir_pretty Auto merge of #121676 - Bryanskiy:polarity, r=petrochenkov 2024-07-26 20:14:16 +00:00
rustc_hir_typeck Rollup merge of #128140 - veera-sivarajan:remove-ident-to-str-conversions, r=compiler-errors 2024-07-24 22:22:18 +02:00
rustc_incremental Use tidy to sort crate attributes for all compiler crates. 2024-06-12 15:49:10 +10:00
rustc_index Fix feature gating on rustc_index to not use implicit features 2024-07-15 12:44:24 -04:00
rustc_index_macros Remove usage of specialization from newtype_index! 2024-06-30 16:42:53 +00:00
rustc_infer Get rid of can_eq_shallow 2024-07-22 13:54:48 -04:00
rustc_interface Use dep: for crate dependencies 2024-07-15 12:40:10 -04:00
rustc_lexer Use tidy to sort crate attributes for all compiler crates. 2024-06-12 15:49:10 +10:00
rustc_lint Auto merge of #121676 - Bryanskiy:polarity, r=petrochenkov 2024-07-26 20:14:16 +00:00
rustc_lint_defs Mark missing_fragment_specifier as FutureReleaseErrorReportInDeps 2024-07-24 13:16:46 -04:00
rustc_llvm LLVM: LLVM-20.0 removes MMX types 2024-07-25 17:58:37 +00:00
rustc_log Bump tracing-tree and allow rendering lines again 2024-06-12 10:11:41 +00:00
rustc_macros lift_to_tcx -> lift_to_interner 2024-07-17 10:46:10 -04:00
rustc_metadata Rollup merge of #127528 - estebank:ascii-control-chars, r=oli-obk 2024-07-25 04:43:19 +02:00
rustc_middle Auto merge of #128165 - saethlin:optimize-clone-shims, r=compiler-errors 2024-07-26 13:13:04 +00:00
rustc_mir_build Auto merge of #128034 - Nadrieril:explain-unreachable, r=compiler-errors 2024-07-26 10:51:04 +00:00
rustc_mir_dataflow Avoid ref when using format! in compiler 2024-07-19 14:52:07 -04:00
rustc_mir_transform Make coroutine-closures possible to be cloned 2024-07-26 12:53:53 -04:00
rustc_monomorphize Move compiler_builtin check to the use case 2024-07-15 23:43:52 +00:00
rustc_next_trait_solver Make coroutine-closures possible to be cloned 2024-07-26 12:53:53 -04:00
rustc_parse Rollup merge of #128229 - tdittr:unsafe-extern-abi-error, r=compiler-errors 2024-07-26 19:03:08 -04:00
rustc_parse_format Use tidy to sort crate attributes for all compiler crates. 2024-06-12 15:49:10 +10:00
rustc_passes Rollup merge of #127017 - mu001999-contrib:dead/enhance, r=pnkfelix 2024-07-26 02:20:29 -04:00
rustc_pattern_analysis Explain why a given pattern is considered unreachable 2024-07-24 08:02:55 +02:00
rustc_privacy Do not ICE in privacy when type inference fails. 2024-06-17 10:09:27 +00:00
rustc_query_impl Allow tracing through item_bounds query invocations on opaques 2024-06-19 08:47:55 +00:00
rustc_query_system Be more accurate about calculating display_col from a BytePos 2024-07-18 20:08:38 +00:00
rustc_resolve Rollup merge of #127557 - linyihai:issue-126694, r=compiler-errors 2024-07-26 02:20:30 -04:00
rustc_sanitizers Rollup merge of #127980 - nyurik:compiler-refs, r=oli-obk 2024-07-20 07:13:45 +02:00
rustc_serialize chore: remove duplicate words 2024-07-02 11:25:31 +08:00
rustc_session Auto merge of #127670 - compiler-errors:no-type-length-limit, r=jackh726 2024-07-14 12:44:07 +00:00
rustc_smir Avoid comments that describe multiple use items. 2024-07-17 08:02:46 +10:00
rustc_span Auto merge of #121676 - Bryanskiy:polarity, r=petrochenkov 2024-07-26 20:14:16 +00:00
rustc_symbol_mangling Fix FnMut/Fn shim for coroutine-closures that capture references 2024-06-29 17:38:02 -04:00
rustc_target Auto merge of #127755 - no1wudi:master, r=michaelwoerister 2024-07-23 09:45:28 +00:00
rustc_trait_selection Rollup merge of #128201 - compiler-errors:closure-clone, r=oli-obk 2024-07-26 19:03:05 -04:00
rustc_traits Move all error reporting into rustc_trait_selection 2024-07-21 22:34:35 -04:00
rustc_transmute Use dep: for crate dependencies 2024-07-15 12:40:10 -04:00
rustc_ty_utils Make sure that args are compatible in resolve_associated_item 2024-07-24 22:59:57 -04:00
rustc_type_ir Rollup merge of #126575 - fmease:update-lint-type_alias_bounds, r=compiler-errors 2024-07-26 02:20:28 -04:00
rustc_type_ir_macros lift_to_tcx -> lift_to_interner 2024-07-17 10:46:10 -04:00
stable_mir Auto merge of #126963 - runtimeverification:smir_serde_derive, r=celinval 2024-07-25 20:27:51 +00:00