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.
@str
get_single_str_from_tts
1 parent f9af11d commit cbf9f5fCopy full SHA for cbf9f5f
src/libsyntax/ext/base.rs
@@ -439,13 +439,15 @@ pub fn get_single_str_from_tts(cx: &ExtCtxt,
439
sp: Span,
440
tts: &[ast::TokenTree],
441
name: &str)
442
- -> Option<@str> {
+ -> Option<~str> {
443
if tts.len() != 1 {
444
cx.span_err(sp, format!("{} takes 1 argument.", name));
445
} else {
446
match tts[0] {
447
ast::TTTok(_, token::LIT_STR(ident))
448
- | ast::TTTok(_, token::LIT_STR_RAW(ident, _)) => return Some(cx.str_of(ident)),
+ | ast::TTTok(_, token::LIT_STR_RAW(ident, _)) => {
449
+ return Some(cx.str_of(ident).to_str())
450
+ }
451
_ => cx.span_err(sp, format!("{} requires a string.", name)),
452
}
453
0 commit comments