@@ -6,13 +6,14 @@ use crate::fmt::Debug;
6
6
use crate :: rc:: Rc ;
7
7
use crate :: string:: { String , ToString } ;
8
8
use crate :: vec:: Vec ;
9
+ use std:: cmp:: Ordering ;
9
10
use std:: convert:: TryFrom ;
10
11
use std:: iter:: { self , FromIterator } ;
11
12
use std:: mem;
12
13
use std:: ops:: Bound :: { self , Excluded , Included , Unbounded } ;
13
14
use std:: ops:: RangeBounds ;
14
15
use std:: panic:: { catch_unwind, AssertUnwindSafe } ;
15
- use std:: sync:: atomic:: { AtomicUsize , Ordering } ;
16
+ use std:: sync:: atomic:: { AtomicUsize , Ordering :: SeqCst } ;
16
17
17
18
mod ord_chaos;
18
19
use ord_chaos:: { Cyclic3 , Governed , Governor } ;
@@ -1094,7 +1095,7 @@ mod test_drain_filter {
1094
1095
struct D ;
1095
1096
impl Drop for D {
1096
1097
fn drop ( & mut self ) {
1097
- if DROPS . fetch_add ( 1 , Ordering :: SeqCst ) == 1 {
1098
+ if DROPS . fetch_add ( 1 , SeqCst ) == 1 {
1098
1099
panic ! ( "panic in `drop`" ) ;
1099
1100
}
1100
1101
}
@@ -1105,14 +1106,14 @@ mod test_drain_filter {
1105
1106
1106
1107
catch_unwind ( move || {
1107
1108
drop ( map. drain_filter ( |i, _| {
1108
- PREDS . fetch_add ( 1usize << i, Ordering :: SeqCst ) ;
1109
+ PREDS . fetch_add ( 1usize << i, SeqCst ) ;
1109
1110
true
1110
1111
} ) )
1111
1112
} )
1112
1113
. unwrap_err ( ) ;
1113
1114
1114
- assert_eq ! ( PREDS . load( Ordering :: SeqCst ) , 0x011 ) ;
1115
- assert_eq ! ( DROPS . load( Ordering :: SeqCst ) , 3 ) ;
1115
+ assert_eq ! ( PREDS . load( SeqCst ) , 0x011 ) ;
1116
+ assert_eq ! ( DROPS . load( SeqCst ) , 3 ) ;
1116
1117
}
1117
1118
1118
1119
#[ test]
@@ -1123,7 +1124,7 @@ mod test_drain_filter {
1123
1124
struct D ;
1124
1125
impl Drop for D {
1125
1126
fn drop ( & mut self ) {
1126
- DROPS . fetch_add ( 1 , Ordering :: SeqCst ) ;
1127
+ DROPS . fetch_add ( 1 , SeqCst ) ;
1127
1128
}
1128
1129
}
1129
1130
@@ -1132,7 +1133,7 @@ mod test_drain_filter {
1132
1133
1133
1134
catch_unwind ( AssertUnwindSafe ( || {
1134
1135
drop ( map. drain_filter ( |i, _| {
1135
- PREDS . fetch_add ( 1usize << i, Ordering :: SeqCst ) ;
1136
+ PREDS . fetch_add ( 1usize << i, SeqCst ) ;
1136
1137
match i {
1137
1138
0 => true ,
1138
1139
_ => panic ! ( ) ,
@@ -1141,8 +1142,8 @@ mod test_drain_filter {
1141
1142
} ) )
1142
1143
. unwrap_err ( ) ;
1143
1144
1144
- assert_eq ! ( PREDS . load( Ordering :: SeqCst ) , 0x011 ) ;
1145
- assert_eq ! ( DROPS . load( Ordering :: SeqCst ) , 1 ) ;
1145
+ assert_eq ! ( PREDS . load( SeqCst ) , 0x011 ) ;
1146
+ assert_eq ! ( DROPS . load( SeqCst ) , 1 ) ;
1146
1147
assert_eq ! ( map. len( ) , 2 ) ;
1147
1148
assert_eq ! ( map. first_entry( ) . unwrap( ) . key( ) , & 4 ) ;
1148
1149
assert_eq ! ( map. last_entry( ) . unwrap( ) . key( ) , & 8 ) ;
@@ -1158,7 +1159,7 @@ mod test_drain_filter {
1158
1159
struct D ;
1159
1160
impl Drop for D {
1160
1161
fn drop ( & mut self ) {
1161
- DROPS . fetch_add ( 1 , Ordering :: SeqCst ) ;
1162
+ DROPS . fetch_add ( 1 , SeqCst ) ;
1162
1163
}
1163
1164
}
1164
1165
@@ -1167,7 +1168,7 @@ mod test_drain_filter {
1167
1168
1168
1169
{
1169
1170
let mut it = map. drain_filter ( |i, _| {
1170
- PREDS . fetch_add ( 1usize << i, Ordering :: SeqCst ) ;
1171
+ PREDS . fetch_add ( 1usize << i, SeqCst ) ;
1171
1172
match i {
1172
1173
0 => true ,
1173
1174
_ => panic ! ( ) ,
@@ -1180,8 +1181,8 @@ mod test_drain_filter {
1180
1181
assert ! ( matches!( result, Ok ( None ) ) ) ;
1181
1182
}
1182
1183
1183
- assert_eq ! ( PREDS . load( Ordering :: SeqCst ) , 0x011 ) ;
1184
- assert_eq ! ( DROPS . load( Ordering :: SeqCst ) , 1 ) ;
1184
+ assert_eq ! ( PREDS . load( SeqCst ) , 0x011 ) ;
1185
+ assert_eq ! ( DROPS . load( SeqCst ) , 1 ) ;
1185
1186
assert_eq ! ( map. len( ) , 2 ) ;
1186
1187
assert_eq ! ( map. first_entry( ) . unwrap( ) . key( ) , & 4 ) ;
1187
1188
assert_eq ! ( map. last_entry( ) . unwrap( ) . key( ) , & 8 ) ;
@@ -1315,8 +1316,6 @@ fn test_zst() {
1315
1316
// undefined.
1316
1317
#[ test]
1317
1318
fn test_bad_zst ( ) {
1318
- use std:: cmp:: Ordering ;
1319
-
1320
1319
#[ derive( Clone , Copy , Debug ) ]
1321
1320
struct Bad ;
1322
1321
@@ -1763,7 +1762,7 @@ fn test_append_drop_leak() {
1763
1762
1764
1763
impl Drop for D {
1765
1764
fn drop ( & mut self ) {
1766
- if DROPS . fetch_add ( 1 , Ordering :: SeqCst ) == 0 {
1765
+ if DROPS . fetch_add ( 1 , SeqCst ) == 0 {
1767
1766
panic ! ( "panic in `drop`" ) ;
1768
1767
}
1769
1768
}
@@ -1779,7 +1778,7 @@ fn test_append_drop_leak() {
1779
1778
1780
1779
catch_unwind ( move || left. append ( & mut right) ) . unwrap_err ( ) ;
1781
1780
1782
- assert_eq ! ( DROPS . load( Ordering :: SeqCst ) , 4 ) ; // Rust issue #47949 ate one little piggy
1781
+ assert_eq ! ( DROPS . load( SeqCst ) , 4 ) ; // Rust issue #47949 ate one little piggy
1783
1782
}
1784
1783
1785
1784
#[ test]
@@ -1894,7 +1893,7 @@ fn test_into_iter_drop_leak_height_0() {
1894
1893
1895
1894
impl Drop for D {
1896
1895
fn drop ( & mut self ) {
1897
- if DROPS . fetch_add ( 1 , Ordering :: SeqCst ) == 3 {
1896
+ if DROPS . fetch_add ( 1 , SeqCst ) == 3 {
1898
1897
panic ! ( "panic in `drop`" ) ;
1899
1898
}
1900
1899
}
@@ -1909,7 +1908,7 @@ fn test_into_iter_drop_leak_height_0() {
1909
1908
1910
1909
catch_unwind ( move || drop ( map. into_iter ( ) ) ) . unwrap_err ( ) ;
1911
1910
1912
- assert_eq ! ( DROPS . load( Ordering :: SeqCst ) , 5 ) ;
1911
+ assert_eq ! ( DROPS . load( SeqCst ) , 5 ) ;
1913
1912
}
1914
1913
1915
1914
#[ test]
@@ -1921,18 +1920,18 @@ fn test_into_iter_drop_leak_height_1() {
1921
1920
struct D ;
1922
1921
impl Drop for D {
1923
1922
fn drop ( & mut self ) {
1924
- if DROPS . fetch_add ( 1 , Ordering :: SeqCst ) == PANIC_POINT . load ( Ordering :: SeqCst ) {
1923
+ if DROPS . fetch_add ( 1 , SeqCst ) == PANIC_POINT . load ( SeqCst ) {
1925
1924
panic ! ( "panic in `drop`" ) ;
1926
1925
}
1927
1926
}
1928
1927
}
1929
1928
1930
1929
for panic_point in vec ! [ 0 , 1 , size - 2 , size - 1 ] {
1931
- DROPS . store ( 0 , Ordering :: SeqCst ) ;
1932
- PANIC_POINT . store ( panic_point, Ordering :: SeqCst ) ;
1930
+ DROPS . store ( 0 , SeqCst ) ;
1931
+ PANIC_POINT . store ( panic_point, SeqCst ) ;
1933
1932
let map: BTreeMap < _ , _ > = ( 0 ..size) . map ( |i| ( i, D ) ) . collect ( ) ;
1934
1933
catch_unwind ( move || drop ( map. into_iter ( ) ) ) . unwrap_err ( ) ;
1935
- assert_eq ! ( DROPS . load( Ordering :: SeqCst ) , size) ;
1934
+ assert_eq ! ( DROPS . load( SeqCst ) , size) ;
1936
1935
}
1937
1936
}
1938
1937
0 commit comments