summaryrefslogtreecommitdiffstats
path: root/tests/ui/rfcs/rfc-3348-c-string-literals/auxiliary/count.rs
blob: 0907061d64a1b714309983d278953b62e5196982 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// force-host
// edition: 2018
// no-prefer-dynamic
#![crate_type = "proc-macro"]

extern crate proc_macro;

use proc_macro::TokenStream;
use std::str::FromStr;

#[proc_macro]
pub fn number_of_tokens(_: TokenStream) -> TokenStream {
    TokenStream::from_str("c\"\"").unwrap().into_iter().count().to_string().parse().unwrap()
}