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 |
|---|---|---|---|---|
sudoku.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... | (g: grid) -> Sudoku {
return Sudoku { grid: g }
}
pub fn from_vec(vec: &[[u8;9];9]) -> Sudoku {
let g = (0..9u).map(|i| {
(0..9u).map(|j| { vec[i][j] }).collect()
}).collect();
return Sudoku::new(g)
}
pub fn read(mut reader: &mut BufferedReader<StdReader>) -... | new | identifier_name |
slice-const-param-mismatch.rs | // revisions: full min
#![cfg_attr(full, feature(adt_const_params))]
#![cfg_attr(full, allow(incomplete_features))]
struct ConstString<const T: &'static str>;
//[min]~^ ERROR
struct ConstBytes<const T: &'static [u8]>;
//[min]~^ ERROR
pub fn main() {
let _: ConstString<"Hello"> = ConstString::<"Hello">;
let ... | } | random_line_split | |
slice-const-param-mismatch.rs | // revisions: full min
#![cfg_attr(full, feature(adt_const_params))]
#![cfg_attr(full, allow(incomplete_features))]
struct ConstString<const T: &'static str>;
//[min]~^ ERROR
struct ConstBytes<const T: &'static [u8]>;
//[min]~^ ERROR
pub fn | () {
let _: ConstString<"Hello"> = ConstString::<"Hello">;
let _: ConstString<"Hello"> = ConstString::<"World">; //[full]~ ERROR mismatched types
let _: ConstString<"βγβ¦"> = ConstString::<"βγβ¦">;
let _: ConstString<"βγβ¦"> = ConstString::<"βγβ₯">; //[full]~ ERROR mismatched types
let _: ConstBytes<b"A... | main | identifier_name |
table_cell.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/. */
//! CSS table formatting contexts.
#![deny(unsafe_blocks)]
use block::{BlockFlow, ISizeAndMarginsComputer, Margi... | {
/// Data common to all block flows.
pub block_flow: BlockFlow,
/// The column span of this cell.
pub column_span: u32,
/// Whether this cell is visible. If false, the value of `empty-cells` means that we must not
/// display this cell.
pub visible: bool,
}
impl TableCellFlow {
pub fn... | TableCellFlow | identifier_name |
table_cell.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/. */
//! CSS table formatting contexts.
#![deny(unsafe_blocks)]
use block::{BlockFlow, ISizeAndMarginsComputer, Margi... |
fn repair_style(&mut self, new_style: &Arc<ComputedValues>) {
self.block_flow.repair_style(new_style)
}
fn compute_overflow(&self) -> Rect<Au> {
self.block_flow.compute_overflow()
}
fn iterate_through_fragment_border_boxes(&self,
itera... | {
if self.visible {
self.block_flow.build_display_list(layout_context)
}
} | identifier_body |
table_cell.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/. */
//! CSS table formatting contexts.
#![deny(unsafe_blocks)]
use block::{BlockFlow, ISizeAndMarginsComputer, Margi... |
}
/// Recursively (top-down) determines the actual inline-size of child contexts and fragments.
/// When called on this context, the context has had its inline-size set by the parent table
/// row.
fn assign_inline_sizes(&mut self, layout_context: &LayoutContext) {
let _scope = layout_debu... | {
self.block_flow.base.intrinsic_inline_sizes.preferred_inline_size =
self.block_flow.base.intrinsic_inline_sizes.minimum_inline_size;
} | conditional_block |
table_cell.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/. */
//! CSS table formatting contexts.
#![deny(unsafe_blocks)]
use block::{BlockFlow, ISizeAndMarginsComputer, Margi... | pub block_flow: BlockFlow,
/// The column span of this cell.
pub column_span: u32,
/// Whether this cell is visible. If false, the value of `empty-cells` means that we must not
/// display this cell.
pub visible: bool,
}
impl TableCellFlow {
pub fn from_node_fragment_and_visibility_flag(nod... | pub struct TableCellFlow {
/// Data common to all block flows. | random_line_split |
const-block-item.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 ... | () {
assert_eq!(BLOCK_USE, 100);
assert_eq!(BLOCK_PUB_USE, 200);
assert_eq!(BLOCK_STRUCT_DEF, 300);
assert_eq!(BLOCK_FN_DEF(390), 400);
assert_eq!(BLOCK_MACRO_RULES, 412);
}
| main | identifier_name |
const-block-item.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 ... | assert_eq!(BLOCK_PUB_USE, 200);
assert_eq!(BLOCK_STRUCT_DEF, 300);
assert_eq!(BLOCK_FN_DEF(390), 400);
assert_eq!(BLOCK_MACRO_RULES, 412);
} | random_line_split | |
const-block-item.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 ... | {
assert_eq!(BLOCK_USE, 100);
assert_eq!(BLOCK_PUB_USE, 200);
assert_eq!(BLOCK_STRUCT_DEF, 300);
assert_eq!(BLOCK_FN_DEF(390), 400);
assert_eq!(BLOCK_MACRO_RULES, 412);
} | identifier_body | |
rwlock.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 ... | c::ReleaseSRWLockExclusive(self.inner.get())
}
#[inline]
pub unsafe fn destroy(&self) {
//...
}
} | pub unsafe fn write_unlock(&self) { | random_line_split |
rwlock.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 ... |
#[inline]
pub unsafe fn write(&self) {
c::AcquireSRWLockExclusive(self.inner.get())
}
#[inline]
pub unsafe fn try_write(&self) -> bool {
c::TryAcquireSRWLockExclusive(self.inner.get())!= 0
}
#[inline]
pub unsafe fn read_unlock(&self) {
c::ReleaseSRWLockShared(sel... | {
c::TryAcquireSRWLockShared(self.inner.get()) != 0
} | identifier_body |
rwlock.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) -> bool {
c::TryAcquireSRWLockExclusive(self.inner.get())!= 0
}
#[inline]
pub unsafe fn read_unlock(&self) {
c::ReleaseSRWLockShared(self.inner.get())
}
#[inline]
pub unsafe fn write_unlock(&self) {
c::ReleaseSRWLockExclusive(self.inner.get())
}
#[inline]... | try_write | identifier_name |
ifmt.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 ... | e defined, there's not really a lot that we
// can do with them just yet (to test the output)
fn test_format_args() {
use std::fmt::Write;
let mut buf = String::new();
{
let w = &mut buf;
write!(w, "{}", format_args!("{}", 1));
write!(w, "{}", format_args!("test"));
write!(w,... | vec!(0u8));
println!("hello");
println!("this is a {}", "test");
println!("{foo}", foo="bar");
}
// Just make sure that the macros ar | identifier_body |
ifmt.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 ... | t!(format!("hello"), "hello");
t!(format!("hello {{"), "hello {");
// default formatters should work
t!(format!("{}", 1.0f32), "1");
t!(format!("{}", 1.0f64), "1");
t!(format!("{}", "a"), "a");
t!(format!("{}", "a".to_string()), "a");
t!(format!("{}", false), "false");
t!(format!("{... | // Various edge cases without formats
t!(format!(""), ""); | random_line_split |
ifmt.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 ... | isize = 0;
unsafe {
FOO += 1;
FOO
}
}
assert_eq!(format!("{} {} {a} {b} {} {c}",
foo(), foo(), foo(), a=foo(), b=foo(), c=foo()),
"1 2 4 5 3 6".to_string());
}
| O: | identifier_name |
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... | //! If you already know the name of what you are looking for the
//! fastest way to find it is to use the <a href="#"
//! onclick="focusSearchBar();">search bar</a> at the top of the page.
//!
//! Otherwise, you may want to jump to one of these useful sections:
//!
//! * [`std::*` modules](#modules)
//! * [Primitive ty... | //!
//! # How to read this documentation
//! | random_line_split |
trailing-comma.rs | // run-pass
// pretty-expanded FIXME #23616
fn f<T,>(_: T,) {}
struct Foo<T,>(T);
struct Bar;
impl Bar {
fn f(_: isize,) {}
fn g(self, _: isize,) {}
fn h(self,) {}
}
enum Baz {
Qux(isize,), | let (_, _,) = (1, 1,);
let [_, _,] = [1, 1,];
let [_, _,.., _,] = [1, 1, 1, 1,];
let [_, _, _,..,] = [1, 1, 1, 1,];
let x: Foo<isize,> = Foo::<isize,>(1);
Bar::f(0,);
Bar.g(0,);
Bar.h();
let x = Baz::Qux(1,);
} | }
#[allow(unused,)]
pub fn main() {
f::<isize,>(0,); | random_line_split |
trailing-comma.rs | // run-pass
// pretty-expanded FIXME #23616
fn f<T,>(_: T,) {}
struct Foo<T,>(T);
struct Bar;
impl Bar {
fn f(_: isize,) {}
fn g(self, _: isize,) {}
fn h(self,) |
}
enum Baz {
Qux(isize,),
}
#[allow(unused,)]
pub fn main() {
f::<isize,>(0,);
let (_, _,) = (1, 1,);
let [_, _,] = [1, 1,];
let [_, _,.., _,] = [1, 1, 1, 1,];
let [_, _, _,..,] = [1, 1, 1, 1,];
let x: Foo<isize,> = Foo::<isize,>(1);
Bar::f(0,);
Bar.g(0,);
Bar.h();
let ... | {} | identifier_body |
trailing-comma.rs | // run-pass
// pretty-expanded FIXME #23616
fn f<T,>(_: T,) {}
struct Foo<T,>(T);
struct Bar;
impl Bar {
fn f(_: isize,) {}
fn g(self, _: isize,) {}
fn | (self,) {}
}
enum Baz {
Qux(isize,),
}
#[allow(unused,)]
pub fn main() {
f::<isize,>(0,);
let (_, _,) = (1, 1,);
let [_, _,] = [1, 1,];
let [_, _,.., _,] = [1, 1, 1, 1,];
let [_, _, _,..,] = [1, 1, 1, 1,];
let x: Foo<isize,> = Foo::<isize,>(1);
Bar::f(0,);
Bar.g(0,);
Bar.h();... | h | identifier_name |
pg.rs | use diesel::*;
use diesel::pg::PgConnection;
use syntax::ast;
use syntax::codemap::Span;
use syntax::ext::base::*;
use syntax::parse::token::str_to_ident;
use syntax::ptr::P;
use super::data_structures::*;
table! {
pg_attribute (attrelid) {
attrelid -> Oid,
attname -> VarChar,
atttypid -> ... | {
use self::pg_attribute::dsl::*;
use self::pg_index::dsl::{pg_index, indisprimary, indexrelid, indrelid};
use self::pg_class::dsl::*;
let table_oid = pg_class.select(oid).filter(relname.eq(table_name)).limit(1);
let pk_query = pg_index.select(indexrelid)
.filter(indrelid.eq_any(table_oid)... | identifier_body | |
pg.rs | use diesel::*;
use diesel::pg::PgConnection;
use syntax::ast;
use syntax::codemap::Span;
use syntax::ext::base::*;
use syntax::parse::token::str_to_ident;
use syntax::ptr::P;
use super::data_structures::*;
table! {
pg_attribute (attrelid) {
attrelid -> Oid,
attname -> VarChar,
atttypid -> ... | (cx: &mut ExtCtxt, _span: Span, attr: &ColumnInformation) -> P<ast::Ty> {
let tpe = if attr.type_name.starts_with("_") {
let subtype = str_to_ident(&capitalize(&attr.type_name[1..]));
quote_ty!(cx, Array<$subtype>)
} else {
let type_name = str_to_ident(&capitalize(&attr.type_name));
... | determine_column_type | identifier_name |
pg.rs | use diesel::*;
use diesel::pg::PgConnection;
use syntax::ast;
use syntax::codemap::Span;
use syntax::ext::base::*;
use syntax::parse::token::str_to_ident;
use syntax::ptr::P;
use super::data_structures::*;
table! {
pg_attribute (attrelid) {
attrelid -> Oid,
attname -> VarChar,
atttypid -> ... | }
}
table! {
pg_class (oid) {
oid -> Oid,
relname -> VarChar,
}
}
pub fn determine_column_type(cx: &mut ExtCtxt, _span: Span, attr: &ColumnInformation) -> P<ast::Ty> {
let tpe = if attr.type_name.starts_with("_") {
let subtype = str_to_ident(&capitalize(&attr.type_name[1..]));
... | pg_index (indrelid) {
indrelid -> Oid,
indexrelid -> Oid,
indkey -> Array<SmallInt>,
indisprimary -> Bool, | random_line_split |
pg.rs | use diesel::*;
use diesel::pg::PgConnection;
use syntax::ast;
use syntax::codemap::Span;
use syntax::ext::base::*;
use syntax::parse::token::str_to_ident;
use syntax::ptr::P;
use super::data_structures::*;
table! {
pg_attribute (attrelid) {
attrelid -> Oid,
attname -> VarChar,
atttypid -> ... | else {
tpe
}
}
fn capitalize(name: &str) -> String {
name[..1].to_uppercase() + &name[1..]
}
pub fn load_table_names(connection: &PgConnection) -> QueryResult<Vec<String>> {
use diesel::prelude::*;
use diesel::expression::dsl::sql;
let query = select(sql::<types::VarChar>("table_name FRO... | {
quote_ty!(cx, Nullable<$tpe>)
} | conditional_block |
item.rs | //! Language items and abstract-syntax tree.
use std::fmt;
use vm;
/// The equivalent of a routine/function.
#[derive(PartialEq, Clone, Debug)]
pub struct Block<I>(pub Vec<BlockItem<I>>);
/// Language items only valid in a block.
#[derive(PartialEq, Clone, Debug)]
pub enum BlockItem<I> {
Call(String),
Litera... | StackItem::String(ref s) => write!(f, "\"{}\"", *s),
StackItem::Boolean(b) => write!(f, "{}", b),
StackItem::Symbol(ref s) => write!(f, ":{}", *s),
StackItem::Block(ref b) => write!(f, "{{ {}}}", *b),
}
}
} | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
StackItem::Integer(ref i) => write!(f, "{}", *i),
StackItem::Float(n) => write!(f, "{}", n), | random_line_split |
item.rs | //! Language items and abstract-syntax tree.
use std::fmt;
use vm;
/// The equivalent of a routine/function.
#[derive(PartialEq, Clone, Debug)]
pub struct | <I>(pub Vec<BlockItem<I>>);
/// Language items only valid in a block.
#[derive(PartialEq, Clone, Debug)]
pub enum BlockItem<I> {
Call(String),
Literal(StackItem<I>),
}
impl<I> fmt::Display for Block<I> where I: fmt::Display {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
for item in &self... | Block | identifier_name |
harfbuzz.rs | }
/// Returns shaped glyph data for one glyph, and updates the y-position of the pen.
pub fn entry_for_glyph(&self, i: usize, y_pos: &mut Au) -> ShapedGlyphEntry {
assert!(i < self.count);
unsafe {
let glyph_info_i = self.glyph_infos.offset(i as isize);
let pos_info_... |
let font: *mut Font = font_data as *mut Font;
assert!(!font.is_null());
unsafe {
let advance = (*font).glyph_h_kerning(first_glyph as GlyphId, second_glyph as GlyphId);
Shaper::float_to_fixed(advance)
}
}
| identifier_body | |
harfbuzz.rs | ::shaping::ShaperMethods;
use text::util::{fixed_to_float, float_to_fixed, is_bidi_control};
const NO_GLYPH: i32 = -1;
const LIGA: u32 = ot_tag!('l', 'i', 'g', 'a');
pub struct ShapedGlyphData {
count: usize,
glyph_infos: *mut hb_glyph_info_t,
pos_infos: *mut hb_glyph_position_t,
}
pub struct ShapedGlyph... |
while byte_range.end < byte_max {
byte_range.end += 1;
// Extend the byte range to include any following byte without its own glyph.
while byte_range.end < byte_max && byte_to_glyph[byte_range.end] == NO_GLYPH {
byte_range.end += 1;
... | // processed.
while glyph_span.start < glyph_count {
debug!("Processing glyph at idx={}", glyph_span.start);
glyph_span.end = glyph_span.start;
byte_range.end = glyph_data.byte_offset_of_glyph(glyph_span.start) as usize; | random_line_split |
harfbuzz.rs | ping::ShaperMethods;
use text::util::{fixed_to_float, float_to_fixed, is_bidi_control};
const NO_GLYPH: i32 = -1;
const LIGA: u32 = ot_tag!('l', 'i', 'g', 'a');
pub struct ShapedGlyphData {
count: usize,
glyph_infos: *mut hb_glyph_info_t,
pos_infos: *mut hb_glyph_position_t,
}
pub struct ShapedGlyphEntry... | *mut hb_font_funcs_t);
unsafe impl Sync for FontFuncs {}
lazy_static! {
static ref HB_FONT_FUNCS: FontFuncs = unsafe {
let hb_funcs = hb_font_funcs_create();
hb_font_funcs_set_nominal_glyph_func(hb_funcs, Some(glyph_func), ptr::null_mut(), None);
hb_font_funcs_set_glyph_h_advance_func(
... | ontFuncs( | identifier_name |
util.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/. */
#![allow(unsafe_blocks)]
use construct::ConstructionResult;
use incremental::RestyleDamage;
use parallel::DomPara... |
#[inline(always)]
fn borrow_layout_data<'a>(&'a self) -> Ref<'a,Option<LayoutDataWrapper>> {
unsafe {
mem::transmute(self.get().layout_data())
}
}
#[inline(always)]
fn mutate_layout_data<'a>(&'a self) -> RefMut<'a,Option<LayoutDataWrapper>> {
unsafe {
... | {
mem::transmute(self.get().layout_data_unchecked())
} | identifier_body |
util.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/. */
#![allow(unsafe_blocks)]
use construct::ConstructionResult;
use incremental::RestyleDamage;
use parallel::DomPara... | before_style: None,
after_style: None,
restyle_damage: RestyleDamage::empty(),
flow_construction_result: ConstructionResult::None,
before_flow_construction_result: ConstructionResult::None,
after_flow_construction_result: ConstructionResult::None,
... | PrivateLayoutData { | random_line_split |
util.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/. */
#![allow(unsafe_blocks)]
use construct::ConstructionResult;
use incremental::RestyleDamage;
use parallel::DomPara... | {
pub chan: Option<LayoutChan>,
pub shared_data: SharedLayoutData,
pub data: Box<PrivateLayoutData>,
}
#[allow(dead_code)]
fn static_assertion(x: Option<LayoutDataWrapper>) {
unsafe {
let _: Option<::script::dom::node::LayoutData> =
::std::intrinsics::transmute(x);
}
}
/// A t... | LayoutDataWrapper | identifier_name |
renumber.rs | use rustc_index::vec::IndexVec;
use rustc_infer::infer::{InferCtxt, NllRegionVariableOrigin};
use rustc_middle::mir::visit::{MutVisitor, TyContext};
use rustc_middle::mir::{Body, Location, PlaceElem, Promoted};
use rustc_middle::ty::subst::SubstsRef;
use rustc_middle::ty::{self, Ty, TyCtxt, TypeFoldable};
/// Replaces... | }
} | }
fn visit_const(&mut self, constant: &mut &'tcx ty::Const<'tcx>, _location: Location) {
*constant = self.renumber_regions(&*constant); | random_line_split |
renumber.rs | use rustc_index::vec::IndexVec;
use rustc_infer::infer::{InferCtxt, NllRegionVariableOrigin};
use rustc_middle::mir::visit::{MutVisitor, TyContext};
use rustc_middle::mir::{Body, Location, PlaceElem, Promoted};
use rustc_middle::ty::subst::SubstsRef;
use rustc_middle::ty::{self, Ty, TyCtxt, TypeFoldable};
/// Replaces... |
None
}
#[instrument(skip(self), level = "debug")]
fn visit_substs(&mut self, substs: &mut SubstsRef<'tcx>, location: Location) {
*substs = self.renumber_regions(*substs);
debug!(?substs);
}
#[instrument(skip(self), level = "debug")]
fn visit_region(&mut self, region:... | {
let new_ty = self.renumber_regions(ty);
if new_ty != ty {
return Some(PlaceElem::Field(field, new_ty));
}
} | conditional_block |
renumber.rs | use rustc_index::vec::IndexVec;
use rustc_infer::infer::{InferCtxt, NllRegionVariableOrigin};
use rustc_middle::mir::visit::{MutVisitor, TyContext};
use rustc_middle::mir::{Body, Location, PlaceElem, Promoted};
use rustc_middle::ty::subst::SubstsRef;
use rustc_middle::ty::{self, Ty, TyCtxt, TypeFoldable};
/// Replaces... |
/// Replaces all regions appearing in `value` with fresh inference
/// variables.
#[instrument(skip(infcx), level = "debug")]
pub fn renumber_regions<'tcx, T>(infcx: &InferCtxt<'_, 'tcx>, value: T) -> T
where
T: TypeFoldable<'tcx>,
{
infcx.tcx.fold_regions(value, &mut false, |_region, _depth| {
let or... | {
debug!(?body.arg_count);
let mut visitor = NllVisitor { infcx };
for body in promoted.iter_mut() {
visitor.visit_body(body);
}
visitor.visit_body(body);
} | identifier_body |
renumber.rs | use rustc_index::vec::IndexVec;
use rustc_infer::infer::{InferCtxt, NllRegionVariableOrigin};
use rustc_middle::mir::visit::{MutVisitor, TyContext};
use rustc_middle::mir::{Body, Location, PlaceElem, Promoted};
use rustc_middle::ty::subst::SubstsRef;
use rustc_middle::ty::{self, Ty, TyCtxt, TypeFoldable};
/// Replaces... | (&mut self, region: &mut ty::Region<'tcx>, location: Location) {
let old_region = *region;
*region = self.renumber_regions(&old_region);
debug!(?region);
}
fn visit_const(&mut self, constant: &mut &'tcx ty::Const<'tcx>, _location: Location) {
*constant = self.renumber_regions(&... | visit_region | identifier_name |
lib.rs | #![doc(html_root_url = "https://mackwic.github.io/rspec")]
#![cfg_attr(feature="clippy", feature(plugin))]
#![cfg_attr(feature="clippy", plugin(clippy))]
#![allow(dead_code)]
#[macro_use]
extern crate derive_builder;
#[macro_use]
extern crate derive_new;
#[cfg(feature = "expectest_compat")]
extern crate expectest;... |
#[cfg(test)]
mod tests {
pub use super::*;
pub use block::*;
// Test list:
// x check that tests can call `assert_eq!`
// x check that tests can return Err or Ok
// x runner can count the tests
// x runner can count the success and failed
// x check that we can use before in a descri... | {
use std::io;
use std::sync::Arc;
use logger::Logger;
use runner::{ConfigurationBuilder, Runner};
let logger = Arc::new(Logger::new(io::stdout()));
let configuration = ConfigurationBuilder::default().build().unwrap();
let runner = Runner::new(configuration, vec![logger]);
runner.run(... | identifier_body |
lib.rs | #![doc(html_root_url = "https://mackwic.github.io/rspec")]
#![cfg_attr(feature="clippy", feature(plugin))]
#![cfg_attr(feature="clippy", plugin(clippy))]
#![allow(dead_code)]
#[macro_use]
extern crate derive_builder;
#[macro_use]
extern crate derive_new;
#[cfg(feature = "expectest_compat")]
extern crate expectest;... | <T>(suite: &Suite<T>)
where
T: Clone + Send + Sync + ::std::fmt::Debug,
{
use std::io;
use std::sync::Arc;
use logger::Logger;
use runner::{ConfigurationBuilder, Runner};
let logger = Arc::new(Logger::new(io::stdout()));
let configuration = ConfigurationBuilder::default().build().unwrap();... | run | identifier_name |
lib.rs | #![doc(html_root_url = "https://mackwic.github.io/rspec")]
#![cfg_attr(feature="clippy", feature(plugin))]
#![cfg_attr(feature="clippy", plugin(clippy))]
#![allow(dead_code)]
#[macro_use]
extern crate derive_builder;
#[macro_use]
extern crate derive_new;
#[cfg(feature = "expectest_compat")]
extern crate expectest;... | /// # Examples
///
/// ```
/// # extern crate rspec;
/// #
/// # pub fn main() {
/// rspec::run(&rspec::given("a scenario", (), |ctx| {
/// ctx.when("...", |ctx| {
/// //...
/// });
///
/// ctx.then("...", |env| { /*... */ });
/// }));
/// # }
/// ```
pub fn run<T>(suite: &Suite<T>)
where
T: Clo... |
/// A wrapper for conveniently running a test suite with
/// the default configuration with considerebly less glue-code.
/// | random_line_split |
uniq-self-in-mut-slot.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 ... |
impl Changer for X {
fn change(mut self: Box<X>) -> Box<X> {
self.a = 55;
self
}
}
pub fn main() {
let x: Box<_> = box X { a: 32 };
let new_x = x.change();
assert_eq!(new_x.a, 55);
} | fn change(self: Box<Self>) -> Box<Self>;
} | random_line_split |
uniq-self-in-mut-slot.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 x: Box<_> = box X { a: 32 };
let new_x = x.change();
assert_eq!(new_x.a, 55);
} | identifier_body | |
uniq-self-in-mut-slot.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: Box<X>) -> Box<X> {
self.a = 55;
self
}
}
pub fn main() {
let x: Box<_> = box X { a: 32 };
let new_x = x.change();
assert_eq!(new_x.a, 55);
}
| change | identifier_name |
hashes.rs | //! Computing hashes for files.
use crate::Result;
use openssl::hash::{DigestBytes, Hasher, MessageDigest};
use std::io::{Read, Write};
#[derive(Debug)]
pub struct | {
pub files: u64,
pub bytes: u64,
}
// TODO: Reuse buffer and hasher for a given thread.
pub(crate) fn hash_file<R: Read>(rd: &mut R) -> Result<DigestBytes> {
let mut h = Hasher::new(MessageDigest::sha1())?;
let mut buf = vec![0u8; 8192];
loop {
let count = rd.read(&mut buf)?;
if ... | Estimate | identifier_name |
hashes.rs | //! Computing hashes for files.
use crate::Result;
use openssl::hash::{DigestBytes, Hasher, MessageDigest};
use std::io::{Read, Write};
#[derive(Debug)]
pub struct Estimate {
pub files: u64,
pub bytes: u64,
}
// TODO: Reuse buffer and hasher for a given thread.
pub(crate) fn hash_file<R: Read>(rd: &mut R) -> ... | use std::fs::{File, OpenOptions};
use std::io;
use std::os::unix::fs::OpenOptionsExt;
use std::path::Path;
// From linux's fcntl.h, not exported in the libc crate.
const O_NOATIME: i32 = 0o1000000;
pub fn noatime_open(name: &Path) -> io::Result<File> {
// Try opening it first with ... | #[cfg(target_os = "linux")]
mod atime_impl { | random_line_split |
hashes.rs | //! Computing hashes for files.
use crate::Result;
use openssl::hash::{DigestBytes, Hasher, MessageDigest};
use std::io::{Read, Write};
#[derive(Debug)]
pub struct Estimate {
pub files: u64,
pub bytes: u64,
}
// TODO: Reuse buffer and hasher for a given thread.
pub(crate) fn hash_file<R: Read>(rd: &mut R) -> ... |
}
// Other platforms, just use normal open.
#[cfg(not(target_os = "linux"))]
mod atime_impl {
use std::fs::{File, OpenOptions};
use std::io;
use std::path::Path;
pub fn noatime_open(name: &Path) -> io::Result<File> {
OpenOptions::new().read(true).open(name)
}
}
| {
// Try opening it first with noatime, and if that fails, try the open
// again without the option.
match OpenOptions::new()
.read(true)
.custom_flags(O_NOATIME)
.open(name)
{
Ok(f) => Ok(f),
Err(_) => OpenOptions::new().read(t... | identifier_body |
package_source.rs | // Copyright 2012-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-MI... | (src_dir: &Path, dst_dir: &Path,
id: &PkgId) -> PkgSrc {
PkgSrc {
root: copy *src_dir,
dst_dir: copy *dst_dir,
id: copy *id,
libs: ~[],
mains: ~[],
tests: ~[],
benchs: ~[]
}
}
fn check_dir(&se... | new | identifier_name |
package_source.rs | // Copyright 2012-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-MI... |
}
/// True if the given path's stem is self's pkg ID's stem
/// or if the pkg ID's stem is <rust-foo> and the given path's
/// stem is foo
/// Requires that dashes in p have already been normalized to
/// underscores
fn stem_matches(&self, p: &Path) -> bool {
let self_id = self.id.... | {
None
} | conditional_block |
package_source.rs | // Copyright 2012-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-MI... | pth),
_ => ()
}
}
if self.libs.is_empty() && self.mains.is_empty()
&& self.tests.is_empty() && self.benchs.is_empty() {
note("Couldn't infer any crates to build.\n\
Try ... | {
use conditions::missing_pkg_files::cond;
let dir = self.check_dir();
debug!("Called check_dir, I'm in %s", dir.to_str());
let prefix = dir.components.len();
debug!("Matching against %?", self.id.local_path.filestem());
for os::walk_dir(&dir) |pth| {
match p... | identifier_body |
package_source.rs | // Copyright 2012-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-MI... | self.tests.len(),
self.benchs.len())
}
fn build_crates(&self,
ctx: &Ctx,
dst_dir: &Path,
src_dir: &Path,
crates: &[Crate],
cfgs: &[~str],
what: OutputType) {
... | self.mains.len(), | random_line_split |
range_map.rs | //! Implements a map from integer indices to data.
//! Rather than storing data for every index, internally, this maps entire ranges to the data.
//! To this end, the APIs all work on ranges, not on individual integers. Ranges are split as
//! necessary (e.g., when [0,5) is first associated with X, and then [1,2) is mu... | let mut right = self.v.len(); // exclusive
loop {
debug_assert!(left < right, "find_offset: offset {} is out-of-bounds", offset);
let candidate = left.checked_add(right).unwrap() / 2;
let elem = &self.v[candidate];
if offset < elem.range.start {
... | /// Finds the index containing the given offset.
fn find_offset(&self, offset: u64) -> usize {
// We do a binary search.
let mut left = 0usize; // inclusive | random_line_split |
range_map.rs | //! Implements a map from integer indices to data.
//! Rather than storing data for every index, internally, this maps entire ranges to the data.
//! To this end, the APIs all work on ranges, not on individual integers. Ranges are split as
//! necessary (e.g., when [0,5) is first associated with X, and then [1,2) is mu... | }
}
/// Provides read-only iteration over everything in the given range. This does
/// *not* split items if they overlap with the edges. Do not use this to mutate
/// through interior mutability.
pub fn iter<'a>(&'a self, offset: Size, len: Size) -> impl Iterator<Item = &'a T> + 'a {
... | {
// We do a binary search.
let mut left = 0usize; // inclusive
let mut right = self.v.len(); // exclusive
loop {
debug_assert!(left < right, "find_offset: offset {} is out-of-bounds", offset);
let candidate = left.checked_add(right).unwrap() / 2;
let ... | identifier_body |
range_map.rs | //! Implements a map from integer indices to data.
//! Rather than storing data for every index, internally, this maps entire ranges to the data.
//! To this end, the APIs all work on ranges, not on individual integers. Ranges are split as
//! necessary (e.g., when [0,5) is first associated with X, and then [1,2) is mu... | let mut end_idx = first_idx;
loop {
// Compute if `end` is the last element we need to look at.
let done = self.v[end_idx].range.end >= offset + len;
// We definitely need to include `end`, so move the index.
end_idx += 1;
... | {
// Make sure we got a clear beginning
let mut first_idx = self.find_offset(offset);
if self.split_index(first_idx, offset) {
// The newly created 2nd element is ours
first_idx += 1;
}
// No more mutation.
let first... | conditional_block |
range_map.rs | //! Implements a map from integer indices to data.
//! Rather than storing data for every index, internally, this maps entire ranges to the data.
//! To this end, the APIs all work on ranges, not on individual integers. Ranges are split as
//! necessary (e.g., when [0,5) is first associated with X, and then [1,2) is mu... | (&self, offset: u64) -> usize {
// We do a binary search.
let mut left = 0usize; // inclusive
let mut right = self.v.len(); // exclusive
loop {
debug_assert!(left < right, "find_offset: offset {} is out-of-bounds", offset);
let candidate = left.checked_add(right).... | find_offset | identifier_name |
rpc.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 https://mozilla.org/MPL/2.0/. */
use app_units::Au;
use euclid::default::Rect;
use euclid::Size2D;
use script_traits::UntrustedNodeAddress;
use se... | {
pub client_rect: Rect<i32>,
}
pub struct NodeScrollIdResponse(pub ExternalScrollId);
pub struct ResolvedStyleResponse(pub String);
#[derive(Clone)]
pub struct OffsetParentResponse {
pub node_address: Option<UntrustedNodeAddress>,
pub rect: Rect<Au>,
}
impl OffsetParentResponse {
pub fn empty() ->... | NodeGeometryResponse | identifier_name |
rpc.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 https://mozilla.org/MPL/2.0/. */
use app_units::Au;
use euclid::default::Rect;
use euclid::Size2D;
use script_traits::UntrustedNodeAddress;
use se... | }
impl OffsetParentResponse {
pub fn empty() -> OffsetParentResponse {
OffsetParentResponse {
node_address: None,
rect: Rect::zero(),
}
}
}
#[derive(Clone)]
pub struct TextIndexResponse(pub Option<usize>); | pub struct OffsetParentResponse {
pub node_address: Option<UntrustedNodeAddress>,
pub rect: Rect<Au>, | random_line_split |
struct-log-self.rs | //! Example of how to implement `KV` for a struct
//! to conveniently log data associated with it.
#[macro_use]
extern crate slog;
use slog::*;
mod common;
struct Peer {
host: String,
port: u32,
}
impl Peer {
fn new(host: String, port: u32) -> Self {
Peer {
host: host,
por... |
fn main() {
let log = Logger::root(Fuse(common::PrintlnDrain), o!("build-id" => "7.3.3-abcdef"));
let server = Server::new("localhost".into(), 12345, log.clone());
let peer = Peer::new("1.2.3.4".into(), 999);
server.connection(&peer);
let mut counter = PeerCounter::new(log);
counter.count(&pe... | fn count(&mut self, peer: &Peer) {
self.count += 1;
self.log_info("counted peer", b!(peer));
}
} | random_line_split |
struct-log-self.rs | //! Example of how to implement `KV` for a struct
//! to conveniently log data associated with it.
#[macro_use]
extern crate slog;
use slog::*;
mod common;
struct Peer {
host: String,
port: u32,
}
impl Peer {
fn new(host: String, port: u32) -> Self {
Peer {
host: host,
por... |
}
fn main() {
let log = Logger::root(Fuse(common::PrintlnDrain), o!("build-id" => "7.3.3-abcdef"));
let server = Server::new("localhost".into(), 12345, log.clone());
let peer = Peer::new("1.2.3.4".into(), 999);
server.connection(&peer);
let mut counter = PeerCounter::new(log);
counter.count(... | {
self.count += 1;
self.log_info("counted peer", b!(peer));
} | identifier_body |
struct-log-self.rs | //! Example of how to implement `KV` for a struct
//! to conveniently log data associated with it.
#[macro_use]
extern crate slog;
use slog::*;
mod common;
struct Peer {
host: String,
port: u32,
}
impl Peer {
fn new(host: String, port: u32) -> Self {
Peer {
host: host,
por... | (&self, msg: &str, kv: BorrowedKV) {
info!(self.log, "{}", msg; "current-count" => self.count, kv);
}
fn count(&mut self, peer: &Peer) {
self.count += 1;
self.log_info("counted peer", b!(peer));
}
}
fn main() {
let log = Logger::root(Fuse(common::PrintlnDrain), o!("build-id" =>... | log_info | identifier_name |
primitive.rs | //! Facilities for working with primitive values.
/// Mutates the `out` argument provided to refer to the `v8::Undefined` object.
pub use neon_sys::Neon_Primitive_Undefined as undefined;
/// Mutates the `out` argument provided to refer to the `v8::Null` object.
pub use neon_sys::Neon_Primitive_Null as null;
/// Muta... | pub use neon_sys::Neon_Primitive_NumberValue as number_value; | /// Gets the underlying value of a `v8::Number` object. | random_line_split |
permutations_with_repetitions.rs | // Implements http://rosettacode.org/wiki/Permutations_with_repetitions
struct PermutationIterator<'a, T: 'a> {
universe: &'a [T],
size: usize,
prev: Option<Vec<usize>>,
}
fn permutations<T>(universe: &[T], size: usize) -> PermutationIterator<T> {
return PermutationIterator {
universe: univers... | }
match self.prev {
None => {
let zeroes: Vec<usize> = std::iter::repeat(0)
.take(self.size)
.collect();
let result = Some(map(self.universe, &zeroes[..]));
... | return None; | random_line_split |
permutations_with_repetitions.rs | // Implements http://rosettacode.org/wiki/Permutations_with_repetitions
struct PermutationIterator<'a, T: 'a> {
universe: &'a [T],
size: usize,
prev: Option<Vec<usize>>,
}
fn permutations<T>(universe: &[T], size: usize) -> PermutationIterator<T> |
fn map<T>(values: &[T], ixs: &[usize]) -> Vec<T> where T: Clone {
return ixs.iter().map(|&i| values[i].clone()).collect();
}
impl<'a, T> Iterator for PermutationIterator<'a, T> where T: Clone {
type Item = Vec<T>;
fn next(&mut self) -> Option<Vec<T>> {
let n = self.universe.len();
if n... | {
return PermutationIterator {
universe: universe,
size: size,
prev: None,
}
} | identifier_body |
permutations_with_repetitions.rs | // Implements http://rosettacode.org/wiki/Permutations_with_repetitions
struct PermutationIterator<'a, T: 'a> {
universe: &'a [T],
size: usize,
prev: Option<Vec<usize>>,
}
fn permutations<T>(universe: &[T], size: usize) -> PermutationIterator<T> {
return PermutationIterator {
universe: univers... |
Some (ref mut indexes) =>
match indexes.iter().position(|&i| i + 1 < n) {
None => return None,
Some(position) => {
for i in 0..(position) {
indexes[i] = 0;
}
... | {
let zeroes: Vec<usize> = std::iter::repeat(0)
.take(self.size)
.collect();
let result = Some(map(self.universe, &zeroes[..]));
self.prev = Some(zeroes);
return result... | conditional_block |
permutations_with_repetitions.rs | // Implements http://rosettacode.org/wiki/Permutations_with_repetitions
struct PermutationIterator<'a, T: 'a> {
universe: &'a [T],
size: usize,
prev: Option<Vec<usize>>,
}
fn permutations<T>(universe: &[T], size: usize) -> PermutationIterator<T> {
return PermutationIterator {
universe: univers... | (&mut self) -> Option<Vec<T>> {
let n = self.universe.len();
if n == 0 {
return None;
}
match self.prev {
None => {
let zeroes: Vec<usize> = std::iter::repeat(0)
.take(self.size)
... | next | identifier_name |
struct_with_derive_debug.rs | /* automatically generated by rust-bindgen */
#![allow(non_snake_case)]
#[repr(C)]
#[derive(Debug, Copy)]
pub struct LittleArray {
pub a: [::std::os::raw::c_int; 32usize],
}
#[test]
fn bindgen_test_layout_LittleArray() {
assert_eq!(::std::mem::size_of::<LittleArray>(), 128usize);
assert_eq!(::std::mem::... | assert_eq!(::std::mem::size_of::<WithLittleArray>(), 128usize);
assert_eq!(::std::mem::align_of::<WithLittleArray>(), 4usize);
}
impl Clone for WithLittleArray {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
pub struct WithBigArray {
pub a: BigArray,
}
#[test]
fn bindgen_test_layout_WithBigArray() {
... | pub struct WithLittleArray {
pub a: LittleArray,
}
#[test]
fn bindgen_test_layout_WithLittleArray() { | random_line_split |
struct_with_derive_debug.rs | /* automatically generated by rust-bindgen */
#![allow(non_snake_case)]
#[repr(C)]
#[derive(Debug, Copy)]
pub struct LittleArray {
pub a: [::std::os::raw::c_int; 32usize],
}
#[test]
fn bindgen_test_layout_LittleArray() {
assert_eq!(::std::mem::size_of::<LittleArray>(), 128usize);
assert_eq!(::std::mem::... |
}
#[repr(C)]
pub struct BigArray {
pub a: [::std::os::raw::c_int; 33usize],
}
#[test]
fn bindgen_test_layout_BigArray() {
assert_eq!(::std::mem::size_of::<BigArray>(), 132usize);
assert_eq!(::std::mem::align_of::<BigArray>(), 4usize);
}
#[repr(C)]
#[derive(Debug, Copy)]
pub struct WithLittleArray {
pub... | { *self } | identifier_body |
struct_with_derive_debug.rs | /* automatically generated by rust-bindgen */
#![allow(non_snake_case)]
#[repr(C)]
#[derive(Debug, Copy)]
pub struct LittleArray {
pub a: [::std::os::raw::c_int; 32usize],
}
#[test]
fn bindgen_test_layout_LittleArray() {
assert_eq!(::std::mem::size_of::<LittleArray>(), 128usize);
assert_eq!(::std::mem::... | (&self) -> Self { *self }
}
#[repr(C)]
pub struct BigArray {
pub a: [::std::os::raw::c_int; 33usize],
}
#[test]
fn bindgen_test_layout_BigArray() {
assert_eq!(::std::mem::size_of::<BigArray>(), 132usize);
assert_eq!(::std::mem::align_of::<BigArray>(), 4usize);
}
#[repr(C)]
#[derive(Debug, Copy)]
pub struct ... | clone | identifier_name |
issue-3021.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 ... |
}
fail2!();
}
fn main() {}
| {
self.v0 = k0 ^ 0x736f6d6570736575; //~ ERROR can't capture dynamic environment
//~^ ERROR unresolved name `k0`.
} | identifier_body |
issue-3021.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 ... | }
}
fail2!();
}
fn main() {} | self.v0 = k0 ^ 0x736f6d6570736575; //~ ERROR can't capture dynamic environment
//~^ ERROR unresolved name `k0`. | random_line_split |
issue-3021.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 ... | () {}
| main | identifier_name |
issue-17252.rs | // Copyright 2014 The Rust Project Developers. See the 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 http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
static FOO: uint = ... | // file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
// | random_line_split |
issue-17252.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 ... | () {
let _x: [u8,..FOO]; // caused stack overflow prior to fix
let _y: uint = 1 + {
static BAR: uint = BAR; //~ ERROR recursive constant
let _z: [u8,..BAR]; // caused stack overflow prior to fix
1
};
}
| main | identifier_name |
issue-17252.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 ... | {
let _x: [u8, ..FOO]; // caused stack overflow prior to fix
let _y: uint = 1 + {
static BAR: uint = BAR; //~ ERROR recursive constant
let _z: [u8, ..BAR]; // caused stack overflow prior to fix
1
};
} | identifier_body | |
bench_extern.rs | #![feature(test)]
extern crate racer_testutils;
extern crate test;
use test::Bencher;
use racer_testutils::*;
#[bench]
fn completes_rand(b: &mut Bencher) |
#[bench]
fn completes_rayon(b: &mut Bencher) {
let src = "
extern crate rayon;
extern crate rand;
use rand::{Rng, thread_rng};
fn main() {
rayon::colle~
}
";
let mut match_ = None;
b.iter(|| {
with_test_project(|dir| {
let src_dir = dir.nested_dir("test-... | {
let src = "
extern crate rand;
use rand::{Rng, thread_rng};
fn main() {
let mut rng: Box<Rng> = Box::new(thread_rng());
rng.gen_rang~
}
";
let mut match_ = None;
b.iter(|| {
with_test_project(|dir| {
let src_dir = dir.nested_dir("test-crate3").nested... | identifier_body |
bench_extern.rs | #![feature(test)]
extern crate racer_testutils;
extern crate test;
use test::Bencher;
use racer_testutils::*;
#[bench]
fn | (b: &mut Bencher) {
let src = "
extern crate rand;
use rand::{Rng, thread_rng};
fn main() {
let mut rng: Box<Rng> = Box::new(thread_rng());
rng.gen_rang~
}
";
let mut match_ = None;
b.iter(|| {
with_test_project(|dir| {
let src_dir = dir.nested_dir("te... | completes_rand | identifier_name |
bench_extern.rs | #![feature(test)]
extern crate racer_testutils;
extern crate test;
use test::Bencher;
use racer_testutils::*;
#[bench]
fn completes_rand(b: &mut Bencher) {
let src = "
extern crate rand;
use rand::{Rng, thread_rng};
fn main() {
let mut rng: Box<Rng> = Box::new(thread_rng());
rng.gen_ra... | } | random_line_split | |
font.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/. */
//! Generic types for font stuff.
use cssparser::Parser;
use num_traits::One;
use parser::{Parse, ParserContext};... | dest.write_char(' ')?;
self.value.to_css(dest)?;
}
Ok(())
}
}
/// Variation setting for a single feature, see:
///
/// https://drafts.csswg.org/css-fonts-4/#font-variation-settings-def
#[derive(Animate, Clone, Debug, Eq, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
pub... | if self.value != Integer::one() { | random_line_split |
font.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/. */
//! Generic types for font stuff.
use cssparser::Parser;
use num_traits::One;
use parser::{Parse, ParserContext};... | <W>(&self, dest: &mut CssWriter<W>) -> fmt::Result
where
W: Write,
{
if self.0.is_empty() {
return dest.write_str("normal");
}
let mut first = true;
for item in self.0.iter() {
if!first {
dest.write_str(", ")?;
}
... | to_css | identifier_name |
font.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/. */
//! Generic types for font stuff.
use cssparser::Parser;
use num_traits::One;
use parser::{Parse, ParserContext};... |
self.value.compute_squared_distance(&other.value)
}
}
/// A value both for font-variation-settings and font-feature-settings.
#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, ToComputedValue)]
pub struct FontSettings<T>(pub Box<[T]>);
impl<T> FontSettings<T> {
/// Default value of font settings as... | {
return Err(());
} | conditional_block |
font.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/. */
//! Generic types for font stuff.
use cssparser::Parser;
use num_traits::One;
use parser::{Parse, ParserContext};... |
}
| {
if self.0.is_empty() {
return dest.write_str("normal");
}
let mut first = true;
for item in self.0.iter() {
if !first {
dest.write_str(", ")?;
}
first = false;
item.to_css(dest)?;
}
Ok(())
... | identifier_body |
var-captured-in-nested-closure.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(); // #break
nested_closure();
};
closure();
}
fn zzz() {()}
| {
let mut variable = 1;
let constant = 2;
let a_struct = Struct {
a: -3,
b: 4.5,
c: 5
};
let struct_ref = &a_struct;
let owned = box 6;
let closure = || {
let closure_local = 8;
let nested_closure = || {
zzz(); // #break
var... | identifier_body |
var-captured-in-nested-closure.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... |
// gdb-command:print variable
// gdb-check:$1 = 1
// gdb-command:print constant
// gdb-check:$2 = 2
// gdb-command:print a_struct
// gdb-check:$3 = {a = -3, b = 4.5, c = 5}
// gdb-command:print *struct_ref
// gdb-check:$4 = {a = -3, b = 4.5, c = 5}
// gdb-command:print *owned
// gdb-check:$5 = 6
// gdb-command:print c... | // === GDB TESTS ===================================================================================
// gdb-command:run | random_line_split |
var-captured-in-nested-closure.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 |
main.rs | // Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file | // with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either expre... | // to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance | random_line_split |
main.rs | // Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may... | {
#[cfg(feature = "cli")]
repl::main()
} | identifier_body | |
main.rs | // Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may... | () {
#[cfg(feature = "cli")]
repl::main()
}
| main | identifier_name |
mod.rs | // This module contains helpers functions and types that
// are not test in themselves, but are used by several tests.
#![allow(dead_code, unused_macros)]
pub extern crate wayland_client as wayc;
pub extern crate wayland_server as ways;
use std::os::unix::net::UnixStream;
use std::sync::atomic::{AtomicBool, Ordering... | _: &$crate::helpers::ways::Client,
new_id: $crate::helpers::ways::New<$iface>,
_: &(),
data_init: &mut $crate::helpers::ways::DataInit<'_, Self>,
) {
data_init.init(new_id, ());
}
... | _: &mut $crate::helpers::ways::DisplayHandle<'_>, | random_line_split |
mod.rs | // This module contains helpers functions and types that
// are not test in themselves, but are used by several tests.
#![allow(dead_code, unused_macros)]
pub extern crate wayland_client as wayc;
pub extern crate wayland_server as ways;
use std::os::unix::net::UnixStream;
use std::sync::atomic::{AtomicBool, Ordering... | (socket: UnixStream) -> TestClient<D> {
let conn =
self::wayc::Connection::from_socket(socket).expect("Failed to connect to server.");
let event_queue = conn.new_event_queue();
let display = conn.handle().display();
TestClient { conn, display, event_queue }
}
pub fn ... | new | identifier_name |
issue13507.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... |
pub fn type_ids() -> Vec<TypeId> {
let mut ids = vec!();
ids.push(TypeId::of::<FooNil>());
ids.push(TypeId::of::<FooBool>());
ids.push(TypeId::of::<FooInt>());
ids.push(TypeId::of::<FooUint>());
ids.push(TypeId::of::<FooFloat>());
ids.push(TypeId::of::<FooEnu... | pub mod testtypes {
use std::any::TypeId; | random_line_split |
issue13507.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... | {
VarA(usize),
VarB(usize, usize)
}
// Tests TyBox (of u8)
pub type FooUniq = Box<u8>;
// As with TyStr, what type should be used for TyArray?
// Tests TyRawPtr
pub type FooPtr = *const u8;
// Skipping TyRef
// Skipping TyBareFn (how do you get a bare function type,... | FooEnum | identifier_name |
issue13507.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... |
// Tests ty_nil
pub type FooNil = ();
// Skipping ty_bot
// Tests TyBool
pub type FooBool = bool;
// Tests TyChar
pub type FooChar = char;
// Tests TyInt (does not test all variants of IntTy)
pub type FooInt = isize;
// Tests TyUint (does not test all variants of UintTy)
... | {
let mut ids = vec!();
ids.push(TypeId::of::<FooNil>());
ids.push(TypeId::of::<FooBool>());
ids.push(TypeId::of::<FooInt>());
ids.push(TypeId::of::<FooUint>());
ids.push(TypeId::of::<FooFloat>());
ids.push(TypeId::of::<FooEnum>());
ids.push(TypeId::of::<F... | identifier_body |
lib.rs | #[macro_use]
#[cfg(test)]
extern crate lazy_static;
#[cfg(test)]
extern crate itertools;
extern crate r68k_common;
#[cfg(test)]
extern crate r68k_tools;
pub mod cpu;
pub mod ram;
pub mod interrupts;
pub mod musashi;
#[cfg(test)]
mod tests {
use cpu::TestCore;
use r68k_tools::memory::MemoryVec;
use r68k_t... | under += 1;
println!("{:04x}: {} disasm under", opcode, op);
}
, //println!("{:04x}:\t\tover", opcode),
Ok((new_pc, dis_inst)) => if op == "???" || op == "unimplemented_1111" || op == "unimplemented_1010" || op == "illegal" {
... | {
let mut over = 0;
let mut under = 0;
let mut wrong = 0;
let gen = InstructionSetGenerator::<TestCore>::new();
let optable: Vec<&str> = gen.generate_with("???", |ref op| op.name);
let d = Disassembler::new();
for opcode in 0x0000..0xffff {
let op = op... | identifier_body |
lib.rs | #[macro_use]
#[cfg(test)]
extern crate lazy_static;
#[cfg(test)]
extern crate itertools;
extern crate r68k_common;
#[cfg(test)]
extern crate r68k_tools;
pub mod cpu;
pub mod ram;
pub mod interrupts;
pub mod musashi;
#[cfg(test)]
mod tests {
use cpu::TestCore;
use r68k_tools::memory::MemoryVec;
use r68k_t... | () {
let mut over = 0;
let mut under = 0;
let mut wrong = 0;
let gen = InstructionSetGenerator::<TestCore>::new();
let optable: Vec<&str> = gen.generate_with("???", |ref op| op.name);
let d = Disassembler::new();
for opcode in 0x0000..0xffff {
let op =... | roundtrips | identifier_name |
lib.rs | #[macro_use]
#[cfg(test)]
extern crate lazy_static;
#[cfg(test)]
extern crate itertools;
extern crate r68k_common;
#[cfg(test)]
extern crate r68k_tools;
pub mod cpu;
pub mod ram;
pub mod interrupts;
pub mod musashi;
#[cfg(test)]
mod tests {
use cpu::TestCore;
use r68k_tools::memory::MemoryVec;
use r68k_t... | fn roundtrips() {
let mut over = 0;
let mut under = 0;
let mut wrong = 0;
let gen = InstructionSetGenerator::<TestCore>::new();
let optable: Vec<&str> = gen.generate_with("???", |ref op| op.name);
let d = Disassembler::new();
for opcode in 0x0000..0xffff {
... | random_line_split | |
region-bounds-on-objects-and-type-parameters.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 ... | // Bounds on object types:
struct Foo<'a,'b,'c> {
// All of these are ok, because we can derive exactly one bound:
a: Box<IsStatic>,
b: Box<Is<'static>>,
c: Box<Is<'a>>,
d: Box<IsSend>,
e: Box<Is<'a>+Send>, // we can derive two bounds, but one is'static, so ok
f: Box<SomeTrait>, // OK, de... | random_line_split | |
region-bounds-on-objects-and-type-parameters.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,'b,'c> {
// All of these are ok, because we can derive exactly one bound:
a: Box<IsStatic>,
b: Box<Is<'static>>,
c: Box<Is<'a>>,
d: Box<IsSend>,
e: Box<Is<'a>+Send>, // we can derive two bounds, but one is'static, so ok
f: Box<SomeTrait>, // OK, defaults to'static due to RFC 599.
g... | Foo | identifier_name |
region-bounds-on-objects-and-type-parameters.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 ... |
fn main() { }
| { } | identifier_body |
init-twice-retains-filter.rs | extern crate env_logger;
extern crate log;
use std::env;
use std::process;
use std::str;
fn main() {
if env::var("YOU_ARE_TESTING_NOW").is_ok() {
// Init from the env (which should set the max level to `Debug`)
env_logger::init();
assert_eq!(log::LevelFilter::Debug, log::max_level());
... |
println!("test failed: {}", out.status);
println!("--- stdout\n{}", str::from_utf8(&out.stdout).unwrap());
println!("--- stderr\n{}", str::from_utf8(&out.stderr).unwrap());
process::exit(1);
}
| {
return;
} | conditional_block |
init-twice-retains-filter.rs | extern crate env_logger;
extern crate log;
use std::env;
use std::process;
use std::str;
fn | () {
if env::var("YOU_ARE_TESTING_NOW").is_ok() {
// Init from the env (which should set the max level to `Debug`)
env_logger::init();
assert_eq!(log::LevelFilter::Debug, log::max_level());
// Init again using a different max level
// This shouldn't clobber the level that w... | main | identifier_name |
init-twice-retains-filter.rs | extern crate env_logger;
extern crate log;
use std::env;
use std::process;
use std::str;
fn main() {
if env::var("YOU_ARE_TESTING_NOW").is_ok() {
// Init from the env (which should set the max level to `Debug`)
env_logger::init();
assert_eq!(log::LevelFilter::Debug, log::max_level()); | .parse_filters("info")
.try_init()
.unwrap_err();
assert_eq!(log::LevelFilter::Debug, log::max_level());
return;
}
let exe = env::current_exe().unwrap();
let out = process::Command::new(exe)
.env("YOU_ARE_TESTING_NOW", "1")
.env("RUST_LOG", "d... |
// Init again using a different max level
// This shouldn't clobber the level that was previously set
env_logger::Builder::new() | random_line_split |
init-twice-retains-filter.rs | extern crate env_logger;
extern crate log;
use std::env;
use std::process;
use std::str;
fn main() | .env("YOU_ARE_TESTING_NOW", "1")
.env("RUST_LOG", "debug")
.output()
.unwrap_or_else(|e| panic!("Unable to start child process: {}", e));
if out.status.success() {
return;
}
println!("test failed: {}", out.status);
println!("--- stdout\n{}", str::from_utf8(&out.stdou... | {
if env::var("YOU_ARE_TESTING_NOW").is_ok() {
// Init from the env (which should set the max level to `Debug`)
env_logger::init();
assert_eq!(log::LevelFilter::Debug, log::max_level());
// Init again using a different max level
// This shouldn't clobber the level that was ... | identifier_body |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.