summarylogtreecommitdiffstats
path: root/new_rust.patch
blob: 811d50bed546c87e8992c7be79a75f0da41dc7c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
From dbc1a3326b4a69ae1639f8dd93892fe5d45bb18b Mon Sep 17 00:00:00 2001
From: Manish Goregaokar <manishearth@gmail.com>
Date: Wed, 2 Aug 2017 11:24:35 -0700
Subject: [PATCH 01/16] Bug 1386887 - Clean up FFI lifetimes to work on
 nightly; r=emilio

(cherry picked from commit mozilla/gecko-dev@efbe3a9af876)
---
 layout/style/ServoBindingList.h  | 4 ++--
 layout/style/ServoBindingTypes.h | 2 ++
 layout/style/ServoBindings.h     | 4 ++--
 layout/style/ServoBindings.toml  | 4 +++-
 4 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/layout/style/ServoBindingList.h b/layout/style/ServoBindingList.h
index 4d0294a33b28..c8b05858b95c 100644
--- a/layout/style/ServoBindingList.h
+++ b/layout/style/ServoBindingList.h
@@ -377,10 +377,10 @@ SERVO_BINDING_FUNC(Servo_DeclarationBlock_HasCSSWideKeyword, bool,
                    nsCSSPropertyID property)
 // Compose animation value for a given property.
 // |base_values| is nsRefPtrHashtable<nsUint32HashKey, RawServoAnimationValue>.
