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
This commit is contained in:
Brian Koropoff 2014-09-12 21:52:56 -07:00
parent ccae356ace
commit 26d716a500

View file

@ -19,7 +19,6 @@ use std::cell::RefCell;
use std::cmp::Equiv; use std::cmp::Equiv;
use std::fmt; use std::fmt;
use std::hash::Hash; use std::hash::Hash;
use std::mem;
use std::rc::Rc; use std::rc::Rc;
pub struct Interner<T> { pub struct Interner<T> {
@ -192,16 +191,6 @@ impl StrInterner {
(*self.vect.borrow().get(idx.uint())).clone() (*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 { pub fn len(&self) -> uint {
self.vect.borrow().len() self.vect.borrow().len()
} }