Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
ext -> target

- name: Rust test
run: cargo test --manifest-path rust/Cargo.toml
run: cargo test --manifest-path core/Cargo.toml

- name: Build and test
run: |
Expand Down
12 changes: 6 additions & 6 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ A fast static type checker for Ruby. Verifies method call validity using graph-b

```bash
# Rust tests (most frequently used)
cd rust && cargo test --lib
cd core && cargo test --lib

# Rust build (native extension)
bundle exec rake compile
Expand All @@ -20,10 +20,10 @@ bundle exec rake test
bundle exec rake

# CLI binary build
cd rust && cargo build --release --bin methodray --features cli
cd core && cargo build --release --bin methodray --features cli

# Clippy (lint)
cd rust && cargo clippy --lib --all-features -- -W clippy::all
cd core && cargo clippy --lib --all-features -- -W clippy::all

# Ruby lint
bundle exec rubocop
Expand All @@ -33,7 +33,7 @@ bundle exec rubocop

```bash
# Rust: specific test
cd rust && cargo test --lib test_name
cd core && cargo test --lib test_name

# Ruby: specific file
bundle exec ruby -Ilib -Itest test/string_test.rb
Expand All @@ -42,7 +42,7 @@ bundle exec ruby -Ilib -Itest test/string_test.rb
## Project Structure

```
rust/src/ # Rust core (type inference engine)
core/src/ # Rust core (type inference engine)
analyzer/ # AST → Graph conversion (install.rs is the entry point)
env/ # Environment (GlobalEnv, LocalEnv, MethodRegistry, Scope)
graph/ # Type graph (Vertex, Box, ChangeSet)
Expand All @@ -69,7 +69,7 @@ test/ # Ruby integration tests (minitest)

### Rust

- Add new AST node handlers as separate files under `rust/src/analyzer/` (e.g., `loops.rs`, `exceptions.rs`)
- Add new AST node handlers as separate files under `core/src/analyzer/` (e.g., `loops.rs`, `exceptions.rs`)
- Follow the existing function signature pattern: `process_*_node(genv, lenv, changes, source, node) -> Option<VertexId>`
- When adding new nodes to `install.rs` dispatch, maintain the ordering: definitions → control flow → literals
- `#[allow(dead_code)]` is prohibited in principle — remove unused code instead
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[workspace]
resolver = "2"
members = ["rust", "ext"]
members = ["core", "ext"]
6 changes: 3 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ end
namespace :cli do
desc 'Build CLI binary for current platform'
task :build do
sh 'cd rust && cargo build --release --bin methodray --features cli'
sh 'cd core && cargo build --release --bin methodray --features cli'
end

desc 'Build CLI binary for all platforms (requires cross)'
Expand All @@ -37,11 +37,11 @@ namespace :cli do

platforms.each do |rust_target, ruby_platform|
puts "Building for #{rust_target}..."
sh "cd rust && cross build --release --bin methodray --features cli --target #{rust_target}"
sh "cd core && cross build --release --bin methodray --features cli --target #{rust_target}"

# Copy binary to platform-specific directory
binary_name = rust_target.include?('windows') ? 'methodray.exe' : 'methodray'
src = "rust/target/#{rust_target}/release/#{binary_name}"
src = "core/target/#{rust_target}/release/#{binary_name}"
dst_dir = "lib/methodray/#{ruby_platform}"

mkdir_p dst_dir
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion ext/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ default = []
cli = ["methodray-core/cli", "dep:clap", "dep:anyhow"]

[dependencies]
methodray-core = { path = "../rust", features = ["ruby-ffi"] }
methodray-core = { path = "../core", features = ["ruby-ffi"] }
magnus = "0.8"
clap = { version = "4", features = ["derive"], optional = true }
anyhow = { version = "1", optional = true }
4 changes: 2 additions & 2 deletions lib/methodray/binary_locator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ def candidates
File.expand_path(@binary_name, LIB_DIR),
# Development: target/release (project root)
File.expand_path("../../target/release/#{@binary_name}", LIB_DIR),
# Development: rust/target/release (legacy standalone binary)
File.expand_path("../../rust/target/release/#{@legacy_binary_name}", LIB_DIR)
# Development: core/target/release (legacy standalone binary)
File.expand_path("../../core/target/release/#{@legacy_binary_name}", LIB_DIR)
]
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/methodray/commands.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def exec_rust_cli(command, args)
warn 'Error: CLI binary not found.'
warn ''
warn 'For development, build with:'
warn ' cd rust && cargo build --release --bin methodray --features cli'
warn ' cd core && cargo build --release --bin methodray --features cli'
warn ''
warn 'If installed via gem, this might be a platform compatibility issue.'
warn 'Please report at: https://github.com/dak2/method-ray/issues'
Expand Down
6 changes: 3 additions & 3 deletions methodray.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ Gem::Specification.new do |spec|
'lib/methodray/*.{so,dylib,dll,bundle}', # Precompiled native extensions
'exe/*',
'ext/**/*',
'rust/**/*.rs',
'rust/Cargo.toml',
'rust/Cargo.lock',
'core/**/*.rs',
'core/Cargo.toml',
'core/Cargo.lock',
'README.md',
'LICENSE',
'CHANGELOG.md'
Expand Down
2 changes: 1 addition & 1 deletion test/method_loader_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

class MethodLoaderTest < Minitest::Test
def setup
require_relative '../rust/src/rbs/method_loader'
require_relative '../core/src/rbs/method_loader'
@loader = Rbs::MethodLoader.new
@results = @loader.load_methods
end
Expand Down