conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "human",
"value": "Check const-propagation of borrows of unsized places\n"
},
{
"from": "gpt",
"value": "// run-pass (ensure that const-prop is run)\n\nstruct A<T: ?Sized>(T);\n\nfn main() {\n let _x = &(&A([2, 3]) as &A<[i32]>).0 as *const [i32] as *const i32;\n}\n"
}
] | rust | chosen |
[
{
"from": "human",
"value": "Add test for silenced unused params in derive\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 ... | rust | chosen |
[
{
"from": "human",
"value": "Add an inlining debuginfo test\n"
},
{
"from": "gpt",
"value": "#![crate_type=\"rlib\"]\n// compile-flags: -Copt-level=3 -g\n\n#[no_mangle]\n#[inline(always)]\npub extern \"C\" fn callee(x: u32) -> u32 {\n x + 4\n}\n\n// CHECK-LABEL: caller\n// CHECK: call void @l... | rust | chosen |
[
{
"from": "human",
"value": "Add example to load and print bundle\n\nAlso allows quick testing if local kbdgen bundles can be parsed, e.g.\nlike this:\n\n fd -0 .kbdgen ../giellalt/ | xargs -0 -I % cargo r --example load_bundle -- %\n"
},
{
"from": "gpt",
"value": "use kbdgen::{Load, ProjectB... | rust | chosen |
[
{
"from": "human",
"value": "Add simple assembler parsing example\n\nHas proven useful for finding assembler statements that the parser fail\nto understand, by loading larger examples found online.\n"
},
{
"from": "gpt",
"value": "extern crate r68k_tools;\nextern crate pest;\n\nuse r68k_tools::a... | rust | chosen |
[
{
"from": "human",
"value": "Add benchmarks for zeros / default\n"
},
{
"from": "gpt",
"value": "#![feature(test)]\n\nextern crate test;\nuse test::Bencher;\n\n#[macro_use(s)]\nextern crate ndarray;\nuse ndarray::prelude::*;\n\n#[bench]\nfn default_f64(bench: &mut Bencher) {\n bench.iter(|| {... | rust | chosen |
[
{
"from": "human",
"value": "Add test for closure drop.\n"
},
{
"from": "gpt",
"value": "struct Foo<'a>(&'a mut bool);\n\nimpl<'a> Drop for Foo<'a> {\n fn drop(&mut self) {\n *self.0 = true;\n }\n}\n\nfn f<T: FnOnce()>(t: T) {\n t()\n}\n\nfn main() {\n let mut ran_drop = false... | rust | chosen |
[
{
"from": "human",
"value": "Add tests for `if let`\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//\n// Licensed under the Apache License, Ver... | rust | chosen |
[
{
"from": "human",
"value": "Add solution to problem 48\n"
},
{
"from": "gpt",
"value": "#[macro_use] extern crate libeuler;\nextern crate num;\n\nuse num::bigint::{BigInt, ToBigInt};\nuse num::traits::{Zero, One, ToPrimitive, PrimInt};\n\n/// The series, 1^1 + 2^2 + 3^3 + ... + 10^10 = 10405071... | rust | chosen |
[
{
"from": "system",
"value": "Fix the tests broken by replacing `task` with `thread`\n"
},
{
"from": "human",
"value": "// 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// Lic... | rust | chosen |
[
{
"from": "system",
"value": "Update error message and un-xfail test\n"
},
{
"from": "human",
"value": "// xfail-test\n// error-pattern:unresolved import: m::f\nuse x = m::f;\n\nmod m {\n #[legacy_exports];\n}\n\nfn main() {\n}\n"
},
{
"from": "gpt",
"value": "use x = m::f; //~ ER... | rust | chosen |
[
{
"from": "human",
"value": "Add missing example for testing the drop/ memory leakage\n"
},
{
"from": "gpt",
"value": "extern crate libmodbus_sys as raw;\nextern crate libmodbus_rs;\n\nuse libmodbus_rs::modbus::{Modbus};\n\n\nfn main() {\n // 1. Parameter Serial Interface `/dev/ttyUSB0`\n ... | rust | chosen |
[
{
"from": "human",
"value": "Check if enum_map! can be used on variantless enum\n"
},
{
"from": "gpt",
"value": "#![no_std]\n\n#[macro_use]\nextern crate enum_map;\n\nuse enum_map::EnumMap;\n\n#[derive(EnumMap)]\nenum Void {}\n\n#[test]\nfn empty_map() {\n let void: EnumMap<Void, Void> = enum... | rust | chosen |
[
{
"from": "human",
"value": "Add equivalent test in src/test/rustdoc\n"
},
{
"from": "gpt",
"value": "// edition:2018\n\n#![no_core]\n#![feature(no_core)]\n\n// @count issue_89852/index.html '//*[@class=\"macro\"]' 2\n// @has - '//*[@class=\"macro\"]/@href' 'macro.repro.html'\n#[macro_export]\nm... | rust | chosen |
[
{
"from": "human",
"value": "Add Depth-First Search using The Rust Programming Language\n"
},
{
"from": "gpt",
"value": "use std::io::stdin;\n\n// DFS receives a graph and the start point\nfn dfs(graph: &mut Vec<Vec<usize>>, start: usize) {\n let mut visited: Box<Vec<bool>> = Box::new(Vec::ne... | rust | chosen |
[
{
"from": "system",
"value": "Update old xfailing spawn/bind/join test\n"
},
{
"from": "human",
"value": "// 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 th... | rust | chosen |
[
{
"from": "system",
"value": "Allow '$' in rust files\n"
},
{
"from": "human",
"value": "pub fn editor(source: &str) -> String {\n format!(\"<div id=\\\"active-code\\\">\n<button class=\\\"btn btn-primary\\\" type=\\\"button\\\" id=\\\"run-code\\\">Run</button>\n<button class=\\\"btn btn-prim... | rust | chosen |
[
{
"from": "human",
"value": "Add an XFAILed test for if expressions resulting in boxes\n"
},
{
"from": "gpt",
"value": "// xfail-boot\n// xfail-stage0\n// -*- rust -*-\n\n// Tests for if as expressions returning boxed types\n\nfn test_box() {\n auto res = if (true) { @100 } else { @101 };\n ch... | rust | chosen |
[
{
"from": "human",
"value": " Test that object bounds are preferred over global where clause bounds\n"
},
{
"from": "gpt",
"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.org/COPYRIGHT... | rust | chosen |
[
{
"from": "human",
"value": "Add run-pass test for paths containing the NUL character\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// Lice... | rust | chosen |
[
{
"from": "human",
"value": "Test for cross-crate const in match pattern.\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//\n// Licensed under t... | rust | chosen |
[
{
"from": "system",
"value": "Fix stage 0 and 1 tests broken because i128 doesn't work in stages less than 2\n\nBroken by https://github.com/rust-lang/rust/pull/38992.\n"
},
{
"from": "human",
"value": "// Copyright 2017 The Rust Project Developers. See the COPYRIGHT\n// file at the top-level di... | rust | chosen |
[
{
"from": "system",
"value": "Reduce size of array in test case to 1MB\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 under th... | rust | chosen |
[
{
"from": "human",
"value": "Add test for concurrently using an FFT object\n"
},
{
"from": "gpt",
"value": "//! Test that we can use an `FFT` object from multiple threads\n\nextern crate rustfft;\n\nuse std::thread;\n\nuse rustfft::FFTplanner;\nuse rustfft::num_complex::Complex32;\n\n#[test]\nfn... | rust | chosen |
[
{
"from": "human",
"value": "Add initial Firefix tab opener rust program (0.9)\n"
},
{
"from": "gpt",
"value": "extern mod extra;\n\nuse std::from_str::from_str;\nuse std::io::net::ip::SocketAddr;\nuse std::io::net::tcp::TcpListener;\nuse std::io::{Acceptor,Listener};\nuse std::run::{Process,Pro... | rust | chosen |
[
{
"from": "human",
"value": "Add an implementation for SimDev.\n\nSigned-off-by: mulhern <7b51bcf507bcd7afb72bf8663752c0ddbeb517f6@redhat.com>\n"
},
{
"from": "gpt",
"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... | rust | chosen |
[
{
"from": "human",
"value": "Add regression test for const prop\n"
},
{
"from": "gpt",
"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.org/COPYRIGHT.\n//\n// Licensed under the Apache ... | rust | chosen |
[
{
"from": "system",
"value": "Remove unused import of log crate\n"
},
{
"from": "human",
"value": "//\n// imag - the personal information management suite for the commandline\n// Copyright (C) 2015, 2016 Matthias Beyer <mail@beyermatthias.de> and contributors\n//\n// This library is free softwar... | rust | chosen |
[
{
"from": "system",
"value": "Reduce number of threads in many_threads() test\n\nReduce number of threads in many_threads() test to 1k because os x\nfailed to allocate 10k threads\n"
},
{
"from": "human",
"value": "extern crate futures;\n\nuse std::thread;\nuse futures::sync::oneshot;\nuse futur... | rust | chosen |
[
{
"from": "human",
"value": "Add linked_list implementation in Rust\n"
},
{
"from": "gpt",
"value": "use List::{Item, Nil};\n\n// linked list implementation in rust\n\nfn main() {\n let mut list = List::new();\n list = list.prepend(1);\n list = list.prepend(2);\n list = list.prepend(... | rust | chosen |
[
{
"from": "human",
"value": "Add address stability test for matches\n"
},
{
"from": "gpt",
"value": "// Check that `ref mut` variables don't change address between the match guard\n// and the arm expression.\n\n// run-pass\n\n#![feature(nll, bind_by_move_pattern_guards)]\n\n// Test that z always... | rust | chosen |
[
{
"from": "human",
"value": "Add test case for labeled break in const assignment\n\nSee https://github.com/rust-lang/rust/issues/51350 for more information.\n"
},
{
"from": "gpt",
"value": "// Using labeled break in a while loop has caused an illegal instruction being\n// generated, and an ICE l... | rust | chosen |
[
{
"from": "human",
"value": "Add the example as an example test program.\n\nPutting it in the examples directory makes it be automatically built as\npart of `cargo test`.\n"
},
{
"from": "gpt",
"value": "extern crate wasmparser;\n\nuse std::io;\nuse std::io::prelude::*;\nuse std::fs::File;\nuse ... | rust | chosen |
[
{
"from": "human",
"value": "Add test for memory layout information\n"
},
{
"from": "gpt",
"value": "// @has type_layout/struct.Foo.html 'Size: '\n// @has - ' bytes'\npub struct Foo {\n pub a: usize,\n b: Vec<String>,\n}\n\n// @has type_layout/enum.Bar.html 'Size: '\n// @has - ' bytes'\npu... | rust | chosen |
[
{
"from": "human",
"value": "Add test for rustdoc ignore test\n\nThis will check for regression on issue #32556\n"
},
{
"from": "gpt",
"value": "// 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.o... | rust | chosen |
[
{
"from": "human",
"value": "Add test of serialize_trait_object involving generics\n"
},
{
"from": "gpt",
"value": "use erased_serde::serialize_trait_object;\n\npub trait MyTrait: erased_serde::Serialize {}\n\nserialize_trait_object!(MyTrait);\n\npub trait MyGenericTrait<'a, T>: erased_serde::Se... | rust | chosen |
[
{
"from": "human",
"value": "test: Add a test case for self regions and typeclass implementations\n"
},
{
"from": "gpt",
"value": "type clam = { chowder: &int };\n\nimpl clam for clam {\n fn get_chowder() -> &self.int { ret self.chowder; }\n}\n\nfn main() {\n let clam = { chowder: &3 };\n ... | rust | chosen |
[
{
"from": "human",
"value": "Add a test that unique boxes in vectors are copied when the vector is\n\nIssue #409\n"
},
{
"from": "gpt",
"value": "fn main() {\n let a = [~mutable 10];\n let b = a;\n\n assert *a[0] == 10;\n assert *b[0] == 10;\n\n // This should only modify the valu... | rust | chosen |
[
{
"from": "human",
"value": "Add example for multiple simultaneous examples\n"
},
{
"from": "gpt",
"value": "extern crate init = \"gl-init-rs\";\nextern crate libc;\nextern crate gl;\n\nfn main() {\n let window1 = init::Window::new().unwrap();\n let window2 = init::Window::new().unwrap();\... | rust | chosen |
[
{
"from": "human",
"value": "Add failing test for globals to subcommands\n\nIssue 978 mentions that subcommands cannot see the value\nof globals that get passed, even if ArgSettings::PropagateGlobalsDown\nis true.\n\nThis change commits a failing test that reproduces this error.\n"
},
{
"from": "gpt... | rust | chosen |
[
{
"from": "human",
"value": "Add an unwind test for failure during unique box construction\n"
},
{
"from": "gpt",
"value": "// error-pattern:fail\n\nfn f() -> [int] { fail; }\n\n// Voodoo. In unwind-alt we had to do this to trigger the bug. Might\n// have been to do with memory allocation patter... | rust | chosen |
[
{
"from": "human",
"value": "Add basic program for benchmarking decode speed\n"
},
{
"from": "gpt",
"value": "// Claxon -- A FLAC decoding library in Rust\n// Copyright 2016 Ruud van Asseldonk\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file... | rust | chosen |
[
{
"from": "human",
"value": "Add test for a mixture of arguments\n"
},
{
"from": "gpt",
"value": "extern crate clap;\n\nuse clap::{App, Arg};\n\n#[test]\nfn mixed_positional_and_options() {\n App::new(\"mixed_positional_and_options\")\n .arg(Arg::with_name(\"feed\")\n .shor... | rust | chosen |
[
{
"from": "human",
"value": "Add a compile-fail test for qualification lint\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//\n// Licensed under... | rust | chosen |
[
{
"from": "human",
"value": "Add regression test for lint deprecation\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//\n// Licensed under the A... | rust | chosen |
[
{
"from": "human",
"value": "needless_continue: Add tests for helper functions to the needless_continue lint.\n\nCreating a test file per function sounds a bit excessive, so just\nclubbing all needless_continue specific function tests into this module.\n"
},
{
"from": "gpt",
"value": "// Tests f... | rust | chosen |
[
{
"from": "human",
"value": "Add test for drop for newtype structs.\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//\n// Licensed under the Apa... | rust | chosen |
[
{
"from": "human",
"value": "Add example of color effects\n"
},
{
"from": "gpt",
"value": "//! Demonstrates adding a color tint and applying a color gradient to a grayscale image.\n\nextern crate image;\nextern crate imageproc;\n\nuse std::env;\nuse std::path::Path;\nuse image::{Luma, open, Rgb}... | rust | chosen |
[
{
"from": "system",
"value": "Fix merge after reexport fix\n"
},
{
"from": "human",
"value": "use std::io::{Result, SeekFrom};\nuse std::syscall::*;\nuse std::Url;\n\npub struct Resource;\n\nimpl Resource {\n pub fn dup(&self) -> Result<Box<Resource>> {\n Ok(box Resource)\n }\n\n ... | rust | chosen |
[
{
"from": "human",
"value": "Add a test for BTreeMap lifetime bound to see if it compiles\n"
},
{
"from": "gpt",
"value": "// check-pass\n\nuse std::collections::{BTreeMap, HashMap};\n\ntrait Map\nwhere\n for<'a> &'a Self: IntoIterator<Item = (&'a Self::Key, &'a Self::Value)>,\n{\n type Ke... | rust | chosen |
[
{
"from": "human",
"value": "Add test for wrong code generation for HashSet creation on arm cpu\n\nThis is test for #42918.\nTo reproduce bug you need machine with arm cpu and compile with optimization.\nI tried with rustc 1.19.0-nightly (3d5b8c626 2017-06-09),\nif compile test with -C opt-level=3 for targe... | rust | chosen |
[
{
"from": "human",
"value": "Add test for reading truncated files\n\nTests loading every image for every truncation length up to 1000\nbytes. Expensive, so ignored by default.\n"
},
{
"from": "gpt",
"value": "//! Ensure truncated images are read without panics.\n\nuse std::fs;\nuse std::path::Pa... | rust | chosen |
[
{
"from": "human",
"value": "Test for (previously uncaught) infinite loop identified by matthewjasper.\n"
},
{
"from": "gpt",
"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.org/COPYRI... | rust | chosen |
[
{
"from": "human",
"value": "Add test to ensure const-prop fails gracefully\n"
},
{
"from": "gpt",
"value": "#[inline(never)]\nfn read(_: usize) { }\n\nfn main() {\n const FOO: &i32 = &1;\n let x = FOO as *const i32 as usize;\n read(x);\n}\n\n// END RUST SOURCE\n// START rustc.main.Cons... | rust | chosen |
[
{
"from": "human",
"value": "Add codegen test for integers compare\n"
},
{
"from": "gpt",
"value": "// This is test for more optimal Ord implementation for integers.\n// See <https://github.com/rust-lang/rust/issues/63758> for more info.\n\n// compile-flags: -C opt-level=3\n\n#![crate_type = \"l... | rust | chosen |
[
{
"from": "human",
"value": "Test that column information is not emitted for MSVC targets\n"
},
{
"from": "gpt",
"value": "// Verify that no column information is emitted for MSVC targets\n//\n// only-msvc\n// compile-flags: -C debuginfo=2\n\n// CHECK-NOT: !DILexicalBlock({{.*}}column: {{.*}})\n... | rust | chosen |
[
{
"from": "human",
"value": "Add \"cheating\" http server example.\n\nBecause I'm a showoff.\n\n% wrk -t8 -c100 -d10s http://localhost:5555\nRunning 10s test @ http://localhost:5555\n 8 threads and 100 connections\n Thread Stats Avg Stdev Max +/- Stdev\n Latency 5.01s 2.37s 7.98... | rust | chosen |
[
{
"from": "human",
"value": "Add ignored test for associated types in const impl\n"
},
{
"from": "gpt",
"value": "// ignore-test\n\n// FIXME: This test should fail since, within a const impl of `Foo`, the bound on `Foo::Bar` should\n// require a const impl of `Add` for the associated type.\n\n#!... | rust | chosen |
[
{
"from": "human",
"value": "Add a test for untagged unions\n"
},
{
"from": "gpt",
"value": "// 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/COPYRIGHT.\n//\n// Licensed under the Apache Lice... | rust | chosen |
[
{
"from": "human",
"value": "Fix kindck to consider inherited bounds\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//\n// Licensed under the Ap... | rust | chosen |
[
{
"from": "human",
"value": "Add codegen test checking binary_search allows eliding bound checks\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 are... | rust | chosen |
[
{
"from": "human",
"value": "Add rather involved run-pass test case.\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//\n// Licensed under the Ap... | rust | chosen |
[
{
"from": "human",
"value": "Add regression test for Clone for [[T; 256]; 4] where T: Copy and not Clone\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/COPY... | rust | chosen |
[
{
"from": "human",
"value": "Add regression test for MIR drop generation in async loops\n\nFixes #61986.\n"
},
{
"from": "gpt",
"value": "// compile-pass\n// edition:2018\n//\n// Tests that we properly handle StorageDead/StorageLives for temporaries\n// created in async loop bodies.\n\n#![featur... | rust | chosen |
[
{
"from": "human",
"value": "Add a test Hello World Iron server\n"
},
{
"from": "gpt",
"value": "use iron::prelude::*;\nuse iron::status;\n\n/// Test hello world server\npub fn hello_world(_: &mut Request) -> IronResult<Response> {\n Ok(Response::with((status::Ok, \"Hello World!\")))\n}\n... | rust | chosen |
[
{
"from": "human",
"value": "Add solution to problem 72\n"
},
{
"from": "gpt",
"value": "#![feature(core, step_by)]\n#[macro_use] extern crate libeuler;\n\nuse std::collections::{HashSet, HashMap};\n\nuse libeuler::prime::SieveOfAtkin;\n/// Consider the fraction, n/d, where n and d are positive ... | rust | chosen |
[
{
"from": "human",
"value": "Use of impl trait in an impl as the valoe for an associated type in a dyn\n"
},
{
"from": "gpt",
"value": "// check-pass\n\n#![feature(type_alias_impl_trait)]\n#![allow(dead_code)]\n\ntype Foo = Box<dyn Iterator<Item = impl Send>>;\n\nfn make_foo() -> Foo {\n Box:... | rust | chosen |
[
{
"from": "human",
"value": "Add rust code for tournament project\n\nIt passed all testcases\n"
},
{
"from": "gpt",
"value": "use std::collections::HashMap;\nuse std::cmp::Ordering;\n\n\n#[derive(Debug)]\nstruct Record {\n win: u32,\n draw: u32,\n lose: u32,\n}\n\nimpl Record {\n fn ... | rust | chosen |
[
{
"from": "human",
"value": "Add test for module ambiguity\n"
},
{
"from": "gpt",
"value": "// ignore-tidy-linelength\n\n#![deny(intra_doc_link_resolution_failure)]\n\n\npub fn foo() {\n\n}\n\npub mod foo {}\n// @has intra_doc_link_mod_ambiguity/struct.A.html '//a/@href' '../intra_doc_link_mod_a... | rust | chosen |
[
{
"from": "human",
"value": "Add test that `!` cannot be indexed\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//\n// Licensed under the Apache... | rust | chosen |
[
{
"from": "human",
"value": "Add test for `Ipv4Addr` methods in a const context\n"
},
{
"from": "gpt",
"value": "// run-pass\n\n#![feature(ip)]\n#![feature(const_ipv4)]\n\nuse std::net::Ipv4Addr;\n\nfn main() {\n const IP_ADDRESS: Ipv4Addr = Ipv4Addr::new(127, 0, 0, 1);\n assert_eq!(IP_ADD... | rust | chosen |
[
{
"from": "human",
"value": "Test that bounds checks are elided when slice len is checked up-front\n"
},
{
"from": "gpt",
"value": "// no-system-llvm\n// compile-flags: -O\n#![crate_type = \"lib\"]\n\n// CHECK-LABEL: @already_sliced_no_bounds_check\n#[no_mangle]\npub fn already_sliced_no_bounds_... | rust | chosen |
[
{
"from": "human",
"value": "Add test to check for debug logging disabled at compile time\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//\n// ... | rust | chosen |
[
{
"from": "human",
"value": "Add expression tests from rcc codebase\n"
},
{
"from": "gpt",
"value": "use std::fmt::Display;\nuse thiserror::Error;\n\n// Some of the elaborate cases from the rcc codebase, which is a C compiler in\n// Rust. https://github.com/jyn514/rcc/blob/0.8.0/src/data/error.r... | rust | chosen |
[
{
"from": "human",
"value": "Add tests for hidden types\n"
},
{
"from": "gpt",
"value": "// 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/COPYRIGHT.\n//\n// Licensed under the Apache License,... | rust | chosen |
[
{
"from": "human",
"value": "Add a test that lambdas can't deinitialize upvars\n"
},
{
"from": "gpt",
"value": "// error-pattern:assigning to upvar\nfn force(f: &block() -> int) -> int { ret f(); }\nfn main() {\n let x = 5;\n let f = lambda () -> int { let y = 6; x <- y; ret 7 };\n asse... | rust | chosen |
[
{
"from": "human",
"value": "Add a test for the returned balances from Kraken\n"
},
{
"from": "gpt",
"value": "#[cfg(test)]\r\nmod kraken_tests {\r\n extern crate coinnect;\r\n\r\n use self::coinnect::kraken::KrakenApi;\r\n\r\n /// IMPORTANT: Real keys are needed in order to retrieve th... | rust | chosen |
[
{
"from": "human",
"value": "Add simple UtpStream test using only the public API.\n"
},
{
"from": "gpt",
"value": "#![feature(macro_rules)]\n\nextern crate utp;\n\nuse std::io::test::next_test_ip4;\nuse utp::UtpStream;\n\nmacro_rules! iotry(\n ($e:expr) => (match $e { Ok(e) => e, Err(e) => pa... | rust | chosen |
[
{
"from": "system",
"value": "WIP: Implement tests for syscalls in example scheme\n"
},
{
"from": "human",
"value": "use 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... | rust | chosen |
[
{
"from": "human",
"value": "Add test for Item::Verbatim splitting a None group\n\n(see issue #1235)\n"
},
{
"from": "gpt",
"value": "use proc_macro2::{Delimiter, Group};\nuse quote::quote;\n\n#[test]\nfn main() {\n // Okay. Rustc allows top-level `static` with no value syntactically, but\n ... | rust | chosen |
[
{
"from": "human",
"value": "Add test for uninit raw ptrs\n"
},
{
"from": "gpt",
"value": "fn main() {\n let _val = unsafe { std::mem::MaybeUninit::<*const u8>::uninit().assume_init() };\n //~^ ERROR type validation failed at .value: encountered uninitialized raw pointer\n}\n"
}
] | rust | chosen |
[
{
"from": "human",
"value": "Add a test for mocking Generic Associated Types\n\nNo code changes are necessary to get this test working.\n"
},
{
"from": "gpt",
"value": "#! vim: tw=80\n//! automock a trait with Generic Associated Types\n#![cfg_attr(feature = \"nightly\", feature(generic_associate... | rust | chosen |
[
{
"from": "human",
"value": "Add another test using projection types in impls.\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 un... | rust | chosen |
[
{
"from": "human",
"value": "Add a new test case to verify behavior.\n"
},
{
"from": "gpt",
"value": "// run-pass\n#![feature(trait_upcasting)]\n#![allow(incomplete_features)]\n\ntrait Foo<T: Default + ToString>: Bar<i32> + Bar<T> {}\ntrait Bar<T: Default + ToString> {\n fn bar(&self) -> Stri... | rust | chosen |
[
{
"from": "human",
"value": "Test for struct-like variants in consts\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//\n// Licensed under the Ap... | rust | chosen |
[
{
"from": "human",
"value": "Add run-pass test for reinitialized unions.\n\nThis commit adds a run-pass test for the subset of\n`src/test/ui/borrowck/borrowck-union-move-assign.rs` that is intended to\npass as the union is reinitialized.\n"
},
{
"from": "gpt",
"value": "// Copyright 2016 The Rus... | rust | chosen |
[
{
"from": "human",
"value": "Add test for derive(PartialOrd) correctness\n"
},
{
"from": "gpt",
"value": "// 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/COPYRIGHT.\n//\n// Licensed under th... | rust | chosen |
[
{
"from": "human",
"value": "Test that autoref'ing beyond method receivers does not leak into two-phase borrows.\n"
},
{
"from": "gpt",
"value": "// 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.... | rust | chosen |
[
{
"from": "human",
"value": "Add a utility for printing out a table of bytes\n"
},
{
"from": "gpt",
"value": "pub fn print_byte_table<'a, T: Iterator<&'a u8>>(iter: T) {\n print!(\" \");\n for x in range::<u8>(0, 16) {\n print!(\" {:02x}\", x);\n\n if x == 15 {\n ... | rust | chosen |
[
{
"from": "human",
"value": "Add a struct representing the chosen device and interface options\n"
},
{
"from": "gpt",
"value": "use std::fmt;\n\n\nstatic DEFAULTDEVICE: &'static str = \"/dev/net/tun\";\nstatic DEFAULTINTERFACE: &'static str = \"tap0\";\n\n\npub enum CloneDevice {\n DefaultDev... | rust | chosen |
[
{
"from": "human",
"value": "Add new test case showing that supertraits are not enough\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// Lic... | rust | chosen |
[
{
"from": "human",
"value": "Add hello world server example\n"
},
{
"from": "gpt",
"value": "extern crate clap;\nextern crate fibers;\nextern crate futures;\nextern crate miasht;\n\nuse fibers::{Executor, ThreadPoolExecutor};\nuse futures::{Future, BoxFuture};\nuse miasht::{Server, Status};\nuse... | rust | chosen |
[
{
"from": "human",
"value": "Implement hashing for trie metadata.\n"
},
{
"from": "gpt",
"value": "use std::fmt::Debug;\nuse std::hash::{Hash, Hasher, SipHasher};\n\n#[derive(Debug,PartialEq,Eq,Clone)]\npub enum IFreq {\n Never,\n Depth(u64, u64),\n First(u64),\n Const(u64),\n}\n\nim... | rust | chosen |
[
{
"from": "human",
"value": "Add example showing incorrect handling of gamma\n"
},
{
"from": "gpt",
"value": "//! Demonstrates the current incorrect handling of gamma for RGB images\n\nextern crate image;\nextern crate imageproc;\n\nuse image::{ImageBuffer, Rgb};\nuse imageproc::pixelops::interp... | rust | chosen |
[
{
"from": "human",
"value": "Add example that periodically shows the current clock ticks.\n"
},
{
"from": "gpt",
"value": "#![no_std]\n/**\n * This example shows a repeated timer combined with reading and displaying the current time in\n * clock ticks.\n **/\nuse core::fmt::Write;\nuse libtock::... | rust | chosen |
[
{
"from": "human",
"value": "Add simple `[repr(align)]` codegen test.\n\nChecks alloca and memcpy are aligned correctly.\n"
},
{
"from": "gpt",
"value": "// Copyright 2016 The Rust Project Developers. See the COPYRIGHT\n// file at the top-level directory of this distribution and at\n// http://ru... | rust | chosen |
[
{
"from": "human",
"value": "test: Add a simple region test, xfail'd in the pretty printer\n"
},
{
"from": "gpt",
"value": "// xfail-pretty\n\nfn main() {\n unsafe {\n let x : int = 3;\n let y : &mut int = &mut x;\n *y = 5;\n log(debug, *y);\n }\n}\n\n\n"
}
] | rust | chosen |
[
{
"from": "human",
"value": "Add an example program which demonstates detailed detection\n"
},
{
"from": "gpt",
"value": "extern crate cld2;\n\nuse std::default::Default;\nuse cld2::{detect_language_ext, Format};\n\nstatic TEXTS: &'static [&'static str] = &[\n // English.\n // From Colerid... | rust | chosen |
[
{
"from": "human",
"value": "Add an example of using the typed API\n"
},
{
"from": "gpt",
"value": "// This example assumes you have InfluxDB running at http://localhost:8086/\n// without authentication and that there is an existing database named\n// `my_database`.\n\nextern crate tokio_core;\n... | rust | chosen |
[
{
"from": "human",
"value": "Add testing coverage for assigning to immutable thread-locals.\n\nIt is currently allowed to perform such assignments when not making use\nof NLL. NLL already does this right, but let's add a test in place to\nensure it never regresses.\n"
},
{
"from": "gpt",
"value"... | rust | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.