Skip to content

Commit

Permalink
Update for syntax changes
Browse files Browse the repository at this point in the history
Closes #72
  • Loading branch information
sfackler committed Jan 1, 2016
1 parent d35d05f commit 3be2db8
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions phf_macros/src/lib.rs
Expand Up @@ -42,7 +42,7 @@ extern crate phf_generator;

use std::collections::HashMap;
use std::collections::hash_map::Entry::{Occupied, Vacant};
use syntax::ast::{self, TokenTree, LitStr, LitByteStr, LitByte, LitChar, Expr, ExprLit, ExprVec};
use syntax::ast::{self, TokenTree, Expr, ExprLit, ExprVec};
use syntax::codemap::{Span, Spanned};
use syntax::ext::base::{DummyResult, ExtCtxt, MacResult};
use syntax::fold::Folder;
Expand Down Expand Up @@ -81,7 +81,7 @@ fn generate_hash(cx: &mut ExtCtxt, sp: Span, entries: &[Entry]) -> HashState {
let time = precise_time_s() - start;

if cfg!(feature = "stats") && env::var_os("PHF_STATS").is_some() {
cx.span_note(sp, &format!("PHF generation took {} seconds", time));
cx.span_warn(sp, &format!("PHF generation took {} seconds", time));
}

state
Expand Down Expand Up @@ -300,11 +300,12 @@ fn has_duplicates(cx: &mut ExtCtxt, sp: Span, entries: &[Entry]) -> bool {
}

dups = true;
cx.span_err(sp,
&*format!("duplicate key {}", pprust::expr_to_string(&**key)));
let mut err = cx.struct_span_err(sp, &*format!("duplicate key {}",
pprust::expr_to_string(&**key)));
for span in spans.iter() {
cx.span_note(*span, "one occurrence here");
err.span_note(*span, "one occurrence here");
}
err.emit();
}

dups
Expand Down

0 comments on commit 3be2db8

Please sign in to comment.