Skip to content

Commit 0b93b3f

Browse files
authored
chore: record uses of user-defined attributes as shake dependencies (#11202)
1 parent ed34ee0 commit 0b93b3f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Lean/Elab/Attributes.lean

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ module
77

88
prelude
99
public import Lean.Elab.Util
10+
public import Lean.Compiler.InitAttr
1011
import Lean.Parser.Term
1112

1213
public section
@@ -56,6 +57,9 @@ def elabAttr [Monad m] [MonadEnv m] [MonadResolveName m] [MonadError m] [MonadMa
5657
| _ => throwErrorAt attr "Unknown attribute"
5758
let .ok _impl := getAttributeImpl (← getEnv) attrName
5859
| throwError "Unknown attribute `[{attrName}]`"
60+
if let .ok impl := getAttributeImpl (← getEnv) attrName then
61+
if isIOUnitRegularInitFn (← getEnv) impl.ref then -- skip `builtin_initialize` attributes
62+
recordExtraModUseFromDecl (isMeta := true) impl.ref
5963
/- The `AttrM` does not have sufficient information for expanding macros in `args`.
6064
So, we expand them before here before we invoke the attributer handlers implemented using `AttrM`. -/
6165
return { kind := attrKind, name := attrName, stx := attr }

0 commit comments

Comments
 (0)