Skip to content

Commit 5f417fb

Browse files
chore: update toolchain (#309)
Our `rust-toolchain` specifies `nightly-2024-05-02`. That one comes with `rustfmt` version 1.7. But our `rustfmt.toml` uses `style_edition = "2024"`; but `2024` was only added in version 1.8. So in this PR we update to a more recent nightly toolchain. Most of the changes in here are from our specified `rustfmt.toml` config actually applying. The main thing that's causing a lot of diff is [version sorting](rust-lang/rust#123800) of imports, which changes how letter case is handled for comparison. Fixes #297
1 parent c7316e8 commit 5f417fb

File tree

140 files changed

+1108
-1303
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+1108
-1303
lines changed

.github/workflows/lints.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
components: rustfmt, clippy
4747
targets: riscv32im-unknown-none-elf
4848
# TODO(Matthias): see whether we can keep this in sync with rust-toolchain.toml automatically?
49-
toolchain: nightly-2024-05-02
49+
toolchain: nightly-2024-10-03
5050
- name: Cargo cache
5151
uses: actions/cache@v3
5252
with:

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
with:
4545
targets: riscv32im-unknown-none-elf
4646
# TODO(Matthias): see whether we can keep this in sync with rust-toolchain.toml automatically?
47-
toolchain: nightly-2024-05-02
47+
toolchain: nightly-2024-10-03
4848
- name: Cargo cache
4949
uses: actions/cache@v3
5050
with:

ceno_emul/src/elf.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ extern crate alloc;
1919
use alloc::collections::BTreeMap;
2020

2121
use crate::addr::WORD_SIZE;
22-
use anyhow::{anyhow, bail, Context, Result};
23-
use elf::{endian::LittleEndian, file::Class, ElfBytes};
22+
use anyhow::{Context, Result, anyhow, bail};
23+
use elf::{ElfBytes, endian::LittleEndian, file::Class};
2424

2525
/// A RISC Zero program
2626
pub struct Program {

ceno_emul/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ mod addr;
22
pub use addr::*;
33

44
mod platform;
5-
pub use platform::{Platform, CENO_PLATFORM};
5+
pub use platform::{CENO_PLATFORM, Platform};
66

77
mod tracer;
88
pub use tracer::{Change, MemOp, ReadOp, StepRecord, Tracer, WriteOp};

ceno_emul/src/rv32im.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
// See the License for the specific language governing permissions and
1515
// limitations under the License.
1616

17-
use anyhow::{anyhow, Result};
17+
use anyhow::{Result, anyhow};
1818
use std::sync::OnceLock;
1919
use strum_macros::EnumIter;
2020

21-
use super::addr::{ByteAddr, RegIdx, Word, WordAddr, WORD_SIZE};
21+
use super::addr::{ByteAddr, RegIdx, WORD_SIZE, Word, WordAddr};
2222

2323
pub trait EmuContext {
2424
// Handle environment call

ceno_emul/src/tracer.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
use std::{collections::HashMap, fmt, mem};
22

33
use crate::{
4+
CENO_PLATFORM, PC_STEP_SIZE,
45
addr::{ByteAddr, Cycle, RegIdx, Word, WordAddr},
56
rv32im::DecodedInstruction,
6-
CENO_PLATFORM, PC_STEP_SIZE,
77
};
88

99
/// An instruction and its context in an execution trace. That is concrete values of registers and memory.
@@ -239,13 +239,10 @@ impl Tracer {
239239
/// Return the completed step and advance to the next cycle.
240240
pub fn advance(&mut self) -> StepRecord {
241241
let next_cycle = self.record.cycle + Self::SUBCYCLES_PER_INSN;
242-
mem::replace(
243-
&mut self.record,
244-
StepRecord {
245-
cycle: next_cycle,
246-
..StepRecord::default()
247-
},
248-
)
242+
mem::replace(&mut self.record, StepRecord {
243+
cycle: next_cycle,
244+
..StepRecord::default()
245+
})
249246
}
250247

251248
pub fn store_pc(&mut self, pc: ByteAddr) {

ceno_emul/src/vm_state.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ use std::collections::HashMap;
22

33
use super::rv32im::EmuContext;
44
use crate::{
5+
Program,
56
addr::{ByteAddr, RegIdx, Word, WordAddr},
67
platform::Platform,
78
rv32im::{DecodedInstruction, Emulator, TrapCause},
89
tracer::{Change, StepRecord, Tracer},
9-
Program,
1010
};
11-
use anyhow::{anyhow, Result};
11+
use anyhow::{Result, anyhow};
1212
use std::iter::from_fn;
1313

1414
/// An implementation of the machine state and of the side-effects of operations.

ceno_emul/tests/test_elf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use anyhow::Result;
2-
use ceno_emul::{ByteAddr, EmuContext, InsnKind, StepRecord, VMState, CENO_PLATFORM};
2+
use ceno_emul::{ByteAddr, CENO_PLATFORM, EmuContext, InsnKind, StepRecord, VMState};
33

44
#[test]
55
fn test_ceno_rt_mini() -> Result<()> {

ceno_emul/tests/test_vm_trace.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use anyhow::Result;
33
use std::collections::HashMap;
44

55
use ceno_emul::{
6-
ByteAddr, Cycle, EmuContext, InsnKind, StepRecord, Tracer, VMState, WordAddr, CENO_PLATFORM,
6+
ByteAddr, CENO_PLATFORM, Cycle, EmuContext, InsnKind, StepRecord, Tracer, VMState, WordAddr,
77
};
88

99
#[test]

ceno_zkvm/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ glob = "0.3"
5050
default = ["riv32"]
5151
riv32 = []
5252
riv64 = []
53+
non_pow2_rayon_thread = []
54+
flamegraph = ["pprof/flamegraph", "pprof/criterion"]
5355

5456
[[bench]]
5557
name = "riscv_add"

ceno_zkvm/benches/riscv_add.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::time::{Duration, Instant};
33
use ark_std::test_rng;
44
use ceno_zkvm::{
55
self,
6-
instructions::{riscv::arith::AddInstruction, Instruction},
6+
instructions::{Instruction, riscv::arith::AddInstruction},
77
scheme::prover::ZKVMProver,
88
structs::{ZKVMConstraintSystem, ZKVMFixedTraces},
99
};

ceno_zkvm/examples/riscv_opcodes.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ use clap::Parser;
99
use const_env::from_env;
1010

1111
use ceno_emul::{
12-
ByteAddr,
12+
ByteAddr, CENO_PLATFORM,
1313
InsnKind::{ADD, BLTU, EANY, JAL},
14-
StepRecord, VMState, CENO_PLATFORM,
14+
StepRecord, VMState,
1515
};
1616
use ceno_zkvm::{
1717
instructions::riscv::ecall::HaltInstruction,
18-
scheme::{constants::MAX_NUM_VARIABLES, verifier::ZKVMVerifier, PublicValues},
18+
scheme::{PublicValues, constants::MAX_NUM_VARIABLES, verifier::ZKVMVerifier},
1919
structs::{ZKVMConstraintSystem, ZKVMFixedTraces, ZKVMWitnesses},
2020
tables::{AndTableCircuit, LtuTableCircuit, U16TableCircuit},
2121
};
@@ -24,7 +24,7 @@ use goldilocks::GoldilocksExt2;
2424
use mpcs::{Basefold, BasefoldRSParams, PolynomialCommitmentScheme};
2525
use rand_chacha::ChaCha8Rng;
2626
use tracing_flame::FlameLayer;
27-
use tracing_subscriber::{fmt, layer::SubscriberExt, EnvFilter, Registry};
27+
use tracing_subscriber::{EnvFilter, Registry, fmt, layer::SubscriberExt};
2828
use transcript::Transcript;
2929

3030
#[from_env]

ceno_zkvm/src/expression.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,7 @@ mod tests {
826826

827827
use crate::circuit_builder::{CircuitBuilder, ConstraintSystem};
828828

829-
use super::{fmt, Expression, ToExpr};
829+
use super::{Expression, ToExpr, fmt};
830830
use ff::Field;
831831

832832
#[test]

ceno_zkvm/src/expression/monomial.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ mod tests {
154154
use super::*;
155155
use ff::Field;
156156
use goldilocks::{Goldilocks as F, GoldilocksExt2 as E};
157-
use rand_chacha::{rand_core::SeedableRng, ChaChaRng};
157+
use rand_chacha::{ChaChaRng, rand_core::SeedableRng};
158158

159159
#[test]
160160
fn test_to_monomial_form() {

ceno_zkvm/src/gadgets/div.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ use std::{fmt::Display, mem::MaybeUninit};
33
use ff_ext::ExtensionField;
44

55
use crate::{
6+
Value,
67
circuit_builder::CircuitBuilder,
78
error::ZKVMError,
8-
instructions::riscv::constants::{UInt, UINT_LIMBS},
9+
instructions::riscv::constants::{UINT_LIMBS, UInt},
910
witness::LkMultiplicity,
10-
Value,
1111
};
1212

1313
use super::AssertLTConfig;

ceno_zkvm/src/gadgets/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ mod div;
22
mod is_lt;
33
mod is_zero;
44
pub use div::DivConfig;
5-
pub use is_lt::{cal_lt_diff, AssertLTConfig, InnerLtConfig, IsLtConfig};
5+
pub use is_lt::{AssertLTConfig, InnerLtConfig, IsLtConfig, cal_lt_diff};
66
pub use is_zero::{IsEqualConfig, IsZeroConfig};

0 commit comments

Comments
 (0)