Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: 1d2a26ee by Andrew Lelechenko at 2026-10-01T20:22:04-04:00 Remove bitSize from MINIMAL pragma of class Bits Cf. https://github.com/haskell/core-libraries-committee/issues/441 The function is deprecated for 12 years and has a default implementation, yet it was never removed from the MINIMAL pragma, putting library authors in a very awkward position. Let's finally remove bitSize from MINIMAL. - - - - - 3cc21e4c by Hannes Siebenhandl at 2026-10-01T20:22:59-04:00 Add regression test for #27641 - - - - - c35096f5 by Hannes Siebenhandl at 2026-10-01T20:23:00-04:00 Don't `:add` modules the loader will reject Only home modules can be actually added to the loader context, thus we only accept the module if it belongs to a home unit. - - - - - 49b7d017 by Simon Jakobi at 2026-10-02T08:25:40-04:00 ci: accept modified changelog.d entries in lint-changelog The changelog guide says to extend an existing entry rather than add a new one when the feature is already documented. lint_changelog only counted added files, so such MRs failed before the validator ran. Fixes #27779. Assisted-by: Claude Fable 5.1 - - - - - c67e8aad by Hannes Siebenhandl at 2026-10-02T08:25:41-04:00 Extend the `TrustOverlay` for wired-in units The TrustOverlay only contained the `UnitId` of all on-disk units. However, wired-in units are referred to by their wired-in unit id, which is not the same as the on-disk unit id. Thus, trust checks for wired-in units failed because the lookup was using the wired-in unit, which wasn't present in the `TrustOverlay`. We fix #27834, by copying the trust info for wired-in unit ids. - - - - - 18 changed files: - .gitlab/ci.sh - + changelog.d/27641 - changelog.d/unit-index - compiler/GHC/Unit/External/Wired.hs - compiler/GHC/Unit/State.hs - ghc/GHCi/UI.hs - libraries/base/changelog.md - libraries/ghc-internal/src/GHC/Internal/Bits.hs - + testsuite/tests/ghci/scripts/T27641.script - + testsuite/tests/ghci/scripts/T27641.stderr - + testsuite/tests/ghci/scripts/T27641.stdout - + testsuite/tests/ghci/scripts/T27834.hs - + testsuite/tests/ghci/scripts/T27834.script - + testsuite/tests/ghci/scripts/T27834.stdout - testsuite/tests/ghci/scripts/all.T - testsuite/tests/interface-stability/base-exports.stdout - testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs - testsuite/tests/interface-stability/base-exports.stdout-mingw32 Changes: ===================================== .gitlab/ci.sh ===================================== @@ -982,23 +982,24 @@ function lint_changelog() { exit 0 fi - # Check that the MR adds at least one changelog entry. + # Check that the MR adds or modifies at least one changelog entry. git fetch --depth=1 \ "$CI_MERGE_REQUEST_PROJECT_URL" \ "$CI_MERGE_REQUEST_DIFF_BASE_SHA" - local added - added=$(git diff --name-only --diff-filter=A \ + local entries + entries=$(git diff --name-only --diff-filter=AM \ "$CI_MERGE_REQUEST_DIFF_BASE_SHA..$CI_COMMIT_SHA" -- \ 'changelog.d/' | grep -v '^changelog.d/config$' || true) - if [ -z "$added" ]; then + if [ -z "$entries" ]; then error "No changelog entry found in changelog.d/" - echo "Please add a changelog entry file describing your user-facing changes." + echo "Please add a changelog entry file describing your user-facing changes," + echo "or add this MR to the 'mrs' field of an existing entry." echo "If this MR does not need a changelog entry, apply the 'no-changelog' label." exit 1 fi - echo "Found changelog entries: $added" + echo "Found changelog entries: $entries" # Build changelog-d with the bootstrap compiler and validate all entries # (checks required fields, section names, and the MR number). ===================================== changelog.d/27641 ===================================== @@ -0,0 +1,4 @@ +section: ghci +synopsis: Don't accept modules in `:add` that the loader will reject +issues: #27641 +mrs: !16734 ===================================== changelog.d/unit-index ===================================== @@ -1,7 +1,7 @@ section: compiler synopsis: Use global ``UnitIndex`` to deduplicate ``UnitInfo``s over multiple home units -issues: #27500 #26423 #27748 -mrs: !16115 !16598 +issues: #27500 #26423 #27748 #27834 +mrs: !16115 !16598 !16743 description: { The ``UnitState`` used to be duplicated for all ``HomeUnitEnv``, not sharing any of the ``UnitInfo``s. ===================================== compiler/GHC/Unit/External/Wired.hs ===================================== @@ -5,6 +5,7 @@ module GHC.Unit.External.Wired ( isWireMapEmpty, lookupWireMap, listWireMap, + nonDetFoldWireMap, -- * 'UnwireMap' UnwireMap, emptyUnwireMap, @@ -48,6 +49,9 @@ lookupWireMap uid (WireMap wmap) = lookupUniqMap wmap uid listWireMap :: WireMap -> [(UnitId, UnitId)] listWireMap (WireMap wmap) = nonDetUniqMapToList wmap +nonDetFoldWireMap :: ((UnitId, UnitId) -> b -> b) -> b -> WireMap -> b +nonDetFoldWireMap go z (WireMap uniq) = nonDetFoldUniqMap go z uniq + -- | The reverse of 'WireMap'. -- Records the mapping from the wired-in 'UnitId' to the on-disk 'UnitId'. newtype UnwireMap = ===================================== compiler/GHC/Unit/State.hs ===================================== @@ -286,6 +286,21 @@ trustUnits elements (TrustOverlay to) = TrustOverlay $ foldl' (\ acc uid -> addT emptyTrustOverlay :: TrustOverlay emptyTrustOverlay = TrustOverlay emptyUniqMap +-- | For all values in the 'WireMap', copy the recorded trust/distrust +-- for the wired-in unit id. +-- +extendForWireMap :: TrustOverlay -> WireMap -> TrustOverlay +extendForWireMap to wmap = + nonDetFoldWireMap go to wmap + where + go (onDiskUid, wiredInUid) overlay = + case lookupTrustOverlay overlay onDiskUid of + Nothing -> overlay + Just Trusted -> + trustUnits [wiredInUid] overlay + Just Distrusted -> + distrustUnits [wiredInUid] overlay + {- Note [Sharing 'UnitInfo's across the 'UnitEnv'] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -957,7 +972,7 @@ mkUnitState logger unit_index cfg = do , explicitUnits = explicit_pkgs , homeUnitDepends = home_unit_deps , unitInfoMap = pkg_db - , trustedUnits = trustUnitsOverlay + , trustedUnits = trustUnitsOverlay `extendForWireMap` wired_map , moduleNameProvidersMap = mod_map , pluginModuleNameProvidersMap = mkModuleNameProvidersMap logger (unitConfigAllowVirtual cfg) pkg_db plugin_vis_map , packageNameMap = pkgname_map ===================================== ghc/GHCi/UI.hs ===================================== @@ -180,6 +180,7 @@ import GHC.IO.Handle ( hFlushAll ) import GHC.TopHandler ( topHandler ) import qualified GHC.Unit.Module.Graph as GHC +import GHC.Unit.Home.Graph (memberHugUnit) ----------------------------------------------------------------------------- @@ -2400,7 +2401,9 @@ addModule files = do result <- liftIO $ Finder.findImportedModule hsc_env Finder.LookupUser m NoPkgQual case result of - Found _ _ -> return True + -- We could find a module from a dependency, such as `Data.List`, but we can't + -- actualy load that unless the module is located in a home unit. + Found _ m | moduleUnit m `memberHugUnit` hsc_HUG hsc_env -> return True _ -> do reportError (GhciModuleError $ GhciModuleNotFound (moduleNameString m)) return False ===================================== libraries/base/changelog.md ===================================== @@ -7,6 +7,7 @@ * Add `Data.List.NonEmpty.{zip{3..7},zipWith{3..7},unzip{3..7}}` ([CLC proposal #409)(https://github.com/haskell/core-libraries-committee/issues/409)) * Ensure that `Data.List.elem` and `notElem` can be specialized even when no list fusion happens. ([CLC proposal #412)(https://github.com/haskell/core-libraries-committee/issues/412)) * Introduce `Data.Double` and `Data.Float` modules. ([CLC proposal #378](https://github.com/haskell/core-libraries-committee/issues/378)) + * Remove `bitSize` from `MINIMAL` pragma of `class Bits`. ([CLC proposal #440](https://github.com/haskell/core-libraries-committee/issues/440)) * Change `Generically a`'s `Monoid` definition to require a `Semigroup` constraint, and define its `mconcat` using `(<>)` from that constraint. ([CLC proposal #413](https://github.com/haskell/core-libraries-committee/issues/413)) * Add `withEmptyCallStack` to `GHC.Stack`. ([CLC proposal #428](https://github.com/haskell/core-libraries-committee/issues/428)) * Add new `Data.RealFloat` module re-exporting `RealFloat` from `GHC.Float` ([CLC proposal #394](https://github.com/haskell/core-libraries-committee/issues/394)) ===================================== libraries/ghc-internal/src/GHC/Internal/Bits.hs ===================================== @@ -90,7 +90,7 @@ class Eq a => Bits a where {-# MINIMAL (.&.), (.|.), xor, complement, (shift | (shiftL, shiftR)), (rotate | (rotateL, rotateR)), - bitSize, bitSizeMaybe, isSigned, testBit, bit, popCount #-} + bitSizeMaybe, isSigned, testBit, bit, popCount #-} -- | Bitwise \"and\" (.&.) :: a -> a -> a ===================================== testsuite/tests/ghci/scripts/T27641.script ===================================== @@ -0,0 +1,3 @@ +:add Data.List +:reload +putStrLn ":add Data.List should fail and a subsequent :reload should succeed" ===================================== testsuite/tests/ghci/scripts/T27641.stderr ===================================== @@ -0,0 +1,2 @@ +<interactive>: error: [GHCi-23305] Module Data.List not found + ===================================== testsuite/tests/ghci/scripts/T27641.stdout ===================================== @@ -0,0 +1 @@ +:add Data.List should fail and a subsequent :reload should succeed ===================================== testsuite/tests/ghci/scripts/T27834.hs ===================================== @@ -0,0 +1,9 @@ +{-# LANGUAGE Haskell2010 #-} +{-# LANGUAGE Safe #-} +module Main where + +-- Importing a wired-in in module should honour trustworthiness +import GHC.Internal.Char (chr) + +main :: IO () +main = print (chr 120) ===================================== testsuite/tests/ghci/scripts/T27834.script ===================================== @@ -0,0 +1,2 @@ +:load T27834 +putStrLn "Can import trusted module from ghc-internal" ===================================== testsuite/tests/ghci/scripts/T27834.stdout ===================================== @@ -0,0 +1 @@ +Can import trusted module from ghc-internal ===================================== testsuite/tests/ghci/scripts/all.T ===================================== @@ -402,3 +402,5 @@ test('GhciPackageRename', ghci_script, ['GhciPackageRename.script']) test('T26233', normal, ghci_script, ['T26233.script']) +test('T27641', normal, ghci_script, ['T27641.script']) +test('T27834', [extra_hc_opts("-fpackage-trust -trust base -trust ghc-internal -package ghc-internal")], ghci_script, ['T27834.script']) ===================================== testsuite/tests/interface-stability/base-exports.stdout ===================================== @@ -726,7 +726,7 @@ module Data.Bits where rotateL :: a -> GHC.Internal.Types.Int -> a rotateR :: a -> GHC.Internal.Types.Int -> a popCount :: a -> GHC.Internal.Types.Int - {-# MINIMAL (.&.), (.|.), xor, complement, (shift | (shiftL, shiftR)), (rotate | (rotateL, rotateR)), bitSize, bitSizeMaybe, isSigned, testBit, bit, popCount #-} + {-# MINIMAL (.&.), (.|.), xor, complement, (shift | (shiftL, shiftR)), (rotate | (rotateL, rotateR)), bitSizeMaybe, isSigned, testBit, bit, popCount #-} type FiniteBits :: * -> Constraint class Bits b => FiniteBits b where finiteBitSize :: b -> GHC.Internal.Types.Int @@ -2024,7 +2024,7 @@ module Foreign where rotateL :: a -> Int -> a rotateR :: a -> Int -> a popCount :: a -> Int - {-# MINIMAL (.&.), (.|.), xor, complement, (shift | (shiftL, shiftR)), (rotate | (rotateL, rotateR)), bitSize, bitSizeMaybe, isSigned, testBit, bit, popCount #-} + {-# MINIMAL (.&.), (.|.), xor, complement, (shift | (shiftL, shiftR)), (rotate | (rotateL, rotateR)), bitSizeMaybe, isSigned, testBit, bit, popCount #-} type FinalizerEnvPtr :: * -> * -> * type FinalizerEnvPtr env a = FunPtr (Ptr env -> Ptr a -> GHC.Internal.Types.IO ()) type FinalizerPtr :: * -> * @@ -2938,7 +2938,7 @@ module Foreign.Safe where rotateL :: a -> Int -> a rotateR :: a -> Int -> a popCount :: a -> Int - {-# MINIMAL (.&.), (.|.), xor, complement, (shift | (shiftL, shiftR)), (rotate | (rotateL, rotateR)), bitSize, bitSizeMaybe, isSigned, testBit, bit, popCount #-} + {-# MINIMAL (.&.), (.|.), xor, complement, (shift | (shiftL, shiftR)), (rotate | (rotateL, rotateR)), bitSizeMaybe, isSigned, testBit, bit, popCount #-} type FinalizerEnvPtr :: * -> * -> * type FinalizerEnvPtr env a = FunPtr (Ptr env -> Ptr a -> GHC.Internal.Types.IO ()) type FinalizerPtr :: * -> * @@ -5070,7 +5070,7 @@ module GHC.Bits where rotateL :: a -> GHC.Internal.Types.Int -> a rotateR :: a -> GHC.Internal.Types.Int -> a popCount :: a -> GHC.Internal.Types.Int - {-# MINIMAL (.&.), (.|.), xor, complement, (shift | (shiftL, shiftR)), (rotate | (rotateL, rotateR)), bitSize, bitSizeMaybe, isSigned, testBit, bit, popCount #-} + {-# MINIMAL (.&.), (.|.), xor, complement, (shift | (shiftL, shiftR)), (rotate | (rotateL, rotateR)), bitSizeMaybe, isSigned, testBit, bit, popCount #-} type FiniteBits :: * -> Constraint class Bits b => FiniteBits b where finiteBitSize :: b -> GHC.Internal.Types.Int ===================================== testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs ===================================== @@ -726,7 +726,7 @@ module Data.Bits where rotateL :: a -> GHC.Internal.Types.Int -> a rotateR :: a -> GHC.Internal.Types.Int -> a popCount :: a -> GHC.Internal.Types.Int - {-# MINIMAL (.&.), (.|.), xor, complement, (shift | (shiftL, shiftR)), (rotate | (rotateL, rotateR)), bitSize, bitSizeMaybe, isSigned, testBit, bit, popCount #-} + {-# MINIMAL (.&.), (.|.), xor, complement, (shift | (shiftL, shiftR)), (rotate | (rotateL, rotateR)), bitSizeMaybe, isSigned, testBit, bit, popCount #-} type FiniteBits :: * -> Constraint class Bits b => FiniteBits b where finiteBitSize :: b -> GHC.Internal.Types.Int @@ -2024,7 +2024,7 @@ module Foreign where rotateL :: a -> Int -> a rotateR :: a -> Int -> a popCount :: a -> Int - {-# MINIMAL (.&.), (.|.), xor, complement, (shift | (shiftL, shiftR)), (rotate | (rotateL, rotateR)), bitSize, bitSizeMaybe, isSigned, testBit, bit, popCount #-} + {-# MINIMAL (.&.), (.|.), xor, complement, (shift | (shiftL, shiftR)), (rotate | (rotateL, rotateR)), bitSizeMaybe, isSigned, testBit, bit, popCount #-} type FinalizerEnvPtr :: * -> * -> * type FinalizerEnvPtr env a = FunPtr (Ptr env -> Ptr a -> GHC.Internal.Types.IO ()) type FinalizerPtr :: * -> * @@ -2938,7 +2938,7 @@ module Foreign.Safe where rotateL :: a -> Int -> a rotateR :: a -> Int -> a popCount :: a -> Int - {-# MINIMAL (.&.), (.|.), xor, complement, (shift | (shiftL, shiftR)), (rotate | (rotateL, rotateR)), bitSize, bitSizeMaybe, isSigned, testBit, bit, popCount #-} + {-# MINIMAL (.&.), (.|.), xor, complement, (shift | (shiftL, shiftR)), (rotate | (rotateL, rotateR)), bitSizeMaybe, isSigned, testBit, bit, popCount #-} type FinalizerEnvPtr :: * -> * -> * type FinalizerEnvPtr env a = FunPtr (Ptr env -> Ptr a -> GHC.Internal.Types.IO ()) type FinalizerPtr :: * -> * @@ -5070,7 +5070,7 @@ module GHC.Bits where rotateL :: a -> GHC.Internal.Types.Int -> a rotateR :: a -> GHC.Internal.Types.Int -> a popCount :: a -> GHC.Internal.Types.Int - {-# MINIMAL (.&.), (.|.), xor, complement, (shift | (shiftL, shiftR)), (rotate | (rotateL, rotateR)), bitSize, bitSizeMaybe, isSigned, testBit, bit, popCount #-} + {-# MINIMAL (.&.), (.|.), xor, complement, (shift | (shiftL, shiftR)), (rotate | (rotateL, rotateR)), bitSizeMaybe, isSigned, testBit, bit, popCount #-} type FiniteBits :: * -> Constraint class Bits b => FiniteBits b where finiteBitSize :: b -> GHC.Internal.Types.Int ===================================== testsuite/tests/interface-stability/base-exports.stdout-mingw32 ===================================== @@ -726,7 +726,7 @@ module Data.Bits where rotateL :: a -> GHC.Internal.Types.Int -> a rotateR :: a -> GHC.Internal.Types.Int -> a popCount :: a -> GHC.Internal.Types.Int - {-# MINIMAL (.&.), (.|.), xor, complement, (shift | (shiftL, shiftR)), (rotate | (rotateL, rotateR)), bitSize, bitSizeMaybe, isSigned, testBit, bit, popCount #-} + {-# MINIMAL (.&.), (.|.), xor, complement, (shift | (shiftL, shiftR)), (rotate | (rotateL, rotateR)), bitSizeMaybe, isSigned, testBit, bit, popCount #-} type FiniteBits :: * -> Constraint class Bits b => FiniteBits b where finiteBitSize :: b -> GHC.Internal.Types.Int @@ -2024,7 +2024,7 @@ module Foreign where rotateL :: a -> Int -> a rotateR :: a -> Int -> a popCount :: a -> Int - {-# MINIMAL (.&.), (.|.), xor, complement, (shift | (shiftL, shiftR)), (rotate | (rotateL, rotateR)), bitSize, bitSizeMaybe, isSigned, testBit, bit, popCount #-} + {-# MINIMAL (.&.), (.|.), xor, complement, (shift | (shiftL, shiftR)), (rotate | (rotateL, rotateR)), bitSizeMaybe, isSigned, testBit, bit, popCount #-} type FinalizerEnvPtr :: * -> * -> * type FinalizerEnvPtr env a = FunPtr (Ptr env -> Ptr a -> GHC.Internal.Types.IO ()) type FinalizerPtr :: * -> * @@ -2938,7 +2938,7 @@ module Foreign.Safe where rotateL :: a -> Int -> a rotateR :: a -> Int -> a popCount :: a -> Int - {-# MINIMAL (.&.), (.|.), xor, complement, (shift | (shiftL, shiftR)), (rotate | (rotateL, rotateR)), bitSize, bitSizeMaybe, isSigned, testBit, bit, popCount #-} + {-# MINIMAL (.&.), (.|.), xor, complement, (shift | (shiftL, shiftR)), (rotate | (rotateL, rotateR)), bitSizeMaybe, isSigned, testBit, bit, popCount #-} type FinalizerEnvPtr :: * -> * -> * type FinalizerEnvPtr env a = FunPtr (Ptr env -> Ptr a -> GHC.Internal.Types.IO ()) type FinalizerPtr :: * -> * @@ -5073,7 +5073,7 @@ module GHC.Bits where rotateL :: a -> GHC.Internal.Types.Int -> a rotateR :: a -> GHC.Internal.Types.Int -> a popCount :: a -> GHC.Internal.Types.Int - {-# MINIMAL (.&.), (.|.), xor, complement, (shift | (shiftL, shiftR)), (rotate | (rotateL, rotateR)), bitSize, bitSizeMaybe, isSigned, testBit, bit, popCount #-} + {-# MINIMAL (.&.), (.|.), xor, complement, (shift | (shiftL, shiftR)), (rotate | (rotateL, rotateR)), bitSizeMaybe, isSigned, testBit, bit, popCount #-} type FiniteBits :: * -> Constraint class Bits b => FiniteBits b where finiteBitSize :: b -> GHC.Internal.Types.Int View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/8515790b30bd71ab4f8523b8f2ffd17... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/8515790b30bd71ab4f8523b8f2ffd17... You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
participants (1)
-
Marge Bot (@marge-bot)