Skip to content

Commit b7bfb76

Browse files
committed
Indicate that bidirectional_lang_item_map! declares functions
Requiring `fn` in the macro syntax makes it a little more obvious that the macro declares functions with those names, and makes them easier to grep for.
1 parent 4234d2d commit b7bfb76

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

compiler/rustc_middle/src/ty/context/impl_interner.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -722,9 +722,11 @@ impl<'tcx> Interner for TyCtxt<'tcx> {
722722
}
723723
}
724724

725+
/// Defines trivial conversion functions between the main [`LangItem`] enum,
726+
/// and some other lang-item enum that is a subset of it.
725727
macro_rules! bidirectional_lang_item_map {
726728
(
727-
$solver_ty:ident, $to_solver:ident, $from_solver:ident;
729+
$solver_ty:ident, fn $to_solver:ident, fn $from_solver:ident;
728730
$($name:ident),+ $(,)?
729731
) => {
730732
fn $from_solver(lang_item: $solver_ty) -> LangItem {
@@ -743,7 +745,7 @@ macro_rules! bidirectional_lang_item_map {
743745
}
744746

745747
bidirectional_lang_item_map! {
746-
SolverLangItem, lang_item_to_solver_lang_item, solver_lang_item_to_lang_item;
748+
SolverLangItem, fn lang_item_to_solver_lang_item, fn solver_lang_item_to_lang_item;
747749

748750
// tidy-alphabetical-start
749751
AsyncFnKindUpvars,
@@ -759,7 +761,7 @@ bidirectional_lang_item_map! {
759761
}
760762

761763
bidirectional_lang_item_map! {
762-
SolverAdtLangItem, lang_item_to_solver_adt_lang_item, solver_adt_lang_item_to_lang_item;
764+
SolverAdtLangItem, fn lang_item_to_solver_adt_lang_item, fn solver_adt_lang_item_to_lang_item;
763765

764766
// tidy-alphabetical-start
765767
Option,
@@ -768,7 +770,7 @@ bidirectional_lang_item_map! {
768770
}
769771

770772
bidirectional_lang_item_map! {
771-
SolverTraitLangItem, lang_item_to_solver_trait_lang_item, solver_trait_lang_item_to_lang_item;
773+
SolverTraitLangItem, fn lang_item_to_solver_trait_lang_item, fn solver_trait_lang_item_to_lang_item;
772774

773775
// tidy-alphabetical-start
774776
AsyncFn,

0 commit comments

Comments
 (0)