diff options
author | Ziyang Liu <unsafeFixIO@gmail.com> | 2021-10-05 16:57:50 -0700 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-02-09 20:43:02 -0500 |
commit | 53c26e79961b6fac249425b1023e92646cdbfe41 (patch) | |
tree | 50e42c578c31b721b17d4f0311f4dd10b6bc8b4a | |
parent | e01ffec2456739bcfba750f0c36716ff697404bf (diff) | |
download | haskell-53c26e79961b6fac249425b1023e92646cdbfe41.tar.gz |
Include ru_name in toHsRule message
See #18147
-rw-r--r-- | compiler/GHC/Core/Ppr.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/Iface/Make.hs | 18 |
2 files changed, 9 insertions, 11 deletions
diff --git a/compiler/GHC/Core/Ppr.hs b/compiler/GHC/Core/Ppr.hs index 853ed990bc..43579082a9 100644 --- a/compiler/GHC/Core/Ppr.hs +++ b/compiler/GHC/Core/Ppr.hs @@ -23,7 +23,7 @@ module GHC.Core.Ppr ( pprCoreBinding, pprCoreBindings, pprCoreAlt, pprCoreBindingWithSize, pprCoreBindingsWithSize, pprCoreBinder, pprCoreBinders, - pprRules, pprOptCo + pprRule, pprRules, pprOptCo ) where import GHC.Prelude diff --git a/compiler/GHC/Iface/Make.hs b/compiler/GHC/Iface/Make.hs index 129da7c014..28ddcac422 100644 --- a/compiler/GHC/Iface/Make.hs +++ b/compiler/GHC/Iface/Make.hs @@ -46,6 +46,7 @@ import GHC.Core.Type import GHC.Core.Multiplicity import GHC.Core.InstEnv import GHC.Core.FamInstEnv +import GHC.Core.Ppr import GHC.Core.Unify( RoughMatchTc(..) ) import GHC.Driver.Env @@ -73,6 +74,7 @@ import GHC.Types.HpcInfo import GHC.Types.CompleteMatch import GHC.Utils.Outputable +import GHC.Utils.Panic import GHC.Utils.Panic.Plain import GHC.Utils.Misc hiding ( eqListBy ) import GHC.Utils.Logger @@ -735,9 +737,12 @@ ifaceRoughMatchTcs tcs = map do_rough tcs -------------------------- coreRuleToIfaceRule :: CoreRule -> IfaceRule -coreRuleToIfaceRule (BuiltinRule { ru_fn = fn}) - = pprTrace "toHsRule: builtin" (ppr fn) $ - bogusIfaceRule fn +-- A plugin that installs a BuiltinRule in a CoreDoPluginPass should +-- ensure that there's another CoreDoPluginPass that removes the rule. +-- Otherwise a module using the plugin and compiled with -fno-omit-interface-pragmas +-- would cause panic when the rule is attempted to be written to the interface file. +coreRuleToIfaceRule rule@(BuiltinRule {}) + = pprPanic "toHsRule:" (pprRule rule) coreRuleToIfaceRule (Rule { ru_name = name, ru_fn = fn, ru_act = act, ru_bndrs = bndrs, @@ -758,10 +763,3 @@ coreRuleToIfaceRule (Rule { ru_name = name, ru_fn = fn, do_arg (Type ty) = IfaceType (toIfaceType (deNoteType ty)) do_arg (Coercion co) = IfaceCo (toIfaceCoercion co) do_arg arg = toIfaceExpr arg - -bogusIfaceRule :: Name -> IfaceRule -bogusIfaceRule id_name - = IfaceRule { ifRuleName = fsLit "bogus", ifActivation = NeverActive, - ifRuleBndrs = [], ifRuleHead = id_name, ifRuleArgs = [], - ifRuleRhs = IfaceExt id_name, ifRuleOrph = IsOrphan, - ifRuleAuto = True } |