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": "Write rust code for the following: Change typestate to use visit instead of walk\n\nTypestate was failing to check some code because if it saw an item,\nit would quit immediately. This was to avoid checking nested items\nin the same context as the lexically enclosing item, but ... | rust | new_file | null | null | apache-2.0 | 21b94d57d5319e42f5a30818c88b95c95449864e | aepsil0n/rust,XMPPwocky/rust,vhbit/rust,aturon/rust,pythonesque/rust,rohitjoshi/rust,avdi/rust,kimroen/rust,P1start/rust,ejjeong/rust,mvdnes/rust,vhbit/rust,hauleth/rust,SiegeLord/rust,jroesch/rust,michaelballantyne/rust-gpu,GBGamer/rust,TheNeikos/rust,carols10cents/rust,omasanori/rust,andars/rust,zubron/rust,AerialX/r... | src/test/compile-fail/uninit-after-item.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Write rust code for the following: Add simple link_section test to exercise it"
},
{
"role": "assistant",
"content": "#[cfg(not(target_os = \"macos\"))]\n#[link_section=\".moretext\"]\nfn i_live_in_more_text() -> &'static str {\n \"knock knock\"\n}\n\n#[cfg(not(t... | rust | new_file | 0 | 1 | apache-2.0 | c6c1472c6845ea02fad009603b1c2331b679ed67 | robertg/rust,rprichard/rust,kwantam/rust,shepmaster/rand,servo/rust,krzysz00/rust,dinfuehr/rust,andars/rust,andars/rust,rohitjoshi/rust,aidancully/rust,robertg/rust,miniupnp/rust,omasanori/rust,michaelballantyne/rust-gpu,Ryman/rust,krzysz00/rust,philyoon/rust,XMPPwocky/rust,TheNeikos/rust,Ryman/rust,seanrivera/rust,ejj... | src/test/run-pass/link-section.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add rust code for all-your-base\n\nIt passed all testcases"
},
{
"role": "assistant",
"content": "///\n/// Convert a number between two bases.\n///\n/// A number is any slice of digits.\n/// A digit is any unsigned integer (e.g. u8... | rust | new_file | 0 | 4 | bsd-2-clause | 4d3807ad2f9592f1796f964ff25ece8287b38d56 | gyn/exercism,gyn/exercism,gyn/exercism,gyn/exercism | rust/all-your-base/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add Adapter pattern in Rust"
},
{
"role": "assistant",
"content": "/*\n * Adapter Design Pattern\n * http://joshldavis.com/design-patterns/adapter/\n */\n\n/*\n * Core Trait that defines a basic Rocket Ship\n */\ntrait RocketShip {... | rust | new_file | 0 | 2 | mit | 170ef07b5e71d7fc702bc4658854324aa7859a24 | beni55/rust-design-patterns,jdavis/rust-design-patterns,jdavis/rust-design-patterns,ianlet/rust-design-patterns,beni55/rust-design-patterns,ianlet/rust-design-patterns,ianlet/rust-design-patterns,jdavis/rust-design-patterns,jdavis/rust-design-patterns,beni55/rust-design-patterns | patterns/adapter.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add test for expanding doc strings in macros."
},
{
"role": "assistant",
"content": "// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT\n// file at the top-level directory of this distribution and at\n// http://r... | rust | new_file | 1 | 1 | apache-2.0 | 5c20a1535e24daa74e90f6186642e56674f13b6e | bombless/rust,aepsil0n/rust,aneeshusa/rust,l0kod/rust,carols10cents/rust,zaeleus/rust,miniupnp/rust,victorvde/rust,reem/rust,bombless/rust,aepsil0n/rust,graydon/rust,zachwick/rust,aidancully/rust,avdi/rust,robertg/rust,XMPPwocky/rust,miniupnp/rust,quornian/rust,hauleth/rust,mdinger/rust,hauleth/rust,GBGamer/rust,ebfull... | src/test/run-pass/macro-attribute-expansion.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate futures;\n\nuse std::cell::Cell;\nuse std::sync::Arc;\n\nuse futures::{Future, Task, Poll};\nuse futures::executor::{Executor, ExecuteCallback};\n\nthread_local!(static EXECUTOR_HIT: Cell<bool> = Cell::new(false));\n\nstruct MyFu... | rust | edit | 0 | 2 | apache-2.0 | cbf29c27c681ca9d3a629fc13f60e544fe140349 | alexcrichton/futures-rs,Idolf/futures-rs | tests/executor.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add a test to check that AtomicBool has the proper representation"
},
{
"role": "assistant",
"content": "// Copyright 2016 The Rust Project Developers. See the COPYRIGHT\n// file at the top-level directory of this distribution and ... | rust | new_file | 3 | 1 | apache-2.0 | ee1fc38c2a41c96ab3b8d058b7fa1328e93391ef | GBGamer/rust,aidancully/rust,graydon/rust,aidancully/rust,GBGamer/rust,aidancully/rust,GBGamer/rust,graydon/rust,GBGamer/rust,GBGamer/rust,GBGamer/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust,GBGamer/rust,GBGamer/rust,graydon/rust,graydon/rust,graydon/rust | src/test/run-pass/atomic-access-bool.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add a test that uses a hypothetical bare-fn spawn signature\n\nIssue #1022"
},
{
"role": "assistant",
"content": "// This is what the signature to spawn should look like with bare functions\n\nfn spawn<~T>(val: T, f: fn#(T)) {\n ... | rust | new_file | null | null | apache-2.0 | 90c240208985aff48c8bf09574c0cb1d79868593 | pelmers/rust,mihneadb/rust,vhbit/rust,TheNeikos/rust,cllns/rust,omasanori/rust,TheNeikos/rust,andars/rust,erickt/rust,emk/rust,pshc/rust,aturon/rust,mdinger/rust,jbclements/rust,richo/rust,mdinger/rust,rohitjoshi/rust,kmcallister/rust,barosl/rust,Ryman/rust,pshc/rust,sae-bom/rust,j16r/rust,aidancully/rust,mvdnes/rust,a... | src/test/run-pass/fn-bare-spawn.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Write rust code for the following: Add tests from old display_derive crate to ensure backward-compatibility"
},
{
"role": "assistant",
"content": "// The following code is from https://github.com/withoutboats/display_derive/blob/232a32ee19e262aacbd2c93be5b4ce9e89a5f... | rust | new_file | 0 | 1 | mit | c6d1c2d1036cfc3ab921409102d0c8445995656d | JelteF/derive_more,JelteF/derive_more | tests/boats_display_derive.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add test for DerefMut methods"
},
{
"role": "assistant",
"content": "#![crate_name = \"foo\"]\n\nuse std::ops;\n\npub struct Foo;\n\nimpl Foo {\n pub fn foo(&mut self) {}\n}\n\n// @has foo/struct.Bar.html\n// @has - '//div[@clas... | rust | new_file | 0 | 1 | apache-2.0 | 4fb29f9fd2758a5c07328fc12aa771bb239f9450 | aidancully/rust,graydon/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust | src/test/rustdoc/deref-mut-methods.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add some XML character predicates"
},
{
"role": "assistant",
"content": "use super::{Document,Root,RootChild};\n\ntrait XmlChar {\n fn is_name_start_char(&self) -> bool;\n fn is_name_char(&self) -> bool;\n}\n\nimpl XmlChar fo... | rust | new_file | null | null | mit | 6bcd10f8db14f4fd0acfa8a1b5cee0a990838522 | shepmaster/sxd-rust | document/src/parser.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Write rust code for the following: Add solution to problem 35"
},
{
"role": "assistant",
"content": "#[macro_use] extern crate libeuler;\nextern crate num;\n\nuse libeuler::SieveOfAtkin;\nuse std::collections::HashSet;\nuse num::traits::PrimInt;\n\n/// The number, 1... | rust | new_file | 0 | 5 | mit | 777e99c7d828c46d6bb3b856b7ddf4a3ee04a16e | zmbush/euler,zmbush/euler | sol_0035/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add example that calculate Lyapunov exponents of Lorenz 63 model"
},
{
"role": "assistant",
"content": "\nextern crate ndarray;\nextern crate ndarray_odeint;\nextern crate ndarray_linalg;\nextern crate itertools;\n\nuse ndarray::*;... | rust | new_file | 0 | 2 | mit | d98c2e9c9b67243834194f657de84f1078893c93 | termoshtt/ndarray-odeint,termoshtt/ndarray-odeint | src/bin/clv.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add cfail test for custom attribute gate"
},
{
"role": "assistant",
"content": "// 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.o... | rust | new_file | 0 | 1 | apache-2.0 | d5c3194c5998a229e869a0c1f85e1a4a0dff5ecb | carols10cents/rust,pshc/rust,jroesch/rust,zubron/rust,rohitjoshi/rust,XMPPwocky/rust,KokaKiwi/rust,avdi/rust,gifnksm/rust,rprichard/rust,reem/rust,rprichard/rust,seanrivera/rust,sae-bom/rust,zubron/rust,miniupnp/rust,zubron/rust,jashank/rust,jashank/rust,untitaker/rust,kwantam/rust,victorvde/rust,richo/rust,philyoon/ru... | src/test/compile-fail/custom_attribute.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::{io, fs};\n\nmacro_rules! readln {\n () => {\n {\n let mut line = String::new();\n match io::stdin().read_line(&mut line) {\n Ok(n) => Some(line.trim().to_string()),\n Err... | rust | edit | 5 | 7 | mit | 8961b666d789c347cf966abb50353bb4ff9bf715 | Lacaranian/redox,Lacaranian/redox,rexlunae/redox,Lacaranian/redox,Lacaranian/redox,Lacaranian/redox,rexlunae/redox,rexlunae/redox | filesystem/apps/test/test.rs | rejected_lint | Too many lint violations: 5 | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add rust code for variable-length-quantity case\n\nIt passed all test cases"
},
{
"role": "assistant",
"content": "/// Convert a list of numbers to a stream of bytes encoded with variable length encoding.\npub fn to_bytes(values: &... | rust | new_file | 0 | 9 | bsd-2-clause | afc7a4ef2c2a65ff1ed007580683dd0382d82a80 | gyn/exercism,gyn/exercism,gyn/exercism,gyn/exercism | rust/variable-length-quantity/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add a task spawning benchmark\n\nThis is the kind of workload that the test runner generates - lots of tiny\nlittle tasks - and currently it leaves the CPU underutilized."
},
{
"role": "assistant",
"content": "use std;\nimport std:... | rust | new_file | null | null | apache-2.0 | ec46f07e6e41d91b86f5fee8cd0925934a0f7b60 | kmcallister/rust,omasanori/rust,mvdnes/rust,servo/rust,hauleth/rust,0x73/rust,TheNeikos/rust,hauleth/rust,ktossell/rust,defuz/rust,andars/rust,cllns/rust,0x73/rust,fabricedesre/rust,pshc/rust,aepsil0n/rust,sarojaba/rust-doc-korean,avdi/rust,ejjeong/rust,ktossell/rust,ebfull/rust,rprichard/rust,ejjeong/rust,mdinger/rust... | src/test/bench/task-perf-spawnalot.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Write rust code for the following: Add a test for thread locals."
},
{
"role": "assistant",
"content": "#![feature(thread_local)]\n\nuse std::thread;\n\n#[thread_local]\nstatic mut A: u8 = 0;\n#[thread_local]\nstatic mut B: u8 = 0;\nstatic mut C: u8 = 0;\n\nunsafe f... | rust | new_file | 0 | 2 | apache-2.0 | 92946b5a9cc52bfef2338b2075cec85561652449 | rust-lang/miri,rust-lang/miri,rust-lang/miri,rust-lang/miri | tests/run-pass/concurrency/thread_locals.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add a test for const\n\nSimilar to the tests for Option and Result."
},
{
"role": "assistant",
"content": "// run-pass\n\n#![feature(cow_is_borrowed)]\n\nuse std::borrow::Cow;\n\nfn main() {\n const COW: Cow<str> = Cow::Borrowed... | rust | new_file | 0 | 1 | apache-2.0 | d591829ed0c9c589c0b05e9cabf1b90d30ed19a9 | graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,aidancully/rust | src/test/ui/consts/cow-is-borrowed.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: debuginfo: Add test case for limited debuginfo"
},
{
"role": "assistant",
"content": "// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT\n// file at the top-level directory of this distribution and at\n// http://... | rust | new_file | 0 | 1 | apache-2.0 | a5b4d94e3daa0fc2ea59785cb6480e421c4bd8e6 | gifnksm/rust,dinfuehr/rust,nwin/rust,l0kod/rust,zubron/rust,ruud-v-a/rust,jroesch/rust,mvdnes/rust,GBGamer/rust,zubron/rust,emk/rust,AerialX/rust,nham/rust,jroesch/rust,aneeshusa/rust,richo/rust,miniupnp/rust,pshc/rust,jashank/rust,jroesch/rust,pythonesque/rust,gifnksm/rust,ejjeong/rust,carols10cents/rust,mahkoh/rust,K... | src/test/debug-info/limited-debuginfo.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add trivial assembler example w/SRecord output"
},
{
"role": "assistant",
"content": "extern crate r68k_tools;\n\nuse r68k_tools::assembler::Assembler;\nuse std::io;\nuse std::io::BufReader;\nuse r68k_tools::srecords::write_s68;\n\... | rust | new_file | 0 | 1 | mit | c7c3fc2b06fdc093180f21c379786dfd7cd3cad9 | marhel/r68k,marhel/r68k | tools/examples/asm.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add a test that exercises these cases in bind."
},
{
"role": "assistant",
"content": "// xfail-stage0\n\nfn fix_help[A,B](@fn (@fn (&A) -> B, &A) -> B f, &A x) -> B {\n ret f(@bind fix_help(f, _), x);\n}\n\nfn fix[A,B](@fn (@fn ... | rust | new_file | null | null | apache-2.0 | 418aa525107319a224a3299eae8d9c8fdfe02c13 | servo/rust,aidancully/rust,rohitjoshi/rust,pshc/rust,ebfull/rust,LeoTestard/rust,defuz/rust,P1start/rust,stepancheg/rust-ide-rust,jbclements/rust,jroesch/rust,XMPPwocky/rust,rprichard/rust,vhbit/rust,mahkoh/rust,vhbit/rust,reem/rust,rprichard/rust,stepancheg/rust-ide-rust,jashank/rust,Ryman/rust,ktossell/rust,LeoTestar... | src/test/run-pass/fixed-point-bind-box.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Write rust code for the following: Add Rust solution for reversing a string"
},
{
"role": "assistant",
"content": "fn reverse<T>(s: T) -> String where T: Into<String> {\n s.into().chars().rev().collect()\n}\n\nfn main() {\n println!(\"{}\", reverse(\"hello élle ... | rust | new_file | 0 | 2 | mit | 2b5af5b6db89cdf0d71fd8ee64305dd60b66a5e1 | mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-inter... | problems/reverse-string/reverse-string.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add solution to problem 20"
},
{
"role": "assistant",
"content": "#[macro_use] extern crate libeuler;\n\nextern crate num;\nuse num::bigint::{BigInt, ToBigInt};\nuse num::traits::{One, Zero};\n/// n! means n × (n − 1) × ... × 3 × 2... | rust | new_file | 0 | 4 | mit | 89967f9583209bbf0b3758fa9d0b092654e79b78 | zmbush/euler,zmbush/euler | sol_0020/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add test for assert_eq! with none Sized types"
},
{
"role": "assistant",
"content": "// Copyright 2015 The Rust Project Developers. See the COPYRIGHT\n// file at the top-level directory of this distribution and at\n// http://rust-l... | rust | new_file | 0 | 1 | apache-2.0 | 780581e8a1233f744329f37b6de10177069fbd86 | GBGamer/rust,GBGamer/rust,graydon/rust,GBGamer/rust,GBGamer/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,GBGamer/rust,GBGamer/rust,graydon/rust,GBGamer/rust,GBGamer/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust | src/test/run-pass/assert-eq-macro-unsized.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add a test for sparc64 ABI issue"
},
{
"role": "assistant",
"content": "// Copyright 2018 The Rust Project Developers. See the COPYRIGHT\n// file at the top-level directory of this distribution and at\n// http://rust-lang.org/COPYR... | rust | new_file | 1 | 1 | apache-2.0 | cc2bd71269f9c54fed3849141e29204a5f353693 | GBGamer/rust,aidancully/rust,graydon/rust,aidancully/rust,GBGamer/rust,graydon/rust,GBGamer/rust,aidancully/rust,GBGamer/rust,aidancully/rust,aidancully/rust,graydon/rust,GBGamer/rust,graydon/rust,graydon/rust,GBGamer/rust,GBGamer/rust,graydon/rust,GBGamer/rust,aidancully/rust | src/test/codegen/sparc-struct-abi.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nstruct Point { x: i32, y: i32, z: i32 }\n\nfn main() {\n let mut point = Point { x: 0, y: 0, z: 0 };\n\n {\n let borrowed_point = &point;\n let another_borrow = &point;\n\n // Data can be accessed via the references... | rust | edit | 0 | 1 | apache-2.0 | f8e24e8e0d40d168d24fb2e250d8a6a05ccb99fe | realcr/rust-by-example,chriskrycho/rust-by-example,realcr/rust-by-example,chriskrycho/rust-by-example | examples/scope/borrow/alias/alias.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add test of conversion to box dyn error"
},
{
"role": "assistant",
"content": "mod drop;\n\nuse self::drop::DetectDrop;\nuse anyhow::Error;\nuse std::error::Error as StdError;\nuse std::sync::atomic::AtomicBool;\nuse std::sync::ato... | rust | new_file | 4 | 1 | apache-2.0 | 0dc3332a7d7474d3d3c3acb28bb52884239224f9 | dtolnay/anyhow | tests/test_convert.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add example for child properties"
},
{
"role": "assistant",
"content": "//! # Child Properties\n//!\n//! This sample demonstrates how to set child properties.\n\n#![crate_type = \"bin\"]\n\nextern crate gtk;\n\nuse gtk::{BoxExt, Bu... | rust | new_file | 0 | 1 | mit | 33a182a2d874722dee4d6ef04be2227a6c38c9a5 | rust-gnome/examples,rust-gnome/examples | src/bin/child-properties.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add udp echo server example"
},
{
"role": "assistant",
"content": "use mio::net::UdpSocket;\nuse mio::{Events, Interests, Poll, Token};\nuse std::io;\n\nconst IN: Token = Token(0);\n\nfn main() {\n // Set up a new socket on port... | rust | new_file | 0 | 5 | mit | 8f5861e83383bc9a50595d13f80fb1f180717f3f | carllerche/mio,carllerche/mio | examples/udp_server.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Create a stdout logging example"
},
{
"role": "assistant",
"content": "/// An example of sending data to a Prometheus server with a local webserver\nextern crate iron;\nextern crate metrics;\nextern crate histogram;\n\nuse iron::pr... | rust | new_file | 0 | 2 | apache-2.0 | 53af650bb03fd48b4c8f12f136807c95ea4025c5 | cstorey/rust-metrics,chridou/rust-metrics,waywardmonkeys/rust-metrics,chridou/rust-metrics,waywardmonkeys/rust-metrics,cstorey/rust-metrics | examples/web_server_with_stdout_logging.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add a run-pass test for linked failure"
},
{
"role": "assistant",
"content": "// -*- rust -*-\n\n// error-pattern:1 == 2\nuse std;\nimport std::task;\nimport std::comm::port;\nimport std::comm::recv;\n\nfn child() { assert (1 == 2)... | rust | new_file | null | null | apache-2.0 | 69eda46af880847f8edc194da9c69974e1e746ef | AerialX/rust,aturon/rust,TheNeikos/rust,carols10cents/rust,avdi/rust,erickt/rust,nwin/rust,sarojaba/rust-doc-korean,reem/rust,aneeshusa/rust,mihneadb/rust,jroesch/rust,omasanori/rust,sarojaba/rust-doc-korean,l0kod/rust,ruud-v-a/rust,TheNeikos/rust,untitaker/rust,ruud-v-a/rust,gifnksm/rust,aturon/rust,seanrivera/rust,pc... | src/test/run-pass/linked-failure.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Write rust code for the following: Add tests for helpful error messages"
},
{
"role": "assistant",
"content": "use std::process;\n\nfn assert_output_contains(output: &process::Output, needle: &str) {\n let stdout = String::from_utf8_lossy(&output.stdout);\n le... | rust | new_file | 2 | 3 | mit | 9e6e059e40a8cefb7671a1c4ef1ed862b38334cb | MrJohz/cargo-edit | tests/error-messages.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add implementation of Leonid Volnitsky's fast substring search\n\nDerived from C++ example on http://volnitsky.com/project/str_search/.\nCurrently does not handle the last few bytes of a string, but is\nblazingly fast."
},
{
"role": "a... | rust | new_file | 0 | 7 | mit | 0ab98caf6f8b4fa06b25307c3ea08b9586f98a2a | hobinjk/cottages | volnitsky.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Test missing field in remote struct"
},
{
"role": "assistant",
"content": "#[macro_use]\nextern crate serde_derive;\n\nmod remote {\n pub struct S {\n pub a: u8,\n pub b: u8,\n }\n}\n\n#[derive(Serialize, Deseri... | rust | new_file | 0 | 1 | apache-2.0 | 174867295b8f7e9af18556bd7dd16b3d1fa9ba1e | serde-rs/serde | test_suite/tests/compile-fail/remote/missing_field.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: test: Test yielding in crust functions"
},
{
"role": "assistant",
"content": "native mod rustrt {\n fn rust_dbg_call(cb: *u8,\n data: ctypes::uintptr_t) -> ctypes::uintptr_t;\n}\n\ncrust fn cb(data: ctypes::u... | rust | new_file | null | null | apache-2.0 | 3f4872f03284f4737675a68438350dd2958db229 | robertg/rust,rohitjoshi/rust,fabricedesre/rust,dwillmer/rust,untitaker/rust,ebfull/rand,servo/rust,mdinger/rust,jashank/rust,GBGamer/rust,l0kod/rust,sarojaba/rust-doc-korean,miniupnp/rust,GBGamer/rust,mvdnes/rust,P1start/rust,AerialX/rust-rt-minimal,sae-bom/rust,reem/rust,stepancheg/rust-ide-rust,aidancully/rust,richo/... | src/test/run-pass/crust-yield.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Copyright 2012 The Rust Project Developers. See the COPYRIGHT\n// file at the top-level directory of this distribution and at\n// http://rust-lang.org/COPYRIGHT.\n//\n// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or\n//... | rust | edit | 0 | 1 | apache-2.0 | 0ddc17d5bb6757dc49136c0de3168d9cdb00f6e3 | aidancully/rust,graydon/rust,aidancully/rust,GBGamer/rust,GBGamer/rust,graydon/rust,graydon/rust,GBGamer/rust,GBGamer/rust,GBGamer/rust,graydon/rust,GBGamer/rust,graydon/rust,GBGamer/rust,aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,GBGamer/rust | src/test/compile-fail/issue-30580.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Test error for `...` in expressions"
},
{
"role": "assistant",
"content": "// Copyright 2017 The Rust Project Developers. See the COPYRIGHT\n// file at the top-level directory of this distribution and at\n// http://rust-lang.org/CO... | rust | new_file | 4 | 2 | apache-2.0 | b81a7b333abce1d5de85406947db5007d19730c4 | aidancully/rust,GBGamer/rust,graydon/rust,GBGamer/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,GBGamer/rust,aidancully/rust,graydon/rust,aidancully/rust,GBGamer/rust,aidancully/rust,GBGamer/rust,aidancully/rust,GBGamer/rust,GBGamer/rust,GBGamer/rust | src/test/parse-fail/range_inclusive_dotdotdot.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add new code generator integration tests"
},
{
"role": "assistant",
"content": "#[path=\"../src/grammar.rs\"]\nmod grammar;\n#[path=\"../src/parser.rs\"]\nmod parser;\n#[path=\"../src/codegen.rs\"]\nmod codegen;\n#[path=\"../src/le... | rust | new_file | 0 | 1 | mit | 49df1e4f334c2916a2fa29c482b651cc2447e816 | maciejhirsz/HoneyBadger | tests/codegen_test.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add rust code for collatz-conjecture case\n\nIt passed all test cases"
},
{
"role": "assistant",
"content": "// return Ok(x) where x is the number of steps required to reach 1\npub fn collatz(n: u64) -> Result<u64, &'static str> {\... | rust | new_file | 0 | 4 | bsd-2-clause | 6cac3cfa8f623812261d7021bc38decda98b0b6d | gyn/exercism,gyn/exercism,gyn/exercism,gyn/exercism | rust/collatz-conjecture/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add test case that checks that class members must be prefixed with \"self\"\n\nCloses #2289."
},
{
"role": "assistant",
"content": "class cat {\n priv {\n let mut meows : uint;\n fn sleep() { loop{} }\n fn meow() {\n ... | rust | new_file | null | null | apache-2.0 | 95a2b5d42f1acb96b035f21f192b0fab6cb2af6a | l0kod/rust,mitsuhiko/rust,j16r/rust,TheNeikos/rust,untitaker/rust,dinfuehr/rust,emk/rust,jroesch/rust,victorvde/rust,sarojaba/rust-doc-korean,jashank/rust,ruud-v-a/rust,omasanori/rust,erickt/rust,KokaKiwi/rust,quornian/rust,pshc/rust,nwin/rust,GBGamer/rust,mahkoh/rust,barosl/rust,zachwick/rust,jashank/rust,stepancheg/r... | src/test/compile-fail/class-missing-self.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Write rust code for the following: examples: Add an example of using the async client"
},
{
"role": "assistant",
"content": "extern crate solicit;\n\nuse solicit::http::Header;\nuse solicit::client::Client;\nuse solicit::http::client::CleartextConnector;\nuse std::t... | rust | new_file | 0 | 3 | mit | 107ec188f00d3f943f2ffb55b4cfb243369b12f6 | stepancheg/solicit,mlalic/solicit | examples/client_async.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add example that calculates the hash of provided files"
},
{
"role": "assistant",
"content": "extern crate hash;\n\nuse std::env;\nuse std::hash::Hasher;\nuse std::fs::File;\nuse std::io::{BufRead,BufReader};\nuse hash::XxHash;\n\n... | rust | new_file | 0 | 3 | mit | eebd5b5ab5b4abaebb69fc06f8f41650ca5c82cc | arthurprs/twox-hash,shepmaster/twox-hash,arthurprs/twox-hash | src/bin/hash_file.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add a cross-crate test for casting classes to ifaces"
},
{
"role": "assistant",
"content": "import to_str::*;\nimport to_str::to_str;\n\nclass cat implements to_str {\n priv {\n let mut meows : uint;\n fn meow() {\n #er... | rust | new_file | null | null | apache-2.0 | 2d793ef49845172ed3db10070820d75070e7ef17 | defuz/rust,LeoTestard/rust,stepancheg/rust-ide-rust,AerialX/rust,defuz/rust,erickt/rust,vhbit/rust,ejjeong/rust,aturon/rust,mvdnes/rust,philyoon/rust,aturon/rust,erickt/rust,aidancully/rust,TheNeikos/rust,zachwick/rust,krzysz00/rust,jroesch/rust,mahkoh/rust,mitsuhiko/rust,bluss/rand,vhbit/rust,kwantam/rust,pelmers/rust... | src/test/run-pass/class-cast-to-iface-cross-crate.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Write rust code for the following: Add test to check if inlining works for any operand"
},
{
"role": "assistant",
"content": "// Copyright 2017 The Rust Project Developers. See the COPYRIGHT\n// file at the top-level directory of this distribution and at\n// http://... | rust | new_file | 0 | 1 | apache-2.0 | 1e3c86e1c40e703f632087751d073b58bd96a6df | graydon/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust,GBGamer/rust,GBGamer/rust,GBGamer/rust,aidancully/rust,GBGamer/rust,GBGamer/rust,aidancully/rust,GBGamer/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,GBGamer/rust,aidancully/rust,GBGamer/rust | src/test/mir-opt/inline-any-operand.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add an example that lists genl families\n\nRunning this example on my Ubuntu 18.04 virtual machine outputs:\n\n$ cargo run --example ctrl-list\nnlctrl\n\tID: 0x10\nVFS_DQUOT\n\tID: 0x11\nNLBL_MGMT\n\tID: 0x13\nNLBL_CIPSOv4\n\tID: 0x14\nNLBL_CA... | rust | new_file | 0 | 12 | bsd-3-clause | 9d2108c5f832283f10e285987d70c10f0caec484 | jbaublitz/nl,jbaublitz/nl | examples/ctrl-list.rs | rejected_complexity | Cyclomatic complexity too high: 12 | true |
[
{
"role": "user",
"content": "Write rust code for the following: Create functions for getting config filenames"
},
{
"role": "assistant",
"content": "//! System functions for `budget`\n\n/// Acquire the home directory's path\nfn get_homedir_string() -> Option<String> {\n use std::env;\n //... | rust | new_file | 0 | 2 | apache-2.0 | 8f3f36613e33677914d17ce83b4207b67a169db1 | SilverWingedSeraph/budget | budget/src/system.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add a test that generic bare functions can be bound\n\nIssue #1022"
},
{
"role": "assistant",
"content": "fn# f<T>(i: T, j: T, k: T) {\n assert i == j;\n assert j != k;\n}\n\nfn main() {\n // Binding a bare function turns ... | rust | new_file | null | null | apache-2.0 | 60cfa91897b90d37ef85068f93c01b2b99c30e10 | zaeleus/rust,pelmers/rust,krzysz00/rust,dwillmer/rust,Ryman/rust,pythonesque/rust,jbclements/rust,aidancully/rust,AerialX/rust-rt-minimal,omasanori/rust,untitaker/rust,GBGamer/rust,LeoTestard/rust,vhbit/rust,pelmers/rust,pczarn/rust,zaeleus/rust,michaelballantyne/rust-gpu,reem/rust,Ryman/rust,pczarn/rust,avdi/rust,atur... | src/test/run-pass/fn-bare-bind-generic.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse Renderable;\nuse std::collections::HashMap;\n\npub struct Template<'a>{\n elements: Vec<Box<Renderable +'a>>\n}\n\nimpl<'a> Renderable for Template<'a> {\n fn render (&self, context: &HashMap<String, String>) -> String{\n sel... | rust | edit | 2 | 1 | mit | f7c1c348d21c694f47bd5e95855fca2c9b9926c9 | kaj/liquid-rust,tcsc/liquid-rust,Albibek/liquid-rust,cobalt-org/liquid-rust | src/template.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Make sure that generics are internalized in executables even with -Zshare-generics"
},
{
"role": "assistant",
"content": "// Copyright 2018 The Rust Project Developers. See the COPYRIGHT\n// file at the top-level directory of this ... | rust | new_file | 0 | 1 | apache-2.0 | 94d36cf2948a999210516ff9001f93277f331d04 | aidancully/rust,graydon/rust,graydon/rust,GBGamer/rust,GBGamer/rust,GBGamer/rust,graydon/rust,aidancully/rust,graydon/rust,GBGamer/rust,aidancully/rust,GBGamer/rust,aidancully/rust,aidancully/rust,GBGamer/rust,aidancully/rust,GBGamer/rust,graydon/rust,graydon/rust,GBGamer/rust | src/test/codegen/local-generics-in-exe-internalized.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: cubeb-rs: Add example usage of cubeb."
},
{
"role": "assistant",
"content": "// Copyright © 2011 Mozilla Foundation\n//\n// This program is made available under an ISC-style license. See the\n// accompanying file LICENSE for detai... | rust | new_file | 0 | 2 | isc | 8ffe0ffe03fbdb01e4d6e56e1be628c4134e16e1 | djg/cubeb-rs | examples/tone.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add some prototypical objet relational mapping"
},
{
"role": "assistant",
"content": "macro_rules! rdf{\n (\n $(\n class $name:ident = $id:expr {\n $(\n $prop_name:ident : $pro... | rust | new_file | 0 | 1 | mit | 593854f4211a2580cb782d56d2ea907641916364 | enex/rdf-types | src/orm.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add a version of the arithmetic example that returns an AST as an enum\n\nCloses #114"
},
{
"role": "assistant",
"content": "#![feature(plugin)]\n#![plugin(peg_syntax_ext)]\nuse arithmetic::expression;\n\n#[derive(Clone, PartialEq,... | rust | new_file | null | null | mit | 905b65aab1fdaa6b481b33d556920aeee76d959d | kevinmehall/rust-peg,tempbottle/rust-peg,tempbottle/rust-peg,kevinmehall/rust-peg | tests/test_arithmetic_ast.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Write rust code for the following: Add test for assert!() hygiene in edition 2021."
},
{
"role": "assistant",
"content": "// check-pass\n// edition:2021\n\n#![no_implicit_prelude]\n\nfn main() {\n assert!(true, \"hoi\");\n assert!(false, \"hoi {}\", 123);\n}\n... | rust | new_file | 3 | 1 | apache-2.0 | 8098ac17064ee5a1d34ffe6bc8d35a9574f2bf6e | graydon/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust | src/test/ui/hygiene/no_implicit_prelude-2021.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Implement \"Strip comments from a string\"."
},
{
"role": "assistant",
"content": "// http://rosettacode.org/wiki/Strip_comments_from_a_string\n\nfn strip_comments(str: &str) -> &str {\n let markers = ['#', ';'];\n str.find(m... | rust | new_file | 1 | 2 | unlicense | 6c7bc55d2dfc3ca68012b9f72a990fa8be398a3d | pfalabella/rust-rosetta,ghotiphud/rust-rosetta,magum/rust-rosetta,JIghtuse/rust-rosetta,sakeven/rust-rosetta,ZoomRmc/rust-rosetta,Hoverbear/rust-rosetta,crespyl/rust-rosetta,magum/rust-rosetta,crr0004/rust-rosetta | src/strip_comments_from_a_string.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add solution to problem 56\n\nSlow (7 seconds)\ncould be faster with GMP bindings"
},
{
"role": "assistant",
"content": "#[macro_use] extern crate libeuler;\nextern crate num;\n\nuse num::bigint::{BigInt, ToBigInt};\nuse num::trait... | rust | new_file | 0 | 5 | mit | 83864b79dc9875fb592a2b045b76531bc0859a40 | zmbush/euler,zmbush/euler | sol_0056/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add rust code for sieve case\n\nIt passed all testcases"
},
{
"role": "assistant",
"content": "pub fn primes_up_to(limit: u32) -> Vec<u32> {\n if limit < 2 {\n return Vec::new();\n }\n\n let upper = (limit as f64).s... | rust | new_file | 0 | 5 | bsd-2-clause | 3b7ccb01ed3b89d613a3696c2469534dd72b68c7 | gyn/exercism,gyn/exercism,gyn/exercism,gyn/exercism | rust/sieve/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add Serialize trait for USB module to make serializing simpler"
},
{
"role": "assistant",
"content": "use core::mem::{transmute, size_of};\nuse core::intrinsics::copy_nonoverlapping;\n\npub unsafe trait Serialize: Sized {\n fn s... | rust | new_file | 1 | 2 | apache-2.0 | c97969d1e627c30d921a0448ad4fb232d9fc3e2a | google/tock-on-titan,google/tock-on-titan,google/tock-on-titan | src/chips/hotel/src/usb/serialize.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add example based on into_header_for_infinite_file"
},
{
"role": "assistant",
"content": "// Generate endless screeching noise to stdout\n\n// Usage: cargo run --example wavstdout | mpv -\n\nextern crate hound;\nuse std::io::Write;... | rust | new_file | 0 | 3 | apache-2.0 | cea4bb9e71de52648ab84a28f433fe998f13f4e9 | ruuda/hound,ruud-v-a/hound | examples/wavstdout.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add a test for nullary univariant enums."
},
{
"role": "assistant",
"content": "// Copyright 2013 The Rust Project Developers. See the COPYRIGHT\n// file at the top-level directory of this distribution and at\n// http://rust-lang.o... | rust | new_file | 0 | 1 | apache-2.0 | 3e7ab3a443a3c49d457226e7842a7256fe07933b | quornian/rust,sarojaba/rust-doc-korean,pczarn/rust,pczarn/rust,mvdnes/rust,fabricedesre/rust,stepancheg/rust-ide-rust,aidancully/rust,Ryman/rust,pshc/rust,AerialX/rust-rt-minimal,jashank/rust,zachwick/rust,defuz/rust,rohitjoshi/rust,XMPPwocky/rust,pshc/rust,XMPPwocky/rust,kmcallister/rust,victorvde/rust,mitsuhiko/rust,... | src/test/run-pass/const-nullary-univariant-enum.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add test for MIR printing changes"
},
{
"role": "assistant",
"content": "// Test that we don't ICE when trying to dump MIR for unusual item types and\n// that we don't create filenames containing `<` and `>`\n\nstruct A;\n\nimpl A ... | rust | new_file | 5 | 1 | apache-2.0 | d7afd3ebfb490c3c3905812a93cbc08b6d45d26b | aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust | src/test/mir-opt/unusual-item-types.rs | rejected_lint | Too many lint violations: 5 | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add a Test for actual split files"
},
{
"role": "assistant",
"content": "extern crate livesplit_core;\n\nuse livesplit_core::{Time, TimeSpan};\nuse livesplit_core::comparison::balanced_pb::{BalancedPB, NAME};\nuse std::fs::File;\nu... | rust | new_file | 0 | 1 | apache-2.0 | 2612f2240364f28ec6ff1c4a8c3fa90e627b57e7 | CryZe/livesplit-core,CryZe/livesplit-core | tests/balanced_pb.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add an example of a minimalistic server"
},
{
"role": "assistant",
"content": "#[macro_use]\nextern crate rustful;\nuse std::error::Error;\nuse rustful::{Server, Context, Response};\n\nfn main() {\n println!(\"Visit http://local... | rust | new_file | 0 | 2 | mit | aef114fb29c6f94a4b451a00757798d260290216 | evnix/Rframe,evnix/Rframe | examples/tiny_hello.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: let_chains: Add test protecting the precedence of && in relation to other things."
},
{
"role": "assistant",
"content": "// run-pass\n\n#![allow(irrefutable_let_patterns)]\n\nuse std::ops::Range;\n\nfn main() {\n let x: bool;\n ... | rust | new_file | 4 | 3 | apache-2.0 | d45dadd9518f8ab20fb511661d3400192c56dd5c | aidancully/rust,graydon/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust | src/test/ui/rfc-2497-if-let-chains/protect-precedences.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add a test to make sure trans doesn't choke on any of the intrinsics"
},
{
"role": "assistant",
"content": "// Copyright 2016 The Rust Project Developers. See the COPYRIGHT\n// file at the top-level directory of this distribution a... | rust | new_file | 3 | 1 | apache-2.0 | 4fdbc2f1cb56cf47f535dbe2f250ca387f0278b6 | GBGamer/rust,GBGamer/rust,graydon/rust,graydon/rust,graydon/rust,graydon/rust,GBGamer/rust,GBGamer/rust,GBGamer/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,GBGamer/rust,GBGamer/rust,aidancully/rust,aidancully/rust,GBGamer/rust,aidancully/rust,aidancully/rust | src/test/run-pass/atomic-compare_exchange.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add codegen test for multiple `asm!` options"
},
{
"role": "assistant",
"content": "// compile-flags: -O\n// only-x86_64\n\n#![crate_type = \"rlib\"]\n#![feature(asm)]\n\n// CHECK-LABEL: @pure\n// CHECK-NOT: asm\n// CHECK: ret void... | rust | new_file | 1 | 1 | apache-2.0 | 820bba1c467aa5aa54d6db2869b15c643e5c350c | aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust | src/test/codegen/asm-multiple-options.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add ICE regression test with unboxed closures\n\nThis code used to produce the following ICE:\n\n error: internal compiler error: get_unique_type_id_of_type() -\n unexpected type: closure,\n ty_unboxed_closure(syntax::ast::DefId{krate: 0... | rust | new_file | null | null | apache-2.0 | a1d9010f5133e7f505b80634670e51d8dd763060 | graydon/rust,sae-bom/rust,hauleth/rust,seanrivera/rust,aidancully/rust,ruud-v-a/rust,miniupnp/rust,zaeleus/rust,aneeshusa/rust,zachwick/rust,omasanori/rust,ejjeong/rust,pshc/rust,gifnksm/rust,emk/rust,rohitjoshi/rust,mvdnes/rust,ruud-v-a/rust,gifnksm/rust,ejjeong/rust,richo/rust,victorvde/rust,0x73/rust,P1start/rust,om... | src/test/run-pass/unboxed-closures-unique-type-id.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Copyright 2015 The Rust Project Developers. See the COPYRIGHT\n// file at the top-level directory of this distribution and at\n// http://rust-lang.org/COPYRIGHT.\n//\n// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or\n//... | rust | edit | null | null | apache-2.0 | 5f1c6a0076d97c4893b852a71a073ae7a6fa3c6b | graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,GBGamer/rust,aidancully/rust,aidancully/rust,aidancully/rust,GBGamer/rust,GBGamer/rust,GBGamer/rust,GBGamer/rust,aidancully/rust,GBGamer/rust,graydon/rust,graydon/rust,GBGamer/rust,GBGamer/rust,graydon/rust,graydon/rust | src/test/compile-fail/issue-23024.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Write rust code for the following: Add additional test case for superregion"
},
{
"role": "assistant",
"content": "// Copyright 2015 The Rust Project Developers. See the COPYRIGHT\n// file at the top-level directory of this distribution and at\n// http://rust-lang.o... | rust | new_file | null | null | apache-2.0 | 3dcc631dee7b2f4be3443b4bbc1dd916436d60ca | nwin/rust,zubron/rust,ejjeong/rust,zubron/rust,nwin/rust,dwillmer/rust,ruud-v-a/rust,ejjeong/rust,pelmers/rust,avdi/rust,AerialX/rust-rt-minimal,gifnksm/rust,aneeshusa/rust,philyoon/rust,l0kod/rust,seanrivera/rust,TheNeikos/rust,jashank/rust,jroesch/rust,pshc/rust,ruud-v-a/rust,KokaKiwi/rust,mvdnes/rust,philyoon/rust,X... | src/test/compile-fail/typeck-default-trait-impl-superregion.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Write rust code for the following: Make sure we notice when a u16 is loaded at offset 1 into a u8 allocation"
},
{
"role": "assistant",
"content": "// This should fail even without validation or Stacked Borrows.\n// compile-flags: -Zmiri-disable-validation -Zmiri-di... | rust | new_file | 0 | 2 | apache-2.0 | 798dc5a78ac9b0016c9b5c193bf8c7dea73ef908 | rust-lang/miri,rust-lang/miri,rust-lang/miri,rust-lang/miri | tests/compile-fail/unaligned_pointers/unaligned_ptr4.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add nested TAIT inference test"
},
{
"role": "assistant",
"content": "// check-pass\n\n#![feature(type_alias_impl_trait)]\n#![allow(dead_code)]\n\nuse std::fmt::Debug;\n\ntype FooX = impl Debug;\n\ntrait Foo<A> { }\n\nimpl Foo<()> ... | rust | new_file | 1 | 1 | apache-2.0 | 5c7400c12d462af2fe7507c24d88c837d35df9dd | aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust | src/test/ui/type-alias-impl-trait/nested-tait-inference.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::fs::File;\nuse std::io::{Read, Write};\n\nuse system::scheme::{Packet, Scheme};\n\nextern crate system;\n\nstruct ExampleScheme;\n\nimpl Scheme for ExampleScheme {\n\n}\n\nfn main() {\n //In order to handle example:, we create :exa... | rust | edit | 0 | 2 | mit | 2db84f95994e329cd591b78db88d1ca2d51177f8 | nxnfufunezn/redox,tedsta/redox,imp/redox,nxnfufunezn/redox,nounoursheureux/redox,achanda/redox,vvlevchenko/redox,imp/redox,tedsta/redox,vvlevchenko/redox,tedsta/redox,nxnfufunezn/redox,achanda/redox,nounoursheureux/redox,vvlevchenko/redox,imp/redox,nounoursheureux/redox,achanda/redox,tedsta/redox | filesystem/apps/example/main.rs | rejected_duplicate | Near-duplicate of sample 120492 | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add test for Inherent static methods can be called with a non-well-formed Self-type."
},
{
"role": "assistant",
"content": "// Copyright 2017 The Rust Project Developers. See the COPYRIGHT\n// file at the top-level directory of thi... | rust | new_file | 1 | 1 | apache-2.0 | df5ab64d6cb881e59244182aedd9f652c3673630 | GBGamer/rust,GBGamer/rust,aidancully/rust,GBGamer/rust,graydon/rust,aidancully/rust,GBGamer/rust,GBGamer/rust,GBGamer/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,GBGamer/rust,graydon/rust,graydon/rust,GBGamer/rust | src/test/compile-fail/issue-28848.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Implement Counter struct and Iterator for it"
},
{
"role": "assistant",
"content": "struct Counter {\n count: u32\n}\n\nimpl Counter {\n fn new() -> Counter {\n Counter { count: 0 }\n }\n}\n\nimpl Iterator for Count... | rust | new_file | 0 | 2 | mit | 83d742b71a2f56c22ec4c4d8dc09fdda47d92230 | pgrzesik/learning-rust | 24_iterators/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add the socket settings example from the README to examples"
},
{
"role": "assistant",
"content": "extern crate knob;\n\nuse std::io::net::ip::IpAddr;\nuse knob::Settings;\n\nfn main() {\n let mut settings = Settings::new();\n ... | rust | new_file | 0 | 1 | mit | e09d1280728862e155ef675ebfb567791008c6b0 | skade/knob | examples/socket_settings.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add Rust implementation of Armstrong Number algorithm"
},
{
"role": "assistant",
"content": "fn is_armstrong_number(num: u32) -> bool {\n // Get vector of the digits in the number\n // Makes it possible to use `fold` to do the ca... | rust | new_file | 0 | 2 | cc0-1.0 | 0ec6f08b9947a55339c0959a197492aefeb5a056 | ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovs... | math/armstrong_number/Rust/armstrong-number.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add test for missing default impl"
},
{
"role": "assistant",
"content": "// 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/COPY... | rust | new_file | 0 | 1 | apache-2.0 | 199e0cd804f039ccdd414e37fe68323061ba4aa7 | jashank/rust,pelmers/rust,graydon/rust,kwantam/rust,KokaKiwi/rust,carols10cents/rust,avdi/rust,rohitjoshi/rust,victorvde/rust,robertg/rust,zaeleus/rust,untitaker/rust,nwin/rust,mahkoh/rust,GBGamer/rust,l0kod/rust,sae-bom/rust,aidancully/rust,vhbit/rust,l0kod/rust,TheNeikos/rust,TheNeikos/rust,nwin/rust,reem/rust,victor... | src/test/compile-fail/coherence-trait-polarity-mising-default-implementation.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add basic file system tests"
},
{
"role": "assistant",
"content": "#[macro_use]\nextern crate lazy_static;\n\nextern crate rex;\n\nmod util;\n\nuse std::path::Path;\n\nuse rex::frontend::{Event, KeyPress};\n\nuse util::mock_filesys... | rust | new_file | 1 | 4 | apache-2.0 | 0aed7b170373b537f79ed1c1d2c2ab948ba8fc29 | dbrodie/rex | tests/fs.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add a test that causes an ICE currently"
},
{
"role": "assistant",
"content": "// 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.or... | rust | new_file | 0 | 1 | apache-2.0 | c786b68dd3ecf96e202f50ba600292f54b35f2ee | mihneadb/rust,rohitjoshi/rust,avdi/rust,robertg/rust,l0kod/rust,emk/rust,cllns/rust,nwin/rust,richo/rust,TheNeikos/rust,XMPPwocky/rust,mitsuhiko/rust,fabricedesre/rust,robertg/rust,defuz/rust,P1start/rust,kmcallister/rust,reem/rust,pelmers/rust,mitsuhiko/rust,rprichard/rust,quornian/rust,shepmaster/rand,pshc/rust,jroes... | src/test/compile-fail/unconstrained-ref.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Make sure that casting a ptr-integer down to u8 makes it unusable"
},
{
"role": "assistant",
"content": "fn main() {\n let x = &1;\n // Casting down to u8 and back up to a pointer loses too much precision; this must not work.... | rust | new_file | 0 | 1 | apache-2.0 | 7b7f690274683777e810bfb61aae2af2e36aaab8 | GBGamer/rust,GBGamer/rust,GBGamer/rust,aidancully/rust,aidancully/rust,rust-lang/miri,graydon/rust,GBGamer/rust,aidancully/rust,rust-lang/miri,GBGamer/rust,GBGamer/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,GBGamer/rust,aidancully/rust,graydon/rust,GBGamer/rust,graydon/rust,tsion/miri,rust-lang/miri... | tests/compile-fail/ptr_int_cast.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add example how to make the main window transparent"
},
{
"role": "assistant",
"content": "//! # Transparent main window example\n//!\n//! This example demonstrates how to create a main window with a transparent background.\n\nexte... | rust | new_file | 0 | 3 | mit | 446e26de63d3f877d844ec4d8e7d4ade6b429964 | rust-gnome/examples,rust-gnome/examples | src/bin/transparent_main_window.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Test if IoError is properly returned as cause()"
},
{
"role": "assistant",
"content": "extern crate yaml;\n\nuse std::error::Error;\nuse std::io::{IoError, IoResult};\nuse std::io::IoErrorKind;\n\nstruct MockReader {\n _data: ()... | rust | new_file | 0 | 2 | mit | e6fc1e4518cd1af2d3e828f70bff7e2d791927c5 | kimhyunkang/libyaml-rust,kimhyunkang/libyaml-rust | tests/io_error_test.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse rand::seq::SliceRandom;\n\nextern crate phf;\n\n// build.rs produces a codegen.rs file defining WORDLIST:\n// static WORDLIST: phf::Map<&str,&str>\ninclude!(concat!(env!(\"OUT_DIR\"), \"/codegen.rs\"));\n\npub fn get_word(roll: &str) -> O... | rust | edit | 0 | 2 | mit | 25694dd866e2d6b84e4bbe4b36d90bef72a2a08a | jacobmorzinski/diceware,jacobmorzinski/diceware,jacobmorzinski/diceware | diceware-rust/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Copyright 2014 The Rust Project Developers. See the COPYRIGHT\n// file at the top-level directory of this distribution and at\n// http://rust-lang.org/COPYRIGHT.\n//\n// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or\n//... | rust | edit | 0 | 0 | apache-2.0 | 4ec64453ae8a84099c83663344ccd2d3b2ce7f94 | jashank/rust,l0kod/rust,pshc/rust,jashank/rust,GBGamer/rust,vhbit/rust,GBGamer/rust,jroesch/rust,jashank/rust,pshc/rust,graydon/rust,pshc/rust,dwillmer/rust,pshc/rust,GBGamer/rust,l0kod/rust,vhbit/rust,dwillmer/rust,GBGamer/rust,zubron/rust,graydon/rust,l0kod/rust,jashank/rust,GBGamer/rust,GBGamer/rust,nwin/rust,aidanc... | src/libstd/sys/windows/ext/raw.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse gobject::GObject;\nuse libc::c_char;\nuse glib::GError;\n\n#[repr(C)]\nstruct NotifyNotificationPrivate;\n\n#[repr(C)]\npub struct NotifyNotification {\n _parent_object: GObject,\n _priv_: NotifyNotificationPrivate\n}\n\nextern \"C\... | rust | edit | 0 | 0 | mit | b304960c7cd56267c043b5e7a3fe01974f9b84a3 | crumblingstatue/rust-libnotify-sys | src/notification.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\npub mod client;\n\npub mod network;\n\n#[cfg(test)]\nmod tests {\n #[test]\n fn it_works() {\n }\n}\n\n```\n\nApply this change: Add example usage of super in tests"
},
{
"role": "assistant",
"content": "pub mod client;\n... | rust | edit | 1 | 1 | mit | c25a5573a084f1d0822cb3bf373191d560565db6 | pgrzesik/learning-rust | communicator/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate clap;\nextern crate rsstreem;\nextern crate rsstreem-parser as parser;\n\nuse clap::{Arg, App, SubCommand};\n\nuse std::error::Error;\nuse std::io::Read;\nuse std::fs::File;\nuse std::path::PathBuf;\n\nconst VERSION_MAJOR: u32 = ... | rust | edit | 0 | 2 | mit | 02bbc3e78507c7160574ef7b6d095d70b04fe1d4 | Everysick/rsstreem | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse crate::syntax::ident;\nuse std::fmt::{self, Display};\nuse syn::parse::{Parse, ParseStream, Result};\nuse syn::{Path, Token};\n\nmod kw {\n syn::custom_keyword!(namespace);\n}\n\npub struct Namespace {\n segments: Vec<String>,\n}\n\... | rust | edit | 0 | 8 | apache-2.0 | 3c19e53ad1ff1808dc9e3d41ca88c8d1eb5f38f9 | dtolnay/cxx,dtolnay/cxx,dtolnay/cxx,dtolnay/cxx | macro/src/namespace.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Test the simple case first\n\nIt should be better"
},
{
"role": "assistant",
"content": "pub fn is_leap_year(year: isize) -> bool {\n (year % 400 == 0) || (year % 4 == 0 && year % 100 != 0)\n}\n"
}
] | rust | new_file | 0 | 3 | bsd-2-clause | 4e6b2fce221b8d702d7d2caaf40aeaed9de2fe80 | gyn/exercism,gyn/exercism,gyn/exercism,gyn/exercism | rust/leap/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse super::Hash256;\n\n#[derive(Clone, Debug, PartialEq)]\npub struct CrosslinkRecord {\n pub slot: u64,\n pub shard_block_hash: Hash256,\n}\n\nimpl CrosslinkRecord {\n /// Generates a new instance where `dynasty` and `hash` are both... | rust | edit | 0 | 1 | apache-2.0 | c944c435e2853a1687b5a5331ac0e9a326fdf967 | sigp/lighthouse,sigp/lighthouse,sigp/lighthouse,sigp/lighthouse | beacon_chain/types/src/crosslink_record.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse hyper::header::{ContentLength, Headers};\nuse std::ops::Deref;\n\nuse Byte;\n\n/// Trait to extend functionalities of the Headers type, from `hyper`\npub trait GetContentLength {\n /// Function to get the content length of a remote doc... | rust | edit | 1 | 2 | mit | 124813eb95aec39844e1c7c723254a0da7962b14 | derniercri/snatch | src/contentlength.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Read from STDIN and PTTY input and print to PTTY output\n\nAll using async operations from async-std"
},
{
"role": "assistant",
"content": "#![recursion_limit=\"256\"]\n// use futures::{select, FutureExt};\nuse async_std::io;\nuse ... | rust | new_file | 0 | 11 | mit | 874d8c7d3581fc9ec064c48b7edf25db5276564a | jhbabon/scout | src/main.rs | rejected_complexity | Cyclomatic complexity too high: 11 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![feature(test)]\n\nextern crate test;\n\nextern crate base;\nextern crate parser;\nextern crate check;\nextern crate vm;\n\nuse std::fs::File;\nuse std::io::Read;\n\nuse base::symbol::SymbolModule;\nuse check::typecheck::Typecheck;\nuse vm:... | rust | edit | 0 | 3 | mit | e55710d8c26b8531126e0d69708345da090342dd | gluon-lang/gluon,Marwes/embed_lang,gluon-lang/gluon,Marwes/gluon,Marwes/embed_lang,Marwes/gluon | benches/vm.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::env;\n\nfn multiply (a: f32, b: f32) -> f32 {\n return a * b;\n}\n\nfn add (a: f32, b: f32) -> f32 {\n return a + b;\n}\n\nfn divide (a: f32, b: f32) -> f32 {\n return a / b;\n}\n\nfn subtract (a: f32, b: f32) -> f32 {\n ... | rust | edit | 0 | 4 | mit | c2c8e4325dec929af86222e30715f67fdcbf0478 | adamjc/rust_calc | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! Implementation of Ethernet related Extractors\n\nuse net::Packet;\n\nuse net::defs::{Rule, EtherType};\n\nuse net::conn::filter::Extractor;\n\nuse super::defs::Header;\n\n/// Type responsible for ether type extraction\npub struct EtherTyp... | rust | edit | 0 | 1 | mit | 82e1c5672a2e1ab101bbd672cce61b6ebe9841f8 | uni-rs/uni.rs | src/net/eth/extractor.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate ascii;\n\nmod pascal_str;\nmod pascal_string;\n\nconst PASCAL_STRING_BUF_SIZE: usize = 255;\n\npub use pascal_str::{Chars, CharsMut, PascalStr};\npub use pascal_string::{PascalString, PascalStringAppendError, PascalStringCreateEr... | rust | edit | 1 | 1 | mit | 0119058ec28c5b65ff2a863c1dbfd59a7d258e48 | burtonageo/pascal_string | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::env;\nuse std::fs;\nuse std::path::Path;\n\nfn main() {\n println!(\"cargo:rerun-if-changed=build/glslangValidator\");\n println!(\"cargo:rerun-if-changed=build/glslangValidator.exe\");\n\n let target = env::var(\"TARGET\").... | rust | edit | 4 | 5 | apache-2.0 | 4df9586e376a1ebc873158e27d28c434de7ae6fe | vulkano-rs/vulkano | glsl-to-spirv/build/build.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![feature(proc_macro)]\n\n#[macro_use]\nextern crate askama_derive;\nextern crate askama;\n\nuse askama::Template;\n\n#[derive(Template)]\n#[template(path = \"simple.html\")]\nstruct TestTemplate {\n strvar: String,\n num: i64,\n i1... | rust | edit | 0 | 1 | apache-2.0 | 9800a5ab6499a7d3488fc4db49d92b5f156b3940 | djc/askama,djc/askama,djc/askama | testing/tests/simple.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::io;\nuse std::io::Write; // need it to flush stdout\n\nstatic PROMPT: &'static str = \"$ \";\n\nfn execute(cmd: &String) {\n println!(\"you entered [{}]\", cmd);\n}\n\nfn main() {\n\n // we allocate a String for the user input\... | rust | edit | 2 | 4 | mit | 6ee768244b39680600e83deaa725afe20a666729 | mossberg/relish | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate ast;\n\nuse ast::Evaluate;\n\nfn main() {\n\tlet program: ast::Program = ast::Program::If(\n\t\tast::Condition::Less(\n\t\t\tBox::new(ast::Expression::Sensor(ast::Sensor::Vx)),\n\t\t\tBox::new(ast::Expression::Multiply(\n\t\t\t\t... | rust | edit | 0 | 2 | mit | eaca4fada0fbdff98381afbc610bb8f850f33e79 | darwins-challenge/moonlander-ast-rust,darwins-challenge/moonlander-ast-rust | src/main.rs | accepted | null | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.