[Git][ghc/ghc][master] compiler: Ensure that Panic.Plain.assertPanic' provides callstack

Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: 6111c5e4 by Ben Gamari at 2025-04-24T18:04:53-04:00 compiler: Ensure that Panic.Plain.assertPanic' provides callstack In 36cddd2ce1a3bc62ea8a1307d8bc6006d54109cf @alt-romes removed CallStack output from `GHC.Utils.Panic.Plain.assertPanic'`. While this output is redundant due to the exception backtrace proposal, we may be bootstrapping with a compiler which does not yet include this machinery. Reintroduce the output for now. Fixes #25898. - - - - - 1 changed file: - compiler/GHC/Utils/Panic/Plain.hs Changes: ===================================== compiler/GHC/Utils/Panic/Plain.hs ===================================== @@ -116,9 +116,17 @@ assertPanic file line = Exception.throw (Exception.AssertionFailed ("ASSERT failed! file " ++ file ++ ", line " ++ show line)) - +-- | Throw a failed assertion exception taking the location information +-- from 'HasCallStack' evidence. assertPanic' :: HasCallStack => a -assertPanic' = Exception.throw (Exception.AssertionFailed "ASSERT failed!") +assertPanic' = + Exception.throw + $ Exception.AssertionFailed + $ "ASSERT failed!\n" ++ withFrozenCallStack doc + where + -- TODO: Drop CallStack when exception backtrace functionality + -- can be assumed of bootstrap compiler. + doc = unlines $ fmap (" "++) $ lines (prettyCallStack callStack) assert :: HasCallStack => Bool -> a -> a {-# INLINE assert #-} View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/6111c5e4c4aad2f4e97af62ae304e96b... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/6111c5e4c4aad2f4e97af62ae304e96b... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Marge Bot (@marge-bot)