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 field::{Field, FieldHeight};\n\npub struct FieldWithHeight<F: Field> {\n field: F,\n height: [u16; 8],\n}\n\nimpl<F: Field> FieldWithHeight<F> {\n pub fn new() -> FieldWithHeight<F> {\n FieldWithHeight::<F> {\n ... | rust | edit | 0 | 1 | mit | 5588311ceaa48c51a8b70b80d11f0830faeb61f3 | mayah/rust-puyoai,mayah/rust-puyoai | puyocore/src/field/field_with_height.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! Console logger\n\nuse log::*;\n\n/// Logs to console\npub struct CLILogger;\n\nimpl CLILogger {\n pub fn init<'a>(level: &'a str) -> Result<(), SetLoggerError> {\n set_logger(|max_log_level| {\n max_log_level.set(matc... | rust | edit | 0 | 2 | unlicense | 5cd8dd850ba546ea01d50e26e1d1c3e22afe3c47 | muktakosh/unicorn | src/logger/cli.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![no_std]\n\n#[macro_use]\nextern crate static_assertions;\n\nassert_impl!(byte; u8, Send, Sync);\n\n#[test]\nfn str_impl() {\n assert_impl!(str, Send, Sync, AsRef<[u8]>);\n}\n\n```\n\nApply this change: [Tests] Add failure case for asser... | rust | edit | 0 | 1 | apache-2.0 | cdcd2f337a5be43b59638cc7ded1b26e05abc94c | nvzqz/static-assertions-rs | tests/trait_impl.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\npub trait Summarizable {\n fn summary(&self) -> String;\n}\n\npub struct NewsArticle {\n pub headline: String,\n pub location: String,\n pub author: String,\n pub content: String,\n}\n\nimpl Summarizable for NewsArticle {\n ... | rust | edit | 0 | 1 | mit | c96bdc580f22d156ba1faa75c7d3187edf16c60f | pgrzesik/learning-rust | traits/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern {\n static dc_qlookup_Q3: [i16; 256];\n static ac_qlookup_Q3: [i16; 256];\n}\n\npub fn dc_q(qindex: usize) -> i16 {\n unsafe {\n dc_qlookup_Q3[qindex]\n }\n}\n\npub fn ac_q(qindex: usize) -> i16 {\n unsafe {\n ... | rust | edit | 1 | 2 | bsd-2-clause | a3fd1c0e034fbe728db6ba576941659b7d9b60f4 | xiph/rav1e,xiph/rav1e | src/quantize.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate slog;\n\nuse std::time::Instant;\nuse slog::Logger;\n\n// When this struct is dropped, it logs a message stating its name and how long, in seconds,\n// execution time was. Can be used to time functions or other critical areas.\np... | rust | edit | 3 | 1 | mit | c48bea142d9eb17ee78966f800e6a2360765ca6a | PhilipDaniels/qork,PhilipDaniels/qork,PhilipDaniels/qork | src/rust/qork/src/execution_timer.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate clap;\nextern crate hyper;\n#[macro_use]\nextern crate serde_derive;\nextern crate serde_json;\nextern crate toml;\n\nmod config;\nmod issue;\nmod jira_api;\nmod jira_client;\nmod jira_request;\nmod search_command;\nmod search_re... | rust | edit | 1 | 4 | mit | 305e666479d3cf01dd016ed57a9ba84cc2fdf3de | dorayakikun/alfred_jira_workflow | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse util::units::{Point, Size};\n\npub struct Rectangle {\n location: Point,\n size: Size,\n}\n\nimpl Rectangle {\n\n pub fn new(location: Point, size: Size) -> Rectangle {\n Rectangle { location: location, size: size }\n }... | rust | edit | 2 | 1 | bsd-3-clause | 503bf6e67140164af0639eed1e4db2b41f5f9043 | jgilchrist/rslike | src/util/units/rectangle.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! Defines the DifferentialGeometry type which is used to pass information\n//! about the hit piece of geometry back from the intersection to the shading\n\nuse linalg::{Point, Normal};\nuse geometry::{Geometry, Instance};\n\n/// Stores info... | rust | edit | 2 | 1 | mit | c5a83812f6e1acacb33a493906d0b9b84aceb93f | GuzTech/tray_rust,Twinklebear/tray_rust,voidException/tray_rust | src/geometry/differential_geometry.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse syntax;\nuse syntax::codemap::DUMMY_SP;\nuse syntax::ext::base::ExtCtxt;\nuse syntax::feature_gate::GatedCfg;\n\n/// Create a fake ExtCtxt to perform macro quasiquotes outside of rustc plugins\npub fn with_fake_extctxt<T, F: Fn(&ExtCtxt) ... | rust | edit | 1 | 1 | mit | 7c5bdd7751ae7ccfc87cf2a8ca3a9ccea36a3f6a | tempbottle/rust-peg,daramos/rust-peg,daramos/rust-peg,tempbottle/rust-peg,kevinmehall/rust-peg,kevinmehall/rust-peg | src/fake_extctxt.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate clap;\n\nuse clap::{App, Arg};\n\nfn main() {\n\n let matches = App::new(\"aux2bib\")\n .version(\"0.1.0\")\n .author(\"Nathan Musoke\")\n .about(\"gets BibT... | rust | edit | 0 | 1 | apache-2.0 | 83de90b93e67933887bb9cf58282a9ee3de91a8b | musoke/inspirer,musoke/inspirer | src/bin/aux2bib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![crate_type = \"lib\"]\n\npub fn bar<P>( // Error won't happen if \"bar\" is not generic\n _baz: P,\n) {\n hide_foo()();\n}\n\nfn hide_foo() -> impl Fn() { // Error won't happen if \"iterate\" hasn't impl Trait or has generics\n fo... | rust | edit | 0 | 1 | apache-2.0 | 043fab3fd5731d9b3e76468c1d92445c4f11bebb | graydon/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust | src/test/ui/issues/issue-50865-private-impl-trait/auxiliary/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n# Rust solution via @jrick\n\nuse std::cmp;\nuse std::num::{Int, NumCast};\n\nfn percents<T: Int>(input: &Vec<T>) -> Vec<f64> {\n let mul = f64::from(input.iter().fold(T::zero(), |m, &e| cmp::max(m, e))).unwrap();\n input.iter().map(|el... | rust | edit | 0 | 1 | mit | 221b3d873d079471e158ec21fe00e6cdbdb67259 | Zamicol/Challenge,Zamicol/Challenge,Zamicol/Challenge | 2015-03-12.solution.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[inline]\npub(crate) fn u64_to_arr(number: u64) -> [u8; 8] {\n number.to_le_bytes()\n}\n\n#[inline]\npub(crate) fn arr_to_u64(arr: &[u8]) -> u64 {\n debug_assert_eq!(arr.len(), 8);\n u64::from(arr[0])\n + ((u64::from(arr[1]))... | rust | edit | 0 | 1 | apache-2.0 | 9453e520ccdf358d193eba5536ef51b81635ba32 | spacejam/sled,spacejam/sled,spacejam/sled | crates/pagecache/src/util.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate libnfqueue as nfq;\n\nuse nfq::{Handle, ProtocolFamily, CopyMode, VerdictHandler, Message, Verdict};\n\nfn main() {\n let mut handle = Handle::new().ok().unwrap();\n let mut queue = handle.queue(0, Decider{count: 0}).unwrap... | rust | edit | 0 | 2 | mit | 08158b660a5238d9701b811000333f9fb0f01f90 | terminalcloud/libnetfilter_queue,bluepeppers/libnetfilter_queue,steveklabnik/libnetfilter_queue | examples/drop_odd.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::ops::Deref;\n\nuse quote;\n\n#[derive(Debug, Clone)]\npub struct TableData {\n /// Table name\n name: String,\n /// Schema name\n schema: Option<String>,\n}\n\nimpl TableData {\n pub fn new(name: &str, schema: Option<&... | rust | edit | 2 | 2 | apache-2.0 | 86a5ab36e91b642a0a3b31f2f6994fb7e0eeb26c | diesel-rs/diesel,sgrif/diesel,diesel-rs/diesel,sgrif/diesel | diesel_infer_schema/src/table_data.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n/// Maximum number of channels supported in the FLAC format.\npub const MAX_CHANNELS: usize = 8;\n\n/// Audio frame that contains one sample for each channel.\npub struct Frame {\n pub header: Header,\n pub footer: Footer,\n}\n\n/// Channel... | rust | edit | 0 | 0 | bsd-3-clause | bcf159fc5d268b581e4f222926f57dfa3273cea8 | sourrust/flac | src/frame/types.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse gobject::GObject;\nuse libc::c_char;\nuse glib::GError;\n\npub type NotifyNotification = _NotifyNotification;\n\n#[repr(C)]\nstruct NotifyNotificationPrivate;\n\n#[repr(C)]\nstruct _NotifyNotification {\n _parent_object: GObject,\n ... | rust | edit | 0 | 0 | mit | 0adfeec65940ea720960ba6ca21fb5c182a2d179 | crumblingstatue/rust-libnotify-sys | src/notification.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[test]\nfn fmt() {\n if option_env!(\"RUSTC_TEST_SUITE\").is_some() {\n return;\n }\n\n let root_dir = std::path::PathBuf::from(env!(\"CARGO_MANIFEST_DIR\"));\n let dev_dir = root_dir.join(\"clippy_dev\");\n let output ... | rust | edit | 0 | 2 | apache-2.0 | c0c2a8d9c1b2d4f41ad7d61d11a0980116dc795c | aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust | tests/fmt.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse super::schema::notes;\nuse rocket::{Request, Data, Outcome};\nuse rocket::data::{self, FromData};\nuse rocket::http::Status;\nuse rocket::Outcome::*;\nuse serde_json;\nuse rocket_contrib::JSON;\n\n#[derive(Queryable)]\n#[derive(Serialize,... | rust | edit | 1 | 2 | mit | 161a3d86073077f789143dbe9398372ac445e984 | fanderzon/rocket-api | src/models.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate lrs;\n\n#[test]\nfn parse_Num() {\n\n}\n\n#[test]\nfn parse_Sym() {\n\n}\n\n#[test]\nfn parse_Atom() {\n\n}\n\n#[test]\nfn parse_List() {\n\n}\n\n#[test]\nfn parse_Expr() {\n\n}\n\n#[test]\nfn parse_Node() {\n\n}\n\n#[test]\nfn p... | rust | edit | 0 | 1 | apache-2.0 | f4779f2c13f121d6f31e5a4abf366765350f493c | jzhu98/telescope | tests/parsing_tests.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n\nuse nom::{Err, Needed};\n\npub fn report_error(err: Err<&[u8], u32>) {\n match err {\n Err::Code(_) => {\n println!(\"Parsing error: Unknown origin\");\n }\n Err::Node(_, n) => {\n println!(\"Pa... | rust | edit | 0 | 4 | mit | b640da7d24035de9ff2ddfbb176d14432fae762a | snewt/bnf | src/reports.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse super::values::*;\n\n///\n/// The treenode trait is implemented by things that can act as part of a tree\n///\npub trait TreeNode {\n ///\n /// Counts the number of children of this tree node\n ///\n fn count_children(&self) -... | rust | edit | 0 | 0 | apache-2.0 | d45e727370b535b087168d5625d3d7253a26b66f | Logicalshift/tame-tree | src/tree/traits.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nstruct S {}\n\ntrait T<'a> {\n type A;\n}\n\nimpl T<'_> for S {\n type A = u32;\n}\n\nfn foo(x: impl Fn(<S as T<'_>>::A) -> <S as T<'_>>::A) {}\n//~^ ERROR binding for associated type `Output` references an anonymous lifetime\n\nfn main... | rust | edit | 1 | 1 | apache-2.0 | bbaab63f844d64ca726a2a83c18774b3957c7169 | graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust | src/test/ui/associated-types/issue-62200.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```go\n/*\nPackage mal provides a client for accessing the MyAnimeList API.\n\nConstruct a new client, then use one of the client's services to access the\ndifferent MyAnimeList API methods. For example, to get the anime list of the\nuser \"Xinil\":\n... | go | edit | 0 | 0 | mit | 02e96137c936076cd184dab11625b3cb4d6912ce | nstratos/go-myanimelist | mal/doc.go | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\npub trait RefInto<'a, T>: MutInto<'a, T> {\n fn ref_into(&'a self) -> T;\n}\n\npub trait MutInto<'a, T> {\n fn mut_into(&'a mut self) -> T;\n}\n\n```\n\nApply this change: Add basic `RefInto` and `MutInto` implementations"
},
{
... | rust | edit | 0 | 2 | apache-2.0 | 3413078bc4daa893c8feb2da36b04ebc8f7f6dbb | kylewlacy/glitter,kylewlacy/glitter | src/ref_into.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Implement converting from fahrenheit to celsius"
},
{
"role": "assistant",
"content": "use std::io;\n\nfn main() {\n println!(\"Enter value in Fahrenheit:\");\n\n let mut f = String::new();\n\n io::stdin().read_line(&mut f... | rust | new_file | 0 | 1 | mit | 57c19a896edc158d04ef5aa1b47724d00568b6fd | pgrzesik/learning-rust | fahrenheit_to_celsius/src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Copyright (c) The Diem Core Contributors\n// SPDX-License-Identifier: Apache-2.0\n\nuse crate::{protocols::network::SerializedRequest, ProtocolId};\nuse bytes::Bytes;\nuse serde::Serialize;\nuse std::fmt::Debug;\n\n// TODO(philiphayes): ju... | rust | edit | 0 | 2 | apache-2.0 | 5b00d5498dfc64df66860a77e2a884c952a0668a | aptos-labs/aptos-core,libra/libra,libra/libra,aptos-labs/aptos-core,aptos-labs/aptos-core,aptos-labs/aptos-core,aptos-labs/aptos-core,libra/libra,libra/libra,aptos-labs/aptos-core,libra/libra,aptos-labs/aptos-core | network/src/protocols/direct_send/mod.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std;\n\n/// GcLeaf can be used to embed just about anything in a GC heap type.\n#[derive(Copy, Clone, Debug, PartialEq)]\npub struct GcLeaf<T: Clone + 'static> {\n // This private field has an underscore in the hopes that it is\n //... | rust | edit | 1 | 1 | mit | 1556301fc3eab7058659c2d82fd730e86a43ff43 | jorendorff/cell-gc,jorendorff/cell-gc | src/gc_leaf.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or\n// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license\n// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your\n// option. This file may not be copied, ... | rust | edit | 1 | 1 | apache-2.0 | 1404ec5611511fda5dcb39a791275e6e22f8fa93 | endoli/disassemble.rs | src/address.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::io;\n\nuse tag;\nuse err;\nuse serial;\n\nimpl serial::traits::Asn1Info for u64 {\n fn asn1_type(&self) -> tag::Type {\n tag::Type::from(\"INTEGER\")\n }\n\n fn asn1_class(&self) -> tag::Class {\n tag::Class::Universal\n }\... | rust | edit | null | null | apache-2.0 | 81123178d68ea1a61fd9acffd7f5fe355774478a | keeperofdakeys/asn1-rs,keeperofdakeys/asn1-rs | src/asn1-rs/serial/int.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate capnpc;\n\nfn main() {\n\n // CAPNP_INCLUDE_DIR=$(shell dirname $(shell which capnp))/../include\n\n let prefix = {\n let output = ::std::process::Command::new(\"which\").arg(\"capnp\")\n .output().unwrap(... | rust | edit | 0 | 1 | mit | 1ebdfb10b6cf5cc16d8bfb592ad9ae501c8d8e1e | dwrensha/capnproto-rust,dwrensha/capnp-rpc-rust,placrosse/capnproto-rust,dwrensha/capnp-rpc-rust,tempbottle/capnproto-rust | build.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Generated from pipe compiler\nmod stream {\n fn init<T: send>() -> (client::stream<T>, server::stream<T>) {\n pipes::entangle()\n }\n enum stream<T: send> { send(T, server::stream<T>), }\n mod client {\n fn send<T... | rust | edit | null | null | apache-2.0 | d594f3701a5c50e00bb496288477010e31c38a69 | stepancheg/rust-ide-rust,dinfuehr/rust,KokaKiwi/rust,quornian/rust,nham/rust,quornian/rust,kimroen/rust,bombless/rust,mahkoh/rust,ebfull/rust,AerialX/rust-rt-minimal,sae-bom/rust,pshc/rust,krzysz00/rust,l0kod/rust,Ryman/rust,XMPPwocky/rust,dinfuehr/rust,nwin/rust,aneeshusa/rust,Ryman/rust,achanda/rand,AerialX/rust,P1st... | src/test/run-pass/issue-2930.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![feature(libc)]\nextern crate libc;\n\nuse libc::{c_int, c_uint};\n\n#[repr(C)]\n#[derive(Copy)]\npub struct RawEvent {\n pub etype: u8,\n pub emod: u8,\n pub key: u16,\n pub ch: u32,\n pub w: i32,\n pub h: i32,\n pub x... | rust | edit | 0 | 0 | mit | d3f63288d71b7c50f53ea2dc9ac0f776ccd036ec | gchp/termbox-sys | lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Copyright:: Copyright (c) 2015-2016 The Habitat Maintainers\n//\n// The terms of the Evaluation Agreement (Habitat) between Chef Software Inc.\n// and the party accessing this file (\"Licensee\") apply to Licensee's use of\n// the Software... | rust | edit | null | null | apache-2.0 | cbae02c5c54756e3b479c9d947b1dc4a0b7c306f | habitat-sh/habitat,habitat-sh/habitat,rsertelon/habitat,rsertelon/habitat,rsertelon/habitat,habitat-sh/habitat,rsertelon/habitat,habitat-sh/habitat,habitat-sh/habitat,habitat-sh/habitat,habitat-sh/habitat,habitat-sh/habitat,rsertelon/habitat,rsertelon/habitat,rsertelon/habitat | src/util/sys.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![no_main]\n#[macro_use] extern crate libfuzzer_sys;\nextern crate inf_4301a;\n\nuse std::str;\n\nfuzz_target!(|data: &[u8]| {\n\n if let Ok(ref s) = str::from_utf8(data) {\n if let Ok(exprs) = inf_4301a::parse_expressions(&s) {\n ... | rust | edit | 0 | 0 | mit | 7e85ab23d4acab936a55532c4f637baedab7f1e7 | minijackson/INF-4301A,minijackson/INF-4301A | fuzz/fuzzers/fuzzer_script_1.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[cfg(feature = \"acpi\")]\nuse acpi;\nuse syscall::io::{Io, Pio};\n\n#[no_mangle]\npub unsafe extern fn kreset() -> ! {\n println!(\"kreset\");\n\n // 8042 reset\n {\n println!(\"Reset with 8042\");\n let mut port = Pi... | rust | edit | 2 | 2 | mit | aff0c339b486f29006ba791983cd716e2a2ff307 | redox-os/kernel,redox-os/kernel,redox-os/kernel | src/arch/x86_64/stop.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse {SystrayError};\n\npub struct Window {\n}\n\nimpl Window {\n pub fn new() -> Result<Window, SystrayError> {\n Err(SystrayError::NotImplementedError)\n }\n}\n\n```\n\nApply this change: Add dummy `unimplemented!()` for cocoa a... | rust | edit | 2 | 2 | bsd-3-clause | d12dd5ec94030b8d1c8b480c910209fafd83a90a | qdot/systray-rs,qdot/systray-rs | src/api/cocoa/mod.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Copyright 2014 The Rust Project Developers. See the COPYRIGHT\n// file at the top-level directory of this distribution and at\n// http://rust-lang.org/COPYRIGHT.\n//\n// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or\n//... | rust | edit | 0 | 1 | apache-2.0 | 560def15113d3d54b262d2b9365b6952e5e5ee3a | dinfuehr/rust,ktossell/rust,defuz/rust,avdi/rust,ebfull/rust,shepmaster/rand,emk/rust,miniupnp/rust,erickt/rust,erickt/rust,jroesch/rust,hauleth/rust,untitaker/rust,aturon/rust,bombless/rust,GBGamer/rust,servo/rust,rohitjoshi/rust,omasanori/rust,0x73/rust,cllns/rust,zaeleus/rust,seanrivera/rust,jroesch/rust,pczarn/rust... | src/test/run-pass/deriving-global.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate document;\nextern crate xpath;\n\nuse std::collections::hashmap::HashMap;\n\nuse document::{Document,ToAny};\n\nuse xpath::{XPathEvaluationContext,XPathFactory};\nuse xpath::expression::XPathExpression;\n\nfn main() {\n let mu... | rust | edit | 0 | 5 | mit | 33029f440f9be98f2460fcaf7c2d87defac902e9 | shepmaster/sxd-rust | evaluate/src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::fmt::{Display, Formatter, Error as FormatError};\nuse std::error::Error;\n\npub type PortMidiDeviceId = i32;\npub type PortMidiResult<T> = Result<T, PortMidiError>;\n\n#[derive(Copy, Clone, Debug, PartialEq, Eq)]\npub enum PortMidiEr... | rust | edit | 0 | 2 | mit | d18af4351a1e05be97cb360da9c228c1ecfd58c5 | samdoshi/portmidi-rs,samdoshi/portmidi-rs | src/types.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nmod vm;\nmod command;\nmod parse;\nmod program;\n\nuse vm::VM;\nuse program::Program;\nuse std::io::Write;\nuse std::env;\nuse std::path::Path;\nuse std::fs::File;\nuse std::io::prelude::*;\n\n\nfn main() {\n let vm = VM::new();\n let p... | rust | edit | 1 | 3 | mit | 206898f996deeceae8d3a18fd75f8fe39e8fa8dc | nafarlee/thoughtfuck | src/main.rs | rejected_duplicate | Near-duplicate of sample 119763 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// error-pattern: mismatched types\nuse std;\nimport std::map::hashmap;\nimport std::bitv;\n\ntype fn_info = {vars: hashmap<uint, var_info>};\ntype var_info = {a: uint, b: uint};\n\nfn bitv_to_str(enclosing: fn_info, v: bitv::t) -> str {\n ... | rust | edit | null | null | apache-2.0 | e1b14f6d5b8e423fbed4b482c0029e8c17510246 | KokaKiwi/rust,gifnksm/rust,servo/rust,aturon/rust,kwantam/rust,kmcallister/rust,pythonesque/rust,barosl/rust,andars/rust,P1start/rust,dwillmer/rust,zachwick/rust,andars/rust,GBGamer/rust,mvdnes/rust,nham/rust,dwillmer/rust,mvdnes/rust,seanrivera/rust,mahkoh/rust,reem/rust,jashank/rust,SiegeLord/rust,nham/rust,pythonesq... | src/test/compile-fail/for-loop-decl.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT\n// file at the top-level directory of this distribution and at\n// http://rust-lang.org/COPYRIGHT.\n//\n// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE o... | rust | edit | 5 | 0 | apache-2.0 | 8b5ca90e166e20fc93e1af7ca4f213825139f767 | ajroetker/rustc-serialize,DenisKolodin/rustc-serialize,shepmaster/rustc-serialize,SimonSapin/rustc-serialize,rust-lang-nursery/rustc-serialize,rust-lang/rustc-serialize,gbersac/rustc-serialize,rust-lang-deprecated/rustc-serialize,indefini/rustc-serialize | src/lib.rs | rejected_lint | Too many lint violations: 5 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! Tools for wrapping devices.\n\nuse types::{AudioDevice, Sample, Time};\n\n\n/// Bundles an AudioDevice with allocated input and output buffers.\n///\n/// To use the device, input samples must first be manually dropped into the\n/// `input... | rust | edit | 1 | 1 | apache-2.0 | 6d1c8df21cc42e0264af83af54ccd4720c24316c | oxcable/oxcable,thenyeguy/oxcable,oxcable/oxcable,thenyeguy/oxcable | src/wrappers.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! Contains code to handle an IPC channel which is issuing commands.\n\nuse std::io::prelude::*;\n\nuse rustc_serialize::Decodable;\nuse rustc_serialize::json::{Json, ToJson, Decoder, EncoderError};\n\nuse unix_socket::UnixStream;\n\n/// Rea... | rust | edit | null | null | mit | c57422fa6afb3cce79824b41e889e74b20761b23 | way-cooler/way-cooler,Immington-Industries/way-cooler,way-cooler/way-cooler,Immington-Industries/way-cooler,way-cooler/way-cooler,Immington-Industries/way-cooler | src/ipc/channel.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Copyright 2017 Serde Developers\n//\n// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or\n// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license\n// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your\n... | rust | edit | 1 | 0 | apache-2.0 | deede62d1baf945fc1baf6bd3c99e3c506d7e389 | bolinfest/serde-jsonrc,serde-rs/json,google/serde_json_lenient | tests/deps/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate ggez;\n\nuse ggez::{Game, State, GameError};\nuse std::time::Duration;\n\nstruct MainState\n{\n}\n\nimpl State for MainState\n{\n fn init(&mut self) -> Result<(), GameError>\n {\n println!(\"init\");\n Ok(())\... | rust | edit | 0 | 1 | mit | 6715dd433e03b6461ef57a9da15eb8e839b52448 | ggez/ggez,sjaustirni/ggez,kampffrosch94/ggez | examples/flappy.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or\n// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license\n// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your\n// option. This file may not be copied, ... | rust | edit | 0 | 0 | apache-2.0 | 5c79da766a8f5c12789c2d9b0e6ad3291228816f | exe-dealer/rust-md5,DaGenix/rust-crypto,andreasots/rust-crypto,andreasots/rust-crypto,nmathewson/rust-crypto,thinkingfish/rust-crypto,mseri/rust-crypto,PeterReid/rust-crypto,nmathewson/rust-crypto,tempbottle/rust-crypto,canndrew/rust-crypto,thinkingfish/rust-crypto,PeterReid/rust-crypto,tempbottle/rust-crypto,DaGenix/r... | src/rust-crypto/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate gl as gl_lib;\n\nmod context;\n\npub use gl_lib as gl;\npub use context::Context;\n\n```\n\nApply this change: Fix gl exports in certain circumstances"
},
{
"role": "assistant",
"content": "extern crate gl as gl_lib;\... | rust | edit | 0 | 0 | apache-2.0 | d93d401e27e496ee790c8ed575c041813f16bc8f | kylewlacy/glitter,kylewlacy/glitter | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![feature(zero_one, box_syntax)]\n\nextern crate asexp;\n\npub mod num_expr;\npub mod cond;\n\nuse std::fmt::Debug;\nuse std::cmp::{PartialEq, PartialOrd};\n\n#[derive(Debug, Eq, PartialEq)]\npub enum ExpressionError {\n /// In case of di... | rust | edit | 1 | 0 | mit | 24c63016f8e3699bd2b87ec38a7004fcf2deeef5 | mneumann/expression-rs | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![feature(\n btree_range,\n collections,\n collections_bound,\n question_mark,\n rustc_private,\n pub_restricted,\n)]\n\n// From rustc.\n#[macro_use] extern crate rustc;\nextern crate rustc_borrowck;\nextern crate rustc_dat... | rust | edit | 5 | 0 | apache-2.0 | f3589d68354f42dc98e96aa47827405f364289dd | rust-lang/miri,GBGamer/rust,graydon/rust,rust-lang/miri,graydon/rust,GBGamer/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,GBGamer/rust,GBGamer/rust,aidancully/rust,rust-lang/miri,graydon/rust,rust-lang/miri,aidancully/rust,aidancully/rust,GBGamer/rust,GBGamer/rust,tsion/miri,graydon/rust,GBGamer/ru... | src/lib.rs | rejected_lint | Too many lint violations: 5 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::ops::{Add, AddAssign, Sub};\n\n#[derive(Debug, Copy, Clone)]\npub struct Vec3 {\n pub i : f64,\n pub j : f64,\n pub k : f64,\n}\n\nimpl Vec3 {\n pub fn length(&self) -> f64 {\n (self.i * self.i + self.j * self.j + self.k * sel... | rust | edit | 0 | 1 | mit | 1da5b027f8d6b0fb19eee03e2d6a1c90bcdd86a3 | corragon/rust-raytracer | src/vector.rs | rejected_duplicate | Near-duplicate of sample 119850 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// ignore-windows: File handling is not implemented yet\n// compile-flags: -Zmiri-disable-isolation\n\nuse std::fs::File;\nuse std::io::Read;\n\nfn main() {\n let mut file = File::open(\"./tests/hello.txt\").unwrap();\n let mut contents... | rust | edit | 0 | 1 | apache-2.0 | bdaa90ceb20a42405f9c7fee31133e70aab1bf7d | tsion/miri,rust-lang/miri,rust-lang/miri,rust-lang/miri,rust-lang/miri | tests/run-pass/file_read.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Copyright lowRISC contributors.\n// Licensed under the Apache License, Version 2.0, see LICENSE for details.\n// SPDX-License-Identifier: Apache-2.0\n\nuse anyhow::Result;\nuse structopt::StructOpt;\n\nuse crate::backend::BackendOpts;\nuse... | rust | edit | 0 | 2 | apache-2.0 | d0b964318a70477c6cfadb1886b1de882d2b45d8 | lowRISC/opentitan,lowRISC/opentitan,lowRISC/opentitan,lowRISC/opentitan,lowRISC/opentitan,lowRISC/opentitan | sw/host/opentitanlib/src/backend/cw310.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse glutin::Window;\n\nuse event::{Event, PollEvents, Reactor};\nuse render::{Context, GlutinContext, MetaContext};\n\npub struct Harness<A, C>\n where A: Application<C>,\n C: MetaContext\n{\n application: A,\n context: Cont... | rust | edit | 1 | 3 | mit | 3682a25bc3d68521dc65cb9c77dfed47606abc29 | olson-sean-k/bismuth | src/framework.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::ffi::OsString;\nuse std::env;\nuse std::path::{Path, PathBuf};\nuse std::process::Command;\n\npub fn append_path(name: &str, value: Vec<PathBuf>, cmd: &mut Command) {\n let old_value = env::var_os(name);\n let mut parts: Vec<Pa... | rust | edit | 0 | 3 | apache-2.0 | ee07bdfe44224d8c101772b607fff73b7f9ca665 | Boddlnagg/rustup.rs,nodakai/rustup.rs,polonez/rustup.rs,theindigamer/rustup.rs,rust-lang/rustup,theindigamer/rustup.rs,rust-lang/rustup,inejge/rustup.rs,theindigamer/rustup.rs,rust-lang/rustup,polonez/rustup.rs,polonez/rustup.rs,nodakai/rustup.rs,Boddlnagg/rustup.rs,rust-lang/rustup,inejge/rustup.rs,Boddlnagg/rustup.rs... | src/rustup/env_var.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nfn main() {\n if cfg!(r#static) {\n println!(\"cargo:rustc-link-lib=static=odbc\");\n }\n\n if cfg!(target_os = \"macos\") {\n // if we're on Mac OS X we'll kindly add DYLD_LIBRARY_PATH to rustc's\n // linker sea... | rust | edit | 0 | 2 | mit | 98013f632e7f4becb75c4964f38be9f8a9be0d64 | pacman82/odbc-sys | build.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse syntax::ast;\nuse syntax::ast::{MetaItem, Expr};\nuse syntax::codemap::Span;\nuse syntax::ext::base::{Annotatable, ExtCtxt};\nuse syntax::ext::build::AstBuilder;\nuse syntax::ext::deriving::generic::{Struct, Substructure, TraitDef, ty};\n... | rust | edit | 0 | 1 | mit | 8dd53ec44da28907d8da6914c23916308e26f961 | burtonageo/rebind | rebind_plugins/src/derive_action.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 | a5bdc43a46fb02faeec64fd13b67db11197cef97 | aidancully/rust,GBGamer/rust,GBGamer/rust,aidancully/rust,GBGamer/rust,aidancully/rust,graydon/rust,aidancully/rust,GBGamer/rust,graydon/rust,graydon/rust,GBGamer/rust,graydon/rust,graydon/rust,GBGamer/rust,aidancully/rust,graydon/rust,GBGamer/rust,aidancully/rust,GBGamer/rust | src/test/compile-fail/issue-30730.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse {Parcel, Error, Settings};\nuse std::io::prelude::*;\n\nuse uuid::Uuid;\n\nimpl Parcel for Uuid\n{\n fn read(read: &mut Read,\n settings: &Settings,\n _: &mut hint::Hints)\n -> Result<Self, Error> {\n ... | rust | edit | 4 | 3 | mit | b9f68712843ea3e4c029fd0fe915fab75aad2d84 | dylanmckay/protocol,dylanmckay/protocol | protocol/src/types/uuid.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate base;\n#[macro_use]\nextern crate glium;\n#[macro_use]\nextern crate log;\n\npub mod render;\npub mod event_manager;\nmod config;\nmod game;\n\npub use config::Config;\n\n\npub fn start_game(config: Config, world_provider: &base:... | rust | edit | 1 | 1 | apache-2.0 | ec294134a1f380937872d46b19fd9448d19e5b09 | adRichter/plantex,adRichter/plantex | client/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// run-pass\n// ignore-tidy-cr\n\n// this file has some special \\r\\n endings (use xxd to see them)\n\nfn main() {assert_eq!(b\"\", b\"\\\n \");\nassert_eq!(b\"\\n\", b\"\n\");\n}\n\n```\n\nApply this change... | rust | edit | 0 | 1 | apache-2.0 | 5ab5806c875b9336cd97ff5e58f803b6c95fb9b2 | graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust | src/test/run-pass/issues/issue-16278.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 println!(\"Bismillah\");\n}\n```\n\nApply this change: Add function to convert roman numerals int... | rust | edit | 3 | 2 | mit | 654be5c058ecc91927240bc5f307a3f71425c853 | tzkhan/roman-rust | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse parser::Expr;\nuse parser::Expr::*;\n\n// The main entry point for the calculator itself.\n// It receives an expression tree, and recursively reduces it to a single signed 64-bit integer\npub fn evaluate(expr: &Expr) -> i64 {\n match e... | rust | edit | null | null | mit | 3bda1a1b52c02b07f1f66d4bd035aac5655974b8 | bitwalker/rustcalc | src/calculator.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![cfg_attr(feature=\"clippy\", feature(plugin))]\n#![cfg_attr(feature=\"clippy\", plugin(clippy))]\n#![feature(conservative_impl_trait)]\n#![feature(collections_bound)]\n#![feature(btree_range)]\n#![feature(step_by)]\n\n#![allow(dead_code)]\... | rust | edit | 2 | 0 | apache-2.0 | 9d9d173acb61850f767ea7599dba1d68782d498c | zslayton/cron | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate rust_guessing_game;\n\nuse std::old_io as io;\nuse std::rand;\nuse std::cmp::Ordering;\n\nuse rust_guessing_game::my_funcs;\n\n#[cfg(not(test))]\nfn main() {\n println!(\"Guess the magic number!\");\n let magic_number = ( r... | rust | edit | 0 | 3 | mit | 6103bcc18363c50a6a752b97d7db2305952a3552 | nathanrosspowell/rust_guessing_game | src/main.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 std::process;\nuse structopt::StructOpt;\n\n#[derive(StructOpt, Debug)]\n#[structopt(name = \"cxxbridge\", author)]\nstruct Opt {\n /// I... | rust | edit | 1 | 2 | apache-2.0 | 4aea27578878bdd8416a2c95defcef57d9d65302 | 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/// Validation provider\npub trait Validator {\n fn is_valid(&self, line: &str) -> bool;\n}\n\nimpl Validator for () {\n fn is_valid(&self, _line: &str) -> bool {\n true\n }\n}\n\n```\n\nApply this change: Improve documentatio... | rust | edit | 0 | 1 | mit | ec69bffd1e732a55a3211cfd65f3bef6aed33a39 | kkawakam/rustyline | src/validate.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[macro_use]\nextern crate serde_elm;\n\n#[allow(dead_code)]\n#[derive(Elm)]\nstruct Simple {\n name: String\n}\n\n#[test]\nfn should_assert_elm_generation_was_done() {\n assert!(true);\n}\n\n```\n\nApply this change: Test is the file a... | rust | edit | 0 | 1 | mit | ef42bcd7c7c350195b9ff7c2d9da0037c595dd24 | mijnadres/serde_elm | tests/struct_derive.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate rustc_serialize;\n\nuse self::rustc_serialize::json::{ToJson, Json};\nuse std::collections::BTreeMap;\n\nuse std::fs::File;\nuse std::io::{self, Read};\nuse std::path::Path;\n\npub struct GistFile {\n pub name: String,\n pu... | rust | edit | null | null | bsd-2-clause | 4f85489b71b0cb851337e28fdc82a6a1491dcdf1 | LesPepitos/gist | src/gist/gist_file.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or\n// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license\n// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your\n// option. This file may not be copied, ... | rust | edit | 0 | 4 | apache-2.0 | 4fd7ffbe75306d2e9adc4ac547551d6cf1352eac | DaGenix/rust-crypto,DaGenix/rust-crypto | build.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\npub use std::mem;\npub use std::slice;\n\npub enum IndexDatumType {\n UnsignedByte,\n UnsignedShort\n}\n\npub trait IndexData {\n fn index_datum_type() -> IndexDatumType;\n fn index_bytes(&self) -> &[u8];\n fn index_elements(&s... | rust | edit | 0 | 2 | apache-2.0 | 64c051b190a9ca2181972bbbe3f88f152a1530c2 | kylewlacy/glitter,kylewlacy/glitter | src/index_data.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[macro_use]\nextern crate clap;\n#[macro_use]\nextern crate log;\nextern crate git2;\n\nmod cd;\nmod cli;\nmod logger;\nmod repository;\nmod settings;\n\nuse std::process::exit;\n\nuse settings::Settings;\n\nfn main() {\n match run_cli() ... | rust | edit | null | null | mit | 265f057f25bc50ea8cc926a924336d3ca27ade6c | jhelwig/homers | src/main.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::io::Command;\nuse std::os;\n\nfn main() {\n let curr_dir = os::getenv(\"CARGO_MANIFEST_DIR\").unwrap();\n let nvim_dir = Path::new(curr_dir).join(\"neovim\");\n Command::new(\"make\").arg(\"libnvim\").cwd(&nvim_dir).status()... | rust | edit | 0 | 1 | unlicense | 8e80d59f5b0e00c842d7c27c4a8b7554198b64c4 | oakes/neovim-rs | build.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse data_encoding::{BASE64URL, DecodeError};\n\npub fn check_access_token<T: AsRef<str>>(token: T, salt: T, hash: T) -> bool {\n let hashed_token = salt_and_hash(salt, token);\n let should_be = BASE64URL.decode(hash.as_ref().as_bytes())... | rust | edit | 0 | 3 | bsd-3-clause | 6399311758433b9940b156bdfa6d4f32f9f69f8b | tum-rt/emoji-feedback,tum-rt/emoji-feedback,tum-rt/emoji-feedback,tum-rt/emoji-feedback | src/auth_utils.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![cfg_attr(nightly, feature(custom_derive, plugin))]\n#![cfg_attr(nightly, plugin(serde_macros))]\n\nextern crate serde;\nextern crate serde_json;\n\n#[cfg(feature = \"serde_macros\")]\ninclude!(\"main.rs.in\");\n\n#[cfg(not(feature = \"serd... | rust | edit | 0 | 0 | apache-2.0 | cb4694387e56627d1ffc982bad3a370f6ddef866 | serde-rs/serde,erickt/serde,oli-obk/rust-serde | examples/serde-syntex-example/src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nenum PackageType {\n Bin, // Binary\n Lib, // Library\n Src, // Source\n}\n\nstruct Version {\n major: u32,\n minor: u32,\n patch: u32,\n additional: Option<String>,\n}\n\nstruct Package {\n name: String,\n hash: u3... | rust | edit | 0 | 0 | bsd-3-clause | 6b57746950b4310ee5dfb01bfb3c38b82cc7d06c | hch12907/wiz | src/package.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![ warn( missing_docs ) ]\n#![ warn( missing_debug_implementations ) ]\n\n//!\n//! Basic exceptions handling mechanism.\n//!\n//! # Sample\n//! ```\n//! use werror::*;\n//!\n//! let err1 = Error::new( \"Some error\" );\n//! println!( \"err1 ... | rust | edit | 3 | 0 | mit | 0d52eadb9eeca6ceb5ac68ff5b1550c3b7a8e02e | Wandalen/wTools,Wandalen/wTools | rust/impl/error/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[cfg(all(feature=\"syntax-highlight\", not(windows)))]\nmod syntect;\n#[cfg(all(feature=\"syntax-highlight\", not(windows)))]\npub use self::syntect::*;\n\n#[cfg(any(not(feature=\"syntax-highlight\"), windows))]\nmod null;\n#[cfg(any(not(fea... | rust | edit | 1 | 0 | mit | 2a57763cab24c16a02b67d2ab262df552f43b021 | cobalt-org/cobalt.rs,cobalt-org/cobalt.rs,cobalt-org/cobalt.rs,cobalt-org/cobalt.rs | src/syntax_highlight/mod.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate proc_macro;\n\nuse proc_macro::TokenStream;\nuse syn::{parse_macro_input, File};\n\n#[proc_macro]\npub fn r#mod(input: TokenStream) -> TokenStream {\n parse_macro_input!(input as File);\n \"fn main() {}\".parse().unwrap()\n... | rust | edit | 0 | 0 | apache-2.0 | cfb5ca83d4cbb6468f857213c20007b573faa8a4 | dtolnay/syn | dev/parse.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse super::hmac_client;\nuse super::hmac_server;\n\nuse rand;\nuse rand::Rng;\n\nuse errors::*;\n\npub fn run() -> Result<(), Error> {\n let skip_exercise = true;\n\n if skip_exercise {\n return Err(ChallengeError::Skipped(\"Runs... | rust | edit | 1 | 3 | mit | e4b310c8d501d1539083156f9ec8d1688a481600 | aopicier/cryptopals-rust | challenges/src/set4/challenge32.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::cell::Cell;\nuse std::rc::Rc;\nuse std::sync::Arc;\n\nfn rc_cell() -> Rc<Cell<i32>> {\n let r = Rc::new(Cell::new(42));\n let x = r.get();\n r.set(x + x);\n r\n}\n\n// TODO(solson): also requires destructors to run for th... | rust | edit | 1 | 1 | apache-2.0 | 9e244251a0c05ba5c06fd94970b01d11cfbb73f1 | GBGamer/rust,tsion/miri,rust-lang/miri,aidancully/rust,rust-lang/miri,GBGamer/rust,graydon/rust,GBGamer/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,rust-lang/miri,GBGamer/rust,graydon/rust,aidancully/rust,GBGamer/rust,GBGamer/rust,aidancully/rust,rust-lang/miri,GBGamer/rust,GBGamer/ru... | tests/run-pass/std.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::fmt;\nuse std::error::Error;\n\n#[derive(Debug)]\npub struct ParsingError {\n desc: String,\n}\n\nimpl fmt::Display for ParsingError {\n fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {\n self.description().fmt(f)\... | rust | edit | 2 | 1 | mit | 33601047f1a1e94eea3fb9814bf23dd7f3c081d0 | hoodie/rust-email,niax/rust-email,hoodie/rust-email,buster/rust-email,buster/rust-email,niax/rust-email | src/results.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 struct JsType {\n uid: Uuid,\n t: Box<JsT>,\n}\n\nimpl JsType {\n fn new(t: Box<JsT>) -> JsType {\n JsType {\n uid: Uuid::new_v4(),\n ... | rust | edit | 2 | 3 | mit | 5e798a52c80801364ebbf2e0eff0acb72a53185f | rustoscript/french-press | src/js_types/js_type.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![deny(clippy::internal)]\n#![feature(rustc_private)]\n\n#[macro_use]\nextern crate rustc;\nuse rustc::lint;\n\n#[macro_use]\nextern crate clippy_lints;\n\ndeclare_clippy_lint! {\n pub TEST_LINT,\n correctness,\n \"\"\n}\n\ndeclare_... | rust | edit | 0 | 1 | apache-2.0 | ef29db773e8367e68e957f435f70ee96a85d9a8f | graydon/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust | tests/ui/lint_without_lint_pass.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// this is just a test binary that can be hooked up to Instruments\nextern crate lonlat_bng;\nuse lonlat_bng::{convert_to_bng_threaded, Array};\n\nextern crate rand;\nuse rand::distributions::{IndependentSample, Range};\n\nextern crate libc;\... | rust | edit | 0 | 1 | mit | 858fe76789e1d42c8d0538da9c402e170a646e9d | urschrei/lonlat_bng,urschrei/rust_bng,urschrei/lonlat_bng,urschrei/rust_bng,urschrei/lonlat_bng | src/bin/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! Types used in the registry.\n\nuse std::fmt::{Debug, Display, Formatter};\n\nuse std::sync::Arc;\nuse rustc_serialize::{Encodable, Decodable};\nuse rustc_serialize::json::{Json, ToJson};\n\n/// How much access things have\n#[derive(Debug,... | rust | edit | 2 | 2 | mit | 185afddba73c107e0b96340622a5bad1619fb636 | Immington-Industries/way-cooler,way-cooler/way-cooler,Immington-Industries/way-cooler,way-cooler/way-cooler,Immington-Industries/way-cooler,way-cooler/way-cooler | src/registry/types.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate syn;\n\nuse syn::DeriveInput;\n\npub fn generate_elm(_: &DeriveInput) {\n // do nothing\n}\n\n```\n\nApply this change: Write a test file to generated directory"
},
{
"role": "assistant",
"content": "extern crate s... | rust | edit | 0 | 1 | mit | d03e07b708c1f1f0fc0e4769e9990043d4f3cf8f | mijnadres/serde_elm | src/derive/mod.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate tvdb;\nextern crate argparse;\n\nuse argparse::{ArgumentParser, StoreTrue, Store};\n\n\nfn main(){\n let mut series_name = \"\".to_owned();\n let mut season_no = 1;\n let mut episode_no = 1;\n\n {\n let mut ap ... | rust | edit | 0 | 2 | unlicense | 2022fc461e2cb03b98011f4f999ffb375bd08ca7 | dbr/tvdb-rs | examples/tvdb-lookup.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\npub enum ErrorLevel {\n Info,\n Warning,\n Error,\n}\n\n// Use a hashmap which contains an error level and a string\ntype ErrorStack = Vec<(ErrorLevel, String)>;\n```\n\nApply this change: Make the error stack type public"
},
{
... | rust | edit | 0 | 0 | apache-2.0 | 93ec76c58edeb006b13acb040634b764b951a797 | Willifme/robin_core,Willifme/robin_core,Willifme/robin_core | src/error/mod.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Refactor the ConstantOrigin shape to the query module."
},
{
"role": "assistant",
"content": "use na::{RealField, Unit};\n\nuse crate::math::{Isometry, Point, Vector};\nuse crate::shape::SupportMap;\n\n/// A support mapping that is... | rust | new_file | 0 | 1 | bsd-3-clause | eba20f6ec0f3c1072f326d04761f7d703e3ca931 | sebcrozet/ncollide,sebcrozet/ncollide | src/query/algorithms/special_support_maps.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[macro_use] extern crate log;\nextern crate \"rustc-serialize\" as rustc_serialize;\n\npub mod hpack;\npub mod http;\npub mod client;\n\nmod tests {\n}\n\n```\n\nApply this change: Add feature annotations for currently unstable features used... | rust | edit | null | null | mit | 5b42821565cd7dcc014044e51168d7414a828301 | stepancheg/solicit,Galvanization/solicit,jinnjuice/solicit,mlalic/solicit,tempbottle/solicit,gwicke/solicit | src/lib.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n/*!\n * Hello World server in Rust\n * Binds REP socket to tcp://*:5555\n * Expects \"Hello\" from client, replies with \"World\"\n */\n\nextern mod zmq;\n\nuse std::libc;\n\nfn main() {\n#[fixed_stack_segment];\n\n let context = zmq::Cont... | rust | edit | null | null | apache-2.0 | 8ce43a80622e2db28d0b72a755d7e4ac259356ba | tempbottle/rust-zmq,alexkamp/rust-zmq,erickt/rust-zmq,pblasucci/rust-zmq,petehayes102/rust-zmq,jedisct1/rust-zmq,cristicbz/rust-zmq,dginev/rust-zmq,pfernie/rust-zmq | zguide/hwserver.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![feature(custom_attribute, box_syntax)]\n#![allow(dead_code, unused_attributes)]\n\n#[miri_run]\nfn rc_cell() -> i32 {\n use std::rc::Rc;\n use std::cell::Cell;\n let r = Rc::new(Cell::new(42));\n let x = r.get();\n r.set(x +... | rust | edit | 0 | 1 | apache-2.0 | f6b1282eee33e2967775b8139614de361bf3c6f2 | rust-lang/miri,aidancully/rust,rust-lang/miri,GBGamer/rust,GBGamer/rust,graydon/rust,aidancully/rust,GBGamer/rust,graydon/rust,graydon/rust,tsion/miri,rust-lang/miri,graydon/rust,rust-lang/miri,GBGamer/rust,GBGamer/rust,GBGamer/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/ru... | test/std.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! This is the `custom types` module for Xtensis.\n\n// This file is part of Xtensis.\n\n// This is the Xtensis text editor; it edits text.\n// Copyright (C) 2016-2017 The Xtensis Developers\n\n// This program is free software: you can redi... | rust | edit | null | null | apache-2.0 | 9d72e1f3d071d0504471d63be443df1496053e02 | shymega/slacs,shymega/slacs | src/utils/types.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"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 | d03467971de5a3a89e7583fcbb485ff6454adbf0 | diesel-rs/diesel,sgrif/diesel,diesel-rs/diesel,sgrif/diesel | diesel/src/pg/mod.rs | rejected_duplicate | Near-duplicate of sample 119992 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// This file is part of libfringe, a low-level green threading library.\n// Copyright (c) Ben Segall <<EMAIL>>\n// Copyright (c) edef <<EMAIL>>\n// See the LICENSE file included in this distribution.\n#![cfg(target_os = \"linux\")]\n#![featur... | rust | edit | 0 | 1 | apache-2.0 | 375846bda50964f4dcfc1f36341666f22b608e28 | nathan7/libfringe,nathan7/libfringe | tests/fpe.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse traits::Grid;\nuse traits::Engine;\nuse traits::Consumer;\n\n\npub struct Sequential<G: Grid, C: Consumer> {\n grid: G,\n consumer: C\n}\n\nimpl<G: Grid, C: Consumer> Sequential<G, C> {\n\n pub fn new(grid: G, consumer: C) -> Sel... | rust | edit | 2 | 2 | mit | 85df9aad678192e2f31fb224a025846525887ab7 | 0nkery/celly | src/engine/sequential.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse errors;\n\n// see OSC Type Tag String: http://opensoundcontrol.org/spec-1_0\n// padding: zero bytes (n*4)\npub enum OscType {\n OscInt(i32),\n OscFloat(f32),\n OscString(String),\n OscBlob(Vec<u8>),\n OscTime(u32, u32),\n ... | rust | edit | 1 | 0 | apache-2.0 | b5d64dab892eeeecbdcf667ab8c797d5d3c4fdc7 | klingtnet/rosc | src/osc_types.rs | accepted | null | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.