Skip to content

Instantly share code, notes, and snippets.

View kemurphy's full-sized avatar

Kevin Murphy kemurphy

View GitHub Profile
@kemurphy
kemurphy / rustdeps.rs
Created June 15, 2013 06:07
Tool to list all dependencies of a rust source file. Usage: ./rustdeps foo.rs
extern mod syntax;
extern mod extra;
use syntax::ast::{item, item_mod};
use syntax::parse::{new_parse_sess, new_parser_from_file};
use syntax::parse::parser::Parser;
use syntax::codemap::FileName;
use std::os;
use extra::sort;
struct Node(uint, uint);
struct Nobe { fst: uint, snd: uint }
fn main() {
let foo = Node(17, 42);
let bar = Nobe{fst: 17, snd: 42};
}
diff --git a/src/librustc/middle/trans/callee.rs b/src/librustc/middle/trans/callee.rs
index d64615e..4a8b779 100644
--- a/src/librustc/middle/trans/callee.rs
+++ b/src/librustc/middle/trans/callee.rs
@@ -124,16 +124,6 @@ pub fn trans(bcx: @mut Block, expr: @ast::expr) -> Callee {
trait_did,
ref_expr.id))
}
- ast::def_variant(tid, vid) => {
- // nullary variants are not callable
@kemurphy
kemurphy / oops.rs
Last active December 20, 2015 06:39
pub fn rewrite_tuple_struct_or_variant_calls(c: &Crate, dm: DefMap) -> @Crate {
fn fold_expr(e: &ast::expr_, fld: @fold::ast_fold, dm: DefMap) -> Option<ast::expr_> {
let fold_unnamed_field = |x| {
ast::Field {
ident: special_idents::unnamed_field,
expr: fld.fold_expr(x),
span: fld.new_span(x.span),
}
};
let mut i: @item = fold::noop_fold_item(i, fld).take_unwrap();
i.node = match i.node {
item_mod(ref m) => {
item_mod(self.with_scope(Some(i.ident), || {
debug!("Rewriting: with scope %?", i.ident);
fld.fold_mod(m)
}))
},
item_foreign_mod(ref foreign_module) => {
item_foreign_mod(self.with_scope(Some(i.ident), ||
let replace_id = @mut None;
let rewriter = @fold::AstFoldFns {
fold_expr: do fold::wrap |e, fld| {
match fold_expr(e, fld, self.def_map, replace_id) {
Some(f) => {
debug!("Rewriting: wrote expr_struct");
f
}
None => fold::noop_fold_expr(e, fld)
// parse an element of a struct definition
fn parse_struct_decl_field(&self) -> @struct_field {
let attrs = self.parse_outer_attributes();
let vis = if self.eat_keyword(keywords::Priv) {
private
} else if self.eat_keyword(keywords::Pub) {
public
} else {
inherited
};

Keybase proof

I hereby claim:

  • I am kemurphy on github.
  • I am kemurphy (https://keybase.io/kemurphy) on keybase.
  • I have a public key whose fingerprint is 881D 9A33 4473 4044 5368 EA40 D368 327B 9B05 A530

To claim this, I am signing this object:

| * | 3x inferium essence | |
| twilight swamp | 8x steeleaf | !!!, mystical: tier 3, 8x essence => 5 leaf |
| twilight swamp | 2x fiery ingot | !!!, mystical: tier 4, 8x essence => 3 ingot |
| twilight glacier | 8x arctic fur | exclusive |
| twilight glacier | 4x arctic fur | exclusive |
| twilight glacier | charm of life ii | |
| twilight glacier | charm of keeping ii | |
| blaze | 2x blaze rod | better through 2x hellish + bone probably |
| blaze | 16x sulfur dust | |
| shulker | 4x shulker shell | exclusive
use std::{
collections::{btree_map, BTreeMap},
env,
io::Error,
sync::{Arc, Once},
};
use anyhow::{Context};
use futures::{Sink, Stream, StreamExt};
use log::info;