summaryrefslogtreecommitdiff
path: root/compiler/GHC/Rename/Doc.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/GHC/Rename/Doc.hs')
-rw-r--r--compiler/GHC/Rename/Doc.hs9
1 files changed, 8 insertions, 1 deletions
diff --git a/compiler/GHC/Rename/Doc.hs b/compiler/GHC/Rename/Doc.hs
index 006bc2689b..d476b1782e 100644
--- a/compiler/GHC/Rename/Doc.hs
+++ b/compiler/GHC/Rename/Doc.hs
@@ -1,5 +1,7 @@
module GHC.Rename.Doc ( rnHsDoc, rnLHsDoc, rnLDocDecl, rnDocDecl ) where
+import Control.DeepSeq (force)
+
import GHC.Prelude
import GHC.Tc.Types
@@ -33,7 +35,12 @@ rnDocDecl (DocGroup i doc) = do
rnHsDoc :: WithHsDocIdentifiers a GhcPs -> RnM (WithHsDocIdentifiers a GhcRn)
rnHsDoc (WithHsDocIdentifiers s ids) = do
gre <- tcg_rdr_env <$> getGblEnv
- pure (WithHsDocIdentifiers s (rnHsDocIdentifiers gre ids))
+
+ -- This is forced to avoid retention of the entire GlobalRdrEnv
+ let !rn = force $ rnHsDocIdentifiers gre ids
+
+ pure (WithHsDocIdentifiers s rn)
+
rnHsDocIdentifiers :: GlobalRdrEnv
-> [Located RdrName]