From 204afe9e29303702f737f1002ec2217018a4dd03 Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Sat, 14 Jun 2014 11:14:00 -0700 Subject: [PATCH 1/4] Update for formatter changes --- src/phf.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/phf.rs b/src/phf.rs index d657f92..07a086b 100644 --- a/src/phf.rs +++ b/src/phf.rs @@ -83,7 +83,7 @@ impl<'a, T> Map<&'a str, T> for PhfMap { impl fmt::Show for PhfMap { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { - try!(write!(fmt, r"\{")); + try!(write!(fmt, "{{")); let mut first = true; for (k, v) in self.entries() { if !first { @@ -92,7 +92,7 @@ impl fmt::Show for PhfMap { try!(write!(fmt, "{}: {}", k, v)) first = false; } - write!(fmt, r"\}") + write!(fmt, "}}") } } @@ -216,7 +216,7 @@ pub struct PhfSet { impl fmt::Show for PhfSet { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { - try!(write!(fmt, r"\{")); + try!(write!(fmt, "{{")); let mut first = true; for entry in self.iter() { if !first { @@ -225,7 +225,7 @@ impl fmt::Show for PhfSet { try!(write!(fmt, "{}", entry)); first = false; } - write!(fmt, r"\}") + write!(fmt, "}}") } } @@ -332,7 +332,7 @@ pub struct PhfOrderedMap { impl fmt::Show for PhfOrderedMap { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { - try!(write!(fmt, r"\{")); + try!(write!(fmt, "{{")); let mut first = true; for (k, v) in self.entries() { if !first { @@ -341,7 +341,7 @@ impl fmt::Show for PhfOrderedMap { try!(write!(fmt, "{}: {}", k, v)) first = false; } - write!(fmt, r"\}") + write!(fmt, "}}") } } @@ -541,7 +541,7 @@ pub struct PhfOrderedSet { impl fmt::Show for PhfOrderedSet { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { - try!(write!(fmt, r"\{")); + try!(write!(fmt, "{{")); let mut first = true; for entry in self.iter() { if !first { @@ -550,7 +550,7 @@ impl fmt::Show for PhfOrderedSet { try!(write!(fmt, "{}", entry)); first = false; } - write!(fmt, r"\}") + write!(fmt, "}}") } } From f68b675ab99b334fa8294476daf74729785b68db Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Sun, 15 Jun 2014 11:38:28 -0700 Subject: [PATCH 2/4] Update for @ removal --- src/phf_mac.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/phf_mac.rs b/src/phf_mac.rs index dea3b67..54b1ee4 100644 --- a/src/phf_mac.rs +++ b/src/phf_mac.rs @@ -4,7 +4,7 @@ #![crate_id="github.com/sfackler/rust-phf/phf_mac"] #![crate_type="dylib"] #![doc(html_root_url="http://sfackler.github.io/rust-phf/doc")] -#![feature(managed_boxes, plugin_registrar, quote)] +#![feature(plugin_registrar, quote)] extern crate rand; extern crate syntax; @@ -13,6 +13,7 @@ extern crate phf; extern crate rustc; use std::collections::HashMap; +use std::gc::{Gc, GC}; use std::os; use syntax::ast; use syntax::ast::{TokenTree, LitStr, Expr, ExprVec, ExprLit}; @@ -41,8 +42,8 @@ pub fn macro_registrar(reg: &mut Registry) { struct Entry { key_str: InternedString, - key: @Expr, - value: @Expr + key: Gc, + value: Gc } struct HashState { @@ -403,8 +404,8 @@ fn create_ordered_set(cx: &mut ExtCtxt, sp: Span, entries: Vec, MacExpr::new(quote_expr!(cx, ::phf::PhfOrderedSet { map: $map })) } -fn create_slice_expr(vec: Vec<@Expr>, sp: Span) -> @Expr { - @Expr { +fn create_slice_expr(vec: Vec>, sp: Span) -> Gc { + box (GC) Expr { id: ast::DUMMY_NODE_ID, node: ExprVec(vec), span: sp From 93f4d4cd98e1c306885d9755ff84c4190a883928 Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Sun, 15 Jun 2014 18:13:19 -0700 Subject: [PATCH 3/4] Fix parallel builds --- Makefile.in | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile.in b/Makefile.in index 20fd0bd..4b49915 100644 --- a/Makefile.in +++ b/Makefile.in @@ -5,6 +5,7 @@ INSTALL_DIR := %PREFIX% PHF_LIB := src/phf.rs PHF := $(foreach file,$(shell $(RUSTC) --crate-file-name $(PHF_LIB)),$(BUILDDIR)/$(file)) +PHF_STAMP := $(BUILDDIR)/phf.stamp PHF_MAC_LIB := src/phf_mac.rs PHF_MAC := $(BUILDDIR)/$(shell $(RUSTC) --crate-file-name $(PHF_MAC_LIB)) PHF_TEST_MAIN := src/test.rs @@ -19,8 +20,11 @@ all: $(PHF) $(PHF_MAC) $(BUILDDIR): mkdir -p $@ -$(PHF): $(PHF_LIB) | $(BUILDDIR) +$(PHF): $(PHF_STAMP) + +$(PHF_STAMP): $(PHF_LIB) | $(BUILDDIR) $(RUSTC) $(RUSTFLAGS) --dep-info $(BUILDDIR)/phf.d --out-dir $(@D) $< + touch $(PHF_STAMP) $(PHF_MAC): $(PHF_MAC_LIB) $(PHF) | $(BUILDDIR) $(RUSTC) $(RUSTFLAGS) --dep-info $(BUILDDIR)/phf_mac.d --out-dir $(@D) \ From 6dcad9b5798d446ae81a4f433fa3cfdb766dcdae Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Tue, 17 Jun 2014 19:40:02 -0700 Subject: [PATCH 4/4] Don't use a stamp file for multi-targets It breaks dep-info usage. --- Makefile.in | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Makefile.in b/Makefile.in index 4b49915..da04a16 100644 --- a/Makefile.in +++ b/Makefile.in @@ -5,7 +5,6 @@ INSTALL_DIR := %PREFIX% PHF_LIB := src/phf.rs PHF := $(foreach file,$(shell $(RUSTC) --crate-file-name $(PHF_LIB)),$(BUILDDIR)/$(file)) -PHF_STAMP := $(BUILDDIR)/phf.stamp PHF_MAC_LIB := src/phf_mac.rs PHF_MAC := $(BUILDDIR)/$(shell $(RUSTC) --crate-file-name $(PHF_MAC_LIB)) PHF_TEST_MAIN := src/test.rs @@ -20,11 +19,10 @@ all: $(PHF) $(PHF_MAC) $(BUILDDIR): mkdir -p $@ -$(PHF): $(PHF_STAMP) +.NOTPARALLEL: $(PHF) -$(PHF_STAMP): $(PHF_LIB) | $(BUILDDIR) +$(PHF): $(PHF_LIB) | $(BUILDDIR) $(RUSTC) $(RUSTFLAGS) --dep-info $(BUILDDIR)/phf.d --out-dir $(@D) $< - touch $(PHF_STAMP) $(PHF_MAC): $(PHF_MAC_LIB) $(PHF) | $(BUILDDIR) $(RUSTC) $(RUSTFLAGS) --dep-info $(BUILDDIR)/phf_mac.d --out-dir $(@D) \