From 26d716a5006f72f398e051757adc031c0b507b4f Mon Sep 17 00:00:00 2001 From: Brian Koropoff Date: Fri, 12 Sep 2014 21:52:56 -0700 Subject: [PATCH] Remove unused, unsound method on StrInterner The string slices returned by `get_ref` can actually be invalidated by calling `clear`. Since this method is unused, it is easiest to simply remove it. Closes #17181 --- src/libsyntax/util/interner.rs | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/libsyntax/util/interner.rs b/src/libsyntax/util/interner.rs index 452b5a52512..9ad3157fe6a 100644 --- a/src/libsyntax/util/interner.rs +++ b/src/libsyntax/util/interner.rs @@ -19,7 +19,6 @@ use std::cell::RefCell; use std::cmp::Equiv; use std::fmt; use std::hash::Hash; -use std::mem; use std::rc::Rc; pub struct Interner { @@ -192,16 +191,6 @@ impl StrInterner { (*self.vect.borrow().get(idx.uint())).clone() } - /// Returns this string with lifetime tied to the interner. Since - /// strings may never be removed from the interner, this is safe. - pub fn get_ref<'a>(&'a self, idx: Name) -> &'a str { - let vect = self.vect.borrow(); - let s: &str = vect.get(idx.uint()).as_slice(); - unsafe { - mem::transmute(s) - } - } - pub fn len(&self) -> uint { self.vect.borrow().len() }