Every inductive type gets an `unsafe` declaration `T.ctorIdx._impl`
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
- #16324 di @vincentqb — chiusa senza merge
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 39/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Ambito
- compilers
Direzione di ricerca
Read the changes associated with #15407 and #16253, then inspect how inductive declarations generate T.ctorIdx and T.ctorIdx._impl. The issue reports that #16324 is a closed, unmerged pull request, so check its changes and status first. Done means safe-only files can use inductive types with multiple constructors without receiving the unwanted unsafe implementation or implemented_by attribute.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Since v4.36.0-rc1, declaring an inductive type T with more than one constructor also adds unsafe def T.ctorIdx._impl and marks T.ctorIdx with @[implemented_by T.ctorIdx._impl]. Files with only safe code therefore contain unsafe code, and tools that refuse unsafe or @[implemented_by] in the code they check refuse every such type. The values are correct, and v4.35.0 added neither.
inductive T | a | b (n : Nat)
#print T.ctorIdx._impl
-- v4.35.0: Unknown constant `T.ctorIdx._impl`
-- v4.36.0-rc2, nightly-2026-11-06: unsafe protected def T.ctorIdx._impl : T → Nat := fun x => getObjTagNat x
Related:
- #9951 generates
T.ctorIdxfor every inductive type. - #15407 added
T.ctorIdx._implso thatT.ctorIdxreads the constructor tag. - #16253 made
withPtrEqsafe by letting the compiler substitute its unsafe implementation, which is howT.ctorIdxcan read the tag without_impl.
- Lingua principale
- Lean
- Stelle
- 10.3k
- Fork
- 1.1k
- Merge medio
- 19h 8m
- PR unite (30g)
- 421
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di leanprover/lean4
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
leanprover/lean4#16681 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
leanprover/lean4#16305 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
leanprover/lean4#16299 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
leanprover/lean4#16257 ·
I maintainer di solito rispondono entro 1 giorno
-
`IO.FS.realPath` reports every failure as `noFileOrDirectory` instead of classifying by `errno`Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
leanprover/lean4#15683 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di leanprover/lean4
Issue simili
-
bug fixed form parser medium priority tokenizer
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
swc-project/swc-next-issues#817 ·
-
Magma mode: div:=, mod:= and the other keyword assignments (join:=, meet:=, diff:=, sdiff:=, and:=, or:=, xor:=) are refusedForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
sagemathinc/sagebrush#1683 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 1 giorno
-
microts: a model local that every branch assigns raises unused_assignments in the generated RustApertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
pocket-stack/pocketjs#756 ·