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\npub enum ExitCode {\n Success,\n GeneralError,\n KilledBySigint,\n}\n\nimpl Into<i32> for ExitCode {\n fn into(self) -> i32 {\n match self {\n Self::Success => 0,\n Self::GeneralError => 1,\n ... | rust | edit | 0 | 3 | apache-2.0 | b23cfc383f8ce3fe4f0ed0023c01ce4731569833 | sharkdp/fd,sharkdp/fd | src/exit_codes.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![feature(ascii_ctype)]\nuse std::ascii::AsciiExt;\n\n\nfn check_countrycode(mut phone: Vec<u8>) -> Option<String> {\n println!(\"{:?}\", phone);\n\n if phone[0] != b'1' {\n return None;\n }\n\n String::from_utf8(phone.dra... | rust | edit | 2 | 4 | bsd-2-clause | 53fb23d1591afa06aec64a3292bc43cde9df0fa6 | gyn/exercism,gyn/exercism,gyn/exercism,gyn/exercism | rust/phone-number/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse crate::cell::UnsafeCell;\n\npub struct RWLock {\n mode: UnsafeCell<isize>,\n}\n\nunsafe impl Send for RWLock {}\nunsafe impl Sync for RWLock {} // no threads on this platform\n\nimpl RWLock {\n pub const fn new() -> RWLock {\n ... | rust | edit | 0 | 2 | apache-2.0 | 3d192ace34bcb13d3c033735cd7415260040c252 | aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust | library/std/src/sys/unsupported/rwlock.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[derive(Debug, PartialEq)]\npub struct RibonucleicAcid(String);\n\nimpl RibonucleicAcid {\n pub fn new(serial: &str) -> Self {\n RibonucleicAcid(serial.to_string())\n }\n}\n\n#[derive(Debug, PartialEq)]\npub struct Deoxyribonucl... | rust | edit | 0 | 3 | bsd-2-clause | 69b05b3f7d0862dce687d9304607a3c7e0083880 | gyn/exercism,gyn/exercism,gyn/exercism,gyn/exercism | rust/rna-transcription/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse crate::vector::VectorTarget;\n\n#[repr(C)]\npub struct RustVec<T: VectorTarget<T>> {\n repr: Vec<T>,\n}\n\nimpl<T: VectorTarget<T>> RustVec<T> {\n pub fn from(v: Vec<T>) -> Self {\n RustVec { repr: v }\n }\n\n pub fn fr... | rust | edit | 0 | 1 | apache-2.0 | fac8b25a2590ffc1fca971d71ff037288af422f2 | dtolnay/cxx,dtolnay/cxx,dtolnay/cxx,dtolnay/cxx | src/rust_vec.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! MIPS\n\nmod msa;\npub use self::msa::*;\n\n#[cfg(test)]\nuse stdarch_test::assert_instr;\n\n/// Generates the trap instruction `BREAK`\n#[cfg_attr(test, assert_instr(break))]\n#[inline]\npub unsafe fn break_() -> ! {\n crate::intrinsic... | rust | edit | 1 | 1 | apache-2.0 | 5066ab16d191db6f076ddad15e9bfd6ed0deae33 | 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\nextern crate init = \"gl-init-rs\";\nextern crate libc;\nextern crate gl;\n\nfn main() {\n use std::default::Default;\n\n let window = init::Window::new(None, \"Hello world!\", &Default::default(), None).unwrap();\n\n window.make_cur... | rust | edit | null | null | apache-2.0 | 1249ebed803993078f4c11e5d2565477bdaeccf5 | kornholi/glutin,paulrouget/glutin,robertknight/glutin,TimNN/glutin,nc4rrillo/glutin,christopheraugustus/glutin,Jayflux/glutin,retep998/glutin,ecoal95/glutin,jdm/glutin,aepsil0n/glutin,fkaa/glutin,vvuk/glutin,tomaka/glutin,mbrubeck/glutin,servo/glutin,vberger/glutin,mbrubeck/glutin,ozkriff/glutin,akiss77/glutin,mitchmin... | examples/window.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Copyright 2014 The Rust Project Developers. See the COPYRIGHT\n// file at the top-level directory of this distribution and at\n// http://rust-lang.org/COPYRIGHT.\n//\n// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or\n//... | rust | edit | 0 | 1 | apache-2.0 | 3f0c483594e8560cacdb28170e703695d8e74c49 | mdinger/rust,andars/rust,XMPPwocky/rust,barosl/rust,AerialX/rust-rt-minimal,zubron/rust,aneeshusa/rust,victorvde/rust,miniupnp/rust,zachwick/rust,XMPPwocky/rust,zaeleus/rust,pshc/rust,krzysz00/rust,philyoon/rust,defuz/rust,quornian/rust,barosl/rust,pelmers/rust,victorvde/rust,omasanori/rust,victorvde/rust,rohitjoshi/ru... | src/test/run-pass-fulldeps/roman-numerals-macro.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![feature(bool_to_option)]\n#![feature(crate_visibility_modifier)]\n#![feature(decl_macro)]\n#![feature(or_patterns)]\n#![feature(proc_macro_diagnostic)]\n#![feature(proc_macro_internals)]\n#![feature(proc_macro_span)]\n#![feature(try_blocks... | rust | edit | 0 | 0 | apache-2.0 | 63806cc919593a5a163458bc5427bbcffcfb45ba | aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust | compiler/rustc_expand/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 | null | null | apache-2.0 | 0af88e3c0495c5dfc78a8a31d0d8d4fee4f5aea8 | sae-bom/rust,0x73/rust,untitaker/rust,dinfuehr/rust,ebfull/rust,rohitjoshi/rust,bombless/rust,quornian/rust,0x73/rust,richo/rust,GBGamer/rust,vhbit/rust,zachwick/rust,XMPPwocky/rust,carols10cents/rust,omasanori/rust,rprichard/rust,jroesch/rust,barosl/rust,kimroen/rust,mvdnes/rust,jashank/rust,pelmers/rust,ruud-v-a/rust... | src/test/compile-fail/extern-foreign-crate.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Write rust code for the following: Create a static IDT with a page fault handler function"
},
{
"role": "assistant",
"content": "mod idt;\n\nlazy_static! {\n static ref IDT: idt::Idt = {\n let mut idt = idt::Idt::new();\n\n idt.set_handler(14, page_... | rust | new_file | 0 | 1 | apache-2.0 | c65b16f42d27daab392a035e41eca80054122f2a | phil-opp/blogOS,phil-opp/blog_os,phil-opp/blog_os,phil-opp/blog_os,phil-opp/blogOS,phil-opp/blog_os | src/interrupts/mod.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse super::prelude::*;\n\n/// Returns the JSON representation of the current deployed commit sha.\n///\n/// The sha is contained within the `HEROKU_SLUG_COMMIT` environment variable.\n/// If `HEROKU_SLUG_COMMIT` is not set, returns `\"unknown... | rust | edit | 0 | 1 | apache-2.0 | e75c2927f0c636233310c5230d4bf682d50eeebe | rust-lang/crates.io,rust-lang/crates.io,rust-lang/crates.io,rust-lang/crates.io | src/controllers/site_metadata.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[macro_use]\nextern crate perl_xs;\n#[macro_use]\nextern crate perl_sys;\n\nuse perl_xs::{ SV, AV, IV, NV };\n\nxs! {\n package XSBench::RS;\n \n sub rs_sum_loop(ctx) {\n let param: SV = ctx.st_fetch(0);\n let array: A... | rust | edit | 0 | 0 | bsd-2-clause | f8a0d2b22279a2e5b3b8346b9bdaceb16c763fa6 | vickenty/perl-xs,vickenty/perl-xs | bench/rs/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![feature(test)]\n\nextern crate identicon;\nextern crate openssl;\nextern crate test;\n\nuse openssl::crypto::hash::{hash, Type};\nuse test::Bencher;\n\nuse identicon::Identicon;\n\n#[bench]\nfn generate(x: &mut Bencher) {\n let source =... | rust | edit | 0 | 3 | mit | 02769f7c15923ec2c99b315290ee4d4a0f37641c | dgraham/identicon | benches/generate.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse {Pattern, PatternNode, PatternOperand};\nuse machine::avr::registers;\n\nuse machine;\nuse select;\n\nuse mir;\n\nmacro_rules! pattern {\n ($node:expr) => { Pattern { root: $node } }\n}\n\nmacro_rules! node {\n ($opcode:ident, $oper... | rust | edit | 6 | 1 | mit | 901faf48e2a4444d5fc54a422e92d22b751aada3 | dylanmckay/compiler | src/target/machine/avr/select.rs | rejected_lint | Too many lint violations: 6 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse core::marker;\nuse core::pin::Pin;\nuse futures_core::future::{FusedFuture, Future};\nuse futures_core::task::{Context, Poll};\n\n/// Future for the [`pending()`] function.\n#[derive(Debug)]\n#[must_use = \"futures do nothing unless you `... | rust | edit | 0 | 1 | apache-2.0 | 98a7dad6edd42a9a2dcd0a73c0e7d4c70495e406 | alexcrichton/futures-rs | futures-util/src/future/pending.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate gcc;\n\nfn main() {\n let litend = if cfg!(target_endian = \"little\") {\n \"1\"\n } else {\n \"0\"\n };\n gcc::Config::new()\n .include(\"decNumber\")\n .file(\"decNumber/decContext.c\")\n... | rust | edit | 0 | 2 | apache-2.0 | 63a0fc19d843d00c01d7f9bcc1fee7cb528b8861 | alkis/decimal,alkis/decimal,alkis/decimal | build.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nstruct Car {\n name : String,\n}\n\nstruct Whhel {\n size : i32,\n owner : Car,\n}\n\nfn main () {\n let car = Car {name: \"DeLorean\".to_string() };\n\n for _ in range(0, 4) {\n Wheel { size : 360, owner : car };\n }... | rust | edit | 0 | 2 | mit | fec27d67f57e9f1d8006d8cf4169ea20549a9bde | leonardinius/rust-guide | 3.4-ownership/car-ref/src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse core::libc::{c_char, c_void};\nuse core::libc::types::common::c99::uint32_t;\n\n#[nolink]\n#[link_args=\"-L../libwapcaplet -lwapcaplet\"]\npub extern mod linking { }\n\n\n```\n\nApply this change: Add definitions of a few data structures ... | rust | edit | null | null | apache-2.0 | d1a2915aad4317c8f71ab610de13e065e2a31cea | servo/rust-wapcaplet,servo/rust-wapcaplet | ll.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern mod std;\n\n#[test]\nfn test_tokenize() {\n assert tokenize( ~\"(1 2 3)\" ) == ~[~\"(\", ~\"1\", ~\"2\", ~\"3\", ~\")\"];\n}\n\n#[test]\nfn test_addspaces() {\n assert addspaces( ~\"(1 2 3)\" ) == ~\" ( 1 2 3 ) \"\n}\n\nfn addspa... | rust | edit | null | null | mit | e05770738c050e4d464bdb929b1a03baa77c564a | martica/rusty | rusty.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"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 | 3 | bsd-3-clause | 33355071a219e525e0a388452b1f908df2bb8b35 | jgilchrist/rslike | src/engine/map.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Copyright (c) 2014-2015 Michael J. Sullivan\n// Use of this source code is governed by an MIT-style license that can be\n// found in the LICENSE file.\n\n#![feature(plugin_registrar, rustc_private)]\nextern crate rustc;\nuse rustc::plugin:... | rust | edit | 0 | 2 | mit | c68fe59905a4fd428f80b880841a8d2669d2c361 | msullivan/rmc-compiler,msullivan/rmc-compiler,msullivan/rmc-compiler,msullivan/rmc-compiler,msullivan/rmc-compiler,msullivan/rmc-compiler | rust/plugin/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\npub fn find() -> Option<u32> {\n const LOWER: u32 = 1000/3;\n const UPPER: u32 = 1000/2;\n\n for c in LOWER..UPPER {\n for b in c/2..c {\n for a in 1..b {\n if a*a + b*b != c*c {\n ... | rust | edit | 0 | 6 | bsd-2-clause | 72c3995b68239e5d48aacdf5dfa503f8a8754664 | gyn/exercism,gyn/exercism,gyn/exercism,gyn/exercism | rust/pythagorean-triplet/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[macro_use] extern crate bitflags;\nextern crate gl as gl_lib;\n#[cfg(feature = \"cgmath\")] extern crate cgmath as cgmath_lib;\n#[cfg(feature = \"image\")] extern crate image as image_lib;\n\nmod ref_into;\n\n#[macro_use] mod macros;\nmod c... | rust | edit | 15 | 0 | apache-2.0 | 0be526f2732b3c43c5d9374cf0616f83745b9d35 | kylewlacy/glitter,kylewlacy/glitter | src/lib.rs | rejected_lint | Too many lint violations: 15 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate zmq;\n\nfn main() {\n let mut context = zmq::Context::new();\n let _poll_item = {\n let socket = context.socket(zmq::PAIR).unwrap();\n socket.as_poll_item(0) //~ ERROR `socket` does not live long enough\n }... | rust | edit | 0 | 1 | apache-2.0 | 770f4b45e59f314300a76976b85680af38ed834a | petehayes102/rust-zmq,erickt/rust-zmq,pfernie/rust-zmq | tests/compile-fail/no-leaking-poll-items.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n\nuse std::fmt;\nuse byteorder;\n\n/// An Error type.\n#[derive(Debug)]\npub enum Error {\n Malformed,\n MissingTable,\n HHEAVersionIsNotSupported,\n HEADVersionIsNotSupported,\n Byteorder(byteorder::Error),\n}\n\nimpl fmt::Dis... | rust | edit | 2 | 2 | mit | 1b89aadc196691a99a963faeaa23dc5df96e61b9 | PistonDevelopers/truetype | src/error.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate simple_csv;\n\nuse std::fs::File;\nuse std::io::BufReader;\nuse std::str::FromStr;\nuse simple_csv::{SimpleCsvWriter, SimpleCsvReader};\n\nfn main(){\n let f = File::open(\"../long-cadence.csv\").unwrap();\n let buf = BufRe... | rust | edit | 0 | 2 | mit | b7e3aa877aac0a237c41c24614a7789a5f5efebc | fifth-postulate/finding-the-planets,fifth-postulate/finding-the-planets,fifth-postulate/finding-the-planets | rust-showcase/src/bin/brightness.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::fmt;\n\nmod token;\nmod parser;\nmod optimizer;\nmod compiler;\n\npub use token::Token;\npub use parser::parse;\n\n\n/// Intermediate representation used by isbfc\npub struct IsbfcIR {\n /// Syntax tree of tokens\n pub tokens: ... | rust | edit | 1 | 1 | mit | af7ef8ea4dadbd9055260050360695ae07fa242f | ids1024/isbfc | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::fs::File;\nuse std::io::Read;\nuse std::path::Path;\nuse std::process::Command;\n\nstatic PROGNAME: &'static str = \"./sort\";\n\n#[test]\nfn numeric1() {\n numeric_helper(1);\n}\n\n#[test]\nfn numeric2() {\n numeric_helper(2);... | rust | edit | 1 | 3 | mit | 8140208cd072f0dd5ff27e50e2e79b4e5d084268 | steveklabnik/coreutils,hexsel/coreutils,beni55/coreutils,dbrgn/coreutils,bundai223/coreutils,silvio/rust-coreutils,Shtong/coreutils,Shtong/coreutils,dennis/coreutils,retep998/coreutils,kwantam/coreutils,kball/coreutils,uutils/coreutils,efuquen/coreutils,kball/coreutils,steveklabnik/coreutils,mauricio/coreutils,sshling/... | test/sort.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate rand;\n\nuse std::io;\nuse std::cmp::Ordering;\nuse rand::Rng;\n\nfn main() {\n println!(\"Guess the number!\");\n\n let secret_number = rand::thread_rng().gen_range(1, 101);\n\n println!(\"The secret number ... | rust | edit | 0 | 2 | mit | 77ca3acf14421e4193128d613195c363b773f975 | juliangrosshauser/guessing_game | src/main.rs | rejected_duplicate | Near-duplicate of sample 121393 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\npub mod lex_script_tool;\npub mod tool;\n\nuse self::lex_script_tool::*;\nuse silkthread_base::*;\nuse silkthread_base::basic::*;\n\n///\n/// ToolSet for dealing with the scripting language\n///\npub struct ScriptToolSet {\n}\n\nimpl ToolSet ... | rust | edit | 2 | 1 | apache-2.0 | da7ef2b58736a794fb3d0d783fc4ccd6f1737211 | Logicalshift/gossyp,Logicalshift/gossyp | src/script/mod.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![doc=\"Defines some operators.\n\"]\n\n// std imports\nuse std::ops::Div;\n\n/// A type for which computing the reciprocal is supported.\n/// Supported types include f32, f64, etc.. \npub trait Recip {\n /// The resulting type after comp... | rust | edit | 0 | 2 | apache-2.0 | e1ad0457262396ee35b198bf9209a4385e4f5133 | achanda/scirust,tempbottle/scirust,indigits/scirust,Sean1708/scirust,daniel-vainsencher/scirust | src/algebra/ops.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! Crate ruma_appservice_api contains serializable types for the requests and responses for each\n//! endpoint in the [Matrix](https://matrix.org/) application service API specification. These\n//! types can be shared by application service ... | rust | edit | 0 | 0 | mit | e3e8911d8b6c68483f25ca760bbd3dff2fefe576 | ruma/ruma | ruma-appservice-api/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// pp-exact - Make sure we actually print the attributes\n\nstruct cat {\n #[cat_maker]\n new(name: ~str) { self.name = name; }\n #[cat_dropper]\n drop { error!(\"%s landed on hir feet\",self.name); }\n name: ~str;\n}\n\nfn mai... | rust | edit | null | null | apache-2.0 | 7fb5f41bacade4999b84c61bbc5e392048fc8c42 | ktossell/rust,michaelballantyne/rust-gpu,miniupnp/rust,waynenilsen/rand,graydon/rust,P1start/rust,SiegeLord/rust,jashank/rust,seanrivera/rust,AerialX/rust-rt-minimal,jbclements/rust,sae-bom/rust,kwantam/rust,dinfuehr/rust,miniupnp/rust,SiegeLord/rust,barosl/rust,kimroen/rust,nham/rust,ruud-v-a/rust,LeoTestard/rust,TheN... | src/test/run-pass/class-attributes-1.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Write rust code for the following: Add the piston tutorials initial code as a base"
},
{
"role": "assistant",
"content": "extern crate piston;\nextern crate graphics;\nextern crate glutin_window;\nextern crate opengl_graphics;\n\nuse piston::window::WindowSettings;\... | rust | new_file | 0 | 4 | mit | ea586633392a5755147578b0f8e0221865c7bb99 | mateusmedeiros/rust_of_life | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![feature(test)]\n\nextern crate test;\nextern crate scribe;\n\nuse test::Bencher;\nuse scribe::Workspace;\nuse std::path::PathBuf;\n\n#[bench]\nfn bench_tokens(b: &mut Bencher) {\n // Create a workspace with this benchmark test as a buff... | rust | edit | 0 | 3 | mit | 0fbcad3eff2f6db8dad0fa66d3fdc7fca2358008 | jmacdonald/scribe | benches/buffer_tokens.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Copyright (c) The Libra Core Contributors\n// SPDX-License-Identifier: Apache-2.0\n\n//! This module defines the structs transported during the network handshake protocol v1.\n//! These should serialize as per [link](TODO: Add ref).\n//!\n... | rust | edit | 0 | 0 | apache-2.0 | ab87ae61b7ba3b4b3797c6dde519f2a446a80728 | aptos-labs/aptos-core,aptos-labs/aptos-core,aptos-labs/aptos-core,aptos-labs/aptos-core,libra/libra,aptos-labs/aptos-core,libra/libra,libra/libra,aptos-labs/aptos-core,libra/libra,aptos-labs/aptos-core,libra/libra | network/src/protocols/wire/handshake/v1/mod.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse bytes::{BufMut, BytesMut};\nuse futures::Poll;\nuse std::io;\n\nuse super::IoStream;\n\nconst LW_BUFFER_SIZE: usize = 4096;\nconst HW_BUFFER_SIZE: usize = 32_768;\n\npub fn read_from_io<T: IoStream>(\n io: &mut T, buf: &mut BytesMut,\n... | rust | edit | 0 | 4 | apache-2.0 | 17c033030ba6deda3f32755f06e4da04f46ab532 | actix/actix-web,actix/actix-web,actix/actix-web | src/server/utils.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse super::Wasmbin;\n\nmacro_rules! newtype_idx {\n ($name:ident) => {\n #[derive(Debug, PartialEq, Eq, Clone, Copy, Wasmbin)]\n pub struct $name(u32);\n };\n}\n\nnewtype_idx!(TypeIdx);\nnewtype_idx!(FuncIdx);\nnewtype_idx... | rust | edit | 0 | 0 | apache-2.0 | 6b9bbd88e925e0e9f5b87d866fa2226b0eb2d920 | GoogleChromeLabs/wasmbin | src/indices.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![feature(no_std, lang_items, asm, const_fn)]\n#![feature(core_str_ext)]\n#![no_std]\n\n#[macro_use]\npub mod xen;\n\npub mod arch;\npub mod utils;\n\nextern {\n fn main(_: isize, _: *const *const u8) -> isize;\n}\n\n// 8KB\nconst STACK_S... | rust | edit | 5 | 1 | mit | 59bbae76e1317c1810afc661ddd88285f7710568 | uni-rs/uni.rs | src/lib.rs | rejected_lint | Too many lint violations: 5 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate portmidi as pm;\n\nextern crate rustc_serialize;\nextern crate docopt;\n\nconst USAGE: &'static str = r#\"\nportmidi-rs: monitor-device example\n\nUsage:\n monitor-device <id>\n\nOptions:\n -h --help Show this screen.\n\n... | rust | edit | 0 | 3 | mit | 91e49241027729a600a1f8c3d5e0cabb14cb06c9 | samdoshi/portmidi-rs,samdoshi/portmidi-rs | examples/monitor.rs | rejected_duplicate | Near-duplicate of sample 119983 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::fmt;\n\npub enum OscError {\n BadOscPacket(String),\n BadOscAddress(String),\n BadOscMessage(String),\n BadOscString(String),\n BadOscBundle,\n}\n\nimpl fmt::Display for OscError {\n fn fmt(&self, f: &mut fmt::Forma... | rust | edit | 0 | 2 | apache-2.0 | ee40a735b2f10e0a917d3e3ddacb88f5166997d5 | klingtnet/rosc | src/errors.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate xswag_base as base;\n\nuse base::code::{SrcOffset, BytePos, Span, FileMap};\nuse base::diag;\n\nconst TEXT: &'static str = \"no-content\";\n\nfn main() {\n let file = FileMap::new(\"src/examples/dummy.txt\", TEXT);\n file.f... | rust | edit | 0 | 1 | mit | 946071ed66279fc80bd7b5c3f5fa325cbd3193f7 | LukasKalbertodt/xswag-base,LukasKalbertodt/xswag-base | examples/dummy-span.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate stripe;\n\nuse std::env;\n\nfn main() {\n // Create a new client\n let secret_key = env::var(\"STRIPE_SECRET_KEY\").expect(\"Missing STRIPE_SECRET_KEY in env\");\n let client = stripe::Client::new(&secret_key);\n\n //... | rust | edit | 0 | 1 | apache-2.0 | 5ffe99abdfa28ef02511e4c5fb681fdf71637f50 | rapiditynetworks/stripe-rust | examples/create_customer_with_card.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n/// extern test-lib for zwreec\n/// to test the whole zwreec library\n/// for the future: real twee and z-code test-data\n\nextern crate zwreec;\n\n#[test]\nfn file_test() {\n assert_eq!(\"hello from file\", zwreec::utils::file::temp_hello... | rust | edit | 0 | 1 | bsd-2-clause | e81a8fbebba05af9a35e6c019585db879cd8f3aa | Drakulix/zwreec,Drakulix/zwreec | tests/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Copyright (c) 2016, Matthew O'Connor\nextern crate system_zero_core;\n\nuse std::io;\nuse std::io::Write;\nuse system_zero_core::*;\nuse system_zero_core::ast::*;\n\nconst PROMPT: &'static str = \"> \";\n\nfn repl() -> io::Result<()> {\n ... | rust | edit | null | null | isc | d2d154924a007e132ff36b52ce2f3db50d58c464 | oconnor0/system-zero | szi/src/main.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![feature(collections, std_misc)]\n\nextern crate tcod;\n\npub mod engine;\npub mod gui;\npub mod util;\n\n```\n\nApply this change: Remove unused collections feature gate"
},
{
"role": "assistant",
"content": "#![feature(std_mis... | rust | edit | 1 | 0 | bsd-3-clause | 72447c459621242426f73f58980f0b940674e125 | jgilchrist/rslike | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::env;\nuse std::process::Command;\nuse std::str::{self, FromStr};\n\nfn main() {\n let compiler = match rustc_version() {\n Some(compiler) => compiler,\n None => return,\n };\n\n if compiler.minor >= 40 && compi... | rust | edit | 0 | 4 | apache-2.0 | 5ada2978c5841dc5d043acdf99a9ac69ff88e527 | dtolnay/anyhow | build.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::f32::consts::PI;\n\nuse rand::{self, XorShiftRng, Rng};\n\n#[derive(Clone)]\npub struct Noise(XorShiftRng);\n\nimpl Noise {\n pub fn new() -> Noise {\n Noise(rand::weak_rng())\n }\n\n pub fn next(&mut self) -> f32 {\n... | rust | edit | 0 | 1 | mit | 9a57aeb7834dfd25a89f6cdcbab29320c0bc992f | kchmck/imbe.rs | src/noise.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![feature(specialization)]\n#![feature(alloc, allocator_api)]\n#![feature(asm)]\n\n#![cfg_attr(feature=\"clippy\", feature(plugin))]\n#![cfg_attr(feature=\"clippy\", plugin(clippy))]\n#![allow(unknown_lints)]\n#![allow(inline_always)] \n#![a... | rust | edit | 6 | 0 | bsd-3-clause | a819fac29148ac4a4e9549933ddf318c259e731e | tlrmchlsmth/momms,tlrmchlsmth/momms,tlrmchlsmth/momms | src/lib.rs | rejected_lint | Too many lint violations: 6 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![crate_name=\"orbclient\"]\n#![crate_type=\"lib\"]\n#![feature(alloc)]\n#![feature(asm)]\n#![feature(const_fn)]\n#![cfg_attr(all(not(feature=\"no_std\"), not(target_os = \"redox\")), feature(const_ptr_null_mut))]\n#![cfg_attr(feature=\"no_s... | rust | edit | 0 | 0 | mit | 97e8407d459a25ea2a485d620f1ba195b1873ce3 | redox-os/orbclient | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![cfg(any(target_arch=\"x86\", target_arch=\"x86_64\"))]\n\n#![no_std]\n#![crate_name=\"cpu\"]\n#![crate_type=\"rlib\"]\n#![feature(no_std)]\n#![feature(asm)]\n#![feature(associated_consts)]\n#![feature(core, core_slice_ext)]\n\n#[macro_use]... | rust | edit | 0 | 0 | mit | e2df889a80415c415f915fb1a5f8119b242025dd | rexlunae/redox,gz/rust-x86,gz/rust-x86,rexlunae/redox,phil-opp/rust-x86_64,RustOS-Fork-Holding-Ground/libcpu,rexlunae/redox | src/lib.rs | rejected_duplicate | Near-duplicate of sample 120651 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! An XML-RPC implementation in Rust.\n//!\n//! The `xmlrpc` crate provides a minimal implementation of the [XML-RPC spec][spec].\n//!\n//! [Repo link][repo].\n//!\n//! [spec]: http://xmlrpc.scripting.com/spec.html\n//! [repo]: https://githu... | rust | edit | 1 | 0 | cc0-1.0 | 74c5a82f3b0838f5ff53b654f655f00f6d7a4d39 | jonas-schievink/xml-rpc-rs | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate chifir;\nextern crate termion;\n\nuse termion::raw::IntoRawMode;\nuse termion::async_stdin;\n\nuse std::io::{self, Write};\n\nfn main() {\n let stdout = io::stdout();\n let mut stdout = stdout.lock().into_raw_mode().unwrap(... | rust | edit | 0 | 2 | mit | 576579d2903db8957ce336788a8774bf5f306ec5 | onefrankguy/chifir | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![feature(convert)]\n\nextern crate tcod;\n\npub mod engine;\npub mod gui;\npub mod util;\n\n```\n\nApply this change: Remove the 'convert' feature gate which is now stable"
},
{
"role": "assistant",
"content": "extern crate tcod... | rust | edit | 1 | 0 | bsd-3-clause | 856ee4286a109e4e638927059338c068be28dd58 | jgilchrist/rslike | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse client;\nuse interface;\n\nfn help(event: &interface::CommandEvent) {\n let plugins = event.client.plugins.read();\n let commands = plugins.commands.keys().collect::<Vec<&String>>().connect(\", \");\n event.client.send_message(ev... | rust | edit | 2 | 1 | mit | 0abe5720acaea8af7bfc725e4794394af949491f | daboross/zaldinar,daboross/zaldinar | src/plugins/help.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate num;\n\n// Must re-export num for the unit! macro.\n#[doc(hidden)]pub use num as num_export;\n\nmod vec2;\nmod vec3;\nmod vec4;\nmod float;\nmod clamp;\n#[macro_use] pub mod unit;\n\npub use num::{Zero, One, Num};\npub use self::... | rust | edit | 1 | 0 | bsd-3-clause | a6b05839c4196f00b225fc967e1c7122631e0d6c | fiz3d/fiz-math,fiz3d/math | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::error::Error;\nuse std::fs::File;\nuse std::io::prelude::*;\nuse std::path::Path;\n\nstruct Vertex {\n\tx: f32,\n\ty: f32,\n\tz: f32\n}\n\npub struct WavefrontModel {\n\tvertices: Vec<Vertex>\n}\n\nimpl WavefrontModel {\n\tpub fn new... | rust | edit | 0 | 2 | mit | eeb91a1cdadc55d5770643c6327afcf7e45a2f8b | jamwaffles/Wavefront.rs | wavefront/mod.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![feature(backtrace)]\n\nmod as_dyn_error;\nmod context;\nmod error;\n\n#[cfg(not(feature = \"std\"))]\ncompile_error!(\"no_std support is not implemented yet\");\n\npub use crate::as_dyn_error::AsDynError;\npub use crate::context::Context;\... | rust | edit | 2 | 0 | apache-2.0 | f54adae5eff8012103a959d598a5b730e1eb9b79 | dtolnay/anyhow | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\npub mod ui {\n extern crate term;\n\n pub fn online() {\n let mut t = term::stdout().unwrap();\n t.fg(term::color::GREEN).unwrap();\n writeln!(t, \"Online\").unwrap();\n\n }\n pub fn offline() {\n let m... | rust | edit | 0 | 2 | mit | ffd4ad1ca62dd63737ad882f07c40c6716503299 | bascht/binichonline | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![crate_name = \"foo\"]\n\nmod hidden {\n // @has foo/hidden/struct.Foo.html\n // @has - '//p/a' '../../foo/struct.FooBar.html'\n pub struct Foo {}\n\n // @has foo/hidden/bar/index.html\n // @has - '//p/a' '../../foo/baz/index... | rust | edit | 0 | 0 | apache-2.0 | 8c94f8be992719a6e6652018e39a653366b4227f | graydon/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust | src/test/rustdoc/redirect-rename.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[derive(Debug)]\npub struct Brackets {\n brackets: String,\n}\n\nimpl Brackets {\n pub fn from(text: &str) -> Self {\n Brackets {\n brackets: text.chars()\n .filter(|&x| {\n x == '[' ... | rust | edit | 0 | 4 | bsd-2-clause | e25514813a372d8ba84a78ffaf5add040a90dcaf | gyn/exercism,gyn/exercism,gyn/exercism,gyn/exercism | rust/bracket-push/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate yaml_rust;\nuse self::yaml_rust::{YamlLoader, Yaml};\n\npub fn from_yaml(yaml_file: String) -> Vec<String> {\n let docs = YamlLoader::load_from_str(&yaml_file).unwrap();\n let doc = &docs[0];\n\n let key = Yaml::from_str... | rust | edit | null | null | mit | 83a5e1829a58a92fa6e37f93b51c7df046aea890 | schultyy/Sokan | src/configuration.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"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 | null | null | apache-2.0 | 52f8b22d4f304abd6227f1476396b0a3a94e241f | hauleth/rust,defuz/rust,reem/rust,AerialX/rust-rt-minimal,defuz/rust,hauleth/rust,zaeleus/rust,ejjeong/rust,jroesch/rust,richo/rust,cllns/rust,pelmers/rust,SiegeLord/rust,avdi/rust,aidancully/rust,ruud-v-a/rust,pelmers/rust,fabricedesre/rust,aepsil0n/rust,avdi/rust,quornian/rust,bombless/rust,stepancheg/rust-ide-rust,m... | src/test/compile-fail/unresolved-import.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"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 | null | null | apache-2.0 | 4be086b7f6499fa7c0ff177eef6942b3ba1bb1b1 | mitsuhiko/rust,GBGamer/rust,erickt/rust,defuz/rust,sae-bom/rust,robertg/rust,aneeshusa/rust,TheNeikos/rust,stepancheg/rust-ide-rust,aturon/rust,aidancully/rust,nwin/rust,ejjeong/rust,mahkoh/rust,zaeleus/rust,reem/rust,nwin/rust,hauleth/rust,pczarn/rust,zubron/rust,gifnksm/rust,jashank/rust,mahkoh/rust,krzysz00/rust,Rym... | src/libstd/macros.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! This crate exposes functionality to create receivers that\n//! receive notifications after a specified period of time or at\n//! a specified frequency.\n//!\n//! # Examples\n//!\n//! At its simplest, oneshot_ms can be used to put the thre... | rust | edit | 0 | 0 | mit | c0933b29bf6effaefc3df95c6a164f2ada414c49 | PeterReid/schedule_recv | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Copyright (c) 2016-2017 Chef Software Inc. and/or applicable contributors\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a c... | rust | edit | 5 | 2 | apache-2.0 | 32d0b594a1c2a03d5a1c8b4019e2307af6d91483 | habitat-sh/habitat,rsertelon/habitat,rsertelon/habitat,habitat-sh/habitat,habitat-sh/habitat,rsertelon/habitat,habitat-sh/habitat,habitat-sh/habitat,rsertelon/habitat,rsertelon/habitat,habitat-sh/habitat,habitat-sh/habitat,habitat-sh/habitat,rsertelon/habitat,rsertelon/habitat | src/url.rs | rejected_lint | Too many lint violations: 5 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nmod reader;\nmod writer;\n\npub use self::reader::StreamingParser;\npub use self::writer::Writer;\n```\n\nApply this change: Add warning to xml writer"
},
{
"role": "assistant",
"content": "mod reader;\nmod writer;\n\npub use self... | rust | edit | 1 | 0 | mit | 33c71a7c2e3c0592e97f7d796d8e8a1396d69e09 | ebarnard/rust-plist | src/xml/mod.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse num_traits::{FromPrimitive, Signed};\nuse std::fmt::Debug;\n\npub trait FFTnum: Copy + FromPrimitive + Signed + Debug + 'static {}\n\nimpl FFTnum for f32 {}\nimpl FFTnum for f64 {}\n\n\n#[inline(always)]\npub fn verify_length<T>(input: &[... | rust | edit | 0 | 1 | apache-2.0 | 8c859f92fd0d2900c80b05022c5861e797db0051 | ejmahler/RustFFT,ejmahler/RustFFT | src/common.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::error::Error;\n\nuse conduit::{Request, Response, Handler};\nuse conduit_static::Static;\nuse conduit_middleware::AroundMiddleware;\n\nuse util::RequestProxy;\n\npub struct Middleware {\n handler: Option<Box<Handler>>,\n dist: ... | rust | edit | 0 | 4 | apache-2.0 | fadf6b94caec4c9fc1afd4cc7767afdb1105668c | achanda/crates.io,steveklabnik/crates.io,rust-lang/crates.io,rust-lang/crates.io,achanda/crates.io,Susurrus/crates.io,Susurrus/crates.io,Susurrus/crates.io,achanda/crates.io,rust-lang/crates.io,achanda/crates.io,steveklabnik/crates.io,steveklabnik/crates.io,steveklabnik/crates.io,Susurrus/crates.io,rust-lang/crates.io | src/dist.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Sings '99 Bottles of Beer'\nfn main()\n{\n for bottle in (0..100).rev()\n {\n if bottle > 1\n {\n println!(\"{} bottles of beer on the wall, {} bottles of beer.\", bottle, bottle);\n if bottle > 2\... | rust | edit | 2 | 4 | cc0-1.0 | 84b66706e762d866e3c6e162b5a307accd2905d0 | ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovs... | puzzles/99_Bottles/Rust/99_Bottles.rs | rejected_duplicate | Near-duplicate of sample 120566 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse libc;\n\npub const TIOCGWINSZ: libc::c_int = 0x5413;\npub const TIOCSWINSZ: libc::c_int = 0x5414;\n\n#[repr(C)]\n#[derive(RustcEncodable, RustcDecodable, PartialEq, Debug)]\npub struct Winsize {\n pub ws_row: libc::c_ushort, /* rows... | rust | edit | 1 | 0 | mit | c07048b06fc09fca7b03d83390ea91b3364b57b2 | idobata/hokaido,idobata/hokaido | src/libc_ext.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse crate::colour::Colour;\nuse crate::graph::{Graph, Position};\nuse crate::grid::Grid;\n\npub enum GameState {\n Solving,\n Solved,\n}\n\npub struct Game {\n pub state: GameState,\n pub graph: Graph,\n}\n\nconst top_left_cell: P... | rust | edit | 0 | 1 | mit | cc2998731f9a40bf79126ca802c6d3aff955586d | yzhs/flood-it | src/game.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Copyright 2013 The Servo Project Developers. See the COPYRIGHT\n// file at the top-level directory of this distribution.\n//\n// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or\n// http://www.apache.org/licenses/LICENSE-2... | rust | edit | 1 | 0 | apache-2.0 | a534d23e81ce593cd567cb1cb0edbe08d6168440 | pcwalton/rust-core-graphics,servo/core-graphics-rs | src/base.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\npub enum Tree<T> {\n Nil,\n Node(T, Vec<Tree<T>>),\n}\n\n```\n\nApply this change: Rewrite Tree data structure, add new() and leaf() methods"
},
{
"role": "assistant",
"content": "struct TreeNode<T> {\n data: T,\n chil... | rust | edit | 0 | 1 | mit | 68b0a504dfbc6a610df70a3f8f47a3e89cc98268 | nham/gymnosporangium | src/tree.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate rand;\n\nuse std::io;\nuse rand::Rng;\n\nfn main() {\n println!(\"Guess the number!\");\n\n let secret_number = rand::thread_rng().gen_range(1, 101);\n\n println!(\"The secret number is: {}\", secret_number);... | rust | edit | 0 | 1 | mit | 6869bdc4ebf6a872dcd2042c273564b429a3811d | juliangrosshauser/guessing_game | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Copyright 2015 James Bostock. See the LICENSE file at the top-level\n// directory of this distribution.\n\n// An implementation of the cat(1) command in Rust.\n// See http://man.cat-v.org/unix-6th/1/cat\nuse std::env;\nuse std::fs::File;\n... | rust | edit | null | null | mit | 5f7f69ff44c0ffb014223cb397b874569a093d04 | james-bostock/rust-v6-cmd | src/bin/cat.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate integrate;\n\nuse integrate::cquad;\nuse std::num::FloatMath;\nuse std::f64::consts;\n\nfn main() {\n // Integrate sin(x)/2 from 0 to pi\n let (result, err, neval) = cquad(|x| 0.5f64 * FloatMath::sin(x), 0f64, consts::PI);\... | rust | edit | 0 | 1 | mit | b6d84ddfc2ddaf5f97bf8db7ef66f586a186fa21 | ibab/rust-gsl-integrate | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[macro_use]\nextern crate clap;\nextern crate riscan_pro;\nextern crate serde_json;\n\nuse clap::{App, Arg, SubCommand};\nuse riscan_pro::Project;\n\nfn main() {\n let matches = App::new(\"RiSCAN Pro\")\n .author(\"Pete Gadomski <<... | rust | edit | 0 | 3 | mit | b2366ebfd529f769685d84bb9d8cbee5f06749df | gadomski/riscan-pro | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// xfail-test\n\nfn foo(cond: bool) {\n // Here we will infer a type that uses the\n // region of the if stmt then block:\n let mut x; //~ ERROR foo\n\n if cond {\n x = &3;\n }\n}\n\nfn main() {}\n```\n\nApply this chang... | rust | edit | 0 | 2 | apache-2.0 | 9d6ab9ae2326ef130a1a43876f49f00933d234e6 | victorvde/rust,bhickey/rand,AerialX/rust,seanrivera/rust,KokaKiwi/rust,michaelballantyne/rust-gpu,j16r/rust,j16r/rust,pelmers/rust,mdinger/rust,michaelballantyne/rust-gpu,gifnksm/rust,aneeshusa/rust,bombless/rust,GBGamer/rust,vhbit/rust,0x73/rust,vhbit/rust,vhbit/rust,barosl/rust,pythonesque/rust,seanrivera/rust,stepan... | src/test/compile-fail/regions-var-type-out-of-scope.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate iron;\nextern crate mount;\nextern crate logger;\nextern crate staticfile;\n\nuse iron::prelude::*;\nuse iron::mime::Mime;\nuse iron::status;\nuse mount::Mount;\nuse logger::Logger;\nuse staticfile::Static;\n\nstatic JSON_RESPONS... | rust | edit | 0 | 1 | mit | 8ef5ddaf829bff3d671544e7ca45e50d7e75787b | zsiciarz/skyrim-alchemy-toolbox,zsiciarz/skyrim-alchemy-toolbox,zsiciarz/skyrim-alchemy-toolbox | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nmod vm;\nmod command;\nmod parse;\nmod program;\n\nuse vm::VM;\nuse program::Program;\nuse std::io::Write;\nuse std::env;\n\n\nfn main() {\n for argument in env::args() {\n println!(\"{}\", argument);\n }\n\n let vm = VM::new(... | rust | edit | 1 | 3 | mit | 55398a945abc0ea6f5bd35aad54d18ce3e1f9ed0 | nafarlee/thoughtfuck | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![feature(rustc_private)] // TODO Migrate to crates.io variant (json)\n#![feature(core)]\n\nextern crate hyper;\nextern crate regex;\nextern crate serialize;\nextern crate websocket;\nextern crate rustc_serialize;\n\nmod authentication;\nmod... | rust | edit | 2 | 1 | mit | 197a3c2d7f863e20639f608c7cb40c309d996144 | timonv/lax | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nmod vm;\nmod command;\nmod parse;\n\nuse vm::VM;\nuse std::io::Write;\n\nfn main() {\n let mut vm = VM::new();\n loop {\n print!(\"{}\", \"bf> \");\n std::io::stdout().flush().unwrap();\n\n let mut line = String::ne... | rust | edit | 1 | 2 | mit | 9619c12f2232fdf637f64d125b4e692005c2f5c1 | nafarlee/thoughtfuck | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::io::File;\n\nmod parser;\n\nfn main() {\n let input =\nr#\"{\nlet x = 0;\nloop {\n __clear();\n __draw_pos(x, 5);\n __get_font(3);\n __draw(5);\n x = x + 1;\n __key_wait(0);\n}\n}\"#;\n\n let code = parser::pa... | rust | edit | 0 | 3 | mit | 1fa642e41b145fcf0109822c1864842f34ff8653 | mchesser/pchip,quvarxa/pchip | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![deny(clippy::all, clippy::pedantic)]\n\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: Disable ui test on miri... | rust | edit | 0 | 1 | apache-2.0 | 625d349ffb2be7855d51a1c1ec88f75417d28f24 | dtolnay/thiserror | tests/compiletest.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nmod board;\n\n#[cfg(not(test))]\nfn main() {\n let mut brd = board::Board::new(65, 248).random();\n let mut timer = std::io::Timer::new().unwrap();\n let ref mut worker_pool = board::WorkerPool::new_with_default_size();\n let periodic = t... | rust | edit | 0 | 1 | mit | 5ae4b8ec4a8952c4f592ba8306bc006ff9d6f397 | crazymykl/rust-life | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::thread::{self};\nuse std::time::{Duration};\n\nuse umio::{ELoopBuilder};\n\nuse {MockDispatcher, MockMessage};\n\n#[test]\nfn positive_send_notify() {\n let eloop_addr = \"127.0.0.1:0\".parse().unwrap();\n let mut eloop = ELoop... | rust | edit | 4 | 3 | apache-2.0 | e26fa8d09c275e93cf96129d3b4c33bb0a6caea2 | GGist/umio-rs | test/test_timeout.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nmod test_event;\nmod test_socket;\nmod test_sockopt;\nmod test_termios;\nmod test_ioctl;\nmod test_wait;\nmod test_select;\nmod test_uio;\n\n```\n\nApply this change: Disable sys/event tests on Linux"
},
{
"role": "assistant",
"co... | rust | edit | 1 | 0 | mit | 9613b10b8dec0f1fb7e08c99d5f2191305902b3a | carllerche/nix-rust,xd009642/nix,carllerche/nix-rust,carllerche/nix-rust,geofft/nix-rust,kamalmarhubi/nix-rust,Susurrus/nix,posborne/rust-nix,berkowski/nix,xd009642/nix,berkowski/nix,geofft/nix-rust,nix-rust/nix,geofft/nix-rust,xd009642/nix,Susurrus/nix,MarkusJais/nix-rust,Susurrus/nix,kamalmarhubi/nix-rust,MarkusJais/... | test/sys/mod.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Copyright 2014-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 | 2 | apache-2.0 | 14994ac6b67cdaff1692f836e3495a75f4f7d71b | graydon/rust,GBGamer/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,aidancully/rust,GBGamer/rust,graydon/rust,GBGamer/rust,graydon/rust,graydon/rust,GBGamer/rust,GBGamer/rust,GBGamer/rust,aidancully/rust,GBGamer/rust,aidancully/rust,GBGamer/rust,graydon/rust | src/librustc_back/target/emscripten_base.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![feature(inclusive_range_syntax)]\n\nextern crate arrayvec;\nextern crate collect_slice;\nextern crate crossbeam;\nextern crate map_in_place;\nextern crate num;\nextern crate quad_osc;\nextern crate rand;\n\npub mod consts;\npub mod decoder... | rust | edit | 2 | 0 | mit | 9f2e49b5cb281187d3967e400f5996745f21429f | kchmck/imbe.rs | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate thoughtfuck;\n\nmod common;\n\nuse std::fs::File;\nuse std::io::Read;\n\nuse common::FauxStdout;\nuse thoughtfuck::vm::*;\nuse thoughtfuck::program::*;\nuse thoughtfuck::parse::parse;\n\nfn read_file(filename: &str) -> String {\n... | rust | edit | 0 | 1 | mit | a8bd0aa2d801acc145774a37317e43bea03e3b35 | nafarlee/thoughtfuck | tests/integration.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Copyright 2012-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 o... | rust | edit | 1 | 0 | apache-2.0 | 946572177c4b25f2e16773983b82e183f833e7fd | rust-lang/rustc-serialize,gbersac/rustc-serialize,rust-lang-nursery/rustc-serialize,rust-lang-deprecated/rustc-serialize,DenisKolodin/rustc-serialize,ajroetker/rustc-serialize,shepmaster/rustc-serialize,SimonSapin/rustc-serialize,indefini/rustc-serialize | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n/// Exercise 8.6: Write a program that creates a zombie, and then call system\n/// to execute the ps(1) command to verify that the process is a zombie.\n///\n/// Takeaway: does only work on Linux, on MacOs the child process is somehow\n/// re... | rust | edit | 0 | 2 | mit | 1fa0b5f7558309a194d411840526c4a6d66ce010 | philippkeller/apue-rust,philippkeller/apue-rust,philippkeller/apue-rust | src/bin/08-process-cntl/e06-zombie.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![feature(test)]\n\nextern crate test;\nuse test::Bencher;\nextern crate lonlat_bng;\nuse lonlat_bng::convert_to_bng_threaded_vec;\n\nextern crate rand;\nuse rand::distributions::{IndependentSample, Range};\n\n#[bench]\nfn bench_threads(b: &... | rust | edit | 0 | 2 | mit | 50028c4a2de4a3ebef0851d6fb3b1635ed8c4397 | urschrei/lonlat_bng,urschrei/lonlat_bng,urschrei/rust_bng,urschrei/rust_bng,urschrei/lonlat_bng | benches/benchmarks.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Copyright 2015 Pierre Talbot (IRCAM)\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://... | rust | edit | 1 | 0 | apache-2.0 | eec60836625d124ef6386e6d519296afbe989374 | ptal/rust-interval | src/libinterval/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate made_up;\nextern crate log;\nuse std::env;\nfn main() {\n log::set_logger(|max_log_level| {\n max_log_level.set(::log::LogLevelFilter::Debug);\n Box::new(SimpleLogger)\n ... | rust | edit | 0 | 2 | mit | 21d20354a0c9734004070dc497bbf14304707f8e | maccoda/made-up,maccoda/made-up,maccoda/made-up | src/bin/made-up.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse stdio;\npub unsafe fn outb(port: u16, value: u8) {\n asm!(\"outb %al, %dx\"\n :\n : \"{dx}\" (port), \"{al}\" (value)\n :\n : \"volatile\" );\n}\n\npub unsafe fn inb(port: u16) -> u8 {\n let mut ret: ... | rust | edit | 1 | 1 | mit | 2d32daa27305c93131145e63aff93fd1e4a599d4 | jvns/puddle,jvns/puddle | src/utils.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate thoughtfuck;\nmod common;\n\nuse thoughtfuck::vm::*;\nuse thoughtfuck::program::*;\nuse thoughtfuck::parse::parse;\n\n#[test]\nfn hello_world () {\n const SOURCE: &str = \"++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>-... | rust | edit | 0 | 1 | mit | f1e66c6ab05054baa0bc0767cb37a59dd1bd6e36 | nafarlee/thoughtfuck | tests/integration.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n\nuse std::iter;\nuse std::num::{Float, NumCast};\n\n/// An iterator of `n` evenly spaced floats.\n///\n/// Iterator element type is `F`.\npub type Linspace<F> = iter::Take<iter::Counter<F>>;\n\n/// Return an iterator with `n` elements, where... | rust | edit | 0 | 2 | apache-2.0 | c7c58cb7eff2b33f92b5196d6b30de7642df4a3c | imp/rust-itertools,rust-itertools/itertools,DanielKeep/rust-itertools,tempbottle/rust-itertools,stepancheg/rust-itertools,Wilfred/rust-itertools,flo-l/rust-itertools | src/linspace.rs | accepted | null | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.