File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,12 @@ pub fn test_sectioned_used_static() {
3636 // directly at the source file
3737 let src = include_str ! ( "attributes.rs" ) ;
3838
39- let lines: Vec < & str > = src. lines ( ) . collect ( ) ;
39+ let mut lines: Vec < & str > = src. lines ( ) . collect ( ) ;
40+
41+ // Remove the c2rust::src_loc annotation, which is only produced if
42+ // --reorganize-definitions is enabled.
43+ lines. retain ( |x| !x. contains ( "#[c2rust::src_loc" ) ) ;
44+ let src = lines. join ( "\n " ) ;
4045
4146 let pos = lines
4247 . iter ( )
@@ -52,6 +57,8 @@ pub fn test_sectioned_used_static() {
5257
5358 // This static is pub, but we want to ensure it has attributes applied
5459 assert ! ( src. contains( "#[link_section = \" fb\" ]\n pub static mut rust_initialized_extern: ::core::ffi::c_int = 1 as ::core::ffi::c_int;" ) ) ;
55- assert ! ( src. contains( "extern \" C\" {\n #[link_name = \" no_attrs\" ]\n static mut rust_aliased_static: ::core::ffi::c_int;" ) )
60+ // This static is pub only with --reorganize-definitions
61+ let aliased_static_syntax = |public| format ! ( "extern \" C\" {{\n #[link_name = \" no_attrs\" ]\n {}static mut rust_aliased_static: ::core::ffi::c_int;" , public) ;
62+ assert ! ( src. contains( & aliased_static_syntax( "" ) ) || src. contains( & aliased_static_syntax( "pub " ) ) )
5663 }
5764}
You can’t perform that action at this time.
0 commit comments