Skip to content

Instantly share code, notes, and snippets.

View daboross's full-sized avatar

Dabo daboross

View GitHub Profile
import asyncio
from cloudbot import hook
@asyncio.coroutine
@hook.irc_raw('044')
def set_mode(conn):
conn.send("MODE {} +B".format(conn.nick))
fn main() {
let a = Box::new([0; isize::MAX]);
}
$ cargo new test-project
$ cd test-project
$ mkdir subdir
$ touch subdir/Cargo.toml
$ cargo build
failed to parse manifest at `/home/daboross/test-project/subdir/Cargo.toml`
Caused by:
No `package` or `project` section found.
$ rm -r subdir
daboross:/home/daboross/Projects/Rust/
$ cargo new project
daboross:/home/daboross/Projects/Rust/
$ cd project
daboross:/home/daboross/Projects/Rust/project/
$ cargo build
Compiling project v0.0.1 (file:///home/daboross/Projects/Rust/project)
daboross:/home/daboross/Projects/Rust/project/
$ cargo build --release
Compiling project v0.0.1 (file:///home/daboross/Projects/Rust/project)
class TestDecorator():
def __init__(self, function):
print("before: {}".format(hasattr(function, "test_value")))
function.test_value = self
print("after: {}".format(hasattr(function, "test_value")))
@TestDecorator
def test_function():
return "hi"
$ cargo build
Compiling zaldinar v0.1.1-dev (file:///home/daboross/zaldinar)
/home/daboross/zaldinar/src/dispatch.rs:176:17: 176:24 error: internal compiler error: the 1th autoderef failed: _
/home/daboross/zaldinar/src/dispatch.rs:176 closure(&events::CtcpEvent::new(interface, &event));
^~~~~~~
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'Box<Any>', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libsyntax/diagnost
ic.rs:123
@daboross
daboross / snipper2.rs
Last active August 29, 2015 14:12
Just a bunch of code to debug inotify events!
fn watch_binary() -> Result<thread::JoinGuard<()>, InitializationError> {
let mut watch = try!(inotify::INotify::init());
let args = os::args();
let program = match Path::new_opt(args[0].as_slice()) {
Some(v) => v,
None => return Err(InitializationError::from_string(
format!("Failed to create Path from args[0] ({})", args[0]))),
};
let filename = match program.filename_str() {
Some(v) => v.to_string(),
$ RUST_BACKTRACE=1 cargo build --verbose
   Compiling gcc v0.1.2
     Running `rustc /home/daboross/.cargo/registry/src/github.com-1ecc6299db9ec823/gcc-0.1.2/src/lib.rs --crate-name gcc --crate-type lib -g -C metadata=165e603132fd5f7c -C extra-filename=-165e603132fd5f7c --out-dir /home/daboross/Projects/Rust/zaldinar/target/deps --dep-info /home/daboross/Projects/Rust/zaldinar/target/.fingerprint/gcc-165e603132fd5f7c/dep-lib-gcc -L /home/daboross/Projects/Rust/zaldinar/target/deps -L /home/daboross/Projects/Rust/zaldinar/target/deps -Awarnings`
   Compiling fern v0.1.1
 Running `rustc /home/daboross/.cargo/registry/src/github.com-1ecc6299db9ec823/fern-0.1.1/src/lib.rs --crate-name fern --crate-type lib -g -C metadata=f947a6e68d6542c1 -C extra-filename=-f947a6e68d6542c1 --out-dir /home/daboross/Projects/Rust/zaldinar/target/deps --dep-info /home/daboross/Projects/Rust/zaldinar/target/.fingerprint/fern-f947a6e68d6542c1/dep-lib-fern -L /home/daboross/Projects/Rust/zaldinar/target/deps -L /home/daboross/P
   Compiling fern v0.1.1-dev (file:///home/daboross/Projects/Rust/fern)
<std macros>:4:24: 4:27 error: mismatched types: expected `api::Logger + Send+Sync`, found `loggers::WriterLogger<std::io::fs::File>` (expected trait api::Logger, found struct loggers::WriterLogger)
<std macros>:4             Ok(val) => val,
                                      ^~~
<std macros>:1:1: 8:2 note: in expansion of try!
/home/daboross/Projects/Rust/fern/src/config.rs:51:21: 51:80 note: expansion site
/home/daboross/Projects/Rust/fern/src/config.rs:51:17: 51:111 error: the trait `core::kinds::Sized` is not implemented for the type `api::Logger + Send+Sync`
/home/daboross/Projects/Rust/fern/src/config.rs:51                 box try!(loggers::WriterLogger::<io::File>::with_file(path)) as Box<api::Logger + Sync + Send>
                                                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Compiling simple-logging v0.0.1 (file:///home/daboross/Projects/Rust/simple-logging)
/home/daboross/Projects/Rust/simple-logging/src/lib.rs:35:5: 35:39 error: unable to infer enough type information to locate the impl of the trait `core::kinds::Send` for the type `_`; type annotations required
/home/daboross/Projects/Rust/simple-logging/src/lib.rs:35 loggers::WriterLogger::with_stdout();
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/daboross/Projects/Rust/simple-logging/src/lib.rs:35:5: 35:39 note: required by `loggers::WriterLogger<T>::with_stdout`
/home/daboross/Projects/Rust/simple-logging/src/lib.rs:35 loggers::WriterLogger::with_stdout();
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to previous error
Could not compile `simple-logging`.