summaryrefslogtreecommitdiff
path: root/docs/users_guide/using-warnings.rst
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2022-12-13 12:30:36 +0000
committerMatthew Pickering <matthewtpickering@gmail.com>2022-12-23 11:22:25 +0000
commit40c9da19decb68e1bf4be6fef7b0592c19a8cacd (patch)
treeda86ac3d580f161cb971bfba6edae205f11a9d7c /docs/users_guide/using-warnings.rst
parent16a1bcd1d72c7a4567671f6a7f610df3fc477519 (diff)
downloadhaskell-wip/22188.tar.gz
Add flag to control whether self-recompilation information is written to interfacewip/22188
This patch adds the flag -fwrite-self-recomp-info which controls whether interface files contain the information necessary to answer the question: Do I need to recompile myself or is this current interface file suitable? Why? Most packages are only built once either by a distribution or cabal and then placed into an immutable store, after which we will never ask this question. Therefore we can derive two benefits from omitting this information. * Primary motivation: It vastly reduces the surface area for creating non-deterministic interface files. See issue #10424 which motivated a proper fix to that issue. Distributions have long contained versions of GHC which just have broken self-recompilation checking (in order to get deterministic interface files). * Secondary motivation: This reduces the size of interface files slightly.. the `mi_usages` field can be quite big but probably this isn't such a great benefit. * Third motivation: Conceptually clarity about which parts of an interface file are used in order to **communicate** with subsequent packages about the **interface** for a module. And which parts are used to self-communicate during recompilation checking. In addition to this, the change alerted me to the incorrect implemenation of the reifyModule function. See #8489 for more discussion about how to fix this if anyone was so inclined. For now I just added a warning `-Wreify-module-missing-info` which triggers if the module you are trying to reify doesn't have a suitable interface. Interfaces which are unsuitable include: * The GHC.Prim interface, which is a fake interface * Interfaces compiled with -fno-write-self-recomp-info The main tracking issue is #22188 but fixes issues such as #10424 in a proper way.
Diffstat (limited to 'docs/users_guide/using-warnings.rst')
-rw-r--r--docs/users_guide/using-warnings.rst15
1 files changed, 15 insertions, 0 deletions
diff --git a/docs/users_guide/using-warnings.rst b/docs/users_guide/using-warnings.rst
index 977bb69941..d61fc46319 100644
--- a/docs/users_guide/using-warnings.rst
+++ b/docs/users_guide/using-warnings.rst
@@ -2355,6 +2355,21 @@ of ``-W(no-)*``.
triggered whenever this happens, and can be addressed by enabling the
extension.
+.. ghc-flag:: -Wreify-module-missing-info
+ :shortdesc: warn when `reifyModule`
+ :type: dynamic
+ :reverse: -Wno-reify-module-missing-info
+
+ :since: 9.6.1
+
+ The `reifyModule` function in the Template Haskell API can fail to find the necessary
+ information when an interface file is generated with `-fno-write-self-recomp-info`. This
+ is due to a shortcoming in `reifyModule` tracked by :ghc-ticket:`8489`.
+
+ This flag warns the user when they try to call `reifyModule` on a module where this
+ situation occurs so that they know the traversal has ended prematurely.
+
+
If you're feeling really paranoid, the :ghc-flag:`-dcore-lint` option is a good choice.
It turns on heavyweight intra-pass sanity-checking within GHC. (It checks GHC's
sanity, not yours.)