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 |
|---|---|---|---|---|
tree.rs | #![cfg_attr(feature = "unstable", feature(test))]
extern crate rand;
extern crate rdxsort;
#[cfg(feature = "unstable")]
mod unstable {
extern crate test;
use self::test::Bencher;
use rand::{Rng, XorShiftRng};
use rdxsort::*;
use std::collections::BTreeSet;
use std::collections::HashSet;
... |
#[bench]
fn bench_set_std(b: &mut Bencher) {
bench_generic(b, |vec| {
let mut set = BTreeSet::new();
for x in vec {
set.insert(x);
}
});
}
} | } | random_line_split |
build.rs |
use std::env;
use std::path::PathBuf;
fn main() {
let target = env::var("TARGET").unwrap();
if target.contains("pc-windows") {
let manifest_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
let mut lib_dir = manifest_dir.clone();
let mut dll_dir = manifest_dir.clone();
... |
else {
lib_dir.push("gnu-mingw");
dll_dir.push("gnu-mingw");
}
lib_dir.push("lib");
dll_dir.push("dll");
if target.contains("x86_64") {
lib_dir.push("64");
dll_dir.push("64");
}
else {
lib_dir.push("32")... | {
lib_dir.push("msvc");
dll_dir.push("msvc");
} | conditional_block |
build.rs |
use std::env;
use std::path::PathBuf;
fn main() | else {
lib_dir.push("32");
dll_dir.push("32");
}
println!("cargo:rustc-link-search=all={}", lib_dir.display());
for entry in std::fs::read_dir(dll_dir).expect("Can't read DLL dir") {
let entry_path = entry.expect("Invalid fs entry").path();
... | {
let target = env::var("TARGET").unwrap();
if target.contains("pc-windows") {
let manifest_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
let mut lib_dir = manifest_dir.clone();
let mut dll_dir = manifest_dir.clone();
if target.contains("msvc") {
lib_d... | identifier_body |
build.rs | use std::env;
use std::path::PathBuf;
fn main() {
let target = env::var("TARGET").unwrap();
if target.contains("pc-windows") {
let manifest_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
let mut lib_dir = manifest_dir.clone();
let mut dll_dir = manifest_dir.clone();
... | let entry_path = entry.expect("Invalid fs entry").path();
let file_name_result = entry_path.file_name();
let mut new_file_path = manifest_dir.clone();
if let Some(file_name) = file_name_result {
let file_name = file_name.to_str().unwrap();
... | lib_dir.push("32");
dll_dir.push("32");
}
println!("cargo:rustc-link-search=all={}", lib_dir.display());
for entry in std::fs::read_dir(dll_dir).expect("Can't read DLL dir") { | random_line_split |
build.rs |
use std::env;
use std::path::PathBuf;
fn | () {
let target = env::var("TARGET").unwrap();
if target.contains("pc-windows") {
let manifest_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
let mut lib_dir = manifest_dir.clone();
let mut dll_dir = manifest_dir.clone();
if target.contains("msvc") {
li... | main | identifier_name |
coerce-overloaded-autoderef-fail.rs | fn borrow_mut<T>(x: &mut T) -> &mut T { x }
fn borrow<T>(x: &T) -> &T { x }
fn borrow_mut2<T>(_: &mut T, _: &mut T) {}
fn borrow2<T>(_: &mut T, _: &T) {}
fn double_mut_borrow<T>(x: &mut Box<T>) {
let y = borrow_mut(x);
let z = borrow_mut(x);
//~^ ERROR cannot borrow `*x` as mutable more than once at a tim... | (x: &mut Box<i32>) {
let y = borrow(x);
let z = borrow(x);
**x += 1;
//~^ ERROR cannot assign to `**x` because it is borrowed
drop((y, z));
}
fn double_mut_borrow2<T>(x: &mut Box<T>) {
borrow_mut2(x, x);
//~^ ERROR cannot borrow `*x` as mutable more than once at a time
}
fn double_borrow2<... | double_imm_borrow | identifier_name |
coerce-overloaded-autoderef-fail.rs | fn borrow_mut<T>(x: &mut T) -> &mut T { x }
fn borrow<T>(x: &T) -> &T { x }
fn borrow_mut2<T>(_: &mut T, _: &mut T) {}
fn borrow2<T>(_: &mut T, _: &T) {}
fn double_mut_borrow<T>(x: &mut Box<T>) {
let y = borrow_mut(x);
let z = borrow_mut(x);
//~^ ERROR cannot borrow `*x` as mutable more than once at a tim... | borrow_mut2(x, x);
//~^ ERROR cannot borrow `*x` as mutable more than once at a time
}
fn double_borrow2<T>(x: &mut Box<T>) {
borrow2(x, x);
//~^ ERROR cannot borrow `*x` as mutable because it is also borrowed as immutable
}
pub fn main() {} | drop((y, z));
}
fn double_mut_borrow2<T>(x: &mut Box<T>) { | random_line_split |
coerce-overloaded-autoderef-fail.rs | fn borrow_mut<T>(x: &mut T) -> &mut T { x }
fn borrow<T>(x: &T) -> &T { x }
fn borrow_mut2<T>(_: &mut T, _: &mut T) {}
fn borrow2<T>(_: &mut T, _: &T) {}
fn double_mut_borrow<T>(x: &mut Box<T>) |
fn double_imm_borrow(x: &mut Box<i32>) {
let y = borrow(x);
let z = borrow(x);
**x += 1;
//~^ ERROR cannot assign to `**x` because it is borrowed
drop((y, z));
}
fn double_mut_borrow2<T>(x: &mut Box<T>) {
borrow_mut2(x, x);
//~^ ERROR cannot borrow `*x` as mutable more than once at a time... | {
let y = borrow_mut(x);
let z = borrow_mut(x);
//~^ ERROR cannot borrow `*x` as mutable more than once at a time
drop((y, z));
} | identifier_body |
lib.rs | // Copyright 2018 Google LLC
//
// Use of this source code is governed by an MIT-style
// license that can be found in the LICENSE file or at
// https://opensource.org/licenses/MIT.
//! Cryptography in Rust.
//!
//! Mundane is a Rust cryptography library backed by BoringSSL that is difficult
//! to misuse, ergonomic, ... | use boringssl::BoringError;
/// Errors generated by this crate.
///
/// `Error` represents two types of errors: errors generated by BoringSSL, and
/// errors generated by the Rust code in this crate. When printed (using either
/// `Display` or `Debug`), BoringSSL errors are of the form `boringssl:
/// <error>`, while ... | use std::fmt::{self, Debug, Display, Formatter};
| random_line_split |
lib.rs | // Copyright 2018 Google LLC
//
// Use of this source code is governed by an MIT-style
// license that can be found in the LICENSE file or at
// https://opensource.org/licenses/MIT.
//! Cryptography in Rust.
//!
//! Mundane is a Rust cryptography library backed by BoringSSL that is difficult
//! to misuse, ergonomic, ... | () {
fn assert_sync<T: Sync>() {}
assert_sync::<Error>();
}
}
| test_sync | identifier_name |
lib.rs | // Copyright 2018 Google LLC
//
// Use of this source code is governed by an MIT-style
// license that can be found in the LICENSE file or at
// https://opensource.org/licenses/MIT.
//! Cryptography in Rust.
//!
//! Mundane is a Rust cryptography library backed by BoringSSL that is difficult
//! to misuse, ergonomic, ... |
#[test]
fn test_sync() {
fn assert_sync<T: Sync>() {}
assert_sync::<Error>();
}
}
| {
fn assert_send<T: Send>() {}
assert_send::<Error>();
} | identifier_body |
obarray.rs | //! obarray code
use libc;
use remacs_macros::lisp_fn;
use remacs_sys::{Fpurecopy, Lisp_Object};
use remacs_sys::{check_obarray, check_vobarray, globals, intern_driver, make_unibyte_string,
oblookup};
use lisp::LispObject;
use lisp::defsubr;
/// A lisp object containing an `obarray`.
pub struct Lisp... | (&mut self, string: LispObject) -> LispObject {
let tem = self.lookup(string);
if tem.is_symbol() {
tem
} else if LispObject::from(unsafe { globals.f_Vpurify_flag }).is_not_nil() {
// When Emacs is running lisp code to dump to an executable, make
// use of pur... | intern | identifier_name |
obarray.rs | //! obarray code
use libc;
use remacs_macros::lisp_fn;
use remacs_sys::{Fpurecopy, Lisp_Object};
use remacs_sys::{check_obarray, check_vobarray, globals, intern_driver, make_unibyte_string,
oblookup};
use lisp::LispObject;
use lisp::defsubr;
/// A lisp object containing an `obarray`.
pub struct Lisp... |
/// Return the symbol that matches NAME (either a symbol or string). If
/// there is no such symbol, return the integer bucket number of where the
/// symbol would be if it were present.
///
/// # C Porting Notes
///
/// This is a wrapper around the C function `oblookup`. It is capable of
... | random_line_split | |
obarray.rs | //! obarray code
use libc;
use remacs_macros::lisp_fn;
use remacs_sys::{Fpurecopy, Lisp_Object};
use remacs_sys::{check_obarray, check_vobarray, globals, intern_driver, make_unibyte_string,
oblookup};
use lisp::LispObject;
use lisp::defsubr;
/// A lisp object containing an `obarray`.
pub struct Lisp... | else {
tem
}
}
/// Return the canonical symbol whose name is STRING.
/// If there is none, one is created by this function and returned.
/// A second optional argument specifies the obarray to use;
/// it defaults to the value of `obarray'.
#[lisp_fn(min = "1")]
fn intern(string: LispObject, obarray: Lisp... | {
LispObject::constant_nil()
} | conditional_block |
xrinputsource.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 crate::dom::bindings::codegen::Bindings::XRInputSourceBinding;
use crate::dom::bindings::codegen::Bindings::X... |
pub fn id(&self) -> InputId {
self.info.id
}
}
impl XRInputSourceMethods for XRInputSource {
/// https://immersive-web.github.io/webxr/#dom-xrinputsource-handedness
fn Handedness(&self) -> XRHandedness {
match self.info.handedness {
Handedness::None => XRHandedness::None,
... | {
reflect_dom_object(
Box::new(XRInputSource::new_inherited(session, info)),
global,
XRInputSourceBinding::Wrap,
)
} | identifier_body |
xrinputsource.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 crate::dom::bindings::codegen::Bindings::XRInputSourceBinding;
use crate::dom::bindings::codegen::Bindings::X... | Handedness::Right => XRHandedness::Right,
}
}
/// https://immersive-web.github.io/webxr/#dom-xrinputsource-targetrayspace
fn TargetRaySpace(&self) -> DomRoot<XRSpace> {
self.target_ray_space.or_init(|| {
let global = self.global();
XRSpace::new_inputspace... | match self.info.handedness {
Handedness::None => XRHandedness::None,
Handedness::Left => XRHandedness::Left, | random_line_split |
xrinputsource.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 crate::dom::bindings::codegen::Bindings::XRInputSourceBinding;
use crate::dom::bindings::codegen::Bindings::X... | (
global: &GlobalScope,
session: &XRSession,
info: InputSource,
) -> DomRoot<XRInputSource> {
reflect_dom_object(
Box::new(XRInputSource::new_inherited(session, info)),
global,
XRInputSourceBinding::Wrap,
)
}
pub fn id(&self) -> In... | new | identifier_name |
random_ordered_unique_vecs.rs | use core::hash::Hash;
use itertools::Itertools;
use malachite_base::chars::exhaustive::exhaustive_chars;
use malachite_base::chars::random::graphic_weighted_random_char_inclusive_range;
use malachite_base::num::random::geometric::geometric_random_unsigneds;
use malachite_base::num::random::random_primitive_ints;
use ma... | vec![52, 69, 73, 91, 115, 137, 153, 178],
vec![],
vec![34, 95, 112],
vec![],
vec![106, 130, 167, 168, 197],
vec![86, 101, 122, 150, 172, 177, 207, 218, 221],
],
&[
(vec![], 199913),
(vec![7], 705),
... | {
random_ordered_unique_vecs_helper(
&random_primitive_ints::<u8>,
4,
1,
&[
vec![],
vec![11, 32, 38, 85, 134, 136, 162, 166, 177, 200, 203, 217, 223, 235],
vec![30, 90, 218, 234],
vec![9, 106, 204, 216],
vec![151],
... | identifier_body |
random_ordered_unique_vecs.rs | use core::hash::Hash;
use itertools::Itertools;
use malachite_base::chars::exhaustive::exhaustive_chars;
use malachite_base::chars::random::graphic_weighted_random_char_inclusive_range;
use malachite_base::num::random::geometric::geometric_random_unsigneds;
use malachite_base::num::random::random_primitive_ints;
use ma... | #[test]
#[should_panic]
fn random_ordered_unique_vecs_fail_2() {
random_ordered_unique_vecs(EXAMPLE_SEED, &random_primitive_ints::<u32>, 1, 0);
}
#[test]
#[should_panic]
fn random_ordered_unique_vecs_fail_3() {
random_ordered_unique_vecs(
EXAMPLE_SEED,
&random_primitive_ints::<u32>,
u64... | #[should_panic]
fn random_ordered_unique_vecs_fail_1() {
random_ordered_unique_vecs(EXAMPLE_SEED, &random_primitive_ints::<u32>, 0, 1);
}
| random_line_split |
random_ordered_unique_vecs.rs | use core::hash::Hash;
use itertools::Itertools;
use malachite_base::chars::exhaustive::exhaustive_chars;
use malachite_base::chars::random::graphic_weighted_random_char_inclusive_range;
use malachite_base::num::random::geometric::geometric_random_unsigneds;
use malachite_base::num::random::random_primitive_ints;
use ma... | 2>, 1, 0);
}
#[test]
#[should_panic]
fn random_ordered_unique_vecs_fail_3() {
random_ordered_unique_vecs(
EXAMPLE_SEED,
&random_primitive_ints::<u32>,
u64::MAX,
u64::MAX - 1,
);
}
| SEED, &random_primitive_ints::<u3 | identifier_name |
protocol_trait.rs | // Copyright 2016 Alexander Reece
//
// 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... | specs: specs
}
}
} | }
impl<'a> ProtocolTraitWriter<'a> {
pub fn new(specs: &'a Specs<'a>) -> Self {
ProtocolTraitWriter { | random_line_split |
protocol_trait.rs | // Copyright 2016 Alexander Reece
//
// 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... | <W>(&self, writer: &mut W) -> io::Result<()>
where W: io::Write
{
try!(writeln!(
writer,
"pub trait Protocol<'a> {{\n\
type Frame: 'a;\n\
\n\
fn protocol_header() -> &'static [u8];\n"
));
for method in self.specs.me... | write_rust_to | identifier_name |
protocol_trait.rs | // Copyright 2016 Alexander Reece
//
// 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... | pascal_method = method.method_name().to_pascal_case(),
))
}
try!(writeln!(writer, "}} // pub trait Protocol<'a>"));
Ok(())
}
}
impl<'a> ProtocolTraitWriter<'a> {
pub fn new(specs: &'a Specs<'a>) -> Self {
ProtocolTraitWriter {
specs: sp... | {
try!(writeln!(
writer,
"pub trait Protocol<'a> {{\n\
type Frame: 'a;\n\
\n\
fn protocol_header() -> &'static [u8];\n"
));
for method in self.specs.methods() {
try!(writeln!(
writer,
... | identifier_body |
receipt.rs | //! Endpoints for event receipts.
/// [POST /_matrix/client/r0/rooms/{roomId}/receipt/{receiptType}/{eventId}](https://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-rooms-roomid-receipt-receipttype-eventid)
pub mod create_receipt {
use ruma_identifiers::{EventId, RoomId};
use std::fmt::... | ;
/// This endpoint's path parameters.
#[derive(Clone, Debug)]
pub struct PathParams {
/// The event ID to acknowledge up to.
pub event_id: EventId,
/// The type of receipt to send.
pub receipt_type: ReceiptType,
/// The room in which to send the event.
pub r... | Endpoint | identifier_name |
receipt.rs | //! Endpoints for event receipts.
/// [POST /_matrix/client/r0/rooms/{roomId}/receipt/{receiptType}/{eventId}](https://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-rooms-roomid-receipt-receipttype-eventid)
pub mod create_receipt {
use ruma_identifiers::{EventId, RoomId};
use std::fmt::... |
fn rate_limited() -> bool {
true
}
}
impl Display for ReceiptType {
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
match *self {
ReceiptType::Read => write!(f, "m.read"),
}
}
}
}
| {
true
} | identifier_body |
receipt.rs | //! Endpoints for event receipts.
/// [POST /_matrix/client/r0/rooms/{roomId}/receipt/{receiptType}/{eventId}](https://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-rooms-roomid-receipt-receipttype-eventid)
pub mod create_receipt {
use ruma_identifiers::{EventId, RoomId};
use std::fmt::... | }
/// This API endpoint's response.
#[derive(Clone, Copy, Debug, Deserialize, Serialize)]
pub struct Response;
impl<'de> ::Endpoint<'de> for Endpoint {
type BodyParams = ();
type PathParams = PathParams;
type QueryParams = ();
type Response = Response;
fn m... | #[derive(Clone, Copy, Debug)]
pub enum ReceiptType {
/// m.read
Read, | random_line_split |
texturegl.rs | // Copyright (c) 2016-2018 Bruce Stenning. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of co... | gl::TEXTURE_2D,
0, // Mipmap level
internal_format as GLint,
width as GLint,
height as GLint,
0, // Border: must be zero
data_format,
data_type,
... | );
} else {
gl::TexImage2D( | random_line_split |
texturegl.rs | // Copyright (c) 2016-2018 Bruce Stenning. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of co... | (&self, num: i32) {
unsafe {
gl::ActiveTexture(match num {
1 => gl::TEXTURE1,
_ => gl::TEXTURE0,
});
gl::BindTexture(gl::TEXTURE_2D, self.texture_name);
}
}
}
// Output the handle associated with the textures's image, for debug pu... | bind | identifier_name |
texturegl.rs | // Copyright (c) 2016-2018 Bruce Stenning. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of co... |
let mut ptr: *const raw::c_void = ptr::null();
if data.len()!= 0 {
ptr = mem::transmute(data.as_ptr());
};
if msaa > 1 {
gl::TexImage2DMultisample(
gl::TEXTURE_2D_MULTISAMPLE,
msaa as GLsizei,
... | {
gl::TexParameteri(gl::TEXTURE_2D, gl::TEXTURE_WRAP_S, gl::REPEAT as GLint);
gl::TexParameteri(gl::TEXTURE_2D, gl::TEXTURE_WRAP_T, gl::REPEAT as GLint);
gl::TexParameteri(gl::TEXTURE_2D, gl::TEXTURE_MAG_FILTER, gl::LINEAR as GLint);
gl::TexParameteri(gl::... | conditional_block |
texturegl.rs | // Copyright (c) 2016-2018 Bruce Stenning. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of co... | },
texture_name,
);
if msaa > 1 {
gl::TexParameteri(gl::TEXTURE_2D, gl::TEXTURE_WRAP_S, gl::REPEAT as GLint);
gl::TexParameteri(gl::TEXTURE_2D, gl::TEXTURE_WRAP_T, gl::REPEAT as GLint);
gl::TexParameteri(gl::TEXTURE_... | {
let mut texture_name: GLuint = 0;
let internal_format = if depth { gl::DEPTH_COMPONENT } else { gl::RGBA };
let data_format = if depth { gl::DEPTH_COMPONENT } else { gl::RGBA };
let data_type = if floating {
gl::FLOAT
} else {
gl::UNSIGNED_BYTE
... | identifier_body |
animation.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 transitions and animations.
use context::SharedLayoutContext;
use flow::{self, Flow};
use gfx::display_li... | Animation::Keyframes(_, _, ref mut state) => {
// This animation is still running, or we need to keep
// iterating.
now < state.started_at + state.duration || state.tick()
}
};
if still_running {
... | Animation::Transition(_, _, started_at, ref frame, _expired) => {
now < started_at + frame.duration
} | random_line_split |
animation.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 transitions and animations.
use context::SharedLayoutContext;
use flow::{self, Flow};
use gfx::display_li... | {
let mut damage = RestyleDamage::empty();
flow.mutate_fragments(&mut |fragment| {
if let Some(ref animations) = animations.get(&fragment.node) {
for animation in animations.iter() {
let old_style = fragment.style.clone();
update_style_for_animation(&context.s... | identifier_body | |
animation.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 transitions and animations.
use context::SharedLayoutContext;
use flow::{self, Flow};
use gfx::display_li... |
if should_push {
new_running_animations.push(animation);
}
}
if running_animations.is_empty() && new_running_animations.is_empty() {
// Nothing to do. Return early so we don't flood the compositor with
// `ChangeRunningAnimationsState` messages.
return
... | {
// If the animation was already present in the list for the
// node, just update its state, else push the new animation to
// run.
if let Some(ref mut animations) = running_animations.get_mut(node) {
// TODO: This being linear is probably not optimal.
... | conditional_block |
animation.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 transitions and animations.
use context::SharedLayoutContext;
use flow::{self, Flow};
use gfx::display_li... | (context: &SharedLayoutContext,
flow: &mut Flow,
animations: &HashMap<OpaqueNode,
Vec<Animation>>) {
let mut damage = RestyleDamage::empty();
flow.mutate_fragments(&mut |fragment| {
... | recalc_style_for_animations | identifier_name |
flatten.rs | use {Task, Poll};
use stream::Stream;
/// A combinator used to flatten a stream-of-streams into one long stream of
/// elements.
///
/// This combinator is created by the `Stream::flatten` method.
pub struct Flatten<S>
where S: Stream,
{
stream: S,
next: Option<S::Item>,
}
pub fn new<S>(s: S) -> Flatten<S... | {
Flatten {
stream: s,
next: None,
}
}
impl<S> Stream for Flatten<S>
where S: Stream,
S::Item: Stream,
<S::Item as Stream>::Error: From<S::Error>,
{
type Item = <S::Item as Stream>::Item;
type Error = <S::Item as Stream>::Error;
fn poll(&mut self, task: &mut... | random_line_split | |
flatten.rs | use {Task, Poll};
use stream::Stream;
/// A combinator used to flatten a stream-of-streams into one long stream of
/// elements.
///
/// This combinator is created by the `Stream::flatten` method.
pub struct Flatten<S>
where S: Stream,
{
stream: S,
next: Option<S::Item>,
}
pub fn new<S>(s: S) -> Flatten<S... |
}
| {
match self.next {
Some(ref mut s) => s.schedule(task),
None => self.stream.schedule(task),
}
} | identifier_body |
flatten.rs | use {Task, Poll};
use stream::Stream;
/// A combinator used to flatten a stream-of-streams into one long stream of
/// elements.
///
/// This combinator is created by the `Stream::flatten` method.
pub struct Flatten<S>
where S: Stream,
{
stream: S,
next: Option<S::Item>,
}
pub fn new<S>(s: S) -> Flatten<S... | (&mut self, task: &mut Task)
-> Poll<Option<Self::Item>, Self::Error> {
loop {
if self.next.is_none() {
match try_poll!(self.stream.poll(task)) {
Ok(Some(e)) => self.next = Some(e),
Ok(None) => return Poll::Ok(None),
... | poll | identifier_name |
unnecessary_sort_by.rs | // run-rustfix
#![allow(clippy::stable_sort_primitive)]
use std::cmp::Reverse;
fn unnecessary_sort_by() {
fn id(x: isize) -> isize {
x
}
let mut vec: Vec<isize> = vec![3, 6, 1, 2, 5];
// Forward examples
vec.sort_by(|a, b| a.cmp(b));
vec.sort_unstable_by(|a, b| a.cmp(b));
vec.sor... | }
fn wrapped(&self) -> Wrapper<'_> {
Wrapper(&self.0)
}
}
pub fn test() {
let mut args: Vec<Test> = vec![];
// Forward
args.sort_by(|a, b| a.name().cmp(b.name()));
args.sort_by(|a, b| a.wrapped().cmp(&b.wrapped()));
args.sort_unstabl... | struct Wrapper<'a>(&'a usize);
impl Test {
fn name(&self) -> &usize {
&self.0 | random_line_split |
unnecessary_sort_by.rs | // run-rustfix
#![allow(clippy::stable_sort_primitive)]
use std::cmp::Reverse;
fn unnecessary_sort_by() | vec.sort_unstable_by(|a, _| a.cmp(c));
// Vectors of references are fine as long as the resulting key does not borrow
let mut vec: Vec<&&&isize> = vec![&&&3, &&&6, &&&1, &&&2, &&&5];
vec.sort_by(|a, b| (***a).abs().cmp(&(***b).abs()));
vec.sort_unstable_by(|a, b| (***a).abs().cmp(&(***b).abs()));
... | {
fn id(x: isize) -> isize {
x
}
let mut vec: Vec<isize> = vec![3, 6, 1, 2, 5];
// Forward examples
vec.sort_by(|a, b| a.cmp(b));
vec.sort_unstable_by(|a, b| a.cmp(b));
vec.sort_by(|a, b| (a + 5).abs().cmp(&(b + 5).abs()));
vec.sort_unstable_by(|a, b| id(-a).cmp(&id(-b)));
/... | identifier_body |
unnecessary_sort_by.rs | // run-rustfix
#![allow(clippy::stable_sort_primitive)]
use std::cmp::Reverse;
fn unnecessary_sort_by() {
fn id(x: isize) -> isize {
x
}
let mut vec: Vec<isize> = vec![3, 6, 1, 2, 5];
// Forward examples
vec.sort_by(|a, b| a.cmp(b));
vec.sort_unstable_by(|a, b| a.cmp(b));
vec.sor... | () {
let mut args: Vec<Test> = vec![];
// Forward
args.sort_by(|a, b| a.name().cmp(&b.name()));
args.sort_unstable_by(|a, b| a.name().cmp(&b.name()));
// Reverse
args.sort_by(|a, b| b.name().cmp(&a.name()));
args.sort_unstable_by(|a, b| b.name().cmp(&a.name()));
... | test | identifier_name |
xfstate.rs | extern crate gears;
use gears::structure::xflow::*;
use gears::runtime::xfstate::*;
#[cfg(test)]
#[test]
fn test_store_has() {
let mut xfstate = XFState::default();
let xvar = XFlowVariable {
name: "number1".to_string(),
vtype: XFlowValueType::String,
value: XFlowValue::String("number1"... |
assert_eq!(xfstate.has("number1"), true);
match xfstate.get("number1") {
Some(res) => assert_eq!(res.name, "number1"),
None => println!("Error, number1 not found in xfstate"),
}
}
#[test]
fn test_store_add_and_remove() {
let mut xfstate = XFState::default();
let xvar = XFlowVaria... |
assert_eq!(xfstate.len(), 1);
assert_eq!(xfstate.is_empty(), false); | random_line_split |
xfstate.rs | extern crate gears;
use gears::structure::xflow::*;
use gears::runtime::xfstate::*;
#[cfg(test)]
#[test]
fn test_store_has() {
let mut xfstate = XFState::default();
let xvar = XFlowVariable {
name: "number1".to_string(),
vtype: XFlowValueType::String,
value: XFlowValue::String("number1"... | {
let mut xfstate = XFState::default();
let xvar = XFlowVariable {
name: "number1".to_string(),
vtype: XFlowValueType::String,
value: XFlowValue::String("number1".to_owned()),
};
xfstate.add(&xvar);
assert_eq!(xfstate.has("number1"), true);
xfstate.remove("number1");
... | identifier_body | |
xfstate.rs | extern crate gears;
use gears::structure::xflow::*;
use gears::runtime::xfstate::*;
#[cfg(test)]
#[test]
fn | () {
let mut xfstate = XFState::default();
let xvar = XFlowVariable {
name: "number1".to_string(),
vtype: XFlowValueType::String,
value: XFlowValue::String("number1".to_owned()),
};
assert_eq!(xfstate.len(), 0);
assert_eq!(xfstate.is_empty(), true);
xfstate.add(&xvar);
... | test_store_has | identifier_name |
kunpckdq.rs | use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode};
use ::RegType::*;
use ::instruction_def::*;
use ::Operand::*;
use ::Reg::*;
use ::RegScale::*;
fn | () {
run_test(&Instruction { mnemonic: Mnemonic::KUNPCKDQ, operand1: Some(Direct(K5)), operand2: Some(Direct(K2)), operand3: Some(Direct(K6)), operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[196, 225, 236, 75, 238], OperandSize::Dword)
}
fn kunpckdq_... | kunpckdq_1 | identifier_name |
kunpckdq.rs | use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode};
use ::RegType::*;
use ::instruction_def::*;
use ::Operand::*;
use ::Reg::*;
use ::RegScale::*;
fn kunpckdq_1() {
run_test(&Instruction { mnemonic: Mnemonic::KUNPCKDQ, operand1: Some(Direct(K5)), operand2: Some(Direct(... | {
run_test(&Instruction { mnemonic: Mnemonic::KUNPCKDQ, operand1: Some(Direct(K7)), operand2: Some(Direct(K1)), operand3: Some(Direct(K4)), operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[196, 225, 244, 75, 252], OperandSize::Qword)
} | identifier_body | |
kunpckdq.rs | use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode};
use ::RegType::*;
use ::instruction_def::*;
use ::Operand::*;
use ::Reg::*;
use ::RegScale::*; |
fn kunpckdq_1() {
run_test(&Instruction { mnemonic: Mnemonic::KUNPCKDQ, operand1: Some(Direct(K5)), operand2: Some(Direct(K2)), operand3: Some(Direct(K6)), operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[196, 225, 236, 75, 238], OperandSize::Dword)
}... | random_line_split | |
main.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 ... | #[cfg(rpass2)]
pub fn foo(_: u8) {
} | }
}
| random_line_split |
main.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 ... |
#[cfg(rpass2)]
pub fn foo(_: u8) {
}
| {
#[cfg(rpass1)]
{
extern_crate::foo(1);
}
#[cfg(rpass2)]
{
foo(1);
}
} | identifier_body |
main.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 ... | (_: u8) {
}
| foo | identifier_name |
third.rs | use std::rc::Rc;
pub struct List<T> {
head: Link<T>,
}
type Link<T> = Option<Rc<Node<T>>>;
struct Node<T> {
elem: T,
next: Link<T>,
}
pub struct Iter<'a, T:'a> {
next: Option<&'a Node<T>>,
}
impl<T> List<T> {
pub fn new() -> Self |
pub fn append(&self, elem: T) -> List<T> {
List { head: Some(Rc::new(Node {
elem: elem,
next: self.head.clone(),
}))}
}
pub fn tail(&self) -> List<T> {
List { head: self.head.as_ref().and_then(|node| node.next.clone()) }
}
pub fn head(&self) -> Opt... | {
List { head: None }
} | identifier_body |
third.rs | use std::rc::Rc;
pub struct List<T> {
head: Link<T>,
}
type Link<T> = Option<Rc<Node<T>>>;
struct Node<T> {
elem: T,
next: Link<T>,
}
pub struct Iter<'a, T:'a> {
next: Option<&'a Node<T>>,
}
impl<T> List<T> {
pub fn new() -> Self {
List { head: None }
}
pub fn append(&self, ... | (&self) -> List<T> {
List { head: self.head.as_ref().and_then(|node| node.next.clone()) }
}
pub fn head(&self) -> Option<&T> {
self.head.as_ref().map(|node| &node.elem)
}
pub fn iter(&self) -> Iter<T> {
Iter { next: self.head.as_ref().map(|node| &**node) }
}
}
impl<'a, T> ... | tail | identifier_name |
third.rs | use std::rc::Rc;
pub struct List<T> {
head: Link<T>,
}
type Link<T> = Option<Rc<Node<T>>>;
struct Node<T> {
elem: T,
next: Link<T>,
}
pub struct Iter<'a, T:'a> {
next: Option<&'a Node<T>>,
}
impl<T> List<T> {
pub fn new() -> Self {
List { head: None }
}
pub fn append(&self, ... |
#[test]
fn iter() {
let list = List::new().append(1).append(2).append(3);
let mut iter = list.iter();
assert_eq!(iter.next(), Some(&3));
assert_eq!(iter.next(), Some(&2));
assert_eq!(iter.next(), Some(&1));
}
} | } | random_line_split |
htmltableheadercellelement.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 dom::bindings::codegen::Bindings::HTMLTableHeaderCellElementBinding;
use dom::bindings::codegen::InheritTypes:... |
impl HTMLTableHeaderCellElement {
pub fn new_inherited(localName: DOMString, document: JSRef<Document>) -> HTMLTableHeaderCellElement {
HTMLTableHeaderCellElement {
htmltablecellelement: HTMLTableCellElement::new_inherited(HTMLTableHeaderCellElementTypeId, localName, document)
}
}
... | impl HTMLTableHeaderCellElementDerived for EventTarget {
fn is_htmltableheadercellelement(&self) -> bool {
self.type_id == NodeTargetTypeId(ElementNodeTypeId(HTMLTableHeaderCellElementTypeId))
}
} | random_line_split |
htmltableheadercellelement.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 dom::bindings::codegen::Bindings::HTMLTableHeaderCellElementBinding;
use dom::bindings::codegen::InheritTypes:... |
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, document: JSRef<Document>) -> Temporary<HTMLTableHeaderCellElement> {
let element = HTMLTableHeaderCellElement::new_inherited(localName, document);
Node::reflect_node(box element, document, HTMLTableHeaderCellElementBinding::Wrap)
... | {
HTMLTableHeaderCellElement {
htmltablecellelement: HTMLTableCellElement::new_inherited(HTMLTableHeaderCellElementTypeId, localName, document)
}
} | identifier_body |
htmltableheadercellelement.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 dom::bindings::codegen::Bindings::HTMLTableHeaderCellElementBinding;
use dom::bindings::codegen::InheritTypes:... | (localName: DOMString, document: JSRef<Document>) -> HTMLTableHeaderCellElement {
HTMLTableHeaderCellElement {
htmltablecellelement: HTMLTableCellElement::new_inherited(HTMLTableHeaderCellElementTypeId, localName, document)
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: ... | new_inherited | identifier_name |
thread.rs | // "Tifflin" Kernel
// - By John Hodge (thePowersGang)
| //
// Core/threads/thread.rs
//! Representation of an active thread
/**
* Ownership
* =========
*
* The `Thread` struct is owned by the thread itself (the pointer stored within TLS)
* however, it points to a shared block that contains information needed by both the
* thread itself, and the "owner" of th... | random_line_split | |
thread.rs | // "Tifflin" Kernel
// - By John Hodge (thePowersGang)
//
// Core/threads/thread.rs
//! Representation of an active thread
/**
* Ownership
* =========
*
* The `Thread` struct is owned by the thread itself (the pointer stored within TLS)
* however, it points to a shared block that contains information nee... |
lh.0 = Some(status);
Ok( () )
}
}
}
impl ProcessHandle
{
pub fn new<S: Into<String>+::core::fmt::Debug>(name: S, clone_start: usize, clone_end: usize) -> ProcessHandle {
ProcessHandle( Process::new(name, ::memory::virt::AddressSpace::new(clone_start, clone_end)) )
}
pub fn start_root_thre... | {
sleep_ref.signal();
} | conditional_block |
thread.rs | // "Tifflin" Kernel
// - By John Hodge (thePowersGang)
//
// Core/threads/thread.rs
//! Representation of an active thread
/**
* Ownership
* =========
*
* The `Thread` struct is owned by the thread itself (the pointer stored within TLS)
* however, it points to a shared block that contains information nee... | <T: Send+Sync+::core::marker::Reflect+Default+'static>(&self) -> Option<::lib::mem::aref::ArefBorrow<T>> {
let pld = &self.0.proc_local_data;
// 1. Try without write-locking
for s in pld.read().iter()
{
let item_ref: &::core::any::Any = &**s;
if item_ref.get_type_id() == ::core::any::TypeId::of::<T>... | get_process_local | identifier_name |
websocket_loader.rs | Name, Upgrade};
use hyper::http::h1::{LINE_ENDING, parse_response};
use hyper::method::Method;
use hyper::net::HttpStream;
use hyper::status::StatusCode;
use hyper::version::HttpVersion;
use ipc_channel::ipc::{IpcReceiver, IpcSender};
use net_traits::{CookieSource, MessageData, NetworkError};
use net_traits::{WebSocket... | ,
Err(e) => {
debug!("Failed to establish a WebSocket connection: {:?}", e);
let _ = resource_event_sender.send(WebSocketNetworkEvent::Fail);
return;
}
};
let initiated_close = Arc::new(AtomicBool::new(false));
let ws_send... | {
let _ = resource_event_sender.send(WebSocketNetworkEvent::ConnectionEstablished { protocol_in_use });
(sender, receiver)
} | conditional_block |
websocket_loader.rs | Name, Upgrade};
use hyper::http::h1::{LINE_ENDING, parse_response};
use hyper::method::Method;
use hyper::net::HttpStream;
use hyper::status::StatusCode;
use hyper::version::HttpVersion;
use ipc_channel::ipc::{IpcReceiver, IpcSender};
use net_traits::{CookieSource, MessageData, NetworkError};
use net_traits::{WebSocket... | rl: &ServoUrl,
origin: String,
headers: &mut Headers,
http_state: &HttpState)
-> Result<Response, NetworkError> {
// Step 1.
// Not applicable: with step 3 being useless here, this one is too.
// Step 2.
// Not applicable: we don't need to maintai... | tp_fetch(u | identifier_name |
websocket_loader.rs | std::sync::atomic::{AtomicBool, Ordering};
use std::thread;
use url::Position;
use websocket::Message;
use websocket::header::{Origin, WebSocketAccept, WebSocketKey, WebSocketProtocol, WebSocketVersion};
use websocket::message::OwnedMessage;
use websocket::receiver::{Reader as WsReader, Receiver as WsReceiver};
use we... | }
// FIXME: StatusCode::from_u16 isn't supposed to be used. | random_line_split | |
websocket_loader.rs | ProtocolName, Upgrade};
use hyper::http::h1::{LINE_ENDING, parse_response};
use hyper::method::Method;
use hyper::net::HttpStream;
use hyper::status::StatusCode;
use hyper::version::HttpVersion;
use ipc_channel::ipc::{IpcReceiver, IpcSender};
use net_traits::{CookieSource, MessageData, NetworkError};
use net_traits::{... |
// Step 4.4.
// Not applicable: CORS flag is unset.
response
};
// Step 5.
if response.as_ref().ok().map_or(false, |response| is_redirect_status(response.status)) {
// Step 5.1.
// Not applicable: the connection does not use HTTP/2.
// Steps 5.2-4.
... | // Step 1.
// Not applicable: with step 3 being useless here, this one is too.
// Step 2.
// Not applicable: we don't need to maintain an internal response.
// Step 3.
// Not applicable: request's service-workers mode is "none".
// Step 4.
// There cannot be a response yet at this poi... | identifier_body |
sized_unsized_cast.rs | use crate::structured_errors::StructuredDiagnostic;
use rustc_errors::{DiagnosticBuilder, DiagnosticId};
use rustc_middle::ty::{Ty, TypeFoldable};
use rustc_session::Session;
use rustc_span::Span;
pub struct SizedUnsizedCast<'tcx> {
pub sess: &'tcx Session,
pub span: Span,
pub expr_ty: Ty<'tcx>,
pub ca... | fn diagnostic_common(&self) -> DiagnosticBuilder<'tcx> {
if self.expr_ty.references_error() {
self.sess.diagnostic().struct_dummy()
} else {
self.sess.struct_span_fatal_with_code(
self.span,
&format!(
"cannot cast thin point... |
fn code(&self) -> DiagnosticId {
rustc_errors::error_code!(E0607)
}
| random_line_split |
sized_unsized_cast.rs | use crate::structured_errors::StructuredDiagnostic;
use rustc_errors::{DiagnosticBuilder, DiagnosticId};
use rustc_middle::ty::{Ty, TypeFoldable};
use rustc_session::Session;
use rustc_span::Span;
pub struct SizedUnsizedCast<'tcx> {
pub sess: &'tcx Session,
pub span: Span,
pub expr_ty: Ty<'tcx>,
pub ca... |
fn diagnostic_common(&self) -> DiagnosticBuilder<'tcx> {
if self.expr_ty.references_error() {
self.sess.diagnostic().struct_dummy()
} else {
self.sess.struct_span_fatal_with_code(
self.span,
&format!(
"cannot cast thin poi... | {
rustc_errors::error_code!(E0607)
} | identifier_body |
sized_unsized_cast.rs | use crate::structured_errors::StructuredDiagnostic;
use rustc_errors::{DiagnosticBuilder, DiagnosticId};
use rustc_middle::ty::{Ty, TypeFoldable};
use rustc_session::Session;
use rustc_span::Span;
pub struct SizedUnsizedCast<'tcx> {
pub sess: &'tcx Session,
pub span: Span,
pub expr_ty: Ty<'tcx>,
pub ca... |
}
fn diagnostic_extended(&self, mut err: DiagnosticBuilder<'tcx>) -> DiagnosticBuilder<'tcx> {
err.help(
"Thin pointers are \"simple\" pointers: they are purely a reference to a
memory address.
Fat pointers are pointers referencing \"Dynamically Sized Types\" (also
called DST). DST don't ... | {
self.sess.struct_span_fatal_with_code(
self.span,
&format!(
"cannot cast thin pointer `{}` to fat pointer `{}`",
self.expr_ty, self.cast_ty
),
self.code(),
)
} | conditional_block |
sized_unsized_cast.rs | use crate::structured_errors::StructuredDiagnostic;
use rustc_errors::{DiagnosticBuilder, DiagnosticId};
use rustc_middle::ty::{Ty, TypeFoldable};
use rustc_session::Session;
use rustc_span::Span;
pub struct SizedUnsizedCast<'tcx> {
pub sess: &'tcx Session,
pub span: Span,
pub expr_ty: Ty<'tcx>,
pub ca... | (&self) -> DiagnosticId {
rustc_errors::error_code!(E0607)
}
fn diagnostic_common(&self) -> DiagnosticBuilder<'tcx> {
if self.expr_ty.references_error() {
self.sess.diagnostic().struct_dummy()
} else {
self.sess.struct_span_fatal_with_code(
self.s... | code | identifier_name |
flock.rs | use std::fs::{File, OpenOptions};
use std::io;
use std::io::{Read, Seek, SeekFrom, Write};
use std::path::{Display, Path, PathBuf};
use termcolor::Color::Cyan;
use crate::util::errors::{CargoResult, CargoResultExt};
use crate::util::paths;
use crate::util::Config;
use sys::*;
#[derive(Debug)]
pub struct FileLock {
... |
}
#[cfg(target_os = "solaris")]
fn flock(file: &File, flag: libc::c_int) -> Result<()> {
// Solaris lacks flock(), so simply succeed with a no-op
Ok(())
}
}
#[cfg(windows)]
mod sys {
use std::fs::File;
use std::io::{Error, Result};
use std::mem;
use std::os::windows::i... | {
Ok(())
} | conditional_block |
flock.rs | use std::fs::{File, OpenOptions};
use std::io;
use std::io::{Read, Seek, SeekFrom, Write};
use std::path::{Display, Path, PathBuf};
use termcolor::Color::Cyan;
use crate::util::errors::{CargoResult, CargoResultExt};
use crate::util::paths;
use crate::util::Config;
use sys::*;
#[derive(Debug)]
pub struct FileLock {
... |
/// Like `Path::join`, creates a new filesystem rooted at this filesystem
/// joined with the given path.
pub fn join<T: AsRef<Path>>(&self, other: T) -> Filesystem {
Filesystem::new(self.root.join(other))
}
/// Like `Path::push`, pushes a new path component onto this filesystem.
pub ... | {
Filesystem { root: path }
} | identifier_body |
flock.rs | use std::fs::{File, OpenOptions};
use std::io;
use std::io::{Read, Seek, SeekFrom, Write};
use std::path::{Display, Path, PathBuf};
use termcolor::Color::Cyan;
use crate::util::errors::{CargoResult, CargoResultExt};
use crate::util::paths;
use crate::util::Config;
use sys::*;
#[derive(Debug)]
pub struct FileLock {
... |
pub(super) fn error_unsupported(err: &Error) -> bool {
err.raw_os_error()
.map_or(false, |x| x == ERROR_INVALID_FUNCTION as i32)
}
pub(super) fn unlock(file: &File) -> Result<()> {
unsafe {
let ret = UnlockFile(file.as_raw_handle(), 0, 0,!0,!0);
if ret ==... | pub(super) fn error_contended(err: &Error) -> bool {
err.raw_os_error()
.map_or(false, |x| x == ERROR_LOCK_VIOLATION as i32)
} | random_line_split |
flock.rs | use std::fs::{File, OpenOptions};
use std::io;
use std::io::{Read, Seek, SeekFrom, Write};
use std::path::{Display, Path, PathBuf};
use termcolor::Color::Cyan;
use crate::util::errors::{CargoResult, CargoResultExt};
use crate::util::paths;
use crate::util::Config;
use sys::*;
#[derive(Debug)]
pub struct FileLock {
... | (file: &File, flag: libc::c_int) -> Result<()> {
// Solaris lacks flock(), so simply succeed with a no-op
Ok(())
}
}
#[cfg(windows)]
mod sys {
use std::fs::File;
use std::io::{Error, Result};
use std::mem;
use std::os::windows::io::AsRawHandle;
use winapi::shared::minwindef::DW... | flock | identifier_name |
chmod.rs | #![crate_name = "uu_chmod"]
/*
* This file is part of the uutils coreutils package.
*
* (c) Arcterus <arcterus@mail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
extern crate getopts;
extern crate libc;
extern crate walker... | (file: &Path, name: &str, changes: bool, quiet: bool, verbose: bool, fmode: Option<libc::mode_t>, cmode: Option<&String>) -> Result<(), i32> {
// chmod is useless on Windows
// it doesn't set any permissions at all
// instead it just sets the readonly attribute on the file
Err(0)
}
#[cfg(unix)]
fn chmod... | chmod_file | identifier_name |
chmod.rs | #![crate_name = "uu_chmod"]
/*
* This file is part of the uutils coreutils package.
*
* (c) Arcterus <arcterus@mail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
extern crate getopts;
extern crate libc;
extern crate walker... |
mode = &mode[pos..];
while mode.len() > 0 {
let (op, pos) = try!(parse_op(mode, None));
mode = &mode[pos..];
let (srwx, pos) = parse_change(mode, fperm, file);
mode = &mode[pos..];
match op {
'+' => fperm |= srwx & mask,
'-' => fperm &=!(srwx & ma... | {
return Err(format!("invalid mode ({})", mode));
} | conditional_block |
chmod.rs | #![crate_name = "uu_chmod"]
/*
* This file is part of the uutils coreutils package.
*
* (c) Arcterus <arcterus@mail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
extern crate getopts;
extern crate libc;
extern crate walker... | }
| {
if fperm == mode {
if verbose && !changes {
show_info!("mode of '{}' retained as {:o}", file.display(), fperm);
}
Ok(())
} else if unsafe { libc::chmod(path.as_ptr(), mode) } == 0 {
if verbose || changes {
show_info!("mode of '{}' changed from {:o} to {:... | identifier_body |
chmod.rs | #![crate_name = "uu_chmod"]
/*
* This file is part of the uutils coreutils package.
*
* (c) Arcterus <arcterus@mail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
extern crate getopts;
extern crate libc;
extern crate walker... | let msg = format!("{name} {version}
Usage:
{program} [OPTION]... MODE[,MODE]... FILE...
{program} [OPTION]... OCTAL-MODE FILE...
{program} [OPTION]... --reference=RFILE FILE...
Change the mode of each FILE to MODE.
With --reference, change the mode of each FILE to that of RFILE.
Each MODE is of the form... | random_line_split | |
outline.mako.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/. */
<%namespace name="helpers" file="/helpers.mako.rs" />
<% from data import Method %>
<% data.new_style_struct("Out... | <'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>)
-> Result<SpecifiedValue, ParseError<'i>> {
SpecifiedValue::parse(context, input)
.and_then(|result| {
if let Either::Second(BorderStyle::hidden) = result {
// The outline-style ... | parse | identifier_name |
outline.mako.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/. */
<%namespace name="helpers" file="/helpers.mako.rs" />
<% from data import Method %>
<% data.new_style_struct("Out... |
#[inline]
pub fn get_initial_specified_value() -> SpecifiedValue {
Either::Second(BorderStyle::none)
}
pub mod computed_value {
pub type T = super::SpecifiedValue;
}
pub fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>)
-> Result<S... | {
Either::Second(BorderStyle::none)
} | identifier_body |
outline.mako.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/. */
<%namespace name="helpers" file="/helpers.mako.rs" />
<% from data import Method %>
<% data.new_style_struct("Out... | "Au::from_px(3)",
initial_specified_value="specified::BorderSideWidth::Medium",
computed_type="::app_units::Au",
animation_value_type="ComputedValue",
spec="https://drafts.csswg.org/css-ui/#... | }
</%helpers:longhand>
${helpers.predefined_type("outline-width",
"BorderSideWidth", | random_line_split |
into_bits.rs | //! Implementation of `FromBits` and `IntoBits`.
/// Safe lossless bitwise conversion from `T` to `Self`.
pub trait FromBits<T>: crate::marker::Sized {
/// Safe lossless bitwise transmute from `T` to `Self`.
fn from_bits(t: T) -> Self;
}
/// Safe lossless bitwise conversion from `Self` to `T`.
pub trait IntoB... |
/// `FromBits` and `IntoBits` are reflexive
impl<T> FromBits<T> for T {
#[inline]
fn from_bits(t: Self) -> Self {
t
}
}
#[macro_use]
mod macros;
mod v16;
pub use self::v16::*;
mod v32;
pub use self::v32::*;
mod v64;
pub use self::v64::*;
mod v128;
pub use self::v128::*;
mod v256;
pub use self... | );
U::from_bits(self)
}
} | random_line_split |
into_bits.rs | //! Implementation of `FromBits` and `IntoBits`.
/// Safe lossless bitwise conversion from `T` to `Self`.
pub trait FromBits<T>: crate::marker::Sized {
/// Safe lossless bitwise transmute from `T` to `Self`.
fn from_bits(t: T) -> Self;
}
/// Safe lossless bitwise conversion from `Self` to `T`.
pub trait IntoB... |
}
/// `FromBits` and `IntoBits` are reflexive
impl<T> FromBits<T> for T {
#[inline]
fn from_bits(t: Self) -> Self {
t
}
}
#[macro_use]
mod macros;
mod v16;
pub use self::v16::*;
mod v32;
pub use self::v32::*;
mod v64;
pub use self::v64::*;
mod v128;
pub use self::v128::*;
mod v256;
pub use s... | {
debug_assert!(
crate::mem::size_of::<Self>() == crate::mem::size_of::<U>()
);
U::from_bits(self)
} | identifier_body |
into_bits.rs | //! Implementation of `FromBits` and `IntoBits`.
/// Safe lossless bitwise conversion from `T` to `Self`.
pub trait FromBits<T>: crate::marker::Sized {
/// Safe lossless bitwise transmute from `T` to `Self`.
fn from_bits(t: T) -> Self;
}
/// Safe lossless bitwise conversion from `Self` to `T`.
pub trait IntoB... | (self) -> U {
debug_assert!(
crate::mem::size_of::<Self>() == crate::mem::size_of::<U>()
);
U::from_bits(self)
}
}
/// `FromBits` and `IntoBits` are reflexive
impl<T> FromBits<T> for T {
#[inline]
fn from_bits(t: Self) -> Self {
t
}
}
#[macro_use]
mod macros... | into_bits | identifier_name |
borrow.rs | // 此函数拥有 box 的所有权并销毁它
fn eat_box_i32(boxed_i32: Box<i32>) {
println!("Destroying box that contains {}", boxed_i32);
}
// 此函数借用了一个 i32 类型
fn borrow_i32(borrowed_i32: &i32) {
println!("This int is: {}", borrowed_i32);
}
fn main() {
// 创建一个装箱的 i32 类型,以及一个存在栈中的 i32 类型。
| // box 现在可以放弃 `eat_i32` 的所有权且可以销毁
eat_i32(boxed_i32);
}
| let boxed_int = Box::new(5_i32);
let stacked_i32 = 6_i32;
// 借用了 box 的内容,但没有取得所有权,所以 box 的内容可以
// 再次借用。
borrow_i32(&boxed_i32);
borrow_i32(&tacked_i32);
{
// 给出一个指向 box 里面所包含数据的引用
let _ref_to_i32: &i32 = &boxed_i32;
// 报错!
// 当 `boxed_i32` 里面的值被借用时,不能销毁 `boxed... | identifier_body |
borrow.rs | // 此函数拥有 box 的所有权并销毁它
fn eat_box_i32(boxed_i32: Box<i32>) {
println!("Destroying box that contains {}", boxed_i32);
}
// 此函数借用了一个 i32 类型
fn borrow_i32(borrowed_i32: &i32) { |
fn main() {
// 创建一个装箱的 i32 类型,以及一个存在栈中的 i32 类型。
let boxed_int = Box::new(5_i32);
let stacked_i32 = 6_i32;
// 借用了 box 的内容,但没有取得所有权,所以 box 的内容可以
// 再次借用。
borrow_i32(&boxed_i32);
borrow_i32(&tacked_i32);
{
// 给出一个指向 box 里面所包含数据的引用
let _ref_to_i32: &i32 = &boxed_i32;
... | println!("This int is: {}", borrowed_i32);
} | random_line_split |
borrow.rs | // 此函数拥有 box 的所有权并销毁它
fn eat_box_i32(boxed_i32: Box<i32>) {
println!("Destroying box that contains {}", boxed_i32);
}
// 此函数借用了一个 i32 类型
fn borrow_i32(borrowed_i32: &i32) {
println!( | is: {}", borrowed_i32);
}
fn main() {
// 创建一个装箱的 i32 类型,以及一个存在栈中的 i32 类型。
let boxed_int = Box::new(5_i32);
let stacked_i32 = 6_i32;
// 借用了 box 的内容,但没有取得所有权,所以 box 的内容可以
// 再次借用。
borrow_i32(&boxed_i32);
borrow_i32(&tacked_i32);
{
// 给出一个指向 box 里面所包含数据的引用
let _ref_to_i3... | "This int | identifier_name |
braille.rs | // Copyright (c) 2016 Patrick Burroughs <celti@celti.name>.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// https://www.apache.org/licenses/LICENSE-2.0>, or the MIT license
// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option.
// This file may not be copied, modified, or di... | else { 0 };
let mut output: Graph = vec![vec![EMPTY; blocks]; lines];
for (block,chunk) in input.chunks(2).collect::<Vec<&[usize]>>().iter().enumerate() {
for (index,value) in chunk.iter().enumerate() {
for line in 0..lines {
let partial = value.saturating_sub(line * 4);
... | { 2 } | conditional_block |
braille.rs | // Copyright (c) 2016 Patrick Burroughs <celti@celti.name>.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// https://www.apache.org/licenses/LICENSE-2.0>, or the MIT license
// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option.
// This file may not be copied, modified, or di... | (reverse: bool, input: Vec<usize>) -> Result<Graph> {
let blocks = input.len() / 2 + if input.len() % 2 > 0 { 1 } else { 0 };
let lines = max((try!(input.iter().max().ok_or(Error { kind: NoInput })) + 3) / 4, 1);
let char = if reverse { 2 } else { 0 };
let mut output: Graph = vec![vec![E... | horizontal_graph | identifier_name |
braille.rs | // Copyright (c) 2016 Patrick Burroughs <celti@celti.name>.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// https://www.apache.org/licenses/LICENSE-2.0>, or the MIT license
// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option.
// This file may not be copied, modified, or di... | };
Ok(output)
}
pub fn vertical_graph(reverse: bool, input: Vec<usize>) -> Result<Graph> {
let blocks = max((try!(input.iter().max().ok_or(Error { kind: NoInput })) + 1) / 2, 1);
let lines = input.len() / 4 + if input.len() % 4 > 0 { 1 } else { 0 };
let char = if reverse { 3 } else... | {
let blocks = input.len() / 2 + if input.len() % 2 > 0 { 1 } else { 0 };
let lines = max((try!(input.iter().max().ok_or(Error { kind: NoInput })) + 3) / 4, 1);
let char = if reverse { 2 } else { 0 };
let mut output: Graph = vec![vec![EMPTY; blocks]; lines];
for (block,chunk) in inp... | identifier_body |
braille.rs | // Copyright (c) 2016 Patrick Burroughs <celti@celti.name>.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// https://www.apache.org/licenses/LICENSE-2.0>, or the MIT license
// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option.
// This file may not be copied, modified, or di... | for (line, chunk) in input.chunks(4).collect::<Vec<&[usize]>>().iter().enumerate() {
for (index,value) in chunk.iter().enumerate() {
for block in 0..blocks {
let partial = value.saturating_sub(block * 2);
let insert = if partial > 2 { 2 } else { partial };
... | let lines = input.len() / 4 + if input.len() % 4 > 0 { 1 } else { 0 };
let char = if reverse { 3 } else { 1 };
let mut output: Graph = vec![vec![EMPTY; blocks]; lines];
| random_line_split |
method-two-trait-defer-resolution-1.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 ... |
}
impl foo for Vec<i32> {
fn foo(&self) -> i32 {2}
}
fn call_foo_uint() -> i32 {
let mut x = Vec::new();
let y = x.foo();
x.push(0u32);
y
}
fn call_foo_int() -> i32 {
let mut x = Vec::new();
let y = x.foo();
x.push(0i32);
y
}
fn main() {
assert_eq!(call_foo_uint(), 1);
a... | {1} | identifier_body |
method-two-trait-defer-resolution-1.rs | //
// 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.
// Test that we ... | // 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. | random_line_split | |
method-two-trait-defer-resolution-1.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 ... | () -> i32 {
let mut x = Vec::new();
let y = x.foo();
x.push(0u32);
y
}
fn call_foo_int() -> i32 {
let mut x = Vec::new();
let y = x.foo();
x.push(0i32);
y
}
fn main() {
assert_eq!(call_foo_uint(), 1);
assert_eq!(call_foo_int(), 2);
}
| call_foo_uint | identifier_name |
annotations.rs | //! Types and functions related to bindgen annotation comments.
//!
//! Users can add annotations in doc comments to types that they would like to
//! replace other types with, mark as opaque, etc. This module deals with all of
//! that stuff.
use clang;
/// What kind of accessor should we provide for a field?
#[deri... |
/// For a given type, indicates the type it should replace.
///
/// For example, in the following code:
///
/// ```cpp
///
/// /** <div rustbindgen replaces="Bar"></div> */
/// struct Foo { int x; };
///
/// struct Bar { char foo; };
/// ```
///
/// the generated co... | {
self.opaque
} | identifier_body |
annotations.rs | //! Types and functions related to bindgen annotation comments.
//!
//! Users can add annotations in doc comments to types that they would like to
//! replace other types with, mark as opaque, etc. This module deals with all of
//! that stuff.
use clang;
/// What kind of accessor should we provide for a field?
#[deri... | /// ```
///
/// the generated code would look something like:
///
/// ```
/// /** <div rustbindgen replaces="Bar"></div> */
/// struct Bar {
/// x: ::std::os::raw::c_int,
/// };
/// ```
///
/// That is, code for `Foo` is used to generate `Bar`.
pub fn use_instead_... | ///
/// struct Bar { char foo; }; | random_line_split |
annotations.rs | //! Types and functions related to bindgen annotation comments.
//!
//! Users can add annotations in doc comments to types that they would like to
//! replace other types with, mark as opaque, etc. This module deals with all of
//! that stuff.
use clang;
/// What kind of accessor should we provide for a field?
#[deri... | (&self) -> Option<bool> {
self.private_fields
}
/// What kind of accessors should we provide for this type's fields?
pub fn accessor_kind(&self) -> Option<FieldAccessorKind> {
self.accessor_kind
}
fn parse(&mut self, comment: &clang::Comment, matched: &mut bool) {
use clang... | private_fields | identifier_name |
path_utils.rs | use crate::borrow_set::{BorrowData, BorrowSet, TwoPhaseActivation};
use crate::places_conflict;
use crate::AccessDepth;
use crate::BorrowIndex;
use crate::Upvar;
use rustc_data_structures::graph::dominators::Dominators;
use rustc_middle::mir::BorrowKind;
use rustc_middle::mir::{BasicBlock, Body, Field, Location, Place,... | debug!(
"each_borrow_involving_path: {:?} @ {:?} vs. {:?}/{:?}",
i, borrowed, place, access
);
let ctrl = op(s, i, borrowed);
if ctrl == Control::Break {
return;
}
}
}
}
pub(super) fn is_active<'tcx... | {
let (access, place) = access_place;
// FIXME: analogous code in check_loans first maps `place` to
// its base_path.
// check for loan restricting path P being used. Accounts for
// borrows of P, P.a.b, etc.
for i in candidates {
let borrowed = &borrow_set[i];
if places_confl... | identifier_body |
path_utils.rs | use crate::borrow_set::{BorrowData, BorrowSet, TwoPhaseActivation};
use crate::places_conflict;
use crate::AccessDepth;
use crate::BorrowIndex;
use crate::Upvar;
use rustc_data_structures::graph::dominators::Dominators;
use rustc_middle::mir::BorrowKind;
use rustc_middle::mir::{BasicBlock, Body, Field, Location, Place,... | <'tcx>(
dominators: &Dominators<BasicBlock>,
borrow_data: &BorrowData<'tcx>,
location: Location,
) -> bool {
debug!("is_active(borrow_data={:?}, location={:?})", borrow_data, location);
let activation_location = match borrow_data.activation_location {
// If this is not a 2-phase borrow, it ... | is_active | identifier_name |
path_utils.rs | use crate::borrow_set::{BorrowData, BorrowSet, TwoPhaseActivation};
use crate::places_conflict;
use crate::AccessDepth;
use crate::BorrowIndex;
use crate::Upvar;
use rustc_data_structures::graph::dominators::Dominators;
use rustc_middle::mir::BorrowKind;
use rustc_middle::mir::{BasicBlock, Body, Field, Location, Place,... | ) -> Option<Field> {
let mut place_ref = place_ref;
let mut by_ref = false;
if let Some((place_base, ProjectionElem::Deref)) = place_ref.last_projection() {
place_ref = place_base;
by_ref = true;
}
match place_ref.last_projection() {
Some((place_base, ProjectionElem::Field(... | tcx: TyCtxt<'tcx>,
upvars: &[Upvar<'tcx>],
place_ref: PlaceRef<'tcx>,
body: &Body<'tcx>, | random_line_split |
trait-bounds-in-arc.rs | // xfail-pretty
// 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
//... | let (p2,c2) = comm::stream();
let arc2 = arc.clone();
do task::spawn { check_names(arc2); c2.send(()); }
let (p3,c3) = comm::stream();
let arc3 = arc.clone();
do task::spawn { check_pedigree(arc3); c3.send(()); }
p1.recv();
p2.recv();
p3.recv();
}
fn check_legs(arc: arc::Arc<~[~Pet:... | random_line_split | |
trait-bounds-in-arc.rs | // xfail-pretty
// 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
//... | {
num_whiskers: uint,
name: ~str,
}
struct Dogge {
bark_decibels: uint,
tricks_known: uint,
name: ~str,
}
struct Goldfyshe {
swim_speed: uint,
name: ~str,
}
impl Pet for Catte {
fn name(&self, blk: |&str|) { blk(self.name) }
fn num_legs(&self) -> uint { 4 }
fn of_good_pedigre... | Catte | identifier_name |
trait-bounds-in-arc.rs | // xfail-pretty
// 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
//... |
fn check_names(arc: arc::Arc<~[~Pet:Freeze+Send]>) {
for pet in arc.get().iter() {
pet.name(|name| {
assert!(name[0] == 'a' as u8 && name[1] == 'l' as u8);
})
}
}
fn check_pedigree(arc: arc::Arc<~[~Pet:Freeze+Send]>) {
for pet in arc.get().iter() {
assert!(pet.of_good_pe... | {
let mut legs = 0;
for pet in arc.get().iter() {
legs += pet.num_legs();
}
assert!(legs == 12);
} | identifier_body |
TestNextafter.rs | /*
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by app... | }
float2 __attribute__((kernel)) testNextafterFloat2Float2Float2(float2 inX, unsigned int x) {
float2 inY = rsGetElementAt_float2(gAllocInY, x);
return nextafter(inX, inY);
}
float3 __attribute__((kernel)) testNextafterFloat3Float3Float3(float3 inX, unsigned int x) {
float3 inY = rsGetElementAt_float3(gAl... | rs_allocation gAllocInY;
float __attribute__((kernel)) testNextafterFloatFloatFloat(float inX, unsigned int x) {
float inY = rsGetElementAt_float(gAllocInY, x);
return nextafter(inX, inY); | random_line_split |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.