Skip to content

Instantly share code, notes, and snippets.

View steveklabnik's full-sized avatar
🦀
Rustacean

Steve Klabnik steveklabnik

🦀
Rustacean
View GitHub Profile
#!/bin/bash
for name in $(cat repos.txt); do
echo $name;
repo=$(echo $name | cut -d'/' -f2);
echo $repo;
hub clone $name;
cd $repo;
hub fork;
pwd && grep -lZR 'panic!' . | xargs -0 -l sed -i -e 's/panic!/panic!/g';
/// Literal strings translate to slices into static memory. This is different from
/// trans_slice_vstore() above because it doesn't need to copy the content anywhere.
pub fn trans_lit_str<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
lit_expr: &ast::Expr,
str_lit: InternedString,
dest: Dest)
-> Block<'blk, 'tcx> {
debug!("trans_lit_str(lit_expr={}, dest={})",
DEBUG:wtftw_core::core: creating new workspaces with 1 screen(s)
INFO:wtftw_core::config: compiling config module
INFO:wtftw_core::config: config module compiled
DEBUG:wtftw_core::config: looking for config module
DEBUG:wtftw_core::core: creating new workspaces with 1 screen(s)
INFO:wtftw: WTFTW - Window Tiling For The Win
INFO:wtftw: Starting wtftw on 1 screen(s)
DEBUG:wtftw: Display 0: 1920x1080 (0, 0)
DEBUG:wtftw: Size of keyhandlers after config.generaluration: 38
DEBUG:wtftw: grabbing command KeyCommand { mask: 0, key: 269025026 }
<std macros>:3:22: 3:40 error: mismatched types: expected `error::Error`, found `collections::string::String` (expected trait error::Error, found struct collections::string::String)
<std macros>:3 format_args!(::std::fmt::format, $($arg)*)
^~~~~~~~~~~~~~~~~~
note: in expansion of format_args!
<std macros>:3:9: 3:51 note: expansion site
<std macros>:1:1: 5:2 note: in expansion of format!
/home/steve/src/rust-book/src/build.rs:113:36: 116:34 note: expansion site
/home/steve/src/rust-book/src/build.rs:113:32: 116:45 error: the trait `core::kinds::Sized` is not implemented for the type `error::Error`
/home/steve/src/rust-book/src/build.rs:113 return Err(box format!("{}\n{}",
/home/steve/src/rust-book/src/build.rs:114 String::from_utf8_lossy(output.output[]),
- [ ] 0001-private-fields
- [ ] 0002-rfc-process
- [ ] 0003-attribute-usage
- [ ] 0008-new-intrinsics
- [ ] 0016-more-attributes
- [ ] 0019-opt-in-builtin-traits
- [ ] 0026-remove-priv
- [ ] 0034-bounded-type-parameters
- [ ] 0040-libstd-facade
- [ ] 0042-regexps
pub fn foo() -> int { 5 }
@steveklabnik
steveklabnik / wc.rs
Created March 23, 2015 21:50
a little wc-like in rust
#![feature(collections)]
use std::io::prelude::*;
use std::fs::File;
use std::io::BufReader;
fn main() {
let args: Vec<String> = std::env::args().collect();
let filename = args[1].clone();
@steveklabnik
steveklabnik / new_toc.md
Created April 7, 2015 23:57
new trpl toc propsal

here's the rendered SUMMARY.md: https://github.com/steveklabnik/rust/blob/new_toc/src/doc/trpl/SUMMARY.md

Basically, the overall structure is this:

  • Getting Started - getting an environment up and running
  • Learn Rust - project-based learning the basics
  • Effective Rust - higher level concepts that lead to writing good rust
  • Syntax and Semantics - chunks of exactly what it sounds like
  • Nightly Rust - unstable stuff, a staging area for documenting features
  • Glossary - self-explanatory
fn remove_first<T:Eq + Clone>(i: T, v: Vec<T>) -> Vec<T> {
let index = v.iter().position(|x| *x == i);
let mut result = vec![];
if index != None {
if index.unwrap() > 0 {
result.extend(v[0 .. index.unwrap()].to_vec());
}
@steveklabnik
steveklabnik / rustc_output.md
Last active August 29, 2015 14:20
Some output from rustc
$ uname -a
Linux warmachine 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt7-1 (2015-03-01) x86_64 GNU/Linux
$ cat > hello.rs
fn main() {
    println!("Hello, world");
}
$ rustc hello.rs 
$ ls -alh
total 580K