conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Make word wrap support words longer than CHARS_PER_LINE.\n" }, { "from": "human", "value": "use std::io::{self, Write};\n\nconst CHARS_PER_LINE: usize = 78;\nconst SPACE: u8 = 32;\nconst LF: u8 = 10;\n\n// This is a *very* naive algorithm. It assumes the cursor is\n...
rust
chosen
[ { "from": "system", "value": "Make content check accept a model name\n" }, { "from": "human", "value": "#[macro_use]\nextern crate serde_elm;\n\nuse std::env;\nuse std::fs::File;\nuse std::io::{Read, Error};\nuse std::path::Path;\n\n#[allow(dead_code)]\n#[derive(Elm)]\nstruct Simple {\n name:...
rust
chosen
[ { "from": "system", "value": "Make the version string a variable, at least.\n" }, { "from": "human", "value": "\n#![feature(plugin)]\n#![plugin(clippy)]\n\n#[macro_use]\nextern crate kafka;\nextern crate log;\nextern crate openssl;\nextern crate toml;\n\nmod flowgger;\n\nconst DEFAULT_CONFIG_FIL...
rust
chosen
[ { "from": "system", "value": "Mark Repo.path be a PathBuf instead of a String\n\nThis is the beginning of an effort to bring in changes from the\n\"refactoring\" branch that I forgot about before publishing 0.2.0.\n" }, { "from": "human", "value": "//! Git repository representation for git-globa...
rust
chosen
[ { "from": "system", "value": "Remove unique vector matching from Problem 10\n" }, { "from": "human", "value": "enum Node<T> {\n One(T),\n Many(uint, T)\n}\n\nfn pack<T: Clone+Eq>(list: &[T]) -> ~[~[T]] {\n let mut it = list.iter();\n let mut result = ~[];\n let mut l = 1;\n loo...
rust
chosen
[ { "from": "system", "value": "Return the model after training\n" }, { "from": "human", "value": "use model::Model;\n\n\npub struct Classifier {\n models: Vec<(String, Model)>\n}\n\n\nimpl Classifier {\n pub fn new() -> Classifier {\n Classifier { models: Vec::new() }\n }\n\n p...
rust
chosen
[ { "from": "system", "value": "Use default perl if env variable is not set.\n\nThis makes it easier to run under perlbrew that can transparently switch\nbetween perl versions.\n" }, { "from": "human", "value": "extern crate gcc;\n\nuse std::path::Path;\nuse std::process::Command;\n\nstruct Perl {...
rust
chosen
[ { "from": "system", "value": "Add doc comment to pass tidy check\n" }, { "from": "human", "value": "use proc_macro_srv::cli;\n\nfn main() {\n cli::run().unwrap();\n}\n" }, { "from": "gpt", "value": "//! A standalone binary for `proc-macro-srv`.\n\nuse proc_macro_srv::cli;\n\nfn ma...
rust
chosen
[ { "from": "system", "value": "Use unreachable!() on debug build while unreachable::unreachable() on release build\n\n" }, { "from": "human", "value": "#[macro_use]\nextern crate log;\n\n#[cfg(unix)]\nextern crate libc;\n\nextern crate net2;\nextern crate futures;\n\n#[cfg(target_pointer_width = ...
rust
chosen
[ { "from": "system", "value": "Use batch_execute instead of execute\n\nIt'll should speed up the check since we'll end up with 1 round trip\ninstead of 3 and don't care about the result anyway.\n" }, { "from": "human", "value": "extern crate r2d2;\nextern crate postgres;\n\nuse postgres::{Postgre...
rust
chosen
[ { "from": "system", "value": "Remove unnecessary import and function definition\n" }, { "from": "human", "value": "// This file was generated automatically by crowbook-localize.\n// It is probably not a good idea to edit it manually.\n//\n// # Usage:\n//\n// ```rust, no_run\n// extern crate crow...
rust
chosen
[ { "from": "system", "value": "Add a second test case\n" }, { "from": "human", "value": "// test4.rs\n// This test covers the sections:\n// - Modules\n// - Macros\n\n// Write a macro that passes the test! No hints this time, you can do it!\n\n// I AM NOT DONE\n\n#[cfg(test)]\nmod tests {\n use...
rust
chosen
[ { "from": "system", "value": "Add a `<<` operator on `Write`ers like on C++ IOStream\n" }, { "from": "human", "value": "//\n// SOS: the Stupid Operating System\n// by Hawk Weisman (hi@hawkweisman.me)\n//\n// Copyright (c) 2015 Hawk Weisman\n// Released under the terms of the MIT license. See...
rust
chosen
[ { "from": "system", "value": "Make a comment on a test less sensational.\n" }, { "from": "human", "value": "// It's OK to destroy a heap when some GcRefs still exist. (!)\n//\n// Rust's safety rules ensure that the GcRefs won't still be accessible\n// afterwards, so if this happens, it means the...
rust
chosen
[ { "from": "system", "value": "Use ProcessAction in Windows handler for clippy\n" }, { "from": "human", "value": "use anyhow::{bail, Result};\nuse std::process::{Child, Command};\n\nuse crate::task_handler::ProcessAction;\nuse log::info;\n\npub fn compile_shell_command(command_string: &str) -> Co...
rust
chosen
[ { "from": "system", "value": "Fix tests of utility `wpublisher`, use compile mode directives\n" }, { "from": "human", "value": "\nuse super::*;\n\n//\n\ntests_impls!\n{\n fn basic_no_args()\n {\n let path = std::ffi::OsStr::new( \"../../../target/debug/wpublisher\" );\n let proc = std::p...
rust
chosen
[ { "from": "system", "value": "Use intradoc-links for the whole test, add a @has check\n\nCo-authored-by: Joshua Nelson <d6955d9721560531274cb8f50ff595a9bd39d66f@yottadb.com>" }, { "from": "human", "value": "// ignore-tidy-linelength\n\npub mod internal {\n pub struct r#mod;\n\n /// See [na...
rust
chosen
[ { "from": "system", "value": "Convert try! to ? operator.\n" }, { "from": "human", "value": "use std::env;\nuse std::fs::{copy, create_dir_all, read_dir};\nuse std::path::{Path, PathBuf};\nuse std::io;\n\nfn main() {\n let res_dir_source = Path::new(&env::var(\"CARGO_MANIFEST_DIR\").unwrap())...
rust
chosen
[ { "from": "system", "value": "Upgrade to rustc 1.0.0-dev (47551b574 2015-04-14) (built 2015-03-18)\n" }, { "from": "human", "value": "/* This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can o...
rust
chosen
[ { "from": "system", "value": "Add conversion to/from io::Error for kv::Error\n\nAnd keep the original error, so that an io error inside the visitor is\nreturned accessible by the call to `visit`.\n" }, { "from": "human", "value": "use std::fmt;\n\n/// An error encountered while working with stru...
rust
chosen
[ { "from": "system", "value": "Increase worker thread stack and name them\n" }, { "from": "human", "value": "//! A thin wrapper around `ThreadPool` to make sure that we join all things\n//! properly.\nuse crossbeam_channel::Sender;\n\npub(crate) struct TaskPool<T> {\n sender: Sender<T>,\n i...
rust
chosen
[ { "from": "system", "value": "Remove obsolete fixed-length string test\n" }, { "from": "human", "value": "fn wants_box(x: @str) { }\nfn wants_uniq(x: ~str) { }\nfn wants_three(x: str/3) { }\n\nfn has_box(x: @str) {\n wants_box(x);\n wants_uniq(x); //~ ERROR str storage differs: expected ~ bu...
rust
chosen
[ { "from": "system", "value": "Remove remaining uses of old fixed-length vec syntax\n" }, { "from": "human", "value": "// Issue #3656\n// Incorrect struct size computation in the FFI, because of not taking\n// the alignment of elements into account.\n\nuse libc::*;\n\nstruct KEYGEN {\n hash_al...
rust
chosen
[ { "from": "system", "value": "Use to_owned instead of to_string\n\nIt’s always faster\n" }, { "from": "human", "value": "use model::Model;\n\n\npub struct Classifier {\n models: Vec<(String, Model)>\n}\n\n\nimpl Classifier {\n pub fn new() -> Classifier {\n Classifier { models: Vec:...
rust
chosen
[ { "from": "system", "value": "Implement `Changeset` for `Vec<T>` and `Box<T>`\n\nA valid use case has arisen in #26 that is impossible to work around at\nthe moment. We're going to eventually add a standard API to handle this,\nso this implementation has no tests. It will get tested through that\nAPI, once ...
rust
chosen
[ { "from": "system", "value": "Add Sized trait to ElementType\n" }, { "from": "human", "value": "#![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 enu...
rust
chosen
[ { "from": "system", "value": "Add GitHub link within the documentation\n" }, { "from": "human", "value": "//! An implementation of [FLAC](https://xiph.org/flac), free lossless audio\n//! codec, written in Rust.\n//!\n//! # Examples\n//!\n//! Basic decoding from a file.\n//!\n//! ```\n//! use fla...
rust
chosen
[ { "from": "system", "value": "Add `ignore-tidy-linelength` and fix formatting\n" }, { "from": "human", "value": "// 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 u...
rust
chosen
[ { "from": "system", "value": "Optimize fuzzy::eq(), add mixed benchmark\n\nChecking for direct equality and ascii characters _significantly_\nimproves the performance of this method for anything that isn't UTF8.\n" }, { "from": "human", "value": "mod score;\npub mod consts;\n\npub use self::scor...
rust
chosen
[ { "from": "system", "value": "Fix broken test on musl\n" }, { "from": "human", "value": "// run-pass\n\n#![allow(dead_code)]\n// Static recursion check shouldn't fail when given a foreign item (#18279)\n\n// aux-build:check_static_recursion_foreign_helper.rs\n// ignore-wasm32-bare no libc to tes...
rust
chosen
[ { "from": "system", "value": "Rename result images in Perlin example\n\nCloses #158" }, { "from": "human", "value": "// Copyright 2015 The Noise-rs Developers.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the Li...
rust
chosen
[ { "from": "system", "value": "x86_64-unknown-none: Use position-independent code by default\n\nThis avoids requiring relocation code, which a bare-metal environment\nmay not have or want.\n" }, { "from": "human", "value": "// Generic AArch64 target for bare-metal code - Floating point enabled\n/...
rust
chosen
[ { "from": "system", "value": ":art: Make possible to write alfred items\n\n" }, { "from": "human", "value": "extern crate alfred;\n\nuse config::Config;\nuse jira_api::SearchIssue;\nuse jira_client;\nuse search_response::SearchResponse;\n\nstruct SearchCommand {\n pub config: Config,\n}\n\nim...
rust
chosen
[ { "from": "system", "value": "Use correct version of cargo in test\n" }, { "from": "human", "value": "use cargo_test_support::compare::assert_ui;\nuse cargo_test_support::curr_dir;\nuse cargo_test_support::CargoCommand;\nuse cargo_test_support::Project;\nuse cargo_test_support::TestEnv;\n\nuse c...
rust
chosen
[ { "from": "system", "value": "net/conn: Add type EthernetRule, NetworkRule and TransportRule\n" }, { "from": "human", "value": "//! Definition of various types related to connexions\n\n/// Type of the ether_type\npub type EtherType = u16;\n/// Type that represent a protocol id\npub type Protocol...
rust
chosen
[ { "from": "system", "value": "Disable const item mutation warning (triggers on pointers)\n" }, { "from": "human", "value": "#![feature(const_fn)]\n#![feature(extern_types)]\n#![feature(or_patterns)]\n\n#[cfg(test)]\n#[macro_use]\nextern crate quickcheck;\n\n#[macro_use]\nmod dbg;\n\n#[macro_use]...
rust
chosen
[ { "from": "system", "value": "Add p macro for tests\n" }, { "from": "human", "value": "extern crate native_tls;\n\npub use native_tls::*;\n" }, { "from": "gpt", "value": "extern crate native_tls;\n\npub use native_tls::*;\n\n\nmacro_rules! p {\n ($e:expr) => {\n match $e {\...
rust
chosen
[ { "from": "system", "value": "Fix sub-breakage due to the changed error message.\n" }, { "from": "human", "value": "class c { //~ ERROR a class must have at least one field\n new() { }\n}\n\nfn main() {\n let a = c();\n let x = ~[a];\n let _y = x[0];\n}\n" }, { "from": "gpt",...
rust
chosen
[ { "from": "system", "value": "Fix for 1.2.0-nightly (613e57b44 2015-06-01)\n" }, { "from": "human", "value": "// This whole file is strongly inspired by: https://github.com/jeaye/q3/blob/master/src/client/ui/ttf/glyph.rs\n// available under the BSD-3 licence.\n// It has been modified to work wit...
rust
chosen
[ { "from": "system", "value": "Update fuzzer script with upper size bound\n" }, { "from": "human", "value": "#![no_main]\n#[macro_use] extern crate libfuzzer_sys;\nextern crate image;\n\nfuzz_target!(|data: &[u8]| {\n let _ = image::load_from_memory_with_format(data, image::ImageFormat::Tga);\...
rust
chosen
[ { "from": "system", "value": "Update the compile-fail-fulldeps tests with new isize/usize literal suffixes.\n" }, { "from": "human", "value": "// 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...
rust
chosen
[ { "from": "system", "value": "Fix rustdoc const generics test\n" }, { "from": "human", "value": "// ignore-tidy-linelength\n\n#![feature(const_generics)]\n\n#![crate_name = \"foo\"]\n\npub enum Order {\n Sorted,\n Unsorted,\n}\n\n// @has foo/struct.VSet.html '//pre[@class=\"rust struct\"]'...
rust
chosen
[ { "from": "system", "value": "Make the setenv tests threadsafe(ish)\n" }, { "from": "human", "value": "import std::generic_os::setenv;\nimport std::generic_os::getenv;\nimport std::option;\n\n#[test]\nfn test_setenv() {\n setenv(\"NAME\", \"VALUE\");\n assert getenv(\"NAME\") == option::so...
rust
chosen
[ { "from": "system", "value": "Handle missing cfitsio on pkg-config path\n" }, { "from": "human", "value": "extern crate pkg_config;\n\nfn main() {\n println!(\"cargo:rerun-if-changed=build.rs\");\n pkg_config::probe_library(\"cfitsio\").unwrap();\n}\n" }, { "from": "gpt", "valu...
rust
chosen
[ { "from": "system", "value": "[generate-format] Remove the extra empty line at EOF\n\nThe extra empty line at EOF when generating YAML specification for\nmessage formats will cause the linter to panic. We fix it in this\ncommit.\n\nCloses: #8816\n" }, { "from": "human", "value": "// Copyright (c...
rust
chosen
[ { "from": "system", "value": "Fix example to hnadle result.\n" }, { "from": "human", "value": "extern crate lcm;\n\nmod exlcm {\n include!(concat!(env!(\"OUT_DIR\"), \"/exlcm/example_t.rs\"));\n}\n\nfn main() {\n let mut lcm = lcm::Lcm::new();\n\n let mut my_data = exlcm::ExampleT::new(...
rust
chosen
[ { "from": "system", "value": "fix(rustup): Update serde_codegen to reflect Registry move\n" }, { "from": "human", "value": "#![feature(plugin_registrar, rustc_private)]\n\nextern crate serde_codegen;\nextern crate rustc;\n\n#[plugin_registrar]\n#[doc(hidden)]\npub fn plugin_registrar(reg: &mut r...
rust
chosen
[ { "from": "system", "value": "Fix a warning in plugin compile tests\n" }, { "from": "human", "value": "/* This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at http://mozilla.org...
rust
chosen
[ { "from": "system", "value": "Use environment variable in the example\n\nThis will help in reproducing problems in nightly builds.\n" }, { "from": "human", "value": "extern crate randomorg;\n\nfn main() {\n use randomorg::Random;\n\n let r = Random::new(\"API KEY HERE\");\n println!(\"R...
rust
chosen
[ { "from": "system", "value": "Address LLVM assertion failure by prepopulating with *just* name-anon-globals.\n" }, { "from": "human", "value": "// 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.or...
rust
chosen
[ { "from": "system", "value": "Make a more meaningful test for Punct eq\n" }, { "from": "human", "value": "use proc_macro::{LineColumn, Punct};\n\npub fn test() {\n test_line_column_ord();\n test_punct_eq();\n}\n\nfn test_line_column_ord() {\n let line0_column0 = LineColumn { line: 0, co...
rust
chosen
[ { "from": "system", "value": "Remove 'use' line that's confusing pp-exact during use/import transition.\n" }, { "from": "human", "value": "#!/usr/bin/env rustx\n// pp-exact\n\nuse io::println;\n\nfn main() { io::println(~\"Hello World\"); }\n" }, { "from": "gpt", "value": "#!/usr/bin...
rust
chosen
[ { "from": "system", "value": "Add some work on RenderCommandEncoder\n" }, { "from": "human", "value": "use cocoa::base::id;\n\npub struct RenderCommandEncoder(id);\n\nimpl_from_into_raw!(RenderCommandEncoder, of protocol \"MTLRenderCommandEncoder\");\n" }, { "from": "gpt", "value": "...
rust
chosen
[ { "from": "system", "value": "Rename C-like enum to Field-less enum\n\nThere is no need to reference the C programming language to explain this concept." }, { "from": "human", "value": "// Copyright 2012 The Rust Project Developers. See the COPYRIGHT\n// file at the top-level directory of this d...
rust
chosen
[ { "from": "system", "value": "Add safety comment to StableAddress impl for Mmap\n" }, { "from": "human", "value": "use std::fs::File;\nuse std::io;\nuse std::ops::Deref;\n\nuse crate::owning_ref::StableAddress;\n\n/// A trivial wrapper for [`memmap2::Mmap`] that implements [`StableAddress`].\n#[...
rust
chosen
[ { "from": "system", "value": "events: Fix UI test failing with compat feature\n" }, { "from": "human", "value": "// rustc overflows when compiling this see:\n// https://github.com/rust-lang/rust/issues/55779\nextern crate serde;\n\nuse ruma_events::StateEventContent;\nuse ruma_events_macros::Eve...
rust
chosen
[ { "from": "system", "value": "Update the usage of random\n" }, { "from": "human", "value": "use probability::prelude::*;\nuse test::{Bencher, black_box};\n\n#[bench]\nfn cdf(bencher: &mut Bencher) {\n let mut source = random::default();\n let gaussian = Gaussian::new(0.0, 1.0);\n let x ...
rust
chosen
[ { "from": "system", "value": "Update autocargo component on FBS:master\n\nSummary:\nAutomated component version update\nBump Schedule: https://www.internalfb.com/intern/msdk/bump/?schedule_fbid=342556550408072\nPackage: https://www.internalfb.com/intern/msdk/package/125803836415945/\nOncall Team: rust_found...
rust
chosen
[ { "from": "system", "value": "federation-api: Fix link to old matrix-doc repo\n" }, { "from": "human", "value": "//! Endpoint to receive metadata about implemented matrix versions.\n\npub mod msc3723 {\n //! [GET /_matrix/federation/versions](https://github.com/matrix-org/matrix-doc/pull/3723...
rust
chosen
[ { "from": "system", "value": "Add generic types to prelude collision lint test.\n" }, { "from": "human", "value": "// edition:2018\n// check-pass\n#![allow(unused)]\n#![deny(rust_2021_prelude_collisions)]\n\nstruct S;\n\nimpl S {\n fn try_into(self) -> S {\n S\n }\n}\n\nstruct X;\n\...
rust
chosen
[ { "from": "system", "value": "Use recommended pkg-config method to discover libfuse\n" }, { "from": "human", "value": "extern crate pkg_config;\n\nfn main () {\n pkg_config::probe_library(\"fuse\").unwrap();\n}\n" }, { "from": "gpt", "value": "extern crate pkg_config;\n\n#[cfg(not...
rust
chosen
[ { "from": "system", "value": "docs: Fix copy paste error in example" }, { "from": "human", "value": "use clap::{app_from_crate, arg};\n\nfn main() {\n let matches = app_from_crate!()\n .arg(\n arg!(<PORT>)\n .help(\"Network port to use\")\n .val...
rust
chosen
[ { "from": "system", "value": "Rename `render_command_encoder` to `create_render_command_encoder` to emphasise that it creates a `RenderCommandEncoder`\n" }, { "from": "human", "value": "use cocoa::base::id;\nuse std::mem;\nuse std::ops::{Deref, DerefMut};\nuse {CommandEncoder, StoreAction, Rende...
rust
chosen
[ { "from": "system", "value": "Remove line with unimplemented function\n" }, { "from": "human", "value": "extern crate uosql;\n\nuse uosql::storage::*;\n\nfn main() {\n\n //let db = Database::create(\"storage_team\").unwrap();\n let db = Database::load(\"storage_team\").unwrap();\n\n let...
rust
chosen
[ { "from": "system", "value": "Implement Eq and Ord for Rollers\n" }, { "from": "human", "value": "#[macro_use]\nextern crate pest;\nextern crate rand;\n\nmod parse;\nmod random;\n\nuse pest::*;\nuse parse::*;\n\npub fn roll_dice(r: &str) -> i32 {\n let mut parser = Rdp::new(StringInput::new(r...
rust
chosen
[ { "from": "system", "value": "Remove box syntax feature since it's not used\n" }, { "from": "human", "value": "//! Furry Fiesta is a library for poker.\n//! It's mostly meant for Holdem games, however the core functionality\n//! should work for all game types.\n//!\n//! # Implemented:\n//! Curre...
rust
chosen
[ { "from": "system", "value": "Rename fps to period, provide more suitable defaults\n" }, { "from": "human", "value": "extern crate rustc_serialize;\nextern crate docopt;\n\nmod display;\nmod world;\n\nuse docopt::Docopt;\nuse std::thread::sleep_ms;\n\nstatic USAGE: &'static str = \"\nUsage:\n ...
rust
chosen
[ { "from": "system", "value": "Handle Result returned by execute.\n" }, { "from": "human", "value": "use std::io::{self, stdin, stdout, Write};\n\n// TODO(tsion): Use the readline library.\nfn prompt(line: &mut String) -> io::Result<usize> {\n let current_dir = try!(std::env::current_dir());\n...
rust
chosen
[ { "from": "system", "value": "Add -Wl,-znotext to default linker flags to link with lld 9 on FreeBSD 13.0-CURRENT i386\n\nrust-nightly has been failing to link since 2019-12-10 with variations of\n```\n = note: ld: error: relocation R_386_PC32 cannot be used against symbol __rust_probestack; recompile with ...
rust
chosen
[ { "from": "human", "value": "Add basic `BezNode` and `BezQuad`.\n" }, { "from": "gpt", "value": "use std::ops::Index;\nuse std::convert::Into;\n\n#[derive(Debug, Clone, Copy)]\npub enum BezNode {\n Point {\n x: f32,\n y: f32\n },\n\n Control {\n x: f32,\n y: ...
rust
chosen
[ { "from": "human", "value": "Add ui test with explicit Unpin impl\n" }, { "from": "gpt", "value": "use std::marker::Unpin;\n\n#[cxx::bridge]\nmod ffi {\n extern \"C++\" {\n type Opaque;\n }\n}\n\nimpl Unpin for ffi::Opaque {}\n\nfn main() {}\n" } ]
rust
chosen
[ { "from": "human", "value": "Add tests for Visibility parsing\n\nThese test both general `Visibility` usage, as well as specific failure cases\nfixed by the other two patches in this series.\n" }, { "from": "gpt", "value": "mod features;\n\nuse proc_macro2::TokenStream;\nuse syn::{Result, Visibi...
rust
chosen
[ { "from": "human", "value": "Add a rustdoc test for future rustc_deprecated attributes\n" }, { "from": "gpt", "value": "#![feature(staged_api)]\n\n#![stable(feature = \"rustc_deprecated-future-test\", since = \"1.0.0\")]\n\n// @has rustc_deprecated_future/index.html '//*[@class=\"stab deprecated...
rust
chosen
[ { "from": "human", "value": "Add failure tests for moving out of unboxed closure environments\n" }, { "from": "gpt", "value": "// 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//\...
rust
chosen
[ { "from": "human", "value": "Add example for R function call\n" }, { "from": "gpt", "value": "extern crate libr;\n\nuse std::env;\nuse std::ffi::CString;\n\nuse libr::ffi::embedded;\nuse libr::ffi::internals::*;\n\nfn main() {\n if let Err(_) = env::var(\"R_HOME\") {\n panic!(\"Rembedd...
rust
chosen
[ { "from": "human", "value": "Add Arc test, triggering an unusual bug.\n\nWeird stuff. Ain't high, ain't drunk, but shit's happening, and it is fucked up. I can smell rainbows.\n" }, { "from": "gpt", "value": "//! This test is a more subtle one. It is one which can hit thread destructors unexpect...
rust
chosen
[ { "from": "human", "value": "testsuite: Add an xfailed test case for the new `extern mod` syntax\n" }, { "from": "gpt", "value": "// Copyright 2013 The Rust Project Developers. See the COPYRIGHT\n// file at the top-level directory of this distribution and at\n// http://rust-lang.org/COPYRIGHT.\n...
rust
chosen
[ { "from": "human", "value": "Add Automorphic number in Rust\n" }, { "from": "gpt", "value": "// In mathematics an automorphic number (sometimes referred to as a circular number)\n// is a number whose square \"ends\" in the same digits as the number itself.\n\nfn list_automorphic_numbers(start: i...
rust
chosen
[ { "from": "human", "value": "Add rust code for custom-set case\n\nIt passed all test cases\n" }, { "from": "gpt", "value": "use std::collections::HashSet;\nuse std::hash::Hash;\n\n#[derive(Debug, PartialEq)]\npub struct CustomSet<T: Hash + Eq> {\n store: HashSet<T>,\n}\n\nimpl<T> CustomSet<T>...
rust
chosen
[ { "from": "human", "value": "Test that bounds checks are elided for indexing after .[r]position()\n" }, { "from": "gpt", "value": "// min-llvm-version: 11.0.0\n// compile-flags: -O\n// ignore-debug: the debug assertions get in the way\n#![crate_type = \"lib\"]\n\n// Make sure no bounds checks ar...
rust
chosen
[ { "from": "human", "value": "Add a C ABI compatible struct for use when performing\n" }, { "from": "gpt", "value": "static IFNAMSIZ: uint = 16;\nstatic PADDINGSIZE: uint = 22;\nstatic IFF_TAP: u16 = 2;\nstatic IFF_NO_PI: u16 = 0x1000;\n\n\n// An enum representing the possible results of trying t...
rust
chosen
[ { "from": "system", "value": "Add missing \"max_atomic_width\" to new armv7 android target.\n" }, { "from": "human", "value": "// 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//\...
rust
chosen
[ { "from": "human", "value": "Add example for implementing a custom widget\n" }, { "from": "gpt", "value": "extern crate tui;\n\nuse tui::Terminal;\nuse tui::widgets::Widget;\nuse tui::buffer::Buffer;\nuse tui::layout::Rect;\nuse tui::style::Color;\n\nstruct Label<'a> {\n text: &'a str,\n}\n\n...
rust
chosen
[ { "from": "system", "value": "Test that a feature gated cfg variable in a `cfg_attr` on an unconfigured item is allowed\n" }, { "from": "human", "value": "// Copyright 2016 The Rust Project Developers. See the COPYRIGHT\n// file at the top-level directory of this distribution and at\n// http://r...
rust
chosen
[ { "from": "human", "value": "Add skeleton code for FilterExec.\n" }, { "from": "gpt", "value": "use common::types::Ty;\nuse driver::DriverContext;\nuse super::{Executor, ExecutorFactory};\n\npub struct FilterExecFactory\n{\n\ttypes: Vec<Ty>\n}\n\nimpl FilterExecFactory \n{\n\tpub fn new(f: Box<E...
rust
chosen
[ { "from": "human", "value": "Add test for compiler reexports removal\n" }, { "from": "gpt", "value": "// compile-flags: --no-defaults\n\n#![crate_name = \"foo\"]\n\n// @has 'foo/index.html' '//code' 'extern crate std;'\n// @!has 'foo/index.html' '//code' 'use std::prelude::v1::*;'\npub struct Fo...
rust
chosen
[ { "from": "human", "value": "[rust] Address of two struct must be different even the struct is empty struct(size is zero).\n" }, { "from": "gpt", "value": "struct EmptyStruct;\n\nfn main() {\n let e1 = EmptyStruct;\n let e2 = EmptyStruct;\n println!(\"{:?}\", &e1 as *const EmptyStruct);...
rust
chosen
[ { "from": "human", "value": "Add test for constant pattern diagnostics\n" }, { "from": "gpt", "value": "// 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 ...
rust
chosen
[ { "from": "human", "value": "utils: Add tests for the `align_blocks` helper in utils.\n" }, { "from": "gpt", "value": "extern crate clippy_lints;\n\nuse clippy_lints::utils::align_snippets;\n\n#[test]\nfn test_align_snippets_single_line() {\n assert_eq!(\"\", align_snippets(&[\"\"]));\n as...
rust
chosen
[ { "from": "human", "value": "Add test for `has_test_signature` for explicit return\n" }, { "from": "gpt", "value": "// 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// License...
rust
chosen
[ { "from": "human", "value": "Add crypto coin ticker lookup functionality\n" }, { "from": "gpt", "value": "use std::io::Read;\n\nuse serde_json;\nuse reqwest;\nuse reqwest::Method;\nuse regex::Regex;\n\nuse ::bot::{Bot, Node, RoomEvent};\n\n\npub struct CryptoCoin {\n}\n\nimpl CryptoCoin {\n p...
rust
chosen
[ { "from": "human", "value": "Add the generic GObject wrapper struct\n" }, { "from": "gpt", "value": "// Copyright 2015, The Rust-GNOME Project Developers.\n// See the COPYRIGHT file at the top-level directory of this distribution.\n// Licensed under the MIT license, see the LICENSE file or <http...
rust
chosen
[ { "from": "human", "value": "Add moc test (not testing result)\n" }, { "from": "gpt", "value": "\nextern crate ndarray;\nextern crate ndarray_linalg as linalg;\n\nuse ndarray::prelude::*;\nuse linalg::SquareMatrix;\n\n#[test]\nfn test_eigh() {\n let a = arr2(&[[3.0, 1.0, 1.0], [1.0, 3.0, 1.0]...
rust
chosen
[ { "from": "human", "value": "Add some simple should_parse tests\n" }, { "from": "gpt", "value": "//! This module contains some simple tests where we can write strings which we \n\nextern crate syn;\n\nmacro_rules! should_parse {\n ($name:ident, { $($in:tt)* }) => {\n #[test]\n f...
rust
chosen
[ { "from": "human", "value": "Add test against possible undefined behavior\n" }, { "from": "gpt", "value": "#![cfg(feature = \"std\")]\n\nextern crate rand;\nextern crate libc;\n\nuse rand::{FromEntropy, SmallRng};\nuse rand::distributions::{Distribution, Bernoulli};\n\n#[link_name = \"m\"]\nexte...
rust
chosen
[ { "from": "human", "value": "Test case to make sure typestate checks the body of class constructors\n" }, { "from": "gpt", "value": "// error-pattern:unsatisfied precondition\nclass cat {\n priv {\n let mutable meows : uint;\n }\n\n let how_hungry : int;\n\n fn eat() {\n how_hungry -= ...
rust
chosen
[ { "from": "human", "value": "Add testcase for proper LLVM representation of SIMD types.\n\nTestcase to make sure that no 0-sized padding is inserted in structs and that structs are represented as expected by Neon intrinsics in LLVM.\n" }, { "from": "gpt", "value": "// Make sure that no 0-sized p...
rust
chosen
[ { "from": "human", "value": "Add an example with at least 2 arguments\n" }, { "from": "gpt", "value": "#[macro_use]\nextern crate structopt;\n\nuse structopt::StructOpt;\n\n#[derive(StructOpt, Debug)]\nstruct Opt {\n #[structopt(raw(required = \"true\", min_values = \"2\"))]\n foos: Vec<St...
rust
chosen
[ { "from": "human", "value": "Add an example of playing a WAV file.\n\nAddresses #458.\n" }, { "from": "gpt", "value": "extern crate sdl2;\n\nuse sdl2::audio::{AudioCallback, AudioSpecDesired,AudioSpecWAV,AudioCVT};\n\n// NOTE: You probably want to investigate SDL_Mixer\n// (https://github.com/an...
rust
chosen
[ { "from": "human", "value": "Add Rust code for circular-buffer\n\nIt passed all test cases\n" }, { "from": "gpt", "value": "use std::collections::VecDeque;\n\npub struct CircularBuffer<T> {\n buffer: VecDeque<T>,\n size: usize,\n}\n\n#[derive(Debug, PartialEq)]\npub enum Error {\n Empty...
rust
chosen