We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
as_str
1 parent c8a0252 commit bf04a7cCopy full SHA for bf04a7c
src/libsyntax/ast.rs
@@ -50,6 +50,13 @@ pub struct Ident {
50
impl Ident {
51
/// Construct an identifier with the given name and an empty context:
52
pub fn new(name: Name) -> Ident { Ident {name: name, ctxt: EMPTY_CTXT}}
53
+
54
+ pub fn as_str<'a>(&'a self) -> &'a str {
55
+ unsafe {
56
+ // FIXME #12938: can't use copy_lifetime since &str isn't a &T
57
+ ::std::mem::transmute(token::get_ident(*self).get())
58
+ }
59
60
}
61
62
impl Show for Ident {
0 commit comments