@@ -1323,83 +1323,165 @@ impl<T: Hash> Hash for Vec<T> {
1323
1323
impl < T > Index < usize > for Vec < T > {
1324
1324
type Output = T ;
1325
1325
1326
+
1327
+ #[ cfg( stage0) ]
1326
1328
#[ inline]
1327
1329
fn index ( & self , index : & usize ) -> & T {
1328
1330
// NB built-in indexing via `&[T]`
1329
1331
& ( * * self ) [ * index]
1330
1332
}
1333
+
1334
+ #[ cfg( not( stage0) ) ]
1335
+ #[ inline]
1336
+ fn index ( & self , index : usize ) -> & T {
1337
+ // NB built-in indexing via `&[T]`
1338
+ & ( * * self ) [ index]
1339
+ }
1331
1340
}
1332
1341
1333
1342
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1334
1343
impl < T > IndexMut < usize > for Vec < T > {
1344
+
1345
+ #[ cfg( stage0) ]
1335
1346
#[ inline]
1336
1347
fn index_mut ( & mut self , index : & usize ) -> & mut T {
1337
1348
// NB built-in indexing via `&mut [T]`
1338
1349
& mut ( * * self ) [ * index]
1339
1350
}
1351
+
1352
+ #[ cfg( not( stage0) ) ]
1353
+ #[ inline]
1354
+ fn index_mut ( & mut self , index : usize ) -> & mut T {
1355
+ // NB built-in indexing via `&mut [T]`
1356
+ & mut ( * * self ) [ index]
1357
+ }
1340
1358
}
1341
1359
1342
1360
1343
1361
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1344
1362
impl < T > ops:: Index < ops:: Range < usize > > for Vec < T > {
1345
1363
type Output = [ T ] ;
1364
+
1365
+ #[ cfg( stage0) ]
1346
1366
#[ inline]
1347
1367
fn index ( & self , index : & ops:: Range < usize > ) -> & [ T ] {
1348
1368
Index :: index ( & * * self , index)
1349
1369
}
1370
+
1371
+ #[ cfg( not( stage0) ) ]
1372
+ #[ inline]
1373
+ fn index ( & self , index : ops:: Range < usize > ) -> & [ T ] {
1374
+ Index :: index ( & * * self , index)
1375
+ }
1350
1376
}
1351
1377
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1352
1378
impl < T > ops:: Index < ops:: RangeTo < usize > > for Vec < T > {
1353
1379
type Output = [ T ] ;
1380
+
1381
+ #[ cfg( stage0) ]
1354
1382
#[ inline]
1355
1383
fn index ( & self , index : & ops:: RangeTo < usize > ) -> & [ T ] {
1356
1384
Index :: index ( & * * self , index)
1357
1385
}
1386
+
1387
+ #[ cfg( not( stage0) ) ]
1388
+ #[ inline]
1389
+ fn index ( & self , index : ops:: RangeTo < usize > ) -> & [ T ] {
1390
+ Index :: index ( & * * self , index)
1391
+ }
1358
1392
}
1359
1393
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1360
1394
impl < T > ops:: Index < ops:: RangeFrom < usize > > for Vec < T > {
1361
1395
type Output = [ T ] ;
1396
+
1397
+ #[ cfg( stage0) ]
1362
1398
#[ inline]
1363
1399
fn index ( & self , index : & ops:: RangeFrom < usize > ) -> & [ T ] {
1364
1400
Index :: index ( & * * self , index)
1365
1401
}
1402
+
1403
+ #[ cfg( not( stage0) ) ]
1404
+ #[ inline]
1405
+ fn index ( & self , index : ops:: RangeFrom < usize > ) -> & [ T ] {
1406
+ Index :: index ( & * * self , index)
1407
+ }
1366
1408
}
1367
1409
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1368
1410
impl < T > ops:: Index < ops:: RangeFull > for Vec < T > {
1369
1411
type Output = [ T ] ;
1412
+
1413
+ #[ cfg( stage0) ]
1370
1414
#[ inline]
1371
1415
fn index ( & self , _index : & ops:: RangeFull ) -> & [ T ] {
1372
1416
self . as_slice ( )
1373
1417
}
1418
+
1419
+ #[ cfg( not( stage0) ) ]
1420
+ #[ inline]
1421
+ fn index ( & self , _index : ops:: RangeFull ) -> & [ T ] {
1422
+ self . as_slice ( )
1423
+ }
1374
1424
}
1375
1425
1376
1426
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1377
1427
impl < T > ops:: IndexMut < ops:: Range < usize > > for Vec < T > {
1428
+
1429
+ #[ cfg( stage0) ]
1378
1430
#[ inline]
1379
1431
fn index_mut ( & mut self , index : & ops:: Range < usize > ) -> & mut [ T ] {
1380
1432
IndexMut :: index_mut ( & mut * * self , index)
1381
1433
}
1434
+
1435
+ #[ cfg( not( stage0) ) ]
1436
+ #[ inline]
1437
+ fn index_mut ( & mut self , index : ops:: Range < usize > ) -> & mut [ T ] {
1438
+ IndexMut :: index_mut ( & mut * * self , index)
1439
+ }
1382
1440
}
1383
1441
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1384
1442
impl < T > ops:: IndexMut < ops:: RangeTo < usize > > for Vec < T > {
1443
+
1444
+ #[ cfg( stage0) ]
1385
1445
#[ inline]
1386
1446
fn index_mut ( & mut self , index : & ops:: RangeTo < usize > ) -> & mut [ T ] {
1387
1447
IndexMut :: index_mut ( & mut * * self , index)
1388
1448
}
1449
+
1450
+ #[ cfg( not( stage0) ) ]
1451
+ #[ inline]
1452
+ fn index_mut ( & mut self , index : ops:: RangeTo < usize > ) -> & mut [ T ] {
1453
+ IndexMut :: index_mut ( & mut * * self , index)
1454
+ }
1389
1455
}
1390
1456
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1391
1457
impl < T > ops:: IndexMut < ops:: RangeFrom < usize > > for Vec < T > {
1458
+
1459
+ #[ cfg( stage0) ]
1392
1460
#[ inline]
1393
1461
fn index_mut ( & mut self , index : & ops:: RangeFrom < usize > ) -> & mut [ T ] {
1394
1462
IndexMut :: index_mut ( & mut * * self , index)
1395
1463
}
1464
+
1465
+ #[ cfg( not( stage0) ) ]
1466
+ #[ inline]
1467
+ fn index_mut ( & mut self , index : ops:: RangeFrom < usize > ) -> & mut [ T ] {
1468
+ IndexMut :: index_mut ( & mut * * self , index)
1469
+ }
1396
1470
}
1397
1471
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1398
1472
impl < T > ops:: IndexMut < ops:: RangeFull > for Vec < T > {
1473
+
1474
+ #[ cfg( stage0) ]
1399
1475
#[ inline]
1400
1476
fn index_mut ( & mut self , _index : & ops:: RangeFull ) -> & mut [ T ] {
1401
1477
self . as_mut_slice ( )
1402
1478
}
1479
+
1480
+ #[ cfg( not( stage0) ) ]
1481
+ #[ inline]
1482
+ fn index_mut ( & mut self , _index : ops:: RangeFull ) -> & mut [ T ] {
1483
+ self . as_mut_slice ( )
1484
+ }
1403
1485
}
1404
1486
1405
1487
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
0 commit comments