Dataset Viewer
Auto-converted to Parquet Duplicate
id
stringlengths
14
67
project
stringclasses
20 values
interface_path
stringlengths
9
29
target_path
stringlengths
9
29
interface_code
stringlengths
42
11.8k
c_sources
stringclasses
20 values
rust_tests
stringclasses
20 values
prompt
stringlengths
11.2k
324k
answer_prefix
stringlengths
18
38
Genetic_neural_network_for_simple_control/src/activation_fnc.rs
Genetic_neural_network_for_simple_control
src/activation_fnc.rs
src/activation_fnc.rs
"// activation_fnc.rs\n/// Hyperbolic tangent activation function (scaled).\npub fn tangenth(x: f32)(...TRUNCATED)
"C sources:\n\ninclude/toolbox/general/general_math.h\n```c\n#ifndef GENERAL_MATH_H\n#define GENERAL(...TRUNCATED)
"Rust tests:\n\ntest_activation_func.rs\n```rust\nuse Genetic_neural_network_for_simple_control::act(...TRUNCATED)
"\nYou are an expert at converting C To Rust.\nYou will be provided with C source files in the forma(...TRUNCATED)
src/activation_fnc.rs ```rust
Genetic_neural_network_for_simple_control/src/fit_functions.rs
Genetic_neural_network_for_simple_control
src/fit_functions.rs
src/fit_functions.rs
"use crate::model_system;\nuse crate::neural_network;\nuse crate::pid_controller;\nuse crate::popula(...TRUNCATED)
"C sources:\n\ninclude/toolbox/general/general_math.h\n```c\n#ifndef GENERAL_MATH_H\n#define GENERAL(...TRUNCATED)
"Rust tests:\n\ntest_activation_func.rs\n```rust\nuse Genetic_neural_network_for_simple_control::act(...TRUNCATED)
"\nYou are an expert at converting C To Rust.\nYou will be provided with C source files in the forma(...TRUNCATED)
src/fit_functions.rs ```rust
Genetic_neural_network_for_simple_control/src/general_math.rs
Genetic_neural_network_for_simple_control
src/general_math.rs
src/general_math.rs
use rand::Rng; pub fn createRandomFloat(min: f32, max: f32) -> f32 { unimplemented!() }
"C sources:\n\ninclude/toolbox/general/general_math.h\n```c\n#ifndef GENERAL_MATH_H\n#define GENERAL(...TRUNCATED)
"Rust tests:\n\ntest_activation_func.rs\n```rust\nuse Genetic_neural_network_for_simple_control::act(...TRUNCATED)
"\nYou are an expert at converting C To Rust.\nYou will be provided with C source files in the forma(...TRUNCATED)
src/general_math.rs ```rust
Genetic_neural_network_for_simple_control/src/genetic_operations.rs
Genetic_neural_network_for_simple_control
src/genetic_operations.rs
src/genetic_operations.rs
"// genetic_operations.rs\n\nuse crate::general_math::createRandomFloat;\n\nuse crate::population::{(...TRUNCATED)
"C sources:\n\ninclude/toolbox/general/general_math.h\n```c\n#ifndef GENERAL_MATH_H\n#define GENERAL(...TRUNCATED)
"Rust tests:\n\ntest_activation_func.rs\n```rust\nuse Genetic_neural_network_for_simple_control::act(...TRUNCATED)
"\nYou are an expert at converting C To Rust.\nYou will be provided with C source files in the forma(...TRUNCATED)
src/genetic_operations.rs ```rust
Genetic_neural_network_for_simple_control/src/input_toolbox.rs
Genetic_neural_network_for_simple_control
src/input_toolbox.rs
src/input_toolbox.rs
"// input_toolbox.rs\n\nuse crate::model_system::SystemNN;\n\n/// Input preparation for NN type one.(...TRUNCATED)
"C sources:\n\ninclude/toolbox/general/general_math.h\n```c\n#ifndef GENERAL_MATH_H\n#define GENERAL(...TRUNCATED)
"Rust tests:\n\ntest_activation_func.rs\n```rust\nuse Genetic_neural_network_for_simple_control::act(...TRUNCATED)
"\nYou are an expert at converting C To Rust.\nYou will be provided with C source files in the forma(...TRUNCATED)
src/input_toolbox.rs ```rust
Genetic_neural_network_for_simple_control/src/matrix_math.rs
Genetic_neural_network_for_simple_control
src/matrix_math.rs
src/matrix_math.rs
"use crate::population;\n#[derive(Debug, Clone, Default)]\npub struct Matrix {\n pub matrix: Vec<(...TRUNCATED)
"C sources:\n\ninclude/toolbox/general/general_math.h\n```c\n#ifndef GENERAL_MATH_H\n#define GENERAL(...TRUNCATED)
"Rust tests:\n\ntest_activation_func.rs\n```rust\nuse Genetic_neural_network_for_simple_control::act(...TRUNCATED)
"\nYou are an expert at converting C To Rust.\nYou will be provided with C source files in the forma(...TRUNCATED)
src/matrix_math.rs ```rust
Genetic_neural_network_for_simple_control/src/model_system.rs
Genetic_neural_network_for_simple_control
src/model_system.rs
src/model_system.rs
"// model_system.rs\n\nuse crate::neural_network::{NN, NNInput};\n\nuse crate::signal_designer::Sign(...TRUNCATED)
"C sources:\n\ninclude/toolbox/general/general_math.h\n```c\n#ifndef GENERAL_MATH_H\n#define GENERAL(...TRUNCATED)
"Rust tests:\n\ntest_activation_func.rs\n```rust\nuse Genetic_neural_network_for_simple_control::act(...TRUNCATED)
"\nYou are an expert at converting C To Rust.\nYou will be provided with C source files in the forma(...TRUNCATED)
src/model_system.rs ```rust
Genetic_neural_network_for_simple_control/src/neural_network.rs
Genetic_neural_network_for_simple_control
src/neural_network.rs
src/neural_network.rs
"// neural_network.rs\n\nuse crate::matrix_math::Matrix;\n\nuse crate::population::Pop;\n\n#[derive((...TRUNCATED)
"C sources:\n\ninclude/toolbox/general/general_math.h\n```c\n#ifndef GENERAL_MATH_H\n#define GENERAL(...TRUNCATED)
"Rust tests:\n\ntest_activation_func.rs\n```rust\nuse Genetic_neural_network_for_simple_control::act(...TRUNCATED)
"\nYou are an expert at converting C To Rust.\nYou will be provided with C source files in the forma(...TRUNCATED)
src/neural_network.rs ```rust
Genetic_neural_network_for_simple_control/src/pid_controller.rs
Genetic_neural_network_for_simple_control
src/pid_controller.rs
src/pid_controller.rs
"// pid_controller.rs\n\nuse crate::signal_designer::Signal;\n\nuse std::fs::File;\n\n#[derive(Defau(...TRUNCATED)
"C sources:\n\ninclude/toolbox/general/general_math.h\n```c\n#ifndef GENERAL_MATH_H\n#define GENERAL(...TRUNCATED)
"Rust tests:\n\ntest_activation_func.rs\n```rust\nuse Genetic_neural_network_for_simple_control::act(...TRUNCATED)
"\nYou are an expert at converting C To Rust.\nYou will be provided with C source files in the forma(...TRUNCATED)
src/pid_controller.rs ```rust
Genetic_neural_network_for_simple_control/src/population.rs
Genetic_neural_network_for_simple_control
src/population.rs
src/population.rs
"// population.rs\n\nuse crate::general_math::createRandomFloat;\n\n#[derive(Default)]\n/// Structur(...TRUNCATED)
"C sources:\n\ninclude/toolbox/general/general_math.h\n```c\n#ifndef GENERAL_MATH_H\n#define GENERAL(...TRUNCATED)
"Rust tests:\n\ntest_activation_func.rs\n```rust\nuse Genetic_neural_network_for_simple_control::act(...TRUNCATED)
"\nYou are an expert at converting C To Rust.\nYou will be provided with C source files in the forma(...TRUNCATED)
src/population.rs ```rust
End of preview. Expand in Data Studio

CRUST-bench

CRUST-bench evaluates C-to-safe-Rust repository-level transpilation.

This dataset was used for evaluation in the paper Generative Compilation: On-the-Fly Compiler Feedback as AI Generates Code. You can find the corresponding evaluation code in the project GitHub repository.

Example Usage

from datasets import load_dataset
import json

dataset = load_dataset("eth-sri/CRUST-bench")
for instance in dataset["test"]:
    print(json.dumps(instance, indent=2))
    break

Example Instance

{
  "id": "Genetic_neural_network_for_simple_control/src/activation_fnc.rs",
  "project": "Genetic_neural_network_for_simple_control",
  "interface_path": "src/activation_fnc.rs",
  "target_path": "src/activation_fnc.rs",
  "interface_code": "pub fn ... {\n    unimplemented!();\n}",
  "c_sources": "C sources:\n...",
  "rust_tests": "Rust tests:\n...",
  "prompt": "...",
  "answer_prefix": "src/activation_fnc.rs\n```rust\n"
}

Each row also includes the complete rendered prompt, the answer_prefix used to start model generation, and the structured source fields needed to inspect the task.

License

The benchmark combines source code from multiple upstream projects. The license of each upstream project continues to apply to its code; consult the source files and the project repository for the corresponding license notices.

Downloads last month
22

Collection including eth-sri/CRUST-bench

Paper for eth-sri/CRUST-bench