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\nuse std::net::{TcpListener, TcpStream};\n\nextern crate rust_ofp;\nuse rust_ofp::ofp_controller::OfpController;\nuse rust_ofp::ofp_controller::openflow0x01::OF0x01Controller;\nuse rust_ofp::openflow0x01::{SwitchFeatures, PacketIn, Pattern};\n... | rust | edit | 0 | 5 | mit | 2035956642801b48136261f40b56fc1da4daf143 | baxtersa/rust_ofp | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate lalrpop;\n\nfn main() {\n ::std::env::set_var(\"LALRPOP_LANE_TABLE\", \"disabled\");\n lalrpop::Configuration::new().process_current_dir().unwrap();\n println!(\"cargo:rerun-if-changed=src/grammar.lalrpop\");\n}\n\n```\n... | rust | edit | 0 | 1 | mit | 485716be091d0a7a147ba41560f8bc5befb984ab | Marwes/embed_lang,gluon-lang/gluon,gluon-lang/gluon,Marwes/embed_lang | parser/build.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 | 0 | 1 | apache-2.0 | 6c1529b34fcf57d8292cd121f2261b8119bf5fcf | GBGamer/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust,graydon/rust,GBGamer/rust,aidancully/rust,graydon/rust,GBGamer/rust,GBGamer/rust,GBGamer/rust,aidancully/rust,GBGamer/rust,GBGamer/rust,GBGamer/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust | src/test/ui/span/E0535.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate wasm_bindgen;\n\nuse wasm_bindgen::prelude::*;\n\n#[wasm_bindgen]\nextern {\n fn oak_print(s: &str);\n}\n\n#[wasm_bindgen]\npub fn oak_main() {\n oak_print(\"HELLO OAK\");\n}\n\n```\n\nApply this change: Add empty get time ... | rust | edit | 0 | 1 | apache-2.0 | 3fcfa78a2394f1be76b018f98a55dbce46458156 | project-oak/oak,project-oak/oak,project-oak/oak,project-oak/oak,project-oak/oak,project-oak/oak,project-oak/oak | examples/rust/hello_world/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse super::branchify::generate_branchified_method;\nuse super::get_writer;\nuse std::io::IoResult;\n\npub fn generate(output_dir: &Path) -> IoResult<()> {\n let mut writer = get_writer(output_dir, \"read_method.rs\");\n try!(writer.writ... | rust | edit | null | null | apache-2.0 | bbcd8af20c99e57d91479db916fa57f74786392a | servo/rust-http,Shraddha512/rust-http,chris-morgan/rust-http,chris-morgan/rust-http,servo/rust-http,Shraddha512/rust-http,servo/rust-http,servo/rust-http,Shraddha512/rust-http,Shraddha512/rust-http,chris-morgan/rust-http,Shraddha512/rust-http,chris-morgan/rust-http | codegen/src/read_method.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![allow(unstable)]\nextern crate sss;\nextern crate test;\n\nuse std::collections::VecMap;\nuse std::rand::ChaChaRng;\nuse test::Bencher;\n\n#[bench]\nfn bench_combine(b: &mut Bencher) {\n let mut expected: VecMap<Vec<u8>> = VecMap::new()... | rust | edit | 0 | 2 | mit | f9673581a3346f0047eba3502226cc23c3fc048c | codahale/sss.rs | benches/benches.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::cmp::Ordering;\nuse std::hash::{Hash, Hasher};\nuse uuid::Uuid;\n\npub trait JsTrait {}\n\npub struct JsT {\n uid: Uuid,\n t: Box<JsTrait>,\n}\n\nimpl JsT {\n pub fn new(t: Box<JsTrait>) -> JsT {\n JsT {\n ... | rust | edit | 2 | 3 | mit | 2d99255b87e36ad057cc94011f1e34ee3f107f59 | rustoscript/french-press | src/js_types/js_type.rs | rejected_duplicate | Near-duplicate of sample 121338 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![deny(unsafe_op_in_unsafe_fn)]\n//~^ ERROR the `unsafe_op_in_unsafe_fn` lint is unstable\n\nfn main() {}\n\n```\n\nApply this change: Mark deduplicated errors as expected in gate test"
},
{
"role": "assistant",
"content": "#![de... | rust | edit | 0 | 1 | apache-2.0 | 3599ada976568d0b5326e890d4b0c2f22dcdc985 | graydon/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust | src/test/ui/feature-gates/feature-gate-unsafe_block_in_unsafe_fn.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! Defines a specular metal material\n\nuse std::vec::Vec;\n\nuse film::Colorf;\nuse geometry::Intersection;\nuse bxdf::{BxDF, BSDF, SpecularReflection, fresnel};\nuse material::Material;\n\n/// The Specular Metal material describes specular... | rust | edit | 0 | 1 | mit | 7c65188536fe7c9081284536d8b4d8865d1117ac | GuzTech/tray_rust,voidException/tray_rust,Twinklebear/tray_rust | src/material/specular_metal.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse Application;\nuse ffi;\nuse gio::ApplicationFlags;\nuse glib::object::IsA;\nuse glib::translate::*;\nuse rt;\nuse glib;\nuse glib_ffi;\n\nimpl Application {\n #[cfg(feature = \"v3_6\")]\n fn new(application_id: Option<&str>, flags: ... | rust | edit | null | null | mit | 4835b75be9f221c00d3ec5c6035829f05dc71e16 | rust-gnome/gtk,EPashkin/rust-gnome-gtk,EPashkin/rust-gnome-gtk,rust-gnome/gtk | src/application.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//#![feature(libc)]\n\nextern crate libc;\nextern crate rand;\nextern crate rustc_serialize;\n\nuse rand::*;\n\nmod yubikey;\n\nfn random_challenge() -> Vec<u8> {\n let mut vec: Vec<u8> = Vec::new();\n for _ in 0..64 {\n vec.push... | rust | edit | 0 | 2 | mit | fdab70538e523709d1f3e9a58d61cd6721c7cb2b | jbothma/yubikey-fde,tazjin/yubikey-fde,tazjin/yubikey-fde,jbothma/yubikey-fde | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! Module for working with `Function`s\n//!\n//! This module contains a type alias for `Rc<Fn(f64) -> f64>`,\n//! which is used in many other modules, and functions for\n//! working with the alias.\n\npub use std::rc::Rc;\n\n/// Type alias u... | rust | edit | 0 | 0 | mit | 4207cc9067e3d3c2da7df463658bfb25076a1543 | phillip-h/reikna | src/func.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::convert::From;\n\nuse binding::hash;\nuse types;\n\nuse super::object;\nuse super::traits::RawObject;\n\npub struct Hash {\n value: types::rb_value\n}\n\nimpl Hash {\n pub fn new() -> Self {\n Hash {\n value: ... | rust | edit | 2 | 1 | mit | ba2617f7dd04281b38c7c5cd581e5200de059d67 | d-unseductable/ruru | src/class/hash.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::env;\n\nconst HELP_MESSAGE: &str = r#\"\nUsage:\n table -h | --help\n table -v | --version\n\nOptions:\n -h --help Print help message\n -v --version Print version\n\"#;\n\nconst VERSION: &str = \"0.3.0\";\n\nfn main() {\n ... | rust | edit | 0 | 4 | mit | 080983d5f9a15a85625b9ee6f717e1930ebfb8bd | naoty/table | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse serde_json::*;\n\nuse super::super::lex::*;\n\n///\n/// Creates a lexing tool for the scripting language\n///\npub fn create_lex_script_tool() -> StringLexingTool {\n // Parse the lexer\n let script_json = from_str::<Vec<LexToolSymb... | rust | edit | 0 | 2 | apache-2.0 | 966bf159c612692d059602153177d68676f29398 | Logicalshift/gossyp,Logicalshift/gossyp | src/script/lex_script_tool.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! Implements `Syscalls` for all types that implement `RawSyscalls`.\n\nuse crate::{RawSyscalls, Syscalls, YieldNoWaitReturn};\n\nmod yield_op {\n pub const NO_WAIT: u32 = 0;\n pub const WAIT: u32 = 1;\n}\n\nimpl<S: RawSyscalls> Syscal... | rust | edit | 0 | 1 | apache-2.0 | c877a6c44324b0135017ab1e1300c0d666746c84 | tock/libtock-rs | core/platform/src/syscalls_impl.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate test;\nextern crate ndarray;\n\nuse ndarray::Array;\n\n#[bench]\nfn time_matmul(b: &mut test::Bencher)\n{\n b.iter(|| {\n let mut a: Array<uint, (uint, uint)> = Array::zeros((2u, 3u));\n for (i, elt) in a.iter_mu... | rust | edit | null | null | apache-2.0 | 060d83133fc4ed433f8b310dd771236b222299ce | Pireax/rust-ndarray,SuperFluffy/rust-ndarray,SuperFluffy/rust-ndarray,Pireax/rust-ndarray | tests/tests.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::io::{Result, SeekFrom};\nuse std::syscall::*;\nuse std::Url;\n\npub struct Resource;\n\nimpl Resource {\n pub fn dup(&self) -> Result<Box<Resource>> {\n Ok(box Resource)\n }\n\n pub fn path(&self) -> Result<String> {\... | rust | edit | null | null | mit | da37f3e2a6d0bfa6a293b77f6a69b9f3064bc7ec | Lacaranian/redox,rexlunae/redox,Lacaranian/redox,Lacaranian/redox,Lacaranian/redox,rexlunae/redox,rexlunae/redox,Lacaranian/redox | filesystem/schemes/pty/main.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[macro_use]\nmod macros;\n\nuse syn::Stmt;\n\n#[test]\nfn test_raw_operator() {\n let stmt = syn::parse_str::<Stmt>(\"let _ = &raw const x;\").unwrap();\n\n snapshot!(stmt, @r###\"\n Local(Local {\n pat: Pat::Wild,\n i... | rust | edit | 1 | 1 | apache-2.0 | ba4f188168c11f61f8db79a00a166fe0a1c6a378 | dtolnay/syn | tests/test_stmt.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\npub struct Gauge<T> {\n pub value: T\n}\n\n\nimpl<T> Gauge<T> {\n pub fn update(&mut self, value: T) {\n self.value = value\n }\n\n pub fn snapshot(self) -> Gauge<T> {\n Gauge { value: self.value }\n }\n}\n\n\n#[c... | rust | edit | 0 | 2 | apache-2.0 | b96b5f888c060b1afc7b0c0463d3e18d7d01df09 | ekarlso/rust-metrics,ekarlso/rust-metrics | src/gauge.rs | rejected_duplicate | Near-duplicate of sample 119764 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse super::{Resource, Url};\n\nuse alloc::boxed::Box;\n\nuse system::error::{Error, Result, ENOENT};\nuse system::syscall::Stat;\n\n#[allow(unused_variables)]\npub trait KScheme {\n fn on_irq(&mut self, irq: u8) {\n\n }\n\n fn scheme... | rust | edit | 0 | 1 | mit | 32b9e1c74726dab76b802fccd6fc07924ca6aa14 | tedsta/redox,tedsta/redox,nounoursheureux/redox,nounoursheureux/redox,vvlevchenko/redox,tedsta/redox,vvlevchenko/redox,imp/redox,nounoursheureux/redox,tedsta/redox,imp/redox,imp/redox,vvlevchenko/redox | kernel/fs/kscheme.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::io::{File, Open, ReadWrite};\nuse std::io::IoResult;\nuse super::GapBuffer;\nuse super::gap_buffer;\nuse super::Position;\nuse super::Range;\n\npub struct Buffer {\n data: GapBuffer,\n file: Option<File>,\n cursor: Position,... | rust | edit | 1 | 3 | mit | b3b179ecb40c894ed09b9a92b704c65898c69a10 | jmacdonald/scribe | src/buffer/buffer.rs | rejected_duplicate | Near-duplicate of sample 119997 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::error::Error;\n\npub trait AsDynError {\n fn as_dyn_error(&self) -> &(dyn Error + 'static);\n}\n\nimpl<T: Error + 'static> AsDynError for T {\n fn as_dyn_error(&self) -> &(dyn Error + 'static) {\n self\n }\n}\n\nimpl ... | rust | edit | 0 | 2 | apache-2.0 | 678cd7ac7b0fb2482d93a9ceccb8824a9eb3c646 | dtolnay/thiserror | src/aserror.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Run with `rust run hello.rs`\n\nfn greeter(greeting_text: &str) {\n println(fmt!(\"Hello %s!\", greeting_text));\n}\n\nfn main() {\n greeter(\"World\");\n}\n\n```\n\nApply this change: Make Rust example work in post-rust-1.0 world"
... | rust | edit | 0 | 1 | mit | 9f078a33062ff75d24b011acbf8887a1dce778ae | pxlpnk/xhelloworlds,pxlpnk/xhelloworlds,pxlpnk/xhelloworlds,pxlpnk/xhelloworlds,pxlpnk/xhelloworlds,pxlpnk/xhelloworlds,pxlpnk/xhelloworlds,pxlpnk/xhelloworlds,pxlpnk/xhelloworlds,pxlpnk/xhelloworlds,pxlpnk/xhelloworlds,pxlpnk/xhelloworlds | rust/hello.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[macro_export]\nmacro_rules! poll {\n ($e:expr) => ({\n loop {\n match $e {\n ::futures::__rt::Ok(::futures::Async::Ready(e)) => {\n break ::futures::__rt::Ok(e)\n }\n ... | rust | edit | 0 | 0 | unlicense | 9579d00951996a2216cd87ca4caa4ca111feeca9 | iovxw/plasmodesmata | src/macros.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\npub fn encrypt(text: &str) -> String {\n let text = text.to_lowercase()\n .chars()\n .filter(|c| c.is_lowercase())\n .collect::<Vec<_>>();\n\n if text.is_empty() {\n return String::new();\n }\n\n let ro... | rust | edit | 0 | 1 | mit | 500adddb73b40aae388d5aa417bd87c366fe469a | attilahorvath/exercism-rust | crypto-square/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::ops::{Add, Sub};\n\n#[derive(Debug,Copy,Clone,PartialEq,Eq)]\npub enum LimitVal {\n Val(u8)\n}\n\n\nimpl Add for LimitVal {\n type Output = LimitVal;\n\n fn add(self, other: LimitVal) -> LimitVal {\n let val1 = match ... | rust | edit | 3 | 3 | apache-2.0 | e905a9240a320bda7b72c6485e35b41baeedbb5e | jpace121/RustRestrictedIntegers | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse js::exec::{Executor, Interpreter};\nuse syntax::Lexer;\nuse syntax::Parser;\nuse getopts::Matches;\nuse std::io::stdio::stdin;\nuse std::io::{BufReader, BufferedReader};\n/// An interactive command-line mode\npub struct Interactive {\n\tm... | rust | edit | 1 | 5 | mit | 19ed8c3e24a285e398a274bc5548d950929d6192 | new-mind/js.rs,synlestidae/js.rs,TomBebbington/js.rs,synlestidae/js.rs,TomBebbington/js.rs,new-mind/js.rs | src/front/interactive.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nfn main() {\n unsafe {\n let m = &mut () as *mut ();\n m.offset(0);\n m.wrapping_add(0);\n m.sub(0);\n m.wrapping_sub(0);\n\n let c = &() as *const ();\n c.offset(0);\n c.wrapping_add... | rust | edit | 9 | 1 | apache-2.0 | 642239c857124b109f43f7223baddbe8694c84ee | graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust | tests/ui/zero_offset.rs | rejected_lint | Too many lint violations: 9 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n/// `ExpectedVersion` represents the different modes of optimistic locking when writing to a stream\n/// using `WriteEventsBuilder`.\n#[derive(Debug, Copy, Clone, Eq, PartialEq)]\npub enum ExpectedVersion {\n /// No optimistic locking\n ... | rust | edit | 1 | 2 | mit | b20e38a2515f3c2dccb4f596b5516bb4a2a9261d | koivunej/eventstore-tcp,koivunej/eventstore-tcp | src/expected_version.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Copyright 2018 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 | ed7e4e1e27d21d47b93f756e615b5cb750275c3f | GBGamer/rust,graydon/rust,graydon/rust,GBGamer/rust,GBGamer/rust,aidancully/rust,graydon/rust,GBGamer/rust,aidancully/rust,GBGamer/rust,graydon/rust,graydon/rust,GBGamer/rust,graydon/rust,GBGamer/rust,GBGamer/rust,aidancully/rust,aidancully/rust,aidancully/rust,aidancully/rust | src/test/run-pass/union/union-const-eval-field.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n\n\n\n/**\n * Bindings the runtime's random number generator (ISAAC).\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 =\n obj {\n ... | rust | edit | null | null | apache-2.0 | 897080bc1bea4fad1b9b6fb0e7ceed23b3596a8b | 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// $ cargo bench --features full --bench file\n\n#![feature(rustc_private, test)]\n#![recursion_limit = \"1024\"]\n#![allow(clippy::missing_panics_doc, clippy::must_use_candidate)]\n\nextern crate test;\n\n#[macro_use]\n#[path = \"../tests/ma... | rust | edit | 0 | 2 | apache-2.0 | 4225638710ee2e63238c48f86e93d1445ba2c485 | dtolnay/syn | benches/file.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Copyright 2014 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 | 0 | 0 | apache-2.0 | a955aba2b1d6ede679c34b022a6bc4c6560677ee | servo/string-cache | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![cfg_attr(feature = \"nightly-testing\", feature(plugin))]\n#![cfg_attr(feature = \"nightly-testing\", plugin(clippy))]\n\n#![cfg_attr(not(feature = \"with-syntex\"), feature(proc_macro, plugin))]\n#![cfg_attr(not(feature = \"with-syntex\")... | rust | edit | 0 | 0 | apache-2.0 | f7bdf86e870f03591c0728679cc47d189200094a | bolinfest/serde-jsonrc,serde-rs/json,google/serde_json_lenient | json_tests/tests/test.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate syn;\n\nuse syn::{\n parse::{Parse, ParseStream},\n parse::discouraged::Speculative,\n Result,\n};\n\n#[test]\n#[should_panic(expected = \"Fork was not derived from the advancing parse stream\")]\nfn smuggled_speculative... | rust | edit | 0 | 3 | apache-2.0 | 48e29168861ef1770e48d59e587e9b4fb4240671 | dtolnay/syn | tests/test_parse_buffer.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![crate_type = \"lib\"]\n#![crate_name = \"leveldb\"]\n#![feature(globs,phase)]\n#![phase(syntax, link)] extern crate log;\n\nextern crate serialize;\nextern crate libc;\n\npub use database::options as options;\npub use database::error as er... | rust | edit | 2 | 0 | mit | 00f207c71e29e501c521a3d480f432d63976c2a0 | skade/leveldb,alekseysidorov/leveldb,alekseysidorov/leveldb | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n\nextern crate rand;\nextern crate ndarray;\nextern crate ndarray_rand;\nextern crate ndarray_linalg as linalg;\n\nuse ndarray::prelude::*;\nuse linalg::SquareMatrix;\nuse rand::distributions::*;\nuse ndarray_rand::RandomExt;\n\nfn all_close(... | rust | edit | 0 | 2 | mit | c04cd8d882776ccb0d93bc60c85783b9a42c9ca9 | termoshtt/ndarray-linalg | tests/inv.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse rusoto_core::signature;\n\n/// URL encodes an S3 object key. This is necessary for `copy_object` and `upload_part_copy`,\n/// which require the `copy_source` field to be URL encoded.\n///\n/// # Examples\n///\n/// ```\n/// use rusoto_s3::... | rust | edit | 0 | 1 | mit | 1f2ac5f43514b1c52b00dc9573480a6469e7bdfb | DualSpark/rust-aws,mattico/rusoto,DualSpark/rusoto,mthjones/rusoto,DualSpark/rusoto,rusoto/rusoto,DualSpark/rust-aws,DualSpark/rusoto,DualSpark/rust-aws,rusoto/rusoto,rusoto/rusoto,SecurityInsanity/rusoto,SecurityInsanity/rusoto,mattico/rusoto,mattico/rusoto,mthjones/rusoto | rusoto/services/s3/src/custom/util.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate rustix;\n\nuse std::io::Read;\nuse std::fs::File;\n\nuse rustix::bot;\nuse rustix::client::MatrixClient;\nuse rustix::services::echo::*;\nuse rustix::services::self_filter::*;\nuse rustix::services::upvote::*;\n\n\nfn main() {\n ... | rust | edit | 0 | 1 | mit | d6d0e761c7483f15f11eac338d216a3f10eff832 | jpypi/rustix | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::any::{ Any };\nuse std::collections::HashMap;\n\nuse super::{ GetterErr, Registry };\nuse super::definition::{ TypeDef };\nuse super::getter::{ GetterWrap };\n\npub struct Container {\n typedefs: HashMap<String, TypeDef>,\n get... | rust | edit | 0 | 4 | apache-2.0 | 2d5f019f262c02fefbec0001ae6bd8d6db1c61be | Nercury/di-rs | src/container.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n///\n/// Convert a number between two bases.\n///\n/// A number is any slice of digits.\n/// A digit is any unsigned integer (e.g. u8, u16, u32, u64, or usize).\n/// Bases are specified as unsigned integers.\n///\n/// Return an `Err(.)` if th... | rust | edit | 0 | 4 | bsd-2-clause | 11fdd9c3cd22a52f07ae825c742fea5a8ef8d0c1 | gyn/exercism,gyn/exercism,gyn/exercism,gyn/exercism | rust/all-your-base/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nmod gen;\nmod syntax;\n\nuse gen::include;\nuse std::io::{self, Write};\nuse std::path::PathBuf;\nuse structopt::StructOpt;\n\n#[derive(StructOpt, Debug)]\n#[structopt(name = \"cxxbridge\", author)]\nstruct Opt {\n /// Input Rust source fi... | rust | edit | 1 | 2 | apache-2.0 | fa66e2afa6f43034a564ded0f4ee8a6555f7160d | dtolnay/cxx,dtolnay/cxx,dtolnay/cxx,dtolnay/cxx | cmd/src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n///!\n///! Standard plugin is of the type of view plugins and backend plugins\n///! which follows the same structure in the shared libs\n///!\n\nuse dynamic_reload::Lib;\nuse libc::{c_char, c_void};\nuse std::rc::Rc;\nuse std::mem::transmute;... | rust | edit | 2 | 1 | mit | 953923c8eff2524590ff7f043cb26451564d218f | emoon/ProDBG,emoon/ProDBG,SlNPacifist/ProDBG,v3n/ProDBG,kondrak/ProDBG,emoon/ProDBG,SlNPacifist/ProDBG,emoon/ProDBG,kondrak/ProDBG,emoon/ProDBG,kondrak/ProDBG,SlNPacifist/ProDBG,v3n/ProDBG,kondrak/ProDBG,kondrak/ProDBG,SlNPacifist/ProDBG,kondrak/ProDBG,v3n/ProDBG,v3n/ProDBG,emoon/ProDBG,SlNPacifist/ProDBG,v3n/ProDBG,Sl... | src/prodbg/core/src/plugin.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate orbtk;\n\n#[cfg(target_os = \"redox\")]\n#[no_mangle]\npub fn main() {\n orbtk::example();\n}\n\n#[cfg(not(target_os = \"redox\"))]\nfn main() {\n orbtk::example();\n}\n\n```\n\nApply this change: Replace contents with big ... | rust | edit | 0 | 1 | mit | 6366e0bc35f4021e40f684f746dff216fe5c4ca8 | redox-os/editor,redox-os/orbutils | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse core::clone::Clone;\n\nuse kernel::mm::{Flags, PageDirectory};\nuse kernel::mm::physical;\n\nuse util::rt::breakpoint;\n\nuse platform::cpu::mmu;\n\npub struct Process {\n pub eip: u32,\n pub esp: u32,\n pub paging: physical::Phy... | rust | edit | 1 | 1 | mit | c6c63f24568cebd6951843ca12b4c9df00c0c1f9 | alexchandel/rustboot | common/kernel/process.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n/*\n** A simple program that allows basic arithmetic operations using roman numerals and conversions to decimal numbers.\n*/\n\nfn main() {\n\n\tlet roman_number = \"CLIII\";\n\tlet decimal_number = to_decimal(&roman_number);\n\n\tprintln!(\"... | rust | edit | 0 | 5 | mit | 0600d61f1f1fd54173686e90f3959e3e9fd40848 | tzkhan/roman-rust | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::fmt::{Display, Formatter, Result};\n\n#[derive(Clone, Copy, Debug, PartialEq)]\npub enum Orientation {\n Right,\n UpRight,\n Up,\n UpLeft,\n Left,\n DownLeft,\n Down,\n DownRight,\n Still,\n}\n\nimpl Display for Orientation ... | rust | edit | 0 | 2 | apache-2.0 | 83b645f0684d072e302ec7fa939dda3facf3dc2d | Laastine/zombie-shooter,Laastine/zombie-shooter | src/graphics/orientation.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate ultra;\n\nfn main() {\n println!(\"Hello, World War II\");\n}\n\n```\n\nApply this change: Add basic enciphering functionality to CLI"
},
{
"role": "assistant",
"content": "extern crate ultra;\n\nuse std::io::{stdi... | rust | edit | 0 | 2 | mit | 6841b2ce5940ac21e53da254a745e7645019ed7f | iKevinY/ultra | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::mem;\nuse std::sync;\n\npub struct Lazy<T> {\n pub lock: sync::Once,\n pub ptr: *const T,\n}\n\nimpl<T> Lazy<T> {\n pub fn get(&self, init: || -> T) -> &'static T {\n unsafe {\n self.lock.doit(|| {\n ... | rust | edit | null | null | bsd-2-clause | c1e1d11a055ede414b5da9d4bd6e66aecd510a85 | thijsc/rust-protobuf,plietar/rust-protobuf,meisterpeeps/rust-protobuf,Stebalien/rust-protobuf,Blei/rust-protobuf,filsmick/rust-protobuf,jimmycuadra/rust-protobuf,jamwt/rust-protobuf,tempbottle/rust-protobuf,jamwt/rust-protobuf,danburkert/rust-protobuf,danburkert/rust-protobuf,Stebalien/rust-protobuf,tempbottle/rust-pro... | src/lib/lazy.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse game::{Position, Move};\nuse types::{NumNodes, NumMoves, NumPlies};\n\n#[derive(Clone, Debug)]\npub struct State {\n pub pos: Position,\n pub prev_pos: Option<Position>,\n pub prev_move: Option<Move>,\n pub param: Param,\n}\n\... | rust | edit | 0 | 1 | mit | 05dfed27df8e9f1227e59bcf75e4cb8660ec94a3 | theemathas/binary_turk | src/search/types.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! Command line utility for querying and working with Iridium SBD messages.\n\nextern crate docopt;\nextern crate rustc_serialize;\nextern crate sbd;\n\nuse docopt::Docopt;\n\nuse sbd::filesystem::Storage;\n\nconst USAGE: &'static str = \"\n... | rust | edit | 0 | 5 | apache-2.0 | 8f1f96e627424a332aa7e10be258ec77da8fbacd | gadomski/sbd-rs | 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 | 4 | mit | 0b90b26d77903162e58f3b8e330dd165cd8acb9b | nafarlee/thoughtfuck | src/program.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::default::Default;\n\n#[derive(Copy, Clone)]\npub struct TexturePackerConfig {\n //\n // layout configuration\n //\n pub max_width: u32,\n pub max_height: u32,\n pub allow_rotation: bool,\n\n //\n // texture co... | rust | edit | 0 | 1 | mit | adf8da4ba79839b1836a20cd75b9bc4359e58eb0 | bvssvni/texture_packer,PistonDevelopers/texture_packer | src/texture_packer_config.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![crate_type = \"lib\"]\n#![deny(missing_debug_implementations, missing_copy_implementations,\n trivial_casts, trivial_numeric_casts, unsafe_code, unstable_features,\n unused_import_braces, unused_qualifications)]\n#![warn(miss... | rust | edit | 1 | 0 | apache-2.0 | c9069c454fe11da43ff8169c9a2f0b8cec332ddb | Enet4/dicom-rs,Enet4/dicom-rs | core/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![feature(plugin)]\n#![plugin(clippy)]\n\n#[warn(str_to_string)]\n//~^WARNING: warning: lint str_to_string has been removed: using `str::to_string`\n#[warn(string_to_string)]\n//~^WARNING: warning: lint string_to_string has been removed: usi... | rust | edit | 4 | 1 | apache-2.0 | 056b0c1cf2c55510f8b1e4698d31b71dce00c3b7 | graydon/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust | tests/run-pass/deprecated.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse tableau::tables::Table;\n\npub fn get_enter_var_column_index(table: &Table) -> usize {\n let table_rows = table.get_rows();\n let last_row_index = table_rows.len() - 1;\n // Select the most negative cell in the objective function... | rust | edit | 0 | 3 | mit | ef90893cf7788b54582f843e75bf1c5ad9b9983a | MrKonstantinT/rust-cassowary | src/tableau/enter_vars.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[derive(Copy, Clone, Debug)]\npub enum TockValue<E> {\n Expected(E),\n Unexpected(isize),\n}\n\npub type TockResult<T, E> = Result<T, TockValue<E>>;\n\npub trait TockResultExt<T, E>: Sized {\n fn as_expected(self) -> Result<T, E>;\n... | rust | edit | 0 | 4 | apache-2.0 | 8800af2ec0608ed71699e4199d110896082bfa93 | tock/libtock-rs | src/result.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!(\"Hello in my guessing game!\");\n\n let secret_number = rand::thread_rng().gen_range(1, 101);\n\n println!(\"The secret number is:... | rust | edit | 0 | 2 | mit | 2d88305417bd7bca7fdfe07ed597ff938dbc1468 | pgrzesik/learning-rust | guessing_game/src/main.rs | rejected_duplicate | Near-duplicate of sample 119939 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nnative \"rust\" mod rustrt {\n fn rust_list_files(str path) -> vec[str];\n fn rust_file_is_dir(str path) -> int;\n}\n\nimpure fn list_dir(str path) -> vec[str] {\n ret rustrt.rust_list_files(path+\"*\");\n}\n\nconst char path_sep = '\\\\';... | rust | edit | null | null | apache-2.0 | 0c7545c1ceb96dce7e4ace1718dcb3077f877135 | kwantam/rust,mdinger/rust,zubron/rust,kimroen/rust,victorvde/rust,fabricedesre/rust,l0kod/rust,quornian/rust,mvdnes/rust,sarojaba/rust-doc-korean,zachwick/rust,nham/rust,miniupnp/rust,defuz/rust,vhbit/rust,jbclements/rust,untitaker/rust,mitsuhiko/rust,mvdnes/rust,cllns/rust,GBGamer/rust,graydon/rust,jashank/rust,barosl... | src/lib/win32_fs.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[macro_use]\nextern crate log;\nextern crate unicode_xid;\n\nmod bottom_up;\nmod db;\nmod matching;\nmod name_table;\nmod parser;\nmod program;\nmod types;\n\npub struct Context {\n evaluator: bottom_up::BottomUpEvaluator,\n}\n\n#[derive(... | rust | edit | 2 | 2 | apache-2.0 | 61a1ceaf583f6db8ab8a6f647537240c687ac368 | zentner-kyle/deltalog | rlog/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::collections::HashMap;\n\nuse rustc_serialize::json;\n\nuse schema::{UnitOption, UnitStates};\nuse fleet::FleetAPI;\n\npub struct Client {\n fleet: FleetAPI,\n}\n\nimpl Client {\n pub fn new(root_url: &'static str) -> Client {\n... | rust | edit | 0 | 1 | mit | f70fdecb56171972a79316875deeeaab927cbc28 | jimmycuadra/rust-fleet,jimmycuadra/rust-fleet | src/client.rs | rejected_duplicate | Near-duplicate of sample 120973 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[derive(Debug, PartialEq)]\npub struct CTError {\n pub kind: CTErrorKind,\n pub desc: String,\n pub pos: Option<(usize, usize)>,\n}\n\n#[derive(Debug, PartialEq)]\npub enum CTErrorKind {\n InputError,\n DatabaseError,\n}\n\npu... | rust | edit | 0 | 5 | mit | 26fe1001b552025612ec0280c92c85994c0df098 | opp11/chemtool2 | src/error.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\npub fn reply(message: &str) -> &str {\n if is_silence(message) { \"Fine. Be that way!\" }\n else if is_yelling(message) { \"Whoa, chill out!\" }\n else if is_question(message) { \"Sure.\" }\n else { \"Whatever.\" }\n}\n\nfn is_sil... | rust | edit | 0 | 4 | mit | 5264bc886bb42cdbd1ce61820ecc19c36dd0ea48 | sacherjj/rust,medek/xrust,sacherjj/rust,Rust-Twin-Cities/flaming-octo-wookie,pminten/xrust,Rust-Twin-Cities/flaming-octo-wookie,petertseng/exercism-rust,pminten/xrust,spazm/xrust,Jeff-Hostetler/xrust,spazm/xrust,Jeff-Hostetler/xrust,exercism/xrust,petertseng/exercism-rust,exercism/xrust,ekse/exercism-rust,stevejb71/xru... | bob/example.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[macro_use]\nextern crate askama;\n\nuse askama::Template;\n\n#[derive(Template)] // this will generate the code...\n#[template(path = \"hello.html\", print = \"all\")] // using the template in this path, relative\n ... | rust | edit | 0 | 1 | apache-2.0 | cd685eefb48bf16ff1e15205228a758daccb0dd6 | djc/askama,djc/askama,djc/askama | testing/tests/hello.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse mio::*;\nuse mio::tcp::TcpListener;\nuse std::net::{IpAddr, Ipv4Addr, SocketAddr};\n\nuse super::eventhandler::*;\n\npub struct Relay {\n port: u16,\n}\n\nimpl Relay {\n pub fn new(port: u16) -> Relay {\n Relay {\n ... | rust | edit | 1 | 2 | apache-2.0 | 6aa3545e1027e8b2a4f511ad3340e53ac6074c7c | WPO-Foundation/gnirehtet,WPO-Foundation/gnirehtet,Genymobile/gnirehtet,WPO-Foundation/gnirehtet,Genymobile/gnirehtet,WPO-Foundation/gnirehtet,Genymobile/gnirehtet | rustrelay/src/relay/relay.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Copyright © 2015, Peter Atashian\n// Licensed under the MIT License <LICENSE.md>\n//! Macro APIs, window message crackers, and control APIs\n//1233\npub fn GET_X_LPARAM(lp: ::LPARAM) -> ::c_int {\n\t::LOWORD(lp as ::DWORD) as ::c_int\n}\np... | rust | edit | 0 | 1 | apache-2.0 | 238c8155a0b425a1a72ff842b7c33db8a497b0dd | jmesmon/winapi-rs,bvinc83/winapi-rs,gentoo90/winapi-rs,Boddlnagg/winapi-rs,tomaka/winapi-rs,ROki1988/winapi-rs,overdrivenpotato/winapi-rs,DenisKolodin/winapi-rs,docbrown/winapi-rs,bungcip/winapi-rs,roblabla/winapi-rs,alexcrichton/winapi-rs,DoumanAsh/winapi-rs,Osspial/winapi-rs,Connorcpu/winapi-rs | src/windowsx.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nfn largest<T>(list: &[T]) -> T {\n let mut largest = list[0];\n\n for &item in list.iter() {\n if item > largest {\n largest = item;\n }\n }\n\n largest\n}\n\nstruct Point<T, U> {\n x: T,\n y: U,\n}\... | rust | edit | 4 | 3 | mit | f049aefa24349bc8ef3e021cf973ecf07bc7ef50 | pgrzesik/learning-rust | 21_generics/src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nfn main() {\n let length = 50;\n let width = 30;\n\n println!(\n \"Area of rectangle with length: {} and width: {} is equal to: {}\",\n length, width, area(length, width)\n );\n}\n\nfn area(length: u32, width: u32) -... | rust | edit | 0 | 1 | mit | 00d55bb18eb6eddbf051182ae6d12debff3704d0 | pgrzesik/learning-rust | 13_rectangle_area/src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Copyright 2013-2016, The Gtk-rs Project Developers.\n// See the COPYRIGHT file at the top-level directory of this distribution.\n// Licensed under the MIT license, see the LICENSE file or <http://opensource.org/licenses/MIT>\n\nuse std::sl... | rust | edit | 2 | 2 | mit | c0ac0f798d9e717e2a1b8a08740a472f37626230 | gkoz/rust-gnome-gtk,daa84/gtk,EPashkin/rust-gnome-gtk,gkoz/gtk-rs-gtk,Susurrus/gtk,daa84/gtk,rust-gnome/gtk,Susurrus/gtk,gkoz/rust-gnome-gtk,EPashkin/rust-gnome-gtk,gkoz/gtk-rs-gtk,rust-gnome/gtk | src/tree_path.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate rocksdb;\n\nuse rocksdb::{Options, DB};\n\n#[test]\nfn test_pinnable_slice() {\n let path = \"_rust_rocksdb_pinnable_slice_test\";\n\n let mut opts = Options::default();\n opts.create_if_missing(true);\n let db = DB::... | rust | edit | 0 | 1 | apache-2.0 | aa2c6959418392759bce37e25dcd933d26be8984 | spacejam/rust-rocksdb,spacejam/rust-rocksdb,spacejam/rust-rocksdb | tests/test_pinnable_slice.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add doctest, just for example sake, it does not work"
},
{
"role": "assistant",
"content": "// This definition works for current file.\n// Everywhere.\n#![allow(dead_code)]\n\n// Doc tests. Looks fine.\nuse std::ops::Range;\n/// Re... | rust | new_file | 0 | 4 | mit | f2be005c8b9f222d4b1322c620f0d1208ef3d22a | raventid/coursera_learning,raventid/coursera_learning,raventid/coursera_learning,raventid/coursera_learning,raventid/coursera_learning,raventid/coursera_learning,raventid/coursera_learning,raventid/coursera_learning,raventid/coursera_learning,raventid/coursera_learning | rust/programming_rust_notes/annotations.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nfn main() {\n let length = 50;\n let width = 30;\n\n println!(\n \"Area of rectangle with length: {} and width: {} is equal to: {}\",\n length, width, area(length, width)\n );\n\n let rect = (length, width);\n\n ... | rust | edit | 0 | 2 | mit | 92c00e49bf6ca117c75569f7ada3484f15168907 | pgrzesik/learning-rust | 13_rectangle_area/src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nmod keyboard;\nmod mouse;\nmod state;\n\npub use self::keyboard::{Keyboard, KeyboardState};\npub use self::mouse::{Mouse, MousePosition, MouseProximity, MouseState};\npub use self::state::{Element, Input, InputState, InputDifference, InputTra... | rust | edit | 1 | 0 | mit | 9e435aadefea47c6a13f02259c2b640a58a42ce8 | olson-sean-k/bismuth | src/input/mod.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse crate::translation_utils::SignatureIndex;\nuse cranelift_entity::PrimaryMap;\nuse std::boxed::Box;\n\n/// Contains information decoded from the Wasm module that must be referenced\n/// during each Wasm function's translation.\n///\n/// Th... | rust | edit | 0 | 1 | apache-2.0 | 86b3784783536966c825334b0c6eae283fd43558 | stoklund/cretonne,stoklund/cretonne,stoklund/cretonne | cranelift-wasm/src/state/module_state.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate dbus;\nextern crate futures;\nextern crate tokio_core;\nextern crate mio;\n\n/// Tokio integration for dbus\n///\n/// For examples to get you started, see the examples directory and the Readme.\n\npub mod tree;\n\nmod adriver;\n\... | rust | edit | 2 | 0 | apache-2.0 | a59c2b92326e772db71519ba7e0f6506d151d8f4 | manuels/dbus-rs | async/dbus-tokio/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::path::Path;\n\npub trait Command {\n fn call<S>(&self) -> Vec<&str>;\n}\n\npub struct Session {\n pub name: String,\n pub window_name: String,\n pub root_path: Path\n}\n\nimpl Command for Session {\n fn call<S>(&self) ... | rust | edit | 0 | 1 | mit | 669b18dda236f8e47625b4d085e8175ac1c8e49e | brianp/muxed,brianp/muxed | src/load/v2.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse test::*;\nuse mock::*;\n\nmacro_rules! test_prim_encode {\n ($({ $testname:ident, $iter:expr, $variant:ident, $T:ty }),*) => {$(\n #[test]\n fn $testname() {\n for val in $iter {\n let mut protoc... | rust | edit | 0 | 1 | apache-2.0 | 882755291b7f4a4f2107af60415c7cca73d239d9 | terminalcloud/thrift,terminalcloud/thrift,terminalcloud/thrift,terminalcloud/thrift,terminalcloud/thrift,terminalcloud/thrift,terminalcloud/thrift,terminalcloud/thrift,terminalcloud/thrift,terminalcloud/thrift,terminalcloud/thrift,terminalcloud/thrift,terminalcloud/thrift | lib/rs/src/test/prim.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n\nuse test_tools::*;\n\nuse super::TheModule;\n\n//\n\nfn basic_test()\n{\n use TheModule::*;\n\n // test.case( \"time::now\" );\n let got = time::now();\n assert!( got > 0 );\n\n // test.case( \"time::ms::now\" );\n let got1 = time::no... | rust | edit | 0 | 1 | mit | 1cac56f4dcd9dbbcccdb8fc2a2cdec025ff59cfc | Wandalen/wTools,Wandalen/wTools | rust/test/time/now_test.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Copyright 2018 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 | f8fc5c0523c174e27e670525f5fa22d087315507 | graydon/rust,GBGamer/rust,GBGamer/rust,graydon/rust,aidancully/rust,graydon/rust,GBGamer/rust,aidancully/rust,GBGamer/rust,GBGamer/rust,GBGamer/rust,graydon/rust,GBGamer/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust,GBGamer/rust,aidancully/rust,graydon/rust | src/test/ui/issue-49257.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate msgflo;\n\nuse msgflo::participant::{Participant, InfoBuilder, Info};\n\nstruct Repeat {\n state: Option<String>, // we don't really have any state\n}\n\nimpl Participant for Repeat {\n fn info(&self) -> Info {\n Inf... | rust | edit | 0 | 1 | mit | bc4c92d0e1c57db56a927e295f73d77df61927d4 | msgflo/msgflo-rust | examples/repeat.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! Interrupt instructions\n\nstatic mut INTERRUPTS_ENABLED: bool = false;\n\n/// Clear interrupts\n#[inline(always)]\npub unsafe fn disable() {\n println!(\"CLEAR INTERRUPTS\");\n INTERRUPTS_ENABLED = false;\n}\n\n/// Set interrupts\n#... | rust | edit | 0 | 1 | mit | b83bdb364356236a960e1278f66d0052dd901d11 | Stephen-Seo/redox,k0pernicus/redox,jackpot51/redox,Yoric/redox,Yoric/redox,Yoric/redox,jackpot51/redox,redox-os/redox,jackpot51/redox | arch/test/src/interrupt.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n\n#![feature(globs)]\n\nextern crate graphics;\nextern crate piston;\n\nuse piston::{\n AssetStore,\n Game,\n GameWindow,\n GameWindowSDL2,\n GameWindowSettings,\n keyboard,\n};\n\npub struct App;\n\nimpl App {\n /// Crea... | rust | edit | null | null | mit | 512144fc92a1eabf1e97f5a586bc1f1dbbf8ed07 | oldmanmike/piston,axelmagn/piston,bvssvni/piston,Potpourri/piston,getynge/piston,mitchmindtree/piston,placrosse/piston,KevinFrans3/piston,bvssvni/piston,tempbottle/piston,caldwell/piston,PistonDevelopers/piston,PistonDevelopers/piston | examples/print_keyboard_key.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![allow(unstable)]\n\nextern crate tcod;\n\npub mod engine;\npub mod gui;\npub mod util;\n\n```\n\nApply this change: Allow unstable features during alpha"
},
{
"role": "assistant",
"content": "#![feature(core, collections, io, p... | rust | edit | 2 | 0 | bsd-3-clause | e7c8edcb79bbd40e898403c1cf2adcaec93f5312 | jgilchrist/rslike | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[macro_use]\nextern crate nom;\n\npub mod metadata;\nmod frame;\nmod utility;\n\nuse metadata::metadata_parser;\nuse frame::frame_parser;\n\npub struct Stream {\n pub info: metadata::StreamInfo,\n pub metadata: Vec<metadata::Block>,\n pub... | rust | edit | null | null | bsd-3-clause | d8626dba5bc3b1b86020b937d9ea437f97c0fe13 | sourrust/flac | src/lib.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\npub trait ToRef<'a> {\n type Ref: 'a;\n\n fn to_ref(&'a self) -> Self::Ref;\n}\n\npub trait ToMut<'a>: ToRef<'a> {\n type Mut: 'a;\n\n fn to_mut(&'a mut self) -> Self::Mut;\n}\n\nimpl<'a, T: 'a> ToRef<'a> for &'a T {\n type Ref... | rust | edit | 2 | 2 | apache-2.0 | e73a0a45291e6c46d0fdec5628daac0a4e562676 | kylewlacy/glitter,kylewlacy/glitter | src/to_ref.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse crate::spec::{LinkerFlavor, Target, TargetResult};\n\npub fn target() -> TargetResult {\n let mut base = super::linux_base::opts();\n base.cpu = \"x86-64\".to_string();\n base.max_atomic_width = Some(64);\n base.pre_link_args.... | rust | edit | 0 | 1 | apache-2.0 | 10d415938ed8d87aa5cda7ef23680a16bcad288b | graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust | src/librustc_target/spec/x86_64_unknown_linux_gnux32.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nmod types;\nmod parser;\nmod metadata;\n\npub use self::types::{\n Block, BlockData,\n StreamInfo, Application, VorbisComment, CueSheet, Picture,\n SeekPoint, CueSheetTrack, CueSheetTrackIndex, PictureType,\n MetaDataConsumer,\n};\n\npub ... | rust | edit | 1 | 0 | bsd-3-clause | d82d8c947cc1101ea11ef1706357f39d4746458c | sourrust/flac | src/metadata/mod.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse Parameter;\nuse fa::VFunction;\nuse agents::PredictionAgent;\nuse geometry::{Space, NullSpace};\nuse std::marker::PhantomData;\n\n\npub struct TD<S: Space, V: VFunction<S>>\n{\n v_func: V,\n\n alpha: Parameter,\n gamma: Parameter... | rust | edit | 2 | 2 | mit | ca4e994d00ca5c37a23067e2b5cc0f358d24e740 | tspooner/rsrl | src/agents/prediction/td.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n/// Modifiers which can be injected by the application logic to change the state\n\nuse std::any::Any;\nuse ::api;\nuse ::api::optional::Optional;\n\n/// `StatusModifier`s are used to modify the status\npub trait StatusModifier: Send + Sync +... | rust | edit | 2 | 4 | apache-2.0 | 37f7e33b6bd99ff4ea3df7d304817a2a9fbc9d48 | cmr/spaceapi-server-rs,cmr/spaceapi-server-rs,coredump-ch/spaceapi-server-rs | src/modifiers.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![crate_type = \"lib\"]\n#![feature(core)]\n#![feature(no_std, unsafe_destructor)]\n#![warn(missing_docs)]\n\n//! Synchronization primitives based on spinning\n\n#![no_std]\n\n#[cfg(test)]\nextern crate std;\n\n#[macro_use]\nextern crate cor... | rust | edit | 6 | 0 | mit | 77cc790345066a1b39c22b1284725063167c3c5f | tempbottle/spinlock-rs,arthurprs/spinlock-rs,RustOS-Fork-Holding-Ground/spinlock-rs,mvdnes/spin-rs,dpc/spinlock-rs,mvdnes/spinlock-rs | src/lib.rs | rejected_lint | Too many lint violations: 6 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse disk::fs::FileSystem;\nuse disk::manager::{self, DiskManager};\n\nuse futures_cpupool::Builder;\n\nconst DEFAULT_PENDING_SIZE: usize = 10;\nconst DEFAULT_COMPLETED_SIZE: usize = 10;\n\n/// `DiskManagerBuilder` for building `DiskManager`... | rust | edit | 0 | 2 | apache-2.0 | 6202a4ad55a779bc8f05ee73e837356422ef2fa4 | GGist/redox-rs | bip_disk/src/disk/builder.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate libcratesio;\n\nuse libcratesio::{CratesIO, Crate, Error};\n\n#[test]\nfn basic_data() {\n let krate = Crate::by_name(\"requests\").unwrap();\n println!(\"{:?}\", krate);\n assert_eq!(krate.name, \"requests\");\n}\n\n#[t... | rust | edit | 0 | 2 | apache-2.0 | e2006c781b4ef11e99041d3f1dba8cab0173e2b3 | imp/libcratesio-rs | tests/crate.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Copyright 2016 Mozilla\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use\n// this file except in compliance with the License. You may obtain a copy of the\n// License at http://www.apache.org/license... | rust | edit | 0 | 1 | apache-2.0 | 7a4c75ba4480040b843ec9755909573f8ef73577 | ncalexan/datomish,ncalexan/mentat,ncalexan/mentat,mozilla/mentat,mozilla/mentat,mozilla/mentat,mozilla/mentat,mozilla/mentat,ncalexan/datomish,ncalexan/mentat,ncalexan/mentat,mozilla/mentat,ncalexan/mentat,ncalexan/mentat | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! Virtual machine for the CHIP-8 programming language\n//!\n//! This crate implements a virtual machine for the CHIP-8\n//! programming language.\n//! It can be used as a backend for CHIP-8 emulators, debuggers\n//! and so on.\n//!\n//!\n//... | rust | edit | 3 | 1 | mit | 3333ac757c2dcd8a50689310520e082520475cf2 | chip8-rust/chip8-vm,chip8-rust/chip8-vm | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::sync::atomic::AtomicBool;\n\nuse parking_lot::{RwLockReadGuard, RwLockWriteGuard};\n\nuse super::*;\n\n#[derive(Default)]\npub(crate) struct ConcurrencyControl {\n necessary: AtomicBool,\n rw: RwLock<()>,\n}\n\npub(crate) enum ... | rust | edit | 1 | 4 | apache-2.0 | 43746342dc764eb1723ff300c1d69f6857c7b1c8 | spacejam/sled,spacejam/sled,spacejam/sled | src/concurrency_control.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![allow(dead_code)]\n#![allow(unused_parens)]\n#![allow(unstable)]\n#![feature(box_syntax)]\n\nextern crate syntax;\n\npub mod lexer;\npub mod token;\n\n#[derive(Copy)]\npub struct Span { \n pub start: u32,\n pub end: u32,\n}\n```\n\... | rust | edit | 2 | 0 | apache-2.0 | b18c8384f7ade5a4d64f57b061a5017d0306ccd3 | vosen/simeon | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse super::*;\nuse std::fs::File;\nuse std::io::Read;\n\npub enum OpenStatus {\n Ok,\n NotFound,\n}\n\nimpl Editor {\n /// Open a file\n pub fn open(&mut self, path: &str) -> OpenStatus {\n self.status_bar.file = path.to_st... | rust | edit | 0 | 2 | mit | 26f2c9b304d2d5e9dc9b6fd965ca086a0b67690c | redox-os/sodium | open.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![feature(slicing_syntax)]\n\nextern crate crc64;\nuse crc64::crc64;\nuse std::os;\nuse std::io::{BufferedReader, File};\n\nfn main() {\n let args = os::args();\n if args.len() == 1 {\n println!(\"Usage: {} [list of files]\", ar... | rust | edit | 0 | 6 | bsd-3-clause | c2238f4a5f7072723e87303f29f8eed852225356 | badboy/crc64-rs | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Copyright 2018 Google LLC\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// https://www.ap... | rust | edit | 3 | 0 | apache-2.0 | 3b4c94df6e6cc969db3dc414173546af667e8311 | google/tock-on-titan,google/tock-on-titan,google/tock-on-titan | userspace/test_harness/src/lib.rs | accepted | null | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.