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 crate serialize;\nextern crate toml = \"github.com/mneumann/rust-toml#toml:0.1\";\n\nuse std::os;\n\n#[deriving(ToStr,Decodable)]\nstruct Config {\n host: ~str,\n port: Option<uint>,\n ids: ~[uint],\n products: ~[Product]\n...
rust
edit
null
null
mit
7bde0cdb46b9ceaf2ee70c8baac4465835faeac0
mneumann/rust-toml
src/examples/decoder/main.rs
rejected_syntax
Syntax error detected by tree-sitter
false
[ { "role": "user", "content": "Here is the current file:\n```rust\n#[feature(globs)];\n\nuse std::str;\nuse std::rt::io;\nuse std::rt::io::file;\nuse std::rt::io::{Reader,Writer};\nuse std::os;\nuse peg::{compile_grammar};\nuse codegen::RustWriter;\n\nmod peg;\nmod codegen;\nmod grammar;\n\nfn main() {\n\tle...
rust
edit
0
1
mit
719f274fc69d0d1762fc9f6f77bff010584f945d
loganmhb/rust-peg,tempbottle/rust-peg,kevinmehall/rust-peg,kevinmehall/rust-peg,a-wortman/rust-peg,jsgf/rust-peg,jsgf/rust-peg,daramos/rust-peg,daramos/rust-peg,a-wortman/rust-peg,tempbottle/rust-peg,loganmhb/rust-peg
src/peg/main.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n#![feature(plugin, core, test)]\n#![plugin(speculate)]\n\nextern crate test;\n\nspeculate! {\n bench \"noop\" |b| {\n b.iter(|| ());\n }\n\n describe \"xor\" {\n context \"0 to 1000\" {\n before {\n ...
rust
edit
1
0
apache-2.0
0ba5113a1315c0c5649f163132a8a4a532ee51e1
cmr/speculate.rs
benches/basic.rs
rejected_duplicate
Near-duplicate of sample 121756
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nextern crate document;\n\nuse std::cmp::min;\nuse std::io::File;\nuse std::io::BufferedWriter;\nuse std::io::stdio::stdout_raw;\n\nuse document::parser::Parser;\n\nfn pretty_error(xml: &str, position: uint) -> &str {\n let s = xml.slice_fr...
rust
edit
0
3
mit
31514cf67fbde4bd27e691be37f1a617b5eb6e10
shepmaster/sxd-document,shepmaster/sxd-document
src/bin/open.rs
rejected_duplicate
Near-duplicate of sample 121763
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse super::*;\n\n// crc: u32 4\n// kind: u8 1\n// seg num: u64 9 (varint)\n// pid: u64 9 (varint)\n// len: u64 9 (varint)\n/// Log messages have a header that might eb up to this length.\npub const MAX_MSG_HEADER_LEN: usize = 32;\n\n/// Log s...
rust
edit
0
0
apache-2.0
5a097066314430e509a6b3dcb2a737156ddfdf77
spacejam/sled,spacejam/sled,spacejam/sled
src/pagecache/constants.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n// Magic addresses used to lay out x86_64 VMs.\n\n// The 'zero page', a.k.a linux kernel bootparams.\npub const ZERO_PAGE_START: usize = 0x7000;\n// Initial stack for the boot CPU.\npub const BOOT_STACK_POINTER: usize = 0x8000;\n// Initial pa...
rust
edit
0
0
apache-2.0
4d7a38443335056a00f0abe873a547f470a2d05e
firecracker-microvm/firecracker,firecracker-microvm/firecracker,firecracker-microvm/firecracker,firecracker-microvm/firecracker,firecracker-microvm/firecracker
x86_64/src/layout.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nextern crate common;\n\nuse common::args::Args;\nuse common::first_run::check_first_run;\nuse common::project_paths::{project_paths, CONFIG_EXTENSION};\n\nuse std::path::PathBuf;\n\npub fn exec(args: Args) -> Result<(), String> {\n let pro...
rust
edit
0
4
mit
d0081d3a3f1fbef2286b82b2fa5a40480081e4a8
brianp/muxed,brianp/muxed
list/src/lib.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse db::Pool;\nuse rocket::{self, Rocket, Request};\nuse rocket_contrib::{JSON, Value};\n\nmod teams;\nmod members;\n\npub fn app(pool: Pool) -> Rocket {\n rocket::ignite()\n .manage(pool)\n .mount(\"/teams\", teams::routes()...
rust
edit
1
2
mit
76d1e63a1e632a6215758c937522e25df4325779
mob-rs/mob
server/src/web/mod.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n// Copyright 2016 Alexander Reece\n//\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/...
rust
edit
1
0
apache-2.0
3033cc9a160fdf14ba591d55a3d0ba8a1e28f34b
alreece45/amqp-rs
amqp0/parser-nom/src/lib.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n// compile-flags:-Z unstable-options --show-coverage\n// check-pass\n\n//! Make sure to have some docs on your crate root\n\n#[allow(missing_docs)]\npub mod mod_foo {\n pub struct Bar;\n}\n\n/// This is a struct with a `#[allow(missing_doc...
rust
edit
0
1
apache-2.0
685444008bb2631564b56068bcbf2462bf0cc6af
graydon/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust
src/test/rustdoc-ui/coverage/allow_missing_docs.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n// build-pass (FIXME(62277): could be check-pass?)\n\nuse std::num::NonZeroU8;\n\nconst X: NonZeroU8 = unsafe { NonZeroU8::new_unchecked(5) };\nconst Y: u8 = X.get();\n\nfn main() {\n}\n\n```\n\nApply this change: Test `NonZeroU8::new` in a c...
rust
edit
1
1
apache-2.0
0755c41ae26af20c940a80b3c1f686ab5916e655
graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust
src/test/ui/consts/const-nonzero.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n//\n// Copyright:: Copyright (c) 2015 Chef Software, Inc.\n// License:: Apache License, Version 2.0\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....
rust
edit
0
1
apache-2.0
c3b7a6e350044e230490880068497606d57058bd
chef/delivery-cli,chef/delivery-cli,chef/delivery-cli
src/main.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse std::env;\n\npub fn configure() {\n println!(\"cargo:rerun-if-changed=build.rs\");\n println!(\"cargo:rerun-if-env-changed=PROFILE\");\n\n let wants_debug = env::var(\"PROFILE\").unwrap() == \"debug\";\n\n let artifacts = zero...
rust
edit
0
1
apache-2.0
00a8d7e896f4126966405b08689025ebd5ea6e0a
erickt/rust-zmq
zmq-sys/build/vendored.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n#[inline]\npub fn split_values_vec(values: Vec<String>) -> String {\n let string = values.into_iter().collect::<Vec<String>>()\n .join(\",\").to_owned();\n string.clone()\n}\n\n```\n\nApply this change: util: Add new util method ...
rust
edit
0
1
mit
94a273b7a40cfa88f66485faf99fc22d7bbe04c2
cosmo0920/ruroonga_command
src/util/mod.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nextern crate icecore;\n\nuse icecore::data::FileStore;\nuse icecore::data::DataStore;\n\n\nfn main() {\n let foo = \"bar\";\n let store = FileStore::new(String::from_str(\"_documents\"));\n store.write(foo.as_bytes());\n}\n\n```\n\nApply t...
rust
edit
0
4
mit
72676ca5aabb2b0b851010d355af4bfb38a776a3
jacquesrott/icecore,jacquesrott/icecore
src/main.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nextern crate ghoti;\nextern crate getopts;\n\nuse getopts::Options;\nuse ghoti::correction;\nuse std::env;\n\n\nfn print_usage(opts: Options) {\n let usage = \"Usage: ghoti [options] <word>\";\n print!(\"{}\", opts.usage(usage));\n}\n\n...
rust
edit
0
4
mit
54bc97987de19ab41d3f712028799fe15533adc5
iKevinY/ghoti.rs
src/main.rs
rejected_duplicate
Near-duplicate of sample 121653
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nextern crate lettre;\n\nuse lettre::{EmailTransport, SimpleSendableEmail};\nuse lettre::smtp::SmtpTransportBuilder;\n\nfn main() {\n let email = SimpleSendableEmail::new(\n \"user@localhost\",\n vec![\"root@localhost\"],\n ...
rust
edit
0
2
mit
918c679d941d9384c6beee3db4487361b4a64b6e
amousset/lettre,amousset/rust-smtp,lettre/lettre,amousset/lettre
lettre/examples/smtp.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nextern \"C\" {\n fn evenmorehello();\n}\n\npub fn helloer() {\n println!(\"I'm saying \\\"hello\\\" again!\");\n unsafe { evenmorehello() };\n}\n\n```\n\nApply this change: Update formatter to rustfmt 2.0\n\nReviewed By: zertosh\n\nf...
rust
edit
0
1
apache-2.0
7ddb95428cce2957ae8837cc3161708cf9e6ee1c
JoelMarcey/buck,JoelMarcey/buck,JoelMarcey/buck,JoelMarcey/buck,JoelMarcey/buck,JoelMarcey/buck,JoelMarcey/buck,JoelMarcey/buck,JoelMarcey/buck,JoelMarcey/buck,JoelMarcey/buck,JoelMarcey/buck,JoelMarcey/buck
test/com/facebook/buck/features/rust/testdata/cxx_with_rust_dep/morehello.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n#![feature(old_path)]\n\nextern crate piston;\nextern crate graphics;\nextern crate sdl2_window;\nextern crate opengl_graphics;\n\nuse std::old_path::*;\n\nuse std::cell::RefCell;\nuse opengl_graphics::{\n GlGraphics,\n OpenGL,\n Tex...
rust
edit
0
3
mit
fa801fee9c5061ae2c6f9b6f10da9626dc4bc817
dannyflax/piston-examples,Potpourri/piston-examples,Abica/piston-examples,sinistersnare/piston-examples,placrosse/piston-examples,carols10cents/piston-examples
image/src/main.rs
rejected_duplicate
Near-duplicate of sample 121133
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nextern crate chattium_oxide_lib;\nextern crate yaml_file_handler;\nextern crate hyper;\nextern crate clap;\n\nmod io;\nmod options;\n\nuse io::read_unprompted;\nuse options::Options;\nuse hyper::client::Client;\nuse std::io::{stderr, Write};\...
rust
edit
1
4
mit
c61f7e8c51dc10076b8604e183606c9a3da8cb12
nabijaczleweli/chattium-oxide-client
src/main.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse alloc::string::String;\nuse core::mem;\n\n#[repr(C)]\npub struct RustString {\n repr: String,\n}\n\nimpl RustString {\n pub fn from(s: String) -> Self {\n RustString { repr: s }\n }\n\n pub fn from_ref(s: &String) -> &S...
rust
edit
0
1
apache-2.0
56377fc4f8ccbf7e186ac4f6716e54a9b44b05f9
dtolnay/cxx,dtolnay/cxx,dtolnay/cxx,dtolnay/cxx
src/rust_string.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nmacro_rules! steps {\n ($fut:ty { $($step:ident($ty:ty),)+ }) => (\n enum Step {\n $($step($ty),)+\n }\n\n enum Out {\n $($step(<$ty as Future>::Item),)+\n }\n\n impl $fut {\n ...
rust
edit
1
2
apache-2.0
78d47414a0a5476774a5232ec58901878757eda2
blackbeam/mysql_async
src/macros.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse atoms::*;\nuse molecule::*;\n\npub const WATER: &'static Molecule = &Molecule {\n compounds: &[\n MoleculeCompound { atom: HYDROGEN, amount: 2 },\n MoleculeCompound { atom: OXYGEN, amount: 1 }\n ]\n};\n\npub const TABL...
rust
edit
2
0
mit
13acc3385cacd2711733ecc664e2bc1b5dbf97cf
feroxide/feroxide,feroxide/feroxide
src/molecules.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n#![feature(test)]\nextern crate test;\nextern crate warc_parser;\nmod tests{\n use std::error::Error;\n use std::fs::File;\n use std::io::prelude::*;\n use std::path::Path;\n\n fn read_sample_file(sample_name: &str) -> String{\...
rust
edit
0
1
mit
12e5c4d00e32a987f099b3e6929ec03d5ecf15eb
sbeckeriv/warc_nom_parser
tests/lib.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse formatter::RdbParseFormatter;\nuse std::io;\n\npub struct PlainFormatter {\n out: Box<Writer+'static>\n}\n\nimpl PlainFormatter {\n pub fn new() -> PlainFormatter {\n let out = box io::stdout() as Box<Writer>;\n PlainF...
rust
edit
null
null
mit
0d563378304d11654ee863f543fc947ef5228e36
badboy/rdb-rs,badboy/rdb-rs,kbknapp/rdb-rs,kbknapp/rdb-rs,badboy/rdb-rs,kbknapp/rdb-rs
src/plain_formatter.rs
rejected_syntax
Syntax error detected by tree-sitter
false
[ { "role": "user", "content": "Here is the current file:\n```rust\nextern crate image;\n\nuse std::io::File;\n\n#[test]\nfn test_open_and_save_tga() {\n let path = Path::new(\"./tests/images/tga/testsuite/ctc24.tga\");\n let img = image::open(&path).unwrap();\n let fout = File::create(&Path::new(\"....
rust
edit
0
1
mit
5c42e3d6eace1c9088413a134c32ae98be6fd7c9
ruud-v-a/image,hetzge/image,lady-segfault/image,tomaka/image,TyOverby/rust-image,nwin/rust-image,PistonDevelopers/image,theotherphil/image,bvssvni/image,xanium4332/image,JaySon-Huang/image,dtwood/piston-image,huonw/image,PistonDevelopers/image,twoodford/image,mbrubeck/image
tests/tga.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n/// TODO\npub trait Stack<T> {\n /// TODO\n fn push(&mut self, elem: T);\n /// TODO\n fn pop(&mut self) -> Option<T>;\n /// TODO\n fn peek(&self) -> Option<&T>;\n /// TODO\n fn is_empty(&self) -> bool;\n /// TODO\n ...
rust
edit
0
1
bsd-3-clause
1ad1b688206c0adde5ad3d4da6b069987193460b
steveklabnik/rust-adt
src/stack.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n#![feature(core_intrinsics)]\n\nuse std::intrinsics;\n\nfn main() {\n unsafe { intrinsics::forget(); } //~ ERROR this function takes 1 argument but 0 arguments were supplied\n}\n\n```\n\nApply this change: Test for too many args." }, {...
rust
edit
1
1
apache-2.0
f46d1974313c83886508088ff1beac3a107c3790
rust-lang/miri,rust-lang/miri,rust-lang/miri,rust-lang/miri
tests/compile-fail/check_arg_count.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse common::{FactorIterator,is_prime};\n\nfn largest_prime_factor(value: uint) -> Option<uint> {\n let max = (value as f64).sqrt().ceil();\n let iter = FactorIterator::new(value, max as uint);\n let mut filtered = iter.filter(|x| { i...
rust
edit
0
1
mit
b1ac7e6d39ca23e8fba357366085c48ff6deebaf
niax/euler-rust
src/prob3.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n// Copyright 2016 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
bf529fb6e6c561e8adf7556dd52b542c8498b3c8
GBGamer/rust,aidancully/rust,graydon/rust,GBGamer/rust,GBGamer/rust,aidancully/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust,GBGamer/rust,GBGamer/rust,aidancully/rust,GBGamer/rust,GBGamer/rust,graydon/rust,graydon/rust,GBGamer/rust
src/test/run-pass/associated-const-outer-ty-refs.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n#![feature(unsafe_block_in_unsafe_fn)]\n#![warn(unsafe_op_in_unsafe_fn)]\n#![deny(unused_unsafe)]\n\nunsafe fn unsf() {}\n\nunsafe fn foo() {\n unsf();\n //~^ WARNING call to unsafe function is unsafe and requires unsafe block\n}\n\nuns...
rust
edit
2
1
apache-2.0
3ce9d5c26982ff0516946dda7fa8d29580fa25b3
aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust
src/test/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n#![deny(warnings)]\n\n#[macro_use]\nextern crate rust_embed;\nextern crate warp;\n\nuse std::borrow::Cow;\nuse warp::{filters::path::Tail, http::Response, Filter, Rejection, Reply};\n\n#[derive(RustEmbed)]\n#[folder = \"examples/public/\"]\ns...
rust
edit
0
3
mit
9e5bda6c92881f4bfe178f219d6281b24c49dde7
pyros2097/rust-embed
examples/warp.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
0
1
apache-2.0
6450ee91beada599a86f0020e438608ca2a13850
zubron/rust,ebfull/rust,kimroen/rust,mdinger/rust,pythonesque/rust,gifnksm/rust,SiegeLord/rust,vhbit/rust,emk/rust,aneeshusa/rust,jroesch/rust,michaelballantyne/rust-gpu,bombless/rust,pshc/rust,andars/rust,barosl/rust,rprichard/rust,ktossell/rust,ktossell/rust,carols10cents/rust,cllns/rust,stepancheg/rust-ide-rust,clln...
src/test/run-pass/cfgs-on-items.rs
rejected_duplicate
Near-duplicate of sample 121572
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse crate::atomicmin::AtomicMin;\nuse crate::{PngError, PngResult};\nuse libdeflater::{CompressionError, CompressionLvl, Compressor};\n\npub fn deflate(data: &[u8], max_size: &AtomicMin) -> PngResult<Vec<u8>> {\n let mut compressor = Compr...
rust
edit
0
5
mit
bc0d673af06e52be16ef8b5fa6c1d15217f40013
shssoichiro/oxipng,shssoichiro/oxipng,shssoichiro/oxipng
src/deflate/deflater.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nextern crate sync;\nextern crate nickel;\nextern crate sqlite3;\n\nuse nickel::{Request, Middleware, Response, Action, NickelError, Continue};\nuse sqlite3::core::DatabaseConnection;\nuse sqlite3::access;\nuse self::sync::{Mutex, Arc};\n\n#[d...
rust
edit
0
2
mit
3ca934708d926947476483c4a46ab7fb9a95ee74
SimonPersson/nickel-sqlite3
src/middleware.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nextern crate syn;\n\nuse std::env;\nuse std::fs::File;\nuse std::io::{Write, BufWriter};\nuse syn::DeriveInput;\n\npub fn generate_elm(ast: &DeriveInput) {\n let mut path = env::current_dir().unwrap();\n let name = &ast.ident;\n path...
rust
edit
0
4
mit
352f41ed40eb840bc73566051d09535ac4a2306c
mijnadres/serde_elm
src/derive/mod.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n// TODO: FIXME: It must be removed after code layout stabilization!\n#![allow(dead_code)]\n#![allow(unused_variables)]\n\n#[macro_use]\nextern crate log;\n\n#[macro_use]\nextern crate serde_derive;\n\n#[macro_use]\nextern crate lazy_static;\n...
rust
edit
1
1
apache-2.0
c2a653873e3e3966ef7fd8baf7ecac7310ef556c
anastasia-tarasova/indy-sdk,anastasia-tarasova/indy-sdk,anastasia-tarasova/indy-sdk,Artemkaaas/indy-sdk,Artemkaaas/indy-sdk,Artemkaaas/indy-sdk,Artemkaaas/indy-sdk,srottem/indy-sdk,srottem/indy-sdk,srottem/indy-sdk,Artemkaaas/indy-sdk,Artemkaaas/indy-sdk,Artemkaaas/indy-sdk,anastasia-tarasova/indy-sdk,peacekeeper/indy-...
libindy/src/lib.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n#![ cfg_attr( not( feature = \"use_std\" ), no_std ) ]\n#![ doc( html_logo_url = \"https://raw.githubusercontent.com/Wandalen/wTools/master/asset/img/logo_v3_trans_square.png\" ) ]\n#![ doc( html_favicon_url = \"https://raw.githubusercontent....
rust
edit
1
2
mit
c272c1210e8b794d153c72c1a5dd4a1851ed4e01
Wandalen/wTools,Wandalen/wTools
rust/impl/meta/_template_procedural_macro/meta/lib.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse std::collections::BTreeMap;\nuse std::io;\nuse std::io::BufRead;\n\nfn main() {\n let mut counts: BTreeMap<String, isize> = BTreeMap::new();\n let stdin = io::stdin();\n for line_result in stdin.lock().lines() {\n if let O...
rust
edit
0
6
mit
0bca925552f8318e724be427d9df0bc82ec7bc03
rtoal/ple,rtoal/ple,rtoal/ple,rtoal/ple,rtoal/polyglot,rtoal/ple,rtoal/polyglot,rtoal/ple,rtoal/ple,rtoal/ple,rtoal/polyglot,rtoal/ple,rtoal/ple,rtoal/polyglot,rtoal/polyglot,rtoal/ple,rtoal/polyglot,rtoal/ple,rtoal/polyglot,rtoal/polyglot,rtoal/polyglot,rtoal/ple,rtoal/polyglot,rtoal/polyglot,rtoal/polyglot,rtoal/ple,...
rust/wordcount.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\npub use self::Color::{White,Black};\n\n#[derive(PartialEq, Eq, Copy, Clone, Show)]\npub enum Color {\n White,\n Black,\n}\n\nimpl Color {\n pub fn invert(&self) -> Color {\n match *self {\n White => Black,\n ...
rust
edit
0
2
mit
255a804c2af6e14ba54ca34e3fd33ba6f87a74af
theemathas/binary_turk
src/game/color.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n// From #1174:\n// xfail-test bots are crashing on this on x86_64\n\nuse std;\nimport str;\nimport libc::*;\n\n#[nolink]\nnative mod libc {\n fn write(fd: c_int, buf: *u8, nbyte: size_t);\n}\n\nfn main() {\n let s = \"hello world\\n\";\...
rust
edit
null
null
apache-2.0
101f83ecef7e71a1c6b81795c81ce7fb85333c77
nham/rust,pshc/rust,AerialX/rust,ktossell/rust,reem/rust,jbclements/rust,omasanori/rust,sarojaba/rust-doc-korean,XMPPwocky/rust,quornian/rust,graydon/rust,cllns/rust,LeoTestard/rust,GrahamDennis/rand,fabricedesre/rust,aneeshusa/rust,graydon/rust,jashank/rust,andars/rust,mvdnes/rust,ejjeong/rust,kimroen/rust,waynenilsen...
src/test/run-pass/bind-native-fn.rs
rejected_syntax
Syntax error detected by tree-sitter
false
[ { "role": "user", "content": "Here is the current file:\n```rust\n\n// Extern crates.\nuse piston::*;\nuse graphics::*;\n\n// Local crate.\nuse test_colors;\nuse test_polygons;\nuse conversion;\nuse snipcode_triangulation;\n\npub struct App;\n\nimpl Game for App {\n fn render(&self, c: &Context, gl: &mut...
rust
edit
5
3
mit
eca6d6504741a05f1a436d37fc81c982e9f476a2
PistonDevelopers/graphics-lab
src/snipcode_triangulation_app.rs
rejected_lint
Too many lint violations: 5
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n//! Prints the elapsed time every 1 second and quits on Ctrl+C.\n\n#[macro_use]\nextern crate crossbeam_channel;\nextern crate signal_hook;\n\nuse std::io;\nuse std::thread;\nuse std::time::{Duration, Instant};\n\nuse crossbeam_channel::{tick...
rust
edit
0
5
apache-2.0
f1fc95bc81d965d92dbb3469d65d155ad6143589
crossbeam-rs/crossbeam,crossbeam-rs/crossbeam,crossbeam-rs/crossbeam,aturon/crossbeam,crossbeam-rs/crossbeam
crossbeam-channel/examples/stopwatch.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse engine::{IntoMap, Tile};\nuse util::units::{Point, Size};\n\nuse std::path::AsPath;\nuse std::fs::File;\nuse std::io::Read;\n\npub struct Map {\n pub tiles: Vec<Vec<Tile>>,\n pub size: Size,\n}\n\nimpl Map {\n\n pub fn new<T>(map...
rust
edit
0
2
bsd-3-clause
366ee3d7e00fa6265e7b15c89e3560ef7f63e02d
jgilchrist/rslike
src/engine/map.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\npub fn is_leap_year(year: int) -> bool {\n let has_factor = |n| year % n == 0;\n has_factor(4) && (!has_factor(100) || has_factor(400))\n}\n\n```\n\nApply this change: Fix leap for newest rust" }, { "role": "assistant", "con...
rust
edit
null
null
mit
42f4c5944dd8c170f3c416e2d6024566b184eeaa
Rust-Twin-Cities/flaming-octo-wookie,sacherjj/rust,Jeff-Hostetler/xrust,exercism/xrust,sacherjj/rust,stevejb71/xrust,spazm/xrust,pminten/xrust,pminten/xrust,Rust-Twin-Cities/flaming-octo-wookie,Jeff-Hostetler/xrust,petertseng/exercism-rust,sacherjj/rust,petertseng/exercism-rust,stevejb71/xrust,petertseng/exercism-rust,...
leap/example.rs
rejected_syntax
Syntax error detected by tree-sitter
false
[ { "role": "user", "content": "Write rust code for the following: io: Add traits Read and Write" }, { "role": "assistant", "content": "//! Definition of types, traits, ... for I/O functionality\n\nuse core::result;\n\npub type Result<T> = result::Result<T, ()>;\n\npub trait Read {\n fn read(&m...
rust
new_file
0
0
mit
cf66aac05db2c3b25a464d3e2413ef8e81eed9bd
uni-rs/uni.rs
src/io/mod.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse std::fmt::{self, Debug};\n\nuse self::thread_id::ThreadId;\n\n/// ThreadBound is a Sync-maker and Send-maker that allows accessing a value\n/// of type T only from the original thread on which the ThreadBound was\n/// constructed.\npub st...
rust
edit
1
2
apache-2.0
42ff83533cd0c4442208db59de7e6839d7ca0122
dtolnay/syn
src/thread.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse getopts::{Options,Matches};\nuse std::net::{TcpStream,SocketAddr};\nuse std::io::{BufStream,Write};\nuse std::old_io;\n\npub fn connect(matches: &Matches) {\n let host = matches.free.get(0).unwrap();\n let port = match matches.free....
rust
edit
1
3
mit
ccbdbd5616ec4770250154399390ae12cf053b9d
lukeasrodgers/rust-nc
src/connecter.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n// TODO: dpi\n// TODO: close events (stdweb PR required)\n// TODO: pointer locking (stdweb PR required)\n// TODO: mouse wheel events (stdweb PR required)\n// TODO: key event: .which() (stdweb PR)\n// TODO: should there be a maximization / ful...
rust
edit
1
0
apache-2.0
fe129963825798c95850df874bab863e9ed8c819
tomaka/winit
src/platform_impl/web/mod.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse super::{CollisionDetails, CollisionObjectResults};\n\n#[derive(Clone)]\npub struct CollisionResults<T: Clone> {\n pub collided: bool,\n pub details: Option<CollisionDetails>,\n pub time: Option<f64>,\n pub data: Option<T>\n}\n...
rust
edit
0
2
mit
f87e63333aff01bcdf040fcb506fc125e0a6f819
Jonesey13/generic_game
src/collision/collision_results.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n/// Type size assertion. The first argument is a type and the second argument is its expected size.\n#[macro_export]\nmacro_rules! static_assert_size {\n ($ty:ty, $size:expr) => {\n const _: [(); $size] = [(); ::std::mem::size_of::<...
rust
edit
0
2
apache-2.0
58758f0275172da24ee311e354cd9a7fe79c6e39
aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust
compiler/rustc_data_structures/src/macros.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse core::intrinsics::*;\nuse core::ops::FnOnce;\n\n#[cfg(not(test))]\n#[inline(always)]\n/// NOP instruction\npub fn nop() {\n unsafe { asm!(\"nop\" :::: \"volatile\"); }\n}\n\n#[cfg(test)]\n/// NOP instruction (mock)\npub fn nop() {\n}\n\n...
rust
edit
2
2
apache-2.0
60895adb980455249d11662b8b670d759330f6cc
google/tock-on-titan,google/tock-on-titan,google/tock-on-titan
src/support/src/arm.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n#![no_std]\n\n#[macro_use]\nextern crate enum_map;\n\n#[test]\nfn test_bool() {\n let mut map = enum_map! { false => 24, true => 42 };\n assert_eq!(map[false], 24);\n assert_eq!(map[true], 42);\n map[false] += 1;\n assert_eq!(m...
rust
edit
0
3
apache-2.0
bda03a95fcdd21552a7e04843d377f06fef03b93
xfix/enum-map
enum-map/tests/bool.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n\n/// Single entry of the `Dtab`\n#[derive(PartialEq, Eq, Debug)]\npub struct Dentry {\n pub key: String,\n pub val: String,\n}\n\n/// Delegate table.\n#[derive(PartialEq, Eq, Debug)]\npub struct Dtab {\n pub entries: Vec<Dentry>,\n}...
rust
edit
3
1
apache-2.0
4953472165d6fa57edf6defd57668cf69162aff1
bryce-anderson/rust-mux
src/dtab.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse std::env;\nuse std::fs;\nuse std::fs::Permissions;\nuse std::path::Path;\n\nfn main() {\n println!(\"cargo:rerun-if-changed=build/glslangValidator\");\n println!(\"cargo:rerun-if-changed=build/glslangValidator.exe\");\n\n let tar...
rust
edit
3
5
apache-2.0
b67b96a49ed817682161d7ec063a33dfd027f411
vulkano-rs/vulkano
glsl-to-spirv/build/build.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nmacro_rules! impl_raw_accessors(\n ($(($t:ty, $raw:ty)),+) => (\n $(\n impl $t {\n #[inline]\n pub fn raw(&self) -> $raw { self.raw }\n }\n )+\n )\n);\n\nmacro_rules! impl_owned_accessor...
rust
edit
3
1
mit
3febd0507c9feff5bc3df4eff94922303df5304f
inrustwetrust/rust-sdl2,Rust-SDL2/rust-sdl2,AngryLawyer/rust-sdl2,beni55/rust-sdl2,bfops/rust-sdl2,Rust-SDL2/rust-sdl2,vadixidav/rust-sdl2,caldwell/rust-sdl2,Cobrand/rust-sdl2,PistonDevelopers/rust-sdl2,Cobrand/rust-sdl2,Rust-SDL2/rust-sdl2,wilsoniya/rust-sdl2,nukep/rust-sdl2,crumblingstatue/rust-sdl2,tempbottle/rust-s...
src/sdl2/macros.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n// Based on threadring.erlang by Jira Isa\nuse std;\n\nconst n_threads: int = 503;\n\nfn start(+token: int) {\n import iter::*;\n\n let p = comm::port();\n let ch = iter::foldl(bind int::range(2, n_threads + 1, _),\n ...
rust
edit
null
null
apache-2.0
30a671dc0c0f8f62a36664a4f57c07a2bbab55ff
ejjeong/rust,untitaker/rust,l0kod/rust,aepsil0n/rust,mdinger/rust,omasanori/rust,krzysz00/rust,dwillmer/rust,kimroen/rust,mihneadb/rust,LeoTestard/rust,philyoon/rust,mitsuhiko/rust,nham/rust,kimroen/rust,defuz/rust,kmcallister/rust,servo/rust,defuz/rust,AerialX/rust,erickt/rust,victorvde/rust,GBGamer/rust,kwantam/rust,...
src/test/bench/shootout-threadring.rs
rejected_syntax
Syntax error detected by tree-sitter
false
[ { "role": "user", "content": "Here is the current file:\n```rust\n// ignore-windows\n\n//! This test just calls the relevant APIs to check if Miri crashes.\n\nuse std::sync::{Arc, Mutex};\nuse std::thread;\n\nfn main() {\n\n let data = Arc::new(Mutex::new(0));\n let mut threads = Vec::new();\n\n fo...
rust
edit
0
4
apache-2.0
d9ec0f2b36cc53e770193fa5a409f51cc3a7cc5a
rust-lang/miri,rust-lang/miri,rust-lang/miri,rust-lang/miri
tests/run-pass/concurrency/locks.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nextern crate cursive;\n\nuse cursive::Cursive;\nuse cursive::utils::markup::MarkdownText;\nuse cursive::views::{Dialog, TextView};\n\n// Make sure you compile with the `markdown` feature!\n//\n// cargo run --example markup --features markdown...
rust
edit
0
1
mit
5dcce6a9655f3579b64404feeb7a41d0f7368394
Gyscos/Cursive
examples/markup.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n#![feature(backtrace)]\n\nmod as_error;\nmod context;\nmod error;\n\npub use crate::as_error::AsError;\npub use crate::context::Context;\npub use crate::error::{Error, Errors};\n\n/// Return early with an error.\n///\n/// This macro is equiva...
rust
edit
2
0
apache-2.0
8da8c97e56ae3c07e90017e438b331b8c3db37bf
dtolnay/anyhow
src/lib.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse SChunks;\nuse std::fs::File;\nuse std::io::{Error, Write};\n\n/// This function takes as parameter a file name and a vector of chaunks.\n/// The function will create a file, and append to the buffer each chunk.\npub fn write_file(local_fi...
rust
edit
1
3
mit
f15614a1c88026ccfe8ef901a2e4f815f879e159
derniercri/snatch
src/write.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n// Copyright 2012-2015 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 o...
rust
edit
0
1
apache-2.0
d252d0ad5434bcf77076729ab766eeff98f20ead
jroesch/rust,pelmers/rust,miniupnp/rust,gifnksm/rust,zachwick/rust,philyoon/rust,zachwick/rust,l0kod/rust,jroesch/rust,pshc/rust,cllns/rust,ruud-v-a/rust,graydon/rust,KokaKiwi/rust,KokaKiwi/rust,ebfull/rust,cllns/rust,mvdnes/rust,pelmers/rust,victorvde/rust,philyoon/rust,avdi/rust,jroesch/rust,zachwick/rust,mihneadb/ru...
src/test/run-pass/x86stdcall.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\npub fn is_valid(id: &str) -> bool {\n // check the length\n if id.len() < 2 {\n return false;\n }\n\n let mut index: u32 = 0;\n let mut sum: u32 = 0;\n\n for c in id.chars().rev() {\n if c.is_whitespace() {\n ...
rust
edit
0
8
bsd-2-clause
21b9d5f852b85742f9dde5b90d344662fb507567
gyn/exercism,gyn/exercism,gyn/exercism,gyn/exercism
rust/luhn/src/lib.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse std::io;\nuse std::path::Path;\n\n#[cfg(windows)]\nuse crate::fs::_remove_dir_contents;\n\n#[cfg(not(windows))]\nuse crate::unix::_remove_dir_contents;\n\n/// Deletes the contents of `dir_path`, but not the directory iteself.\n///\n/// If...
rust
edit
0
11
apache-2.0
6c9d685019fdd85a8aeaeee0cbbb82472563aac6
XAMPPRocky/remove_dir_all
src/portable.rs
rejected_complexity
Cyclomatic complexity too high: 11
true
[ { "role": "user", "content": "Here is the current file:\n```rust\npub mod SessionHandler {\n use std::fs::File;\n use std::io::BufReader;\n use std::io::prelude::*;\n use std::env;\n\n pub fn create(profile_name: &str) {\n println!(\"Creating session for profile \\\"{}\\\"...\", profil...
rust
edit
0
4
mit
46ff816459f3a34cbdf324d760914a6d018dcbe0
amongil/bluenine
src/lib.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n//! # Parse `.proto` files\n//!\n//! Parse `.proto` file definitions, **not** the protobuf text format serialization.\n//!\n//! Files can be parsed using pure Rust parser (mod `pure`)\n//! or using the `protoc` command (mod `protoc`).\n//!\n/...
rust
edit
7
0
mit
eb37fbc06dde0905ff410c6ee8458582c72fa465
stepancheg/rust-protobuf,stepancheg/rust-protobuf,stepancheg/rust-protobuf
protobuf-parse/src/lib.rs
rejected_lint
Too many lint violations: 7
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n#[rustversion::attr(not(nightly), ignore)]\n#[test]\nfn ui() {\n let t = trybuild::TestCases::new();\n t.compile_fail(\"tests/ui/*.rs\");\n}\n\n```\n\nApply this change: Exclude ui tests from cargo miri test" }, { "role": "assis...
rust
edit
0
1
apache-2.0
6dd04dadec68eb35f908d8dfa57e1a75a2644a9b
dtolnay/quote
tests/compiletest.rs
rejected_duplicate
Near-duplicate of sample 121129
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n/// Maximum number of channels supported in the FLAC format.\npub const MAX_CHANNELS: usize = 8;\n\n/// Audio frame that contains one sample for each channel.\npub struct Frame {\n /// Information regarding the current audio frame.\n pub he...
rust
edit
0
0
bsd-3-clause
9eb57b4f9f75b9039e01de27578224dd326b234d
sourrust/flac
src/frame/types.rs
rejected_duplicate
Near-duplicate of sample 121599
true
[ { "role": "user", "content": "Write rust code for the following: Implement function that will simulate expensive calculation" }, { "role": "assistant", "content": "use std::thread;\nuse std::time::Duration;\n\nfn main() {\n simulated_expensive_calculation(2);\n}\n\n\nfn simulated_expensive_ca...
rust
new_file
0
1
mit
fd7739c9d4d9b9e5fe449e80ad2b27f2215c3603
pgrzesik/learning-rust
23_closures/src/main.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\npub fn encode(text: &str) -> String {\n if text.is_empty() {\n return \"\".to_string();\n }\n\n let mut last = text.chars().nth(0).unwrap();\n let mut count = 0;\n\n let mut result = String::new();\n\n for c in text.c...
rust
edit
0
4
bsd-2-clause
6a677478e754b1e042356763ef2a52aa5525d8de
gyn/exercism,gyn/exercism,gyn/exercism,gyn/exercism
rust/run-length-encoding/src/lib.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n// Copyright © 2015, Peter Atashian\n// Licensed under the MIT License <LICENSE.md>\n//! This interface definition contains typedefs for Windows Runtime data types.\nDECLARE_HANDLE!(HSTRING, HSTRING__);\n#[repr(C)] #[derive(Clone, Copy, Debug...
rust
edit
0
0
apache-2.0
05202125da1f47decb7aeb435d3a9dbb8adc1e96
tomaka/winapi-rs,DoumanAsh/winapi-rs,overdrivenpotato/winapi-rs,Connorcpu/winapi-rs,DenisKolodin/winapi-rs,Boddlnagg/winapi-rs,Osspial/winapi-rs,docbrown/winapi-rs,bungcip/winapi-rs,ROki1988/winapi-rs
src/hstring.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse super::*;\n\nmod bad;\nmod doubled_bytes;\nmod ignore_garbage;\nmod pairs;\nmod single_bytes;\nmod wrap;\n\n#[cfg(feature = \"nightly\")]\nmod bench;\n\n#[test]\n// this doesn't really fit anywhere else\nfn correct_b2s_types() {\n #[cf...
rust
edit
1
1
apache-2.0
15a512fa46592bad0fdd195ad067da2582175a91
nuew/base65536
src/test/mod.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nextern crate includedir;\nextern crate phf;\n\ninclude!(concat!(env!(\"OUT_DIR\"), \"/data.rs\"));\n\nfn main() {\n println!(\"{:?}\", FILES.get(\"data/foo\"));\n\n for name in FILES.file_names() {\n println!(\"Found: {}\", name)...
rust
edit
0
2
bsd-3-clause
fc04e3d0fd90b9fc2897df2f27245960b9151b10
tilpner/includedir
example/src/main.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n#![feature(plugin_registrar, quote, rustc_private)]\n\nextern crate syntax;\nextern crate rustc;\n\nuse syntax::codemap::Span;\nuse syntax::parse::token;\nuse syntax::ast::{TokenTree, Ident};\nuse syntax::ext::base::{ExtCtxt, MacResult, Dummy...
rust
edit
0
2
mit
2a7906e8c1ff2d2fd5fee31dbf778c340e50c832
SimonSapin/rust-std-candidates
mod_path/lib.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse cards::Card;\n\n// All these functions need reverse sorted vectors of Cards\npub fn has_pair(card_vec: &Vec<&Card>) -> bool {\n has_set(2, card_vec)\n}\n\nfn has_set(set_size: u8, card_vec: &Vec<&Card>) -> bool {\n let mut prev: &Ca...
rust
edit
0
6
mit
76f2145d90025d1a0f6273548f85d7536d0a409a
JelteF/pokers
src/combos.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n// run-pass\n\n#![feature(try_trait_v2)]\n#![feature(const_trait_impl)]\n#![feature(const_try)]\n#![feature(const_convert)]\n\nfn main() {\n const fn foo() -> Result<bool, ()> {\n Err(())?;\n Ok(true)\n }\n\n const FOO:...
rust
edit
0
2
apache-2.0
aaf902bf8ff406f1dd300ad86b4fb5eeccb4fbe9
aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust
src/test/ui/consts/try-operator.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\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 type ErrorStack = Vec<(ErrorLevel, &'static str)>;\n\n```\n\nApply this change: Add display to...
rust
edit
0
1
apache-2.0
df9b3d861d8c16a5d8029314374f28f553ff55cd
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#![feature(plugin_registrar, quote)]\n#![feature(rustc_private)]\n\nextern crate rustc;\nextern crate syntax;\nextern crate rustc_serialize;\n\nuse rustc::plugin::Registry;\n\nmod plugin;\n\n#[plugin_registrar]\npub fn plugin_registrar(reg: &...
rust
edit
0
1
mit
9d298ddb56a8b7255f4d9aef90d2a39d1c1bfaed
tomjakubowski/json_macros,zsiciarz/json_macros
src/lib.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nmod error;\npub mod reader;\n\n#[test]\nfn it_works() {\n}\n\n```\n\nApply this change: Add `Result<T> `and make `error` module public" }, { "role": "assistant", "content": "pub mod error;\npub mod reader;\n\npub type Result<T> = ...
rust
edit
1
1
apache-2.0
333dab322d3385733d7c69c2951728ce810b6a00
l1048576/fbx_direct
src/lib.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nextern crate urbit;\n\nuse urbit::{ream, unpack_pill};\n\n#[test]\n#[ignore] // FIXME\nfn test_parse_hoon_hoon() {\n use std::fs::File;\n use std::io::prelude::*;\n\n let mut hoon_src = Vec::new();\n File::open(\"assets/hoon.hoon\...
rust
edit
0
1
apache-2.0
dc176df060b0d97076a3518ecfad48f1a836edd2
rsaarelm/urbit-rs
tests/lib.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n/// Maximum number of channels supported in the FLAC format.\npub const MAX_CHANNELS: usize = 8;\n\n/// Audio frame that contains one sample for each channel.\npub struct Frame {\n pub header: Header,\n pub footer: Footer,\n}\n\n/// Channel...
rust
edit
0
0
bsd-3-clause
6545e25cdfce9d9b428359f8110d4195c215808b
sourrust/flac
src/frame/types.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse std::io;\n\nfn main() {\n println!(\"Enter value in Fahrenheit:\");\n\n let mut f = String::new();\n\n io::stdin().read_line(&mut f)\n .expect(\"Failed to read line!\");\n\n let f: f32 = f.trim().parse().expect(\"En...
rust
edit
0
1
mit
c19d8b2fe7c6c29ee96320b733a585a4ecb78f51
pgrzesik/learning-rust
fahrenheit_to_celsius/src/main.rs
accepted
null
true
[ { "role": "user", "content": "Write rust code for the following: Add obtaining of program arguments." }, { "role": "assistant", "content": "///\n/// Should program usage be printed?\n///\n/// # Arguments\n///\n/// * `args` - Program arguments, excluding program name.\n///\npub fn should_print_us...
rust
new_file
2
3
apache-2.0
88753670e59fddcc3e8c4ff0ae555d41e7819749
s3rvac/yabir
src/main.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nextern crate getopts;\nuse std::os;\n\n/// Muxed. A tmux project manager with no runtime dependencies.\n\nmod initializer;\nmod help;\nmod creator;\nmod editor;\n\n/// The main execution method.\n/// Uses getopts to fetch arguments and pass t...
rust
edit
1
1
mit
36eb131cbbb822460c85a4bf8c7356ebdead7c46
brianp/muxed,brianp/muxed
src/main.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nextern crate cc;\nuse cc::ToolFamily::*;\n\nfn main() {\n let mut build = cc::Build::new();\n build.cpp(true);\n let compiler = build.try_get_compiler();\n if compiler.is_ok() && compiler.unwrap().family == Clang {\n build....
rust
edit
0
3
apache-2.0
d2dabb6ae38d5c5ee99a29a0e1b4afad3d8ece4d
grovesNL/spirv_cross,grovesNL/spirv_cross,grovesNL/spirv_cross,grovesNL/spirv_cross
spirv_cross/build.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
afc74d4ecf1d2a2004ef4003dcdba3c280275a3b
hch12907/wiz
src/package/pkg.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse crate::syntax::symbol::{self, Symbol};\nuse crate::syntax::{ExternFn, Types};\nuse proc_macro2::Ident;\n\nconst CXXBRIDGE: &str = \"cxxbridge1\";\n\nmacro_rules! join {\n ($($segment:expr),*) => {\n symbol::join(&[$(&$segment),*...
rust
edit
0
2
apache-2.0
ad3db808d0198e20ad75d6f744a4e926ae660e60
dtolnay/cxx,dtolnay/cxx,dtolnay/cxx,dtolnay/cxx
syntax/mangle.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse std::io::{Write,Result};\nuse std::str;\n\n\npub struct FauxStdout {\n buffer: String\n}\n\n\nimpl FauxStdout {\n pub fn new() -> FauxStdout {\n FauxStdout { buffer: String::new() }\n }\n}\n\n\nimpl Write for FauxStdout {\...
rust
edit
0
2
mit
d577d64d7c60b0807f829057664b4959022740eb
nafarlee/thoughtfuck
tests/common/mod.rs
rejected_duplicate
Near-duplicate of sample 121109
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n#[macro_use] extern crate diesel;\n\nuse diesel::*;\nuse diesel::sql_types::*;\nuse diesel::dsl::*;\n\ntable! {\n users {\n id -> Integer,\n name -> VarChar,\n }\n}\n\nsql_function!(fn lower(x: VarChar) -> VarChar);\n\n#[d...
rust
edit
0
1
apache-2.0
4b8796391412c4e1116e4049dde0b3eb492922ad
diesel-rs/diesel,sgrif/diesel,diesel-rs/diesel,sgrif/diesel
diesel_compile_tests/tests/compile-fail/pg_specific_expressions_cant_be_used_in_a_sqlite_query.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n// Sync available crate categories from `src/categories.txt`.\n// Runs when the server is started.\n\nuse pg;\nuse env;\nuse util::errors::CargoResult;\n\npub fn sync() -> CargoResult<()> {\n let conn = pg::Connection::connect(&env(\"DATAB...
rust
edit
null
null
apache-2.0
2dcec879761b0ac7f67e42f64c6bcf5fb090eebc
rust-lang/crates.io,Susurrus/crates.io,steveklabnik/crates.io,rust-lang/crates.io,steveklabnik/crates.io,steveklabnik/crates.io,rust-lang/crates.io,rust-lang/crates.io,Susurrus/crates.io,Susurrus/crates.io,Susurrus/crates.io,steveklabnik/crates.io
src/categories.rs
rejected_syntax
Syntax error detected by tree-sitter
false
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse nom;\nuse nom::{alpha, alphanumeric, digit, multispace};\nuse std::str::from_utf8;\n\n// Identifier\n// IDENT := /[a-zA-Z_]\\w*/g\nnamed!(ident<&str, &str>, re_match!(r\"[a-zA-Z_]\\w*\"));\n\n// Whitespace\nnamed!(whitespace, chain!(many0...
rust
edit
2
0
mit
d68f62b5c1f08bf194776f6bfe7f71c551052241
Smaragdine/Smaragdine
src/libsmac/src/parser.rs
rejected_duplicate
Near-duplicate of sample 120901
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n/// The meaning of GPS time in the point records.\n#[derive(Clone, Copy, Debug, PartialEq)]\npub enum GpsTimeType {\n /// GPS Week Time (the same as previous versions of LAS).\n Week,\n /// Standard GPS Time minus 1e9.\n Standard,...
rust
edit
0
2
mit
3e62698a059f8a3bbbd782f1e611f404a3dec89d
gadomski/las-rs
src/gps_time_type.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nextern crate document;\n\nuse std::cmp::min;\nuse std::io::File;\nuse std::io::BufferedWriter;\nuse std::io::stdio::stdout_raw;\n\nuse document::parser::Parser;\n\nfn pretty_error(xml: &str, position: uint) -> &str {\n let s = xml.slice_fr...
rust
edit
0
4
mit
fb2d704b2f29459f0f50812c73726a49e864b57e
shepmaster/sxd-document,shepmaster/sxd-document
src/bin/open.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nuse std::fmt::{self, Display};\n\npub(crate) fn display(fmt: impl Fn(&mut fmt::Formatter) -> fmt::Result) -> impl Display {\n DisplayInvoke(fmt)\n}\n\nstruct DisplayInvoke<T>(T);\n\nimpl<T> Display for DisplayInvoke<T>\nwhere\n T: Fn(&m...
rust
edit
0
1
apache-2.0
eb5990843b4650ab820fc503a45682f17e6ca9e7
dtolnay/cxx,dtolnay/cxx,dtolnay/cxx,dtolnay/cxx
src/fmt.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nextern crate ease;\nextern crate rustc_serialize;\n\nuse std::collections::HashMap;\nuse ease::{Url, Request};\n\n#[derive(RustcDecodable, Debug)]\nstruct Response {\n args: HashMap<String, String>,\n data: Option<String>,\n files: O...
rust
edit
0
1
mit
b8220589b2afbb6c1acdcad9f69580e6ab812cef
bluss/ease,SimonPersson/ease
examples/json.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n//! Prefabricated shapes for the glium OpenGL wrapper.\n//!\n//! # Building a shape\n//!\n//! Each shape is constructed using a builder object. The builder objects allow us\n//! to customise the resultant shape.\n//!\n//! In the following exa...
rust
edit
1
0
mit
b266c1453034395a376775aa71f572c3fcaae7cd
jbrd/glium_shapes
src/lib.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\nextern crate docopt;\nextern crate flac;\nextern crate rustc_serialize;\n\n#[macro_use]\nmod commands;\n\nuse std::env;\n\nuse commands::{streaminfo, comments, seektable, picture};\nuse docopt::Docopt;\n\nconst USAGE: &'static str = \"\nUsage...
rust
edit
2
2
bsd-3-clause
510ad6635b065e906b9b667882aaf80001a78ef5
sourrust/flac
examples/metadata.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n// Copyright 2015 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\nuse measure::Measureable;\n\...
rust
edit
null
null
mit
194c11237c01da1d3f86571732fbacc8fbc9713f
poiru/rainmeter-rust
src/skin.rs
rejected_syntax
Syntax error detected by tree-sitter
false
[ { "role": "user", "content": "Here is the current file:\n```rust\n#![feature(prelude_import)]\n//! Test\n#[prelude_import]\nuse std::prelude::v1::*;\n#[macro_use]\nextern crate std;\n/// Test\npub fn test() {}\n\n```\n\nApply this change: Update test case for nightly's new prelude import" }, { "role...
rust
edit
3
1
apache-2.0
8c1f99d5aee5427824147c397f59ce06e3b45982
dtolnay/cargo-expand
tests/lib.expand.rs
accepted
null
true
[ { "role": "user", "content": "Here is the current file:\n```rust\n// Zinc, the bare metal stack for rust.\n// Copyright 2014 Vladimir \"farcaller\" Pouzanov <<EMAIL>>\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...
rust
edit
0
0
apache-2.0
c18fe7fb4cab1544199c8bd95850ca6328d421ee
gapry/zinc,posborne/zinc,0xc0170/zinc,troplin/zinc,richo/zinc,richo/zinc,tempbottle/zinc,posborne/zinc,richo/zinc,ryankurte/zinc,ntwyman/zinc,flxo/zinc,hugwijst/zinc,darayus/zinc,0xc0170/zinc,tempbottle/zinc,hackndev/zinc,troplin/zinc,ryankurte/zinc,troplin/zinc,mcoffin/zinc,mcoffin/zinc,ryankurte/zinc,placrosse/zinc,f...
src/boards/mod.rs
accepted
null
true