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\n#[derive(Debug)]\npub struct Rectangle {\n length: u32,\n width: u32\n}\n\nimpl Rectangle {\n pub fn can_hold(&self, other: &Rectangle) -> bool {\n self.length > other.length && self.width > other.width\n }\n}\n\npub fn add... | rust | edit | 0 | 2 | mit | 0226359e632311b08e24d12906e0bebedf0095ab | pgrzesik/learning-rust | testing/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::io::{self, Write, BufWriter};\n\nuse terminal::Terminal;\n\npub struct Interface {\n lines: Vec<String>,\n terminal: Terminal,\n}\n\nimpl Interface {\n pub fn new(lines: Vec<String>) -> Interface {\n Interface {\n ... | rust | edit | 1 | 3 | mit | 9b22564d80c053d087709b34419ea3c8bfd650ea | stewart/rff,stewart/rff | src/interface.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse criterion::*;\nuse ion_shell::parser::Terminator;\nuse std::time::Duration;\n\nconst TEXT: &str = include_str!(\"test.ion\");\nconst EOF: &str = include_str!(\"herestring.ion\");\n\nfn criterion_benchmark(c: &mut Criterion) {\n c.bench... | rust | edit | 1 | 3 | mit | e6235da7f5d9c2056a3b572587f2af5fcdb48100 | redox-os/ion,redox-os/ion,redox-os/ion | benches/terminator.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![cfg_attr(feature = \"unstable\", feature(custom_derive, plugin, custom_attribute, rustc_macro))]\n#![cfg_attr(feature = \"unstable\", plugin(diesel_codegen_old, dotenv_macros))]\n\nextern crate quickcheck;\n#[macro_use] extern crate assert... | rust | edit | 1 | 0 | apache-2.0 | faedd812a140188035dffe17634352760cf3c6ff | diesel-rs/diesel,sgrif/diesel,sgrif/diesel,diesel-rs/diesel | diesel_tests/tests/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate machinelearning;\n\nuse machinelearning::vector::Vector;\nuse machinelearning::linear_regression::LinearRegression;\n\nfn main() {\n let xs = Vector::from_slice(&[1.0,2.0,4.0,0.0]);\n let ys = Vector::from_slice(&[0.5,1.0,2... | rust | edit | 0 | 1 | mit | e0b6af58f7c71b8032113ad087122c911350112b | kubkon/machine-learning | examples/linear_regression.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n\npub use selector::*;\npub use theme::*;\n\npub mod prelude;\nmod selector;\nmod theme;\n\n```\n\nApply this change: Add description to theme crate."
},
{
"role": "assistant",
"content": "/*!\n\nThis crate provides functions to l... | rust | edit | 3 | 0 | mit | c841593a679fa7bf9b70a52157e8c39c8d7a3262 | redox-os/orbtk | crates/css-engine/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Copyright 2016 Alex Regueiro\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 copy of the License at\n//\n// http://www.apac... | rust | edit | 1 | 1 | apache-2.0 | 51dd65627267b251c5c73c9a95e76a8ea20c47fd | kaedroho/rust-rocksdb,spacejam/rust-rocksdb,kaedroho/rust-rocksdb,tempbottle/rust-rocksdb,tempbottle/rust-rocksdb,tempbottle/rust-rocksdb,spacejam/rust-rocksdb,kaedroho/rust-rocksdb,spacejam/rust-rocksdb | src/ffi_util.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: net/eth: Add definition of type EthernetCallbacks"
},
{
"role": "assistant",
"content": "//! Useful callbacks used by ethernet's specific filter\n\nuse boxed::Box;\n\nuse net::Packet;\n\nuse net::defs::{Rule, EthernetRule, EtherTyp... | rust | new_file | 0 | 2 | mit | 4558c9d062e28ce114317b953a7f1256a8867441 | uni-rs/uni.rs | src/net/eth/callbacks.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![doc(hidden)]\n\nmacro_rules! doc_comment {\n ($x:expr, $($tt:tt)*) => {\n #[doc = $x]\n $($tt)*\n };\n}\n\nmacro_rules! int_module {\n ($T:ident) => (int_module!($T, #[stable(feature = \"rust1\", since = \"1.0.0\")])... | rust | edit | 2 | 0 | apache-2.0 | 55e37f9f02af4eec5c52413e3219bef838beadab | aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust | src/libcore/num/int_macros.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[derive(Deserialize)]\npub struct Config {\n hostname: String,\n username: String,\n password: String,\n}\n```\n\nApply this change: :art: Change property scope to public"
},
{
"role": "assistant",
"content": "#[derive(D... | rust | edit | 0 | 1 | mit | c0d4ab69d66ee3d68565681709b53b87a815ba0f | dorayakikun/alfred_jira_workflow | src/config.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// ignore-windows: Concurrency on Windows is not supported yet.\n\n// Joining the same thread from multiple threads is undefined behavior.\n\n#![feature(rustc_private)]\n\nextern crate libc;\n\nuse std::thread;\nuse std::{mem, ptr};\n\nextern... | rust | edit | 0 | 2 | apache-2.0 | eaa63266d8456ac8c3d1b82f4e1078fcd271e95c | rust-lang/miri,rust-lang/miri,rust-lang/miri,rust-lang/miri | tests/compile-fail/concurrency/libc_pthread_join_multiple.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[derive(Deserialize)]\npub struct DcaMetadata {\n opus: OpusInfo,\n}\n\n#[derive(Deserialize)]\nstruct OpusInfo {\n /// Bitrate per second\n abr: u32,\n /// Number of channels\n channels: u8,\n /// Frame size in bytes\n ... | rust | edit | 0 | 1 | isc | 628301ed347e2a037bfff72d239c0c3ce0af366e | Roughsketch/serenity | src/voice/dca.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! MIPS\n\n// Building this module (even if unused) for non-fp64 targets such as the Sony\n// PSP fails with an LLVM error. There doesn't seem to be a good way to detect\n// fp64 support as it is sometimes implied by the target cpu, so\n// `... | rust | edit | 0 | 1 | apache-2.0 | ec6fccd34c30003a7ebf4e7a9dfe4e31f5b76e1b | rust-lang/stdarch,rust-lang/stdarch,rust-lang/stdarch,rust-lang/stdarch,rust-lang/stdarch | crates/core_arch/src/mips/mod.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Copyright 2013 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 | 3503d0bcd19d9c6ce80961fd1d972afb64963cd9 | ruud-v-a/rust,nwin/rust,dwillmer/rust,pczarn/rust,robertg/rust,zaeleus/rust,emk/rust,seanrivera/rust,barosl/rust,kwantam/rust,untitaker/rust,michaelballantyne/rust-gpu,aepsil0n/rust,servo/rust,servo/rust,richo/rust,jroesch/rust,pczarn/rust,barosl/rust,avdi/rust,mvdnes/rust,mvdnes/rust,pelmers/rust,krzysz00/rust,0x73/ru... | src/test/run-pass/deriving-self-lifetime-totalord-totaleq.rs | rejected_duplicate | Near-duplicate of sample 120782 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![feature(allow_internal_unstable)]\n#![feature(bench_black_box)]\n#![feature(extend_one)]\n#![feature(iter_zip)]\n#![feature(unboxed_closures)]\n#![feature(test)]\n#![feature(fn_traits)]\n\npub mod bit_set;\npub mod vec;\n\n// FIXME(#56935)... | rust | edit | 4 | 0 | apache-2.0 | 998753c6f7a47cfa4072c73d5166d85d55d1187a | aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust | compiler/rustc_index/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Regression test for issue #63263.\n// Tests that we properly handle closures with an explicit return type\n// that return an opaque type.\n\n// run-pass\n\n#![feature(type_alias_impl_trait)]\n\npub type Closure = impl FnOnce();\n\nfn main(... | rust | edit | 0 | 3 | apache-2.0 | e8d55d0a43640cd4bdff98b59e962fba006fb819 | graydon/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust | src/test/ui/type-alias-impl-trait/issue-63263-closure-return.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! Less used details of `CxxVector` are exposed in this module. `CxxVector`\n//! itself is exposed at the crate root.\n\npub use crate::cxx_vector::{Iter, IterMut};\n#[doc(no_inline)]\npub use crate::CxxVector;\n#[doc(inline)]\npub use crate... | rust | edit | 0 | 0 | apache-2.0 | 676bb463840c9d5bef87cdd7fe99528d23ec603d | dtolnay/cxx,dtolnay/cxx,dtolnay/cxx,dtolnay/cxx | src/vector.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// ignore-windows: File handling is not implemented yet\n// compile-flags: -Zmiri-disable-isolation\n\nuse std::fs::{File, remove_file};\nuse std::io::{Read, Write};\n\nfn main() {\n let path = \"./tests/hello.txt\";\n let bytes = b\"He... | rust | edit | 1 | 1 | apache-2.0 | 00792493ef65da150ce5d3e4cc7c15660ce1b54a | rust-lang/miri,rust-lang/miri,rust-lang/miri,rust-lang/miri,tsion/miri | tests/run-pass/file_manipulation.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::env;\nuse self_update;\nuse multirust::Result;\nuse clap::{App, Arg};\n\npub fn main() -> Result<()> {\n let args: Vec<_> = env::args().collect();\n let arg1 = args.get(1).map(|a| &**a);\n\n // Secret command used during sel... | rust | edit | null | null | apache-2.0 | ee6a8832cc9e606105e9b591cb4d2b57b65a4f01 | Boddlnagg/rustup.rs,nodakai/rustup.rs,rust-lang/rustup,nodakai/rustup.rs,polonez/rustup.rs,inejge/rustup.rs,nodakai/rustup.rs,rust-lang/rustup,nodakai/rustup.rs,theindigamer/rustup.rs,polonez/rustup.rs,rust-lang/rustup,Boddlnagg/rustup.rs,inejge/rustup.rs,Boddlnagg/rustup.rs,theindigamer/rustup.rs,rust-lang/rustup,noda... | src/multirust-cli/setup_mode.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![feature(custom_attribute)]\n#![allow(dead_code, unused_attributes)]\n\n#[miri_run(expected = \"Int(1)\")]\nfn ret() -> i32 {\n 1\n}\n\n#[miri_run(expected = \"Int(-1)\")]\nfn neg() -> i32 {\n -1\n}\n\n#[miri_run(expected = \"Int(3)\"... | rust | edit | 0 | 1 | apache-2.0 | 3f0eac2c7848a95e84f965e1225e2110da7ae0fa | graydon/rust,GBGamer/rust,graydon/rust,graydon/rust,rust-lang/miri,GBGamer/rust,tsion/miri,graydon/rust,aidancully/rust,rust-lang/miri,rust-lang/miri,aidancully/rust,GBGamer/rust,graydon/rust,GBGamer/rust,aidancully/rust,aidancully/rust,GBGamer/rust,aidancully/rust,graydon/rust,rust-lang/miri,aidancully/rust,GBGamer/ru... | test/basic.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::thread;\nuse std::sync::mpsc;\nuse std::time::Duration;\n\nfn main() {\n let (tx, rx) = mpsc::channel();\n\n thread::spawn(move || {\n let vals = vec![\n String::from(\"Hello there\"),\n String::fro... | rust | edit | 0 | 6 | mit | c10d5935a29ce47e34cb6369e228edc3834733cc | pgrzesik/learning-rust | 27_message_passing/src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse self::ImproperCtype::*;\nuse crate::syntax::atom::Atom::{self, *};\nuse crate::syntax::{Type, Types};\nuse proc_macro2::Ident;\n\npub enum ImproperCtype<'a> {\n Definite(bool),\n Depends(&'a Ident),\n}\n\nimpl<'a> Types<'a> {\n /... | rust | edit | 0 | 5 | apache-2.0 | 6edd2d2a5968dbea1e4c11c725ee4ec2ecff95a0 | dtolnay/cxx,dtolnay/cxx,dtolnay/cxx,dtolnay/cxx | syntax/improper.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::rand;\nuse std::rand::Rng;\n\nfn main() {\n\tprintln(\"Secret Santa\");\n\n\tlet names = ~[\"Angus\", \"Greg\", \"Lewis\", \"Mike\", \"Isabel\", \"Rob\", \"Shannon\", \"Allan\"];\n\n\tlet pairings = secret_santa(&names);\t\n\n\tprint... | rust | edit | null | null | unlicense | 8036529980702e6e9c033188c090d6e9d62c00e2 | AetherWorks/SecretSanta,AetherWorks/SecretSanta,AetherWorks/SecretSanta,AetherWorks/SecretSanta,AetherWorks/SecretSanta | rust/secret-santa.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![feature(zero_one, box_syntax)]\n\nextern crate asexp;\n\npub mod num_expr;\npub mod cond;\n\nuse std::fmt::Debug;\nuse std::cmp::{PartialEq, PartialOrd};\n\n#[derive(Debug, Eq, PartialEq)]\npub enum ExpressionError {\n /// In case of di... | rust | edit | 1 | 0 | mit | 5a9d030df8018a93389360dc1fa68d08fb681ff7 | mneumann/expression-rs | src/lib.rs | rejected_duplicate | Near-duplicate of sample 120090 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![crate_type = \"lib\"]\n#![warn(missing_docs)]\n\n//! Synchronization primitives based on spinning\n\n#![cfg_attr(feature = \"asm\", feature(asm))]\n#![cfg_attr(feature = \"core_intrinsics\", feature(core_intrinsics))]\n#![cfg_attr(feature ... | rust | edit | 3 | 0 | mit | 020f1b3f160a1facf54355278af14cbf6a1613fd | mvdnes/spinlock-rs,mvdnes/spin-rs | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![feature(test)]\n\nextern crate indolentjson;\nextern crate test;\n\nuse indolentjson::strings::*;\nuse test::Bencher;\n\n\n#[bench]\nfn noop_escape(b: &mut Bencher) {\n b.iter(|| {\n escape_bytes(b\"test\")\n });\n}\n\n#[bench... | rust | edit | 0 | 2 | apache-2.0 | bc8d5157345afb9be37c2e56ec8e284f8dab48ce | NegativeMjark/indolentjson-rust | benches/strings.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 | 3 | apache-2.0 | c61baa0fc7a85bd2bcce34aac05ed739261cf037 | aidancully/rust,GBGamer/rust,aidancully/rust,GBGamer/rust,graydon/rust,aidancully/rust,GBGamer/rust,aidancully/rust,aidancully/rust,aidancully/rust,GBGamer/rust,graydon/rust,graydon/rust,graydon/rust,GBGamer/rust,GBGamer/rust,GBGamer/rust,graydon/rust,GBGamer/rust,graydon/rust | src/libstd/sys/redox/path.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse crate::ToTokens;\nuse proc_macro2::{Span, TokenStream};\n\npub trait Spanned {\n fn __span(&self) -> Span;\n}\n\nimpl Spanned for Span {\n fn __span(&self) -> Span {\n *self\n }\n}\n\nimpl<T: ToTokens> Spanned for T {\n ... | rust | edit | 0 | 3 | apache-2.0 | 6f736c24574667097bdf8fc100d025dc81a88141 | dtolnay/quote | src/spanned.rs | rejected_duplicate | Near-duplicate of sample 119975 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! Check that functions don't accept an \"excessive\" number of arguments. \n\nuse syntax::ast::{Block, FnDecl, NodeId};\nuse syntax::codemap::Span;\nuse syntax::visit::FnKind;\nuse rustc::lint::{Context, LintArray, LintPass};\n\nconst MAX_A... | rust | edit | 0 | 2 | mit | c5cb73710af9a949f9878b503188e9648d6d858e | SeanHeelan/pedantrs | src/lints/function_arg_count.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\npub mod der;\npub mod rsa;\n\n/// Helper function to encrypt mysql password using a public key loaded from a server.\npub fn encrypt(pass: &[u8], key: &[u8]) -> Vec<u8> {\n let pub_key = self::rsa::PublicKey::from_pem(key);\n let rng = ... | rust | edit | 1 | 1 | apache-2.0 | f9b8e90c08e190f25fdfa97b6c8131dd2d1805a6 | blackbeam/rust_mysql_common,blackbeam/rust_mysql_common | src/crypto/mod.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[rustversion::not(nightly)]\n#[ignore]\n#[test]\nfn test_backtrace() {}\n\n#[rustversion::nightly]\n#[test]\nfn test_backtrace() {\n use anyhow::anyhow;\n\n let error = anyhow!(\"oh no!\");\n let _ = error.backtrace();\n}\n\n```\n\n... | rust | edit | 0 | 1 | apache-2.0 | 8d25d6b2c9bb04c9f0d222ed6b900f696c0e7ebe | dtolnay/anyhow | tests/test_backtrace.rs | rejected_duplicate | Near-duplicate of sample 120815 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse core::prelude::*;\nuse core::fmt;\n\n#[lang=\"eh_personality\"]\npub fn eh_personality() { }\n\n#[lang=\"panic_fmt\"]\nextern fn panic_fmt(fmt: fmt::Arguments, file: &'static str, line: usize) -> ! {\n println!(\"panic: {}\", fmt);\n ... | rust | edit | 2 | 1 | mit | 43e9444e4eed1b8dc6502c290a20bff26a3e87b8 | anchovieshat/cathode-old,anchovieshat/cathode-old,anchovieshat/cathode-old | kernel/src/lang.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![feature(collections)]\n#![feature(core)]\n\nfn main() {\n // (all the type annotations are superfluous)\n // A reference to a string allocated in read only memory\n let pangram: &'static str = \"the quick brown fox jumps over the ... | rust | edit | 1 | 3 | apache-2.0 | 3720514ab70a219152ebc7297f2462b47cdb07c8 | sohan99/rust-by-example,narutosanjiv/rust-by-example,zhjh1209/rust-by-example,MatejLach/rust-by-example,narutosanjiv/rust-by-example,youprofit/rust-by-example,nodakai/rust-by-example,rwaldron/rust-by-example,realcr/rust-by-example,rwaldron/rust-by-example,shaleh/rust-by-example,jinyuanxie/rust-by-example-cn,chriskrycho... | examples/str/str.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Test dropping an AioCb that hasn't yet finished.\n// This must happen in its own process, because on OSX this test seems to hose\n// the AIO subsystem and causes subsequent tests to fail\n#[test]\n#[should_panic(expected = \"Dropped an in-... | rust | edit | 0 | 1 | mit | 4ff5595a1b1dbf06194144a128c5db70b2cf7491 | carllerche/nix-rust,geofft/nix-rust,asomers/nix,carllerche/nix-rust,geofft/nix-rust,geofft/nix-rust,asomers/nix,nix-rust/nix,nix-rust/nix,carllerche/nix-rust | test/sys/test_aio_drop.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse super::effect::{Effect, EffectRenderState};\nuse partial::Partial;\n\n/// The output for a Sum effect is the sum of all partials sent to any of its\n/// slots.\npub struct Sum;\n\npub struct SumProcessIter {\n partial : Option<Partial>... | rust | edit | 0 | 2 | mit | 7da06be87ae4f61a1622bbc4711c28f655fa7b34 | Wallacoloo/libfriendship | src/effects/sum.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse core::fmt;\n\nuse ::xen::sched::crash;\n\n#[cfg(not(test))]\n#[lang = \"stack_exhausted\"]\npub fn stack_exhausted() -> ! {\n unimplemented!()\n}\n\n#[cfg(not(test))]\n#[lang = \"eh_personality\"]\npub fn eh_personality() -> ! {\n u... | rust | edit | 1 | 1 | mit | 13d1d26453f1f89d9d1cb8a82cc016bc0b71213d | uni-rs/uni.rs | src/utils/lang.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// ignore-windows: Concurrency on Windows is not supported yet.\n\n//! Check that destructors of the library thread locals are executed immediately\n//! after a thread terminates.\n//!\n//! FIXME: We should have a similar test for thread-loca... | rust | edit | 2 | 2 | apache-2.0 | 8240ed26a97a6d1642546e56144870305ff4676c | rust-lang/miri,rust-lang/miri,rust-lang/miri,rust-lang/miri | tests/run-pass/concurrency/tls_lib_drop.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate serde;\nextern crate serde_json;\n\nuse hyper::Client;\nuse hyper::client::{Response};\nuse hyper::header::Headers;\nuse hyper::net::HttpsConnector;\nuse hyper_native_tls::NativeTlsClient;\nuse hyper::status::StatusCode;\nuse jir... | rust | edit | 0 | 3 | mit | 37089307c9e41233372b0c47b6175b2935c93019 | dorayakikun/alfred_jira_workflow | src/jira_client.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! Library for reading and writing Elasto Mania files.\n\n#![doc(html_root_url = \"https://hexjelly.github.io/elma-rust/\")]\n#![feature(slice_patterns)]\n#![feature(plugin)]\n#![plugin(clippy)]\n\nextern crate byteorder;\n\npub mod lev;\npu... | rust | edit | 2 | 5 | mit | c00629fe37786654d8bc8b07dd039d5db9d0e480 | hexjelly/elma-rust | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\npub use super::*;\nuse kafka::producer::{Producer, RequiredAcks};\nuse kafka;\nuse kafka::consumer::Consumer;\nuse std::time::Duration;\n\npub fn test_producer() -> Producer {\n Producer::from_hosts(vec![LOCAL_KAFKA_BOOTSTRAP_HOST.to_owned... | rust | edit | 2 | 3 | mit | 7815b1d7629fcfc9530d15ba14731bb41f32ba00 | spicavigo/kafka-rust,spicavigo/kafka-rust | tests/integration/consumer_producer/mod.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate rayon;\n\nuse std::rc::Rc;\n\nfn main() {\n rayon::join(|| Rc::new(22), || Rc::new(23));\n //~^ ERROR E0277\n //~| ERROR E0277\n}\n\n```\n\nApply this change: Split up the test of join returning Rc\n\nIt seems that curre... | rust | edit | 0 | 5 | apache-2.0 | 8b71c865b2d66c581476e4e7b4870840ba691aa2 | cuviper/rayon,cuviper/rayon | tests/compile-fail/rc_return.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::process::Command;\nuse std::process::exit;\nuse std::os::unix::process::CommandExt;\n\nfn main() {\n let err = Command::new(\"java\")\n .arg(\"-Xms512m\")\n .arg(\"-Xmx1536m\")\n .arg(\"-Xss2m\")\n .arg... | rust | edit | 2 | 2 | apache-2.0 | 0e5a2a44fc9ca89680d1b70e45b74ae1721aa003 | dwijnand/sbtl,dwijnand/sbtl | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::{\n future::Future,\n io::{self, Error},\n time::Duration,\n};\n\nuse tokio::time;\n\npub async fn try_timeout<T, E, F>(fut: F, timeout: Option<Duration>) -> io::Result<T>\nwhere\n F: Future<Output = Result<T, E>>,\n E... | rust | edit | 0 | 4 | mit | 8ca9d0ada45932e5e958b95cb8d2a7d1e9c2f103 | zonyitoo/shadowsocks-rust,shadowsocks/shadowsocks-rust,shadowsocks/shadowsocks-rust,shadowsocks/shadowsocks-rust,shadowsocks/shadowsocks-rust | src/relay/utils.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![no_std]\n\n\nmod entities;\n\n\npub use entities::ENTITIES;\n\n\n#[cfg(test)]\nmod tests {\n extern crate std;\n use self::std::collections::HashMap;\n use super::ENTITIES;\n\n #[test]\n fn sanity() {\n let found = EN... | rust | edit | 0 | 1 | mit | 4966c2f514577c2c5f6f5ee4640d2926652a74e5 | p-jackson/entities | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\npub trait Environment {\n fn reward(&self) -> f64;\n fn observation(&self) -> i16;\n\n fn update(&mut self, action: i16);\n}\n\npub struct CoinFlip {\n last_toss: bool,\n}\n\nimpl CoinFlip {\n pub fn new() -> CoinFlip {\n CoinFlip {\n... | rust | edit | 1 | 2 | mit | eb9fd2dff39bb244823d0aaad9118a72ae588f5b | dinowernli/marvin | src/environment.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Systray Lib\n\n#[macro_use]\nextern crate log;\n#[cfg(target_os = \"windows\")]\nextern crate winapi;\n#[cfg(target_os = \"windows\")]\nextern crate kernel32;\n#[cfg(target_os = \"windows\")]\nextern crate user32;\n#[cfg(target_os = \"wind... | rust | edit | 1 | 2 | bsd-3-clause | f5372efa7400f95556788aeee43b2ce86426c88f | qdot/systray-rs,qdot/systray-rs | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse uuid::Uuid;\n\npub fn allocate_element_key() -> String {\n let uuid_ = format!(\"{}\", Uuid::new_v4());\n format!(\"{0:.8}\", uuid_)\n}\n\n```\n\nApply this change: Reduce length of generated element key components to 3 chars."
},... | rust | edit | 0 | 1 | mit | 7c993a0701ffbb41a537584250acd71c6d15f590 | tmzt/isymtope,tmzt/isymtope,tmzt/isymtope,tmzt/isymtope | src/parser/util.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::env;\nuse hyper::Client;\nuse hubcaps::{Github, ReleaseOptions};\nuse error::Error;\nuse super::USERAGENT;\n\npub fn release(tag_name: &str, tag_message: &str) -> Result<(), Error> {\n let token = try!(env::var(\"GITHUB_TOKEN\"));... | rust | edit | null | null | mit | 30a4f7e6def3e0ad7c678502e97d2cf61d040a30 | semantic-rs/semantic-rs,semantic-rs/semantic-rs | src/github.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\npub mod ffi;\npub mod fs;\npub mod io;\n\n/// A prelude for conveniently writing platform-specific code.\n///\n/// Includes all extension traits, and some important type definitions.\n#[stable(feature = \"rust1\", since = \"1.0.0\")]\npub mod... | rust | edit | 1 | 0 | apache-2.0 | 83bd3d3975bd56e0bd959b5df8129e4ee21aeca3 | graydon/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust | src/libstd/sys/wasi/ext/mod.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate editorconfig;\nextern crate argparse;\n\nuse editorconfig::*;\nuse argparse::{ArgumentParser, Store, List, Print};\nuse std::path::Path;\n\nfn main() {\n let mut conf_filename = \".editorconfig\".to_string();\n let mut vers... | rust | edit | 0 | 6 | mit | 7fb87279069c4cfc241837bb6ae7ea77d38b1322 | mrandri19/rust-editorconfig | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate rand;\n\nuse std::io::Read;\nuse std::fs::File;\nuse rand::Rng;\n\nconst DICT_FILE: &'static str = \"/usr/share/dict/words\";\n\nfn main() {\n let mut dict = File::open(DICT_FILE).unwrap();\n // Not ideal, but whatever.\n ... | rust | edit | 0 | 3 | mit | 4aa7803951baede7eaf2460be48ae9690c19bba2 | richo/pwrs | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![cfg(target_pointer_width = \"64\")]\n\nuse std::mem;\nuse syn::{Expr, Item, Lit, Pat, Type};\n\n#[test]\nfn test_expr_size() {\n assert_eq!(mem::size_of::<Expr>(), 264);\n}\n\n#[test]\nfn test_item_size() {\n assert_eq!(mem::size_of:... | rust | edit | 1 | 1 | apache-2.0 | 20087fc51ceb753b86cba41fee8d4644a569fea8 | dtolnay/syn | tests/test_size.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate hyper;\nextern crate json;\n\nmod request;\nmod 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: &str) -... | rust | edit | 1 | 1 | mit | 8069ae01fef6efd5ed0961232a0c2bd8f8983ec6 | imp/requests-rs | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate gcc;\n\nfn main() {\n let root = Path::new(std::os::getenv(\"CARGO_MANIFEST_DIR\").unwrap())\n .join(\"libogg\");\n\n let config = gcc::Config {\n include_directories: vec![\n root.join(\"include\")... | rust | edit | 0 | 1 | bsd-3-clause | 888111da2690bebe5eb2d3bcc21533aa284153ca | tomaka/ogg-sys,tomaka/ogg-sys | libogg/build.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![feature(test)]\n#[cfg(test)]\n\nextern crate congalife;\nextern crate test;\n\nuse congalife::Game;\nuse test::Bencher;\n\n#[bench]\nfn bench_new_game_64(b: &mut Bencher) {\n b.iter(|| Game::new(64, 0.2));\n}\n\n#[bench]\nfn bench_new_g... | rust | edit | 1 | 2 | mit | 4f86ac5af5ab3b6341c0de3e48155752fc95b1c7 | apostrophest/rust-congalife | benches/new_game.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate lopdf;\nuse lopdf::{Document};\n\n#[macro_use]\nextern crate clap;\nuse clap::{App, Arg};\n\nfn main() {\n\tlet arguments = App::new(\"PDF utility program using lopdf library\")\n\t\t.version(crate_version!())\n\t\t.author(crate_... | rust | edit | 0 | 5 | mit | 034ccad64b35b849e471e85a15ebf1dbd981e95a | J-F-Liu/lopdf | pdfutil/src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse super::{DataStore, DataStoreError};\nuse std::collections::HashMap;\n\npub type HashMapStore = HashMap<String,String>;\n\n/// Implement the DataStore methods for HashMap\nimpl DataStore for HashMapStore {\n\n fn store(&mut self, key: &... | rust | edit | 0 | 1 | mit | b813b76983308fa7897e51a2d5359cc13500030e | coredump-ch/spaceapi | spaceapi_server/src/datastore/hash_map_store.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse tool::*;\n\n///\n/// Represents a tooling environment, which enables tools to be retrieved by name.\n///\n/// Environments make it possible to use tools without needing to know where the\n/// precise implementation is located. Environment... | rust | edit | 0 | 0 | apache-2.0 | 806620a53c78b44326dca6f53f0adc81d748629f | Logicalshift/gossyp,Logicalshift/gossyp | src/environment.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![allow(unknown_lints)]\n#![allow(while_let_on_iterator)]\n\n// For a performance boost on Linux\n// #![feature(alloc_system)]\n// extern crate alloc_system;\n\nextern crate fnv;\nextern crate glob;\nextern crate liner;\nextern crate smallve... | rust | edit | 2 | 4 | mit | b86941d8a159466c8d4c953ad4a0f4f5130aacca | redox-os/ion,jwbowen/ion,bheesham/ion,bheesham/ion,redox-os/ion,redox-os/ion,jwbowen/ion | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![no_std]\n\n#[macro_use]\nextern crate static_assertions;\n\ntrait Tri<A: ?Sized, B: ?Sized, C: ?Sized> {}\n\nimpl<T, A: ?Sized, B: ?Sized, C: ?Sized> Tri<A, B, C> for T {}\n\nassert_impl!(tri; u64, Tri<[&'static u8], Send, (u16, u16)>);\na... | rust | edit | 0 | 1 | apache-2.0 | 4524154386d12b1b507f0f35fee6cca3d1f9e2ec | nvzqz/static-assertions-rs | tests/trait_impl.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Define the tag for describing basic memory information."
},
{
"role": "assistant",
"content": "use tag::TagType;\n\n\nstruct BasicMemoryInformationTag {\n\ttag_type: u32,\n\tsize: u32,\n\tmem_lower: u32,\n\tmem_upper: u32,\n}\n\nim... | rust | new_file | 0 | 2 | apache-2.0 | d0d1d16ed72a8bb7115ee664f4455b2a5c0dbb16 | stallmanifold/rust-multiboot2 | src/basic_memory_information.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse primal_bit::BitVec;\n\npub struct BehavioralBitvec {\n bitvec: BitVec,\n bitpos: usize,\n}\n\nimpl BehavioralBitvec {\n pub fn new(n: usize) -> Self {\n BehavioralBitvec {\n bitvec: BitVec::from_elem(n, false),\... | rust | edit | 1 | 2 | mit | ac9ca231b5f4c85064569d67361ff7a2b98947c6 | mneumann/hypernsga,mneumann/hypernsga | src/behavioral_bitvec.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::env;\nuse tougou_bot::commands::{ pic::PicCommand, ping::PingCommand, status::StatusCommand };\nuse tougou_bot::discord_client::*;\n\nfn main() {\n let token: String =\n env::var(\"DISCORD_TOKEN\").expect(\"Must set the env... | rust | edit | 0 | 1 | mit | 0da5095e5f5990409bf5aac41cc37515c6ed6c4f | Hammatt/tougou_bot | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::vec::Vec;\n\nuse engine::{Actor, Map};\nuse engine::builders::MapFromString;\nuse util::units::{Direction, Point};\n\npub struct World {\n pub player: Actor,\n pub actors: Vec<Actor>,\n pub map: Map,\n}\n\nimpl World {\n\n ... | rust | edit | 0 | 2 | bsd-3-clause | ed88340b0b356b177dcad9d388fa7cbe54e29c06 | jgilchrist/rslike | src/engine/world.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[allow(dead_code)]\nfn add_xcode_private_framework_path() {\n // PrivateFramework dir:\n // `xcode-select -p`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/PrivateFrameworks/\n let xcode_dir = std::process::Comm... | rust | edit | 3 | 1 | apache-2.0 | 08a92a0e643e942911799c9ee8becaae1b30d7e9 | mrmekon/rubrail-rs | build.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\npub fn sing(start: u32, end: u32) -> String {\n let mut song = String::new();\n for i in (end..start+1).rev() {\n song.push_str(&verse(i));\n song.push_str(\"\\n\");\n }\n song.pop();\n song\n}\n\npub fn verse(n: ... | rust | edit | 0 | 2 | mit | 27c3d7c71dfd7c2926ca174d3cb88805ad44be22 | ragnese/exercism-rust | beer-song/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\npub fn score(string: &str) -> usize {\n string\n .chars()\n .map(|c| match c {\n 'A' | 'E' | 'I' | 'O' | 'U' | 'L' | 'N' | 'R' | 'S' | 'T' => 1,\n 'a' | 'e' | 'i' | 'o' | 'u' | 'l' | 'n' | 'r' | 's' | 't... | rust | edit | 2 | 3 | bsd-2-clause | 74a020d6c6e072aad73963f5d0f3e331ec723421 | gyn/exercism,gyn/exercism,gyn/exercism,gyn/exercism | rust/scrabble-score/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse crate::error::{Error,\n Result};\npub use crate::os::system::{uname,\n Uname};\nuse std::net::{IpAddr,\n UdpSocket};\n\nstatic GOOGLE_DNS: &str = \"8.8.8.8:53\";\n\npub fn ip() ->... | rust | edit | 0 | 4 | apache-2.0 | 0d514703cbc31e0c043a8254db7fdcb807ab588a | habitat-sh/habitat,habitat-sh/habitat,rsertelon/habitat,rsertelon/habitat,habitat-sh/habitat,rsertelon/habitat,rsertelon/habitat,habitat-sh/habitat,habitat-sh/habitat,habitat-sh/habitat,habitat-sh/habitat,rsertelon/habitat,rsertelon/habitat,rsertelon/habitat,habitat-sh/habitat | components/core/src/util/sys.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![cfg(test)]\nuse std::cell::RefCell;\nuse std::rc::Rc;\n\nuse alloc::AllocBox;\nuse js_types::js_obj::JsObjStruct;\nuse js_types::js_str::JsStrStruct;\nuse js_types::js_var::{JsKey, JsPtrEnum, JsType, JsVar};\nuse js_types::binding::Binding... | rust | edit | 0 | 1 | mit | e56805598e906d18ac3c4ef5b083453cebb15aa7 | rustoscript/french-press | src/test_utils/mod.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse hyper::client::Client;\nuse hyper::client::response::Response;\nuse hyper::error::Error;\nuse hyper::header::Headers;\nuse hyper::method::Method;\n\n/// Trait that represents some methods to send a specific request\npub trait GetResponse ... | rust | edit | 0 | 2 | mit | ddcf6a7d348665accf0b59ef2f7a19c0a103144d | derniercri/snatch | src/client.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate tar;\nextern crate flate2;\n\nuse std::fs::File;\nuse std::io::{BufReader, Read, Write};\nuse std::path::Path;\n\nuse self::tar::Archive;\nuse self::flate2::read::GzDecoder;\n\nfn extract_tar(input: &Path, output: &Path) {\n l... | rust | edit | 0 | 4 | bsd-3-clause | 7c8fa41625fd17c73876420e300e7c787cb056f6 | hch12907/wiz | src/wiz/extraction.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate bip_handshake;\nextern crate bip_metainfo;\nextern crate bip_util;\nextern crate rotor;\nextern crate rotor_stream;\n#[macro_use]\nextern crate nom;\n\nmod disk;\nmod message;\nmod piece;\nmod protocol;\nmod registration;\nmod to... | rust | edit | 0 | 0 | apache-2.0 | b884243cbca9cced860abb132220385c995d32ee | GGist/redox-rs | bip_peer/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::fmt::Display;\nuse thiserror::Error;\n\n#[derive(Error, Debug)]\n#[error(\"braced error: {}\", msg)]\nstruct BracedError {\n msg: String,\n}\n\n#[derive(Error, Debug)]\n#[error(\"braced error\")]\nstruct BracedUnused {\n extra:... | rust | edit | 0 | 1 | apache-2.0 | f7e48a99b3c72eca2eae0f66626d0b65927f8bf4 | dtolnay/thiserror | tests/test_display.rs | accepted | null | true |
[
{
"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!(identx<&str, &str>, re_match!(r\"[a-zA-Z_]\\w*\"));\n\n// Whitespace\nnamed!(whitespace, chain!(many... | rust | edit | 2 | 0 | mit | 5291b845695c8482774f326a192bb7ae09f7758a | Smaragdine/Smaragdine | src/libsmac/src/parser.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate scroll_phat_hd;\n\nuse scroll_phat_hd::display::*;\nuse scroll_phat_hd::scroller::*;\n\nfn main() {\n println!(\"start\");\n\n // let mut display = I2CDisplay::new(1);\n // let mut display = TermDisplay::new();\n let ... | rust | edit | 0 | 2 | mit | 48c5b07bfbfb1b1f0c566c894e237480950b7dc6 | tiziano88/scroll-phat-hd-rs,tiziano88/scroll-phat-hd-rs | examples/alphabet.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nmod terminal;\nmod ansi;\n\nuse std::io::Write;\nuse self::terminal::{Terminal, Event, Key};\n\npub struct Interface {\n choices: Vec<String>,\n terminal: Terminal\n}\n\nimpl Interface {\n /// Creates a new Interface with the provide... | rust | edit | 2 | 3 | mit | f526d04cbcc96a0b536355c8093763a78faec6c2 | stewart/rff,stewart/rff | src/interface/mod.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::io::{BufRead, Error};\n\npub fn read_and_trim_lines<T: BufRead>(buffered_reader: T) -> Result<Vec<String>, Error> {\n buffered_reader\n .lines()\n .map(|r| Ok(crate::utils::trim_end_inplace(r?)))\n .collect()\... | rust | edit | 0 | 2 | mit | 741d109265e773e0d25a2759ac1a94ef0d69334f | mp4096/indentex | indentexlib/src/preprocessing.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse log::*;\nuse chrono::prelude::Local;\n\nconst THRESHOLD: LogLevelFilter = LogLevelFilter::Debug;\n\npub struct SimpleLogger;\n\nimpl Log for SimpleLogger {\n fn enabled(&self, metadata: &LogMetadata) -> bool {\n metadata.level()... | rust | edit | 0 | 2 | apache-2.0 | 698a1d4652c561a29f11c33fb4f2d29191d9bec5 | Genymobile/gnirehtet,WPO-Foundation/gnirehtet,WPO-Foundation/gnirehtet,Genymobile/gnirehtet,Genymobile/gnirehtet,WPO-Foundation/gnirehtet,WPO-Foundation/gnirehtet | rustrelay/src/logger.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse geom::size::Size2D;\n\npub trait ShareContext {\n // Creates a new context for GL object sharing.\n static fn new(size: Size2D<int>) -> Self;\n\n // Flushes the context.\n fn flush(&self);\n\n // Returns the platform-specif... | rust | edit | null | null | apache-2.0 | 0beee76601f94c5601357c239e5e850266a47c2a | servo/sharegl | base.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[derive(Debug, Clone, Copy, PartialEq)]\npub enum OutputStyle {\n Nested,\n Expanded,\n Compact,\n Compressed,\n}\n\n/// The user facing Options struct, where they can select the libsass\n/// options\n#[derive(Debug, PartialEq, C... | rust | edit | 0 | 1 | mit | 885b330fe0363159f1605fec1944a09757be7d90 | compass-rs/sass-rs | src/options.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n/**\n * Bindings the runtime's random number generator (ISAAC).\n */\n\nnative \"rust\" mod rustrt {\n type rctx;\n fn rand_new() -> rctx;\n fn rand_next(rctx c) -> u32;\n fn rand_free(rctx c);\n}\n\ntype rng = obj { fn next() -> u32; };\... | rust | edit | null | null | apache-2.0 | dfb74263acbf16f4872e231b84c0dd8c6111428c | rust-lang/rand | src/lib/rand.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[link(name = \"protobuf\", vers = \"0.1.0\")];\n#[crate_type = \"lib\"];\n#[feature(globs)];\n#[feature(managed_boxes)];\n\n#[desc = \"protobuf implementation for rust\"];\n#[license = \"BSD\"];\n#[author = \"Stepan Koltsov\"];\n\npub use co... | rust | edit | 0 | 0 | bsd-2-clause | a1cece752b62ffa2218766d82107031accd40dcc | thijsc/rust-protobuf,Blei/rust-protobuf,jamwt/rust-protobuf,jamwt/rust-protobuf,Blei/rust-protobuf,Stebalien/rust-protobuf,jimmycuadra/rust-protobuf,filsmick/rust-protobuf,frew/rust-protobuf,thijsc/rust-protobuf,Stebalien/rust-protobuf,filsmick/rust-protobuf,jimmycuadra/rust-protobuf,danburkert/rust-protobuf,plietar/ru... | src/lib/protobuf.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//!\n//! https://tools.ietf.org/html/rfc5161\n//!\n//! The IMAP ENABLE Extension\n//!\n\n// rustfmt doesn't do a very good job on nom parser invocations.\n#![cfg_attr(rustfmt, rustfmt_skip)]\n#![cfg_attr(feature = \"cargo-clippy\", allow(clip... | rust | edit | 0 | 0 | apache-2.0 | 296262a74eea6a228c37ef45fe043b4917f290d8 | djc/tokio-imap | imap-proto/src/parser/rfc5161.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate hyper;\n\nuse hyper::server::{Server, Request, Response};\nuse hyper::uri::RequestUri;\nuse hyper::header::ContentType;\nuse hyper::header;\n\nconst HELLO_WORLD: &'static [u8; 13] = b\"Hello, World!\";\n\nfn main() {\n Server:... | rust | edit | 0 | 3 | bsd-3-clause | 5a7493fa636e1892b13083e46aeb9971c2e23b30 | Eyepea/FrameworkBenchmarks,circlespainter/FrameworkBenchmarks,steveklabnik/FrameworkBenchmarks,methane/FrameworkBenchmarks,Dith3r/FrameworkBenchmarks,jetty-project/FrameworkBenchmarks,zloster/FrameworkBenchmarks,jeevatkm/FrameworkBenchmarks,Jesterovskiy/FrameworkBenchmarks,herloct/FrameworkBenchmarks,kostya-sh/Framewor... | frameworks/Rust/hyper/src/main.rs | rejected_duplicate | Near-duplicate of sample 120810 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! Provides a testing environment for the `BeaconChain`, `Attester` and `BlockProposer` objects.\n//!\n//! This environment bypasses networking and client run-times and connects the `Attester` and `Proposer`\n//! directly to the `BeaconChain... | rust | edit | 1 | 0 | apache-2.0 | a76b24e274a30694004f919372698e707cfb9dff | sigp/lighthouse,sigp/lighthouse,sigp/lighthouse,sigp/lighthouse | beacon_node/beacon_chain/test_harness/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate identicon;\nextern crate openssl;\nextern crate test;\n\nuse openssl::crypto::hash::{Hasher, HashType};\nuse test::Bencher;\n\nuse identicon::Identicon;\n\n#[bench]\nfn generate(x: &mut Bencher) {\n let source = String::from_s... | rust | edit | 0 | 2 | mit | 4398b553158e5785e91ff49fe1d0b9614315102e | dgraham/identicon | benches/generate.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![no_std]\n#![allow(ctypes)]\n\nenum Color {\n Black = 0,\n Blue = 1,\n Green = 2,\n Cyan = 3,\n Red = 4,\n Pink = 5,\n Brown = 6,\n LightGray = 7,\n DarkGray = 8,\n Li... | rust | edit | 1 | 2 | mit | 6757d9086ba4165f9422215a091d28ecbad7641b | smkell/rustboot,smkell/rustboot | main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[macro_use]\nextern crate clap;\nextern crate names;\n\nuse names::{Generator, Name};\n\nfn main() {\n let (naming, amount) = {\n let app = clap_app!(names =>\n (version: &crate_version!()[..])\n (auth... | rust | edit | 0 | 2 | mit | e4d6556664aad6efadbe8942e49a56490112bfc9 | fnichol/names | cli/src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse command::Command;\nuse vm::VM;\n\n\npub struct Program {\n instructions: Vec<Command>,\n instruction_pointer: Option<usize>,\n current_depth: u64,\n pub status: ProgramStatus,\n}\n\n#[derive(Clone, Copy, PartialEq, Debug)]\npu... | rust | edit | 0 | 5 | mit | 84d02d6f4dda75c075ba324eb5afe39ff52201e2 | nafarlee/thoughtfuck | src/program.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![crate_type = \"lib\"]\n#![warn(missing_docs)]\n\n//! Synchronization primitives based on spinning\n\n#![cfg_attr(feature = \"const_fn\", feature(const_fn, const_unsafe_cell_new, const_atomic_usize_new))]\n\n#![no_std]\n\n#[cfg(test)]\n#[ma... | rust | edit | 3 | 0 | mit | 3a04a1f5dca54b99afe9fdcb83b46b3e3d6b568c | mvdnes/spin-rs,mvdnes/spinlock-rs | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::env;\n\n#[allow(while_true)]\nfn main() {\n let args: Vec<String> = env::args().collect();\n\n match args.len() {\n 1 => {\n while true {\n println!(\"y\");\n }\n },\n _... | rust | edit | 0 | 2 | mit | 8173aec34eb458d351c43207783e775a1c44e8f2 | mubaris/yes,mubaris/yes,mubaris/yes,mubaris/yes,mubaris/yes,mubaris/yes,mubaris/yes,mubaris/yes,mubaris/yes,mubaris/yes,mubaris/yes,mubaris/yes,mubaris/yes,mubaris/yes,mubaris/yes,mubaris/yes,mubaris/yes,mubaris/yes | yes.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![cfg(test)]\n\nextern crate protobuf;\n\nextern crate protobuf_test_common;\n\n#[cfg(feature = \"with-bytes\")]\nextern crate bytes;\n\nmod v2;\n\n// `cfg(proto3)` is emitted by `build.rs`\n\n#[cfg(proto3)]\nmod v3;\n\nmod common;\n\n#[cfg(... | rust | edit | 0 | 0 | mit | 031e880ea7ad4695769c4223672967e369deaa15 | stepancheg/rust-protobuf,stepancheg/rust-protobuf,stepancheg/rust-protobuf | protobuf-test/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 | 0 | apache-2.0 | 4ec64453ae8a84099c83663344ccd2d3b2ce7f94 | jashank/rust,l0kod/rust,pshc/rust,jashank/rust,GBGamer/rust,vhbit/rust,GBGamer/rust,jroesch/rust,jashank/rust,pshc/rust,graydon/rust,pshc/rust,dwillmer/rust,pshc/rust,GBGamer/rust,l0kod/rust,vhbit/rust,dwillmer/rust,GBGamer/rust,zubron/rust,graydon/rust,l0kod/rust,jashank/rust,GBGamer/rust,GBGamer/rust,nwin/rust,aidanc... | src/libstd/sys/windows/ext/raw.rs | rejected_duplicate | Near-duplicate of sample 120731 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nmacro_rules! bench_digest {\n ($name:ident, $engine:path, $bytes:expr) => {\n #[bench]\n fn $name(b: &mut Bencher) {\n use octavo::digest::Digest;\n\n let mut d = <$engine>::default();\n let d... | rust | edit | 1 | 0 | mit | cff8835e2eaaa2d94342b258d6c423315ed24e86 | libOctavo/octavo,hauleth/octavo | benches/digest/mod.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate tokio_io;\nextern crate bytes;\n\nuse bytes::{BytesMut, BufMut};\nuse tokio_io::codec::{BytesCodec, LinesCodec, Decoder, Encoder};\n\n#[test]\nfn bytes_decoder() {\n let mut codec = BytesCodec::new();\n let buf = &mut Bytes... | rust | edit | 0 | 1 | apache-2.0 | 795d7da2ff0c34211fa817dfcab4cf8590669ffd | tokio-rs/tokio-io | tests/codecs.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse super::*;\nuse redox::*;\n\nimpl Editor {\n pub fn exec(&mut self, Inst(n, cmd): Inst) {\n use super::Mode::*;\n use super::PrimitiveMode::*;\n use super::CommandMode::*;\n match self.cursor().mode {\n ... | rust | edit | 0 | 3 | mit | e5299c9a2fec3a0e826f53374884523c17927803 | Lacaranian/redox,rexlunae/redox,Lacaranian/redox,Lacaranian/redox,rexlunae/redox,Lacaranian/redox,rexlunae/redox,Lacaranian/redox | filesystem/apps/sodium/exec.rs | rejected_duplicate | Near-duplicate of sample 120272 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::io;\nuse std::io::Read;\n\n\ntype Cell = u8;\n\npub struct VM {\n cells: [Cell; 30_000],\n data_pointer: usize,\n}\n\n\nimpl VM {\n pub fn new() -> VM {\n VM { cells: [0; 30_000], data_pointer: 0 }\n }\n\n\n pub... | rust | edit | 0 | 2 | mit | b2e4b7be514b475141da56912fa4a068eb77783f | nafarlee/thoughtfuck | src/vm.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![no_main]\n#[macro_use] extern crate libfuzzer_sys;\nextern crate quick_xml;\n\nuse quick_xml::Reader;\nuse quick_xml::events::Event;\nuse std::io::Cursor;\n\nfuzz_target!(|data: &[u8]| {\n // fuzzed code goes here\n let cursor = Curs... | rust | edit | 0 | 0 | mit | 85fb27fcb402904de245001913848777e72505d2 | tafia/quick-xml,tafia/quick-xml | fuzz/fuzz_targets/fuzz_target_1.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nfn replicate<A:Clone>(x:A, l:uint) -> Vec<A> {\n let i = 0u;\n let mut res = Vec::new();\n for _ in range(i,l) {\n res.push(x.clone());\n }\n res\n}\n\nfn pad_right(c:char, l:uint, str:String) -> String {\n let str_le... | rust | edit | 0 | 2 | mit | 18ec06fc6ac92edb33212a778b435ba845b08495 | epsilonz/pretty.rs,Marwes/pretty.rs,Marwes/pretty.rs | src/pretty/string_utils.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::process::Command;\nuse std::env;\n\nfn main() {\n let out_dir = env::var(\"OUT_DIR\").unwrap();\n\n // Invoke ISPC to compile our code\n let ispc_status = Command::new(\"ispc\").args(&[\"src/say_hello.ispc\", \"--pic\", \"-o... | rust | edit | 4 | 4 | mit | 846a752a62054989e07719269fe7c520f1c0eb78 | Twinklebear/ispc-rs,Twinklebear/rust-ispc-integration | build.rs | accepted | null | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.