From 62b9a7b23b20f5cf0a2de14251c2096098009f10 Mon Sep 17 00:00:00 2001 From: Zubin Duggal Date: Wed, 7 Dec 2022 19:24:59 +0530 Subject: Force the Docs structure to prevent leaks in GHCi with -haddock without -fwrite-interface Involves adding many new NFData instances. Without forcing Docs, references to the TcGblEnv for each module are retained by the Docs structure. Usually these are forced when the ModIface is serialised but not when we aren't writing the interface. --- compiler/GHC/Driver/Flags.hs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'compiler/GHC/Driver') diff --git a/compiler/GHC/Driver/Flags.hs b/compiler/GHC/Driver/Flags.hs index f45397d887..ed77b81ebd 100644 --- a/compiler/GHC/Driver/Flags.hs +++ b/compiler/GHC/Driver/Flags.hs @@ -26,6 +26,7 @@ import GHC.Utils.Outputable import GHC.Utils.Binary import GHC.Data.EnumSet as EnumSet +import Control.DeepSeq import Control.Monad (guard) import Data.List.NonEmpty (NonEmpty(..)) import Data.Maybe (fromMaybe,mapMaybe) @@ -40,6 +41,9 @@ instance Binary Language where put_ bh = put_ bh . fromEnum get bh = toEnum <$> get bh +instance NFData Language where + rnf x = x `seq` () + -- | Debugging flags data DumpFlag -- See Note [Updating flag description in the User's Guide] -- cgit v1.2.1