Skip to content

Commit

Permalink
Replace Term::as_str with Term::with_str which only allows access to …
Browse files Browse the repository at this point in the history
…the string in a closure
  • Loading branch information
Zoxc committed Dec 28, 2017
1 parent 04c7d30 commit c3ab779
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/libproc_macro/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -407,8 +407,8 @@ impl Term {

/// Get a reference to the interned string.
#[unstable(feature = "proc_macro", issue = "38356")]
pub fn as_str(&self) -> &str {
unsafe { &*(&*self.0.as_str() as *const str) }
pub fn with_str<F: FnOnce(&str) -> R, R>(self, f: F) -> R {
self.0.with_str(f)
}
}

Expand Down

0 comments on commit c3ab779

Please sign in to comment.