diff options
| author | bors <bors@rust-lang.org> | 2018-10-20 08:45:55 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-10-20 08:45:55 +0000 |
| commit | 94273f4d8e463cac45486328294bb1c2bbc10170 (patch) | |
| tree | de04f7e054e20b25d6b095ea417a42e22720a6f9 /src/libsyntax_pos | |
| parent | 89be71a46234a2231b5b3839cd497188e072291f (diff) | |
| parent | 53e92f4573f30e52a0ea241fb76c6f1ffaabff90 (diff) | |
| download | rust-94273f4d8e463cac45486328294bb1c2bbc10170.tar.gz rust-94273f4d8e463cac45486328294bb1c2bbc10170.zip | |
Auto merge of #55114 - oli-obk:fx#map, r=nikomatsakis
Deprecate the `FxHashMap()` and `FxHashSet()` constructor function hack
Diffstat (limited to 'src/libsyntax_pos')
| -rw-r--r-- | src/libsyntax_pos/hygiene.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax_pos/symbol.rs | 14 |
2 files changed, 4 insertions, 12 deletions
diff --git a/src/libsyntax_pos/hygiene.rs b/src/libsyntax_pos/hygiene.rs index f053cb10d06..bc52a3e1c7c 100644 --- a/src/libsyntax_pos/hygiene.rs +++ b/src/libsyntax_pos/hygiene.rs @@ -156,7 +156,7 @@ impl Mark { pub fn least_ancestor(mut a: Mark, mut b: Mark) -> Mark { HygieneData::with(|data| { // Compute the path from a to the root - let mut a_path = FxHashSet::<Mark>(); + let mut a_path = FxHashSet::<Mark>::default(); while a != Mark::root() { a_path.insert(a); a = data.marks[a.0 as usize].parent; diff --git a/src/libsyntax_pos/symbol.rs b/src/libsyntax_pos/symbol.rs index d412412fc65..361353c82e2 100644 --- a/src/libsyntax_pos/symbol.rs +++ b/src/libsyntax_pos/symbol.rs @@ -224,6 +224,7 @@ impl<T: ::std::ops::Deref<Target=str>> PartialEq<T> for Symbol { } // The &'static strs in this type actually point into the arena +#[derive(Default)] pub struct Interner { arena: DroplessArena, names: FxHashMap<&'static str, Symbol>, @@ -232,17 +233,8 @@ pub struct Interner { } impl Interner { - pub fn new() -> Self { - Interner { - arena: DroplessArena::new(), - names: Default::default(), - strings: Default::default(), - gensyms: Default::default(), - } - } - fn prefill(init: &[&str]) -> Self { - let mut this = Interner::new(); + let mut this = Interner::default(); for &string in init { if string == "" { // We can't allocate empty strings in the arena, so handle this here @@ -697,7 +689,7 @@ mod tests { #[test] fn interner_tests() { - let mut i: Interner = Interner::new(); + let mut i: Interner = Interner::default(); // first one is zero: assert_eq!(i.intern("dog"), Symbol(0)); // re-use gets the same entry: |
