Skip to content

Commit 26d716a

Browse files
committed
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 rust-lang#17181
1 parent ccae356 commit 26d716a

File tree

1 file changed

+0
-11
lines changed

1 file changed

+0
-11
lines changed

src/libsyntax/util/interner.rs

-11
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ use std::cell::RefCell;
1919
use std::cmp::Equiv;
2020
use std::fmt;
2121
use std::hash::Hash;
22-
use std::mem;
2322
use std::rc::Rc;
2423

2524
pub struct Interner<T> {
@@ -192,16 +191,6 @@ impl StrInterner {
192191
(*self.vect.borrow().get(idx.uint())).clone()
193192
}
194193

195-
/// Returns this string with lifetime tied to the interner. Since
196-
/// strings may never be removed from the interner, this is safe.
197-
pub fn get_ref<'a>(&'a self, idx: Name) -> &'a str {
198-
let vect = self.vect.borrow();
199-
let s: &str = vect.get(idx.uint()).as_slice();
200-
unsafe {
201-
mem::transmute(s)
202-
}
203-
}
204-
205194
pub fn len(&self) -> uint {
206195
self.vect.borrow().len()
207196
}

0 commit comments

Comments
 (0)