From ac1e1b3c77cd4662c16e5c6f5c913eaf74df4c3a Mon Sep 17 00:00:00 2001 From: Jonas Wanke Date: Tue, 26 Dec 2023 10:57:59 +0100 Subject: [PATCH 1/3] Impl Copy for TracingConfig, TracingMode --- compiler/cli/src/debug.rs | 30 +++++++-------- compiler/frontend/src/hir_to_mir.rs | 6 +-- compiler/frontend/src/mir_optimize/mod.rs | 4 +- compiler/frontend/src/rich_ir.rs | 20 +++++----- compiler/frontend/src/tracing.rs | 4 +- .../src/debug_adapter/session.rs | 2 +- compiler/language_server/src/features_ir.rs | 38 +++++++++---------- compiler/vm/benches/utils.rs | 14 +------ compiler/vm/fuzz/fuzz_targets/vm.rs | 8 +--- compiler/vm/src/byte_code.rs | 2 +- 10 files changed, 56 insertions(+), 72 deletions(-) diff --git a/compiler/cli/src/debug.rs b/compiler/cli/src/debug.rs index e1853ec85..e3c043b84 100644 --- a/compiler/cli/src/debug.rs +++ b/compiler/cli/src/debug.rs @@ -165,40 +165,40 @@ pub fn debug(options: Options) -> ProgramResult { let module = module_for_path(options.path.clone())?; let execution_target = options.execution_target.resolve(module.clone()); let tracing = options.to_tracing_config(); - let mir = db.mir(execution_target, tracing.clone()); + let mir = db.mir(execution_target, tracing); mir.ok() - .map(|(mir, _)| RichIr::for_mir(&module, &mir, &tracing)) + .map(|(mir, _)| RichIr::for_mir(&module, &mir, tracing)) } Options::OptimizedMir(options) => { let module = module_for_path(options.path.clone())?; let execution_target = options.execution_target.resolve(module.clone()); let tracing = options.to_tracing_config(); - let mir = db.optimized_mir(execution_target, tracing.clone()); + let mir = db.optimized_mir(execution_target, tracing); mir.ok() - .map(|(mir, _, _)| RichIr::for_optimized_mir(&module, &mir, &tracing)) + .map(|(mir, _, _)| RichIr::for_optimized_mir(&module, &mir, tracing)) } Options::Lir(options) => { let module = module_for_path(options.path.clone())?; let execution_target = options.execution_target.resolve(module.clone()); let tracing = options.to_tracing_config(); - let lir = db.lir(execution_target, tracing.clone()); + let lir = db.lir(execution_target, tracing); lir.ok() - .map(|(lir, _)| RichIr::for_lir(&module, &lir, &tracing)) + .map(|(lir, _)| RichIr::for_lir(&module, &lir, tracing)) } Options::OptimizedLir(options) => { let module = module_for_path(options.path.clone())?; let execution_target = options.execution_target.resolve(module.clone()); let tracing = options.to_tracing_config(); - let lir = db.optimized_lir(execution_target, tracing.clone()); + let lir = db.optimized_lir(execution_target, tracing); lir.ok() - .map(|(lir, _)| RichIr::for_optimized_lir(&module, &lir, &tracing)) + .map(|(lir, _)| RichIr::for_optimized_lir(&module, &lir, tracing)) } Options::VmByteCode(options) => { let module = module_for_path(options.path.clone())?; let execution_target = options.execution_target.resolve(module.clone()); let tracing = options.to_tracing_config(); - let (vm_byte_code, _) = compile_byte_code(&db, execution_target, tracing.clone()); - Some(RichIr::for_byte_code(&module, &vm_byte_code, &tracing)) + let (vm_byte_code, _) = compile_byte_code(&db, execution_target, tracing); + Some(RichIr::for_byte_code(&module, &vm_byte_code, tracing)) } #[cfg(feature = "inkwell")] Options::LlvmIr(options) => { @@ -382,33 +382,33 @@ impl GoldOptions { let (mir, _) = db .mir(execution_target.clone(), Self::TRACING_CONFIG.clone()) .unwrap(); - let mir = RichIr::for_mir(&module, &mir, &Self::TRACING_CONFIG); + let mir = RichIr::for_mir(&module, &mir, Self::TRACING_CONFIG); visit("MIR", mir.text); let (optimized_mir, _, _) = db .optimized_mir(execution_target.clone(), Self::TRACING_CONFIG.clone()) .unwrap(); let optimized_mir = - RichIr::for_optimized_mir(&module, &optimized_mir, &Self::TRACING_CONFIG); + RichIr::for_optimized_mir(&module, &optimized_mir, Self::TRACING_CONFIG); visit("Optimized MIR", optimized_mir.text); let (lir, _) = db .lir(execution_target.clone(), Self::TRACING_CONFIG.clone()) .unwrap(); - let lir = RichIr::for_lir(&module, &lir, &Self::TRACING_CONFIG); + let lir = RichIr::for_lir(&module, &lir, Self::TRACING_CONFIG); visit("LIR", lir.text); let (optimized_lir, _) = db .optimized_lir(execution_target.clone(), Self::TRACING_CONFIG.clone()) .unwrap(); let optimized_lir = - RichIr::for_optimized_lir(&module, &optimized_lir, &Self::TRACING_CONFIG); + RichIr::for_optimized_lir(&module, &optimized_lir, Self::TRACING_CONFIG); visit("Optimized LIR", optimized_lir.text); let (vm_byte_code, _) = compile_byte_code(db, execution_target.clone(), Self::TRACING_CONFIG.clone()); let vm_byte_code_rich_ir = - RichIr::for_byte_code(&module, &vm_byte_code, &Self::TRACING_CONFIG); + RichIr::for_byte_code(&module, &vm_byte_code, Self::TRACING_CONFIG); visit( "VM Byte Code", Self::format_byte_code(&vm_byte_code, &vm_byte_code_rich_ir), diff --git a/compiler/frontend/src/hir_to_mir.rs b/compiler/frontend/src/hir_to_mir.rs index 96d6780c2..6bce9346b 100644 --- a/compiler/frontend/src/hir_to_mir.rs +++ b/compiler/frontend/src/hir_to_mir.rs @@ -56,7 +56,7 @@ fn mir(db: &dyn HirToMir, target: ExecutionTarget, tracing: TracingConfig) -> Mi module, target_is_main_function, &hir, - &tracing, + tracing, &mut errors, ); (mir, errors) @@ -185,7 +185,7 @@ fn generate_needs_function(body: &mut BodyBuilder) -> Id { struct LoweringContext<'a> { mapping: &'a mut FxHashMap, needs_function: Id, - tracing: &'a TracingConfig, + tracing: TracingConfig, ongoing_destructuring: Option, errors: &'a mut FxHashSet, } @@ -202,7 +202,7 @@ impl<'a> LoweringContext<'a> { module: Module, target_is_main_function: bool, hir: &hir::Body, - tracing: &TracingConfig, + tracing: TracingConfig, errors: &mut FxHashSet, ) -> Mir { Mir::build(|body| { diff --git a/compiler/frontend/src/mir_optimize/mod.rs b/compiler/frontend/src/mir_optimize/mod.rs index 396f41400..fbdb7ecb7 100644 --- a/compiler/frontend/src/mir_optimize/mod.rs +++ b/compiler/frontend/src/mir_optimize/mod.rs @@ -95,7 +95,7 @@ fn optimized_mir( ) -> OptimizedMirResult { let module = target.module(); debug!("{module}: Compiling."); - let (mir, errors) = db.mir(target.clone(), tracing.clone())?; + let (mir, errors) = db.mir(target.clone(), tracing)?; let mut mir = (*mir).clone(); let mut pureness = PurenessInsights::default(); let mut errors = (*errors).clone(); @@ -216,7 +216,7 @@ impl Context<'_> { } } -#[allow(clippy::unnecessary_wraps)] +#[allow(clippy::trivially_copy_pass_by_ref, clippy::unnecessary_wraps)] fn recover_from_cycle( _db: &dyn OptimizeMir, cycle: &[String], diff --git a/compiler/frontend/src/rich_ir.rs b/compiler/frontend/src/rich_ir.rs index 99935c1a6..a15de13fb 100644 --- a/compiler/frontend/src/rich_ir.rs +++ b/compiler/frontend/src/rich_ir.rs @@ -290,8 +290,8 @@ impl RichIrBuilder { .push(range); } - pub fn push_tracing_config(&mut self, tracing_config: &TracingConfig) { - fn push_mode(builder: &mut RichIrBuilder, title: &str, mode: &TracingMode) { + pub fn push_tracing_config(&mut self, tracing_config: TracingConfig) { + fn push_mode(builder: &mut RichIrBuilder, title: &str, mode: TracingMode) { builder.push_comment_line(format!( "• {title} {}", match mode { @@ -308,13 +308,13 @@ impl RichIrBuilder { push_mode( self, "Include tracing of fuzzable functions?", - &tracing_config.register_fuzzables, + tracing_config.register_fuzzables, ); - push_mode(self, "Include tracing of calls?", &tracing_config.calls); + push_mode(self, "Include tracing of calls?", tracing_config.calls); push_mode( self, "Include tracing of evaluated expressions?", - &tracing_config.evaluated_expressions, + tracing_config.evaluated_expressions, ); } @@ -373,25 +373,25 @@ impl RichIr { Self::for_ir("HIR", module, None, |builder| body.build_rich_ir(builder)) } #[must_use] - pub fn for_mir(module: &Module, mir: &Mir, tracing_config: &TracingConfig) -> Self { + pub fn for_mir(module: &Module, mir: &Mir, tracing_config: TracingConfig) -> Self { Self::for_ir("MIR", module, tracing_config, |builder| { mir.build_rich_ir(builder); }) } #[must_use] - pub fn for_optimized_mir(module: &Module, mir: &Mir, tracing_config: &TracingConfig) -> Self { + pub fn for_optimized_mir(module: &Module, mir: &Mir, tracing_config: TracingConfig) -> Self { Self::for_ir("Optimized MIR", module, tracing_config, |builder| { mir.build_rich_ir(builder); }) } #[must_use] - pub fn for_lir(module: &Module, lir: &Lir, tracing_config: &TracingConfig) -> Self { + pub fn for_lir(module: &Module, lir: &Lir, tracing_config: TracingConfig) -> Self { Self::for_ir("LIR", module, tracing_config, |builder| { lir.build_rich_ir(builder); }) } #[must_use] - pub fn for_optimized_lir(module: &Module, lir: &Lir, tracing_config: &TracingConfig) -> Self { + pub fn for_optimized_lir(module: &Module, lir: &Lir, tracing_config: TracingConfig) -> Self { Self::for_ir("Optimized LIR", module, tracing_config, |builder| { lir.build_rich_ir(builder); }) @@ -400,7 +400,7 @@ impl RichIr { fn for_ir( ir_name: &str, module: &Module, - tracing_config: impl Into>, + tracing_config: impl Into>, build_rich_ir: impl FnOnce(&mut RichIrBuilder), ) -> Self { let mut builder = RichIrBuilder::default(); diff --git a/compiler/frontend/src/tracing.rs b/compiler/frontend/src/tracing.rs index c9efee10d..65b96d4f4 100644 --- a/compiler/frontend/src/tracing.rs +++ b/compiler/frontend/src/tracing.rs @@ -1,6 +1,6 @@ use serde::{Deserialize, Serialize}; -#[derive(PartialEq, Eq, Hash, Debug, Clone, Serialize, Deserialize)] +#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct TracingConfig { pub register_fuzzables: TracingMode, @@ -27,7 +27,7 @@ impl TracingConfig { } } -#[derive(PartialEq, Eq, Hash, Debug, Clone, Serialize, Deserialize)] +#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub enum TracingMode { Off, diff --git a/compiler/language_server/src/debug_adapter/session.rs b/compiler/language_server/src/debug_adapter/session.rs index 48aa039df..b1f54e4fa 100644 --- a/compiler/language_server/src/debug_adapter/session.rs +++ b/compiler/language_server/src/debug_adapter/session.rs @@ -192,7 +192,7 @@ impl DebugSession { let byte_code = compile_byte_code( &self.db, ExecutionTarget::MainFunction(module.clone()), - tracing.clone(), + tracing, ) .0; diff --git a/compiler/language_server/src/features_ir.rs b/compiler/language_server/src/features_ir.rs index 495672031..7a1795427 100644 --- a/compiler/language_server/src/features_ir.rs +++ b/compiler/language_server/src/features_ir.rs @@ -110,43 +110,43 @@ impl IrFeatures { &config.module, db.mir( ExecutionTarget::Module(config.module.clone()), - tracing_config.clone(), + *tracing_config, ), - tracing_config, + *tracing_config, ), Ir::OptimizedMir(tracing_config) => Self::rich_ir_for_optimized_mir( &config.module, db.optimized_mir( ExecutionTarget::Module(config.module.clone()), - tracing_config.clone(), + *tracing_config, ), - tracing_config, + *tracing_config, ), Ir::Lir(tracing_config) => Self::rich_ir_for_lir( &config.module, &db.lir( ExecutionTarget::Module(config.module.clone()), - tracing_config.clone(), + *tracing_config, ), - tracing_config, + *tracing_config, ), Ir::OptimizedLir(tracing_config) => Self::rich_ir_for_optimized_lir( &config.module, db.optimized_lir( ExecutionTarget::Module(config.module.clone()), - tracing_config.clone(), + *tracing_config, ), - tracing_config, + *tracing_config, ), Ir::VmByteCode(tracing_config) => Self::rich_ir_for_vm_byte_code( &config.module, &candy_vm::lir_to_byte_code::compile_byte_code( db, ExecutionTarget::Module(config.module.clone()), - tracing_config.clone(), + *tracing_config, ) .0, - tracing_config, + *tracing_config, ), #[cfg(feature = "inkwell")] Ir::LlvmIr => db @@ -179,7 +179,7 @@ impl IrFeatures { Err(error) => Self::build_rich_ir_for_module_error(builder, module, error), }) } - fn rich_ir_for_mir(module: &Module, mir: MirResult, tracing_config: &TracingConfig) -> RichIr { + fn rich_ir_for_mir(module: &Module, mir: MirResult, tracing_config: TracingConfig) -> RichIr { Self::rich_ir_for("MIR", module, tracing_config, |builder| match mir { Ok((mir, _)) => mir.build_rich_ir(builder), Err(error) => Self::build_rich_ir_for_module_error(builder, module, error), @@ -188,7 +188,7 @@ impl IrFeatures { fn rich_ir_for_optimized_mir( module: &Module, mir: OptimizedMirResult, - tracing_config: &TracingConfig, + tracing_config: TracingConfig, ) -> RichIr { Self::rich_ir_for( "Optimized MIR", @@ -200,7 +200,7 @@ impl IrFeatures { }, ) } - fn rich_ir_for_lir(module: &Module, lir: &LirResult, tracing_config: &TracingConfig) -> RichIr { + fn rich_ir_for_lir(module: &Module, lir: &LirResult, tracing_config: TracingConfig) -> RichIr { Self::rich_ir_for("LIR", module, tracing_config, |builder| match lir { Ok((lir, _)) => lir.build_rich_ir(builder), Err(error) => Self::build_rich_ir_for_module_error(builder, module, *error), @@ -209,7 +209,7 @@ impl IrFeatures { fn rich_ir_for_optimized_lir( module: &Module, lir: LirResult, - tracing_config: &TracingConfig, + tracing_config: TracingConfig, ) -> RichIr { Self::rich_ir_for( "Optimized LIR", @@ -224,7 +224,7 @@ impl IrFeatures { fn rich_ir_for_vm_byte_code( module: &Module, byte_code: &candy_vm::byte_code::ByteCode, - tracing_config: &TracingConfig, + tracing_config: TracingConfig, ) -> RichIr { Self::rich_ir_for("VM Byte Code", module, tracing_config, |builder| { byte_code.build_rich_ir(builder); @@ -233,7 +233,7 @@ impl IrFeatures { fn rich_ir_for( ir_name: &str, module: &Module, - tracing_config: impl Into>, + tracing_config: impl Into>, build_rich_ir: impl FnOnce(&mut RichIrBuilder), ) -> RichIr { let mut builder = RichIrBuilder::default(); @@ -409,14 +409,14 @@ pub enum Ir { LlvmIr, } impl Ir { - const fn tracing_config(&self) -> Option<&TracingConfig> { + const fn tracing_config(&self) -> Option { match self { Self::Rcst | Self::Ast | Self::Hir => None, Self::Mir(tracing_config) | Self::OptimizedMir(tracing_config) | Self::Lir(tracing_config) | Self::OptimizedLir(tracing_config) - | Self::VmByteCode(tracing_config) => Some(tracing_config), + | Self::VmByteCode(tracing_config) => Some(*tracing_config), #[cfg(feature = "inkwell")] Self::LlvmIr => None, } @@ -527,7 +527,6 @@ impl LanguageFeatures for IrFeatures { config .ir .tracing_config() - .cloned() .unwrap_or_else(TracingConfig::off), ), }; @@ -542,7 +541,6 @@ impl LanguageFeatures for IrFeatures { config .ir .tracing_config() - .cloned() .unwrap_or_else(TracingConfig::off), ), }; diff --git a/compiler/vm/benches/utils.rs b/compiler/vm/benches/utils.rs index f26045d54..adffd2fc2 100644 --- a/compiler/vm/benches/utils.rs +++ b/compiler/vm/benches/utils.rs @@ -86,12 +86,7 @@ pub fn setup() -> Database { db.module_provider.add_str(&MODULE, r#"_ = use "Core""#); // Load `Core` into the cache. - let errors = compile_byte_code( - &db, - ExecutionTarget::Module(MODULE.clone()), - TRACING.clone(), - ) - .1; + let errors = compile_byte_code(&db, ExecutionTarget::Module(MODULE.clone()), TRACING).1; if !errors.is_empty() { for error in errors.iter() { warn!("{}", error.to_string_with_location(&db)); @@ -104,12 +99,7 @@ pub fn setup() -> Database { pub fn compile(db: &mut Database, source_code: &str) -> ByteCode { db.did_open_module(&MODULE, source_code.as_bytes().to_owned()); - compile_byte_code( - db, - ExecutionTarget::MainFunction(MODULE.clone()), - TRACING.clone(), - ) - .0 + compile_byte_code(db, ExecutionTarget::MainFunction(MODULE.clone()), TRACING).0 } pub fn run(byte_code: impl Borrow) -> (Heap, InlineObject) { diff --git a/compiler/vm/fuzz/fuzz_targets/vm.rs b/compiler/vm/fuzz/fuzz_targets/vm.rs index 7f83d6da4..b33d564c1 100644 --- a/compiler/vm/fuzz/fuzz_targets/vm.rs +++ b/compiler/vm/fuzz/fuzz_targets/vm.rs @@ -70,12 +70,8 @@ fuzz_target!(|data: &[u8]| { db.module_provider.load_package_from_file_system("Builtins"); db.module_provider.add(&MODULE, data.to_vec()); - let byte_code = compile_byte_code( - &db, - ExecutionTarget::MainFunction(MODULE.clone()), - TRACING.clone(), - ) - .0; + let byte_code = + compile_byte_code(&db, ExecutionTarget::MainFunction(MODULE.clone()), TRACING).0; let mut heap = Heap::default(); let environment = Struct::create(&mut heap, true, &Default::default()); diff --git a/compiler/vm/src/byte_code.rs b/compiler/vm/src/byte_code.rs index e6490427e..bb5c0c48f 100644 --- a/compiler/vm/src/byte_code.rs +++ b/compiler/vm/src/byte_code.rs @@ -423,7 +423,7 @@ pub impl RichIrForByteCode for RichIr { fn for_byte_code( module: &Module, byte_code: &ByteCode, - tracing_config: &TracingConfig, + tracing_config: TracingConfig, ) -> RichIr { let mut builder = RichIrBuilder::default(); builder.push( From 12d355172dbebf4e84069046d522c2c5e45a8008 Mon Sep 17 00:00:00 2001 From: Jonas Wanke Date: Tue, 26 Dec 2023 11:18:05 +0100 Subject: [PATCH 2/3] Support all TracingModes in CLI args --- Cargo.lock | 1 + compiler/cli/src/debug.rs | 59 ++++++++++++++++++++++---------- compiler/frontend/Cargo.toml | 1 + compiler/frontend/src/tracing.rs | 3 +- 4 files changed, 45 insertions(+), 19 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8c994e8ad..14a21a82e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -166,6 +166,7 @@ dependencies = [ name = "candy_frontend" version = "0.1.0" dependencies = [ + "clap", "derive_more", "dunce", "enumset", diff --git a/compiler/cli/src/debug.rs b/compiler/cli/src/debug.rs index e3c043b84..e4f4711e1 100644 --- a/compiler/cli/src/debug.rs +++ b/compiler/cli/src/debug.rs @@ -90,24 +90,47 @@ pub struct PathAndExecutionTargetAndTracing { #[arg(long, value_enum, default_value_t = ExecutionTargetKind::Module)] execution_target: ExecutionTargetKind, - #[arg(long)] - register_fuzzables: bool, - - #[arg(long)] - trace_calls: bool, - - #[arg(long)] - trace_evaluated_expressions: bool, + // The tracing modes can be specified as follows: + // + // - not specified or `--register-fuzzables=off`: off + // - `--register-fuzzables` of `--register-fuzzables=only-current`: only current + // - `--register-fuzzables=all`: all + // + // (Same for `trace-calls` and `evaluated-expressions`.) + #[arg( + long, + default_value("off"), + default_missing_value("only-current"), + num_args(0..=1), + require_equals(true) + )] + register_fuzzables: TracingMode, + + #[arg( + long, + default_value("off"), + default_missing_value("only-current"), + num_args(0..=1), + require_equals(true) + )] + trace_calls: TracingMode, + + #[arg( + long, + default_value("off"), + default_missing_value("only-current"), + num_args(0..=1), + require_equals(true) + )] + trace_evaluated_expressions: TracingMode, } impl PathAndExecutionTargetAndTracing { #[must_use] const fn to_tracing_config(&self) -> TracingConfig { TracingConfig { - register_fuzzables: TracingMode::only_current_or_off(self.register_fuzzables), - calls: TracingMode::only_current_or_off(self.trace_calls), - evaluated_expressions: TracingMode::only_current_or_off( - self.trace_evaluated_expressions, - ), + register_fuzzables: self.register_fuzzables, + calls: self.trace_calls, + evaluated_expressions: self.trace_evaluated_expressions, } } } @@ -380,33 +403,33 @@ impl GoldOptions { visit("HIR", hir.text); let (mir, _) = db - .mir(execution_target.clone(), Self::TRACING_CONFIG.clone()) + .mir(execution_target.clone(), Self::TRACING_CONFIG) .unwrap(); let mir = RichIr::for_mir(&module, &mir, Self::TRACING_CONFIG); visit("MIR", mir.text); let (optimized_mir, _, _) = db - .optimized_mir(execution_target.clone(), Self::TRACING_CONFIG.clone()) + .optimized_mir(execution_target.clone(), Self::TRACING_CONFIG) .unwrap(); let optimized_mir = RichIr::for_optimized_mir(&module, &optimized_mir, Self::TRACING_CONFIG); visit("Optimized MIR", optimized_mir.text); let (lir, _) = db - .lir(execution_target.clone(), Self::TRACING_CONFIG.clone()) + .lir(execution_target.clone(), Self::TRACING_CONFIG) .unwrap(); let lir = RichIr::for_lir(&module, &lir, Self::TRACING_CONFIG); visit("LIR", lir.text); let (optimized_lir, _) = db - .optimized_lir(execution_target.clone(), Self::TRACING_CONFIG.clone()) + .optimized_lir(execution_target.clone(), Self::TRACING_CONFIG) .unwrap(); let optimized_lir = RichIr::for_optimized_lir(&module, &optimized_lir, Self::TRACING_CONFIG); visit("Optimized LIR", optimized_lir.text); let (vm_byte_code, _) = - compile_byte_code(db, execution_target.clone(), Self::TRACING_CONFIG.clone()); + compile_byte_code(db, execution_target.clone(), Self::TRACING_CONFIG); let vm_byte_code_rich_ir = RichIr::for_byte_code(&module, &vm_byte_code, Self::TRACING_CONFIG); visit( diff --git a/compiler/frontend/Cargo.toml b/compiler/frontend/Cargo.toml index 25ac1f449..074d55953 100644 --- a/compiler/frontend/Cargo.toml +++ b/compiler/frontend/Cargo.toml @@ -7,6 +7,7 @@ rust-version = "1.56" [lib] [dependencies] +clap = { version = "4.1.8", features = ["derive"] } derive_more = "0.99.17" dunce = "1.0.4" enumset = "1.0.12" diff --git a/compiler/frontend/src/tracing.rs b/compiler/frontend/src/tracing.rs index 65b96d4f4..134d19745 100644 --- a/compiler/frontend/src/tracing.rs +++ b/compiler/frontend/src/tracing.rs @@ -1,3 +1,4 @@ +use clap::ValueEnum; use serde::{Deserialize, Serialize}; #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] @@ -27,7 +28,7 @@ impl TracingConfig { } } -#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, Serialize, Deserialize, ValueEnum)] #[serde(rename_all = "camelCase")] pub enum TracingMode { Off, From deceaac27df84e3d7c67292673ee168bc0e436b8 Mon Sep 17 00:00:00 2001 From: Jonas Wanke Date: Wed, 27 Dec 2023 10:43:59 +0100 Subject: [PATCH 3/3] Fix typo Co-authored-by: Marcel Garus --- compiler/cli/src/debug.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/cli/src/debug.rs b/compiler/cli/src/debug.rs index e4f4711e1..77e0d7919 100644 --- a/compiler/cli/src/debug.rs +++ b/compiler/cli/src/debug.rs @@ -93,7 +93,7 @@ pub struct PathAndExecutionTargetAndTracing { // The tracing modes can be specified as follows: // // - not specified or `--register-fuzzables=off`: off - // - `--register-fuzzables` of `--register-fuzzables=only-current`: only current + // - `--register-fuzzables` or `--register-fuzzables=only-current`: only current // - `--register-fuzzables=all`: all // // (Same for `trace-calls` and `evaluated-expressions`.)