File tree 2 files changed +30
-0
lines changed
tests/ui/rfcs/rfc-3348-c-string-literals
2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change
1
+ // force-host
2
+ // edition: 2018
3
+ // no-prefer-dynamic
4
+ #![ crate_type = "proc-macro" ]
5
+
6
+ extern crate proc_macro;
7
+
8
+ use proc_macro:: TokenStream ;
9
+ use std:: str:: FromStr ;
10
+
11
+ #[ proc_macro]
12
+ pub fn number_of_tokens ( _: TokenStream ) -> TokenStream {
13
+ TokenStream :: from_str ( "c\" \" " ) . unwrap ( ) . into_iter ( ) . count ( ) . to_string ( ) . parse ( ) . unwrap ( )
14
+ }
Original file line number Diff line number Diff line change
1
+ // even if this crate is edition 2021, proc macros compiled using older
2
+ // editions should still be able to observe the pre-2021 token behavior
3
+ //
4
+ // adapted from tests/ui/rust-2021/reserved-prefixes-via-macro.rs
5
+
6
+ // edition: 2021
7
+ // check-pass
8
+
9
+ // aux-build: count.rs
10
+ extern crate count;
11
+
12
+ const _: ( ) = {
13
+ assert ! ( count:: number_of_tokens!( ) == 2 ) ;
14
+ } ;
15
+
16
+ fn main ( ) { }
You can’t perform that action at this time.
0 commit comments