-// We use void* to avoid exposing nsRefPtrHashtable in FFI.
+// We use RawServoAnimationValueTableBorrowed to avoid exposing nsRefPtrHashtable in FFI.
 SERVO_BINDING_FUNC(Servo_AnimationCompose, void,
                    RawServoAnimationValueMapBorrowedMut animation_values,
-                   void* base_values,
+                   RawServoAnimationValueTableBorrowed base_values,
                    nsCSSPropertyID property,
                    RawGeckoAnimationPropertySegmentBorrowed animation_segment,
                    RawGeckoAnimationPropertySegmentBorrowed last_segment,
diff --git a/layout/style/ServoBindingTypes.h b/layout/style/ServoBindingTypes.h
index aaf4fc27e1b9..69be15ee9f51 100644
--- a/layout/style/ServoBindingTypes.h
+++ b/layout/style/ServoBindingTypes.h
@@ -54,6 +54,8 @@ class nsXBLBinding;
 using mozilla::dom::StyleChildrenIterator;
 using mozilla::ServoElementSnapshot;
 
+typedef void* RawServoAnimationValueTableBorrowed;
+
 typedef nsINode RawGeckoNode;
 typedef mozilla::dom::Element RawGeckoElement;
 typedef nsIDocument RawGeckoDocument;
diff --git a/layout/style/ServoBindings.h b/layout/style/ServoBindings.h
index e29c24d9ade8..6959112ba1e0 100644
--- a/layout/style/ServoBindings.h
+++ b/layout/style/ServoBindings.h
@@ -267,9 +267,9 @@ double Gecko_GetPositionInSegment(
 // Get servo's AnimationValue for |aProperty| from the cached base style
 // |aBaseStyles|.
 // |aBaseStyles| is nsRefPtrHashtable<nsUint32HashKey, RawServoAnimationValue>.
-// We use void* to avoid exposing nsRefPtrHashtable in FFI.
+// We use RawServoAnimationValueTableBorrowed to avoid exposing nsRefPtrHashtable in FFI.
 RawServoAnimationValueBorrowedOrNull Gecko_AnimationGetBaseStyle(
-  void* aBaseStyles,
+  RawServoAnimationValueTableBorrowed aBaseStyles,
   nsCSSPropertyID aProperty);
 void Gecko_StyleTransition_SetUnsupportedProperty(
   mozilla::StyleTransition* aTransition,
diff --git a/layout/style/ServoBindings.toml b/layout/style/ServoBindings.toml
index 5e09c24eb0e3..3841e71b62f3 100644
--- a/layout/style/ServoBindings.toml
+++ b/layout/style/ServoBindings.toml
@@ -353,6 +353,7 @@ raw-lines = [
     "pub type ServoStyleContextBorrowed<'a> = &'a ::properties::ComputedValues;",
     "pub type ServoStyleContextBorrowedOrNull<'a> = Option<&'a ::properties::ComputedValues>;",
     "pub type ServoComputedDataBorrowed<'a> = &'a ServoComputedData;",
+    "pub type RawServoAnimationValueTableBorrowed<'a> = &'a ();"
 ]
 whitelist-functions = ["Servo_.*", "Gecko_.*"]
 structs-types = [
@@ -385,7 +386,7 @@ structs-types = [
     "RawGeckoPresContext",
     "RawGeckoPresContextOwned",
     "RawGeckoStyleAnimationList",
-    "RawGeckoStyleChildrenIteratorBorrowedMut",
+    "RawGeckoStyleChildrenIterator",
     "RawGeckoServoStyleRuleList",
     "RawGeckoURLExtraData",
     "RawGeckoXBLBinding",
@@ -520,6 +521,7 @@ servo-borrow-types = [
     "RawGeckoFontFaceRuleList",
     "RawGeckoServoStyleRuleList",
     "RawGeckoServoAnimationValueList",
+    "RawGeckoStyleChildrenIterator",
 ]
 fixups = [
     # hack for gecko-owned string

From 60e7663069278431eda0b0f2e9133abf2d3f366c Mon Sep 17 00:00:00 2001
From: Manish Goregaokar <manishsmail@gmail.com>
Date: Tue, 1 Aug 2017 12:57:42 -0500
Subject: [PATCH 02/16] servo: Merge #17934 - Remove doc comment on statement
 (from Manishearth:doc-comment); r=canaltinova

rustc warns about these now

Source-Repo: https://github.com/servo/servo
Source-Revision: b49311c65a083a9b8eb03741bf7ea980b64f1e03

(cherry picked from commit mozilla/gecko-dev@4cbdfa028752)
---
 servo/components/style/properties/gecko.mako.rs  | 2 +-
 servo/components/style/values/specified/image.rs | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/servo/components/style/properties/gecko.mako.rs b/servo/components/style/properties/gecko.mako.rs
index 9a2ab2135fc5..b0d5ef189ce2 100644
--- a/servo/components/style/properties/gecko.mako.rs
+++ b/servo/components/style/properties/gecko.mako.rs
@@ -2081,7 +2081,7 @@ fn static_assert() {
             return (parent_size, parent_unconstrained_size)
         }
 
-        /// XXXManishearth this should also handle text zoom
+        // XXXManishearth this should also handle text zoom
         let min = Au(parent.gecko.mScriptMinSize);
 
         let scale = (parent.gecko.mScriptSizeMultiplier as f32).powi(delta as i32);
diff --git a/servo/components/style/values/specified/image.rs b/servo/components/style/values/specified/image.rs
index 37ed00ccf443..687c6f17d432 100644
--- a/servo/components/style/values/specified/image.rs
+++ b/servo/components/style/values/specified/image.rs
@@ -686,14 +686,14 @@ impl LineDirection {
         input.try(|i| {
             let to_ident = i.try(|i| i.expect_ident_matching("to"));
             match *compat_mode {
-                /// `to` keyword is mandatory in modern syntax.
+                // `to` keyword is mandatory in modern syntax.
                 CompatMode::Modern => to_ident?,
                 // Fall back to Modern compatibility mode in case there is a `to` keyword.
                 // According to Gecko, `-moz-linear-gradient(to ...)` should serialize like
                 // `linear-gradient(to ...)`.
                 CompatMode::Moz if to_ident.is_ok() => *compat_mode = CompatMode::Modern,
-                /// There is no `to` keyword in webkit prefixed syntax. If it's consumed,
-                /// parsing should throw an error.
+                // There is no `to` keyword in webkit prefixed syntax. If it's consumed,
+                // parsing should throw an error.
                 CompatMode::WebKit if to_ident.is_ok() => {
                     return Err(SelectorParseError::UnexpectedIdent("to".into()).into())
                 },

From a3d9d535dfc95d5958cb1f7de84e886c42f22c41 Mon Sep 17 00:00:00 2001
From: Manish Goregaokar <manishsmail@gmail.com>
Date: Thu, 3 Aug 2017 16:27:12 -0500
Subject: [PATCH 03/16] servo: Merge #17969 - Update stylo code to work on
 nightly (from Manishearth:rustup); r=emilio

r=emilio https://bugzilla.mozilla.org/show_bug.cgi?id=1386887

Source-Repo: https://github.com/servo/servo
Source-Revision: 7cee7d7fcc4194e410fa8a308a77d37ac452778a

(cherry picked from commit mozilla/gecko-dev@9f5c1f2e4b5b)
---
 servo/components/style/gecko/generated/bindings.rs | 12 +++++++++---
 servo/components/style/gecko/wrapper.rs            |  7 ++++++-
 servo/ports/geckolib/glue.rs                       |  3 ++-
 3 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/servo/components/style/gecko/generated/bindings.rs b/servo/components/style/gecko/generated/bindings.rs
index f0078fa23c20..04722fb866bd 100644
--- a/servo/components/style/gecko/generated/bindings.rs
+++ b/servo/components/style/gecko/generated/bindings.rs
@@ -8,6 +8,7 @@ type nsAString_internal = nsAString;
 pub type ServoStyleContextBorrowed<'a> = &'a ::properties::ComputedValues;
 pub type ServoStyleContextBorrowedOrNull<'a> = Option<&'a ::properties::ComputedValues>;
 pub type ServoComputedDataBorrowed<'a> = &'a ServoComputedData;
+pub type RawServoAnimationValueTableBorrowed<'a> = &'a ();
 use gecko_bindings::structs::mozilla::css::GridTemplateAreasValue;
 use gecko_bindings::structs::mozilla::css::ErrorReporter;
 use gecko_bindings::structs::mozilla::css::ImageValue;
@@ -37,7 +38,7 @@ use gecko_bindings::structs::RawServoStyleRule;
 use gecko_bindings::structs::RawGeckoPresContext;
 use gecko_bindings::structs::RawGeckoPresContextOwned;
 use gecko_bindings::structs::RawGeckoStyleAnimationList;
-use gecko_bindings::structs::RawGeckoStyleChildrenIteratorBorrowedMut;
+use gecko_bindings::structs::RawGeckoStyleChildrenIterator;
 use gecko_bindings::structs::RawGeckoServoStyleRuleList;
 use gecko_bindings::structs::RawGeckoURLExtraData;
 use gecko_bindings::structs::RawGeckoXBLBinding;
@@ -316,6 +317,10 @@ pub type RawGeckoServoAnimationValueListBorrowed<'a> = &'a RawGeckoServoAnimatio
 pub type RawGeckoServoAnimationValueListBorrowedOrNull<'a> = Option<&'a RawGeckoServoAnimationValueList>;
 pub type RawGeckoServoAnimationValueListBorrowedMut<'a> = &'a mut RawGeckoServoAnimationValueList;
 pub type RawGeckoServoAnimationValueListBorrowedMutOrNull<'a> = Option<&'a mut RawGeckoServoAnimationValueList>;
+pub type RawGeckoStyleChildrenIteratorBorrowed<'a> = &'a RawGeckoStyleChildrenIterator;
+pub type RawGeckoStyleChildrenIteratorBorrowedOrNull<'a> = Option<&'a RawGeckoStyleChildrenIterator>;
+pub type RawGeckoStyleChildrenIteratorBorrowedMut<'a> = &'a mut RawGeckoStyleChildrenIterator;
+pub type RawGeckoStyleChildrenIteratorBorrowedMutOrNull<'a> = Option<&'a mut RawGeckoStyleChildrenIterator>;
 pub type ServoCssRulesStrong = ::gecko_bindings::sugar::ownership::Strong<ServoCssRules>;
 pub type ServoCssRulesBorrowed<'a> = &'a ServoCssRules;
 pub type ServoCssRulesBorrowedOrNull<'a> = Option<&'a ServoCssRules>;
@@ -836,7 +841,7 @@ extern "C" {
 }
 extern "C" {
     pub fn Gecko_AnimationGetBaseStyle(aBaseStyles:
-                                           *mut ::std::os::raw::c_void,
+                                           RawServoAnimationValueTableBorrowed,
                                        aProperty: nsCSSPropertyID)
      -> RawServoAnimationValueBorrowedOrNull;
 }
@@ -2588,7 +2593,8 @@ extern "C" {
 extern "C" {
     pub fn Servo_AnimationCompose(animation_values:
                                       RawServoAnimationValueMapBorrowedMut,
-                                  base_values: *mut ::std::os::raw::c_void,
+                                  base_values:
+                                      RawServoAnimationValueTableBorrowed,
                                   property: nsCSSPropertyID,
                                   animation_segment:
                                       RawGeckoAnimationPropertySegmentBorrowed,
diff --git a/servo/components/style/gecko/wrapper.rs b/servo/components/style/gecko/wrapper.rs
index 034dd94590e2..3c61daefe30a 100644
--- a/servo/components/style/gecko/wrapper.rs
+++ b/servo/components/style/gecko/wrapper.rs
@@ -386,7 +386,12 @@ impl<'a> Iterator for GeckoChildrenIterator<'a> {
                 curr
             },
             GeckoChildrenIterator::GeckoIterator(ref mut it) => unsafe {
-                Gecko_GetNextStyleChild(it).map(GeckoNode)
+                // We do this unsafe lengthening of the lifetime here because
+                // structs::StyleChildrenIterator is actually StyleChildrenIterator<'a>,
+                // however we can't express this easily with bindgen, and it would
+                // introduce functions with two input lifetimes into bindgen,
+                // which would be out of scope for elision.
+                Gecko_GetNextStyleChild(&mut * (it as *mut _)).map(GeckoNode)
             }
         }
     }
diff --git a/servo/ports/geckolib/glue.rs b/servo/ports/geckolib/glue.rs
index 977728286fc3..befdda61e0b3 100644
--- a/servo/ports/geckolib/glue.rs
+++ b/servo/ports/geckolib/glue.rs
@@ -62,6 +62,7 @@ use style::gecko_bindings::bindings::RawGeckoServoStyleRuleListBorrowedMut;
 use style::gecko_bindings::bindings::RawServoAnimationValueBorrowed;
 use style::gecko_bindings::bindings::RawServoAnimationValueMapBorrowedMut;
 use style::gecko_bindings::bindings::RawServoAnimationValueStrong;
+use style::gecko_bindings::bindings::RawServoAnimationValueTableBorrowed;
 use style::gecko_bindings::bindings::RawServoStyleRuleBorrowed;
 use style::gecko_bindings::bindings::ServoStyleContextBorrowedOrNull;
 use style::gecko_bindings::bindings::nsTArrayBorrowed_uintptr_t;
@@ -370,7 +371,7 @@ pub extern "C" fn Servo_AnimationValues_ComputeDistance(from: RawServoAnimationV
 
 #[no_mangle]
 pub extern "C" fn Servo_AnimationCompose(raw_value_map: RawServoAnimationValueMapBorrowedMut,
-                                         base_values: *mut ::std::os::raw::c_void,
+                                         base_values: RawServoAnimationValueTableBorrowed,
                                          css_property: nsCSSPropertyID,
                                          segment: RawGeckoAnimationPropertySegmentBorrowed,
                                          last_segment: RawGeckoAnimationPropertySegmentBorrowed,

From c652ad0fbcb161a8883512c23837f2b5e80b8231 Mon Sep 17 00:00:00 2001
From: Simon Sapin <simon.sapin@exyr.org>
Date: Tue, 15 Aug 2017 07:31:04 -0500
Subject: [PATCH 04/16] servo: Merge #18046 - Upgrade to rustc 1.21.0-nightly
 (13d94d5fa 2017-08-10) (from servo:rustup); r=emilio

Source-Repo: https://github.com/servo/servo
Source-Revision: 7d9b82b9efa7b10a2e34d93df5ac535d99518f7a

(cherry picked from commit mozilla/gecko-dev@ea9c8db790e4)
---
 servo/Cargo.lock                                   |  6 +++---
 servo/components/devtools/lib.rs                   |  2 +-
 servo/components/layout/animation.rs               |  2 +-
 servo/components/layout/construct.rs               |  6 +++---
 servo/components/layout/display_list_builder.rs    |  2 +-
 servo/components/layout/flex.rs                    |  6 +++---
 servo/components/layout/inline.rs                  |  4 ++--
 servo/components/layout/sequential.rs              |  2 +-
 servo/components/layout/table_cell.rs              |  2 +-
 servo/components/layout/text.rs                    |  2 +-
 servo/components/net/cookie_storage.rs             |  2 +-
 servo/components/profile/heartbeats.rs             |  4 ++--
 servo/components/script/dom/bindings/js.rs         |  4 ++--
 servo/components/script/dom/cssstyledeclaration.rs |  8 ++++----
 servo/components/script/dom/cssstylerule.rs        |  2 +-
 servo/components/script/dom/document.rs            | 12 ++++++------
 servo/components/script/dom/medialist.rs           |  4 ++--
 servo/components/script/dom/range.rs               |  4 ++--
 .../script/dom/servoparser/async_html.rs           |  4 ++--
 servo/components/script/dom/url.rs                 |  4 ++--
 servo/components/script/dom/vrdisplay.rs           |  2 +-
 .../components/script/dom/webglrenderingcontext.rs |  2 +-
 servo/components/script/dom/xmlhttprequest.rs      |  2 +-
 servo/components/script/lib.rs                     |  1 -
 .../script_plugins/unrooted_must_root.rs           | 22 +++++++++++++++-------
 servo/components/selectors/matching.rs             |  2 +-
 servo/components/selectors/parser.rs               |  2 +-
 .../style/invalidation/element/invalidator.rs      |  2 +-
 servo/components/style/matching.rs                 |  2 +-
 .../components/style/properties/properties.mako.rs |  2 +-
 servo/components/style/style_adjuster.rs           |  2 +-
 servo/components/style/style_resolver.rs           |  2 +-
 servo/components/style/stylesheets/rule_list.rs    |  2 +-
 servo/components/style/stylesheets/rule_parser.rs  |  2 +-
 .../components/style/stylesheets/rules_iterator.rs |  2 +-
 servo/components/webdriver_server/lib.rs           |  2 +-
 servo/rust-commit-hash                             |  2 +-
 servo/tests/unit/style/stylist.rs                  | 13 -------------
 38 files changed, 71 insertions(+), 77 deletions(-)

diff --git a/servo/Cargo.lock b/servo/Cargo.lock
index 50dd6e1a785a..2aa7bd8ea3dd 100644
--- a/servo/Cargo.lock
+++ b/servo/Cargo.lock
@@ -3577,7 +3577,7 @@ version = "0.1.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "error-chain 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "xcb 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "xcb 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -3592,7 +3592,7 @@ dependencies = [
 
 [[package]]
 name = "xcb"
-version = "0.7.6"
+version = "0.7.7"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "libc 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -3918,7 +3918,7 @@ dependencies = [
 "checksum x11 2.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "db27c597c187da52194a4b8232e7d869503911aab9ff726fefb76d7a830f78ed"
 "checksum x11-clipboard 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "731230b8edcbb9d99247105e4c9ec0a538594d50ad68d2afa8662195f9db2973"
 "checksum x11-dl 2.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "326c500cdc166fd7c70dd8c8a829cd5c0ce7be5a5d98c25817de2b9bdc67faf8"
-"checksum xcb 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "63e3a849b73e4e1905e4f4d48f1750429bc86ea9f473632ab382a6f69ecb6b33"
+"checksum xcb 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)" = "7cede38417fcdf2f0a9d8abf1cea1c1b066320a8a316e9583a0d717c334fafb2"
 "checksum xdg 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a66b7c2281ebde13cf4391d70d4c7e5946c3c25e72a7b859ca8f677dcd0b0c61"
 "checksum xi-unicode 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "12ea8eda4b1eb72f02d148402e23832d56a33f55d8c1b2d5bcdde91d79d47cb1"
 "checksum xml-rs 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7ec6c39eaa68382c8e31e35239402c0a9489d4141a8ceb0c716099a0b515b562"
diff --git a/servo/components/devtools/lib.rs b/servo/components/devtools/lib.rs
index d5a2764a7102..6a25696eaed7 100644
--- a/servo/components/devtools/lib.rs
+++ b/servo/components/devtools/lib.rs
@@ -306,7 +306,7 @@ fn run_server(sender: Sender<DevtoolsControlMsg>,
                 columnNumber: console_message.columnNumber,
             },
         };
-        for mut stream in &mut *console_actor.streams.borrow_mut() {
+        for stream in &mut *console_actor.streams.borrow_mut() {
             stream.write_json_packet(&msg);
         }
     }
diff --git a/servo/components/layout/animation.rs b/servo/components/layout/animation.rs
index e4a2782c1271..ebbba82fcc6a 100644
--- a/servo/components/layout/animation.rs
+++ b/servo/components/layout/animation.rs
@@ -39,7 +39,7 @@ pub fn update_animation_state(constellation_chan: &IpcSender<ConstellationMsg>,
             // run.
             if let Some(ref mut animations) = running_animations.get_mut(node) {
                 // TODO: This being linear is probably not optimal.
-                for mut anim in animations.iter_mut() {
+                for anim in animations.iter_mut() {
                     if let Animation::Keyframes(_, ref anim_name, ref mut anim_state) = *anim {
                         if *name == *anim_name {
                             debug!("update_animation_state: Found other animation {}", name);
diff --git a/servo/components/layout/construct.rs b/servo/components/layout/construct.rs
index c863219941e4..7ef391b42183 100644
--- a/servo/components/layout/construct.rs
+++ b/servo/components/layout/construct.rs
@@ -1921,7 +1921,7 @@ impl Legalizer {
     /// true for anonymous block children of flex flows.
     fn try_to_add_child(&mut self, context: &SharedStyleContext, parent: &mut FlowRef, child: &mut FlowRef)
                         -> bool {
-        let mut parent = self.stack.last_mut().unwrap_or(parent);
+        let parent = self.stack.last_mut().unwrap_or(parent);
         let (parent_class, child_class) = (parent.class(), child.class());
         match (parent_class, child_class) {
             (FlowClass::TableWrapper, FlowClass::Table) |
@@ -1962,7 +1962,7 @@ impl Legalizer {
                     } else {
                         IS_BLOCK_FLEX_ITEM
                     };
-                    let mut block = FlowRef::deref_mut(&mut block_wrapper).as_mut_block();
+                    let block = FlowRef::deref_mut(&mut block_wrapper).as_mut_block();
                     block.base.flags.insert(MARGINS_CANNOT_COLLAPSE);
                     block.fragment.flags.insert(flag);
                 }
@@ -1979,7 +1979,7 @@ impl Legalizer {
                     } else {
                         IS_BLOCK_FLEX_ITEM
                     };
-                    let mut block = FlowRef::deref_mut(child).as_mut_block();
+                    let block = FlowRef::deref_mut(child).as_mut_block();
                     block.base.flags.insert(MARGINS_CANNOT_COLLAPSE);
                     block.fragment.flags.insert(flag);
                 }
diff --git a/servo/components/layout/display_list_builder.rs b/servo/components/layout/display_list_builder.rs
index f8b26899b57d..783574afd2a3 100644
--- a/servo/components/layout/display_list_builder.rs
+++ b/servo/components/layout/display_list_builder.rs
@@ -2718,7 +2718,7 @@ impl InlineFlowDisplayListBuilding for InlineFlow {
         self.base.scroll_root_id = Some(state.current_scroll_root_id);
         self.base.clip = state.clip_stack.last().cloned().unwrap_or_else(max_rect);
 
-        for mut fragment in self.fragments.fragments.iter_mut() {
+        for fragment in self.fragments.fragments.iter_mut() {
             let previous_containing_block_scroll_root_id = state.containing_block_scroll_root_id;
             if establishes_containing_block_for_absolute(fragment.style.get_box().position) {
                 state.containing_block_scroll_root_id = state.current_scroll_root_id;
diff --git a/servo/components/layout/flex.rs b/servo/components/layout/flex.rs
index 353c939f58b9..d79580f8cd0d 100644
--- a/servo/components/layout/flex.rs
+++ b/servo/components/layout/flex.rs
@@ -415,7 +415,7 @@ impl FlexFlow {
 
         let items = &mut self.items[start..];
         let mut children = self.block_flow.base.children.random_access_mut();
-        for mut item in items {
+        for item in items {
             let kid = children.get(item.index);
             item.init_sizes(kid, container_size, self.main_mode);
             let outer_main_size = item.outer_main_size(kid, self.main_mode);
@@ -607,7 +607,7 @@ impl FlexFlow {
 
             let mut children = self.block_flow.base.children.random_access_mut();
             for item in items.iter_mut() {
-                let mut block = children.get(item.index).as_mut_block();
+                let block = children.get(item.index).as_mut_block();
 
                 block.base.block_container_writing_mode = container_mode;
                 block.base.block_container_inline_size = inline_size;
@@ -659,7 +659,7 @@ impl FlexFlow {
 
         let mut children = self.block_flow.base.children.random_access_mut();
         for item in &mut self.items {
-            let mut base = flow::mut_base(children.get(item.index));
+            let base = flow::mut_base(children.get(item.index));
             if !self.main_reverse {
                 base.position.start.b = cur_b;
                 cur_b = cur_b + base.position.size.block;
diff --git a/servo/components/layout/inline.rs b/servo/components/layout/inline.rs
index d5813d9bea22..10e091c3c66d 100644
--- a/servo/components/layout/inline.rs
+++ b/servo/components/layout/inline.rs
@@ -435,7 +435,7 @@ impl LineBreaker {
             return
         }
         let last_fragment_index = self.pending_line.range.end() - FragmentIndex(1);
-        let mut fragment = &mut self.new_fragments[last_fragment_index.get() as usize];
+        let fragment = &mut self.new_fragments[last_fragment_index.get() as usize];
 
         let old_fragment_inline_size = fragment.border_box.size.inline;
 
@@ -1047,7 +1047,7 @@ impl InlineFlow {
         let space_per_expansion_opportunity = slack_inline_size / expansion_opportunities as i32;
         for fragment_index in line.range.each_index() {
             let fragment = fragments.get_mut(fragment_index.to_usize());
-            let mut scanned_text_fragment_info = match fragment.specific {
+            let scanned_text_fragment_info = match fragment.specific {
                 SpecificFragmentInfo::ScannedText(ref mut info) if !info.range.is_empty() => info,
                 _ => continue
             };
diff --git a/servo/components/layout/sequential.rs b/servo/components/layout/sequential.rs
index f6f8ce429e4f..4986ebb6c852 100644
--- a/servo/components/layout/sequential.rs
+++ b/servo/components/layout/sequential.rs
@@ -133,7 +133,7 @@ pub fn store_overflow(layout_context: &LayoutContext, flow: &mut Flow) {
         return;
     }
 
-    for mut kid in flow::mut_base(flow).child_iter_mut() {
+    for kid in flow::mut_base(flow).child_iter_mut() {
         store_overflow(layout_context, kid);
     }
 
diff --git a/servo/components/layout/table_cell.rs b/servo/components/layout/table_cell.rs
index 7ef02e28db65..fd807989b463 100644
--- a/servo/components/layout/table_cell.rs
+++ b/servo/components/layout/table_cell.rs
@@ -136,7 +136,7 @@ impl TableCellFlow {
         }
 
         for kid in flow::mut_base(self).children.iter_mut() {
-            let mut kid_base = flow::mut_base(kid);
+            let kid_base = flow::mut_base(kid);
             if !kid_base.flags.contains(IS_ABSOLUTELY_POSITIONED) {
                 kid_base.position.start.b += offset
             }
diff --git a/servo/components/layout/text.rs b/servo/components/layout/text.rs
index 6e1c7b2a43a1..9a207a2bb84e 100644
--- a/servo/components/layout/text.rs
+++ b/servo/components/layout/text.rs
@@ -460,7 +460,7 @@ fn split_first_fragment_at_newline_if_necessary(fragments: &mut LinkedList<Fragm
     }
 
     let new_fragment = {
-        let mut first_fragment = fragments.front_mut().unwrap();
+        let first_fragment = fragments.front_mut().unwrap();
         let string_before;
         let selection_before;
         {
diff --git a/servo/components/net/cookie_storage.rs b/servo/components/net/cookie_storage.rs
index f255f57b56d2..b3147ef4dd32 100644
--- a/servo/components/net/cookie_storage.rs
+++ b/servo/components/net/cookie_storage.rs
@@ -103,7 +103,7 @@ impl CookieStorage {
 
         // Step 12
         let domain = reg_host(&cookie.cookie.domain().as_ref().unwrap_or(&""));
-        let mut cookies = self.cookies_map.entry(domain).or_insert(vec![]);
+        let cookies = self.cookies_map.entry(domain).or_insert(vec![]);
 
         if cookies.len() == self.max_per_host {
             let old_len = cookies.len();
diff --git a/servo/components/profile/heartbeats.rs b/servo/components/profile/heartbeats.rs
index 4661dad61836..0d474fe3a111 100644
--- a/servo/components/profile/heartbeats.rs
+++ b/servo/components/profile/heartbeats.rs
@@ -33,7 +33,7 @@ pub fn cleanup() {
         )
     );
     if let Some(mut hbs) = hbs_opt_box {
-        for (_, mut v) in hbs.iter_mut() {
+        for (_, v) in hbs.iter_mut() {
             // log any remaining heartbeat records before dropping
             log_heartbeat_records(v);
         }
@@ -65,7 +65,7 @@ pub fn maybe_heartbeat(category: &ProfilerCategory,
                 if !(*hbs_ptr).contains_key(category) {
                     maybe_create_heartbeat(&mut (*hbs_ptr), category.clone());
                 }
-                if let Some(mut h) = (*hbs_ptr).get_mut(category) {
+                if let Some(h) = (*hbs_ptr).get_mut(category) {
                     (*h).heartbeat(0, 1, start_time, end_time, start_energy, end_energy);
                 }
             }
diff --git a/servo/components/script/dom/bindings/js.rs b/servo/components/script/dom/bindings/js.rs
index 975ddeda13b0..abfd9f47eff1 100644
--- a/servo/components/script/dom/bindings/js.rs
+++ b/servo/components/script/dom/bindings/js.rs
@@ -469,7 +469,7 @@ impl RootCollection {
     /// Start tracking a stack-based root
     unsafe fn root(&self, untracked_reflector: *const Reflector) {
         debug_assert!(thread_state::get().is_script());
-        let mut roots = &mut *self.roots.get();
+        let roots = &mut *self.roots.get();
         roots.push(untracked_reflector);
         assert!(!(*untracked_reflector).get_jsobject().is_null())
     }
@@ -479,7 +479,7 @@ impl RootCollection {
         assert!(!tracked_reflector.is_null());
         assert!(!(*tracked_reflector).get_jsobject().is_null());
         debug_assert!(thread_state::get().is_script());
-        let mut roots = &mut *self.roots.get();
+        let roots = &mut *self.roots.get();
         match roots.iter().rposition(|r| *r == tracked_reflector) {
             Some(idx) => {
                 roots.remove(idx);
diff --git a/servo/components/script/dom/cssstyledeclaration.rs b/servo/components/script/dom/cssstyledeclaration.rs
index 0732c9af9e45..ddf085b34913 100644
--- a/servo/components/script/dom/cssstyledeclaration.rs
+++ b/servo/components/script/dom/cssstyledeclaration.rs
@@ -238,7 +238,7 @@ impl CSSStyleDeclaration {
             return Err(Error::NoModificationAllowed);
         }
 
-        self.owner.mutate_associated_block(|ref mut pdb, mut changed| {
+        self.owner.mutate_associated_block(|pdb, changed| {
             if value.is_empty() {
                 // Step 3
                 *changed = pdb.remove_property(&id);
@@ -360,7 +360,7 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration {
             _ => return Ok(()),
         };
 
-        self.owner.mutate_associated_block(|ref mut pdb, mut changed| {
+        self.owner.mutate_associated_block(|pdb, changed| {
             // Step 5 & 6
             *changed = pdb.set_importance(&id, importance);
         });
@@ -388,7 +388,7 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration {
         };
 
         let mut string = String::new();
-        self.owner.mutate_associated_block(|mut pdb, mut changed| {
+        self.owner.mutate_associated_block(|pdb, changed| {
             pdb.property_value_to_css(&id, &mut string).unwrap();
             *changed = pdb.remove_property(&id);
         });
@@ -438,7 +438,7 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration {
         }
 
         let quirks_mode = window.Document().quirks_mode();
-        self.owner.mutate_associated_block(|mut pdb, mut _changed| {
+        self.owner.mutate_associated_block(|pdb, _changed| {
             // Step 3
             *pdb = parse_style_attribute(&value,
                                          &self.owner.base_url(),
diff --git a/servo/components/script/dom/cssstylerule.rs b/servo/components/script/dom/cssstylerule.rs
index ea121ef900a9..12e9cdcc8694 100644
--- a/servo/components/script/dom/cssstylerule.rs
+++ b/servo/components/script/dom/cssstylerule.rs
@@ -99,7 +99,7 @@ impl CSSStyleRuleMethods for CSSStyleRule {
         if let Ok(mut s) = SelectorList::parse(&parser, &mut css_parser) {
             // This mirrors what we do in CSSStyleOwner::mutate_associated_block.
             let mut guard = self.cssrule.shared_lock().write();
-            let mut stylerule = self.stylerule.write_with(&mut guard);
+            let stylerule = self.stylerule.write_with(&mut guard);
             mem::swap(&mut stylerule.selectors, &mut s);
             // It seems like we will want to avoid having to invalidate all
             // stylesheets eventually!
diff --git a/servo/components/script/dom/document.rs b/servo/components/script/dom/document.rs
index 90ea06fbe7b4..71bb02eaa364 100644
--- a/servo/components/script/dom/document.rs
+++ b/servo/components/script/dom/document.rs
@@ -633,7 +633,7 @@ impl Document {
         // reset_form_owner_for_listeners -> reset_form_owner -> GetElementById
         {
             let mut id_map = self.id_map.borrow_mut();
-            let mut elements = id_map.entry(id.clone()).or_insert(Vec::new());
+            let elements = id_map.entry(id.clone()).or_insert(Vec::new());
             elements.insert_pre_order(element, root.r().upcast::<Node>());
         }
         self.reset_form_owner_for_listeners(&id);
@@ -642,7 +642,7 @@ impl Document {
     pub fn register_form_id_listener<T: ?Sized + FormControl>(&self, id: DOMString, listener: &T) {
         let mut map = self.form_id_listener_map.borrow_mut();
         let listener = listener.to_element();
-        let mut set = map.entry(Atom::from(id)).or_insert(HashSet::new());
+        let set = map.entry(Atom::from(id)).or_insert(HashSet::new());
         set.insert(JS::from_ref(listener));
     }
 
@@ -1572,7 +1572,7 @@ impl Document {
     /// https://html.spec.whatwg.org/multipage/#dom-window-cancelanimationframe
     pub fn cancel_animation_frame(&self, ident: u32) {
         let mut list = self.animation_frame_list.borrow_mut();
-        if let Some(mut pair) = list.iter_mut().find(|pair| pair.0 == ident) {
+        if let Some(pair) = list.iter_mut().find(|pair| pair.0 == ident) {
             pair.1 = None;
         }
     }
@@ -2399,7 +2399,7 @@ impl Document {
         if entry.snapshot.is_none() {
             entry.snapshot = Some(Snapshot::new(el.html_element_in_html_document()));
         }
-        let mut snapshot = entry.snapshot.as_mut().unwrap();
+        let snapshot = entry.snapshot.as_mut().unwrap();
         if snapshot.state.is_none() {
             snapshot.state = Some(el.state());
         }
@@ -2426,7 +2426,7 @@ impl Document {
             entry.hint.insert(RESTYLE_SELF);
         }
 
-        let mut snapshot = entry.snapshot.as_mut().unwrap();
+        let snapshot = entry.snapshot.as_mut().unwrap();
         if attr.local_name() == &local_name!("id") {
             snapshot.id_changed = true;
         } else if attr.local_name() == &local_name!("class") {
@@ -4028,7 +4028,7 @@ impl PendingInOrderScriptVec {
 
     fn loaded(&self, element: &HTMLScriptElement, result: ScriptResult) {
         let mut scripts = self.scripts.borrow_mut();
-        let mut entry = scripts.iter_mut().find(|entry| &*entry.element == element).unwrap();
+        let entry = scripts.iter_mut().find(|entry| &*entry.element == element).unwrap();
         entry.loaded(result);
     }
 
diff --git a/servo/components/script/dom/medialist.rs b/servo/components/script/dom/medialist.rs
index 0064d0445095..ae20f5aa0422 100644
--- a/servo/components/script/dom/medialist.rs
+++ b/servo/components/script/dom/medialist.rs
@@ -63,7 +63,7 @@ impl MediaListMethods for MediaList {
     // https://drafts.csswg.org/cssom/#dom-medialist-mediatext
     fn SetMediaText(&self, value: DOMString) {
         let mut guard = self.shared_lock().write();
-        let mut media_queries = self.media_queries.write_with(&mut guard);
+        let media_queries = self.media_queries.write_with(&mut guard);
         // Step 2
         if value.is_empty() {
             // Step 1
@@ -154,7 +154,7 @@ impl MediaListMethods for MediaList {
         // Step 3
         let m_serialized = m.unwrap().to_css_string();
         let mut guard = self.shared_lock().write();
-        let mut media_list = self.media_queries.write_with(&mut guard);
+        let media_list = self.media_queries.write_with(&mut guard);
         let new_vec = media_list.media_queries.drain(..)
                                 .filter(|q| m_serialized != q.to_css_string())
                                 .collect();
diff --git a/servo/components/script/dom/range.rs b/servo/components/script/dom/range.rs
index fa849a0fc1a2..1e65caedc9dd 100644
--- a/servo/components/script/dom/range.rs
+++ b/servo/components/script/dom/range.rs
@@ -1049,7 +1049,7 @@ impl WeakRangeVec {
         let offset = context.index();
         let parent = context.parent;
         unsafe {
-            let mut ranges = &mut *self.cell.get();
+            let ranges = &mut *self.cell.get();
 
             ranges.update(|entry| {
                 let range = entry.root().unwrap();
@@ -1076,7 +1076,7 @@ impl WeakRangeVec {
         }
 
         unsafe {
-            let mut ranges = &mut *self.cell.get();
+            let ranges = &mut *self.cell.get();
 
             ranges.update(|entry| {
                 let range = entry.root().unwrap();
diff --git a/servo/components/script/dom/servoparser/async_html.rs b/servo/components/script/dom/servoparser/async_html.rs
index 59411fda1c73..70d2008f49f6 100644
--- a/servo/components/script/dom/servoparser/async_html.rs
+++ b/servo/components/script/dom/servoparser/async_html.rs
@@ -568,7 +568,7 @@ impl TreeSink for Sink {
         }
         let node = self.new_parse_node();
         {
-            let mut data = self.get_parse_node_data_mut(&target.id);
+            let data = self.get_parse_node_data_mut(&target.id);
             data.contents = Some(node.clone());
         }
         self.send_op(ParseOperation::GetTemplateContents { target: target.id, contents: node.id });
@@ -596,7 +596,7 @@ impl TreeSink for Sink {
         let mut node = self.new_parse_node();
         node.qual_name = Some(name.clone());
         {
-            let mut node_data = self.get_parse_node_data_mut(&node.id);
+            let node_data = self.get_parse_node_data_mut(&node.id);
             node_data.is_integration_point = html_attrs.iter()
             .any(|attr| {
                 let attr_value = &String::from(attr.value.clone());
diff --git a/servo/components/script/dom/url.rs b/servo/components/script/dom/url.rs
index a02a735638fc..41de4dcc0c72 100644
--- a/servo/components/script/dom/url.rs
+++ b/servo/components/script/dom/url.rs
@@ -96,8 +96,8 @@ impl URL {
 
     // https://w3c.github.io/FileAPI/#dfn-createObjectURL
     pub fn CreateObjectURL(global: &GlobalScope, blob: &Blob) -> DOMString {
-        /// XXX: Second field is an unicode-serialized Origin, it is a temporary workaround
-        ///      and should not be trusted. See issue https://github.com/servo/servo/issues/11722
+        // XXX: Second field is an unicode-serialized Origin, it is a temporary workaround
+        //      and should not be trusted. See issue https://github.com/servo/servo/issues/11722
         let origin = get_blob_origin(&global.get_url());
 
         let id = blob.get_blob_url_id();
diff --git a/servo/components/script/dom/vrdisplay.rs b/servo/components/script/dom/vrdisplay.rs
index 3f73a577fad7..54f06fb928f2 100644
--- a/servo/components/script/dom/vrdisplay.rs
+++ b/servo/components/script/dom/vrdisplay.rs
@@ -268,7 +268,7 @@ impl VRDisplayMethods for VRDisplay {
     fn CancelAnimationFrame(&self, handle: u32) {
         if self.presenting.get() {
             let mut list = self.raf_callback_list.borrow_mut();
-            if let Some(mut pair) = list.iter_mut().find(|pair| pair.0 == handle) {
+            if let Some(pair) = list.iter_mut().find(|pair| pair.0 == handle) {
                 pair.1 = None;
             }
         } else {
diff --git a/servo/components/script/dom/webglrenderingcontext.rs b/servo/components/script/dom/webglrenderingcontext.rs
index 73d4ddba1b90..62c92b42785c 100644
--- a/servo/components/script/dom/webglrenderingcontext.rs
+++ b/servo/components/script/dom/webglrenderingcontext.rs
@@ -2434,7 +2434,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
         }
 
         typedarray!(in(cx) let mut pixels_data: ArrayBufferView = pixels);
-        let (array_type, mut data) = match { pixels_data.as_mut() } {
+        let (array_type, data) = match { pixels_data.as_mut() } {
             Ok(data) => (data.get_array_type(), data.as_mut_slice()),
             Err(_) => return Err(Error::Type("Not an ArrayBufferView".to_owned())),
         };
diff --git a/servo/components/script/dom/xmlhttprequest.rs b/servo/components/script/dom/xmlhttprequest.rs
index 6ed2dda1851f..e6652d79d706 100644
--- a/servo/components/script/dom/xmlhttprequest.rs
+++ b/servo/components/script/dom/xmlhttprequest.rs
@@ -627,7 +627,7 @@ impl XMLHttpRequestMethods for XMLHttpRequest {
 
                 if !content_type_set {
                     let ct = request.headers.get_mut::<ContentType>();
-                    if let Some(mut ct) = ct {
+                    if let Some(ct) = ct {
                         if let Some(encoding) = encoding {
                             for param in &mut (ct.0).2 {
                                 if param.0 == MimeAttr::Charset {
diff --git a/servo/components/script/lib.rs b/servo/components/script/lib.rs
index e1a1ab592cb7..5824d6f2e490 100644
--- a/servo/components/script/lib.rs
+++ b/servo/components/script/lib.rs
@@ -9,7 +9,6 @@
 #![feature(mpsc_select)]
 #![feature(nonzero)]
 #![feature(on_unimplemented)]
-#![feature(option_entry)]
 #![feature(plugin)]
 #![feature(proc_macro)]
 #![feature(stmt_expr_attributes)]
diff --git a/servo/components/script_plugins/unrooted_must_root.rs b/servo/components/script_plugins/unrooted_must_root.rs
index 5dbd2b1a3bdd..f3f5e60ab62a 100644
--- a/servo/components/script_plugins/unrooted_must_root.rs
+++ b/servo/components/script_plugins/unrooted_must_root.rs
@@ -182,7 +182,7 @@ impl<'a, 'b, 'tcx> visit::Visitor<'tcx> for FnDefVisitor<'a, 'b, 'tcx> {
         }
 
         match expr.node {
-            /// Trait casts from #[must_root] types are not allowed
+            // Trait casts from #[must_root] types are not allowed
             hir::ExprCast(ref subexpr, _) => require_rooted(cx, self.in_new_function, &*subexpr),
             // This catches assignments... the main point of this would be to catch mutable
             // references to `JS<T>`.
@@ -206,13 +206,21 @@ impl<'a, 'b, 'tcx> visit::Visitor<'tcx> for FnDefVisitor<'a, 'b, 'tcx> {
     fn visit_pat(&mut self, pat: &'tcx hir::Pat) {
         let cx = self.cx;
 
-        if let hir::PatKind::Binding(hir::BindingMode::BindByValue(_), _, _, _) = pat.node {
-            let ty = cx.tables.pat_ty(pat);
-            if is_unrooted_ty(cx, ty, self.in_new_function) {
-                cx.span_lint(UNROOTED_MUST_ROOT,
-                            pat.span,
-                            &format!("Expression of type {:?} must be rooted", ty))
+        // We want to detect pattern bindings that move a value onto the stack.
+        // When "default binding modes" https://github.com/rust-lang/rust/issues/42640
+        // are implemented, the `Unannotated` case could cause false-positives.
+        // These should be fixable by adding an explicit `ref`.
+        match pat.node {
+            hir::PatKind::Binding(hir::BindingAnnotation::Unannotated, _, _, _) |
+            hir::PatKind::Binding(hir::BindingAnnotation::Mutable, _, _, _) => {
+                let ty = cx.tables.pat_ty(pat);
+                if is_unrooted_ty(cx, ty, self.in_new_function) {
+                    cx.span_lint(UNROOTED_MUST_ROOT,
+                                pat.span,
+                                &format!("Expression of type {:?} must be rooted", ty))
+                }
             }
+            _ => {}
         }
 
         visit::walk_pat(self, pat);
diff --git a/servo/components/selectors/matching.rs b/servo/components/selectors/matching.rs
index 7bd9814d26fb..8f6b2fa6aa54 100644
--- a/servo/components/selectors/matching.rs
+++ b/servo/components/selectors/matching.rs
@@ -458,7 +458,7 @@ where
 /// Matches a complex selector.
 pub fn matches_complex_selector<E, F>(mut iter: SelectorIter<E::Impl>,
                                       element: &E,
-                                      mut context: &mut LocalMatchingContext<E::Impl>,
+                                      context: &mut LocalMatchingContext<E::Impl>,
                                       flags_setter: &mut F)
                                       -> bool
     where E: Element,
diff --git a/servo/components/selectors/parser.rs b/servo/components/selectors/parser.rs
index 490399ce38ce..6b2c1f2b4e86 100644
--- a/servo/components/selectors/parser.rs
+++ b/servo/components/selectors/parser.rs
@@ -1464,7 +1464,7 @@ fn parse_negation<'i, 't, P, E, Impl>(parser: &P,
 fn parse_compound_selector<'i, 't, P, E, Impl>(
     parser: &P,
     input: &mut CssParser<'i, 't>,
-    mut builder: &mut SelectorBuilder<Impl>)
+    builder: &mut SelectorBuilder<Impl>)
     -> Result<bool, ParseError<'i, SelectorParseError<'i, E>>>
     where P: Parser<'i, Impl=Impl, Error=E>, Impl: SelectorImpl
 {
diff --git a/servo/components/style/invalidation/element/invalidator.rs b/servo/components/style/invalidation/element/invalidator.rs
index 848c5cd13dc8..b8510ba3169b 100644
--- a/servo/components/style/invalidation/element/invalidator.rs
+++ b/servo/components/style/invalidation/element/invalidator.rs
@@ -154,7 +154,7 @@ impl<'a, 'b: 'a, E> TreeStyleInvalidator<'a, 'b, E>
             trace!(" > visitedness change, force subtree restyle");
             // We can't just return here because there may also be attribute
             // changes as well that imply additional hints.
-            let mut data = self.data.as_mut().unwrap();
+            let data = self.data.as_mut().unwrap();
             data.restyle.hint.insert(RestyleHint::restyle_subtree());
         }
 
diff --git a/servo/components/style/matching.rs b/servo/components/style/matching.rs
index b62bc54bf768..f58d7cd123e6 100644
--- a/servo/components/style/matching.rs
+++ b/servo/components/style/matching.rs
@@ -440,7 +440,7 @@ pub trait MatchMethods : TElement {
     fn finish_restyle(
         &self,
         context: &mut StyleContext<Self>,
-        mut data: &mut ElementData,
+        data: &mut ElementData,
         mut new_styles: ElementStyles,
         important_rules_changed: bool,
     ) -> ChildCascadeRequirement {
diff --git a/servo/components/style/properties/properties.mako.rs b/servo/components/style/properties/properties.mako.rs
index d98e173db5ba..81ff00fb6d5e 100644
--- a/servo/components/style/properties/properties.mako.rs
+++ b/servo/components/style/properties/properties.mako.rs
@@ -3364,7 +3364,7 @@ pub fn modify_border_style_for_inline_sides(style: &mut Arc<ComputedValues>,
                 return;
             }
         }
-        let mut style = Arc::make_mut(style);
+        let style = Arc::make_mut(style);
         let border = Arc::make_mut(&mut style.border);
         match side {
             PhysicalSide::Left => {
diff --git a/servo/components/style/style_adjuster.rs b/servo/components/style/style_adjuster.rs
index 03b15916b237..bcda598af9c7 100644
--- a/servo/components/style/style_adjuster.rs
+++ b/servo/components/style/style_adjuster.rs
@@ -269,7 +269,7 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
 
         if overflow_x != original_overflow_x ||
            overflow_y != original_overflow_y {
-            let mut box_style = self.style.mutate_box();
+            let box_style = self.style.mutate_box();
             box_style.set_overflow_x(overflow_x);
             box_style.set_overflow_y(overflow_y);
         }
diff --git a/servo/components/style/style_resolver.rs b/servo/components/style/style_resolver.rs
index cf512c4fbdd2..3fc1d57cc8f7 100644
--- a/servo/components/style/style_resolver.rs
+++ b/servo/components/style/style_resolver.rs
@@ -247,7 +247,7 @@ where
                         Some(&*primary_style.style)
                     };
 
-                for (i, mut inputs) in pseudo_array.iter_mut().enumerate() {
+                for (i, inputs) in pseudo_array.iter_mut().enumerate() {
                     if let Some(inputs) = inputs.take() {
                         let pseudo = PseudoElement::from_eager_index(i);
                         pseudo_styles.set(
diff --git a/servo/components/style/stylesheets/rule_list.rs b/servo/components/style/stylesheets/rule_list.rs
index 82e78015400d..14b3dc5e7696 100644
--- a/servo/components/style/stylesheets/rule_list.rs
+++ b/servo/components/style/stylesheets/rule_list.rs
@@ -150,7 +150,7 @@ impl CssRulesHelpers for RawOffsetArc<Locked<CssRules>> {
 
         {
             let mut write_guard = lock.write();
-            let mut rules = self.write_with(&mut write_guard);
+            let rules = self.write_with(&mut write_guard);
             // Step 5
             // Computes the maximum allowed parser state at a given index.
             let rev_state = rules.0.get(index).map_or(State::Body, CssRule::rule_state);
diff --git a/servo/components/style/stylesheets/rule_parser.rs b/servo/components/style/stylesheets/rule_parser.rs
index 007d7e11026e..f0d224e498a7 100644
--- a/servo/components/style/stylesheets/rule_parser.rs
+++ b/servo/components/style/stylesheets/rule_parser.rs
@@ -209,7 +209,7 @@ impl<'a, 'i> AtRuleParser<'i> for TopLevelRuleParser<'a> {
                 let id = register_namespace(&url)
                     .map_err(|()| StyleParseError::UnspecifiedError)?;
 
-                let mut namespaces = self.namespaces.as_mut().unwrap();
+                let namespaces = self.namespaces.as_mut().unwrap();
 
                 let opt_prefix = if let Ok(prefix) = prefix_result {
                     let prefix = Prefix::from(prefix.as_ref());
diff --git a/servo/components/style/stylesheets/rules_iterator.rs b/servo/components/style/stylesheets/rules_iterator.rs
index 95a3ab8b3885..65e1b637ae52 100644
--- a/servo/components/style/stylesheets/rules_iterator.rs
+++ b/servo/components/style/stylesheets/rules_iterator.rs
@@ -70,7 +70,7 @@ impl<'a, 'b, C> Iterator for RulesIterator<'a, 'b, C>
 
             let rule;
             let sub_iter = {
-                let mut nested_iter = self.stack.last_mut().unwrap();
+                let nested_iter = self.stack.last_mut().unwrap();
                 rule = match nested_iter.next() {
                     Some(r) => r,
                     None => {
diff --git a/servo/components/webdriver_server/lib.rs b/servo/components/webdriver_server/lib.rs
index bd2f667f9892..28a4885f0d41 100644
--- a/servo/components/webdriver_server/lib.rs
+++ b/servo/components/webdriver_server/lib.rs
@@ -702,7 +702,7 @@ impl Handler {
     fn handle_set_timeouts(&mut self,
                            parameters: &TimeoutsParameters)
                            -> WebDriverResult<WebDriverResponse> {
-        let mut session = self.session
+        let session = self.session
             .as_mut()
             .ok_or(WebDriverError::new(ErrorStatus::SessionNotCreated, ""))?;
 
diff --git a/servo/rust-commit-hash b/servo/rust-commit-hash
index d4f08fe97644..a08d23cd1a71 100644
--- a/servo/rust-commit-hash
+++ b/servo/rust-commit-hash
@@ -1 +1 @@
-599be0d18f4c6ddf36366d2a5a2ca6dc65886896
+13d94d5fa8129a34f5c77a1bcd76983f5aed2434
diff --git a/servo/tests/unit/style/stylist.rs b/servo/tests/unit/style/stylist.rs
index da9a9478957a..52067b501788 100644
--- a/servo/tests/unit/style/stylist.rs
+++ b/servo/tests/unit/style/stylist.rs
@@ -51,19 +51,6 @@ fn get_mock_rules(css_selectors: &[&str]) -> (Vec<Vec<Rule>>, SharedRwLock) {
     }).collect(), shared_lock)
 }
 
-fn get_mock_map(selectors: &[&str]) -> (SelectorMap<Rule>, SharedRwLock) {
-    let mut map = SelectorMap::<Rule>::new();
-    let (selector_rules, shared_lock) = get_mock_rules(selectors);
-
-    for rules in selector_rules.into_iter() {
-        for rule in rules.into_iter() {
-            map.insert(rule, QuirksMode::NoQuirks)
-        }
-    }
-
-    (map, shared_lock)
-}
-
 fn parse_selectors(selectors: &[&str]) -> Vec<Selector<SelectorImpl>> {
     selectors.iter()
              .map(|x| SelectorParser::parse_author_origin_no_namespace(x).unwrap().0

From 78ec5fc0bcd627a44274d0d6f310624ebdaca64e Mon Sep 17 00:00:00 2001
From: Simon Sapin <simon.sapin@exyr.org>
Date: Thu, 17 Aug 2017 11:05:32 -0500
Subject: [PATCH 05/16] servo: Merge #18126 - geckolib: Fix some warnings
 (treated as error) new in Rust Nigthly (from servo:glow-fox); r=emilio

Source-Repo: https://github.com/servo/servo
Source-Revision: cc86ca2bcdec5e89ee5279085ea38db63ef41af9

(cherry picked from commit mozilla/gecko-dev@f0acf27d189d)
---
 servo/components/style/gecko/conversions.rs            |  2 +-
 servo/components/style/gecko/wrapper.rs                |  2 +-
 .../style/gecko_bindings/sugar/ns_t_array.rs           |  4 ++--
 servo/components/style/properties/gecko.mako.rs        | 18 +++++++++---------
 servo/components/style/style_adjuster.rs               |  4 ++--
 servo/ports/geckolib/glue.rs                           | 12 ++++++------
 6 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/servo/components/style/gecko/conversions.rs b/servo/components/style/gecko/conversions.rs
index 8f3fb6bf2d0f..51015997c5c1 100644
--- a/servo/components/style/gecko/conversions.rs
+++ b/servo/components/style/gecko/conversions.rs
@@ -348,7 +348,7 @@ impl nsStyleImage {
             // NB: stops are guaranteed to be none in the gecko side by
             // default.
 
-            let mut gecko_stop = unsafe {
+            let gecko_stop = unsafe {
                 &mut (*gecko_gradient).mStops[index]
             };
             let mut coord = nsStyleCoord::null();
diff --git a/servo/components/style/gecko/wrapper.rs b/servo/components/style/gecko/wrapper.rs
index 3c61daefe30a..5ad9668540d4 100644
--- a/servo/components/style/gecko/wrapper.rs
+++ b/servo/components/style/gecko/wrapper.rs
@@ -429,7 +429,7 @@ impl<'lb> GeckoXBLBinding<'lb> {
         }
     }
 
-    fn each_xbl_stylist<F>(self, mut f: &mut F)
+    fn each_xbl_stylist<F>(self, f: &mut F)
     where
         F: FnMut(&Stylist),
     {
diff --git a/servo/components/style/gecko_bindings/sugar/ns_t_array.rs b/servo/components/style/gecko_bindings/sugar/ns_t_array.rs
index 6bc389702f54..068e10ddea1b 100644
--- a/servo/components/style/gecko_bindings/sugar/ns_t_array.rs
+++ b/servo/components/style/gecko_bindings/sugar/ns_t_array.rs
@@ -90,7 +90,7 @@ impl<T> nsTArray<T> {
         // this can leak
         debug_assert!(len >= self.len() as u32);
         self.ensure_capacity(len as usize);
-        let mut header = self.header_mut();
+        let header = self.header_mut();
         header.mLength = len;
     }
 
@@ -99,7 +99,7 @@ impl<T> nsTArray<T> {
     /// This will not leak since it only works on POD types (and thus doesn't assert)
     pub unsafe fn set_len_pod(&mut self, len: u32) where T: Copy {
         self.ensure_capacity(len as usize);
-        let mut header = unsafe { self.header_mut() };
+        let header = unsafe { self.header_mut() };
         header.mLength = len;
     }
 }
diff --git a/servo/components/style/properties/gecko.mako.rs b/servo/components/style/properties/gecko.mako.rs
index b0d5ef189ce2..be038f9f76d4 100644
--- a/servo/components/style/properties/gecko.mako.rs
+++ b/servo/components/style/properties/gecko.mako.rs
@@ -4136,14 +4136,14 @@ fn static_assert() {
                     fn init_shadow(filter: &mut nsStyleFilter) -> &mut nsCSSShadowArray {
                         unsafe {
                             let ref mut union = filter.__bindgen_anon_1;
-                            let mut shadow_array: &mut *mut nsCSSShadowArray = union.mDropShadow.as_mut();
+                            let shadow_array: &mut *mut nsCSSShadowArray = union.mDropShadow.as_mut();
                             *shadow_array = Gecko_NewCSSShadowArray(1);
 
                             &mut **shadow_array
                         }
                     }
 
-                    let mut gecko_shadow = init_shadow(gecko_filter);
+                    let gecko_shadow = init_shadow(gecko_filter);
                     gecko_shadow.mArray[0].set_from_simple_shadow(shadow);
                 },
                 Url(ref url) => {
@@ -4665,14 +4665,14 @@ fn static_assert() {
                     unsafe {
                         // We have to be very careful to avoid a copy here!
                         let ref mut union = ${ident}.__bindgen_anon_1;
-                        let mut shape: &mut *mut StyleBasicShape = union.mBasicShape.as_mut();
+                        let shape: &mut *mut StyleBasicShape = union.mBasicShape.as_mut();
                         *shape = Gecko_NewBasicShape(ty);
                         &mut **shape
                     }
                 }
                 match servo_shape {
                     BasicShape::Inset(inset) => {
-                        let mut shape = init_shape(${ident}, StyleBasicShapeType::Inset);
+                        let shape = init_shape(${ident}, StyleBasicShapeType::Inset);
                         unsafe { shape.mCoordinates.set_len(4) };
 
                         // set_len() can't call constructors, so the coordinates
@@ -4694,7 +4694,7 @@ fn static_assert() {
                         set_corners_from_radius(inset.round, &mut shape.mRadius);
                     }
                     BasicShape::Circle(circ) => {
-                        let mut shape = init_shape(${ident}, StyleBasicShapeType::Circle);
+                        let shape = init_shape(${ident}, StyleBasicShapeType::Circle);
                         unsafe { shape.mCoordinates.set_len(1) };
                         shape.mCoordinates[0].leaky_set_null();
                         circ.radius.to_gecko_style_coord(&mut shape.mCoordinates[0]);
@@ -4702,7 +4702,7 @@ fn static_assert() {
                         shape.mPosition = circ.position.into();
                     }
                     BasicShape::Ellipse(el) => {
-                        let mut shape = init_shape(${ident}, StyleBasicShapeType::Ellipse);
+                        let shape = init_shape(${ident}, StyleBasicShapeType::Ellipse);
                         unsafe { shape.mCoordinates.set_len(2) };
                         shape.mCoordinates[0].leaky_set_null();
                         el.semiaxis_x.to_gecko_style_coord(&mut shape.mCoordinates[0]);
@@ -4712,7 +4712,7 @@ fn static_assert() {
                         shape.mPosition = el.position.into();
                     }
                     BasicShape::Polygon(poly) => {
-                        let mut shape = init_shape(${ident}, StyleBasicShapeType::Polygon);
+                        let shape = init_shape(${ident}, StyleBasicShapeType::Polygon);
                         unsafe {
                             shape.mCoordinates.set_len(poly.coordinates.len() as u32 * 2);
                         }
@@ -4797,7 +4797,7 @@ clip-path
             bindings::Gecko_nsStyleSVG_SetDashArrayLength(&mut self.gecko, v.len() as u32);
         }
 
-        for (mut gecko, servo) in self.gecko.mStrokeDasharray.iter_mut().zip(v) {
+        for (gecko, servo) in self.gecko.mStrokeDasharray.iter_mut().zip(v) {
             match servo {
                 Either::First(number) => gecko.set_value(CoordDataValue::Factor(number)),
                 Either::Second(lop) => gecko.set(lop),
@@ -4885,7 +4885,7 @@ clip-path
         }
 
         self.gecko.mContextPropsBits = 0;
-        for (mut gecko, servo) in self.gecko.mContextProps.iter_mut().zip(v) {
+        for (gecko, servo) in self.gecko.mContextProps.iter_mut().zip(v) {
             if servo.0 == atom!("fill") {
                 self.gecko.mContextPropsBits |= structs::NS_STYLE_CONTEXT_PROPERTY_FILL as u8;
             } else if servo.0 == atom!("stroke") {
diff --git a/servo/components/style/style_adjuster.rs b/servo/components/style/style_adjuster.rs
index bcda598af9c7..6e51fa74072a 100644
--- a/servo/components/style/style_adjuster.rs
+++ b/servo/components/style/style_adjuster.rs
@@ -167,7 +167,7 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
         // When 'contain: paint', update overflow from 'visible' to 'clip'.
         if self.style.get_box().clone_contain().contains(contain::PAINT) {
             if self.style.get_box().clone_overflow_x() == overflow::visible {
-                let mut box_style = self.style.mutate_box();
+                let box_style = self.style.mutate_box();
                 box_style.set_overflow_x(overflow::_moz_hidden_unscrollable);
                 box_style.set_overflow_y(overflow::_moz_hidden_unscrollable);
             }
@@ -182,7 +182,7 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
         use properties::longhands::font_style::computed_value::T as font_style;
         use properties::longhands::font_weight::computed_value::T as font_weight;
         if self.style.get_font().clone__moz_math_variant() != moz_math_variant::none {
-            let mut font_style = self.style.mutate_font();
+            let font_style = self.style.mutate_font();
             // Sadly we don't have a nice name for the computed value
             // of "font-weight: normal".
             font_style.set_font_weight(font_weight::normal());
diff --git a/servo/ports/geckolib/glue.rs b/servo/ports/geckolib/glue.rs
index befdda61e0b3..b52b45354d84 100644
--- a/servo/ports/geckolib/glue.rs
+++ b/servo/ports/geckolib/glue.rs
@@ -816,7 +816,7 @@ pub extern "C" fn Servo_StyleSet_AppendStyleSheet(
 ) {
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let mut data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
-    let mut data = &mut *data;
+    let data = &mut *data;
     let guard = global_style_data.shared_lock.read();
     data.stylesheets.append_stylesheet(
         &data.stylist,
@@ -868,7 +868,7 @@ pub extern "C" fn Servo_StyleSet_PrependStyleSheet(
 ) {
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let mut data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
-    let mut data = &mut *data;
+    let data = &mut *data;
     let guard = global_style_data.shared_lock.read();
     data.stylesheets.prepend_stylesheet(
         &data.stylist,
@@ -886,7 +886,7 @@ pub extern "C" fn Servo_StyleSet_InsertStyleSheetBefore(
 ) {
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let mut data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
-    let mut data = &mut *data;
+    let data = &mut *data;
     let guard = global_style_data.shared_lock.read();
     data.stylesheets.insert_stylesheet_before(
         &data.stylist,
@@ -904,7 +904,7 @@ pub extern "C" fn Servo_StyleSet_RemoveStyleSheet(
 ) {
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let mut data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
-    let mut data = &mut *data;
+    let data = &mut *data;
     let guard = global_style_data.shared_lock.read();
     data.stylesheets.remove_stylesheet(
         &data.stylist,
@@ -1275,7 +1275,7 @@ pub extern "C" fn Servo_StyleRule_GetSpecificityAtIndex(
     specificity: *mut u64
 ) {
     read_locked_arc(rule, |rule: &StyleRule| {
-        let mut specificity =  unsafe { specificity.as_mut().unwrap() };
+        let specificity =  unsafe { specificity.as_mut().unwrap() };
         let index = index as usize;
         if index >= rule.selectors.0.len() {
             *specificity = 0;
@@ -2776,7 +2776,7 @@ pub extern "C" fn Servo_NoteExplicitHints(element: RawGeckoElementBorrowed,
 pub extern "C" fn Servo_TakeChangeHint(element: RawGeckoElementBorrowed,
                                        was_restyled: *mut bool) -> nsChangeHint
 {
-    let mut was_restyled =  unsafe { was_restyled.as_mut().unwrap() };
+    let was_restyled =  unsafe { was_restyled.as_mut().unwrap() };
     let element = GeckoElement(element);
 
     let damage = match element.mutate_data() {

From 491dc73e2e9ece2857f3ed77ecea0284e47a6722 Mon Sep 17 00:00:00 2001
From: Simon Sapin <simon.sapin@exyr.org>
Date: Thu, 9 Nov 2017 10:00:38 -0600
Subject: [PATCH 06/16] servo: Merge #19128 - Upgrade to rustc 1.23.0-nightly
 (02004ef78 2017-11-08) (from servo:asciiext); r=nox

This fixes some new warnings, some of which (in `style`) are treated as errors. See https://users.rust-lang.org/t/psa-dealing-with-warning-unused-import-std-ascii-asciiext-in-today-s-nightly/13726

Source-Repo: https://github.com/servo/servo
Source-Revision: c46c9dc019ffe5447297140c22cd8b6ee95a9f5f

(cherry picked from commit mozilla/gecko-dev@a6f7082122e9)
---
 servo/components/gfx/font.rs                          | 1 -
 servo/components/net/fetch/cors_cache.rs              | 1 -
 servo/components/net/websocket_loader.rs              | 1 -
 servo/components/net_traits/response.rs               | 1 -
 servo/components/script/dom/bindings/str.rs           | 1 -
 servo/components/script/dom/cssstyledeclaration.rs    | 1 -
 servo/components/script/dom/document.rs               | 1 -
 servo/components/script/dom/element.rs                | 1 -
 servo/components/script/dom/htmlelement.rs            | 1 -
 servo/components/script/dom/htmllinkelement.rs        | 1 -
 servo/components/script/dom/htmlmetaelement.rs        | 1 -
 servo/components/script/dom/htmlscriptelement.rs      | 1 -
 servo/components/script/dom/macros.rs                 | 1 -
 servo/components/script/dom/namednodemap.rs           | 1 -
 servo/components/script/dom/serviceworkercontainer.rs | 1 -
 servo/components/script/dom/servoparser/async_html.rs | 1 -
 servo/components/script/dom/servoparser/mod.rs        | 1 -
 servo/components/script/dom/websocket.rs              | 1 -
 servo/components/script/dom/window.rs                 | 1 -
 servo/components/script/dom/xmlhttprequest.rs         | 1 -
 servo/components/style/servo/selector_parser.rs       | 1 -
 21 files changed, 21 deletions(-)

diff --git a/servo/components/gfx/font.rs b/servo/components/gfx/font.rs
index 357f61a2d7ab..acf98e6f9e9a 100644
--- a/servo/components/gfx/font.rs
+++ b/servo/components/gfx/font.rs
@@ -10,7 +10,6 @@ use platform::font::{FontHandle, FontTable};
 use platform::font_context::FontContextHandle;
 use platform::font_template::FontTemplateData;
 use smallvec::SmallVec;
-use std::ascii::AsciiExt;
 use std::borrow::ToOwned;
 use std::cell::RefCell;
 use std::collections::HashMap;
diff --git a/servo/components/net/fetch/cors_cache.rs b/servo/components/net/fetch/cors_cache.rs
index 6c30782453d5..8962dd2c9985 100644
--- a/servo/components/net/fetch/cors_cache.rs
+++ b/servo/components/net/fetch/cors_cache.rs
@@ -12,7 +12,6 @@
 use hyper::method::Method;
 use net_traits::request::{CredentialsMode, Origin, Request};
 use servo_url::ServoUrl;
-use std::ascii::AsciiExt;
 use time::{self, Timespec};
 
 /// Union type for CORS cache entries
diff --git a/servo/components/net/websocket_loader.rs b/servo/components/net/websocket_loader.rs
index 71178bbc7d93..f2d36b4fdae9 100644
--- a/servo/components/net/websocket_loader.rs
+++ b/servo/components/net/websocket_loader.rs
@@ -19,7 +19,6 @@ use net_traits::{CookieSource, MessageData, NetworkError, WebSocketCommunicate,
 use net_traits::{WebSocketDomAction, WebSocketNetworkEvent};
 use net_traits::request::{Destination, Type};
 use servo_url::ServoUrl;
-use std::ascii::AsciiExt;
 use std::io::{self, Write};
 use std::net::TcpStream;
 use std::sync::{Arc, Mutex};
diff --git a/servo/components/net_traits/response.rs b/servo/components/net_traits/response.rs
index 74525a85f07b..a7699d8ad911 100644
--- a/servo/components/net_traits/response.rs
+++ b/servo/components/net_traits/response.rs
@@ -9,7 +9,6 @@ use hyper::header::{AccessControlExposeHeaders, ContentType, Headers};
 use hyper::status::StatusCode;
 use hyper_serde::Serde;
 use servo_url::ServoUrl;
-use std::ascii::AsciiExt;
 use std::sync::{Arc, Mutex};
 
 /// [Response type](https://fetch.spec.whatwg.org/#concept-response-type)
diff --git a/servo/components/script/dom/bindings/str.rs b/servo/components/script/dom/bindings/str.rs
index 761acab30682..e2c91a1f5061 100644
--- a/servo/components/script/dom/bindings/str.rs
+++ b/servo/components/script/dom/bindings/str.rs
@@ -7,7 +7,6 @@
 use cssparser::CowRcStr;
 use html5ever::{LocalName, Namespace};
 use servo_atoms::Atom;
-use std::ascii::AsciiExt;
 use std::borrow::{Borrow, Cow, ToOwned};
 use std::fmt;
 use std::hash::{Hash, Hasher};
diff --git a/servo/components/script/dom/cssstyledeclaration.rs b/servo/components/script/dom/cssstyledeclaration.rs
index ddf085b34913..9bab2b638c62 100644
--- a/servo/components/script/dom/cssstyledeclaration.rs
+++ b/servo/components/script/dom/cssstyledeclaration.rs
@@ -16,7 +16,6 @@ use dom::window::Window;
 use dom_struct::dom_struct;
 use servo_arc::Arc;
 use servo_url::ServoUrl;
-use std::ascii::AsciiExt;
 use style::attr::AttrValue;
 use style::properties::{Importance, PropertyDeclarationBlock, PropertyId, LonghandId, ShorthandId};
 use style::properties::{parse_one_declaration_into, parse_style_attribute, SourcePropertyDeclaration};
diff --git a/servo/components/script/dom/document.rs b/servo/components/script/dom/document.rs
index 71bb02eaa364..464b3658d3c0 100644
--- a/servo/components/script/dom/document.rs
+++ b/servo/components/script/dom/document.rs
@@ -122,7 +122,6 @@ use servo_arc::Arc;
 use servo_atoms::Atom;
 use servo_config::prefs::PREFS;
 use servo_url::{ImmutableOrigin, MutableOrigin, ServoUrl};
-use std::ascii::AsciiExt;
 use std::borrow::ToOwned;
 use std::cell::{Cell, Ref, RefMut};
 use std::collections::{HashMap, HashSet, VecDeque};
diff --git a/servo/components/script/dom/element.rs b/servo/components/script/dom/element.rs
index 59db577c4eb3..ea7567020b97 100644
--- a/servo/components/script/dom/element.rs
+++ b/servo/components/script/dom/element.rs
@@ -95,7 +95,6 @@ use selectors::matching::{RelevantLinkStatus, matches_selector_list};
 use selectors::sink::Push;
 use servo_arc::Arc;
 use servo_atoms::Atom;
-use std::ascii::AsciiExt;
 use std::borrow::Cow;
 use std::cell::{Cell, Ref};
 use std::convert::TryFrom;
diff --git a/servo/components/script/dom/htmlelement.rs b/servo/components/script/dom/htmlelement.rs
index 59846595166a..eb1f1022c8b7 100644
--- a/servo/components/script/dom/htmlelement.rs
+++ b/servo/components/script/dom/htmlelement.rs
@@ -31,7 +31,6 @@ use dom::nodelist::NodeList;
 use dom::virtualmethods::VirtualMethods;
 use dom_struct::dom_struct;
 use html5ever::{LocalName, Prefix};
-use std::ascii::AsciiExt;
 use std::borrow::ToOwned;
 use std::default::Default;
 use std::rc::Rc;
diff --git a/servo/components/script/dom/htmllinkelement.rs b/servo/components/script/dom/htmllinkelement.rs
index 8175da5c913c..5da65a49d34d 100644
--- a/servo/components/script/dom/htmllinkelement.rs
+++ b/servo/components/script/dom/htmllinkelement.rs
@@ -27,7 +27,6 @@ use net_traits::ReferrerPolicy;
 use script_layout_interface::message::Msg;
 use script_traits::{MozBrowserEvent, ScriptMsg as ConstellationMsg};
 use servo_arc::Arc;
-use std::ascii::AsciiExt;
 use std::borrow::ToOwned;
 use std::cell::Cell;
 use std::default::Default;
diff --git a/servo/components/script/dom/htmlmetaelement.rs b/servo/components/script/dom/htmlmetaelement.rs
index 9370675eb6bd..dc3ee9aa12de 100644
--- a/servo/components/script/dom/htmlmetaelement.rs
+++ b/servo/components/script/dom/htmlmetaelement.rs
@@ -22,7 +22,6 @@ use html5ever::{LocalName, Prefix};
 use parking_lot::RwLock;
 use servo_arc::Arc;
 use servo_config::prefs::PREFS;
-use std::ascii::AsciiExt;
 use std::sync::atomic::AtomicBool;
 use style::attr::AttrValue;
 use style::media_queries::MediaList;
diff --git a/servo/components/script/dom/htmlscriptelement.rs b/servo/components/script/dom/htmlscriptelement.rs
index ea0cc4c25e8e..f5f758060525 100644
--- a/servo/components/script/dom/htmlscriptelement.rs
+++ b/servo/components/script/dom/htmlscriptelement.rs
@@ -36,7 +36,6 @@ use network_listener::{NetworkListener, PreInvoke};
 use servo_atoms::Atom;
 use servo_config::opts;
 use servo_url::ServoUrl;
-use std::ascii::AsciiExt;
 use std::cell::Cell;
 use std::fs::File;
 use std::io::{Read, Write};
diff --git a/servo/components/script/dom/macros.rs b/servo/components/script/dom/macros.rs
index a1bb30657252..9cd5fb9a8dc5 100644
--- a/servo/components/script/dom/macros.rs
+++ b/servo/components/script/dom/macros.rs
@@ -149,7 +149,6 @@ macro_rules! make_enumerated_getter(
         fn $attr(&self) -> DOMString {
             use dom::bindings::inheritance::Castable;
             use dom::element::Element;
-            use std::ascii::AsciiExt;
             let element = self.upcast::<Element>();
             let mut val = element.get_string_attribute(&local_name!($htmlname));
             val.make_ascii_lowercase();
diff --git a/servo/components/script/dom/namednodemap.rs b/servo/components/script/dom/namednodemap.rs
index 9d92bf11c2d2..4f1b13a999e8 100644
--- a/servo/components/script/dom/namednodemap.rs
+++ b/servo/components/script/dom/namednodemap.rs
@@ -15,7 +15,6 @@ use dom::element::Element;
 use dom::window::Window;
 use dom_struct::dom_struct;
 use html5ever::LocalName;
-use std::ascii::AsciiExt;
 
 #[dom_struct]
 pub struct NamedNodeMap {
diff --git a/servo/components/script/dom/serviceworkercontainer.rs b/servo/components/script/dom/serviceworkercontainer.rs
index ba2e327409f1..3a0ed0fcb253 100644
--- a/servo/components/script/dom/serviceworkercontainer.rs
+++ b/servo/components/script/dom/serviceworkercontainer.rs
@@ -16,7 +16,6 @@ use dom::serviceworker::ServiceWorker;
 use dom_struct::dom_struct;
 use script_thread::ScriptThread;
 use serviceworkerjob::{Job, JobType};
-use std::ascii::AsciiExt;
 use std::default::Default;
 use std::rc::Rc;
 
diff --git a/servo/components/script/dom/servoparser/async_html.rs b/servo/components/script/dom/servoparser/async_html.rs
index 70d2008f49f6..f3369f93226d 100644
--- a/servo/components/script/dom/servoparser/async_html.rs
+++ b/servo/components/script/dom/servoparser/async_html.rs
@@ -27,7 +27,6 @@ use html5ever::tokenizer::{Tokenizer as HtmlTokenizer, TokenizerOpts, TokenizerR
 use html5ever::tree_builder::{ElementFlags, NodeOrText as HtmlNodeOrText, NextParserState, QuirksMode, TreeSink};
 use html5ever::tree_builder::{TreeBuilder, TreeBuilderOpts};
 use servo_url::ServoUrl;
-use std::ascii::AsciiExt;
 use std::borrow::Cow;
 use std::cell::Cell;
 use std::collections::HashMap;
diff --git a/servo/components/script/dom/servoparser/mod.rs b/servo/components/script/dom/servoparser/mod.rs
index 6a5a723111da..bb8b066c2439 100644
--- a/servo/components/script/dom/servoparser/mod.rs
+++ b/servo/components/script/dom/servoparser/mod.rs
@@ -46,7 +46,6 @@ use script_traits::DocumentActivity;
 use servo_config::prefs::PREFS;
 use servo_config::resource_files::read_resource_file;
 use servo_url::ServoUrl;
-use std::ascii::AsciiExt;
 use std::borrow::Cow;
 use std::cell::Cell;
 use std::mem;
diff --git a/servo/components/script/dom/websocket.rs b/servo/components/script/dom/websocket.rs
index b533789e6118..80febbe72fe4 100644
--- a/servo/components/script/dom/websocket.rs
+++ b/servo/components/script/dom/websocket.rs
@@ -34,7 +34,6 @@ use script_runtime::CommonScriptMsg;
 use script_runtime::ScriptThreadEventCategory::WebSocketEvent;
 use script_thread::{Runnable, RunnableWrapper};
 use servo_url::ServoUrl;
-use std::ascii::AsciiExt;
 use std::borrow::ToOwned;
 use std::cell::Cell;
 use std::ptr;
diff --git a/servo/components/script/dom/window.rs b/servo/components/script/dom/window.rs
index 3c87e5f6b0b4..d10d2131dc5a 100644
--- a/servo/components/script/dom/window.rs
+++ b/servo/components/script/dom/window.rs
@@ -88,7 +88,6 @@ use servo_config::opts;
 use servo_config::prefs::PREFS;
 use servo_geometry::{f32_rect_to_au_rect, max_rect};
 use servo_url::{Host, MutableOrigin, ImmutableOrigin, ServoUrl};
-use std::ascii::AsciiExt;
 use std::borrow::ToOwned;
 use std::cell::Cell;
 use std::collections::{HashMap, HashSet};
diff --git a/servo/components/script/dom/xmlhttprequest.rs b/servo/components/script/dom/xmlhttprequest.rs
index e6652d79d706..46e6abeb62e4 100644
--- a/servo/components/script/dom/xmlhttprequest.rs
+++ b/servo/components/script/dom/xmlhttprequest.rs
@@ -63,7 +63,6 @@ use script_traits::DocumentActivity;
 use servo_atoms::Atom;
 use servo_config::prefs::PREFS;
 use servo_url::ServoUrl;
-use std::ascii::AsciiExt;
 use std::borrow::ToOwned;
 use std::cell::Cell;
 use std::default::Default;
diff --git a/servo/components/style/servo/selector_parser.rs b/servo/components/style/servo/selector_parser.rs
index 95ef6b0169f5..d205c4ee1170 100644
--- a/servo/components/style/servo/selector_parser.rs
+++ b/servo/components/style/servo/selector_parser.rs
@@ -21,7 +21,6 @@ use selectors::Element;
 use selectors::attr::{AttrSelectorOperation, NamespaceConstraint, CaseSensitivity};
 use selectors::parser::{SelectorMethods, SelectorParseError};
 use selectors::visitor::SelectorVisitor;
-use std::ascii::AsciiExt;
 use std::fmt;
 use std::fmt::Debug;
 use std::mem;

From 3ed0304e043c29a28a1b8f2988f6d403b5c61eb5 Mon Sep 17 00:00:00 2001
From: Simon Sapin <simon.sapin@exyr.org>
Date: Thu, 9 Nov 2017 06:49:29 -0600
Subject: [PATCH 07/16] servo: Merge #19162 - Allow unused imports for AsciiExt
 in style code (from emilio:ascii-ext); r=emilio

See #19128, this part is cherry-picked so Gecko can build with rust nightly.

Source-Repo: https://github.com/servo/servo
Source-Revision: e7a654dd13f589e127193267bcb576ffd661c11d

(cherry picked from commit mozilla/gecko-dev@cf341df19ad7)
---
 servo/components/selectors/attr.rs                                  | 2 +-
 servo/components/selectors/parser.rs                                | 2 +-
 servo/components/style/attr.rs                                      | 2 +-
 servo/components/style/counter_style/mod.rs                         | 2 +-
 servo/components/style/custom_properties.rs                         | 2 +-
 servo/components/style/gecko/generated/pseudo_element_definition.rs | 4 ++--
 servo/components/style/gecko/pseudo_element_definition.mako.rs      | 4 ++--
 servo/components/style/gecko_string_cache/mod.rs                    | 2 +-
 servo/components/style/media_queries.rs                             | 2 +-
 servo/components/style/properties/longhand/font.mako.rs             | 2 +-
 servo/components/style/properties/longhand/pointing.mako.rs         | 2 +-
 servo/components/style/str.rs                                       | 2 +-
 servo/components/style/stylesheets/viewport_rule.rs                 | 2 +-
 servo/components/style/values/mod.rs                                | 2 +-
 servo/components/style/values/specified/align.rs                    | 2 +-
 servo/components/style/values/specified/calc.rs                     | 2 +-
 servo/components/style/values/specified/grid.rs                     | 2 +-
 servo/components/style/values/specified/length.rs                   | 2 +-
 servo/components/style/values/specified/mod.rs                      | 2 +-
 servo/components/style/values/specified/text.rs                     | 2 +-
 servo/components/style_traits/viewport.rs                           | 2 +-
 21 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/servo/components/selectors/attr.rs b/servo/components/selectors/attr.rs
index b71be2cca73b..577b52eb26ab 100644
--- a/servo/components/selectors/attr.rs
+++ b/servo/components/selectors/attr.rs
@@ -4,7 +4,7 @@
 
 use cssparser::ToCss;
 use parser::SelectorImpl;
-use std::ascii::AsciiExt;
+#[allow(unused_imports)] use std::ascii::AsciiExt;
 use std::fmt;
 
 #[derive(Eq, PartialEq, Clone)]
diff --git a/servo/components/selectors/parser.rs b/servo/components/selectors/parser.rs
index 6b2c1f2b4e86..d25d3d1cf2d7 100644
--- a/servo/components/selectors/parser.rs
+++ b/servo/components/selectors/parser.rs
@@ -13,7 +13,7 @@ use precomputed_hash::PrecomputedHash;
 use servo_arc::ThinArc;
 use sink::Push;
 use smallvec::SmallVec;
-use std::ascii::AsciiExt;
+#[allow(unused_imports)] use std::ascii::AsciiExt;
 use std::borrow::{Borrow, Cow};
 use std::fmt::{self, Display, Debug, Write};
 use std::iter::Rev;
diff --git a/servo/components/style/attr.rs b/servo/components/style/attr.rs
index 9861c4360f98..e34d03f01823 100644
--- a/servo/components/style/attr.rs
+++ b/servo/components/style/attr.rs
@@ -16,7 +16,7 @@ use selectors::attr::AttrSelectorOperation;
 use servo_arc::Arc;
 use servo_url::ServoUrl;
 use shared_lock::Locked;
-use std::ascii::AsciiExt;
+#[allow(unused_imports)] use std::ascii::AsciiExt;
 use std::str::FromStr;
 use str::{HTML_SPACE_CHARACTERS, read_exponent, read_fraction};
 use str::{read_numbers, split_commas, split_html_space_chars};
diff --git a/servo/components/style/counter_style/mod.rs b/servo/components/style/counter_style/mod.rs
index 1eb47fedf516..6b55364bca96 100644
--- a/servo/components/style/counter_style/mod.rs
+++ b/servo/components/style/counter_style/mod.rs
@@ -15,7 +15,7 @@ use error_reporting::ContextualParseError;
 use parser::{ParserContext, log_css_error, Parse};
 use selectors::parser::SelectorParseError;
 use shared_lock::{SharedRwLockReadGuard, ToCssWithGuard};
-use std::ascii::AsciiExt;
+#[allow(unused_imports)] use std::ascii::AsciiExt;
 use std::borrow::Cow;
 use std::fmt;
 use std::ops::Range;
diff --git a/servo/components/style/custom_properties.rs b/servo/components/style/custom_properties.rs
index cb9e39561846..787dfaadf82c 100644
--- a/servo/components/style/custom_properties.rs
+++ b/servo/components/style/custom_properties.rs
@@ -12,7 +12,7 @@ use parser::ParserContext;
 use properties::{CSSWideKeyword, DeclaredValue};
 use selectors::parser::SelectorParseError;
 use servo_arc::Arc;
-use std::ascii::AsciiExt;
+#[allow(unused_imports)] use std::ascii::AsciiExt;
 use std::borrow::Cow;
 use std::collections::{HashMap, hash_map, HashSet};
 use std::fmt;
diff --git a/servo/components/style/gecko/generated/pseudo_element_definition.rs b/servo/components/style/gecko/generated/pseudo_element_definition.rs
index 46da69d1e9b6..1cb2bf9f3e1d 100644
--- a/servo/components/style/gecko/generated/pseudo_element_definition.rs
+++ b/servo/components/style/gecko/generated/pseudo_element_definition.rs
@@ -1182,7 +1182,7 @@ impl PseudoElement {
     /// Returns `None` if the pseudo-element is not recognised.
     #[inline]
     pub fn from_slice(s: &str, in_ua_stylesheet: bool) -> Option<Self> {
-        use std::ascii::AsciiExt;
+        #[allow(unused_imports)] use std::ascii::AsciiExt;
 
         // We don't need to support tree pseudos because functional
         // pseudo-elements needs arguments, and thus should be created
@@ -1552,7 +1552,7 @@ impl PseudoElement {
     /// Returns `None` if the pseudo-element is not recognized.
     #[inline]
     pub fn tree_pseudo_element(name: &str, args: Box<[String]>) -> Option<Self> {
-        use std::ascii::AsciiExt;
+        #[allow(unused_imports)] use std::ascii::AsciiExt;
         debug_assert!(name.starts_with("-moz-tree-"));
         let tree_part = &name[10..];
             if tree_part.eq_ignore_ascii_case("column") {
diff --git a/servo/components/style/gecko/pseudo_element_definition.mako.rs b/servo/components/style/gecko/pseudo_element_definition.mako.rs
index e4a5025314b6..d676cb9f0491 100644
--- a/servo/components/style/gecko/pseudo_element_definition.mako.rs
+++ b/servo/components/style/gecko/pseudo_element_definition.mako.rs
@@ -171,7 +171,7 @@ impl PseudoElement {
     /// Returns `None` if the pseudo-element is not recognised.
     #[inline]
     pub fn from_slice(s: &str, in_ua_stylesheet: bool) -> Option<Self> {
-        use std::ascii::AsciiExt;
+        #[allow(unused_imports)] use std::ascii::AsciiExt;
 
         // We don't need to support tree pseudos because functional
         // pseudo-elements needs arguments, and thus should be created
@@ -193,7 +193,7 @@ impl PseudoElement {
     /// Returns `None` if the pseudo-element is not recognized.
     #[inline]
     pub fn tree_pseudo_element(name: &str, args: Box<[String]>) -> Option<Self> {
-        use std::ascii::AsciiExt;
+        #[allow(unused_imports)] use std::ascii::AsciiExt;
         debug_assert!(name.starts_with("-moz-tree-"));
         let tree_part = &name[10..];
         % for pseudo in TREE_PSEUDOS:
diff --git a/servo/components/style/gecko_string_cache/mod.rs b/servo/components/style/gecko_string_cache/mod.rs
index fed06fbeec5d..726bbc8631ca 100644
--- a/servo/components/style/gecko_string_cache/mod.rs
+++ b/servo/components/style/gecko_string_cache/mod.rs
@@ -13,7 +13,7 @@ use gecko_bindings::bindings::Gecko_ReleaseAtom;
 use gecko_bindings::structs::nsIAtom;
 use nsstring::{nsAString, nsString};
 use precomputed_hash::PrecomputedHash;
-use std::ascii::AsciiExt;
+#[allow(unused_imports)] use std::ascii::AsciiExt;
 use std::borrow::{Cow, Borrow};
 use std::char::{self, DecodeUtf16};
 use std::fmt::{self, Write};
diff --git a/servo/components/style/media_queries.rs b/servo/components/style/media_queries.rs
index 5f71ddf974fb..6667f16f3585 100644
--- a/servo/components/style/media_queries.rs
+++ b/servo/components/style/media_queries.rs
@@ -12,7 +12,7 @@ use cssparser::{Delimiter, Parser, Token, ParserInput};
 use parser::ParserContext;
 use selectors::parser::SelectorParseError;
 use serialize_comma_separated_list;
-use std::ascii::AsciiExt;
+#[allow(unused_imports)] use std::ascii::AsciiExt;
 use std::fmt;
 use style_traits::{ToCss, ParseError, StyleParseError};
 
diff --git a/servo/components/style/properties/longhand/font.mako.rs b/servo/components/style/properties/longhand/font.mako.rs
index f6b78a917498..093c6c1009e7 100644
--- a/servo/components/style/properties/longhand/font.mako.rs
+++ b/servo/components/style/properties/longhand/font.mako.rs
@@ -2096,7 +2096,7 @@ https://drafts.csswg.org/css-fonts-4/#low-level-font-variation-settings-control-
 
         #[inline]
         fn to_computed_value(&self, _context: &Context) -> computed_value::T {
-            use std::ascii::AsciiExt;
+            #[allow(unused_imports)] use std::ascii::AsciiExt;
             match *self {
                 SpecifiedValue::Normal => computed_value::T(0),
                 SpecifiedValue::Override(ref lang) => {
diff --git a/servo/components/style/properties/longhand/pointing.mako.rs b/servo/components/style/properties/longhand/pointing.mako.rs
index 9e7923889b17..132e62501647 100644
--- a/servo/components/style/properties/longhand/pointing.mako.rs
+++ b/servo/components/style/properties/longhand/pointing.mako.rs
@@ -93,7 +93,7 @@
     impl Parse for computed_value::Keyword {
         fn parse<'i, 't>(_context: &ParserContext, input: &mut Parser<'i, 't>)
                          -> Result<computed_value::Keyword, ParseError<'i>> {
-            use std::ascii::AsciiExt;
+            #[allow(unused_imports)] use std::ascii::AsciiExt;
             use style_traits::cursor::Cursor;
             let ident = input.expect_ident()?;
             if ident.eq_ignore_ascii_case("auto") {
diff --git a/servo/components/style/str.rs b/servo/components/style/str.rs
index 92febb408249..e4ba90d6435e 100644
--- a/servo/components/style/str.rs
+++ b/servo/components/style/str.rs
@@ -7,7 +7,7 @@
 #![deny(missing_docs)]
 
 use num_traits::ToPrimitive;
-use std::ascii::AsciiExt;
+#[allow(unused_imports)] use std::ascii::AsciiExt;
 use std::convert::AsRef;
 use std::iter::{Filter, Peekable};
 use std::str::Split;
diff --git a/servo/components/style/stylesheets/viewport_rule.rs b/servo/components/style/stylesheets/viewport_rule.rs
index 7d3339a92148..ad57415cbc90 100644
--- a/servo/components/style/stylesheets/viewport_rule.rs
+++ b/servo/components/style/stylesheets/viewport_rule.rs
@@ -19,7 +19,7 @@ use parser::{Parse, ParserContext, log_css_error};
 use properties::StyleBuilder;
 use selectors::parser::SelectorParseError;
 use shared_lock::{SharedRwLockReadGuard, ToCssWithGuard};
-use std::ascii::AsciiExt;
+#[allow(unused_imports)] use std::ascii::AsciiExt;
 use std::borrow::Cow;
 use std::fmt;
 use std::iter::Enumerate;
diff --git a/servo/components/style/values/mod.rs b/servo/components/style/values/mod.rs
index 616aa5cb4852..0ea4759ff23e 100644
--- a/servo/components/style/values/mod.rs
+++ b/servo/components/style/values/mod.rs
@@ -12,7 +12,7 @@ use Atom;
 pub use cssparser::{RGBA, Token, Parser, serialize_identifier, BasicParseError, CowRcStr};
 use parser::{Parse, ParserContext};
 use selectors::parser::SelectorParseError;
-use std::ascii::AsciiExt;
+#[allow(unused_imports)] use std::ascii::AsciiExt;
 use std::fmt::{self, Debug};
 use std::hash;
 use style_traits::{ToCss, ParseError, StyleParseError};
diff --git a/servo/components/style/values/specified/align.rs b/servo/components/style/values/specified/align.rs
index dc7fd43ed941..10da78904e2b 100644
--- a/servo/components/style/values/specified/align.rs
+++ b/servo/components/style/values/specified/align.rs
@@ -10,7 +10,7 @@ use cssparser::Parser;
 use gecko_bindings::structs;
 use parser::{Parse, ParserContext};
 use selectors::parser::SelectorParseError;
-use std::ascii::AsciiExt;
+#[allow(unused_imports)] use std::ascii::AsciiExt;
 use std::fmt;
 use style_traits::{ToCss, ParseError, StyleParseError};
 
diff --git a/servo/components/style/values/specified/calc.rs b/servo/components/style/values/specified/calc.rs
index 66b94b20ad01..58d12fe0147e 100644
--- a/servo/components/style/values/specified/calc.rs
+++ b/servo/components/style/values/specified/calc.rs
@@ -9,7 +9,7 @@
 use app_units::Au;
 use cssparser::{Parser, Token, BasicParseError};
 use parser::ParserContext;
-use std::ascii::AsciiExt;
+#[allow(unused_imports)] use std::ascii::AsciiExt;
 use std::fmt;
 use style_traits::{HasViewportPercentage, ToCss, ParseError, StyleParseError};
 use style_traits::values::specified::AllowedLengthType;
diff --git a/servo/components/style/values/specified/grid.rs b/servo/components/style/values/specified/grid.rs
index beb1459e76dc..927b8c912935 100644
--- a/servo/components/style/values/specified/grid.rs
+++ b/servo/components/style/values/specified/grid.rs
@@ -7,7 +7,7 @@
 
 use cssparser::{Parser, Token, BasicParseError};
 use parser::{Parse, ParserContext};
-use std::ascii::AsciiExt;
+#[allow(unused_imports)] use std::ascii::AsciiExt;
 use std::mem;
 use style_traits::{HasViewportPercentage, ParseError, StyleParseError};
 use values::{CSSFloat, CustomIdent};
diff --git a/servo/components/style/values/specified/length.rs b/servo/components/style/values/specified/length.rs
index bf4b83b52932..2514b2aaca89 100644
--- a/servo/components/style/values/specified/length.rs
+++ b/servo/components/style/values/specified/length.rs
@@ -12,7 +12,7 @@ use euclid::Size2D;
 use font_metrics::FontMetricsQueryResult;
 use parser::{Parse, ParserContext};
 use std::{cmp, fmt, mem};
-use std::ascii::AsciiExt;
+#[allow(unused_imports)] use std::ascii::AsciiExt;
 use std::ops::Mul;
 use style_traits::{HasViewportPercentage, ToCss, ParseError, StyleParseError};
 use style_traits::values::specified::{AllowedLengthType, AllowedNumericType};
diff --git a/servo/components/style/values/specified/mod.rs b/servo/components/style/values/specified/mod.rs
index 7c51c3868f8a..8fbdc827829a 100644
--- a/servo/components/style/values/specified/mod.rs
+++ b/servo/components/style/values/specified/mod.rs
@@ -11,7 +11,7 @@ use context::QuirksMode;
 use cssparser::{Parser, Token, serialize_identifier, BasicParseError};
 use parser::{ParserContext, Parse};
 use self::url::SpecifiedUrl;
-use std::ascii::AsciiExt;
+#[allow(unused_imports)] use std::ascii::AsciiExt;
 use std::f32;
 use std::fmt;
 use style_traits::{ToCss, ParseError, StyleParseError};
diff --git a/servo/components/style/values/specified/text.rs b/servo/components/style/values/specified/text.rs
index 2c0395128c64..c3248a7bc45d 100644
--- a/servo/components/style/values/specified/text.rs
+++ b/servo/components/style/values/specified/text.rs
@@ -7,7 +7,7 @@
 use cssparser::Parser;
 use parser::{Parse, ParserContext};
 use selectors::parser::SelectorParseError;
-use std::ascii::AsciiExt;
+#[allow(unused_imports)] use std::ascii::AsciiExt;
 use style_traits::ParseError;
 use values::computed::{Context, ToComputedValue};
 use values::computed::text::LineHeight as ComputedLineHeight;
diff --git a/servo/components/style_traits/viewport.rs b/servo/components/style_traits/viewport.rs
index 01d9b541ac34..e25ff9ba9e71 100644
--- a/servo/components/style_traits/viewport.rs
+++ b/servo/components/style_traits/viewport.rs
@@ -7,7 +7,7 @@
 use {CSSPixel, PinchZoomFactor, ParseError};
 use cssparser::{Parser, ToCss, ParseError as CssParseError, BasicParseError};
 use euclid::TypedSize2D;
-use std::ascii::AsciiExt;
+#[allow(unused_imports)] use std::ascii::AsciiExt;
 use std::fmt;
 
 define_css_keyword_enum!(UserZoom:

From abb937e8e0284e65ef102807905d6e1136c98cd8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= <emilio@crisal.io>
Date: Wed, 3 Jan 2018 12:01:42 -0600
Subject: [PATCH 08/16] servo: Merge #19654 - style: Allow building stylo with
 rust nightly (from emilio:geckolib-nightly); r=jdm

See individual commits for details.

Source-Repo: https://github.com/servo/servo
Source-Revision: f71fb8bddc28060320c233701898541112322d66

(cherry picked from commit mozilla/gecko-dev@61f3d7e4e83b)
---
 servo/components/style/gecko/wrapper.rs                  | 2 +-
 servo/components/style/gecko_bindings/sugar/ownership.rs | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/servo/components/style/gecko/wrapper.rs b/servo/components/style/gecko/wrapper.rs
index 5ad9668540d4..cbff3e8a962b 100644
--- a/servo/components/style/gecko/wrapper.rs
+++ b/servo/components/style/gecko/wrapper.rs
@@ -1403,7 +1403,7 @@ impl<'le> Eq for GeckoElement<'le> {}
 
 impl<'le> Hash for GeckoElement<'le> {
     fn hash<H: Hasher>(&self, state: &mut H) {
-        (self.0 as *const _).hash(state);
+        (self.0 as *const RawGeckoElement).hash(state);
     }
 }
 
diff --git a/servo/components/style/gecko_bindings/sugar/ownership.rs b/servo/components/style/gecko_bindings/sugar/ownership.rs
index b0ac00368eae..8695efaaa40f 100644
--- a/servo/components/style/gecko_bindings/sugar/ownership.rs
+++ b/servo/components/style/gecko_bindings/sugar/ownership.rs
@@ -109,7 +109,6 @@ pub unsafe trait HasArcFFI : HasFFI {
     ///
     /// &GeckoType -> &Arc<ServoType>
     fn as_arc<'a>(ptr: &'a &Self::FFIType) -> &'a RawOffsetArc<Self> {
-        debug_assert!(!(ptr as *const _).is_null());
         unsafe {
             transmute::<&&Self::FFIType, &RawOffsetArc<Self>>(ptr)
         }

From 835930f339eef0b2f02403ea0473e9fd7586e250 Mon Sep 17 00:00:00 2001
From: Simon Sapin <simon.sapin@exyr.org>
Date: Wed, 31 Jan 2018 11:01:26 -0600
Subject: [PATCH 09/16] Bug 1434619 - servo: Remove #![deny(warnings)]. r=nox,
 a=lizzard
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

We already have https://github.com/servo/servo/pull/19612 to deny warnings at the time of landing into master. But it’s not useful to break the build when later compiler with a more recent Rust version that has introduced new warnings:

Source-Repo: https://github.com/servo/servo
Source-Revision: 7546c37f1e921a112fef5828c59c6738a98c3f30

(cherry picked from commit mozilla/gecko-dev@95a1778f4ef0)
---
 servo/components/style/gecko_bindings/nsstring_vendor/src/lib.rs | 1 -
 servo/components/style/lib.rs                                    | 1 -
 servo/ports/geckolib/lib.rs                                      | 1 -
 3 files changed, 3 deletions(-)

diff --git a/servo/components/style/gecko_bindings/nsstring_vendor/src/lib.rs b/servo/components/style/gecko_bindings/nsstring_vendor/src/lib.rs
index 385fe5f24dac..45ae44a25830 100644
--- a/servo/components/style/gecko_bindings/nsstring_vendor/src/lib.rs
+++ b/servo/components/style/gecko_bindings/nsstring_vendor/src/lib.rs
@@ -117,7 +117,6 @@
 //! which invoke their member's destructors through C++ code.
 
 #![allow(non_camel_case_types)]
-#![deny(warnings)]
 
 use std::ops::{Deref, DerefMut};
 use std::marker::PhantomData;
diff --git a/servo/components/style/lib.rs b/servo/components/style/lib.rs
index b82d2fd3cc0a..69ec8c6b589d 100644
--- a/servo/components/style/lib.rs
+++ b/servo/components/style/lib.rs
@@ -23,7 +23,6 @@
 //! [cssparser]: ../cssparser/index.html
 //! [selectors]: ../selectors/index.html
 
-#![deny(warnings)]
 #![deny(missing_docs)]
 
 // FIXME(bholley): We need to blanket-allow unsafe code in order to make the
diff --git a/servo/ports/geckolib/lib.rs b/servo/ports/geckolib/lib.rs
index 37f33245656e..b50147cc2bbd 100644
--- a/servo/ports/geckolib/lib.rs
+++ b/servo/ports/geckolib/lib.rs
@@ -2,7 +2,6 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#![deny(warnings)]
 
 extern crate atomic_refcell;
 extern crate cssparser;

From b0f07e9a204324f18444fae3bcc534a847df4e3c Mon Sep 17 00:00:00 2001
From: Jan Beich <jbeich@FreeBSD.org>
Date: Fri, 20 Oct 2017 03:38:00 -0400
Subject: [PATCH 10/16] Bug 1409680 - Extend --disable-debug-symbols to Rust
 code. r=glandium, a=ritu

This reduces disk I/O and memory usage during build that already lacks
debugging symbols from C++ code, allowing to use more jobs on 32bit hosts.

--disable-debug-symbols build on FreeBSD 10.3 i386 (8 cores) host:
Max RSS before:  libxul - 612 Mb, libgkrust - 1908 Mb
Max RSS after:   libxul - 444 Mb, libgkrust - 1471 Mb
Binary before:   libxul - 203 Mb, libgkrust -  732 Mb
Binary after:    libxul - 123 Mb, libgkrust -  301 Mb

(cherry picked from commit mozilla/gecko-dev@b0d22972325b)
---
 config/rules.mk | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/config/rules.mk b/config/rules.mk
index f64e67c78c7f..00b64bdb8cf4 100644
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -906,12 +906,14 @@ ifdef MOZ_USING_SCCACHE
 sccache_wrap := RUSTC_WRAPPER='$(CCACHE)'
 endif
 
+ifdef MOZ_DEBUG_SYMBOLS
 # XXX hack to work around dsymutil failing on cross-OSX builds (bug 1380381)
 ifeq ($(HOST_OS_ARCH)-$(OS_ARCH),Linux-Darwin)
 default_rustflags += -C debuginfo=1
 else
 default_rustflags += -C debuginfo=2
 endif
+endif
 
 # We use the + prefix to pass down the jobserver fds to cargo, but we
 # don't use the prefix when make -n is used, so that cargo doesn't run

From e4c7440f95be25c8c6a9b1a4e6ec005dda9137cd Mon Sep 17 00:00:00 2001
From: Nathan Froyd <froydnj@mozilla.com>
Date: Fri, 10 Nov 2017 10:05:36 -0500
Subject: [PATCH 11/16] Bug 1341234 - part 0 - fix typo in AC_SUBST_SET
 checking; r=gps

The various AC_SUBST macros generate AC_SUBST_*FOO macros for holding the
values to substitute.  The macros also cross-check the AC_SUBST_* macros
generated by other variants to make sure that you don't try to do
something like AC_SUBST(FOO) and AC_SUBST_SET(FOO).  However, the check
in AC_SUBST_SET for AC_SUBST_LIST duplicate is missing an underscore:
the AC_SUBST_LIST macro generates another macro starting with
AC_SUBST_LIST_, but the AC_SUBST_SET macro checks for the prefix
AC_SUBST_LIST, which is missing the trailing underscore.

As we're going to be adding yet another AC_SUBST_* macro variant, and
therefore adding more checks to all existing macros, let's clean this up
before we start.

(cherry picked from commit mozilla/gecko-dev@1009160a12a7)
---
 build/autoconf/config.status.m4 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/build/autoconf/config.status.m4 b/build/autoconf/config.status.m4
index 53e274a12196..eb1fd3a13a42 100644
--- a/build/autoconf/config.status.m4
+++ b/build/autoconf/config.status.m4
@@ -24,7 +24,7 @@ dnl with values got from the value of the environment variable, split on
 dnl whitespaces.
 define([AC_SUBST_SET],
 [ifdef([AC_SUBST_$1], [m4_fatal([Cannot use AC_SUBST and AC_SUBST_SET on the same variable ($1)])],
-[ifdef([AC_SUBST_LIST$1], [m4_fatal([Cannot use AC_SUBST_LIST and AC_SUBST_SET on the same variable ($1)])],
+[ifdef([AC_SUBST_LIST_$1], [m4_fatal([Cannot use AC_SUBST_LIST and AC_SUBST_SET on the same variable ($1)])],
 [ifdef([AC_SUBST_SET_$1], ,
 [define([AC_SUBST_SET_$1], )dnl
 AC_DIVERT_PUSH(MOZ_DIVERSION_SUBST)dnl

From d4d7da8f69ddc749349ff4c0c5a141cf62ccc027 Mon Sep 17 00:00:00 2001
From: Nathan Froyd <froydnj@mozilla.com>
Date: Fri, 10 Nov 2017 10:05:36 -0500
Subject: [PATCH 12/16] Bug 1341234 - part 1 - add AC_SUBST_TOML_LIST macro;
 r=gps

Stylo's bindgen is configured partially through a .toml.in file that
substitutes the value of a configure variable (BINDGEN_CFLAGS) into a
TOML list.  We can debate whether this is a good thing to do some other
time; the reality is that the current moz.configure code that provides
the set_config for BINDGEN_CFLAGS needs to perform all the quoting
itself.

We want, however, to define the substituted variable in old-configure.in
land (some of the values that will go into BINDGEN_CFLAGS are only
defined in old-configure.in, and are not trivially ported to
moz.configure), which means that we need to have quoting logic in
m4/Python when we generate config.status.  This patch adds an
appropriate macro for doing so.

(cherry picked from commit mozilla/gecko-dev@380dc56df216)
---
 build/autoconf/config.status.m4 | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/build/autoconf/config.status.m4 b/build/autoconf/config.status.m4
index eb1fd3a13a42..0c0fbc76178c 100644
--- a/build/autoconf/config.status.m4
+++ b/build/autoconf/config.status.m4
@@ -12,12 +12,13 @@ dnl    AC_SOMETHING(foo,AC_SUBST(),bar)
 define([AC_SUBST],
 [ifdef([AC_SUBST_SET_$1], [m4_fatal([Cannot use AC_SUBST and AC_SUBST_SET on the same variable ($1)])],
 [ifdef([AC_SUBST_LIST_$1], [m4_fatal([Cannot use AC_SUBST and AC_SUBST_LIST on the same variable ($1)])],
+[ifdef([AC_SUBST_TOML_LIST_$1], [m4_fatal([Cannot use AC_SUBST and AC_SUBST_TOML_LIST on the same variable ($1)])],
 [ifdef([AC_SUBST_$1], ,
 [define([AC_SUBST_$1], )dnl
 AC_DIVERT_PUSH(MOZ_DIVERSION_SUBST)dnl
     (''' $1 ''', r''' [$]$1 ''')
 AC_DIVERT_POP()dnl
-])])])])
+])])])])])
 
 dnl Like AC_SUBST, but makes the value available as a set in python,
 dnl with values got from the value of the environment variable, split on
@@ -25,12 +26,13 @@ dnl whitespaces.
 define([AC_SUBST_SET],
 [ifdef([AC_SUBST_$1], [m4_fatal([Cannot use AC_SUBST and AC_SUBST_SET on the same variable ($1)])],
 [ifdef([AC_SUBST_LIST_$1], [m4_fatal([Cannot use AC_SUBST_LIST and AC_SUBST_SET on the same variable ($1)])],
+[ifdef([AC_SUBST_TOML_LIST_$1], [m4_fatal([Cannot use AC_SUBST_TOML_LIST and AC_SUBST_SET on the same variable ($1)])],
 [ifdef([AC_SUBST_SET_$1], ,
 [define([AC_SUBST_SET_$1], )dnl
 AC_DIVERT_PUSH(MOZ_DIVERSION_SUBST)dnl
     (''' $1 ''', unique_list(r''' [$]$1 '''.split()))
 AC_DIVERT_POP()dnl
-])])])])
+])])])])])
 
 dnl Like AC_SUBST, but makes the value available as a list in python,
 dnl with values got from the value of the environment variable, split on
@@ -38,12 +40,29 @@ dnl whitespaces.
 define([AC_SUBST_LIST],
 [ifdef([AC_SUBST_$1], [m4_fatal([Cannot use AC_SUBST and AC_SUBST_LIST on the same variable ($1)])],
 [ifdef([AC_SUBST_SET_$1], [m4_fatal([Cannot use AC_SUBST_SET and AC_SUBST_LIST on the same variable ($1)])],
+[ifdef([AC_SUBST_TOML_LIST_$1], [m4_fatal([Cannot use AC_SUBST_TOML_LIST and AC_SUBST_LIST on the same variable ($1)])],
 [ifdef([AC_SUBST_LIST_$1], ,
 [define([AC_SUBST_LIST_$1], )dnl
 AC_DIVERT_PUSH(MOZ_DIVERSION_SUBST)dnl
     (''' $1 ''', list(r''' [$]$1 '''.split()))
 AC_DIVERT_POP()dnl
-])])])])
+])])])])])
+
+dnl Like AC_SUBST, but makes the value available as a string of comma-separated
+dnl quoted strings in python, with values got from the value of the environment
+dnl variable, split on whitespaces. The value is suitable for embedding into a
+dnl .toml list.
+define([AC_SUBST_TOML_LIST],
+[ifdef([AC_SUBST_$1], [m4_fatal([Cannot use AC_SUBST and AC_SUBST_TOML_LIST on the same variable ($1)])],
+[ifdef([AC_SUBST_SET_$1], [m4_fatal([Cannot use AC_SUBST_SET and AC_SUBST_TOML_LIST on the same variable ($1)])],
+[ifdef([AC_SUBST_LIST_$1], [m4_fatal([Cannot use AC_SUBST_LIST and AC_SUBST_TOML_LIST on the same variable ($1)])],
+[ifdef([AC_SUBST_TOML_LIST_$1], ,
+[define([AC_SUBST_TOML_LIST_$1], )dnl
+AC_DIVERT_PUSH(MOZ_DIVERSION_SUBST)dnl
+    (''' $1 ''', r''' %s ''' % str(', '.join("'%s'" % s for s in r''' [$]$1 '''.split())))
+AC_DIVERT_POP()dnl
+])])])])])
+
 
 dnl Ignore AC_SUBSTs for variables we don't have use for but that autoconf
 dnl itself exports.

From 3d6c7660f7632606b3dd64c5676aea20674b1da3 Mon Sep 17 00:00:00 2001
From: Nathan Froyd <froydnj@mozilla.com>
Date: Fri, 10 Nov 2017 10:05:36 -0500
Subject: [PATCH 13/16] Bug 1341234 - part 2 - add an intermediate step for
 determining bindgen's CFLAGS; r=gps

Add an intermediate step in old-configure.in for setting up
BINDGEN_CFLAGS (renamed to BINDGEN_SYSTEM_FLAGS), so we can add whatever
flags we like (e.g. for system libaries with their includes in
non-standard places) at a later point.

(cherry picked from commit mozilla/gecko-dev@17b61015519a)
---
 build/moz.configure/toolchain.configure | 9 +++------
 layout/style/bindgen.toml.in            | 2 +-
 old-configure.in                        | 3 +++
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure
index f63c81d8fc75..fadd11225508 100755
--- a/build/moz.configure/toolchain.configure
+++ b/build/moz.configure/toolchain.configure
@@ -914,15 +914,12 @@ option(env='BINDGEN_CFLAGS',
        help='Options bindgen should pass to the C/C++ parser')
 
 @depends('BINDGEN_CFLAGS')
-@checking('bindgen cflags', lambda s: s if s and s.strip() else 'no')
+@checking('bindgen cflags', lambda s: s if s else 'no')
 def bindgen_cflags(value):
     if value and len(value):
-        # Reformat the env value for substitution into a toml list.
-        flags = value[0].split()
-        return ', '.join('"' + flag + '"' for flag in flags)
-    return ''
+        return value[0].split()
 
-set_config('BINDGEN_CFLAGS', bindgen_cflags)
+add_old_configure_assignment('_BINDGEN_CFLAGS', bindgen_cflags)
 
 @depends(c_compiler)
 def default_debug_flags(compiler_info):
diff --git a/layout/style/bindgen.toml.in b/layout/style/bindgen.toml.in
index 7b1c72c86ec7..894008d0cfb6 100644
--- a/layout/style/bindgen.toml.in
+++ b/layout/style/bindgen.toml.in
@@ -1,4 +1,4 @@
 [build]
 args = [
-    @BINDGEN_CFLAGS@
+    @BINDGEN_SYSTEM_FLAGS@
 ]
diff --git a/old-configure.in b/old-configure.in
index ab57a0fbb11e..8a3ed4fdba40 100644
--- a/old-configure.in
+++ b/old-configure.in
@@ -4519,6 +4519,9 @@ AC_SUBST_LIST(MOZ_CAIRO_LIBS)
 AC_SUBST_LIST(MOZ_CAIRO_OSLIBS)
 AC_SUBST(MOZ_TREE_PIXMAN)
 
+BINDGEN_SYSTEM_FLAGS="$_BINDGEN_CFLAGS"
+AC_SUBST_TOML_LIST(BINDGEN_SYSTEM_FLAGS)
+
 dnl ========================================================
 dnl disable xul
 dnl ========================================================

From 7ca173a9ddefe42e2d4aaff65d457d7c3f931e58 Mon Sep 17 00:00:00 2001
From: Nathan Froyd <froydnj@mozilla.com>
Date: Fri, 10 Nov 2017 10:05:36 -0500
Subject: [PATCH 14/16] Bug 1341234 - part 3 - add various system library
 CFLAGS to BINDGEN_SYSTEM_FLAGS; r=gps

This change ensures that folks who configure --with-system-FOO for
various values of FOO can build Stylo, since bindgen will know where to
find the flags for said FOO packages.

(cherry picked from commit mozilla/gecko-dev@4d60ad6f6676)
---
 old-configure.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/old-configure.in b/old-configure.in
index 8a3ed4fdba40..3130f8c076b7 100644
--- a/old-configure.in
+++ b/old-configure.in
@@ -4519,7 +4519,7 @@ AC_SUBST_LIST(MOZ_CAIRO_LIBS)
 AC_SUBST_LIST(MOZ_CAIRO_OSLIBS)
 AC_SUBST(MOZ_TREE_PIXMAN)
 
-BINDGEN_SYSTEM_FLAGS="$_BINDGEN_CFLAGS"
+BINDGEN_SYSTEM_FLAGS="$_BINDGEN_CFLAGS $NSPR_CFLAGS $NSS_CFLAGS $MOZ_PIXMAN_CFLAGS $MOZ_CAIRO_CFLAGS"
 AC_SUBST_TOML_LIST(BINDGEN_SYSTEM_FLAGS)
 
 dnl ========================================================

From 5af00ea6a02f7f23152fcd2e1d443ab73266790c Mon Sep 17 00:00:00 2001
From: Matt Brubeck <mbrubeck@mozilla.com>
Date: Thu, 10 Aug 2017 11:38:10 -0700
Subject: [PATCH 15/16] Bug 1386371 - Disable LTO by default, but enable in
 automation. r=froydnj

(cherry picked from commit mozilla/gecko-dev@503070ad8daa)
---
 build/moz.configure/toolchain.configure      |  1 +
 config/rules.mk                              | 14 ++++++++++++--
 python/mozbuild/mozbuild/frontend/emitter.py |  1 -
 toolkit/library/gtest/rust/Cargo.toml        |  1 -
 toolkit/library/rust/Cargo.toml              |  1 -
 5 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure
index fadd11225508..dd97bdbe4088 100755
--- a/build/moz.configure/toolchain.configure
+++ b/build/moz.configure/toolchain.configure
@@ -1097,6 +1097,7 @@ def developer_options(value):
         return True
 
 add_old_configure_assignment('DEVELOPER_OPTIONS', developer_options)
+set_config('DEVELOPER_OPTIONS', developer_options)
 
 # Linker detection
 # ==============================================================
diff --git a/config/rules.mk b/config/rules.mk
index 00b64bdb8cf4..add8cc74b3a9 100644
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -862,6 +862,16 @@ cargo_build_flags += --color=always
 endif
 endif
 
+# These flags are passed via `cargo rustc` and only apply to the final rustc
+# invocation (i.e., only the top-level crate, not its dependencies).
+cargo_rustc_flags = $(CARGO_RUSTCFLAGS)
+ifndef DEVELOPER_OPTIONS
+ifndef MOZ_DEBUG_RUST
+# Enable link-time optimization for release builds.
+cargo_rustc_flags += -C lto
+endif
+endif
+
 # Cargo currently supports only two interesting profiles for building:
 # development and release.  Those map (roughly) to --enable-debug and
 # --disable-debug in Gecko, respectively, but there's another axis that we'd
@@ -941,7 +951,7 @@ endef
 #
 #   $(call CARGO_BUILD)
 define CARGO_BUILD
-$(call RUN_CARGO,build,$(1))
+$(call RUN_CARGO,rustc,$(1))
 endef
 
 define CARGO_CHECK
@@ -986,7 +996,7 @@ endif
 # build.
 force-cargo-library-build:
 	$(REPORT_BUILD)
-	$(call CARGO_BUILD,$(target_cargo_env_vars)) --lib $(cargo_target_flag) $(rust_features_flag)
+	$(call CARGO_BUILD,$(target_cargo_env_vars)) --lib $(cargo_target_flag) $(rust_features_flag) -- $(cargo_rustc_flags)
 
 $(RUST_LIBRARY_FILE): force-cargo-library-build
 
diff --git a/python/mozbuild/mozbuild/frontend/emitter.py b/python/mozbuild/mozbuild/frontend/emitter.py
index 815126d145b3..07a33caca893 100644
--- a/python/mozbuild/mozbuild/frontend/emitter.py
+++ b/python/mozbuild/mozbuild/frontend/emitter.py
@@ -480,7 +480,6 @@ def _rust_library(self, context, libname, static_args, cls=RustLibrary):
                     expected_profile = {
                         'opt-level': 2,
                         'rpath': False,
-                        'lto': True,
                         'debug-assertions': False,
                         'panic': 'abort',
                     }
diff --git a/toolkit/library/gtest/rust/Cargo.toml b/toolkit/library/gtest/rust/Cargo.toml
index a7a64486c684..c9f942c88033 100644
--- a/toolkit/library/gtest/rust/Cargo.toml
+++ b/toolkit/library/gtest/rust/Cargo.toml
@@ -42,6 +42,5 @@ panic = "abort"
 [profile.release]
 opt-level = 2
 rpath = false
-lto = true
 debug-assertions = false
 panic = "abort"
diff --git a/toolkit/library/rust/Cargo.toml b/toolkit/library/rust/Cargo.toml
index f67669513d38..fd5668729199 100644
--- a/toolkit/library/rust/Cargo.toml
+++ b/toolkit/library/rust/Cargo.toml
@@ -40,6 +40,5 @@ panic = "abort"
 [profile.release]
 opt-level = 2
 rpath = false
-lto = true
 debug-assertions = false
 panic = "abort"