file_name
large_stringlengths
4
69
prefix
large_stringlengths
0
26.7k
suffix
large_stringlengths
0
24.8k
middle
large_stringlengths
0
2.12k
fim_type
large_stringclasses
4 values
intrinsic-raw_eq-const.rs
// run-pass #![feature(core_intrinsics)] #![feature(const_intrinsic_raw_eq)] #![deny(const_err)] pub fn
() { use std::intrinsics::raw_eq; const RAW_EQ_I32_TRUE: bool = unsafe { raw_eq(&42_i32, &42) }; assert!(RAW_EQ_I32_TRUE); const RAW_EQ_I32_FALSE: bool = unsafe { raw_eq(&4_i32, &2) }; assert!(!RAW_EQ_I32_FALSE); const RAW_EQ_CHAR_TRUE: bool = unsafe { raw_eq(&'a', &'a') }; assert!(RAW_EQ...
main
identifier_name
intrinsic-raw_eq-const.rs
// run-pass #![feature(core_intrinsics)] #![feature(const_intrinsic_raw_eq)] #![deny(const_err)] pub fn main()
}
{ use std::intrinsics::raw_eq; const RAW_EQ_I32_TRUE: bool = unsafe { raw_eq(&42_i32, &42) }; assert!(RAW_EQ_I32_TRUE); const RAW_EQ_I32_FALSE: bool = unsafe { raw_eq(&4_i32, &2) }; assert!(!RAW_EQ_I32_FALSE); const RAW_EQ_CHAR_TRUE: bool = unsafe { raw_eq(&'a', &'a') }; assert!(RAW_EQ_CH...
identifier_body
intrinsic-raw_eq-const.rs
// run-pass #![feature(core_intrinsics)] #![feature(const_intrinsic_raw_eq)] #![deny(const_err)] pub fn main() { use std::intrinsics::raw_eq; const RAW_EQ_I32_TRUE: bool = unsafe { raw_eq(&42_i32, &42) }; assert!(RAW_EQ_I32_TRUE); const RAW_EQ_I32_FALSE: bool = unsafe { raw_eq(&4_i32, &2) }; ass...
const RAW_EQ_CHAR_FALSE: bool = unsafe { raw_eq(&'a', &'A') }; assert!(!RAW_EQ_CHAR_FALSE); const RAW_EQ_ARRAY_TRUE: bool = unsafe { raw_eq(&[13_u8, 42], &[13, 42]) }; assert!(RAW_EQ_ARRAY_TRUE); const RAW_EQ_ARRAY_FALSE: bool = unsafe { raw_eq(&[13_u8, 42], &[42, 13]) }; assert!(!RAW_EQ_ARRAY...
const RAW_EQ_CHAR_TRUE: bool = unsafe { raw_eq(&'a', &'a') }; assert!(RAW_EQ_CHAR_TRUE);
random_line_split
main.rs
extern crate parolrs; extern crate sodiumoxide; use parolrs::core::{Parols, Parol}; use parolrs::utils::{load_database, save_database}; use sodiumoxide::crypto::secretbox::gen_nonce; // in 9.90user 3.55system 0:14.92elapsed 90%CPU :) fn main() { let mut parols = Parols::new(); for i in 0.. 100_000 { l...
"Ogromny", "admin", "blabla", ); parols.push(parol); } for i in 0.. 100 { let nonce = gen_nonce(); save_database(&parols, &nonce, "admin").unwrap(); if i == 99 { println!("load_database(\"admin\").ok().unwrap() = {:#?}", lo...
&format!("tox{}", i),
random_line_split
main.rs
extern crate parolrs; extern crate sodiumoxide; use parolrs::core::{Parols, Parol}; use parolrs::utils::{load_database, save_database}; use sodiumoxide::crypto::secretbox::gen_nonce; // in 9.90user 3.55system 0:14.92elapsed 90%CPU :) fn
() { let mut parols = Parols::new(); for i in 0.. 100_000 { let parol = Parol::new_with_arguments( &format!("tox{}", i), "Ogromny", "admin", "blabla", ); parols.push(parol); } for i in 0.. 100 { let nonce = gen_nonce(); ...
main
identifier_name
main.rs
extern crate parolrs; extern crate sodiumoxide; use parolrs::core::{Parols, Parol}; use parolrs::utils::{load_database, save_database}; use sodiumoxide::crypto::secretbox::gen_nonce; // in 9.90user 3.55system 0:14.92elapsed 90%CPU :) fn main() { let mut parols = Parols::new(); for i in 0.. 100_000 { l...
} }
{ load_database("admin").ok().unwrap(); }
conditional_block
main.rs
extern crate parolrs; extern crate sodiumoxide; use parolrs::core::{Parols, Parol}; use parolrs::utils::{load_database, save_database}; use sodiumoxide::crypto::secretbox::gen_nonce; // in 9.90user 3.55system 0:14.92elapsed 90%CPU :) fn main()
} }
{ let mut parols = Parols::new(); for i in 0 .. 100_000 { let parol = Parol::new_with_arguments( &format!("tox{}", i), "Ogromny", "admin", "blabla", ); parols.push(parol); } for i in 0 .. 100 { let nonce = gen_nonce(); ...
identifier_body
rec-align-u64.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
() -> uint { 12u } } #[cfg(target_arch = "x86_64")] pub mod m { pub fn align() -> uint { 8u } pub fn size() -> uint { 16u } } } #[cfg(target_os = "win32")] mod m { #[cfg(target_arch = "x86")] pub mod m { pub fn align() -> uint { 8u } pub fn size() -> uint { 16u ...
size
identifier_name
rec-align-u64.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
pub fn size() -> uint { 12u } } #[cfg(target_arch = "x86_64")] pub mod m { pub fn align() -> uint { 8u } pub fn size() -> uint { 16u } } } #[cfg(target_os = "win32")] mod m { #[cfg(target_arch = "x86")] pub mod m { pub fn align() -> uint { 8u } pub fn s...
{ 4u }
identifier_body
rec-align-u64.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. //
// option. This file may not be copied, modified, or distributed // except according to those terms. // xfail-fast: check-fast screws up repr paths // Issue #2303 use std::sys; mod rusti { extern "rust-intrinsic" { pub fn pref_align_of<T>() -> uint; pub fn min_align_of<T>() -> uint; } } // ...
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
random_line_split
issue-7013.rs
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
} } struct A { v: ~Foo, } fn main() { let a = A {v: ~B{v: None} as ~Foo}; //~ ERROR cannot pack type `~B`, which does not fulfill `Send` let v = RcMut::new(a); //~ ERROR instantiating a type parameter with an incompatible type let w = v.clone(); v.with_mut_borrow(|p| {p.v.set(w.clone());}) }
impl Foo for B { fn set(&mut self, v: RcMut<A>) { self.v = Some(v);
random_line_split
issue-7013.rs
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
() { let a = A {v: ~B{v: None} as ~Foo}; //~ ERROR cannot pack type `~B`, which does not fulfill `Send` let v = RcMut::new(a); //~ ERROR instantiating a type parameter with an incompatible type let w = v.clone(); v.with_mut_borrow(|p| {p.v.set(w.clone());}) }
main
identifier_name
mut_ref.rs
// Compiler: // // Run-time: // stdout: 2 // 7 // 6 // 11 #![allow(unused_attributes)] #![feature(auto_traits, lang_items, no_core, start, intrinsics, track_caller)] #![no_std] #![no_core] /* * Core */ // Because we don't have core yet. #[lang = "sized"] pub trait Sized {} #[lang = "copy"] trait C...
#[lang = "add"] trait Add<RHS = Self> { type Output; fn add(self, rhs: RHS) -> Self::Output; } impl Add for u8 { type Output = Self; fn add(self, rhs: Self) -> Self { self + rhs } } impl Add for i8 { type Output = Self; fn add(self, rhs: Self) -> Self { self + rhs ...
{ unsafe { libc::puts("Panicking\0" as *const str as *const u8); libc::fflush(libc::STDOUT); intrinsics::abort(); } }
identifier_body
mut_ref.rs
// Compiler: // // Run-time: // stdout: 2 // 7 // 6 // 11 #![allow(unused_attributes)] #![feature(auto_traits, lang_items, no_core, start, intrinsics, track_caller)] #![no_std] #![no_core] /* * Core */ // Because we don't have core yet. #[lang = "sized"] pub trait Sized {}
#[lang = "copy"] trait Copy { } impl Copy for isize {} impl Copy for *mut i32 {} impl Copy for usize {} impl Copy for u8 {} impl Copy for i8 {} impl Copy for i32 {} #[lang = "receiver"] trait Receiver { } #[lang = "freeze"] pub(crate) unsafe auto trait Freeze {} #[lang = "panic_location"] struct PanicLocation { ...
random_line_split
mut_ref.rs
// Compiler: // // Run-time: // stdout: 2 // 7 // 6 // 11 #![allow(unused_attributes)] #![feature(auto_traits, lang_items, no_core, start, intrinsics, track_caller)] #![no_std] #![no_core] /* * Core */ // Because we don't have core yet. #[lang = "sized"] pub trait Sized {} #[lang = "copy"] trait C...
(num: &mut isize) { *num = *num + 5; } #[start] fn main(mut argc: isize, _argv: *const *const u8) -> isize { let mut test = test(argc); unsafe { libc::printf(b"%ld\n\0" as *const u8 as *const i8, test.field); } update_num(&mut test.field); unsafe { libc::printf(b"%ld\n\0" as *co...
update_num
identifier_name
issue-84973-blacklist.rs
// Checks that certain traits for which we don't want to suggest borrowing // are blacklisted and don't cause the suggestion to be issued. #![feature(generators)] fn f_copy<T: Copy>(t: T) {} fn f_clone<T: Clone>(t: T) {} fn f_unpin<T: Unpin>(t: T) {} fn f_sized<T: Sized>(t: T) {} fn f_send<T: Send>(t: T) {} struct S...
}
random_line_split
issue-84973-blacklist.rs
// Checks that certain traits for which we don't want to suggest borrowing // are blacklisted and don't cause the suggestion to be issued. #![feature(generators)] fn
<T: Copy>(t: T) {} fn f_clone<T: Clone>(t: T) {} fn f_unpin<T: Unpin>(t: T) {} fn f_sized<T: Sized>(t: T) {} fn f_send<T: Send>(t: T) {} struct S; fn main() { f_copy("".to_string()); //~ ERROR: the trait bound `String: Copy` is not satisfied [E0277] f_clone(S); //~ ERROR: the trait bound `S: Clone` is not sat...
f_copy
identifier_name
issue-84973-blacklist.rs
// Checks that certain traits for which we don't want to suggest borrowing // are blacklisted and don't cause the suggestion to be issued. #![feature(generators)] fn f_copy<T: Copy>(t: T) {} fn f_clone<T: Clone>(t: T) {} fn f_unpin<T: Unpin>(t: T)
fn f_sized<T: Sized>(t: T) {} fn f_send<T: Send>(t: T) {} struct S; fn main() { f_copy("".to_string()); //~ ERROR: the trait bound `String: Copy` is not satisfied [E0277] f_clone(S); //~ ERROR: the trait bound `S: Clone` is not satisfied [E0277] f_unpin(static || { yield; }); //~^ ERROR: cannot be un...
{}
identifier_body
path_parsing.rs
extern crate memchr; use self::memchr::{memchr, memrchr}; use memrnchr::memrnchr; use std::path::MAIN_SEPARATOR; use std::str; pub const SEP: u8 = MAIN_SEPARATOR as u8; lazy_static! { pub static ref SEP_STR: &'static str = str::from_utf8(&[SEP]).unwrap(); } // Returns the byte offset of the last byte that equals M...
#[inline(always)] pub fn contains_sep(bytes: &[u8]) -> bool { memchr(SEP, bytes)!= None }
pub fn find_last_non_sep_pos(bytes: &[u8]) -> Option<usize> { memrnchr(SEP, bytes) } // Whether the given byte sequence contains a MAIN_SEPARATOR.
random_line_split
path_parsing.rs
extern crate memchr; use self::memchr::{memchr, memrchr}; use memrnchr::memrnchr; use std::path::MAIN_SEPARATOR; use std::str; pub const SEP: u8 = MAIN_SEPARATOR as u8; lazy_static! { pub static ref SEP_STR: &'static str = str::from_utf8(&[SEP]).unwrap(); } // Returns the byte offset of the last byte that equals M...
// Whether the given byte sequence contains a MAIN_SEPARATOR. #[inline(always)] pub fn contains_sep(bytes: &[u8]) -> bool { memchr(SEP, bytes)!= None }
{ memrnchr(SEP, bytes) }
identifier_body
path_parsing.rs
extern crate memchr; use self::memchr::{memchr, memrchr}; use memrnchr::memrnchr; use std::path::MAIN_SEPARATOR; use std::str; pub const SEP: u8 = MAIN_SEPARATOR as u8; lazy_static! { pub static ref SEP_STR: &'static str = str::from_utf8(&[SEP]).unwrap(); } // Returns the byte offset of the last byte that equals M...
(bytes: &[u8]) -> bool { memchr(SEP, bytes)!= None }
contains_sep
identifier_name
instr_cvtdq2ps.rs
use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode}; use ::RegType::*; use ::instruction_def::*; use ::Operand::*; use ::Reg::*; use ::RegScale::*; use ::test::run_test; #[test] fn cvtdq2ps_1()
#[test] fn cvtdq2ps_2() { run_test(&Instruction { mnemonic: Mnemonic::CVTDQ2PS, operand1: Some(Direct(XMM6)), operand2: Some(IndirectScaledDisplaced(ECX, Two, 829617393, Some(OperandSize::Xmmword), None)), operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, ...
{ run_test(&Instruction { mnemonic: Mnemonic::CVTDQ2PS, operand1: Some(Direct(XMM2)), operand2: Some(Direct(XMM2)), operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[15, 91, 210], OperandSize::Dword) }
identifier_body
instr_cvtdq2ps.rs
use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode}; use ::RegType::*; use ::instruction_def::*; use ::Operand::*; use ::Reg::*; use ::RegScale::*; use ::test::run_test; #[test] fn cvtdq2ps_1() { run_test(&Instruction { mnemonic: Mnemonic::CVTDQ2PS, operand1: Some(Direc...
() { run_test(&Instruction { mnemonic: Mnemonic::CVTDQ2PS, operand1: Some(Direct(XMM2)), operand2: Some(IndirectScaledDisplaced(RBX, Two, 1952076968, Some(OperandSize::Xmmword), None)), operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[1...
cvtdq2ps_4
identifier_name
instr_cvtdq2ps.rs
use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode}; use ::RegType::*; use ::instruction_def::*; use ::Operand::*; use ::Reg::*; use ::RegScale::*; use ::test::run_test; #[test]
fn cvtdq2ps_1() { run_test(&Instruction { mnemonic: Mnemonic::CVTDQ2PS, operand1: Some(Direct(XMM2)), operand2: Some(Direct(XMM2)), operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[15, 91, 210], OperandSize::Dword) } #[test] fn cvtdq2p...
random_line_split
mut-ptr-cant-outlive-ref.rs
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { } } impl<T> Fake for T { }
{ let m = RefCell::new(0); let p; { let b = m.borrow(); p = &*b; } //~^^ ERROR `b` does not live long enough p.use_ref(); }
identifier_body
mut-ptr-cant-outlive-ref.rs
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
(&mut self) { } fn use_ref(&self) { } } impl<T> Fake for T { }
use_mut
identifier_name
mut-ptr-cant-outlive-ref.rs
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT.
// option. This file may not be copied, modified, or distributed // except according to those terms. use std::cell::RefCell; fn main() { let m = RefCell::new(0); let p; { let b = m.borrow(); p = &*b; } //~^^ ERROR `b` does not live long enough p.use_ref(); } trait Fake { fn us...
// // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
random_line_split
cursor.rs
// Copyright 2013-2015, The Gtk-rs Project Developers. // See the COPYRIGHT file at the top-level directory of this distribution. // Licensed under the MIT license, see the LICENSE file or <http://opensource.org/licenses/MIT> use glib::translate::*; use display::Display; use pixbuf::Pixbuf; use ffi; pub type Type = f...
(display: &Display, pixbuf: &Pixbuf, x: i32, y: i32) -> Cursor { skip_assert_initialized!(); unsafe { from_glib_full( ffi::gdk_cursor_new_from_pixbuf(display.to_glib_none().0, pixbuf.to_glib_none().0, x, y)) } } pub fn new_from_name(displa...
new_from_pixbuf
identifier_name
cursor.rs
// Copyright 2013-2015, The Gtk-rs Project Developers. // See the COPYRIGHT file at the top-level directory of this distribution. // Licensed under the MIT license, see the LICENSE file or <http://opensource.org/licenses/MIT> use glib::translate::*; use display::Display; use pixbuf::Pixbuf; use ffi; pub type Type = f...
} pub fn new_from_pixbuf(display: &Display, pixbuf: &Pixbuf, x: i32, y: i32) -> Cursor { skip_assert_initialized!(); unsafe { from_glib_full( ffi::gdk_cursor_new_from_pixbuf(display.to_glib_none().0, pixbuf.to_glib_none().0, x, y)) } }...
pub fn new(cursor_type: Type) -> Cursor { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::gdk_cursor_new(cursor_type)) }
random_line_split
cursor.rs
// Copyright 2013-2015, The Gtk-rs Project Developers. // See the COPYRIGHT file at the top-level directory of this distribution. // Licensed under the MIT license, see the LICENSE file or <http://opensource.org/licenses/MIT> use glib::translate::*; use display::Display; use pixbuf::Pixbuf; use ffi; pub type Type = f...
}
{ unsafe { ffi::gdk_cursor_get_cursor_type(self.to_glib_none().0) } }
identifier_body
issue-59523-on-implemented-is-not-unused.rs
// We should not see the unused_attributes lint fire for // rustc_on_unimplemented, but with this bug we are seeing it fire (on // subsequent runs) if incremental compilation is enabled. // revisions: cfail1 cfail2 // build-pass (FIXME(62277): could be check-pass?) #![feature(rustc_attrs)] #![deny(unused_attributes)]...
(&self, index: usize) -> &i32 { &self[index] } } fn main() { Index::<usize>::index(&[1, 2, 3] as &[i32], 2); }
index
identifier_name
issue-59523-on-implemented-is-not-unused.rs
// We should not see the unused_attributes lint fire for // rustc_on_unimplemented, but with this bug we are seeing it fire (on // subsequent runs) if incremental compilation is enabled. // revisions: cfail1 cfail2 // build-pass (FIXME(62277): could be check-pass?) #![feature(rustc_attrs)] #![deny(unused_attributes)]...
{ Index::<usize>::index(&[1, 2, 3] as &[i32], 2); }
identifier_body
bench.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use cssparser::{Parser, SourcePosition}; use parking_lot::RwLock; use rayon; use servo_url::ServoUrl; use std::syn...
test::black_box(test_insertion_style_attribute(&r, &rules_matched)); } }) }) } }); }); }
test::black_box(test_insertion_style_attribute(&r, &rules_matched)); } s.spawn(|_| { for _ in 0..100 {
random_line_split
bench.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use cssparser::{Parser, SourcePosition}; use parking_lot::RwLock; use rayon; use servo_url::ServoUrl; use std::syn...
fn test_insertion(rule_tree: &RuleTree, rules: Vec<(StyleSource, CascadeLevel)>) -> StrongRuleNode { rule_tree.insert_ordered_rules(rules.into_iter()) } fn test_insertion_style_attribute(rule_tree: &RuleTree, rules: &[(StyleSource, CascadeLevel)]) -> StrongRuleNode { let mut rules = rules.to_vec(); rules...
{ let s = Stylesheet::from_str(css, ServoUrl::parse("http://localhost").unwrap(), Origin::Author, MediaList { media_queries: vec![], }, ...
identifier_body
bench.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use cssparser::{Parser, SourcePosition}; use parking_lot::RwLock; use rayon; use servo_url::ServoUrl; use std::syn...
(b: &mut Bencher) { let r = RuleTree::new(); // This test case tests a case where you style a bunch of siblings // matching the same rules, with a different style attribute each // one. let rules_matched = parse_rules( ".foo { width: 200px; } \ .bar { height: 500px; } \ .baz...
bench_expensive_insertion
identifier_name
instr_rsqrtps.rs
use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode}; use ::RegType::*; use ::instruction_def::*; use ::Operand::*; use ::Reg::*; use ::RegScale::*; use ::test::run_test; #[test] fn rsqrtps_1() { run_test(&Instruction { mnemonic: Mnemonic::RSQRTPS, operand1: Some(Direct(...
{ run_test(&Instruction { mnemonic: Mnemonic::RSQRTPS, operand1: Some(Direct(XMM3)), operand2: Some(IndirectScaledIndexed(RDX, RDX, Four, Some(OperandSize::Xmmword), None)), operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[15, 82, 28, 1...
identifier_body
instr_rsqrtps.rs
use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode}; use ::RegType::*; use ::instruction_def::*;
use ::RegScale::*; use ::test::run_test; #[test] fn rsqrtps_1() { run_test(&Instruction { mnemonic: Mnemonic::RSQRTPS, operand1: Some(Direct(XMM2)), operand2: Some(Direct(XMM6)), operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[15, 82,...
use ::Operand::*; use ::Reg::*;
random_line_split
instr_rsqrtps.rs
use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode}; use ::RegType::*; use ::instruction_def::*; use ::Operand::*; use ::Reg::*; use ::RegScale::*; use ::test::run_test; #[test] fn rsqrtps_1() { run_test(&Instruction { mnemonic: Mnemonic::RSQRTPS, operand1: Some(Direct(...
() { run_test(&Instruction { mnemonic: Mnemonic::RSQRTPS, operand1: Some(Direct(XMM0)), operand2: Some(Direct(XMM4)), operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[15, 82, 196], OperandSize::Qword) } #[test] fn rsqrtps_4() { run...
rsqrtps_3
identifier_name
target.rs
use std::str::FromStr; use once_cell::sync::Lazy; use regex::Regex; #[derive(Debug)] pub enum Target { Amd64Linux, Arm64Linux, ArmLinux, ArmV7Linux, ArmV7LinuxHardFloat, } impl Target { pub fn try_parse_env() -> Result<Target, <Self as FromStr>::Err> { FromStr::from_str(env!("BUILD_TA...
#[test] fn test_armv7_hard_float_matcher() { assert!(ARMV7_HARD_FLOAT.is_match("armv7-unknown-linux-gnueabihf")); assert!(ARMV7_HARD_FLOAT.is_match("armv7-unknown-linux-musleabihf")); } }
#[cfg(test)] mod tests { use super::*;
random_line_split
target.rs
use std::str::FromStr; use once_cell::sync::Lazy; use regex::Regex; #[derive(Debug)] pub enum Target { Amd64Linux, Arm64Linux, ArmLinux, ArmV7Linux, ArmV7LinuxHardFloat, } impl Target { pub fn try_parse_env() -> Result<Target, <Self as FromStr>::Err> { FromStr::from_str(env!("BUILD_TA...
(s: &str) -> Result<Self, Self::Err> { match s { x if x.starts_with("x86_64-unknown-linux-") => Ok(Target::Amd64Linux), x if x.starts_with("aarch64-unknown-linux-") => Ok(Target::Arm64Linux), x if ARMV7_HARD_FLOAT.is_match(x) => Ok(Target::ArmV7LinuxHardFloat), x ...
from_str
identifier_name
target.rs
use std::str::FromStr; use once_cell::sync::Lazy; use regex::Regex; #[derive(Debug)] pub enum Target { Amd64Linux, Arm64Linux, ArmLinux, ArmV7Linux, ArmV7LinuxHardFloat, } impl Target { pub fn try_parse_env() -> Result<Target, <Self as FromStr>::Err> { FromStr::from_str(env!("BUILD_TA...
} static ARMV7_HARD_FLOAT: Lazy<Regex> = Lazy::new(|| Regex::new(r"armv7-unknown-linux.*hf").unwrap()); #[cfg(test)] mod tests { use super::*; #[test] fn test_armv7_hard_float_matcher() { assert!(ARMV7_HARD_FLOAT.is_match("armv7-unknown-linux-gnueabihf")); assert!(ARMV7_HARD_FLOAT.is...
{ match s { x if x.starts_with("x86_64-unknown-linux-") => Ok(Target::Amd64Linux), x if x.starts_with("aarch64-unknown-linux-") => Ok(Target::Arm64Linux), x if ARMV7_HARD_FLOAT.is_match(x) => Ok(Target::ArmV7LinuxHardFloat), x if x.starts_with("armv7-unknown-linux...
identifier_body
lib.rs
//! A macro that maps unicode names to chars and strings. #![crate_type="dylib"] #![feature(quote, plugin_registrar, plugin, rustc_private)] #![plugin(regex_macros)] extern crate syntax; extern crate rustc; extern crate regex; extern crate unicode_names; use syntax::ast; use syntax::codemap; use syntax::parse::t...
(cx: &mut ExtCtxt, sp: codemap::Span, tts: &[ast::TokenTree]) -> Box<MacResult+'static> { let string = match base::get_single_str_from_tts(cx, sp, tts, "named") { None => return DummyResult::expr(sp), Some(s) => s }; // make sure unclosed braces don't escape. static NAMES: regex::Regex...
named
identifier_name
lib.rs
//! A macro that maps unicode names to chars and strings. #![crate_type="dylib"] #![feature(quote, plugin_registrar, plugin, rustc_private)] #![plugin(regex_macros)] extern crate syntax; extern crate rustc; extern crate regex; extern crate unicode_names; use syntax::ast; use syntax::codemap; use syntax::parse::t...
let new = NAMES.replace_all(&string, |c: &regex::Captures| { let full = c.at(0).unwrap(); if!full.ends_with("}") { cx.span_err(sp, &format!("unclosed escape in `named!`: {}", full)); } else { let name = c.at(1).unwrap(); match unicode_names::character(name...
random_line_split
lib.rs
//! A macro that maps unicode names to chars and strings. #![crate_type="dylib"] #![feature(quote, plugin_registrar, plugin, rustc_private)] #![plugin(regex_macros)] extern crate syntax; extern crate rustc; extern crate regex; extern crate unicode_names; use syntax::ast; use syntax::codemap; use syntax::parse::t...
fn named_char(cx: &mut ExtCtxt, sp: codemap::Span, tts: &[ast::TokenTree]) -> Box<MacResult+'static> { match base::get_single_str_from_tts(cx, sp, tts, "named_char") { None => {} Some(name) => match unicode_names::character(&name) { None => cx.span_err(sp, &format!("`{}` d...
{ registrar.register_macro("named_char", named_char); registrar.register_macro("named", named); }
identifier_body
lib.rs
//! A macro that maps unicode names to chars and strings. #![crate_type="dylib"] #![feature(quote, plugin_registrar, plugin, rustc_private)] #![plugin(regex_macros)] extern crate syntax; extern crate rustc; extern crate regex; extern crate unicode_names; use syntax::ast; use syntax::codemap; use syntax::parse::t...
} } // failed :( String::new() }); MacEager::expr(cx.expr_str(sp, token::intern_and_get_ident(&new))) }
{ cx.span_err(sp, &format!("`{}` does not name a character", name)); }
conditional_block
content_encoding.rs
use brotli::enc::backward_references::{BrotliEncoderParams, BrotliEncoderMode}; use brotli::enc::BrotliCompress as brotli_compress; use flate2::write::{DeflateEncoder, GzEncoder}; use flate2::Compression as Flate2Compression; use iron::headers::{QualityItem, Encoding}; use bzip2::Compression as BzCompression; use std::...
(requested: &mut [QualityItem<Encoding>]) -> Option<Encoding> { requested.sort_by_key(|e| e.quality); requested.iter().filter(|e| e.quality.0!= 0).find(|e| SUPPORTED_ENCODINGS.contains(&e.item)).map(|e| e.item.clone()) } /// Encode a string slice using a specified encoding or `None` if encoding failed or is no...
response_encoding
identifier_name
content_encoding.rs
use brotli::enc::backward_references::{BrotliEncoderParams, BrotliEncoderMode}; use brotli::enc::BrotliCompress as brotli_compress; use flate2::write::{DeflateEncoder, GzEncoder}; use flate2::Compression as Flate2Compression; use iron::headers::{QualityItem, Encoding}; use bzip2::Compression as BzCompression; use std::...
/// Find best supported encoding to use, or `None` for identity. pub fn response_encoding(requested: &mut [QualityItem<Encoding>]) -> Option<Encoding> { requested.sort_by_key(|e| e.quality); requested.iter().filter(|e| e.quality.0!= 0).find(|e| SUPPORTED_ENCODINGS.contains(&e.item)).map(|e| e.item.clone()) } ...
pub const MAX_ENCODING_SIZE: u64 = 100 * 1024 * 1024; /// The minimal size gain at which to preserve encoded filesystem files. pub const MIN_ENCODING_GAIN: f64 = 1.1;
random_line_split
content_encoding.rs
use brotli::enc::backward_references::{BrotliEncoderParams, BrotliEncoderMode}; use brotli::enc::BrotliCompress as brotli_compress; use flate2::write::{DeflateEncoder, GzEncoder}; use flate2::Compression as Flate2Compression; use iron::headers::{QualityItem, Encoding}; use bzip2::Compression as BzCompression; use std::...
{ brotli_compress(&mut inf, &mut outf, &BROTLI_PARAMS).is_ok() }
identifier_body
lex-bad-char-literals.rs
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
; static c: char = '\●' //~ ERROR: unknown character escape ; static s: &'static str = "\●" //~ ERROR: unknown character escape ; // THIS MUST BE LAST, since unterminated character constants kill the lexer static c: char = '● //~ ERROR: unterminated character constant ;
; static s2: &'static str = "\u23q" //~ ERROR: illegal character in numeric character escape //~^ ERROR: numeric character escape is too short
random_line_split
lib.rs
// Copyright 2019 The Chromium OS Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. //! Support crate for writing fuzzers in Chrome OS. //! //! The major features provided by this crate are: //! //! * The [`fuzz_target`] macro which wr...
/// /// # Examples /// /// ``` /// use std::str; /// # #[macro_use] extern crate cros_fuzz; /// /// fuzz_target!(|data: &[u8]| { /// let _ = str::from_utf8(data); /// }); /// /// # fn main() { /// # let buf = b"hello, world!"; /// # llvm_fuzzer_test_one_input(buf.as_ptr(), buf.len()); /// # } /// ``` #[macro_...
random_line_split
mod.rs
use crate::types::game::paddock::PaddockInformationsForSell; use crate::types::game::paddock::PaddockInstancesInformations; use protocol_derive::{Decode, Encode}; #[derive(Clone, PartialEq, Debug, Encode, Decode)] #[protocol(id = 5824)] pub struct PaddockPropertiesMessage<'a> { pub properties: PaddockInstancesInfo...
<'a> { pub area_id: i32, pub at_least_nb_mount: i8, pub at_least_nb_machine: i8, #[protocol(var)] pub max_price: u64, pub order_by: u8, pub _phantom: std::marker::PhantomData<&'a ()>, } #[derive(Clone, PartialEq, Debug, Encode, Decode)] #[protocol(id = 6018)] pub struct PaddockSellBuyDialog...
PaddockToSellFilterMessage
identifier_name
mod.rs
use crate::types::game::paddock::PaddockInformationsForSell; use crate::types::game::paddock::PaddockInstancesInformations; use protocol_derive::{Decode, Encode}; #[derive(Clone, PartialEq, Debug, Encode, Decode)] #[protocol(id = 5824)] pub struct PaddockPropertiesMessage<'a> { pub properties: PaddockInstancesInfo...
#[protocol(var)] pub page_index: u16, pub _phantom: std::marker::PhantomData<&'a ()>, } #[derive(Clone, PartialEq, Debug, Encode, Decode)] #[protocol(id = 6026)] pub struct GameDataPlayFarmObjectAnimationMessage<'a> { #[protocol(var_contents)] pub cell_id: std::borrow::Cow<'a, [u16]>, } #[derive(C...
#[derive(Clone, PartialEq, Debug, Encode, Decode)] #[protocol(id = 6141)] pub struct PaddockToSellListRequestMessage<'a> {
random_line_split
lib.rs
// Tifflin OS - Asynchronous common interface // - By John Hodge (thePowersGang) // // //! Asynchronous waiting support #[macro_use] extern crate syscalls; /// Trait for types that can be used for 'idle_loop' pub trait WaitController { fn get_count(&self) -> usize; fn populate(&self, cb: &mut FnMut(::syscalls::Wait...
(items: &mut [&mut WaitController]) { let mut objects = Vec::new(); loop { let count = items.iter().fold(0, |sum,ctrlr| sum + ctrlr.get_count()); objects.reserve( count ); for ctrlr in items.iter() { ctrlr.populate(&mut |wi| objects.push(wi)); } ::syscalls::threads::wait(&mut objects,!0); let mut of...
idle_loop
identifier_name
lib.rs
// Tifflin OS - Asynchronous common interface // - By John Hodge (thePowersGang) // // //! Asynchronous waiting support #[macro_use] extern crate syscalls; /// Trait for types that can be used for 'idle_loop' pub trait WaitController { fn get_count(&self) -> usize; fn populate(&self, cb: &mut FnMut(::syscalls::Wait...
let count = items.iter().fold(0, |sum,ctrlr| sum + ctrlr.get_count()); objects.reserve( count ); for ctrlr in items.iter() { ctrlr.populate(&mut |wi| objects.push(wi)); } ::syscalls::threads::wait(&mut objects,!0); let mut ofs = 0; for ctrlr in items.iter_mut() { let num = ctrlr.get_count(); ...
{ let mut objects = Vec::new(); loop {
random_line_split
lib.rs
// Tifflin OS - Asynchronous common interface // - By John Hodge (thePowersGang) // // //! Asynchronous waiting support #[macro_use] extern crate syscalls; /// Trait for types that can be used for 'idle_loop' pub trait WaitController { fn get_count(&self) -> usize; fn populate(&self, cb: &mut FnMut(::syscalls::Wait...
objects.clear(); } }
{ let mut objects = Vec::new(); loop { let count = items.iter().fold(0, |sum,ctrlr| sum + ctrlr.get_count()); objects.reserve( count ); for ctrlr in items.iter() { ctrlr.populate(&mut |wi| objects.push(wi)); } ::syscalls::threads::wait(&mut objects, !0); let mut ofs = 0; for ctrlr in items.iter_mu...
identifier_body
metadata.rs
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
{ pub filename: String, pub line: usize } impl ErrorLocation { /// Create an error location from a span. pub fn from_span(ecx: &ExtCtxt, sp: Span) -> ErrorLocation { let loc = ecx.codemap().lookup_char_pos_adj(sp.lo); ErrorLocation { filename: loc.filename, line...
ErrorLocation
identifier_name
metadata.rs
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
/// Write metadata for the errors in `err_map` to disk, to a file corresponding to `prefix/name`. /// /// For our current purposes the prefix is the target architecture and the name is a crate name. /// If an error occurs steps will be taken to ensure that no file is created. pub fn output_metadata(ecx: &ExtCtxt, pre...
{ directory.join(format!("{}.json", name)) }
identifier_body
metadata.rs
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
Ok(result?) }
{ remove_file(&metadata_path)?; }
conditional_block
metadata.rs
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
pub struct ErrorLocation { pub filename: String, pub line: usize } impl ErrorLocation { /// Create an error location from a span. pub fn from_span(ecx: &ExtCtxt, sp: Span) -> ErrorLocation { let loc = ecx.codemap().lookup_char_pos_adj(sp.lo); ErrorLocation { filename: loc.fi...
/// JSON encodable error location type with filename and line number. #[derive(PartialEq, Deserialize, Serialize)]
random_line_split
cleanup.rs
extern crate diesel; extern crate dotenv; extern crate kuchiki; extern crate rusoto_core; extern crate rusoto_credential; extern crate rusoto_s3; extern crate server; extern crate url; use diesel::pg::PgConnection; use diesel::prelude::*; use dotenv::dotenv; use kuchiki::traits::*; use rusoto_core::Region; use rusoto_...
() { use server::schema::ads::dsl::*; dotenv().ok(); start_logging(); let database_url = env::var("DATABASE_URL").expect("DATABASE_URL must be set"); let conn = PgConnection::establish(&database_url).unwrap(); let dbads: Vec<Ad> = ads.order(created_at.desc()).load::<Ad>(&conn).unwrap(); for...
main
identifier_name
cleanup.rs
extern crate diesel; extern crate dotenv; extern crate kuchiki; extern crate rusoto_core; extern crate rusoto_credential; extern crate rusoto_s3; extern crate server; extern crate url; use diesel::pg::PgConnection; use diesel::prelude::*; use dotenv::dotenv; use kuchiki::traits::*; use rusoto_core::Region; use rusoto_...
} } ret = true; } for comment in document.select(".commentable_item").unwrap() { comment.as_node().detach(); ret = true; } ad.html = document .select("div") .unwrap() .nth(0) .unwrap() .as_node() .to_string(); a...
{ println!("Couldn't delete {} {:?}", src, res); }
conditional_block
cleanup.rs
extern crate diesel; extern crate dotenv; extern crate kuchiki; extern crate rusoto_core; extern crate rusoto_credential; extern crate rusoto_s3; extern crate server; extern crate url; use diesel::pg::PgConnection; use diesel::prelude::*; use dotenv::dotenv; use kuchiki::traits::*; use rusoto_core::Region; use rusoto_...
.unwrap(); } else { println!("Skipped {}", ad.id); } } }
{ use server::schema::ads::dsl::*; dotenv().ok(); start_logging(); let database_url = env::var("DATABASE_URL").expect("DATABASE_URL must be set"); let conn = PgConnection::establish(&database_url).unwrap(); let dbads: Vec<Ad> = ads.order(created_at.desc()).load::<Ad>(&conn).unwrap(); for mu...
identifier_body
cleanup.rs
extern crate diesel; extern crate dotenv; extern crate kuchiki; extern crate rusoto_core; extern crate rusoto_credential; extern crate rusoto_s3; extern crate server; extern crate url; use diesel::pg::PgConnection; use diesel::prelude::*; use dotenv::dotenv; use kuchiki::traits::*; use rusoto_core::Region; use rusoto_...
.unwrap() .as_node() .to_string(); ad.images = images; ret } fn main() { use server::schema::ads::dsl::*; dotenv().ok(); start_logging(); let database_url = env::var("DATABASE_URL").expect("DATABASE_URL must be set"); let conn = PgConnection::establish(&database_url).u...
ad.html = document .select("div") .unwrap() .nth(0)
random_line_split
syst_rvr.rs
#[doc = "Register `SYST_RVR` reader"] pub struct R(crate::R<SYST_RVR_SPEC>); impl core::ops::Deref for R { type Target = crate::R<SYST_RVR_SPEC>; #[inline(always)] fn deref(&self) -> &Self::Target { &self.0 } } impl From<crate::R<SYST_RVR_SPEC>> for R { #[inline(always)] fn from(reader: ...
0 } }
#[doc = "`reset()` method sets SYST_RVR to value 0"] impl crate::Resettable for SYST_RVR_SPEC { #[inline(always)] fn reset_value() -> Self::Ux {
random_line_split
syst_rvr.rs
#[doc = "Register `SYST_RVR` reader"] pub struct R(crate::R<SYST_RVR_SPEC>); impl core::ops::Deref for R { type Target = crate::R<SYST_RVR_SPEC>; #[inline(always)] fn deref(&self) -> &Self::Target { &self.0 } } impl From<crate::R<SYST_RVR_SPEC>> for R { #[inline(always)] fn from(reader: ...
} #[doc = "SysTick Reload Value Register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#re...
{ self.0.bits(bits); self }
identifier_body
syst_rvr.rs
#[doc = "Register `SYST_RVR` reader"] pub struct R(crate::R<SYST_RVR_SPEC>); impl core::ops::Deref for R { type Target = crate::R<SYST_RVR_SPEC>; #[inline(always)] fn deref(&self) -> &Self::Target { &self.0 } } impl From<crate::R<SYST_RVR_SPEC>> for R { #[inline(always)] fn from(reader: ...
(self, value: u32) -> &'a mut W { self.w.bits = (self.w.bits &!0x00ff_ffff) | (value as u32 & 0x00ff_ffff); self.w } } impl R { #[doc = "Bits 0:23 - Reload Value"] #[inline(always)] pub fn reload(&self) -> RELOAD_R { RELOAD_R::new((self.bits & 0x00ff_ffff) as u32) } } impl W ...
bits
identifier_name
generic-function.rs
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
() {()}
zzz
identifier_name
generic-function.rs
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
// lldb-command:print *t0 // lldb-check:[...]$6 = 5 // lldb-command:print *t1 // lldb-check:[...]$7 = Struct { a: 6, b: 7.5 } // lldb-command:print ret // lldb-check:[...]$8 = ((5, Struct { a: 6, b: 7.5 }), (Struct { a: 6, b: 7.5 }, 5)) // lldb-command:continue #![omit_gdb_pretty_printer_section] #[derive(Clone)] st...
// lldb-command:print ret // lldb-check:[...]$5 = ((3.5, 4), (4, 3.5)) // lldb-command:continue
random_line_split
mod.rs
////////////////////////////////////////////////////////////////////////////// // File: rust-worldgen/noise/perlin/mod.rs ////////////////////////////////////////////////////////////////////////////// // Copyright 2015 Samuel Sleight // // Licensed under the Apache License, Version 2.0 (the "License"); // you may n...
/// # use worldgen::noise::perlin::{PerlinNoise, Octaves}; /// # use worldgen::noise::NoiseProvider; /// let noise = PerlinNoise::new() /// .set(Octaves::of(5)); /// /// let value = noise.generate(1.5, 2.5, 15); /// ``` #[derive(Default, Debug, Copy, Clone)] pub struct PerlinNoise { octaves: Octaves, freq: F...
/// ```
random_line_split
mod.rs
////////////////////////////////////////////////////////////////////////////// // File: rust-worldgen/noise/perlin/mod.rs ////////////////////////////////////////////////////////////////////////////// // Copyright 2015 Samuel Sleight // // Licensed under the Apache License, Version 2.0 (the "License"); // you may n...
(self, octaves: Octaves) -> PerlinNoise { PerlinNoise { octaves, ..self } } fn set_frequency(self, freq: Frequency) -> PerlinNoise { PerlinNoise { freq, ..self } } fn set_persistence(self, pers: Persistence) -> PerlinNoise {...
set_octaves
identifier_name
mod.rs
////////////////////////////////////////////////////////////////////////////// // File: rust-worldgen/noise/perlin/mod.rs ////////////////////////////////////////////////////////////////////////////// // Copyright 2015 Samuel Sleight // // Licensed under the Apache License, Version 2.0 (the "License"); // you may n...
} impl NoiseProvider for PerlinNoise { fn generate(&self, x: f64, y: f64, seed: u64) -> f64 { let mut x = x * self.freq.value; let mut y = y * self.freq.value; let mut pers = 1.0f64; (0.. self.octaves.value).fold(0.0, |value, octave| { let seed = seed + octave as u64; ...
{ PerlinNoise { lacu, ..self } }
identifier_body
list.rs
//! This module has containers for storing the tasks spawned on a scheduler. The //! `OwnedTasks` container is thread-safe but can only store tasks that //! implement Send. The `LocalOwnedTasks` container is not thread safe, but can //! store non-Send tasks. //! //! The collections can be closed to prevent adding new t...
(&self, task: Notified<S>) -> LocalNotified<S> { assert_eq!(task.header().get_owner_id(), self.id); // safety: All tasks bound to this OwnedTasks are Send, so it is safe // to poll it on this thread no matter what thread we are on. LocalNotified { task: task.0, _...
assert_owner
identifier_name
list.rs
//! This module has containers for storing the tasks spawned on a scheduler. The //! `OwnedTasks` container is thread-safe but can only store tasks that //! implement Send. The `LocalOwnedTasks` container is not thread safe, but can //! store non-Send tasks. //! //! The collections can be closed to prevent adding new t...
} } pub(crate) fn remove(&self, task: &Task<S>) -> Option<Task<S>> { let task_id = task.header().get_owner_id(); if task_id == 0 { // The task is unowned. return None; } assert_eq!(task_id, self.id); // safety: We just checked that the ...
{ // The first iteration of the loop was unrolled so it can set the // closed bool. let first_task = { let mut lock = self.inner.lock(); lock.closed = true; lock.list.pop_back() }; match first_task { Some(task) => task.shutdown(), ...
identifier_body
list.rs
//! This module has containers for storing the tasks spawned on a scheduler. The //! `OwnedTasks` container is thread-safe but can only store tasks that //! implement Send. The `LocalOwnedTasks` container is not thread safe, but can //! store non-Send tasks. //! //! The collections can be closed to prevent adding new t...
/// it to a LocalNotified, giving the thread permission to poll this task. #[inline] pub(crate) fn assert_owner(&self, task: Notified<S>) -> LocalNotified<S> { assert_eq!(task.header().get_owner_id(), self.id); // safety: The task was bound to this LocalOwnedTasks, and the // LocalO...
} /// Asserts that the given task is owned by this LocalOwnedTasks and convert
random_line_split
dst-dtor-1.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. static mut DROP_RAN...
// http://rust-lang.org/COPYRIGHT. //
random_line_split
dst-dtor-1.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
() { { // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let _x: Box<Fat<Trait>> = Box::<Fat<Foo>>::new(Fat { f: Foo }); } unsafe { assert!(DROP_RAN); } }
main
identifier_name
dst-dtor-1.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
} trait Trait { fn dummy(&self) { } } impl Trait for Foo {} struct Fat<T:?Sized> { f: T } pub fn main() { { // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let _x: Box<Fat<Trait>> = Box::<Fat<Foo>>::new(Fat { f: Foo }); } unsafe { assert!(DROP_RAN); ...
{ unsafe { DROP_RAN = true; } }
identifier_body
lib.rs
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
#![unstable(feature = "rustc_private")] #![staged_api] #![crate_type = "dylib"] #![crate_type = "rlib"] #![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/nightly/")] #![a...
#![crate_name = "rustc_borrowck"]
random_line_split
qquote.rs
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
expr: T, f: |pprust::ps, T|, expect: StrBuf) { let s = io::with_str_writer(|wr| { let pp = pprust::rust_printer(wr, cx.parse_sess().interner); f(pp, expr); pp::eof(pp.s); }); stdout().write_line(s); if expect!= "".to_owned() { println!("expect: '%s', got: '...
} fn check_pp<T>(cx: fake_ext_ctxt,
random_line_split
qquote.rs
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
fn call_site() -> span { codemap::span { lo: codemap::BytePos(0), hi: codemap::BytePos(0), expn_info: None } } fn ident_of(st: &str) -> ast::ident { self.interner.intern(st) } } fn mk_ctxt() -> fake_ext_ctxt { parse::new_parse_sess(None) ...
{ self }
identifier_body
qquote.rs
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
() { let cx = mk_ctxt(); let abc = quote_expr!(cx, 23); check_pp(ext_cx, abc, pprust::print_expr, "23".to_owned()); let ty = quote_ty!(cx, int); check_pp(ext_cx, ty, pprust::print_type, "int".to_owned()); let item = quote_item!(cx, static x : int = 10;).get(); check_pp(ext_cx, item, ppr...
main
identifier_name
qquote.rs
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
}
{ println!("expect: '%s', got: '%s'", expect, s); assert_eq!(s, expect); }
conditional_block
borrowck-borrow-overloaded-auto-deref-mut.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
pub fn main() {}
{ *x.y_mut() = 3; }
identifier_body
borrowck-borrow-overloaded-auto-deref-mut.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
self.y = y; } fn x_ref(&self) -> &int { &self.x } fn y_mut(&mut self) -> &mut int { &mut self.y } } fn deref_imm_field(x: Own<Point>) { let _i = &x.y; } fn deref_mut_field1(x: Own<Point>) { let _i = &mut x.y; //~ ERROR cannot borrow } fn deref_mut_field2(mut x: O...
fn set(&mut self, x: int, y: int) { self.x = x;
random_line_split
borrowck-borrow-overloaded-auto-deref-mut.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
<'a>(x: &'a Own<Point>) { *x.y_mut() = 3; //~ ERROR cannot borrow } fn assign_method3<'a>(x: &'a mut Own<Point>) { *x.y_mut() = 3; } pub fn main() {}
assign_method2
identifier_name
size_of_tests.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use cssparser::ToCss; use gecko_like_types; use gecko_like_types::*; use parser; use parser::*; use precomputed_ha...
(_: String) -> Self { unimplemented!() } } impl<'a> From<&'a str> for Atom { fn from(_: &'a str) -> Self { unimplemented!() } } impl PrecomputedHash for Atom { fn precomputed_hash(&self) -> u32 { unimplemented!() } }
from
identifier_name
size_of_tests.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use cssparser::ToCss; use gecko_like_types; use gecko_like_types::*; use parser; use parser::*; use precomputed_ha...
} impl<'a> From<&'a str> for Atom { fn from(_: &'a str) -> Self { unimplemented!() } } impl PrecomputedHash for Atom { fn precomputed_hash(&self) -> u32 { unimplemented!() } }
{ unimplemented!() }
identifier_body
size_of_tests.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use cssparser::ToCss; use gecko_like_types; use gecko_like_types::*; use parser; use parser::*; use precomputed_ha...
size_of_test!(size_of_selector_inner, SelectorInner<Impl>, 40); size_of_test!(size_of_complex_selector, ComplexSelector<Impl>, 24); size_of_test!(size_of_component, Component<Impl>, 32); size_of_test!(size_of_pseudo_class, PseudoClass, 24); impl parser::PseudoElement for gecko_like_types::PseudoElement { type Imp...
use visitor::SelectorVisitor; size_of_test!(size_of_selector, Selector<Impl>, 48); size_of_test!(size_of_pseudo_element, gecko_like_types::PseudoElement, 1);
random_line_split
compl.rs
use std::env; use std::fs; use sym::Symtable; extern crate glob; fn common_prefix(mut strs: Vec<String>) -> String { let mut c_prefix = String::new(); if strs.len() == 0 { return c_prefix; } let delegate = strs.pop().unwrap().clone(); for (di, dc) in delegate.chars().enumerate() { ...
(in_str: &str, st: &Symtable, first_word: bool, print_multi: bool) -> String { if first_word &&!in_str.contains('/') { bin_complete(in_str, st, print_multi) } else { fs_complete(in_str, print_multi) } } pub fn bin_complete(in_str: &str, st: &Symtable, print_multi: bool) -> String { let ...
complete
identifier_name
compl.rs
use std::env; use std::fs; use sym::Symtable; extern crate glob; fn common_prefix(mut strs: Vec<String>) -> String { let mut c_prefix = String::new(); if strs.len() == 0 { return c_prefix; } let delegate = strs.pop().unwrap().clone(); for (di, dc) in delegate.chars().enumerate() { ...
None => { return c_prefix; } } } c_prefix.push(dc); } c_prefix } fn print_completions(res_vec: &Vec<String>) { // TODO: prettier println!(""); for p in res_vec { println!("{}", p); } } pub fn complete(in_...
{ if dc != oc { return c_prefix; } }
conditional_block
compl.rs
use std::env; use std::fs; use sym::Symtable; extern crate glob; fn common_prefix(mut strs: Vec<String>) -> String { let mut c_prefix = String::new(); if strs.len() == 0 { return c_prefix; } let delegate = strs.pop().unwrap().clone(); for (di, dc) in delegate.chars().enumerate() { ...
pub fn complete(in_str: &str, st: &Symtable, first_word: bool, print_multi: bool) -> String { if first_word &&!in_str.contains('/') { bin_complete(in_str, st, print_multi) } else { fs_complete(in_str, print_multi) } } pub fn bin_complete(in_str: &str, st: &Symtable, print_multi: bool) -> ...
{ // TODO: prettier println!(""); for p in res_vec { println!("{}", p); } }
identifier_body
compl.rs
use std::env; use std::fs; use sym::Symtable; extern crate glob; fn common_prefix(mut strs: Vec<String>) -> String { let mut c_prefix = String::new(); if strs.len() == 0 { return c_prefix; } let delegate = strs.pop().unwrap().clone(); for (di, dc) in delegate.chars().enumerate() { ...
pub fn complete(in_str: &str, st: &Symtable, first_word: bool, print_multi: bool) -> String { if first_word &&!in_str.contains('/') { bin_complete(in_str, st, print_multi) } else { fs_complete(in_str, print_multi) } } pub fn bin_complete(in_str: &str, st: &Symtable, print_multi: bool) -> S...
}
random_line_split
io.rs
// // imag - the personal information management suite for the commandline // Copyright (C) 2015-2020 Matthias Beyer <mail@beyermatthias.de> and contributors // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the F...
(&mut self, buf: &[u8]) -> ::std::io::Result<usize> { match *self { LockedOutputProxy::Out(ref mut r) => r.write(buf), LockedOutputProxy::Err(ref mut r) => r.write(buf), LockedOutputProxy::Sink => Ok(buf.len()), } } fn flush(&mut self) -> ::std::io::Result<...
write
identifier_name
io.rs
// // imag - the personal information management suite for the commandline // Copyright (C) 2015-2020 Matthias Beyer <mail@beyermatthias.de> and contributors // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the F...
} impl Debug for OutputProxy { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error> { match *self { OutputProxy::Out(..) => write!(f, "OutputProxy(Stdout)"), OutputProxy::Err(..) => write!(f, "OutputProxy(Stderr)"), OutputProxy::Sink => write...
OutputProxy::Sink => Ok(()), } }
random_line_split
test.rs
use std::marker::PhantomData; //TODO merge_left/merge_right/split_left/split_right for lifetimes //TODO existentials: https://github.com/bluss/indexing //This is a transparent wrapper over a slice, with two run-time type tags for the beginning and the //end of the slice pub struct SliceFragment<'a, T: 'a, A, B>( ...
} //Merge is only allowed if the end marker of the first slice fragment coincides with the begin //marker of the second slice fragment pub fn merge<'a, 'b, 'c: 'a + 'b, T: 'a, A, B, C>( SliceFragment(slice1, begin1, _): SliceFragment<'a, T, A, B>, SliceFragment(slice2, _, end2) : SliceFragment<'b, T, B, C> ...
{ SliceFragment( slice, PhantomData, PhantomData ) }
identifier_body
test.rs
use std::marker::PhantomData; //TODO merge_left/merge_right/split_left/split_right for lifetimes //TODO existentials: https://github.com/bluss/indexing //This is a transparent wrapper over a slice, with two run-time type tags for the beginning and the //end of the slice pub struct
<'a, T: 'a, A, B>( pub &'a mut [T], PhantomData<A>, PhantomData<B> ); impl<'a, T: 'a + Sized, A, B> SliceFragment<'a, T, A, B> { //Creating an empty slice fragment, for demonstration purposes. //Note that the beginning and end markers are the same. pub fn empty(slice: &'a mut [T; 0]) -> SliceF...
SliceFragment
identifier_name
test.rs
use std::marker::PhantomData; //TODO merge_left/merge_right/split_left/split_right for lifetimes //TODO existentials: https://github.com/bluss/indexing //This is a transparent wrapper over a slice, with two run-time type tags for the beginning and the //end of the slice pub struct SliceFragment<'a, T: 'a, A, B>( ...
pub fn split<'a, T: 'a, A, B, C>( SliceFragment(slice, begin1, end2): SliceFragment<'a, T, A, C>, index: usize ) -> (SliceFragment<'a, T, A, B>, SliceFragment<'a, T, B, C>) { let end1: PhantomData<B> = PhantomData; let begin2: PhantomData<B> = PhantomData; let (slice1, slice2) = slice.split_at_m...
} //NOT TYPE SAFE if any of A, B or C are the same type
random_line_split
cors_cache.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //! An implementation of the [CORS preflight cache](https://fetch.spec.whatwg.org/#cors-preflight-cache) //! For n...
(&mut self, request: &Request, method: Method) -> bool { self.find_entry_by_method(&request, method).is_some() } /// Updates max age if an entry for /// [a matching method](https://fetch.spec.whatwg.org/#concept-cache-match-method) is found. /// /// If not, it will insert an equivalent entr...
match_method
identifier_name
cors_cache.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //! An implementation of the [CORS preflight cache](https://fetch.spec.whatwg.org/#cors-preflight-cache) //! For n...
impl CorsCacheEntry { fn new(origin: Origin, url: ServoUrl, max_age: u32, credentials: bool, header_or_method: HeaderOrMethod) -> CorsCacheEntry { CorsCacheEntry { origin: origin, url: url, max_age: max_age, credentials: credentials, h...
pub max_age: u32, pub credentials: bool, pub header_or_method: HeaderOrMethod, created: Timespec }
random_line_split
cors_cache.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //! An implementation of the [CORS preflight cache](https://fetch.spec.whatwg.org/#cors-preflight-cache) //! For n...
/// A simple, vector-based CORS Cache #[derive(Clone)] pub struct CorsCache(Vec<CorsCacheEntry>); impl CorsCache { pub fn new() -> CorsCache { CorsCache(vec![]) } fn find_entry_by_header<'a>(&'a mut self, request: &Request, header_name: &str) -> Option<&'a mut Cor...
{ cors_cache.origin == cors_req.origin && cors_cache.url == cors_req.current_url() && (cors_cache.credentials || cors_req.credentials_mode != CredentialsMode::Include) }
identifier_body