diff --git a/nekocode/nekocode-rust b/nekocode/nekocode-rust deleted file mode 100644 index ef91ebc0..00000000 Binary files a/nekocode/nekocode-rust and /dev/null differ diff --git a/src/backend/vm_phi.rs b/src/backend/vm_phi.rs index 65f7b0dc..722b5d98 100644 --- a/src/backend/vm_phi.rs +++ b/src/backend/vm_phi.rs @@ -6,7 +6,7 @@ */ use super::vm::{VMValue, VMError}; -use crate::mir::{BasicBlockId, ValueId, MirInstruction}; +use crate::mir::{BasicBlockId, ValueId}; use std::collections::HashMap; /// Phi nodeの実行ヘルパー @@ -45,7 +45,7 @@ impl PhiHandler { /// Phi命令を実行 pub fn execute_phi( &mut self, - dst: ValueId, + _dst: ValueId, inputs: &[(BasicBlockId, ValueId)], get_value_fn: impl Fn(ValueId) -> Result, ) -> Result { diff --git a/src/bid/generic_plugin_box.rs b/src/bid/generic_plugin_box.rs index 933ad2eb..91dcf2d1 100644 --- a/src/bid/generic_plugin_box.rs +++ b/src/bid/generic_plugin_box.rs @@ -2,8 +2,6 @@ mod plugin_impl { use crate::bid::{BidError, BidResult, LoadedPlugin}; -use crate::bid::tlv::{TlvEncoder, TlvDecoder}; -use crate::bid::types::BidTag; use crate::box_trait::{NyashBox, StringBox, BoolBox, BoxCore, BoxBase}; use std::any::Any; use std::fmt; diff --git a/src/bid/loader.rs b/src/bid/loader.rs index 05307827..0566730c 100644 --- a/src/bid/loader.rs +++ b/src/bid/loader.rs @@ -1,7 +1,6 @@ use crate::bid::{BidError, BidResult, NyashHostVtable, NyashPluginInfo, PluginHandle, PLUGIN_ABI_SYMBOL, PLUGIN_INIT_SYMBOL, PLUGIN_INVOKE_SYMBOL, PLUGIN_SHUTDOWN_SYMBOL}; #[cfg(all(feature = "plugins", not(target_arch = "wasm32")))] use libloading::{Library, Symbol}; -use std::ffi::c_void; use std::path::{Path, PathBuf}; /// Loaded plugin with FFI entry points and metadata diff --git a/src/bid/metadata.rs b/src/bid/metadata.rs index fbcd5ed8..af528fa4 100644 --- a/src/bid/metadata.rs +++ b/src/bid/metadata.rs @@ -145,7 +145,9 @@ pub struct PluginMetadata { pub state: PluginState, // Keep CStrings alive for C interop + #[allow(dead_code)] type_name_holder: Option, + #[allow(dead_code)] method_holders: Vec<(NyashMethodInfo, CString)>, } diff --git a/src/bid/plugin_api.rs b/src/bid/plugin_api.rs index d7402efc..8943fc2e 100644 --- a/src/bid/plugin_api.rs +++ b/src/bid/plugin_api.rs @@ -1,5 +1,4 @@ use super::{BidError, BidResult, NyashHostVtable, NyashPluginInfo}; -use std::os::raw::c_char; /// Plugin API function signatures for C FFI /// @@ -164,7 +163,7 @@ impl HostVtableBuilder { } } - pub fn with_alloc(mut self, f: F) -> Self + pub fn with_alloc(self, _f: F) -> Self where F: Fn(usize) -> *mut std::os::raw::c_void + 'static, { @@ -173,14 +172,14 @@ impl HostVtableBuilder { self } - pub fn with_free(mut self, f: F) -> Self + pub fn with_free(self, _f: F) -> Self where F: Fn(*mut std::os::raw::c_void) + 'static, { self } - pub fn with_log(mut self, f: F) -> Self + pub fn with_log(self, _f: F) -> Self where F: Fn(&str) + 'static, { diff --git a/src/bid/plugins/filebox/mod.rs b/src/bid/plugins/filebox/mod.rs index fe39b474..72068d48 100644 --- a/src/bid/plugins/filebox/mod.rs +++ b/src/bid/plugins/filebox/mod.rs @@ -4,13 +4,11 @@ //! Everything is Box philosophy applied to file operations! use crate::bid::{BidHandle, BoxTypeId}; -use crate::bid::{NyashPluginInfo, NyashMethodInfo, NyashHostVtable}; +use once_cell::sync::Lazy; use std::collections::HashMap; use std::fs::{File, OpenOptions}; -use std::io::{Read, Write, Seek, SeekFrom}; -use std::os::raw::{c_char, c_void}; +use std::io::{Read, Write}; use std::sync::{Arc, Mutex}; -use std::ffi::{CStr, CString}; /// FileBox handle management pub struct FileBoxRegistry { @@ -21,12 +19,14 @@ pub struct FileBoxRegistry { /// State of an open file struct FileBoxState { file: File, + #[allow(dead_code)] path: String, + #[allow(dead_code)] mode: FileMode, } #[derive(Debug, Clone, Copy)] -enum FileMode { +pub enum FileMode { Read, Write, Append, @@ -94,16 +94,12 @@ impl FileBoxRegistry { } /// Global registry instance -static mut FILEBOX_REGISTRY: Option>> = None; +static FILEBOX_REGISTRY: Lazy>> = + Lazy::new(|| Arc::new(Mutex::new(FileBoxRegistry::new()))); /// Get or create the global registry fn get_registry() -> Arc> { - unsafe { - if FILEBOX_REGISTRY.is_none() { - FILEBOX_REGISTRY = Some(Arc::new(Mutex::new(FileBoxRegistry::new()))); - } - FILEBOX_REGISTRY.as_ref().unwrap().clone() - } + FILEBOX_REGISTRY.clone() } /// FileBox plugin interface for Nyash diff --git a/src/bid/types.rs b/src/bid/types.rs index a1a9a42f..e8d8caee 100644 --- a/src/bid/types.rs +++ b/src/bid/types.rs @@ -1,5 +1,3 @@ -use super::Usize; - /// BID-1 Type System (ChatGPT Enhanced Edition) #[derive(Clone, Debug, PartialEq)] pub enum BidType { diff --git a/src/box_factory/plugin.rs b/src/box_factory/plugin.rs index d2e92156..bc9dfcd1 100644 --- a/src/box_factory/plugin.rs +++ b/src/box_factory/plugin.rs @@ -50,7 +50,7 @@ impl BoxFactory for PluginBoxFactory { fn is_available(&self) -> bool { // Check if any plugins are loaded - let registry = get_global_registry(); + let _registry = get_global_registry(); // TODO: Add method to check if registry has any providers true } diff --git a/src/instance_v2.rs b/src/instance_v2.rs index e907680a..436da869 100644 --- a/src/instance_v2.rs +++ b/src/instance_v2.rs @@ -144,7 +144,7 @@ impl InstanceBox { } /// 🎯 統一初期化処理 - pub fn init(&mut self, args: &[Box]) -> Result<(), String> { + pub fn init(&mut self, _args: &[Box]) -> Result<(), String> { match &self.inner_content { Some(_) => Ok(()), // ビルトイン・プラグインは初期化済み None => { @@ -286,7 +286,7 @@ impl InstanceBox { } // fields_ngから取得して変換を試みる - if let Some(nyash_value) = self.fields_ng.lock().unwrap().get(field_name) { + if let Some(_nyash_value) = self.fields_ng.lock().unwrap().get(field_name) { // NyashValue -> SharedNyashBox 変換(簡易実装) // TODO: 適切な変換実装 None diff --git a/src/interpreter/core.rs b/src/interpreter/core.rs index 7768b08b..f240060c 100644 --- a/src/interpreter/core.rs +++ b/src/interpreter/core.rs @@ -225,6 +225,7 @@ pub struct NyashInterpreter { pub(super) stdlib: Option, /// 共有ランタイム(Boxレジストリ等) + #[allow(dead_code)] pub(super) runtime: NyashRuntime, } diff --git a/src/interpreter/objects.rs b/src/interpreter/objects.rs index ffb42e46..415ae7d5 100644 --- a/src/interpreter/objects.rs +++ b/src/interpreter/objects.rs @@ -1127,7 +1127,7 @@ impl NyashInterpreter { // 🔥 Phase 8.8: pack透明化システム - ビルトインBox判定 use crate::box_trait::is_builtin_box; - let mut is_builtin = is_builtin_box(parent_name); + let is_builtin = is_builtin_box(parent_name); // GUI機能が有効な場合はEguiBoxも追加判定 #[cfg(all(feature = "gui", not(target_arch = "wasm32")))] diff --git a/src/mir/builder.rs b/src/mir/builder.rs index d5210b94..a1014246 100644 --- a/src/mir/builder.rs +++ b/src/mir/builder.rs @@ -92,7 +92,7 @@ impl MirBuilder { effects: EffectMask::READ.add(Effect::ReadHeap), // conservative }; let entry = self.block_gen.next(); - let mut function = MirFunction::new(signature, entry); + let function = MirFunction::new(signature, entry); // Save current builder state let saved_function = self.current_function.take(); diff --git a/src/mir/loop_builder.rs b/src/mir/loop_builder.rs index 21974690..4b15407a 100644 --- a/src/mir/loop_builder.rs +++ b/src/mir/loop_builder.rs @@ -6,11 +6,11 @@ */ use super::{ - MirInstruction, BasicBlock, BasicBlockId, MirFunction, ValueId, - ConstValue, CompareOp, BasicBlockIdGenerator, ValueIdGenerator, EffectMask + MirInstruction, BasicBlockId, ValueId, + ConstValue }; use crate::ast::ASTNode; -use std::collections::{HashMap, HashSet}; +use std::collections::HashMap; /// 不完全なPhi nodeの情報 #[derive(Debug, Clone)] @@ -32,6 +32,7 @@ pub struct LoopBuilder<'a> { incomplete_phis: HashMap>, /// ブロックごとの変数マップ(スコープ管理) + #[allow(dead_code)] block_var_maps: HashMap>, } @@ -59,11 +60,11 @@ impl<'a> LoopBuilder<'a> { // 2. Preheader -> Header へのジャンプ self.emit_jump(header_id)?; - self.add_predecessor(header_id, preheader_id); + let _ = self.add_predecessor(header_id, preheader_id); // 3. Headerブロックの準備(unsealed状態) self.set_current_block(header_id)?; - self.mark_block_unsealed(header_id); + let _ = self.mark_block_unsealed(header_id); // 4. ループ変数のPhi nodeを準備 // ここでは、ループ内で変更される可能性のある変数を事前に検出するか、 @@ -75,8 +76,8 @@ impl<'a> LoopBuilder<'a> { // 6. 条件分岐 self.emit_branch(condition_value, body_id, after_loop_id)?; - self.add_predecessor(body_id, header_id); - self.add_predecessor(after_loop_id, header_id); + let _ = self.add_predecessor(body_id, header_id); + let _ = self.add_predecessor(after_loop_id, header_id); // 7. ループボディの構築 self.set_current_block(body_id)?; @@ -90,7 +91,7 @@ impl<'a> LoopBuilder<'a> { // 8. Latchブロック(ボディの最後)からHeaderへ戻る let latch_id = self.current_block()?; self.emit_jump(header_id)?; - self.add_predecessor(header_id, latch_id); + let _ = self.add_predecessor(header_id, latch_id); // 9. Headerブロックをシール(全predecessors確定) self.seal_block(header_id, latch_id)?; @@ -243,7 +244,7 @@ impl<'a> LoopBuilder<'a> { } } - fn mark_block_unsealed(&mut self, block_id: BasicBlockId) -> Result<(), String> { + fn mark_block_unsealed(&mut self, _block_id: BasicBlockId) -> Result<(), String> { // ブロックはデフォルトでunsealedなので、特に何もしない // (既にBasicBlock::newでsealed: falseに初期化されている) Ok(()) @@ -270,7 +271,7 @@ impl<'a> LoopBuilder<'a> { self.parent_builder.variable_map.insert(name, value); } - fn get_variable_at_block(&self, name: &str, block_id: BasicBlockId) -> Option { + fn get_variable_at_block(&self, name: &str, _block_id: BasicBlockId) -> Option { // 簡易実装:現在の変数マップから取得 // TODO: 本来はブロックごとの変数マップを管理すべき self.parent_builder.variable_map.get(name).copied() diff --git a/src/runner.rs b/src/runner.rs index 32068cf0..ace7b7b8 100644 --- a/src/runner.rs +++ b/src/runner.rs @@ -19,8 +19,7 @@ use nyash_rust::runtime::NyashRuntime; use nyash_rust::interpreter::SharedState; use nyash_rust::box_factory::user_defined::UserDefinedBoxFactory; use nyash_rust::core::model::BoxDeclaration as CoreBoxDecl; -use std::sync::{Arc, RwLock}; -use std::collections::HashMap; +use std::sync::Arc; #[cfg(feature = "wasm-backend")] use nyash_rust::backend::{wasm::WasmBackend, aot::AotBackend}; @@ -289,7 +288,7 @@ impl NyashRunner { // Dump MIR if requested if self.config.dump_mir { - let mut printer = if self.config.mir_verbose { + let printer = if self.config.mir_verbose { MirPrinter::verbose() } else { MirPrinter::new() diff --git a/src/runtime/plugin_loader_v2.rs b/src/runtime/plugin_loader_v2.rs index fb14f284..404ee17a 100644 --- a/src/runtime/plugin_loader_v2.rs +++ b/src/runtime/plugin_loader_v2.rs @@ -7,7 +7,7 @@ #[cfg(all(feature = "plugins", not(target_arch = "wasm32")))] mod enabled { use crate::bid::{BidResult, BidError}; - use crate::box_trait::{NyashBox, BoxCore, BoxBase, StringBox, IntegerBox, BoolBox}; + use crate::box_trait::{NyashBox, BoxCore, StringBox, IntegerBox}; use crate::config::nyash_toml_v2::{NyashConfigV2, LibraryDefinition}; use std::collections::HashMap; use std::sync::{Arc, RwLock}; @@ -21,9 +21,11 @@ mod enabled { _lib: Arc, /// Box types provided by this plugin + #[allow(dead_code)] box_types: Vec, /// Optional init function + #[allow(dead_code)] init_fn: Option i32>, /// Required invoke function @@ -521,7 +523,7 @@ impl PluginBoxV2 { } /// Create a Box instance - pub fn create_box(&self, box_type: &str, args: &[Box]) -> BidResult> { + pub fn create_box(&self, box_type: &str, _args: &[Box]) -> BidResult> { eprintln!("🔍 create_box called for: {}", box_type); let config = self.config.as_ref()