chore: shake: re-add attribute rev use (#11288)

Global `attribute` commands on non-local declarations are impossible to
track granularly a priori and so should be preserved by `shake` by
default. A new `shake` option could be added to ignore these
dependencies for evaluation.
This commit is contained in:
Sebastian Ullrich 2025-11-20 16:39:38 +01:00 committed by GitHub
parent 7267ed707a
commit 7ef229d03d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View file

@ -330,6 +330,11 @@ def elabMutual : CommandElab := fun stx => do
Term.applyAttributes declName attrs
for attrName in toErase do
Attribute.erase declName attrName
if (← getEnv).isImportedConst declName && attrs.any (·.kind == .global) then
-- If an imported declaration is marked with a global attribute, there is no good way to track
-- its use generally and so Shake should conservatively preserve imports of the current
-- module.
recordExtraRevUseOfCurrentModule
@[builtin_command_elab Lean.Parser.Command.«initialize»] def elabInitialize : CommandElab
| stx@`($declModifiers:declModifiers $kw:initializeKeyword $[$id? : $type? ←]? $doSeq) => do

View file

@ -174,7 +174,7 @@ attribute [grind =] List.append
/--
info: Entries: [import Init.Grind.Attr, public import Init.Prelude]
Is rev mod use: false
Is rev mod use: true
-/
#guard_msgs in #eval showExtraModUses