File tree 4 files changed +31
-19
lines changed
dedicated_block_allocator
4 files changed +31
-19
lines changed Original file line number Diff line number Diff line change @@ -101,17 +101,20 @@ impl SubAllocator for DedicatedBlockAllocator {
101
101
) {
102
102
let empty = "" . to_string ( ) ;
103
103
let name = self . name . as_ref ( ) . unwrap_or ( & empty) ;
104
-
105
- let backtrace_info = if cfg ! ( feature = "std" ) {
106
- format ! (
104
+ let backtrace_info;
105
+ #[ cfg( feature = "std" ) ]
106
+ {
107
+ backtrace_info = format ! (
107
108
r#"
108
- backtrace: {}
109
- "# ,
109
+ backtrace: {}
110
+ "# ,
110
111
self . backtrace
111
112
)
112
- } else {
113
- "" . to_owned ( )
114
- } ;
113
+ }
114
+ #[ cfg( not( feature = "std" ) ) ]
115
+ {
116
+ backtrace_info = "" . to_owned ( )
117
+ }
115
118
116
119
log ! (
117
120
log_level,
Original file line number Diff line number Diff line change @@ -5,12 +5,15 @@ use alloc::{
5
5
string:: { String , ToString } ,
6
6
vec:: Vec ,
7
7
} ;
8
- #[ cfg( all( feature = "std" , not( feature = "hashbrown" ) ) ) ]
9
- use std:: collections:: { HashMap , HashSet } ;
8
+
10
9
#[ cfg( feature = "std" ) ]
11
- use std:: { backtrace:: Backtrace , sync:: Arc } ;
10
+ use std:: {
11
+ backtrace:: Backtrace ,
12
+ collections:: { HashMap , HashSet } ,
13
+ sync:: Arc ,
14
+ } ;
12
15
13
- #[ cfg( all ( not ( feature = "std" ) , feature = " hashbrown") ) ]
16
+ #[ cfg( feature = "hashbrown" ) ]
14
17
use hashbrown:: { HashMap , HashSet } ;
15
18
use log:: { log, Level } ;
16
19
@@ -377,16 +380,20 @@ impl SubAllocator for FreeListAllocator {
377
380
}
378
381
let empty = "" . to_string ( ) ;
379
382
let name = chunk. name . as_ref ( ) . unwrap_or ( & empty) ;
380
- let backtrace_info = if cfg ! ( feature = "std" ) {
381
- format ! (
383
+ let backtrace_info;
384
+ #[ cfg( feature = "std" ) ]
385
+ {
386
+ backtrace_info = format ! (
382
387
r#"
383
388
backtrace: {}
384
389
"# ,
385
390
chunk. backtrace
386
391
)
387
- } else {
388
- "" . to_owned ( )
389
- } ;
392
+ }
393
+ #[ cfg( not( feature = "std" ) ) ]
394
+ {
395
+ backtrace_info = "" . to_owned ( )
396
+ }
390
397
log ! (
391
398
log_level,
392
399
r#"leak detected: {{
Original file line number Diff line number Diff line change @@ -10,7 +10,9 @@ use crate::result::*;
10
10
pub ( crate ) mod dedicated_block_allocator;
11
11
pub ( crate ) use dedicated_block_allocator:: DedicatedBlockAllocator ;
12
12
13
+ #[ cfg( any( feature = "std" , feature = "hashbrown" ) ) ]
13
14
pub ( crate ) mod free_list_allocator;
15
+ #[ cfg( any( feature = "std" , feature = "hashbrown" ) ) ]
14
16
pub ( crate ) use free_list_allocator:: FreeListAllocator ;
15
17
16
18
#[ derive( PartialEq , Copy , Clone , Debug ) ]
Original file line number Diff line number Diff line change 222
222
#[ macro_use]
223
223
extern crate alloc;
224
224
225
- #[ cfg( all( not ( feature = "std" ) , not ( feature = "hashbrown" ) ) ) ]
226
- compile_error ! ( "\" hashbrown\" feature should be enabled in \" no_std \" environment." ) ;
225
+ #[ cfg( all( feature = "std" , feature = "hashbrown" ) ) ]
226
+ compile_error ! ( "\" hashbrown\" feature should not be enabled in \" std \" environment." ) ;
227
227
228
228
#[ cfg( all( not( feature = "std" ) , feature = "visualizer" ) ) ]
229
229
compile_error ! ( "Cannot enable \" visualizer\" feature in \" no_std\" environment." ) ;
You can’t perform that action at this time.
0 commit comments