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::collections::HashMap;\n\nfn anagrams(word: &str) -> HashMap<char, u32> {\n let mut result: HashMap<char, u32> = HashMap::new();\n\n for k in word.chars() {\n let v = match result.get(&k) {\n Some(v) => v + 1,\... | rust | edit | 0 | 4 | bsd-2-clause | ec1ebb96e674cb4213cc4dbf32da34481b131d0f | gyn/exercism,gyn/exercism,gyn/exercism,gyn/exercism | rust/anagram/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nimport option::none;\nimport option::some;\n\n// A very naive implementation of union-find with unsigned integer nodes.\n\ntype node = option::t[uint];\ntype ufind = rec(mutable vec[mutable node] nodes);\n\nfn make() -> ufind {\n let vec[m... | rust | edit | null | null | apache-2.0 | 4eb476fc7551e1c7863ed86c89a0370fb458bbdb | j16r/rust,pelmers/rust,krzysz00/rust,j16r/rust,KokaKiwi/rust,stepancheg/rust-ide-rust,mvdnes/rust,hauleth/rust,retep998/rand,GBGamer/rust,ejjeong/rust,fabricedesre/rust,zachwick/rust,l0kod/rust,miniupnp/rust,untitaker/rust,KokaKiwi/rust,kwantam/rust,bombless/rust,quornian/rust,pythonesque/rust,P1start/rust,jbclements/r... | src/lib/ufind.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate expression;\n#[cfg(test)]\nextern crate expression_num;\n\npub mod parametric;\n\nuse std::fmt::Debug;\n\n/// Used to name symbols and variables.\npub trait Alphabet: Debug + PartialEq + Eq + Clone {}\n\nimpl Alphabet for &'stati... | rust | edit | 0 | 0 | mit | 2211eaf8f51ba35edc6078512eeddbf900c30721 | mneumann/lindenmayer-system | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate glob;\n\nuse glob::glob;\nuse std::fs::File;\nuse std::io::prelude::*;\nuse std::io::BufReader;\nuse std::fmt;\n\nfn main() {\n let mut output = String::new();\n\n fmt::write(\n &mut output,\n format_args!(\"p... | rust | edit | 0 | 2 | apache-2.0 | d6b69939eea2cee847bcff926837a43dbe85d4ac | daschl/grok | build.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Implements http://rosettacode.org/wiki/Concurrent_computing\n// not_tested\nuse std::io::timer::sleep;\nuse std::rand::random;\n\nfn main() {\n let strings = vec![\"Enjoy\", \"Rosetta\", \"Code\"];\n\n for s in strings.move_iter(){\n... | rust | edit | null | null | unlicense | a24414b391b87b3fa71836aa2ce7a91f0fdfeb6b | sakeven/rust-rosetta,magum/rust-rosetta,crespyl/rust-rosetta,ZoomRmc/rust-rosetta,JIghtuse/rust-rosetta,Hoverbear/rust-rosetta,crr0004/rust-rosetta,magum/rust-rosetta,ghotiphud/rust-rosetta,pfalabella/rust-rosetta | src/concurrent_computing.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\ns_no_extra_traits! {\n #[allow(missing_debug_implementations)]\n #[repr(align(16))]\n pub struct max_align_t {\n priv_: [f64; 4]\n }\n}\n\n```\n\nApply this change: Add ucontext and clone_args for loongarch64"
},
{
... | rust | edit | 0 | 0 | apache-2.0 | 7066c3c4071a554c6fa5d874cf5108938e163fb2 | rust-lang/libc,rust-lang/libc,rust-lang/libc | src/unix/linux_like/linux/gnu/b64/loongarch64/align.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate libc;\n\nuse self::libc::c_char;\n\nuse std::ffi::CStr;\nuse std::str::Utf8Error;\nuse std::ffi::CString;\n\npub struct CStringUtils {}\n\nimpl CStringUtils {\n pub fn c_str_to_string(cstr: *const c_char) -> Result<Option<Stri... | rust | edit | 2 | 3 | apache-2.0 | 98f4be6ae362fb61d6d977c2b4a7e332b3a8be1d | anastasia-tarasova/indy-sdk,Artemkaaas/indy-sdk,Artemkaaas/indy-sdk,srottem/indy-sdk,srottem/indy-sdk,peacekeeper/indy-sdk,peacekeeper/indy-sdk,peacekeeper/indy-sdk,peacekeeper/indy-sdk,peacekeeper/indy-sdk,peacekeeper/indy-sdk,anastasia-tarasova/indy-sdk,srottem/indy-sdk,anastasia-tarasova/indy-sdk,anastasia-tarasova/... | libindy/src/utils/cstring.rs | accepted | null | true |
[
{
"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_tokenize_empty() {\n assert tokenize( ~\"\" ) == ~[];\n}\n\n#[test]\nfn test_tokeniz... | rust | edit | null | null | mit | 130ad0523278080284ffe994a116a2092727691f | martica/rusty | rusty.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse util::units::Point;\n\npub struct Actor {\n name: String,\n pos: Point,\n health: int,\n max_health: int,\n repr: char,\n}\n\nimpl Actor {\n\n pub fn new(name: String, pos: Point, max_health: int, repr: char) -> Actor {\... | rust | edit | 4 | 1 | bsd-3-clause | d310573553e9caf5bfb23af6ac46ece96e441dff | jgilchrist/rslike | src/engine/actor.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse chrono::{DateTime, FixedOffset};\nuse serde_derive::Deserialize;\n\n#[derive(Deserialize)]\npub(super) struct Page {\n title: Option<String>,\n subtitle: Option<String>,\n summary: Option<String>,\n qualifiers: Option<Qualifie... | rust | edit | 0 | 2 | mit | 0c51cef64f7d537e06ced18f12a43b873e2da41f | chriskrycho/lightning-rs,chriskrycho/lightning-rs | src/metadata/serialize.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse nain_events::{EventCategory, KeyPressedEvent};\nuse nain_log as log;\n\npub trait Application {\n fn run(&self) {\n println!(\"Welcome to the Nain engine!\");\n\n let event = KeyPressedEvent::new(2, 5);\n log::trac... | rust | edit | 0 | 2 | apache-2.0 | 45d2c609d3d16bf7b89e23644b6773cddc4036cc | Danite/NainEngine | src/application.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Copyright 2015, Igor Shaula\n// Licensed under the MIT License <LICENSE or\n// http://opensource.org/licenses/MIT>. This file\n// may not be copied, modified, or distributed\n// except according to those terms.\nextern crate winreg;\nuse s... | rust | edit | 0 | 3 | mit | 64da09c9bbb324c87b5cf8971daf0409d4410d87 | gentoo90/winreg-rs | examples/transactions.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[derive(PartialEq, Show)]\npub enum Category {\n Whitespace,\n Identifier,\n Brace,\n Parenthesis,\n AssignmentOperator,\n IntegerLiteral,\n StringLiteral,\n}\n\npub struct Token {\n pub lexeme: String,\n pub categ... | rust | edit | 0 | 0 | mit | fc2b8be7f71705ea9f022fd9781865c0bc8d602a | jmacdonald/luthor,jmacdonald/luthor,jmacdonald/luthor,jmacdonald/luthor | src/lexer/token.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::process::Command;\n\nextern crate pkg_config;\n\nconst C_IN: &'static str = \"include/include_ffi.h\";\nconst RS_OUT: &'static str = \"src/raw.rs\";\n\nfn main() {\n let libffi = pkg_config::probe_library(\"libffi\").expect(\"li... | rust | edit | 0 | 4 | apache-2.0 | 3c5242e0a33d43b12f52fec76ee27e1a2f01a982 | tov/libffi-rs,tov/libffi-rs,tov/libffi-rs,tov/libffi-rs,tov/libffi-rs,tov/libffi-rs | build.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n\n\nfn id<@T>(x: T) -> T { ret x; }\n\n\n/* FIXME (issue #141): See test/run-pass/constrained-type.rs. Uncomment\n * the constraint once fixed. */\ntype rational = {num: int, den: int};\n\n\n// : int::positive(*.den);\nfn rational_leq(x: ra... | rust | edit | null | null | apache-2.0 | 994beca00d21af69a6ae70a3aae2e829a65fdaff | kwantam/rust,robertg/rust,miniupnp/rust,nham/rust,jashank/rust,zaeleus/rust,defuz/rust,pshc/rust,miniupnp/rust,AerialX/rust,seanrivera/rust,nham/rust,emk/rust,jbclements/rust,sarojaba/rust-doc-korean,carols10cents/rust,carols10cents/rust,fabricedesre/rust,barosl/rust,j16r/rust,aepsil0n/rust,LeoTestard/rust,KokaKiwi/rus... | src/lib/util.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[derive(Debug)]\npub struct Rectangle {\n length: u32,\n width: u32\n}\n\nimpl Rectangle {\n pub fn can_hold(&self, other: &Rectangle) -> bool {\n self.length > other.length && self.width > other.width\n }\n}\n\n#[cfg(test... | rust | edit | 0 | 2 | mit | 9a2ccef45936efbf7f45a06f447234aeb3abd965 | pgrzesik/learning-rust | testing/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse crate::ToTokens;\nuse proc_macro2::{Span, TokenStream};\n\npub trait Spanned {\n fn span(&self) -> Span;\n}\n\nimpl Spanned for Span {\n fn span(&self) -> Span {\n *self\n }\n}\n\nimpl<T: ToTokens> Spanned for T {\n fn ... | rust | edit | 0 | 3 | apache-2.0 | 1659244c6b565a89885b97a0b8d8f94f8c18a69e | dtolnay/quote | src/spanned.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![feature(proc_macro)]\n#![feature(proc_macro_lib)]\n#![recursion_limit = \"128\"]\n\n#[macro_use] extern crate quote;\n\nextern crate proc_macro;\nextern crate syn;\n\nuse proc_macro::TokenStream;\n\n// Yield mock generated code for templat... | rust | edit | 0 | 6 | mit | d26c8525f35017e3464ce55b588617424a8593f7 | maghoff/bart,maghoff/bart | libs/stach_derive/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[macro_use]\nextern crate pod_typeinfo;\n\nuse std::mem;\n\nuse pod_typeinfo::Type::*;\nuse pod_typeinfo::{Type, TypeInfo};\n\n#[test]\nfn test_scalar_types() {\n fn check_type<T: TypeInfo>(ty: Type) {\n assert_eq!(<T as TypeInfo>:... | rust | edit | 0 | 3 | apache-2.0 | 851d18f194642b1a668bc2fa79a508ba3eb6cbdf | aldanor/typeinfo | tests/test.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Enable static linking support (similar to openssl-sys)"
},
{
"role": "assistant",
"content": "use std::env;\n\nfn main () {\n if let Some(lib_dir) = env::var(\"SODIUM_LIB_DIR\").ok() {\n \tprintln!(\"cargo:rustc-flags=-L nati... | rust | new_file | 2 | 3 | mit | ac5e82474b14c79393b42467ef6d34efe9460aed | Fraser999/sodiumoxide,markuskobler/sodiumoxide,romanb/sodiumoxide,maidsafe/sodiumoxide | libsodium-sys/build.rs | rejected_duplicate | Near-duplicate of sample 119954 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::mem::size_of;\nuse std::os::wasi::io::RawFd;\n\n#[test]\nfn test_raw_fd_layout() {\n /// `OwnedFd` and `BorrowedFd` use `rustc_layout_scalar_valid_range_start`\n /// and `rustc_layout_scalar_valid_range_end`, with values that d... | rust | edit | 0 | 1 | apache-2.0 | 0377a633520344c6530f21fffee4d31768c9c447 | graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust | library/std/src/os/wasi/io/fd/tests.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[macro_use]\nextern crate diesel;\n\nuse diesel::*;\n\ntable! {\n int_primary_key {\n id -> Serial,\n }\n}\n\ntable! {\n string_primary_key {\n id -> VarChar,\n }\n}\n\nfn main() {\n let connection = Connection::... | rust | edit | 0 | 1 | apache-2.0 | 2b31337da4a6ea2bbe27f2e98fd33fe9a6176dd6 | tohou/diesel,diesel-rs/diesel,mcasper/diesel,sgrif/diesel,mcasper/diesel,tohou/diesel,diesel-rs/diesel,SoftwareWarlock/diesel,cascalheira/diesel,cascalheira/diesel,sgrif/diesel,SoftwareWarlock/diesel | diesel_tests/tests/compile-fail/find_requires_correct_type.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n\nextern crate gitlab_api as gitlab;\n\nuse std::env;\n#[macro_use]\nextern crate log;\nextern crate env_logger;\n\nuse gitlab::GitLab;\n// use gitlab::Pagination;\nuse gitlab::issues;\n\n\nfn main() {\n env_logger::init().unwrap();\n i... | rust | edit | 0 | 3 | apache-2.0 | 57c0da5070bb9ed45e4ac0ddf212307df2046c6e | nbigaouette/gitlab-api-rs,nbigaouette/gitlab-api-rs | examples/list_issues.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[macro_use]\nextern crate serde_derive;\nextern crate serde;\nextern crate serde_bytes;\nextern crate serde_osc;\n\nuse serde_bytes::ByteBuf;\nuse serde_osc::{de, ser};\n\n/// Struct we'll serialize.\n/// This represents a single OSC message... | rust | edit | 0 | 1 | apache-2.0 | c8449319aad7a52fc5adefa7eaa29074dbe054d3 | Wallacoloo/serde_osc | examples/to_from_vec.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate basiccms;\n\n#[cfg(test)]\nmod tests {\n\n use basiccms::*;\n\n #[test]\n #[should_panic]\n fn you_cannot_add_two_sketches_together_if_they_have_different_hashers () {\n let mut left = Sketch::new(0.0001, 0.99... | rust | edit | 0 | 1 | mit | a8c770fa2d1146c04cdf49f99cbeaa58ec7b586c | kjgorman/basiccms.rs | tests/addition.rs | accepted | null | 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 | d64d47f68606fc9b23755e738c2d2483da0cf5f7 | samdoshi/portmidi-rs,samdoshi/portmidi-rs | examples/monitor.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![no_std]\nextern crate ruru;\n\nuse ruru::VM;\nuse ruru::Hash;\nuse ruru::Fixnum;\nuse ruru::Class;\nuse ruru::types::Argc;\nuse ruru::AnyObject;\n\n#[no_mangle]\npub extern fn pow_3(argc: Argc, argv: *const AnyObject, _: Fixnum) -> Hash {\... | rust | edit | 0 | 1 | mit | 863267f6234591f7e140a83b724294d0518f73ae | steveklabnik/rust_example,steveklabnik/rust_example,steveklabnik/rust_example,steveklabnik/rust_example,steveklabnik/rust_example,steveklabnik/rust_example | ruru/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! Crate ruma_client_api contains serializable types for the requests and responses for each\n//! endpoint in the [Matrix](https://matrix.org/) client API specification. These types can be\n//! shared by client and server code.\n\n#![deny(mi... | rust | edit | 1 | 0 | mit | 6286a2c692e7ab82a3ca493bc4c21a5120586f61 | ruma/ruma | ruma-client-api/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// http://rosettacode.org/wiki/Evaluate_binomial_coefficients\n\nfn binomial(n: uint, mut k: uint) -> u64 {\n // Since binomial(n, k) = binomial(n, n - k), we might as well use\n // the smaller k to optimize\n if n - k < k {\n ... | rust | edit | 0 | 3 | unlicense | 42f1f36b1e41a64a511eefa2ff3b17c219a04653 | ghotiphud/rust-rosetta,JIghtuse/rust-rosetta,pfalabella/rust-rosetta,magum/rust-rosetta,magum/rust-rosetta,Hoverbear/rust-rosetta,crespyl/rust-rosetta,ZoomRmc/rust-rosetta,crr0004/rust-rosetta,sakeven/rust-rosetta | src/binomial_coefficients.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Copyright 2012 The Rust Project Developers. See the COPYRIGHT\n// file at the top-level directory of this distribution and at\n// http://rust-lang.org/COPYRIGHT.\n//\n// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or\n//... | rust | edit | null | null | apache-2.0 | e5bf6d1afa4487ae1d2bfa9c9a0f5875ec288371 | rprichard/rust,pczarn/rust,KokaKiwi/rust,dinfuehr/rust,pshc/rust,jashank/rust,hauleth/rust,andars/rust,michaelballantyne/rust-gpu,mahkoh/rust,pczarn/rust,Ryman/rust,SiegeLord/rust,aidancully/rust,omasanori/rust,nwin/rust,robertg/rust,barosl/rust,ktossell/rust,philyoon/rust,jashank/rust,hauleth/rust,kmcallister/rust,aid... | src/test/compile-fail/assign-to-method.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! Helper functions for dealing with shaders.\n\n// External crates.\nuse gl;\nuse gl::types::{\n GLchar,\n GLenum,\n GLint,\n GLuint,\n};\n\nuse std::ptr;\n\n/// Compiles a shader.\n///\n/// Returns a shader or a message with th... | rust | edit | 1 | 3 | mit | 0d2e3c4f62878bf800f869764b665b06679821ad | aepsil0n/graphics,stjahns/graphics,andrewcsmith/graphics,PistonDevelopers/graphics,Vinatorul/graphics,echochamber/graphics,mitchmindtree/graphics,bvssvni/graphics | src/shader_utils.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! A library implementation of so-called `static_assert` based on a macro which\n//! conditionally expands into an integer overflow, breaking the compilation.\n//!\n//! It can take one or more constant boolean expressions as its parameters.\... | rust | edit | 0 | 1 | apache-2.0 | f42dad98250950d0de9c74684fe19f62dc50fd4f | nodakai/rust-static_assert_macro | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![doc(html_root_url = \"https://docs.rs/serde_derive_internals/0.25.0\")]\n#![allow(unknown_lints, bare_trait_objects)]\n#![cfg_attr(feature = \"cargo-clippy\", allow(renamed_and_removed_lints))]\n#![cfg_attr(\n feature = \"cargo-clippy\"... | rust | edit | 0 | 0 | apache-2.0 | d1975f3661a09053fe069e00cc45176f96033183 | serde-rs/serde | serde_derive_internals/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse error::{CliError, Usage, UsageKind};\nuse super::Command;\n\nuse lib::setting::{Config, ConfigKey, Cron};\n\n#[derive(Debug)]\npub struct Start;\n\nimpl Command for Start {\n fn usage(&self) -> Usage {\n return Usage::new(UsageK... | rust | edit | null | null | mit | 952e1ab2d9d406e21f22855cb486aa69f4d763e7 | ttokutake/kic,ttokutake/kic,ttokutake/kic | src/command/start.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nimport option;\n\nenum mode { mode_compile_fail, mode_run_fail, mode_run_pass, mode_pretty, }\n\ntype config = {\n // The library paths required for running the compiler\n compile_lib_path: ~str,\n\n // The library paths required for... | rust | edit | null | null | apache-2.0 | 2d31c2afc4d029a50c50960bdafc8f56e3bc34c7 | gifnksm/rust,stepancheg/rust-ide-rust,nham/rust,kmcallister/rust,0x73/rust,Ryman/rust,zachwick/rust,sae-bom/rust,jbclements/rust,carols10cents/rust,ruud-v-a/rust,victorvde/rust,nwin/rust,LeoTestard/rust,P1start/rust,jashank/rust,philyoon/rust,erickt/rust,jashank/rust,aturon/rust,LeoTestard/rust,achanda/rand,victorvde/r... | src/compiletest/common.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse crate::spec::{LinkArgs, LinkerFlavor, TargetOptions};\nuse std::default::Default;\n\npub fn opts() -> TargetOptions {\n let mut args = LinkArgs::new();\n args.insert(LinkerFlavor::Msvc, vec![\"/NOLOGO\".to_string(), \"/NXCOMPAT\".to... | rust | edit | 0 | 1 | apache-2.0 | 9150b8ec297483a0b8ff0b8d7c2ef75362c2d5a8 | 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/librustc_target/spec/windows_msvc_base.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// run-rustfix\n\n#![warn(clippy::toplevel_ref_arg)]\n#![allow(unused)]\n\nfn main() {\n // Closures should not warn\n let y = |ref x| println!(\"{:?}\", x);\n y(1u8);\n\n let ref x = 1;\n\n let ref y: (&_, u8) = (&1, 2);\n\n ... | rust | edit | 7 | 1 | apache-2.0 | 3b9e5dfda565224e6f007f379ca1cea4623422d9 | graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust | tests/ui/toplevel_ref_arg.rs | rejected_lint | Too many lint violations: 7 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse ghclient::GithubClient;\nuse std;\nuse std::env;\nuse std::path::Path;\nuse std::string::String;\nuse structs::Config;\n\nlazy_static! {\n static ref DEFAULT_CONF_PATH_STR:String = String::from(\"/etc/sectora.conf\");\n static ref C... | rust | edit | 4 | 0 | mit | c0889d34de0fdfc2d203d67c98ce66616419adde | yasuyuky/ghteam-auth,yasuyuky/ghteam-auth | src/statics.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! Provides types and functions related to working with PostgreSQL\n//!\n//! Much of this module is re-exported from database agnostic locations.\n//! However, if you are writing code specifically to extend Diesel on\n//! PostgreSQL, you may... | rust | edit | 1 | 0 | apache-2.0 | 04b8c418140b245b40cd6b69fe167afe33835398 | sgrif/diesel,sgrif/diesel,diesel-rs/diesel,diesel-rs/diesel | diesel/src/pg/mod.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse nalgebra::{Isometry3, Matrix4, Perspective3, Point3, Real, Scalar, Vector3};\n\npub struct Camera<T>\nwhere\n T: Real + Scalar,\n{\n projection: Perspective3<T>,\n view: Isometry3<T>,\n}\n\nimpl<T> Camera<T>\nwhere\n T: Real +... | rust | edit | 0 | 1 | mit | 23c0a60d4859cd67b282ec1298357ab2e2422d91 | olson-sean-k/plexus,olson-sean-k/plexus | examples/viewer/camera.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\npub fn score(word: &str) -> u32 {\n let mut score = 0;\n\n for c in word.chars() {\n score += match c.to_lowercase().to_string().as_ref() {\n \"a\" | \"e\" | \"i\" | \"o\" | \"u\" | \"l\" | \"n\" | \"r\" | \"s\" | \"t\... | rust | edit | 0 | 2 | mit | 11b35f8026e83882dd4a11be14772b1ff59c31fd | attilahorvath/exercism-rust | scrabble-score/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! Quicksort algorithm.\n//!\n//! The `efficient` module contains the efficient sorting algorithm \"Quicksort\".\n//!\n//! Source: https://en.wikipedia.org/wiki/Quicksort\n\n\n/// Quicksort\n///\n/// # Details\n///\n///\n///\n/// # Scaling\n... | rust | edit | 0 | 4 | bsd-3-clause | 33390f257dbc8d614f93354d0c7d3196106ea0bd | nbigaouette/rust-sorting,nbigaouette/rust-sorting,nbigaouette/rust-sorting | src/efficientsorts/quick.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse bios_boot_device::BIOSBootDeviceTag;\nuse tag::{Tag, TagIter};\n\n\npub struct MultiBootInfo {\n total_size: u32,\n reserved: u32, // Should always be 0\n mem_lower: u32,\n mem_upper: u32,\n boot_device: u32,\n boot... | rust | edit | 3 | 1 | apache-2.0 | 91eead1f7d5296d9cbfa3042d63df453dbc859a6 | stallmanifold/rust-multiboot2 | src/multiboot.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}\n\npub fn from_file... | rust | edit | 1 | 3 | mit | f5a9056f233df815d6b364d03bb7d21b591c6a60 | jmacdonald/scribe | src/buffer/buffer.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse numeric::Tensor;\n\n#[test]\nfn tensor_1d() {\n let x = Tensor::new(vec![1, 2, 3, 4, 5, 6]);\n assert!(x == tensor![1, 2, 3, 4, 5, 6]);\n assert!(x == tensor![1, 2, 3, 4, 5, 6,]);\n}\n\n#[test]\nfn tensor_2d() {\n let x = Tens... | rust | edit | 0 | 1 | mit | deaffd3c73d20ce52a7b128aa25ee59b00692c46 | gustavla/numeric,numeric-rust/numeric | tests/macros.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nmod accreader;\n\npub use self::accreader::AccReader;\n\nuse std::io::{BufRead, Seek, Cursor};\n\npub trait Buffered: BufRead + Seek {\n fn data(&self) -> &[u8];\n}\n\nimpl<'a> Buffered for Cursor<&'a [u8]> {\n fn data(&self) -> &[u8] {... | rust | edit | 1 | 0 | mit | 546a92acee0b6cf209f85e7dbebcbcb4135526b4 | rust-av/rust-av | format/src/buffer/mod.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! Detect the language of a string using the [cld2 library][cld2] from the\n//! Chromium project.\n//!\n//! ```\n//! use cld2::{detect_language, Format, Reliable, Lang};\n//!\n//! let text = \"It is an ancient Mariner,\n//! And he stoppeth o... | rust | edit | null | null | apache-2.0 | 63834ed1b1e43c41eace4206dbc4bf2ddb4b6a15 | emk/rust-cld2,emk/rust-cld2 | src/lib.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![feature(plugin, str_char, slice_patterns, convert, core)]\n#![plugin(regex_macros)]\nextern crate regex;\nextern crate chrono;\n#[macro_use]\nextern crate log as l;\n\npub mod log;\npub mod format;\n\nuse std::error::FromError;\nuse std::{... | rust | edit | 3 | 1 | bsd-3-clause | 7459288bfc849f50e12a220d561210b259e5394a | tilpner/ilc,tilpner/ilc | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! Utilities to talk to Lua\n\nuse rlua::{self, Table};\nuse rustwlc::*;\n\nconst MOD_NAMES: [&str; 8] = [\"Shift\", \"Caps\", \"Control\", \"Alt\",\n \"Mod2\", \"Mod3\", \"Mod4\", \"Mod5\"];\n\n/// Convert a mod... | rust | edit | 0 | 4 | mit | 45b2fb8d431c61f7733cdd3aeaa32166431aa1ea | way-cooler/way-cooler,Immington-Industries/way-cooler,Immington-Industries/way-cooler,way-cooler/way-cooler,Immington-Industries/way-cooler,way-cooler/way-cooler | src/lua/utils.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[ allow( unused_imports ) ]\nuse clone_dyn::clone_dyn;\n\nfn main()\n{\n\n #[ clone_dyn ]\n trait Trait1\n {\n }\n\n let vec = Vec::< Box< dyn Trait1 > >::new();\n let _vec2 = vec.clone(); /* <- it does not work without `clone_dyn` */\... | rust | edit | 0 | 1 | mit | a0eeb45c91c9fe14775d02d40c58d8345c0b7f95 | Wandalen/wTools,Wandalen/wTools | sample/rust/clone_dyn_trivial_sample/src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[rustc::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 tests on emscripten\n\nThese hit a strange error in our Em... | rust | edit | 0 | 1 | apache-2.0 | 9c756f1ec05e854d4b873831035b2556d23ce6c1 | serde-rs/serde | test_suite/tests/compiletest.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse event::Reactor;\nuse render::{Context, GlutinContext, MetaContext};\n\npub struct Harness<A, C>\n where A: Application,\n C: MetaContext\n{\n application: A,\n context: Context<C>,\n}\n\nimpl<A> Harness<A, GlutinContext>... | rust | edit | 1 | 3 | mit | c2568468363b4e040ae2633ce102dc2eb7722c11 | olson-sean-k/bismuth | src/framework.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add function to get closest word for specified word in words array"
},
{
"role": "assistant",
"content": "pub mod sequencematcher;\npub mod differ;\nmod utils;\n\n\nuse sequencematcher::SequenceMatcher;\n\n\npub fn get_close_matche... | rust | new_file | 1 | 5 | mit | b595d39f02946829b9d75f80f66756206825a42c | DimaKudosh/difflib | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![crate_name = \"quickcheck\"]\n#![crate_type = \"lib\"]\n#![license = \"UNLICENSE\"]\n#![doc(html_root_url = \"http://burntsushi.net/rustdoc/quickcheck\")]\n\n//! This crate is a port of\n//! [Haskell's QuickCheck](http://hackage.haskell.or... | rust | edit | 2 | 0 | unlicense | 9b9c39f492782591e876e5547d173009d714cace | bluss/quickcheck,tari/quickcheck,erickt/quickcheck,aepsil0n/quickcheck | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! Entry module for the Netherrack project\n\n// We'll be using serialization a lot\nextern crate rustc_serialize;\n\n// Enable logging and use of logging macros throughout Netherrack\n#[macro_use]\nextern crate log;\n\n// Allow use of Seman... | rust | edit | 3 | 2 | apache-2.0 | 6d4920d172e92d8f0982edf10a29d934729bd28f | Techern/Netherrack | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[macro_use]\nextern crate nom;\n\nuse std::io;\nuse std::io::Read;\n\nstatic BERT_MAGIC_NUMBER: u8 = 131;\n\n#[derive(Debug)]\nenum BertTerm {\n Int(i32),\n Float(f64),\n Atom(String),\n Tuple(Vec<BertTerm>),\n List(Vec<BertTe... | rust | edit | null | null | mit | 5517e47b17f10227deba6d543c9468362d064364 | gnuvince/ppbert,gnuvince/ppbert | src/main.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! An implementation of [FLAC](https://xiph.org/flac), free lossless audio\n//! codec, written in Rust.\n//!\n//! # Examples\n//!\n//! Basic decoding from a file.\n//!\n//! ```\n//! match flac::Stream::from_file(\"path/to/file.flac\") {\n//!... | rust | edit | 1 | 0 | bsd-3-clause | ebde1656a2bd0e84d3b32c4270f9a385c42a030a | sourrust/flac | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![feature(plugin)]\n\n#![allow(unstable)] // TODO: remove this\n\n//! Making sure that no warning is generated by code from generate_gl_bindings!\n#![deny(warnings)]\n\nextern crate libc;\n\ninclude!(concat!(env!(\"OUT_DIR\"), \"/test_no... | rust | edit | 0 | 0 | apache-2.0 | 9da87bfc93b8eb42965fea71b0f3e333d96e5321 | nicokoch/gl-rs,nicokoch/gl-rs,skligys/gl-rs,jimarnold/gl-rs,skligys/gl-rs,neon64/gl-rs,jimarnold/gl-rs,tomaka/gl-rs,bjz/gl-rs,bjz/gl-rs,tomaka/gl-rs,neon64/gl-rs | gl_tests/tests/no_warning.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![feature(slicing_syntax)]\n#![crate_type = \"lib\"]\n#![crate_name = \"suruga\"]\n#![allow(missing_copy_implementations)]\n\n#[macro_use]\nextern crate log;\n\npub use tls::Tls;\npub use client::TlsClient;\n\n#[macro_use]\npub mod macros;\n... | rust | edit | 3 | 0 | mit | 2e3b33eb43efdb5d8936ed247b746b0f40065687 | klutzy/suruga | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::io;\nuse std::io::prelude::*;\nuse std::collections::HashMap;\npub mod parser;\n\nfn evaluate(input: &str, env: &mut HashMap<String, f64>) -> Result<f64, String> {\n let mut p = parser::Parser::new(input);\n let ast = try!(p.pa... | rust | edit | null | null | mit | 619cdcb09203e57c06ee21f136ad21d6c5c635b4 | andars/rust-calculator | src/main.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate rosc;\n\nuse rosc::{encoder, decoder, errors};\nuse rosc::errors::OscError;\nuse rosc::types::{Result, OscMessage, OscPacket};\n\n#[test]\nfn test_encode_message_wo_args() {\n let msg = OscMessage {\n addr: \"/some/addr... | rust | edit | 0 | 2 | apache-2.0 | 8eb2348e75c773711c1fa538708b5307eec51b85 | klingtnet/rosc | tests/encoder_test.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! A simple library for reading and writing Riegl .sdc files.\n//!\n//! .sdc files are simple binary tables of discrete-return LiDAR data.\n\nextern crate byteorder;\n\nmod error;\npub mod file;\npub mod point;\nmod result;\n\npub use file::... | rust | edit | 1 | 0 | mit | d2b8443b5f3adc77b0958ed067ed787c291a1581 | gadomski/sdc-rs,gadomski/sdc-rs | src/lib.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)]\n#[template(source = \"{{ self.get_s() }}\", ext = \"txt\")]\nstruct MethodTemplate<'a> {\n s: &'a str,\n}\n\nimpl<'a> MethodTemplate<'a> {\n fn get_s(&s... | rust | edit | 0 | 1 | apache-2.0 | 3ba47e3fba811c073fc0623374f15861191d2edf | djc/askama,djc/askama,djc/askama | testing/tests/methods.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n/// A simple static assertion macro. The first argument should be a unique\n/// ALL_CAPS identifier that describes the condition.\n#[macro_export]\n#[allow_internal_unstable]\nmacro_rules! static_assert {\n ($name:ident: $test:expr) => {\n... | rust | edit | 0 | 0 | apache-2.0 | 4cfc2ce46d2813f5120053929609de6f9b976cd6 | aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust | src/librustc_data_structures/macros.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::io::{self, Write};\nuse std::fs::File;\n\nuse flac::stream::StreamReader;\nuse flac::metadata::{self, Picture};\n\npub const USAGE: &'static str = \"\nUsage: metadata picture [options] <filename>\n metadata picture --help\n\nOp... | rust | edit | 1 | 5 | bsd-3-clause | 2bc54dc164f3da4587b2c17313d1401c49a46128 | sourrust/flac | examples/commands/picture.rs | rejected_duplicate | Near-duplicate of sample 119949 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![crate_name = \"rboy\"]\n#![crate_type = \"lib\" ]\n\n#![feature(io, core, path)]\n\n#[macro_use]\nextern crate log;\n\nextern crate time;\n\n#[cfg(test)]\nextern crate test;\n\npub use keypad::KeypadKey;\n\npub mod device;\n\nmod cpu;\nmod... | rust | edit | 2 | 0 | mit | a5d2baac3f382cef69488657f4edae39172e3f7e | mvdnes/rboy | src/rboy.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate clap;\n\nuse clap::{Arg, App};\nuse std::fs::File;\nuse std::io;\n\nfn main() {\n let matches = App::new(env!(\"CARGO_PKG_NAME\"))\n .version(env!(\"CARGO_PKG_VERSION\"))\n .author(\"Scott Olson <<EMAIL>>\")\n ... | rust | edit | 0 | 5 | mit | d01018ee5db4b14a7778295f21f67837a5e8370e | solson/rin | src/main.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 to the guessing game!\");\n\n\n let std_in = io::stdin();\n\n let number_to_guess = rand::thread_rng().gen_range(1, 101);\n... | rust | edit | 0 | 3 | mit | b8dc2377dd5afa9baeab060e55d0fc92fde9bbbc | lyuboraykov/rust-exercises | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Copyright 2012 The Rust Project Developers. See the COPYRIGHT\n// file at the top-level directory of this distribution and at\n// http://rust-lang.org/COPYRIGHT.\n//\n// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or\n//... | rust | edit | 0 | 2 | apache-2.0 | bb9d210c99ab248e81598d70c39c3968ab9d09eb | aidancully/rust,mihneadb/rust,cllns/rust,aneeshusa/rust,mvdnes/rust,KokaKiwi/rust,jroesch/rust,l0kod/rust,graydon/rust,avdi/rust,aidancully/rust,cllns/rust,ebfull/rust,gifnksm/rust,aidancully/rust,jroesch/rust,graydon/rust,gifnksm/rust,vhbit/rust,pshc/rust,reem/rust,ebfull/rust,reem/rust,XMPPwocky/rust,dwillmer/rust,cl... | src/test/run-pass/over-constrained-vregs.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add initial implementation of CLI"
},
{
"role": "assistant",
"content": "extern crate getopts;\n\nuse getopts::Options;\n\nuse std::env;\nuse std::fs::File;\nuse std::path::Path;\n\n\nfn print_usage(program: &str, opts: Options) {\... | rust | new_file | 0 | 6 | mit | 5983884516d839d66d5b9f39cc0c0b0b470e1665 | iKevinY/ghoti.rs | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// SPDX-License-Identifier: MIT\n// Copyright (C) 2018-present iced project and contributors\n\nuse alloc::borrow::Cow;\nuse alloc::string::String;\nuse core::fmt;\n#[cfg(feature = \"std\")]\nuse std::error::Error;\n\n/// iced error\n#[derive... | rust | edit | null | null | mit | 015012dc3b909831e50e7793f261036f70e2ea6e | 0xd4d/iced,0xd4d/iced,0xd4d/iced,0xd4d/iced,0xd4d/iced | src/rust/iced-x86/src/iced_error.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate iron;\nextern crate staticfile;\n\nuse iron::Iron;\n\nuse staticfile::Static;\n\nuse std::env;\n\nfn main() {\n let port = env::args().nth(1).unwrap_or(\"80\".to_string());\n let addr = format!(\"localhost:{}\", port);\n\n ... | rust | edit | 0 | 1 | mit | 8f0d48c4588928a643a6fef3239339b33630f86a | aochagavia/Serve | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![feature(tool_lints)]\n\n#![warn(clippy::deprecated_cfg_attr)]\n\n// This doesn't get linted, see known problems\n#![cfg_attr(rustfmt, rustfmt_skip)]\n\n#[cfg_attr(rustfmt, rustfmt_skip)]\nfn main() {\n foo::f();\n}\n\nmod foo {\n #![... | rust | edit | 2 | 1 | apache-2.0 | 7df7a0a86ebf290f6f2650955f2479aaaa39beef | aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust | tests/ui/cfg_attr_lint.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse ::xen::StartInfo;\n\npub mod defs;\npub mod barrier;\npub mod memory;\n\nextern {\n // Start info is not present on all architecture, this is why this\n // was made a global variable only for x86_*\n pub static start_info: *const... | rust | edit | 2 | 1 | mit | a5798f4a839192983fadf923136d203f5ffbfc4f | uni-rs/uni.rs | src/arch/x86_common/mod.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nmod vm;\nmod command;\nmod parse;\n\nuse std::io::Write;\n\nfn main() {\n loop {\n print!(\"{}\", \"bf> \");\n std::io::stdout().flush().unwrap();\n\n let mut line = String::new();\n match std::io::stdin().read_... | rust | edit | 1 | 2 | mit | 37bfa1640f0903c1dc3c71744421554fef98f111 | nafarlee/thoughtfuck | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Copyright 2013 The noise-rs developers. For a full listing of the authors,\n// refer to the AUTHORS file at the top-level directory of this distribution.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may... | rust | edit | null | null | apache-2.0 | 22f3c594ce9c6b3b7f9cc6160937965a7fa29ca6 | Razaekel/noise-rs,bfops/noise-rs,phoenixenero/noise-rs,bjz/noise-rs,amaranth/noise-rs,brendanzab/noise-rs | examples/perlin.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::io;\nuse std::io::prelude::*;\n\npub fn parse_update_count(tag: String) -> u64 {\n tag.split(' ').last().unwrap().parse().unwrap_or(0)\n}\n\npub fn read_all<R: Read>(r: &mut R, mut buf: &mut [u8]) -> io::Result<()> {\n while !b... | rust | edit | 1 | 4 | apache-2.0 | 277e2b6a488f660947e9e58e6d2a2ed837a896af | sfackler/rust-postgres,sfackler/rust-postgres | src/util.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse vmx;\nuse collections::vec::Vec;\nuse core::sync::atomic::{ATOMIC_U16_INIT, AtomicU16, Ordering};\n\n\nstatic CPU_COUNT: AtomicU16 = ATOMIC_U16_INIT;\nstatic CPU_ASSIGNMENT: AtomicU16 = ATOMIC_U16_INIT;\n\n\npub fn init(count: u16) {\n ... | rust | edit | 2 | 2 | mit | db462fb203832938e059f913d860073ba5128daf | iankronquist/rustyvisor,iankronquist/rustyvisor,iankronquist/rustyvisor | src/cpu.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nfn _12_1(){\n println!(\"guide 12-1\");\n\n let a = [1i, 2i, 3i];\n let mut m = [2i, 3i, 4i];\n\n let b = [0i, ..20]; // shorthand for array of 20 elements all initialized to 0\n println!(\"{}\", b);\n m = [5i, 6i, 7i];\n ... | rust | edit | 0 | 3 | mit | 34f73812e496b7269a57652c1e04d20404db612b | leonardinius/rust-guide | 2.12-arr-vec-slice/src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// The shift characters are stored as nulls, as the conversion code doesn't\n// care what value they have. WRU? maps to ASCII ENQ (\\x05), I think.\nconst Ita2Letters = b\"\\0E\\nA SIU\\rDRJNFCKTZLWHYPQOBG\\0MXV\\0\";\nconst Ita2Figures = b\... | rust | edit | 3 | 1 | mit | 38e0cbf514352521e442b82aae785f91f839b215 | mcpherrinm/baudot | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![feature(test)]\nextern crate minimax;\nextern crate test;\nuse test::Bencher;\nuse minimax::*;\n\n#[derive(Clone)]\npub struct Board;\n\n#[derive(Copy, Clone)]\npub struct Place;\n\npub struct Eval;\n\npub struct Noop;\n\nimpl Move for Pla... | rust | edit | 0 | 2 | mit | 6bbb5c4b2139862ac1fb0503746db0789a473f44 | kinghajj/minimax-rs | benches/negamax.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nfn showpresents(count: usize) {\n let days = [\"second\", \"third\", \"fourth\", \"fifth\", \"sixth\", \"seventh\", \"eighth\", \"ninth\",\n \"tenth\", \"eleventh\", \"twelfth\"];\n\n let presents = [\"Two turtle doves\",... | rust | edit | 2 | 3 | unlicense | 809f54a2f62e4a3e2dc5b2065c40325f385f8494 | Hoverbear/rust-rosetta | tasks/the-twelve-days-of-christmas/src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\npub mod liblz4;\npub mod decoder;\npub mod encoder;\n\npub use decoder::Decoder;\npub use encoder::Encoder;\npub use encoder::EncoderBuilder;\npub use liblz4::BlockSize;\npub use liblz4::BlockMode;\npub use liblz4::ContentChecksum;\npub use l... | rust | edit | 1 | 0 | mit | 65c2dd7257cb4ff4f0849e86b535064cddc4fd4e | bvinc83/lz4-rs,bozaro/lz4-rs | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![feature(plugin)]\n#![plugin(rustlex)]\n#[allow(plugin_as_library)]\nextern crate rustlex;\n#[macro_use] extern crate log;\nextern crate time;\nextern crate term;\n\npub mod frontend;\npub mod backend;\npub use backend::zcode::zfile;\npub m... | rust | edit | 2 | 2 | bsd-2-clause | 2d4b29c2b74c87cb0a2e3e4905184363ca596671 | Drakulix/zwreec,Drakulix/zwreec | src/zwreec/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::fmt;\n\nstatic ROMAN_MAP: [(usize, &'static str); 13] = [\n (1, \"I\"),\n (4, \"IV\"),\n (5, \"V\"),\n (9, \"IX\"),\n (10, \"X\"),\n (40, \"XL\"),\n (50, \"L\"),\n (90, \"XC\"),\n (100, \"C\"),\n (400, \... | rust | edit | 1 | 3 | mit | 45513c97ca37ef5ca2a071e4c9bd27653eca89dc | petertseng/exercism-rust,exercism/xrust,petertseng/exercism-rust,exercism/xrust,petertseng/exercism-rust | exercises/roman-numerals/example.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::process::Command;\n\n\npub struct Output {\n pub status: i32,\n pub stdout: String,\n pub stderr: String,\n}\n\n\n/// Run an AppleScript.\n///\n/// * `script`: The AppleScript code to run.\n///\npub fn run(script: &str) -> Output ... | rust | edit | 0 | 1 | mit | 2189bb988f7682c429003e41e9f505122ce1785c | alexwlchan/safari.rs,alexwlchan/safari.rs | src/applescript.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse game::{Position, Move, ZobristHash, NumPlies};\n\nuse negamax::Bound;\n\n#[derive(Clone, Debug)]\npub struct Data {\n pub hash: ZobristHash,\n pub depth: NumPlies,\n pub bound: Bound,\n pub best_move_opt: Option<Move>,\n}\n\np... | rust | edit | 4 | 3 | mit | b0e4394d838843389baef3cb931421f0863b1901 | theemathas/binary_turk | search/src/transposition_table.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[derive(PartialEq, Debug)]\npub struct RibonucleicAcid(String);\n\nimpl RibonucleicAcid {\n pub fn new(rna: &str) -> RibonucleicAcid {\n RibonucleicAcid(rna.into())\n }\n}\n\n#[derive(PartialEq, Debug)]\npub struct Deoxyribonucl... | rust | edit | 0 | 2 | mit | b30f7ce97d422fb71ddd76a3dec652c6646ce4bf | attilahorvath/exercism-rust | rna-transcription/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nfn f(f: fn@(int) -> bool) -> bool { f(10) }\n\nfn main() {\n assert do f() { |i| i == 10 } == 10; //! ERROR: expected `bool` but found `int`\n}\n\n```\n\nApply this change: Add `i` suffix to cfail test so it works after suffix inference"
... | rust | edit | null | null | apache-2.0 | 3f56c0a42de5a9a8cc9698148622263c88de01fa | erickt/rust,barosl/rust,kimroen/rust,sarojaba/rust-doc-korean,nwin/rust,dinfuehr/rust,pythonesque/rust,servo/rust,nwin/rust,stepancheg/rust-ide-rust,SiegeLord/rust,zubron/rust,jbclements/rust,0x73/rust,nwin/rust,andars/rust,kimroen/rust,fabricedesre/rust,miniupnp/rust,dinfuehr/rust,P1start/rust,aturon/rust,avdi/rust,se... | src/test/compile-fail/do2.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse config::Config;\n#[derive(Debug, Default, serde_derive::Deserialize, PartialEq)]\nstruct AppConfig {\n list: Vec<String>,\n}\n\nfn main() {\n std::env::set_var(\"APP_LIST\", \"Hello World\");\n\n let config = Config::builder()\n ... | rust | edit | 0 | 1 | apache-2.0 | 91cea3779763525059cdd1b146774314e7ba6ea6 | mehcode/config-rs | examples/env-list/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse lazy_static::lazy_static;\nuse std::future::Future;\nuse std::sync::Mutex;\nuse tokio::runtime::{Builder, Runtime};\n\nlazy_static! {\n static ref RUNTIME: Mutex<Runtime> = Mutex::new(\n Builder::new()\n .basic_schedu... | rust | edit | 1 | 1 | mit | c7124953df5bd27ccb47e887f234d5854ed9b5e1 | rhysd/git-brws,rhysd/git-brws,rhysd/git-brws | src/async_runtime.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate rand;\n\nuse std::sync::mpsc::{Sender, Receiver};\nuse std::sync::mpsc;\nuse std::{thread, time};\nuse rand::Rng;\n\nstatic NTHREADS: i32 = 64;\n\nfn main() {\n // Channels have two endpoints: the `Sender<T>` and the `Receiver... | rust | edit | 0 | 1 | mit | eee492805644405375994967c8304fd4a7e665b2 | willsalz/actors | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![deny(missing_docs)]\n\nuse varint::consume_single_varint;\nuse stream::*;\nuse std::io::Read;\n\n/// A consumer for a byte stream\npub struct ByteConsumer<'a> {\n read: &'a mut Read,\n type_: StreamType,\n}\n\nimpl<'a> ByteConsumer<'... | rust | edit | 0 | 4 | mit | fc3836af76472f334a24c5ed86809d08bd419d79 | sevagh/pqrs,sevagh/pq,sevagh/pq,sevagh/pqrs | stream-delimit/src/byte_consumer.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[derive(Debug)]\npub enum CalculatorInput {\n Add,\n Subtract,\n Multiply,\n Divide,\n Value(i32),\n}\n\npub fn evaluate(inputs: &[CalculatorInput]) -> Option<i32> {\n let mut operands: Vec<i32> = Vec::new();\n\n for inp... | rust | edit | 0 | 6 | mit | 4f178164f9ca5380474170a295fa057f734cc7d2 | rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism | rust/rpn-calculator/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::collections::btree_map::BTreeMap;\nuse js_types::js_type::{JsType, JsThing};\n\npub struct JsObj {\n proto: Option<Box<JsObj>>,\n dict: BTreeMap<JsType, JsType>,\n}\n\nimpl JsThing for JsObj {}\n\nimpl JsObj {\n pub fn new()... | rust | edit | 0 | 1 | mit | 05ff346e295b77b4565e3c27fe81bf5b41470205 | rustoscript/french-press | src/js_types/js_obj.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![feature(proc_macro_non_items)]\n\npub mod app;\npub mod time;\npub mod render;\n\n```\n\nApply this change: Fix the procedural macro hygiene stuff."
},
{
"role": "assistant",
"content": "#![feature(proc_macro_hygiene)]\n\npub m... | rust | edit | 1 | 0 | bsd-3-clause | d6b1f62e12318e30f7258c45aa57096ef53a90ff | phaazon/ion | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![doc(html_favicon_url = \"https://www.ruma.io/favicon.ico\")]\n#![doc(html_logo_url = \"https://www.ruma.io/images/logo.png\")]\n\npub mod authentication;\npub mod keys;\npub mod status;\npub mod tos;\n\n```\n\nApply this change: identity-s... | rust | edit | 1 | 0 | mit | 0d617995b255c9e8ebfc14c3358c4dbd96e25e24 | ruma/ruma | ruma-identity-service-api/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Check if stdin is from a tty"
},
{
"role": "assistant",
"content": "#![feature(libc)]\nextern crate libc;\n\npub fn readline() -> Option<String> {\n // Buffer to hold readline input\n let buffer = String::new();\n\n let is... | rust | new_file | 0 | 2 | mit | 4ca33c110451cab121d8e060e85eae23e2d0f071 | kkawakam/rustyline,gwenn/rustyline,dubrowgn/rustyline,cavedweller/rustyline,dubrowgn/rustyline | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nfn main() {\n let data: [u8; std::isize::MAX as usize] = [42; std::isize::MAX as usize];\n //~^ ERROR: rustc layout computation failed: SizeOverflow([u8;\n assert_eq!(data.len(), 1024);\n}\n\n```\n\nApply this change: Make layout Siz... | rust | edit | 3 | 1 | apache-2.0 | 42239e69bf43ee7dbda05cf757f86f10a0f16272 | aidancully/rust,rust-lang/miri,aidancully/rust,GBGamer/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,rust-lang/miri,GBGamer/rust,rust-lang/miri,GBGamer/rust,GBGamer/rust,aidancully/rust,graydon/rust,rust-lang/miri,tsion/miri,graydon/rust,GBGamer/rust,GBGamer/rust,graydon/rust,GBGamer/rust,GBGamer/rust,aid... | tests/compile-fail/repeat.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::io::{BufRead, BufReader};\nuse std::path::PathBuf;\nuse std::process::{Command, Stdio};\n\n#[test]\nfn test() {\n let path = PathBuf::from(::std::env::args().next().unwrap());\n let exe = path.parent()\n .and_then(|path|... | rust | edit | 3 | 2 | mit | c323f0bcd17bb817af1806f856851ccfb15d864e | gluon-lang/try_gluon,gluon-lang/try_gluon,gluon-lang/try_gluon,gluon-lang/try_gluon | tests/run.rs | accepted | null | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.