Skip to content

Commit 2aa9979

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 b0d46bd commit 2aa9979

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
@@ -719,9 +719,11 @@ impl<'tcx> Interner for TyCtxt<'tcx> {
719719
}
720720
}
721721

722+
/// Defines trivial conversion functions between the main [`LangItem`] enum,
723+
/// and some other lang-item enum that is a subset of it.
722724
macro_rules! bidirectional_lang_item_map {
723725
(
724-
$solver_ty:ident, $to_solver:ident, $from_solver:ident;
726+
$solver_ty:ident, fn $to_solver:ident, fn $from_solver:ident;
725727
$($name:ident),+ $(,)?
726728
) => {
727729
fn $from_solver(lang_item: $solver_ty) -> LangItem {
@@ -740,7 +742,7 @@ macro_rules! bidirectional_lang_item_map {
740742
}
741743

742744
bidirectional_lang_item_map! {
743-
SolverLangItem, lang_item_to_solver_lang_item, solver_lang_item_to_lang_item;
745+
SolverLangItem, fn lang_item_to_solver_lang_item, fn solver_lang_item_to_lang_item;
744746

745747
// tidy-alphabetical-start
746748
AsyncFnKindUpvars,
@@ -756,7 +758,7 @@ bidirectional_lang_item_map! {
756758
}
757759

758760
bidirectional_lang_item_map! {
759-
SolverAdtLangItem, lang_item_to_solver_adt_lang_item, solver_adt_lang_item_to_lang_item;
761+
SolverAdtLangItem, fn lang_item_to_solver_adt_lang_item, fn solver_adt_lang_item_to_lang_item;
760762

761763
// tidy-alphabetical-start
762764
Option,
@@ -765,7 +767,7 @@ bidirectional_lang_item_map! {
765767
}
766768

767769
bidirectional_lang_item_map! {
768-
SolverTraitLangItem, lang_item_to_solver_trait_lang_item, solver_trait_lang_item_to_lang_item;
770+
SolverTraitLangItem, fn lang_item_to_solver_trait_lang_item, fn solver_trait_lang_item_to_lang_item;
769771

770772
// tidy-alphabetical-start
771773
AsyncFn,

0 commit comments

Comments
 (0)