Skip to content

Commit 570b50c

Browse files
chore: Update to Lean v4.26.0 and Rust 1.92 (#290)
* chore: Update lean4-nix * Update * (WIP) chore: Update Lean to v4.26.0 * Update lean4-nix and Rust 1.92 * Fix lints * Update Blake3.lean
1 parent a887561 commit 570b50c

15 files changed

Lines changed: 151 additions & 321 deletions

File tree

.github/workflows/nix.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
github_access_token: ${{ secrets.GITHUB_TOKEN }}
2727
# Ix CLI
2828
- run: nix build --print-build-logs --accept-flake-config
29-
- run: nix run .#default -- --help
29+
- run: nix run .#ix -- --help
3030
# Ix benches
3131
- run: nix build .#bench-aiur --print-build-logs --accept-flake-config
3232
- run: nix build .#bench-blake3 --print-build-logs --accept-flake-config

Ix/Address.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def natOfHex : Char -> Option Nat
6060
def hexOfByte (b : UInt8) : String :=
6161
let hi := hexOfNat (UInt8.toNat (b >>> 4))
6262
let lo := hexOfNat (UInt8.toNat (b &&& 0xF))
63-
String.mk [hi.get!, lo.get!]
63+
String.ofList [hi.get!, lo.get!]
6464

6565
/-- Convert a ByteArray to a big-endian hexadecimal string. -/
6666
def hexOfBytes (ba : ByteArray) : String :=

Ix/Benchmark/Bench.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,10 +333,10 @@ def padWhitespace (input : String) (width : Nat) : String :=
333333
let padWidth := width - input.length
334334
let leftPad := padWidth / 2
335335
let rightPad := padWidth - leftPad
336-
String.mk (List.replicate leftPad ' ') ++ input ++ (String.mk (List.replicate rightPad ' '))
336+
String.ofList (List.replicate leftPad ' ') ++ input ++ (String.ofList (List.replicate rightPad ' '))
337337

338338
def padDashes (width : Nat) : String :=
339-
String.mk (List.replicate width '-')
339+
String.ofList (List.replicate width '-')
340340

341341
def mkReportPretty' (columnWidths : ColumnWidths) (reportPretty : String) (row : BenchReport) : String :=
342342
let functionStr := padWhitespace row.function columnWidths.function

Ix/Common.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ deriving instance BEq, Repr, Ord, Hashable for Lean.QuotKind
3838
deriving instance BEq, Repr, Ord, Hashable for Lean.ReducibilityHints
3939
deriving instance BEq, Repr, Ord, Hashable for Lean.DefinitionSafety
4040
deriving instance BEq, Repr, Ord, Hashable for ByteArray
41-
deriving instance BEq, Repr, Ord, Hashable for String.Pos
42-
deriving instance BEq, Repr, Ord, Hashable for Substring
41+
deriving instance BEq, Repr, Ord, Hashable for String.Pos.Raw
42+
deriving instance BEq, Repr, Ord, Hashable for Substring.Raw
4343
deriving instance BEq, Repr, Ord, Hashable for Lean.SourceInfo
4444
deriving instance BEq, Repr, Ord, Hashable for Lean.Syntax.Preresolved
4545
deriving instance BEq, Repr, Ord, Hashable for Lean.Syntax

Ix/CompileM.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ def compileLevel (lvl: Lean.Level): CompileM MetaAddress := do
227227
| none => do throw <| .levelNotFound (<- read).current n lvls s!"compileLevel"
228228
| l@(.mvar ..) => throw $ .levelMetavariable l
229229

230-
def compileSubstring : Substring -> CompileM Ixon.Substring
230+
def compileSubstring : Substring.Raw -> CompileM Ixon.Substring
231231
| ⟨str, startPos, stopPos⟩ => do
232232
pure ⟨<- storeString str, startPos.byteIdx, stopPos.byteIdx⟩
233233

Ix/Store.lean

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,11 @@ def storeDir : StoreIO FilePath := do
4343
def storePath (addr: Address): StoreIO FilePath := do
4444
let store <- storeDir
4545
let hex := hexOfBytes addr.hash
46-
let dir1 := String.mk [(hex.get ⟨0⟩), (hex.get ⟨1⟩)]
47-
let dir2 := String.mk [(hex.get ⟨2⟩), (hex.get ⟨3⟩)]
48-
let dir3 := String.mk [(hex.get ⟨4⟩), (hex.get ⟨5⟩)]
46+
-- TODO: Use Slice API once it matures
47+
let hexChars := hex.toSlice.chars.toList
48+
let dir1 := String.ofList [hexChars[0]!, hexChars[1]!]
49+
let dir2 := String.ofList [hexChars[2]!, hexChars[3]!]
50+
let dir3 := String.ofList [hexChars[4]!, hexChars[5]!]
4951
let file := hex.drop 6
5052
let path := store / dir1 / dir2 / dir3
5153
if !(<- path.pathExists) then

Tests/Ix.lean

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def parseHex (x : String) : ByteArray :=
119119
let x :=
120120
if x.startsWith "0x" || x.startsWith "0X" then x.drop 2 else x
121121
-- remove underscores
122-
let x := String.mk (x.toList.filter (· ≠ '_'))
122+
let x := String.ofList (x.toList.filter (· ≠ '_'))
123123
-- must have an even number of hex digits
124124
if x.length % 2 = 1 then
125125
panic! "parseHex: odd number of hex digits"
@@ -128,8 +128,8 @@ def parseHex (x : String) : ByteArray :=
128128
let rec loop (i : Nat) (acc : ByteArray) : ByteArray :=
129129
if i < n then
130130
-- safe since ASCII: `String.get!` indexes by chars
131-
let c1 := x.get! ⟨i⟩
132-
let c2 := x.get! ⟨i+1
131+
let c1 := String.Pos.Raw.get! x ⟨i⟩
132+
let c2 := String.Pos.Raw.get! x ⟨i+1
133133
match hexVal? c1, hexVal? c2 with
134134
| some hi, some lo =>
135135
let b : UInt8 := (hi <<< 4) ||| lo
@@ -148,8 +148,8 @@ def printHex (ba : ByteArray) : String :=
148148
let b := ba.get! i
149149
let hi := (b.toNat / 16)
150150
let lo := (b.toNat % 16)
151-
let acc := acc.push (hexdigits.get! ⟨hi⟩)
152-
let acc := acc.push (hexdigits.get! ⟨lo⟩)
151+
let acc := acc.push (String.Pos.Raw.get! hexdigits ⟨hi⟩)
152+
let acc := acc.push (String.Pos.Raw.get! hexdigits ⟨lo⟩)
153153
go (i + 1) acc
154154
else acc
155155
"0x" ++ go 0 ""

deny.toml

Lines changed: 6 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ ignore = [
7575
"RUSTSEC-2024-0370", # `proc-macro-error` crate is unmaintained
7676
"RUSTSEC-2023-0089", # `atomic-polyfill` crate is unmaintained
7777
"RUSTSEC-2025-0141", # `bincode` crate is unmaintained
78-
7978
#{ id = "RUSTSEC-0000-0000", reason = "you can specify a reason the advisory is ignored" },
8079
#"a-crate-that-is-yanked@0.1.1", # you can also ignore yanked crate versions if you wish
8180
#{ crate = "a-crate-that-is-yanked@0.1.1", reason = "you can specify why you are ignoring the yanked crate" },
@@ -122,66 +121,12 @@ exceptions = [
122121
# Some crates don't have (easily) machine readable licensing information,
123122
# adding a clarification entry for it allows you to manually specify the
124123
# licensing information
125-
[[licenses.clarify]]
126-
crate = "binius_circuits"
127-
expression = "Apache-2.0"
128-
license-files = [
129-
{ path = "../../LICENSE.txt", hash = 0 }
130-
]
131-
[[licenses.clarify]]
132-
crate = "binius_core"
133-
expression = "Apache-2.0"
134-
license-files = [
135-
{ path = "../../LICENSE.txt", hash = 0 }
136-
]
137-
[[licenses.clarify]]
138-
crate = "binius_field"
139-
expression = "Apache-2.0"
140-
license-files = [
141-
{ path = "../../LICENSE.txt", hash = 0 }
142-
]
143-
[[licenses.clarify]]
144-
crate = "binius_hal"
145-
expression = "Apache-2.0"
146-
license-files = [
147-
{ path = "../../LICENSE.txt", hash = 0 }
148-
]
149-
[[licenses.clarify]]
150-
crate = "binius_hash"
151-
expression = "Apache-2.0"
152-
license-files = [
153-
{ path = "../../LICENSE.txt", hash = 0 }
154-
]
155-
[[licenses.clarify]]
156-
crate = "binius_macros"
157-
expression = "Apache-2.0"
158-
license-files = [
159-
{ path = "../../LICENSE.txt", hash = 0 }
160-
]
161-
[[licenses.clarify]]
162-
crate = "binius_math"
163-
expression = "Apache-2.0"
164-
license-files = [
165-
{ path = "../../LICENSE.txt", hash = 0 }
166-
]
167-
[[licenses.clarify]]
168-
crate = "binius_maybe_rayon"
169-
expression = "Apache-2.0"
170-
license-files = [
171-
{ path = "../../LICENSE.txt", hash = 0 }
172-
]
173-
[[licenses.clarify]]
174-
crate = "binius_ntt"
175-
expression = "Apache-2.0"
176-
license-files = [
177-
{ path = "../../LICENSE.txt", hash = 0 }
178-
]
179-
[[licenses.clarify]]
180-
crate = "binius_utils"
181-
expression = "Apache-2.0"
182-
license-files = [
183-
{ path = "../../LICENSE.txt", hash = 0 }
184-
]
124+
# [[licenses.clarify]]
125+
# crate = "binius_circuits"
126+
# expression = "Apache-2.0"
127+
# license-files = [
128+
# { path = "../../LICENSE.txt", hash = 0 }
129+
# ]
185130
# The package spec the clarification applies to
186131
#crate = "ring"
187132
# The SPDX expression for the license requirements of the crate

0 commit comments

Comments
 (0)