File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,12 @@ pub fn test_fn_attrs() {
66 // so instead we're checking the source itself
77 let src = include_str ! ( "fn_attrs.rs" ) ;
88
9+ // Remove the c2rust::src_loc annotation, which is only produced if
10+ // --reorganize-definitions is enabled.
11+ let mut lines: Vec < & str > = src. lines ( ) . collect ( ) ;
12+ lines. retain ( |x| !x. contains ( "#[c2rust::src_loc" ) ) ;
13+ let src = lines. join ( "\n " ) ;
14+
915 // Some C99 rules for convenience:
1016 // * In C99, a function defined inline will never, and a function defined extern inline
1117 // will always, emit an externally visible function.
@@ -57,8 +63,7 @@ pub fn test_fn_attrs() {
5763
5864 if cfg ! ( not( target_os = "macos" ) ) {
5965 // aliased_fn is aliased to the inline_extern function
60- assert ! ( src. contains(
61- "extern \" C\" {\n #[link_name = \" inline_extern\" ]\n fn aliased_fn();"
62- ) ) ;
66+ let aliased_fn_syntax = |public| format ! ( "extern \" C\" {{\n #[link_name = \" inline_extern\" ]\n {}fn aliased_fn();" , public) ;
67+ assert ! ( src. contains( & aliased_fn_syntax( "" ) ) || src. contains( & aliased_fn_syntax( "pub " ) ) ) ;
6368 }
6469}
You can’t perform that action at this time.
0 commit comments