messages
listlengths
2
2
language
stringclasses
8 values
prompt_type
stringclasses
2 values
lint_errors
int64
0
129
⌀
cyclomatic_complexity
int64
0
32
⌀
license
stringclasses
7 values
commit
stringlengths
40
40
repos
stringlengths
5
116k
new_file
stringlengths
4
220
status
stringclasses
6 values
error
stringlengths
26
74
⌀
is_valid_syntax
bool
2 classes
[ { "role": "user", "content": "Here is the current file:\n```rust\nextern mod rsfml;\n\nuse rsfml::window::{ContextSettings, VideoMode};\nuse rsfml::graphics::{RenderWindow, sfClose};\n\nmod cpu;\n\n#[cfg(target_os=\"macos\")]\n#[start]\nfn start(argc: int, argv: **u8) -> int {\n std::rt::start_on_main_th...
rust
edit
null
null
mit
9d005a808174c8c24ec89c3b1cd92377d5875765
dguenther/rustchip
main.rs
rejected_syntax
Syntax error detected by tree-sitter
false
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse commit::Commit;\n\npub trait Serializable {\n fn encode(&self) -> Vec<u8>;\n fn encode_body(&self) -> Vec<u8>;\n}\n\npub fn encode_author_info(commit: &Commit) -> Vec<u8> {\n (format!(\"author {} <{}> {}\\n\",\n commi...
rust
edit
0
1
mit
d1cd17161e16a8fbc289db27b9feb331d301ab24
kaisellgren/rust_git
src/serialization.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n\nextern crate mprovision;\nextern crate clap;\n\nuse std::fs;\nuse clap::{Arg, App, SubCommand};\n\nfn main() {\n let count_subcommand = SubCommand::with_name(\"count\")\n .about(\"Counts provisioning profiles in a directory.\")\n ...
rust
edit
0
3
mit
b35a21108c73212b8c1b5a43e42695327c0b3d38
zummenix/mprovision
src/main.rs
rejected_duplicate
Near-duplicate of sample 119762
true
[ { "role": "user", "content": "Here is the current file:\n```rust\npub use std::mem;\npub use std::slice;\n\npub enum IndexDatumType {\n UnsignedByte,\n UnsignedShort\n}\n\npub trait IndexData {\n fn index_datum_type() -> IndexDatumType;\n fn index_bytes(&self) -> &[u8];\n fn index_elements(&s...
rust
edit
0
2
apache-2.0
11d3c647b045db9f9c6628374695a07d54951a51
kylewlacy/glitter,kylewlacy/glitter
src/index_data.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n// Copyright 2014 Birunthan Mohanathas\n//\n// Licensed under the MIT license <http://opensource.org/licenses/MIT>. This\n// file may not be copied, modified, or distributed except according to those\n// terms.\n\nmod measure;\nmod skin;\nmod...
rust
edit
1
1
mit
2fa5a7706b8c3f303e896a8a48937647cddaf5f1
poiru/rainmeter-rust
src/main.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\npub const MAX_FIXED_ORDER: usize = 4;\n\npub struct SubFrame {\n pub data: Data,\n pub wasted_bits: u32,\n}\n\npub enum Data {\n Constant(i32),\n Verbatim(Vec<i32>),\n Fixed(Fixed),\n}\n\npub struct Fixed {\n pub entropy_coding_method: ...
rust
edit
3
1
bsd-3-clause
3223bba9bc100a5c48fa8fee3f7d5954553007ca
sourrust/flac
src/frame/subframe/types.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse std::io::{Write, BufWriter};\nuse std::fs::File;\nmod vector;\nuse vector::Vec3;\n\nfn main() {\n let nx = 300;\n let ny = 200;\n let data = format!(\"{}\\n{} {}\\n{}\\n\", \"P3\", nx, ny, 255);\n let f = File::create(\"target/image.p...
rust
edit
0
3
mit
e0e8885d9aaff4c04f5826d0f9e99ccffe0d84b1
corragon/rust-raytracer
src/main.rs
rejected_duplicate
Near-duplicate of sample 121322
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse std::fmt::{self, Display};\n\n/// Path to the current value in the input, like `dependencies.serde.typo1`.\n#[derive(Copy, Clone)]\npub enum Path<'a> {\n Root,\n Seq { parent: &'a Path<'a>, index: usize },\n Map { parent: &'a Pat...
rust
edit
0
3
apache-2.0
1666883e2ec43251bb71eecc2c127b899c661e0a
dtolnay/serde-yaml
src/path.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse crate::*;\nuse ssz::{Decode, Encode};\n\nmod beacon_state;\n\nimpl<T: EthSpec> StoreItem for BeaconBlock<T> {\n fn db_column() -> DBColumn {\n DBColumn::BeaconBlock\n }\n\n fn as_store_bytes(&self) -> Vec<u8> {\n le...
rust
edit
1
1
apache-2.0
a3e464078af39e10132bac3d1ac37dbebae8b41a
sigp/lighthouse,sigp/lighthouse,sigp/lighthouse,sigp/lighthouse
beacon_node/store/src/impls.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse std::time::{Duration, Instant};\nuse std::thread::sleep;\n\npub struct GameLoop {\n frame_number: u64,\n fps: u32\n} \n\nimpl GameLoop {\n pub fn new(fps: u32) -> GameLoop {\n GameLoop {\n frame_number: 0,\n ...
rust
edit
1
4
mit
1a9c1ca3e6818939d77118eaab6abe7dc1a436b9
AngryLawyer/rust-sdl2-engine-helpers
src/game_loop.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n#![feature(core, io, path)]\n\nextern crate tcod;\n\npub mod engine;\npub mod gui;\npub mod util;\n\n```\n\nApply this change: Change feature gates io -> old_io and path -> old_path" }, { "role": "assistant", "content": "#![featur...
rust
edit
2
0
bsd-3-clause
a603727038feb84d81b9e9cdd1076ffc5ed186cf
jgilchrist/rslike
src/lib.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n/// Value that either holds a single A or B, or both.\n#[derive(Clone, PartialEq, Eq, Debug)]\npub enum EitherOrBoth<A, B> {\n /// Both values are present.\n Both(A, B),\n /// Only the left value of type `A` is present.\n Left(A),...
rust
edit
0
2
apache-2.0
e67b8342eae599669f5ce08b9a2f80dd253d6b43
rust-itertools/itertools
src/either_or_both.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse std::io;\nuse winapi::ctypes::c_int;\nuse winapi::um::winnls as sys_winnls;\nuse winrust::{from_wide_string, to_wide_string};\n\nconst MAX_LOCALE_NAME_LEN: usize = 85usize;\n\n// TODO: remove panics\npub fn resolve_locale_name(tag: &str) ...
rust
edit
0
3
isc
102d00b98866250f6917c558caaebe0cc9c51b9b
bbqsrc/kbdi
src/platform/winnls.rs
rejected_duplicate
Near-duplicate of sample 121321
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n#[link(name = \"wgfem\",\n vers = \"0.1\",\n url = \"https://github.com/scharris/WGFEM-Rust\")];\n\n#[license = \"MIT\"];\n#[crate_type = \"lib\"];\n\nextern mod extra;\n\npub mod common;\npub mod monomial;\npub mod polynomial;\npub mod vec...
rust
edit
null
null
mit
4f0a3ff79a54522da1491b44ea61a883baddb64e
scharris/WGFEM-Rust,scharris/WGFEM-Rust,scharris/WGFEM-Rust
wgfem.rs
rejected_syntax
Syntax error detected by tree-sitter
false
[ { "role": "user", "content": "Here is the current file:\n```rust\nextern crate rosc;\n\nfn main() {\n println!(\"hello\");\n}\n\n```\n\nApply this change: Implement socket creation address parsing" }, { "role": "assistant", "content": "extern crate rosc;\n\nuse std::{net, env, process};\n\nfn...
rust
edit
0
2
apache-2.0
dde12554a37742e32524f99853e8d7bd24236f4b
klingtnet/rosc
examples/receive.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse std::marker::PhantomData;\n\nuse super::{BaseIndex, BaseIndexIter, Result, Snapshot, Fork, StorageKey, StorageValue};\n\npub struct Entry<T, V> {\n base: BaseIndex<T>,\n _v: PhantomData<V>,\n}\n\nimpl<T, V> Entry<T, V> {\n pub fn...
rust
edit
0
2
apache-2.0
cd1773da9f8cb6cb76631ad1c1f5598de84d58e9
alekseysidorov/exonum,exonum/exonum,exonum/exonum,alekseysidorov/exonum,alekseysidorov/exonum,exonum/exonum,alekseysidorov/exonum,exonum/exonum
exonum/src/storage2/entry.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n#![feature(convert)]\n\nextern crate pkg_config;\n\nuse std::process::Command;\nuse std::fs;\nuse std::env;\nuse std::path::PathBuf;\n\nfn main() {\n let wcd = env::current_dir().unwrap();\n let build = PathBuf::from(&wcd.join(\"ext/lib...
rust
edit
0
1
apache-2.0
a1c1e22356d4977a70cb5ce93b1f3b43eefed2e3
cyndis/qmlrs,flanfly/qmlrs,flanfly/qmlrs,Jxspy/qmlrs,cyndis/qmlrs,florianjacob/qmlrs,Jxspy/qmlrs,florianjacob/qmlrs
build.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nextern crate bindgen;\nextern crate gcc;\n\nuse bindgen::RustTarget;\nuse gcc::Build;\nuse std::env;\nuse std::path::PathBuf;\n\nfn main() {\n\tlet mut c = Build::new();\n\n\tc.flag(\"-std=c99\");\n\tc.file(\"src/c/YGEnums.c\");\n\tc.file(\"s...
rust
edit
0
1
mit
49396715e1c6f3ac8b03ddfad147003d353d2803
bschwind/yoga-rs,bschwind/yoga-rs,bschwind/yoga-rs,bschwind/yoga-rs
build.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse libc::c_double;\nuse std::ptr::{null, null_mut};\nuse raster::{Dataset};\nuse gdal_sys::{self, CPLErr, GDALRIOResampleAlg};\nuse utils::_last_cpl_err;\n\nuse errors::*;\n\npub fn reproject(src: &Dataset, dst: &Dataset) -> Result<()> {\n ...
rust
edit
0
2
mit
0363f0c874c49564931d6ff07ba9ec27059bffcd
georust/rust-gdal,georust/rust-gdal
src/raster/warp.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse std::num;\nuse std::collections::PriorityQueue;\n\nfn is_palindrome(num: uint) -> bool {\n let s = num.to_string();\n let b = s.as_bytes();\n for i in range(0, b.len() / 2) {\n if b[i] != b[b.len() - i - 1] {\n ...
rust
edit
null
null
mit
c35327681914bed7e80a9a566caedc75b22ba6f3
niax/euler-rust
src/prob4.rs
rejected_syntax
Syntax error detected by tree-sitter
false
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse crate::colour::Colour;\nuse crate::graph::{Graph, Position};\nuse crate::grid::Grid;\n\npub enum GameState {\n Solving,\n Solved,\n}\n\npub struct Game {\n pub state: GameState,\n pub graph: Graph,\n number_of_clicks: u32,\...
rust
edit
0
1
mit
18342f08278b03221c282a107861717ff9dd31c9
yzhs/flood-it
src/game.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nfn main() {\n let git_hash = option_env!(\"TRAVIS_COMMIT\")\n .map(ToOwned::to_owned)\n .unwrap_or_else(|| {\n let stdout = std::process::Command::new(\"git\")\n .arg(\"rev-parse\")\n ...
rust
edit
0
2
mit
ead877ae937cafb7338b9c32a6d89f3da0f1c1ce
autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/L...
build.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n\nextern crate git2;\n\nuse std::env;\nuse std::process::Command;\nuse git2::Repository;\n\nconst REPO_URL: &str = \"https://github.com/iris-edu/libmseed\";\nconst BUILD_DIR: &str = \"src/libmseed\";\nconst GIT_REF: &str = \"refs/heads/2.x\";...
rust
edit
0
3
mit
ad25ef85b3d6730da76d8cdba4b50a42e2a6d8d9
savage13/miniseed-rs
build.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n\nfn is_prime(num :u64) -> bool {\n for i in range(2, num) {\n if num % i == 0 {\n return false\n }\n }\n true\n}\n\nfn fatorize_prime(num :u64) {\n for i in range(2, num) {\n if num % i == 0 && is_...
rust
edit
0
4
mit
02080b8baefa76a8ec18b5119cd10691eed22599
leonkunert/Projects-Rust
numbers/prime_factorization.rs
accepted
null
true
[ { "role": "user", "content": "Write rust code for the following: Implement the 'Dining Philosophers' in one go." }, { "role": "assistant", "content": "use std::thread;\nuse std::sync::{Mutex, Arc};\n\nstruct Philosopher {\n name: String,\n left: usize,\n right: usize,\n}\n\nimpl Philoso...
rust
new_file
4
3
mit
7dbec297a18e6c5cffeac212f7fc93718eb26047
wahn/Rust_Examples
dining_philosophers/src/main.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse ascii::AsciiChar;\n\npub struct PascalStr {\n chars: [AsciiChar]\n}\n\n```\n\nApply this change: Replace `PascalStr` internals with an `AsciiStr` for convenience. Also, various improvements." }, { "role": "assistant", "cont...
rust
edit
0
1
mit
f231fd5c6c48bad44111ed41ca689166f31e8e23
burtonageo/pascal_string
src/pascal_str.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse gf256::Gf256;\nuse std::io;\nuse std::io::prelude::*;\n\n/// evaluates a polynomial at x=1, 2, 3, ... n (inclusive)\npub(crate) fn encode_secret_byte<W: Write>(src: &[u8], n: u8, w: &mut W) -> io::Result<()> {\n for raw_x in 1..(u16::f...
rust
edit
0
3
bsd-3-clause
73e45bf032d701225e84b22645786d02e3154d99
SpinResearch/RustySecrets
src/sss/encode.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nextern crate libterminal_cribbage;\n\n\nuse libterminal_cribbage::cards::Deck;\n\n\nfn main() {\n let d = Deck::new();\n\n println!(\"D: {}\", d);\n}\n\n```\n\nApply this change: Test benchmark for Deck::new(). Will remove." }, { ...
rust
edit
0
2
mit
55fe667df5eeaa5dd28ea6bd16d64541bb8d2877
DirtGrubDylan/terminal_cribbage
src/main.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n// Copyright 2015 Sean Patrick Santos\n//\n// Licensed under the Apache License, Version 2.0.\n// License available at:\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Copyright and license information should be present in the top\n// ...
rust
edit
0
1
apache-2.0
291a9ee42031f6e6cf0ee1a30d0cd225d6a49260
quantheory/probe-c-api,quantheory/probe-c-api
tests/try-compile.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n#![feature(custom_attribute)]\n#![allow(dead_code, unused_attributes)]\n\n#[miri_run]\nfn make_vec() -> Vec<i32> {\n let v = Vec::with_capacity(4);\n v.push(1);\n v.push(2);\n v\n}\n\n// #[miri_run]\n// fn make_vec_macro() -> Vec<...
rust
edit
0
1
apache-2.0
27e82b60b08e96076d36825c082bf6a3c2842bce
graydon/rust,aidancully/rust,graydon/rust,GBGamer/rust,aidancully/rust,graydon/rust,tsion/miri,GBGamer/rust,aidancully/rust,GBGamer/rust,GBGamer/rust,GBGamer/rust,aidancully/rust,graydon/rust,rust-lang/miri,rust-lang/miri,rust-lang/miri,graydon/rust,aidancully/rust,GBGamer/rust,graydon/rust,rust-lang/miri,GBGamer/rust,...
test/vecs.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse crate::syntax::report::Errors;\nuse crate::syntax::Api;\nuse serde::Deserialize;\n\ntype Node = clang_ast::Node<Clang>;\n\n#[derive(Deserialize)]\nenum Clang {\n Unknown,\n}\n\npub fn load(cx: &mut Errors, apis: &mut [Api]) {\n let ...
rust
edit
0
5
apache-2.0
0ffb76f5d6996c2fe1323e1a14c1b1b5c21fe7d1
dtolnay/cxx,dtolnay/cxx,dtolnay/cxx,dtolnay/cxx
macro/src/clang.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nextern crate nalgebra;\n\nmod cube;\nmod resource;\n\nuse cube::*;\n\nfn main() {\n let point = Point::new(1024, 197, 293);\n let mut tree = Tree::new(10);\n {\n let mut cube = tree.cursor_mut();\n let mut cube = cube.s...
rust
edit
2
2
mit
9ba3b5056fd59a847fd103cfd61c68dffa368291
olson-sean-k/bismuth
src/main.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n/*\n** A simple program that allows basic arithmetic operations using roman numerals and conversions to decimal numbers.\n*/\n\nfn main() {\n\n\tlet roman_number = \"CLIII\";\n\tlet decimal_number = to_decimal(&roman_number);\n\n\tprintln!(\"...
rust
edit
3
4
mit
05318f2ba1db86d06ec26f652cbcd696be4a9983
tzkhan/roman-rust
src/main.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n// Copyright 2014 The Rust Project Developers. See the COPYRIGHT\n// file at the top-level directory of this distribution and at\n// http://rust-lang.org/COPYRIGHT.\n//\n// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or\n//...
rust
edit
0
1
apache-2.0
3cbc3f4802b9dd8125f2605cf4dab7a18839c4e8
avdi/rust,kimroen/rust,aepsil0n/rust,ebfull/rust,gifnksm/rust,rprichard/rust,defuz/rust,0x73/rust,andars/rust,zaeleus/rust,mvdnes/rust,zaeleus/rust,zubron/rust,ktossell/rust,rprichard/rust,reem/rust,XMPPwocky/rust,hauleth/rust,aidancully/rust,emk/rust,AerialX/rust,AerialX/rust-rt-minimal,TheNeikos/rust,victorvde/rust,s...
src/test/compile-fail/type-parameter-names.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nextern crate gcc;\n\nfn main()\n{\n gcc::Config::new().cpp(true)\n .file(\"wrapper/wrapper.cpp\")\n .file(\"pugixml/src/pugixml.cpp\")\n .include(\"pugixml/src\")\n .compile(\"libpugixml.a\")\n}\n\n```\n\nApply ...
rust
edit
0
1
mit
f22aee65177ac5955ce2b9fc0fdfc28e704ba8f5
sezaru/rust-pugixml,sezaru/rust-pugixml
build.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n// Copyright (c) 2022 The Bitcoin developers\n// Distributed under the MIT software license, see the accompanying\n// file COPYING or http://www.opensource.org/licenses/mit-license.php.\n\n#![deny(unsafe_code)]\n#![warn(\n const_err,\n ...
rust
edit
3
0
mit
8374ab043f5cdb78e5610b8233831d87eb3ccdd5
Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc
chronik/bitcoinsuite-core/src/lib.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse gl::types::*;\n\npub struct Framebuffer {\n gl_id: GLuint\n}\n\nimpl Framebuffer {\n pub fn gl_id(&self) -> GLuint {\n self.gl_id\n }\n}\n\n```\n\nApply this change: Add `Drop` impl for `Framebuffer`" }, { "role": ...
rust
edit
1
1
apache-2.0
fbfd1876a3144b6a844dfbad61aa6a482b99660a
kylewlacy/glitter,kylewlacy/glitter
src/framebuffer.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n/// A simple static assertion macro.\n#[macro_export]\n#[cfg_attr(stage0, allow_internal_unstable(type_ascription, underscore_const_names))]\n#[cfg_attr(not(stage0), allow_internal_unstable(type_ascription))]\nmacro_rules! static_assert {\n ...
rust
edit
0
0
apache-2.0
e62c9d7917052db098c6f27314f4daa5b9513387
aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust
src/librustc_data_structures/macros.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nextern crate fsevent;\nuse std::sync::mpsc::channel;\nuse std::thread;\n\n#[allow(dead_code)]\nfn main() {\n let (sender, receiver) = channel();\n\n let _t = thread::spawn(move || {\n let fsevent = fsevent::FsEvent::new(sender);\n fse...
rust
edit
0
2
mit
67673d41fcec01b8a10ac5b73b3ffb7cd553da55
octplane/fsevent-rust,jakerr/fsevent-rust
examples/fsevent-demo.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n//Following semver here\n#[derive(Clone, RustcDecodable, RustcEncodable)]\npub struct Version {\n pub major: u16,\n pub minor: u16,\n pub patch: u32\n}\n\n#[derive(Clone, RustcDecodable, RustcEncodable)]\npub struct Package {\n pu...
rust
edit
0
4
bsd-3-clause
6de8c7ad42533ca5edc39b4bb702ea6c9c06edfd
hch12907/wiz
src/package/package.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\npub fn find<T: PartialEq>(array: &[T], item: T) -> Option<usize> {\n find_by_ref(array, &item)\n}\n\nfn find_by_ref<T: PartialEq>(array: &[T], item: &T) -> Option<usize> {\n if array.is_empty() {\n return None;\n }\n\n let ...
rust
edit
0
4
mit
8c10af24b839e8a7ec2d7920f710c985199b17ee
attilahorvath/exercism-rust
binary-search/src/lib.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse std;\nimport std::list;\nimport std::list::car;\nimport std::list::cdr;\nimport std::list::from_vec;\n\nfn test_from_vec() {\n auto l = from_vec([0, 1, 2]);\n assert (car(l) == 0);\n assert (car(cdr(l)) == 1);\n assert (car(cdr(cdr(l)...
rust
edit
null
null
apache-2.0
bac68e4af3592dfcd6867fb8a73d2999daff744f
bombless/rust-docs-chinese,aepsil0n/rust,carols10cents/rust,mahkoh/rust,zachwick/rust,seanrivera/rust,philyoon/rust,ejjeong/rust,mihneadb/rust,zaeleus/rust,emk/rust,fabricedesre/rust,AerialX/rust,mahkoh/rust,servo/rust,kwantam/rust,emk/rust,TheNeikos/rust,krzysz00/rust,miniupnp/rust,krzysz00/rust,krzysz00/rust,vhbit/ru...
src/test/run-pass/lib-list.rs
rejected_syntax
Syntax error detected by tree-sitter
false
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse libc;\nuse std;\nuse sys;\nuse sys::{VALUE};\nuse std::ffi::CString;\n\nuse super::{UncheckedValue, CheckResult, CheckedValue, ToRust, ToRuby};\n\n// VALUE -> to_coercible_rust<String> -> CheckResult<String> -> unwrap() -> Coercible<Strin...
rust
edit
3
2
isc
92ac26adb206eb18fc875c249e4e6e1af27c5979
tildeio/helix,tildeio/turboruby,tildeio/helix,tildeio/helix,tildeio/turboruby,tildeio/helix,tildeio/turboruby,tildeio/turboruby
src/coercions/string.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse segmentation::{SegmentSelector, DescriptorBuilder, GateDescriptorBuilder, DescriptorType, SystemDescriptorTypes32};\n\nimpl GateDescriptorBuilder<u16> for DescriptorBuilder {\n\n fn tss_descriptor(selector: SegmentSelector, offset: u16...
rust
edit
0
2
mit
19843c0bcfb7a5d80720ba82524d40b3d69ace4e
gz/rust-x86,gz/rust-x86
src/bits16/segmentation.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse gc_error::GcError;\nuse types::binding::Binding;\nuse types::js_var::{JsPtrEnum, JsVar};\n\npub trait Backend {\n fn alloc(&mut self, var: JsVar, ptr: Option<JsPtrEnum>) -> Result<Binding, GcError>;\n fn load(&self, bnd: &Binding) -...
rust
edit
0
0
mit
b5feafd4728f335c3806ef59cd5b224dd4852a45
rustoscript/js.rs-common
src/backend.rs
rejected_duplicate
Near-duplicate of sample 120816
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n//! Provides an interface for dealing with FLAC metadata blocks.\n\nmod types;\nmod parser;\nmod metadata;\n\npub use self::types::{\n Metadata, Data,\n StreamInfo, Application, VorbisComment, CueSheet, Picture,\n SeekPoint, CueSheetTrack,...
rust
edit
1
0
bsd-3-clause
ba04cb9e16c61e7acb9ac665430add61bff5e28f
sourrust/flac
src/metadata/mod.rs
rejected_duplicate
Near-duplicate of sample 121199
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or\n// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license\n// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your\n// option. This file may not be copied, ...
rust
edit
2
1
apache-2.0
cb9eed5214275a55df3338c4c527aeefb380dd85
endoli/lldb.rs
src/launchinfo.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\npub trait Summarizable {\n fn author_summary(&self) -> String;\n\n fn summary(&self) -> String {\n String::from(\"Read more from {}...\", self.author_summary())\n }\n}\n\npub struct NewsArticle {\n pub headline: String,\n ...
rust
edit
0
1
mit
ceccebe794707fff2e68be9ab0bbeefd5906f818
pgrzesik/learning-rust
traits/src/lib.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n// -*- rust -*-\n\n// Regression test for circular_buffer initialization\n\nuse std;\n\nimport std.option;\nimport std._uint;\nimport std._vec;\n\n// 12-byte unit for the channel buffer. Assuming that the default\n// buffer size needs to hold...
rust
edit
null
null
apache-2.0
32c1c9f55c7a5575aa462bcec9e00cd11273841a
omasanori/rust,vhbit/rust,michaelballantyne/rust-gpu,KokaKiwi/rust,huonw/rand,mitsuhiko/rust,mahkoh/rust,reem/rust,l0kod/rust,ebfull/rust,XMPPwocky/rust,jbclements/rust,pczarn/rust,cllns/rust,aneeshusa/rust,quornian/rust,jashank/rust,ktossell/rust,rprichard/rust,richo/rust,nwin/rust,robertg/rust,kimroen/rust,dwillmer/r...
src/test/run-pass/chan-poweroftwo.rs
rejected_syntax
Syntax error detected by tree-sitter
false
[ { "role": "user", "content": "Here is the current file:\n```rust\nmod obj;\npub use obj::LoadingError;\npub use obj::ObjData;\n\n#[cfg(test)]\nmod test;\n\n```\n\nApply this change: Change visibility of Group and Object" }, { "role": "assistant", "content": "mod obj;\npub use obj::LoadingError;\...
rust
edit
0
0
mit
9c58b6f19a51a49926e420bb134367aa743aec9f
Daepso/lwobj
src/lib.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse std::process::Command;\nuse std::fs;\n\n#[derive(Debug)]\npub enum OSType {\n Unknown,\n Redhat,\n OSX\n}\n\nfn file_exists(path: &String) -> bool {\n let metadata = fs::metadata(path);\n\n match metadata {\n Ok(md) ...
rust
edit
0
4
mit
bbeef63317023730f18bba541f5ca2d255e8e499
schultyy/os_type
src/lib.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\npub enum Command {\n Output,\n Input,\n Increment,\n Decrement,\n RightShift,\n LeftShift\n}\n\n```\n\nApply this change: Add derive(Debug) to Command struct" }, { "role": "assistant", "content": "#[derive(Debug)...
rust
edit
0
0
mit
2c04e4625b992a2e0cc9b406be623c6b1a7b0e78
nafarlee/thoughtfuck
src/command.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nextern crate lang;\n\nuse lang::sexp;\n\n\nfn ast(code: &str) -> String {\n sexp::parse(code.to_owned()).dump()\n}\n\nfn match_ast(actual: &str, expected: &str) {\n let actual = actual.trim();\n let expected = expected.trim();\n i...
rust
edit
0
2
mit
6f1d09c2d42fbc813cc304479c8a112cc3045d69
matklad/fall,matklad/fall,matklad/fall
tests/sexp.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n//! Crate which contain the virtual machine which executes embed_lang programs\n\n#[macro_use]\nextern crate log;\n#[cfg(test)]\nextern crate env_logger;\n#[macro_use]\nextern crate quick_error;\n#[macro_use]\nextern crate mopa;\n\nextern cra...
rust
edit
1
1
mit
366330cacc0484bd4c0c526f84ba66403eb0b2b6
Marwes/gluon,Marwes/embed_lang,gluon-lang/gluon,gluon-lang/gluon,Marwes/embed_lang,Marwes/gluon
vm/src/lib.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nextern crate cmake;\nextern crate bindgen;\n\nuse std::env;\nuse std::path::PathBuf;\nuse cmake::Config;\n\nfn main() {\n let target = env::var(\"TARGET\").unwrap();\n let is_debug = env::var(\"DEBUG\").unwrap() == \"true\";\n let bi...
rust
edit
0
3
mit
31c2ed0063d555fb23736af25b4e9ae9f9430e15
ruabmbua/enet-sys,ruabmbua/enet-sys
build.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n#[macro_use]\nmod macros;\n\nuse proc_macro2::{Delimiter, Group, Ident, Punct, Spacing, Span, TokenStream, TokenTree};\nuse std::iter::FromIterator;\nuse syn::{Expr, Type};\n\n#[test]\nfn parse_interpolated_leading_component() {\n // mimic...
rust
edit
1
1
apache-2.0
0b9d0df041ac6589fc2f558af4f70d89ee382fe5
dtolnay/syn
tests/test_path.rs
rejected_duplicate
Near-duplicate of sample 121306
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n#![feature(ascii_ctype)]\nuse std::ascii::AsciiExt;\n\npub fn is_pangram(words: &str) -> bool {\n let r = words\n .chars()\n .filter(|x| x.is_ascii_alphabetic())\n .map(|x| x.to_ascii_lowercase() as u8 - b'a')\n ...
rust
edit
2
3
bsd-2-clause
9388433a38ed1742a8b5c4c08d746b42d0b7ce42
gyn/exercism,gyn/exercism,gyn/exercism,gyn/exercism
rust/pangram/src/lib.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse crate::{BuildMetadata, Prerelease};\nuse std::fmt::{self, Debug, Display};\n\nimpl Display for Prerelease {\n fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {\n formatter.write_str(self.as_str())\n }\n}\n\nimpl ...
rust
edit
0
4
apache-2.0
ae1b06c8c005345ec9d343ddb0f87f45e61ea4a8
rust-lang/semver
src/display.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n#[cfg(test)]\nmod tests {\n #[test]\n fn it_works() {\n }\n}\n\n```\n\nApply this change: Add struct and method for testing" }, { "role": "assistant", "content": "#[derive(Debug)]\npub struct Rectangle {\n length: u32,...
rust
edit
0
2
mit
1cace92fe7b99e6d9d2e1dad6f3da4633c8341d8
pgrzesik/learning-rust
testing/src/lib.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n#![cfg(feature = \"cloudfront\")]\n\nextern crate rusoto_core;\nextern crate rusoto_cloudfront;\nextern crate env_logger;\n\nuse rusoto_cloudfront::{CloudFront, CloudFrontClient, ListDistributionsRequest};\nuse rusoto_core::Region;\n\n#[test]...
rust
edit
0
1
mit
329cd70068ddddc45c946adf52c96c6c0e746ca5
rusoto/rusoto,DualSpark/rust-aws,rusoto/rusoto,rusoto/rusoto,DualSpark/rusoto,DualSpark/rust-aws,SecurityInsanity/rusoto,DualSpark/rusoto,DualSpark/rust-aws,SecurityInsanity/rusoto,DualSpark/rusoto
integration_tests/tests/cloudfront.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse serde::{ Serialize, Deserialize };\n\npub trait Cell: Clone + Serialize + Deserialize {\n type Coord: Coord;\n\n fn step<'a, I>(&'a self, neighbors: I) -> Self\n where I: Iterator<Item=Option<&'a Self>>;\n\n fn with_coord<...
rust
edit
0
1
mit
73ac6ab24c09515672c587482c2c098359767545
0nkery/celly
src/traits.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nextern crate hyper;\n\nmod get;\nmod post;\n\nuse hyper::{Get, Post};\nuse hyper::server::{Handler, Server, Request, Response};\nuse hyper::status::StatusCode;\n\nstruct HttpTin;\n\nimpl Handler for HttpTin {\n fn handle(&self, request: Re...
rust
edit
2
2
apache-2.0
1d393d45d701d718832a4ee69a255af8955900cf
imp/httptin,imp/httptin
src/main.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse subframe;\nuse subframe::{Subframe, MAX_FIXED_ORDER};\n\npub fn fixed_restore_signal(order: usize,\n residual: &[i32],\n output: &mut [i32]) {\n debug_assert!(order <= MAX_FIXED_ORDER...
rust
edit
1
5
bsd-3-clause
4bf025c7ddc2a6bcc164c05ca0672ce55bd73e5c
sourrust/flac
src/subframe/decoder.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n#![feature(libc)]\n\nextern crate libc;\nextern crate \"glib-2_0-sys\" as glib;\nextern crate \"gobject-2_0-sys\" as gobject;\n\npub mod notification;\n\npub use notification::*;\n\nuse libc::{\n c_char\n};\n\nuse glib::types::{\n gbool...
rust
edit
null
null
mit
e3a039303e4974ee8db0dd3113a84b71c43ec2eb
crumblingstatue/rust-libnotify-sys
src/lib.rs
rejected_syntax
Syntax error detected by tree-sitter
false
[ { "role": "user", "content": "Here is the current file:\n```rust\n// Our first attempt uses `unwrap` and provides unhelpful errors.\nfn double_first(vec: Vec<&str>) -> i32 {\n // Returns an error if the input vector is empty:\n let first = vec.first().unwrap();\n\n // Returns an error if the elemen...
rust
edit
0
1
apache-2.0
7ddda5f4ee6a6c7faf08e893d332414385a6e740
realcr/rust-by-example,chriskrycho/rust-by-example,realcr/rust-by-example,chriskrycho/rust-by-example
examples/error/option_with_result/option_result.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse std::process::Command;\nuse std::os::unix::process::CommandExt;\n\nfn main() {\n Command::new(\"java\")\n .arg(\"-Xms512m\")\n .arg(\"-Xmx1536m\")\n .arg(\"-Xss2m\")\n .args(&[\"-jar\", \"/Users/dnw/.sbt/lau...
rust
edit
2
2
apache-2.0
938c3207b0943ce53e58e6268c9c3e97fd000f89
dwijnand/sbtl,dwijnand/sbtl
src/main.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nextern crate byteorder;\n\n/// OSC data types, see [OSC 1.0\n/// specification](http://opensoundcontrol.org/spec-1_0) for details\npub mod types;\n/// Provides a decoding method for OSC packets\npub mod decoder;\n/// TODO\npub mod encoder;\n/...
rust
edit
1
0
apache-2.0
c675ce93acb0044a02dbb23563aafff761855972
klingtnet/rosc
src/lib.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n//! Importers for RAW volume files. A raw volume file is the raw bytes of\n//! volume data in little endian, with X increasing first, then Y, then Z.\n\nuse std::io::BufReader;\nuse std::io::prelude::*;\nuse std::fs::File;\nuse std::path::Pat...
rust
edit
0
2
mit
b891be55e4371d332e33ba54ac26d9c454fd55ab
Twinklebear/ispc-rs,Twinklebear/rust-ispc-integration
examples/ddvol/src/raw.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n#![feature(ascii_ctype)]\nuse std::ascii::AsciiExt;\nuse std::collections::HashMap;\n\npub fn word_count(text: &str) -> HashMap<String, u32> {\n let iter = text.split(|x: char| x.is_ascii_punctuation() || x == ' ')\n .filter(|x| !x....
rust
edit
2
3
bsd-2-clause
ece4392a0a0900957b3c47412c8ca419767de136
gyn/exercism,gyn/exercism,gyn/exercism,gyn/exercism
rust/word-count/src/lib.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n// Rx -- Reactive programming for Rust\n// Copyright 2016 Ruud van Asseldonk\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// A copy of the Lice...
rust
edit
0
3
apache-2.0
fef990f3a77843634f7c37f4e7094547754d8672
ruud-v-a/rx
src/lib.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n// Copyright (c) 2016-2017 Chef Software Inc. and/or applicable contributors\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a c...
rust
edit
2
4
apache-2.0
bf26c8c661d2843cb04c29b5ad9746d32348fa3d
habitat-sh/habitat,habitat-sh/habitat,habitat-sh/habitat,rsertelon/habitat,rsertelon/habitat,rsertelon/habitat,habitat-sh/habitat,rsertelon/habitat,habitat-sh/habitat,rsertelon/habitat,rsertelon/habitat,rsertelon/habitat,habitat-sh/habitat,habitat-sh/habitat,habitat-sh/habitat
src/util/mod.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\npub fn puzzle(input: &str) -> String {\n String::from(\"no\")\n}\n\n#[cfg(test)]\nmod test {\n use super::*;\n\n}\n\n```\n\nApply this change: Write a struct with methods for representing a column\n\nDoes not compile" }, { "role...
rust
edit
1
1
mit
3957f8a928b12670bd2787540da0c999c78bf9fb
carols10cents/adventofcode-rs
src/lib.rs
accepted
null
true
[ { "role": "user", "content": "Write rust code for the following: Add BitInformation and implement it for u8" }, { "role": "assistant", "content": "//! Bit utilities for Rust\n//!\n//! This will eventually expand to include Nibbles and packing them into bytes and integers.\n\npub trait BitInforma...
rust
new_file
0
2
apache-2.0
642568094c1042d310ac3bd53d2a5a9204c40a70
Techern/bit_utils-rs
src/lib.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse crate::compiler_plugin;\nuse crate::gen::code_writer::CodeWriter;\n\npub(crate) fn gen_mod_rs(mods: &[String]) -> compiler_plugin::GenResult {\n let v = CodeWriter::with_no_error(|w| {\n w.comment(&format!(\"{}generated\", \"@\"...
rust
edit
0
2
mit
7131fb244fb1246d2835f5ad7426e607ee7c4a1f
stepancheg/rust-protobuf,stepancheg/rust-protobuf,stepancheg/rust-protobuf
protobuf-codegen/src/gen/mod_rs.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nextern crate case;\nextern crate docopt;\nextern crate env_logger;\nextern crate git2;\n#[macro_use]\nextern crate lazy_static;\n#[macro_use]\nextern crate log;\nextern crate xml;\nextern crate toml;\n\nuse std::error::Error;\nuse std::proces...
rust
edit
null
null
mit
d9301bf9e21cc0ac0792631bc3b7d98fcf09d767
EPashkin/gir,gtk-rs/gir,gtk-rs/gir,GuillaumeGomez/gir,gkoz/gir,EPashkin/gir,GuillaumeGomez/gir,gtk-rs/gir,GuillaumeGomez/gir,gkoz/gir
src/main.rs
rejected_syntax
Syntax error detected by tree-sitter
false
[ { "role": "user", "content": "Here is the current file:\n```rust\n// -*- flycheck-rust-crate-root: \"lib.rs\" -*-\nuse super::ffi as ffi;\nuse super::context::Context;\nuse std::c_str::ToCStr;\n\n/// The XML document\npub struct Document {\n xmlDocument: *const ffi::Document\n}\n\nimpl Document {\n //...
rust
edit
0
2
mit
2d51d433652417738eec77777711ddc5c08858c8
PistonDevelopers/xpath-rs
src/document.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\npub struct Post {\n state: Option<Box<State>>,\n content: String\n}\n\nimpl Post {\n pub fn new() -> Post {\n Post {\n state: Some(Box::new(Draft {})),\n content: String::new()\n }\n }\n}\n\ntra...
rust
edit
0
1
mit
fe13b988e1b8df65c05d3124ee5425ec9d5660e1
pgrzesik/learning-rust
blog/src/lib.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse super::Hash256;\nuse super::attestation_record::AttestationRecord;\n\npub struct ActiveState {\n pub pending_attestations: Vec<AttestationRecord>,\n pub recent_block_hashes: Vec<Hash256>,\n}\n\nimpl ActiveState {\n /// Returns a ...
rust
edit
0
0
apache-2.0
de8b84f9cd6a4fadbfc03270544b32a345f8b5b7
sigp/lighthouse,sigp/lighthouse,sigp/lighthouse,sigp/lighthouse
beacon_chain/types/src/active_state.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nextern crate base64;\nextern crate hyper;\nextern crate iso8601;\nextern crate xml;\n\nmod error;\nmod parser;\nmod request;\nmod value;\nmod utils;\n\npub use error::{RequestError, Fault};\npub use request::{Request, RequestResult};\npub use...
rust
edit
1
0
cc0-1.0
6b732c339c850ef0e6dfffca6b51aa3dad991f64
jonas-schievink/xml-rpc-rs
src/lib.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n// Copyright 2014 Birunthan Mohanathas\n//\n// Licensed under the MIT license <http://opensource.org/licenses/MIT>. This\n// file may not be copied, modified, or distributed except according to those\n// terms.\n\npub struct Measure {\n na...
rust
edit
0
1
mit
8006852c7509b89f7a7a68f43142339058ec40b0
poiru/rainmeter-rust
src/measure.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n// Implements http://rosettacode.org/wiki/100_doors\n\nuse std::iter::range_inclusive;\n\n#[cfg(not(test))]\nfn main() {\n let drs = doors();\n for (i, x) in drs.iter().enumerate() {\n println!(\"Door {} is {}\", i+1, x);\n }\...
rust
edit
null
null
unlicense
d6c108ff224362c1697cb43146ce7bd37d8fe360
magum/rust-rosetta,ZoomRmc/rust-rosetta,crespyl/rust-rosetta,ghotiphud/rust-rosetta,crr0004/rust-rosetta,Hoverbear/rust-rosetta,JIghtuse/rust-rosetta,sakeven/rust-rosetta,magum/rust-rosetta,pfalabella/rust-rosetta
src/100_doors.rs
rejected_syntax
Syntax error detected by tree-sitter
false
[ { "role": "user", "content": "Here is the current file:\n```rust\n// FIXME: If two macros in the same module have the same name\n// (yes, that's a thing), rustdoc lists both of them on the index page,\n// but only documents the first one on the page for the macro.\n// Fortunately, this can only happen in do...
rust
edit
2
0
apache-2.0
8f035b87e0a839fbca853514287028569808d50f
graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust
src/test/rustdoc/macro-document-private-duplicate.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse std::fs;\nuse std::path::Path;\nfn main() {\n // Copy connectr.ini.in to connectr.ini if connectr.ini does not exist.\n //\n // The local changes in connectr.ini are always preserved, so you can\n // set private keys without w...
rust
edit
0
2
apache-2.0
a6033301326abaed331762402f61c946ae3884af
mrmekon/connectr,mrmekon/connectr
build.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse math::*;\nuse ray::Ray;\n\n#[derive(Copy, Clone)]\npub struct Intersection {\n pub distance: f32,\n pub position: Point,\n pub normal: Vector,\n}\n\nimpl Intersection {\n pub fn nearest(lhs: Self, rhs: Self) -> Intersection {\...
rust
edit
0
2
mit
a1010f6440a57e1e29d0486ec3cb688243795f4b
ijks/crabtrace
src/intersection.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse {DeciderImpl, Decider, Decision, Result};\n\nuse std::time::Instant;\n\n\n#[derive(Copy, Clone)]\n/// The most naive implementation of a rate-limiter ever: Always\n/// allows every cell through.\npub struct Allower {}\n\nimpl Allower {\n ...
rust
edit
4
1
mit
7566e26b44a9837af83950652e0268802f861e9c
antifuchs/ratelimit_meter
src/example_algorithms.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n#![crate_name = \"http\"]\n\n#![comment = \"Rust HTTP server\"]\n#![license = \"MIT/ASL2\"]\n#![crate_type = \"dylib\"]\n#![crate_type = \"rlib\"]\n\n#![doc(html_root_url = \"http://www.rust-ci.org/chris-morgan/rust-http/doc/\")]\n\n#![deny(n...
rust
edit
0
0
apache-2.0
273e4dbae118434631bf0ac1aaec6d28c8c356be
servo/rust-http,Shraddha512/rust-http,Shraddha512/rust-http,Shraddha512/rust-http,servo/rust-http,servo/rust-http,Shraddha512/rust-http,servo/rust-http,Shraddha512/rust-http
src/http/lib.rs
rejected_duplicate
Near-duplicate of sample 120256
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse std::io::Result;\n\nuse fleetspeak::Packet;\n\nuse crate::action::Response;\n\npub struct Session {\n id: String,\n next_response_id: u64,\n}\n\nimpl Session {\n\n pub fn known<S: Into<String>>(id: S) -> Session {\n Sessio...
rust
edit
0
3
mit
45f0d9710df8f01e5dbfc9bdfc541fe0c7aa6ff4
google/rrg
src/session.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n#[macro_use]\nextern crate clap;\nextern crate rsstreem;\nextern crate rsstreem_parser as parser;\n\nuse clap::{App, Arg};\nuse parser::parse;\n\nuse std::error::Error;\nuse std::fs::File;\nuse std::io::Read;\nuse std::path::PathBuf;\n\nfn ma...
rust
edit
0
2
mit
68269507545a574bba92d2f232b5fe76bff7a41d
Everysick/rsstreem
src/main.rs
rejected_duplicate
Near-duplicate of sample 120734
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse std::fmt;\n\n#[derive(Debug)]\npub enum ErrorLevel {\n Info,\n Warning,\n Error,\n}\n\n// Use a hashmap which contains an error level and a string\npub struct ErrorStack(Vec<(ErrorLevel, &'static str)>);\n\nimpl fmt::Display for ...
rust
edit
0
2
apache-2.0
9efde35d37d96a8a9d5bf25ea0c1860cbff63829
Willifme/robin_core,Willifme/robin_core,Willifme/robin_core
src/error/mod.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n// A unit struct\nstruct Nil;\n\n// A tuple struct\nstruct Pair(i32, f64);\n\n// A struct with two fields\nstruct Point {\n x: f64,\n y: f64,\n}\n\n// Structs can be reused as fields of another struct\n#[allow(dead_code)]\nstruct Rectan...
rust
edit
0
1
apache-2.0
8835814e9b89e94cee85d07b9ed4b26769cab423
chriskrycho/rust-by-example,realcr/rust-by-example,realcr/rust-by-example,chriskrycho/rust-by-example
examples/custom_types/structs/structs.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n//! An example of opening an image.\nextern crate image;\n\nuse std::env;\nuse std::fs::File;\nuse std::path::PathBuf;\n\nuse image::GenericImage;\n\nfn main() {\n let file = if env::args().count() == 2 {\n env::args().nth(1).unwrap...
rust
edit
0
2
mit
3e0aae2805550a64f98ed8f034797d55673d52b9
huonw/image,PistonDevelopers/image,JaySon-Huang/image,hetzge/image,theotherphil/image,TyOverby/rust-image,PistonDevelopers/image,tomaka/image,mbrubeck/image,twoodford/image,nwin/rust-image,bvssvni/image,dtwood/piston-image,lady-segfault/image
examples/opening.rs
accepted
null
true
[ { "role": "user", "content": "Write rust code for the following: Create channel and spawn a thread that sends string through it" }, { "role": "assistant", "content": "use std::thread;\nuse std::sync::mpsc;\n\nfn main() {\n let (tx, rx) = mpsc::channel();\n\n thread::spawn(move || {\n ...
rust
new_file
2
2
mit
736b31de32b0fa47cf89f509dcf2c13cb48bbfb5
pgrzesik/learning-rust
27_message_passing/src/main.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n// Copyright 2012 The Rust Project Developers. See the COPYRIGHT\n// file at the top-level directory of this distribution and at\n// http://rust-lang.org/COPYRIGHT.\n//\n// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or\n//...
rust
edit
1
1
apache-2.0
a43171a24257f015113ecf494286d39f47db88ac
GBGamer/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,GBGamer/rust,GBGamer/rust,graydon/rust,graydon/rust,GBGamer/rust,GBGamer/rust,graydon/rust,GBGamer/rust,GBGamer/rust,graydon/rust,GBGamer/rust
src/test/ui/rfc1598-generic-associated-types/shadowing.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nmod ffi {\n use libc::{c_void, size_t, uint32_t, uint64_t};\n\n #[allow(non_camel_case_types)]\n type XXH32_hash_t = uint32_t;\n\n #[allow(non_camel_case_types)]\n type XXH64_hash_t = uint64_t;\n\n extern \"C\" {\n pu...
rust
edit
0
1
mit
2f2ebdffa25eca60540de6e15500ae99c4900526
shepmaster/twox-hash
comparison/src/c_xxhash.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n/// A scale and an offset that transforms xyz coordinates.\n#[derive(Clone, Copy, Debug, PartialEq)]\npub struct Transform {\n /// The scale.\n pub scale: f64,\n /// The offset.\n pub offset: f64,\n}\n\nimpl Transform {\n /// A...
rust
edit
0
1
mit
6e2a2e19c928b8d70f5e1b99c9c426e9aa31b190
gadomski/las-rs
src/transform.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n#![deny(missing_debug_implementations,\n missing_copy_implementations,\n trivial_casts,\n trivial_numeric_casts,\n unsafe_code,\n unstable_features,\n unused_import_braces,\n unused_qualificati...
rust
edit
1
0
mit
6a790ba92ba3d5bc582d430b16ab8296e2239e74
michiel/jsonapi-rust
src/lib.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\npub struct CircularBuffer<T> {\n buffer: Vec<T>,\n capacity: usize\n}\n\n#[derive(Debug, PartialEq)]\npub enum Error {\n EmptyBuffer,\n FullBuffer\n}\n\nimpl<T> CircularBuffer<T> {\n pub fn new(capacity: usize) -> Self {\n ...
rust
edit
0
2
mit
468934c889b6776b1d5c599f91489e8e189f6a3a
attilahorvath/exercism-rust
circular-buffer/src/lib.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n#[macro_use]\nextern crate nom;\n\npub mod metadata;\nmod utility;\n\nuse metadata::metadata;\n\npub struct Stream<'a> {\n pub meta_data: Vec<metadata::Block<'a>>,\n //frames: Vec<u32>\n}\n\nnamed!(stream <&[u8], Stream>,\n chain!(\n bl...
rust
edit
1
0
bsd-3-clause
9b4a6fb9d96fdde57195fce9264032c1510b4c1d
sourrust/flac
src/lib.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n// Copyright 2014 The Rust Project Developers. See the COPYRIGHT\n// file at the top-level directory of this distribution and at\n// http://rust-lang.org/COPYRIGHT.\n//\n// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or\n//...
rust
edit
0
1
apache-2.0
0e03503f539b15d116fad5517e52d5cc7013d0c6
AerialX/rust,rohitjoshi/rust,jashank/rust,bombless/rust-docs-chinese,gifnksm/rust,defuz/rust,kwantam/rust,ebfull/rust,l0kod/rust,mihneadb/rust,AerialX/rust,miniupnp/rust,mihneadb/rust,zaeleus/rust,GBGamer/rust,barosl/rust,pshc/rust,sae-bom/rust,reem/rust,mdinger/rust,mvdnes/rust,mihneadb/rust,robertg/rust,AerialX/rust-...
src/librustc_back/target/i686_unknown_linux_gnu.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nextern crate hyper;\nextern crate json;\n\npub mod request;\npub mod response;\n\npub use request::Request;\npub use response::Response;\n\npub type Result = hyper::Result<Response>;\npub type Error = hyper::error::Error;\n\n\npub fn get(url:...
rust
edit
1
1
mit
d6baffcdee8f1cf139def4064edfb58db7ff8eba
imp/requests-rs
src/lib.rs
rejected_duplicate
Near-duplicate of sample 120880
true