Skip to content

Instantly share code, notes, and snippets.

---
# BasedOnStyle: LLVM
AccessModifierOffset: -4
ConstructorInitializerIndentWidth: 4
AlignEscapedNewlinesLeft: false
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakTemplateDeclarations: false
rustc --crate-type=dylib foo.rs
rustc caller.rs
static str: &'static [u8] = b"Hello\0";
#[repr(C)]
pub struct Foo {
ptr: *const i8
}
#[no_mangle]
pub extern "C" fn new_foo() -> Foo {
Foo {
use std::io::File;
fn main() {
let args = ::std::os::args();
let string = &args[1];
let replace = &args[2];
let path = &args[3];
assert!(replace.len() == string.len());
println!("Replacing`{}` with `{}` in `{}`...", string, replace, path);
let chars: Vec<char> = string.as_slice().chars().collect();
/// ```rust
/// use crusty_chip::{ DISPLAY_WIDTH, VirtualMachine };
/// // Dump the pixels to stdout
/// fn dump_pixels(pixels: &[u8]) {
/// for (i, px) in pixels.iter().enumerate() {
/// match *px {
/// 0 => print!(" "),
/// _ => print!("#")
/// }
/// if i % DISPLAY_WIDTH == 0 {
--- iter.s 2015-05-14 21:14:02.496673255 +0200
+++ while.s 2015-05-14 21:13:58.676673077 +0200
@@ -1,9 +1,9 @@
.text
- .file "iter.0.rs"
- .section .text._ZN4main20h5cb52da90a7daa0eeaaE,"ax",@progbits
+ .file "while.0.rs"
+ .section .text._ZN4main20hfa1625d262a55eb2eaaE,"ax",@progbits
.align 16, 0x90
- .type _ZN4main20h5cb52da90a7daa0eeaaE,@function
#![feature(test, clone_from_slice)]
extern "C" {
fn memcpy(dest: *mut libc::c_void, src: *const libc::c_void, n: libc::size_t) -> *mut libc::c_void;
}
extern crate test;
extern crate libc;
const TEXT: &'static [u8] =
extern crate md5;
fn find_number<F: Fn(md5::Digest) -> bool>(key: &str, predicate: F) -> u32 {
for n in 0.. {
let s = format!("{}{}", key, n);
let digest = md5::compute(s.as_bytes());
if predicate(digest) {
return n;
}
}
[xcb] Unknown request in queue while dequeuing
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
NoLifeClient: xcb_io.c:179: dequeue_pending_request: Assertion `!xcb_xlib_unknown_req_in_deq' failed.
The program has unexpectedly finished.
In file included from /usr/include/c++/4.8.1/bits/atomic_base.h:36:0,
from /usr/include/c++/4.8.1/atomic:41,
from /home/snake/projects/NoLifeStory/NoLifeClient/NoLifeClient.hpp:32,
from /home/snake/projects/NoLifeStory/NoLifeClient/Sprite.cpp:18:
/home/snake/projects/NoLifeStory/NoLifeClient/Sprite.cpp:26:38: error: use of deleted function 'std::atomic<bool>::atomic(const std::atomic<bool>&)'
atomic<bool> ThreadContextMade = false;
^
In file included from /home/snake/projects/NoLifeStory/NoLifeClient/NoLifeClient.hpp:32:0,
from /home/snake/projects/NoLifeStory/NoLifeClient/Sprite.cpp:18:
/usr/include/c++/4.8.1/atomic:487:7: error: declared here