Bug 1363683 - Revendor third-party rust dependencies. r?jrmuizel draft
authorKartikaya Gupta <kgupta@mozilla.com>
Mon, 15 May 2017 14:17:01 -0400
changeset 577964 64a1ef6d2c2aac82b3c03bc558908840453f19ea
parent 577963 a5a2eaed91ea6c4eff278e488581d6014502ed9d
child 577965 7fca3517c6c8a729b65abd401a885d8f8a46a7df
push id58844
push userkgupta@mozilla.com
push dateMon, 15 May 2017 18:23:13 +0000
reviewersjrmuizel
bugs1363683
milestone55.0a1
Bug 1363683 - Revendor third-party rust dependencies. r?jrmuizel MozReview-Commit-ID: 8tJvD6cicNl
third_party/rust/binary-space-partition/.cargo-checksum.json
third_party/rust/binary-space-partition/Cargo.toml
third_party/rust/binary-space-partition/src/lib.rs
third_party/rust/gamma-lut/.cargo-checksum.json
third_party/rust/gamma-lut/.travis.yml
third_party/rust/gamma-lut/Cargo.toml
third_party/rust/gamma-lut/LICENSE
third_party/rust/gamma-lut/README.md
third_party/rust/gamma-lut/examples/basic.rs
third_party/rust/gamma-lut/src/lib.rs
third_party/rust/gamma-lut/src/main.rs
third_party/rust/gleam/.cargo-checksum.json
third_party/rust/gleam/Cargo.toml
third_party/rust/gleam/src/gl.rs
third_party/rust/gleam/src/gl_fns.rs
third_party/rust/gleam/src/gles_fns.rs
third_party/rust/plane-split/.cargo-checksum.json
third_party/rust/plane-split/Cargo.toml
third_party/rust/plane-split/src/bsp.rs
third_party/rust/plane-split/src/lib.rs
third_party/rust/plane-split/src/naive.rs
third_party/rust/plane-split/tests/main.rs
third_party/rust/threadpool/.cargo-checksum.json
third_party/rust/threadpool/.cargo-ok
third_party/rust/threadpool/.gitignore
third_party/rust/threadpool/.travis.yml
third_party/rust/threadpool/CHANGES.md
third_party/rust/threadpool/Cargo.toml
third_party/rust/threadpool/LICENSE-APACHE
third_party/rust/threadpool/LICENSE-MIT
third_party/rust/threadpool/README.md
third_party/rust/threadpool/lib.rs
--- a/third_party/rust/binary-space-partition/.cargo-checksum.json
+++ b/third_party/rust/binary-space-partition/.cargo-checksum.json
@@ -1,1 +1,1 @@
-{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"f9b1ca6ae27d1c18215265024629a8960c31379f206d9ed20f64e0b2dcf79805",".travis.yml":"0310eaafa77ed58afbc5f93b1a26e938e96533b352865bc75ff4a5993aa4a8e0","Cargo.toml":"6b56e1576b18b05d665fc048ac8995efbfc8f15f9952472c382b11957114a906","LICENSE":"b946744aeda89b467929585fe8eeb5461847695220c1b168fb375d8abd4ea3d0","README.md":"ed45cabc231f18f0972348f0e230d45c92495c31e4a06eb105e8259ed9b582b3","src/lib.rs":"566b415ed879434aef230a5b5a993d789f61e98b2e38a8c87fb7f1f6102f5e6d"},"package":"df65281d9b2b5c332f5bfbd9bb5e5f2e62f627c259cf9dc9cd10fecb758be33d"}
\ No newline at end of file
+{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"f9b1ca6ae27d1c18215265024629a8960c31379f206d9ed20f64e0b2dcf79805",".travis.yml":"0310eaafa77ed58afbc5f93b1a26e938e96533b352865bc75ff4a5993aa4a8e0","Cargo.toml":"aeff622e55caf0aaaa01d75ad13ea07be748fbecd2985a81aa6c7c0de5d07241","LICENSE":"b946744aeda89b467929585fe8eeb5461847695220c1b168fb375d8abd4ea3d0","README.md":"ed45cabc231f18f0972348f0e230d45c92495c31e4a06eb105e8259ed9b582b3","src/lib.rs":"f97ad15f6ae8664f4978aaa057c0a8e27a050dc1ea79f8b66506d8fd8c7a22f9"},"package":"88ceb0d16c4fd0e42876e298d7d3ce3780dd9ebdcbe4199816a32c77e08597ff"}
\ No newline at end of file
--- a/third_party/rust/binary-space-partition/Cargo.toml
+++ b/third_party/rust/binary-space-partition/Cargo.toml
@@ -1,11 +1,11 @@
 [package]
 name = "binary-space-partition"
-version = "0.1.1"
+version = "0.1.2"
 authors = ["Dzmitry Malyshau <kvark@mozilla.com>"]
 description = "Abstract BSP tree"
 license = "MPL-2.0"
 repository = "https://github.com/kvark/binary-space-partition"
 keywords = ["geometry", "math"]
 documentation = "https://docs.rs/binary-space-partition"
 
 [dependencies]
--- a/third_party/rust/binary-space-partition/src/lib.rs
+++ b/third_party/rust/binary-space-partition/src/lib.rs
@@ -8,16 +8,17 @@ Is not tied to a particular math library
 #![warn(missing_docs)]
 
 use std::cmp;
 
 
 /// The result of one plane being cut by another one.
 /// The "cut" here is an attempt to classify a plane as being
 /// in front or in the back of another one.
+#[derive(Debug)]
 pub enum PlaneCut<T> {
     /// The planes are one the same geometrical plane.
     Sibling(T),
     /// Planes are different, thus we can either determine that
     /// our plane is completely in front/back of another one,
     /// or split it into these sub-groups.
     Cut {
         /// Sub-planes in front of the base plane.
@@ -46,16 +47,17 @@ fn add_side<T: Plane>(side: &mut Option<
         for p in planes.drain(..) {
             node.insert(p)
         }
     }
 }
 
 
 /// A node in the `BspTree`, which can be considered a tree itself.
+#[derive(Clone, Debug)]
 pub struct BspNode<T> {
     values: Vec<T>,
     front: Option<Box<BspNode<T>>>,
     back: Option<Box<BspNode<T>>>,
 }
 
 impl<T> BspNode<T> {
     /// Create a new node.
@@ -103,22 +105,22 @@ impl<T: Plane> BspNode<T> {
                 add_side(&mut self.front, front);
                 add_side(&mut self.back, back);
             }
         }
     }
 
     /// Build the draw order of this sub-tree into an `out` vector,
     /// so that the contained planes are sorted back to front according
-    /// to the view vector given as the `base` plane normal.
+    /// to the view vector defines as the `base` plane front direction.
     pub fn order(&self, base: &T, out: &mut Vec<T>) {
         let (former, latter) = match self.values.first() {
             None => return,
-            Some(ref first) if base.is_aligned(first) => (&self.back, &self.front),
-            Some(_) => (&self.front, &self.back),
+            Some(ref first) if base.is_aligned(first) => (&self.front, &self.back),
+            Some(_) => (&self.back, &self.front),
         };
 
         if let Some(ref node) = *former {
             node.order(base, out);
         }
 
         out.extend_from_slice(&self.values);
 
@@ -207,12 +209,12 @@ mod tests {
 
         for _ in 0 .. 100 {
             let plane = Plane1D(rng.gen(), rng.gen());
             node.insert(plane);
         }
 
         node.order(&Plane1D(0, true), &mut out);
         let mut out2 = out.clone();
-        out2.sort_by_key(|p| p.0);
+        out2.sort_by_key(|p| -p.0);
         assert_eq!(out, out2);
     }
 }
--- a/third_party/rust/gamma-lut/.cargo-checksum.json
+++ b/third_party/rust/gamma-lut/.cargo-checksum.json
@@ -1,1 +1,1 @@
-{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"f9b1ca6ae27d1c18215265024629a8960c31379f206d9ed20f64e0b2dcf79805","Cargo.toml":"e8868bcf7f120c0ad8a75490e70b200afc1112506ca5d56e0f484d77d3e3b807","LICENSE":"1f04103e3a61b91343b3f9d2ed2cc8543062917e2cc7d52a739ffe6429ccaf61","src/lib.rs":"2d90c309ade5ea2bd981c2ce3d15685b999b5710401b1a4e6a37f73809a3f082","src/main.rs":"afa12e489b290cbe1f255fff7afe2a3d5d4efb08547841d36ff98fe4c6d1eb5e"},"package":"cd8728df930776135895cbb25cbdd17791cde7d4285d53cf58fe6ee2e6412455"}
\ No newline at end of file
+{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"f9b1ca6ae27d1c18215265024629a8960c31379f206d9ed20f64e0b2dcf79805",".travis.yml":"b1affa3cb943685d81ac6870109bf32bdcfef9602c6272041fe59002d08d6b94","Cargo.toml":"b3ffad2789ef4fe16007123118f53dacfb07c5e06eb0623b2e576875c58e6668","LICENSE":"3db78572e8657cca9e9446ce56a057b8a981eb41af318c49a5fe08e7a10fa52a","README.md":"33ad41b44d52e867b6cb385d1cdb5486dce70434a377ea41f6286218e7688f46","examples/basic.rs":"b8ed4dd909de2bceca7325f742e628a6007c38167d70d567bdc03188f14584a7","src/lib.rs":"62194a60c7ee0a1a84023230f92c15479fec3960fef207d62500b9c357938bfd"},"package":"41f72af1e933f296b827361eb9e70d0267abf8ad0de9ec7fa667bbe67177b297"}
\ No newline at end of file
new file mode 100644
--- /dev/null
+++ b/third_party/rust/gamma-lut/.travis.yml
@@ -0,0 +1,13 @@
+sudo: false
+language: rust
+cache: cargo
+rust:
+  - nightly
+  - stable
+os:
+  - linux
+  - osx
+script:
+  - cargo build
+  - cargo doc
+  - cargo test
--- a/third_party/rust/gamma-lut/Cargo.toml
+++ b/third_party/rust/gamma-lut/Cargo.toml
@@ -1,19 +1,20 @@
 [package]
 name = "gamma-lut"
-version = "0.1.6"
-authors = ["Mason Chang <mchang@mozilla.com>"]
+version = "0.2.0"
+authors = ["Mason Chang <mchang@mozilla.com>",
+           "Dzmitry Malyshau <dmalyshau@mozilla.com>"]
 description = "Rust port of Skia gamma correcting tables"
 keywords = ["gamma"]
-license_file = "LICENSE"
+license = "MPL-2.0"
 repository = "https://github.com/changm/gamma-lut-rs"
+documentation = "https://docs.rs/gamma-lut"
 
 [lib]
 name = "gamma_lut"
 path = "src/lib.rs"
 
-[[bin]]
-name = "gamma_lut_bin"
-path = "src/main.rs"
+[[example]]
+name = "basic"
 
 [dependencies]
-lazy_static = "0.2"
+log = "0.3"
--- a/third_party/rust/gamma-lut/LICENSE
+++ b/third_party/rust/gamma-lut/LICENSE
@@ -1,245 +1,373 @@
-// Copyright (c) 2011 Google Inc. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//    * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//    * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//    * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ Mozilla Public License Version 2.0
+==================================
+
+1. Definitions
+--------------
+
+1.1. "Contributor"
+means each individual or legal entity that creates, contributes to
+the creation of, or owns Covered Software.
+
+1.2. "Contributor Version"
+means the combination of the Contributions of others (if any) used
+by a Contributor and that particular Contributor's Contribution.
+
+1.3. "Contribution"
+means Covered Software of a particular Contributor.
+
+1.4. "Covered Software"
+means Source Code Form to which the initial Contributor has attached
+the notice in Exhibit A, the Executable Form of such Source Code
+Form, and Modifications of such Source Code Form, in each case
+including portions thereof.
+
+1.5. "Incompatible With Secondary Licenses"
+means
+
+(a) that the initial Contributor has attached the notice described
+in Exhibit B to the Covered Software; or
+
+(b) that the Covered Software was made available under the terms of
+version 1.1 or earlier of the License, but not also under the
+terms of a Secondary License.
+
+1.6. "Executable Form"
+means any form of the work other than Source Code Form.
+
+1.7. "Larger Work"
+means a work that combines Covered Software with other material, in
+a separate file or files, that is not Covered Software.
+
+1.8. "License"
+means this document.
 
---------------------------------------------------------------------------------
-third_party/etc1 is under the following license:
+1.9. "Licensable"
+means having the right to grant, to the maximum extent possible,
+whether at the time of the initial grant or subsequently, any and
+all of the rights conveyed by this License.
 
+1.10. "Modifications"
+means any of the following:
 
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
+(a) any file in Source Code Form that results from an addition to,
+deletion from, or modification of the contents of Covered
+Software; or
+
+(b) any new file in Source Code Form that contains any Covered
+Software.
 
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
+1.11. "Patent Claims" of a Contributor
+means any patent claim(s), including without limitation, method,
+process, and apparatus claims, in any patent Licensable by such
+Contributor that would be infringed, but for the grant of the
+License, by the making, using, selling, offering for sale, having
+made, import, or transfer of either its Contributions or its
+Contributor Version.
 
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
+1.12. "Secondary License"
+means either the GNU General Public License, Version 2.0, the GNU
+Lesser General Public License, Version 2.1, the GNU Affero General
+Public License, Version 3.0, or any later versions of those
+licenses.
 
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
+1.13. "Source Code Form"
+means the form of the work preferred for making modifications.
 
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
+1.14. "You" (or "Your")
+means an individual or a legal entity exercising rights under this
+License. For legal entities, "You" includes any entity that
+controls, is controlled by, or is under common control with You. For
+purposes of this definition, "control" means (a) the power, direct
+or indirect, to cause the direction or management of such entity,
+whether by contract or otherwise, or (b) ownership of more than
+fifty percent (50%) of the outstanding shares or beneficial
+ownership of such entity.
 
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
+2. License Grants and Conditions
+--------------------------------
+
+2.1. Grants
+
+Each Contributor hereby grants You a world-wide, royalty-free,
+non-exclusive license:
 
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
+(a) under intellectual property rights (other than patent or trademark)
+Licensable by such Contributor to use, reproduce, make available,
+modify, display, perform, distribute, and otherwise exploit its
+Contributions, either on an unmodified basis, with Modifications, or
+as part of a Larger Work; and
 
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
+(b) under Patent Claims of such Contributor to make, use, sell, offer
+for sale, have made, import, and otherwise transfer either its
+Contributions or its Contributor Version.
+
+2.2. Effective Date
+
+The licenses granted in Section 2.1 with respect to any Contribution
+become effective for each Contribution on the date the Contributor first
+distributes such Contribution.
+
+2.3. Limitations on Grant Scope
 
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
+The licenses granted in this Section 2 are the only rights granted under
+this License. No additional rights or licenses will be implied from the
+distribution or licensing of Covered Software under this License.
+Notwithstanding Section 2.1(b) above, no patent license is granted by a
+Contributor:
+
+(a) for any code that a Contributor has removed from Covered Software;
+or
+
+(b) for infringements caused by: (i) Your and any other third party's
+modifications of Covered Software, or (ii) the combination of its
+Contributions with other software (except as part of its Contributor
+Version); or
 
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
+(c) under Patent Claims infringed by Covered Software in the absence of
+its Contributions.
+
+This License does not grant any rights in the trademarks, service marks,
+or logos of any Contributor (except as may be necessary to comply with
+the notice requirements in Section 3.4).
+
+2.4. Subsequent Licenses
+
+No Contributor makes additional grants as a result of Your choice to
+distribute the Covered Software under a subsequent version of this
+License (see Section 10.2) or under the terms of a Secondary License (if
+permitted under the terms of Section 3.3).
 
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
+2.5. Representation
+
+Each Contributor represents that the Contributor believes its
+Contributions are its original creation(s) or it has sufficient rights
+to grant the rights to its Contributions conveyed by this License.
+
+2.6. Fair Use
 
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
+This License is not intended to limit any rights You have under
+applicable copyright doctrines of fair use, fair dealing, or other
+equivalents.
+
+2.7. Conditions
+
+Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
+in Section 2.1.
+
+3. Responsibilities
+-------------------
+
+3.1. Distribution of Source Form
 
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
+All distribution of Covered Software in Source Code Form, including any
+Modifications that You create or to which You contribute, must be under
+the terms of this License. You must inform recipients that the Source
+Code Form of the Covered Software is governed by the terms of this
+License, and how they can obtain a copy of this License. You may not
+attempt to alter or restrict the recipients' rights in the Source Code
+Form.
+
+3.2. Distribution of Executable Form
+
+If You distribute Covered Software in Executable Form then:
 
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
+(a) such Covered Software must also be made available in Source Code
+Form, as described in Section 3.1, and You must inform recipients of
+the Executable Form how they can obtain a copy of such Source Code
+Form by reasonable means in a timely manner, at a charge no more
+than the cost of distribution to the recipient; and
+
+(b) You may distribute such Executable Form under the terms of this
+License, or sublicense it under different terms, provided that the
+license for the Executable Form does not attempt to limit or alter
+the recipients' rights in the Source Code Form under this License.
+
+3.3. Distribution of a Larger Work
 
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
+You may create and distribute a Larger Work under terms of Your choice,
+provided that You also comply with the requirements of this License for
+the Covered Software. If the Larger Work is a combination of Covered
+Software with a work governed by one or more Secondary Licenses, and the
+Covered Software is not Incompatible With Secondary Licenses, this
+License permits You to additionally distribute such Covered Software
+under the terms of such Secondary License(s), so that the recipient of
+the Larger Work may, at their option, further distribute the Covered
+Software under the terms of either this License or such Secondary
+License(s).
 
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
+3.4. Notices
+
+You may not remove or alter the substance of any license notices
+(including copyright notices, patent notices, disclaimers of warranty,
+or limitations of liability) contained within the Source Code Form of
+the Covered Software, except that You may alter any license notices to
+the extent required to remedy known factual inaccuracies.
+
+3.5. Application of Additional Terms
 
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
+You may choose to offer, and to charge a fee for, warranty, support,
+indemnity or liability obligations to one or more recipients of Covered
+Software. However, You may do so only on Your own behalf, and not on
+behalf of any Contributor. You must make it absolutely clear that any
+such warranty, support, indemnity, or liability obligation is offered by
+You alone, and You hereby agree to indemnify every Contributor for any
+liability incurred by such Contributor as a result of warranty, support,
+indemnity or liability terms You offer. You may include additional
+disclaimers of warranty and limitations of liability specific to any
+jurisdiction.
 
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
+4. Inability to Comply Due to Statute or Regulation
+---------------------------------------------------
+
+If it is impossible for You to comply with any of the terms of this
+License with respect to some or all of the Covered Software due to
+statute, judicial order, or regulation then You must: (a) comply with
+the terms of this License to the maximum extent possible; and (b)
+describe the limitations and the code they affect. Such description must
+be placed in a text file included with all distributions of the Covered
+Software under this License. Except to the extent prohibited by statute
+or regulation, such description must be sufficiently detailed for a
+recipient of ordinary skill to be able to understand it.
 
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
+5. Termination
+--------------
+
+5.1. The rights granted under this License will terminate automatically
+if You fail to comply with any of its terms. However, if You become
+compliant, then the rights granted under this License from a particular
+Contributor are reinstated (a) provisionally, unless and until such
+Contributor explicitly and finally terminates Your grants, and (b) on an
+ongoing basis, if such Contributor fails to notify You of the
+non-compliance by some reasonable means prior to 60 days after You have
+come back into compliance. Moreover, Your grants from a particular
+Contributor are reinstated on an ongoing basis if such Contributor
+notifies You of the non-compliance by some reasonable means, this is the
+first time You have received notice of non-compliance with this License
+from such Contributor, and You become compliant prior to 30 days after
+Your receipt of the notice.
+
+5.2. If You initiate litigation against any entity by asserting a patent
+infringement claim (excluding declaratory judgment actions,
+counter-claims, and cross-claims) alleging that a Contributor Version
+directly or indirectly infringes any patent, then the rights granted to
+You by any and all Contributors for the Covered Software under Section
+2.1 of this License shall terminate.
 
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
+5.3. In the event of termination under Sections 5.1 or 5.2 above, all
+end user license agreements (excluding distributors and resellers) which
+have been validly granted by You or Your distributors under this License
+prior to termination shall survive termination.
 
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
+************************************************************************
+* *
+* 6. Disclaimer of Warranty *
+* ------------------------- *
+* *
+* Covered Software is provided under this License on an "as is" *
+* basis, without warranty of any kind, either expressed, implied, or *
+* statutory, including, without limitation, warranties that the *
+* Covered Software is free of defects, merchantable, fit for a *
+* particular purpose or non-infringing. The entire risk as to the *
+* quality and performance of the Covered Software is with You. *
+* Should any Covered Software prove defective in any respect, You *
+* (not any Contributor) assume the cost of any necessary servicing, *
+* repair, or correction. This disclaimer of warranty constitutes an *
+* essential part of this License. No use of any Covered Software is *
+* authorized under this License except under this disclaimer. *
+* *
+************************************************************************
 
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
+************************************************************************
+* *
+* 7. Limitation of Liability *
+* -------------------------- *
+* *
+* Under no circumstances and under no legal theory, whether tort *
+* (including negligence), contract, or otherwise, shall any *
+* Contributor, or anyone who distributes Covered Software as *
+* permitted above, be liable to You for any direct, indirect, *
+* special, incidental, or consequential damages of any character *
+* including, without limitation, damages for lost profits, loss of *
+* goodwill, work stoppage, computer failure or malfunction, or any *
+* and all other commercial damages or losses, even if such party *
+* shall have been informed of the possibility of such damages. This *
+* limitation of liability shall not apply to liability for death or *
+* personal injury resulting from such party's negligence to the *
+* extent applicable law prohibits such limitation. Some *
+* jurisdictions do not allow the exclusion or limitation of *
+* incidental or consequential damages, so this exclusion and *
+* limitation may not apply to You. *
+* *
+************************************************************************
 
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
+8. Litigation
+-------------
+
+Any litigation relating to this License may be brought only in the
+courts of a jurisdiction where the defendant maintains its principal
+place of business and such litigation shall be governed by laws of that
+jurisdiction, without reference to its conflict-of-law provisions.
+Nothing in this Section shall prevent a party's ability to bring
+cross-claims or counter-claims.
 
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
+9. Miscellaneous
+----------------
 
-   END OF TERMS AND CONDITIONS
+This License represents the complete agreement concerning the subject
+matter hereof. If any provision of this License is held to be
+unenforceable, such provision shall be reformed only to the extent
+necessary to make it enforceable. Any law or regulation which provides
+that the language of a contract shall be construed against the drafter
+shall not be used to construe this License against a Contributor.
+
+10. Versions of the License
+---------------------------
 
-   APPENDIX: How to apply the Apache License to your work.
+10.1. New Versions
+
+Mozilla Foundation is the license steward. Except as provided in Section
+10.3, no one other than the license steward has the right to modify or
+publish new versions of this License. Each version will be given a
+distinguishing version number.
+
+10.2. Effect of New Versions
 
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "[]"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
+You may distribute the Covered Software under the terms of the version
+of the License under which You originally received the Covered Software,
+or under the terms of any subsequent version published by the license
+steward.
 
-   Copyright [yyyy] [name of copyright owner]
+10.3. Modified Versions
 
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
+If you create software not governed by this License, and you want to
+create a new license for such software, you may create and use a
+modified version of this License if you rename the license and remove
+any references to the name of the license steward (except to note that
+such modified license differs from this License).
 
-       http://www.apache.org/licenses/LICENSE-2.0
+10.4. Distributing Source Code Form that is Incompatible With Secondary
+Licenses
 
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
+If You choose to distribute Source Code Form that is Incompatible With
+Secondary Licenses under the terms of this version of the License, the
+notice described in Exhibit B of this License must be attached.
+
+Exhibit A - Source Code Form License Notice
+-------------------------------------------
 
---------------------------------------------------------------------------------
-Some files under resources are under the following license:
-
-Unlimited Commercial Use
-We try to make it clear that you may use all clipart from Openclipart even for unlimited commercial use. We believe that giving away our images is a great way to share with the world our talents and that will come back around in a better form.
+This Source Code Form is subject to the terms of the Mozilla Public
+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/.
 
-May I Use Openclipart for?
-We put together a small chart of as many possibilities and questions we have heard from people asking how they may use Openclipart. If you have an additional question, please email love@openclipart.org.
+If it is not possible or desirable to put the notice in a particular
+file, then You may include the notice in a location (such as a LICENSE
+file in a relevant directory) where a recipient would be likely to look
+for such a notice.
 
-All Clipart are Released into the Public Domain.
-Each artist at Openclipart releases all rights to the images they share at Openclipart. The reason is so that there is no friction in using and sharing images authors make available at this website so that each artist might also receive the same benefit in using other artists clipart totally for any possible reason.
+You may add additional accurate notices of copyright ownership.
+
+Exhibit B - "Incompatible With Secondary Licenses" Notice
+---------------------------------------------------------
+
+This Source Code Form is "Incompatible With Secondary Licenses", as
+defined by the Mozilla Public License, v. 2.0.
new file mode 100644
--- /dev/null
+++ b/third_party/rust/gamma-lut/README.md
@@ -0,0 +1,4 @@
+# gamma-lut
+[![Build Status](https://travis-ci.org/changm/gamma-lut-rs.svg)](https://travis-ci.org/changm/gamma-lut-rs) [![](http://meritbadge.herokuapp.com/gamma-lut)](https://crates.io/crates/gamma-lut) [![Documentation](https://docs.rs/gamma-lut/badge.svg)](https://docs.rs/gamma-lut)
+
+Rust port of Skia gamma correcting table.
new file mode 100644
--- /dev/null
+++ b/third_party/rust/gamma-lut/examples/basic.rs
@@ -0,0 +1,11 @@
+extern crate gamma_lut;
+
+fn main() {
+    let contrast = 0.0;
+    let gamma = 0.0;
+
+    let table = gamma_lut::GammaLut::new(contrast, gamma, gamma);
+    for (i, value) in table.get_table(0).iter().enumerate() {
+        println!("[{:?}] = {:?}", i, *value);
+    }
+}
--- a/third_party/rust/gamma-lut/src/lib.rs
+++ b/third_party/rust/gamma-lut/src/lib.rs
@@ -1,388 +1,374 @@
-/*
- * Copyright 2006 The Android Open Source Project
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
+/*!
+Gamma correction lookup tables.
 
-extern crate lazy_static;
+This is a port of Skia gamma LUT logic into Rust, used by WebRender.
+*/
+//#![warn(missing_docs)] //TODO
 
-pub trait ColorSpaceLuminance {
-	fn to_luma(&self, gamma: f32, luminance: f32) -> f32;
-	fn from_luma(&self, gamma: f32, luma: f32) -> f32;
-}
+#[macro_use]
+extern crate log;
 
-pub struct SRGBColorSpaceLuminance
-{
-}
-
-pub struct LinearColorSpaceLuminance
-{
-}
-
-pub struct GammaColorSpaceLuminance
-{}
-
-impl ColorSpaceLuminance for LinearColorSpaceLuminance {
-	fn to_luma(&self, gamma: f32, luminance: f32) -> f32 {
-        assert!(gamma == 1.);
-		luminance
-	}
-	fn from_luma(&self, gamma: f32, luma: f32) -> f32 {
-        assert!(gamma == 1.);
-		luma
-	}
+/// Color space responsible for converting between lumas and luminances.
+#[derive(Clone, Copy, Debug, PartialEq)]
+pub enum LuminanceColorSpace {
+    /// Linear space - no conversion involved.
+    Linear,
+    /// Simple gamma space - uses the `luminance ^ gamma` function.
+    Gamma(f32),
+    /// Srgb space.
+    Srgb,
 }
 
-impl ColorSpaceLuminance for GammaColorSpaceLuminance {
-	fn to_luma(&self, gamma: f32, luminance: f32) -> f32 {
-		luminance.powf(gamma)
-	}
-	fn from_luma(&self, gamma: f32, luma: f32) -> f32 {
-		luma.powf(1./gamma)
-	}
+impl LuminanceColorSpace {
+    pub fn new(gamma: f32) -> LuminanceColorSpace {
+        match gamma {
+            1.0 => LuminanceColorSpace::Linear,
+            0.0 => LuminanceColorSpace::Srgb,
+            _ => LuminanceColorSpace::Gamma(gamma),
+        }
+    }
+
+    pub fn to_luma(&self, luminance: f32) -> f32 {
+        match *self {
+            LuminanceColorSpace::Linear => luminance,
+            LuminanceColorSpace::Gamma(gamma) => luminance.powf(gamma),
+            LuminanceColorSpace::Srgb => {
+                //The magic numbers are derived from the sRGB specification.
+                //See http://www.color.org/chardata/rgb/srgb.xalter .
+                if luminance <= 0.04045 {
+                    luminance / 12.92
+                } else {
+                    ((luminance + 0.055) / 1.055).powf(2.4)
+                }
+            }
+        }
+    }
+
+    pub fn from_luma(&self, luma: f32) -> f32 {
+        match *self {
+            LuminanceColorSpace::Linear => luma,
+            LuminanceColorSpace::Gamma(gamma) => luma.powf(1. / gamma),
+            LuminanceColorSpace::Srgb => {
+                //The magic numbers are derived from the sRGB specification.
+                //See http://www.color.org/chardata/rgb/srgb.xalter .
+                if luma <= 0.0031308 {
+                    luma * 12.92
+                } else {
+                    1.055 * luma.powf(1./2.4) - 0.055
+                }
+            }
+        }
+    }
 }
 
-impl ColorSpaceLuminance for SRGBColorSpaceLuminance {
-	fn to_luma(&self, gamma: f32, luminance: f32) -> f32 {
-        assert!(gamma == 0.);
-        //The magic numbers are derived from the sRGB specification.
-        //See http://www.color.org/chardata/rgb/srgb.xalter .
-		if luminance <= 0.04045 {
-			return luminance / 12.92;
-		}
-		return ((luminance + 0.055) / 1.055).powf(2.4);
-	}
-	fn from_luma(&self, gamma: f32, luma: f32) -> f32 {
-        assert!(gamma == 0.);
-        //The magic numbers are derived from the sRGB specification.
-        //See http://www.color.org/chardata/rgb/srgb.xalter .
-        if luma <= 0.0031308 {
-            return luma * 12.92;
-        }
-        return 1.055 * luma.powf(1./2.4)
-               - 0.055;
-	}
+//TODO: tests
+fn round_to_u8(x : f32) -> u8 {
+    let v = (x + 0.5).floor() as i32;
+    assert!(0 <= v && v < 0x100);
+    v as u8
 }
 
-fn round_to_u8(x : f32) -> u8 {
-    assert!((x + 0.5).floor() < 256.0);
-    (x + 0.5).floor() as u8
-}
-
+//TODO: tests
 /*
  * Scales base <= 2^N-1 to 2^8-1
  * @param N [1, 8] the number of bits used by base.
  * @param base the number to be scaled to [0, 255].
  */
-fn scale255(n: u8, mut base : u8) -> u8 {
+fn scale255(n: u8, mut base: u8) -> u8 {
     base <<= 8 - n;
     let mut lum = base;
     let mut i = n;
 
     while i < 8 {
         lum |= base >> i;
         i += n;
     }
 
-    return lum;
+    lum
 }
 
 #[derive(Copy, Clone)]
-#[allow(dead_code)]
 pub struct Color {
     r: u8,
     g: u8,
     b: u8,
-    a: u8,
+    _a: u8,
 }
 
 impl Color {
     pub fn new(r: u8, g: u8, b: u8, a: u8) -> Color {
         Color {
             r: r,
             g: g,
             b: b,
-            a: a,
+            _a: a,
         }
     }
 }
 
 // This will invert the gamma applied by CoreGraphics,
 // so we can get linear values.
 // CoreGraphics obscurely defaults to 2.0 as the smoothing gamma value.
 // The color space used does not appear to affect this choice.
+#[cfg(target_os="macos")]
 fn get_inverse_gamma_table_coregraphics_smoothing() -> [u8; 256] {
-	let mut table : [u8; 256] = [0; 256];
+    let mut table = [0u8; 256];
 
-	for i in 0..256 {
-		let x = i as f32 / 255.0;
-		let value = round_to_u8(x * x * 255.0);
-		table[i] = value;
-	}
+    for (i, v) in table.iter_mut().enumerate() {
+        let x = i as f32 / 255.0;
+        *v = round_to_u8(x * x * 255.0);
+    }
 
-	table
+    table
 }
 
 // A value of 0.5 for SK_GAMMA_CONTRAST appears to be a good compromise.
 // With lower values small text appears washed out (though correctly so).
 // With higher values lcd fringing is worse and the smoothing effect of
 // partial coverage is diminished.
 fn apply_contrast(srca: f32, contrast: f32) -> f32 {
     srca + ((1.0 - srca) * contrast * srca)
 }
 
 // The approach here is not necessarily the one with the lowest error
 // See https://bel.fi/alankila/lcd/alpcor.html for a similar kind of thing
 // that just search for the adjusted alpha value
 pub fn build_gamma_correcting_lut(table: &mut [u8; 256], src: u8, contrast: f32,
-                                  src_space: &ColorSpaceLuminance, src_gamma: f32,
-                                  dst_convert: &ColorSpaceLuminance, dst_gamma: f32) {
+                                  src_space: LuminanceColorSpace,
+                                  dst_convert: LuminanceColorSpace) {
 
     let src = src as f32 / 255.0;
-    let lin_src = src_space.to_luma(src_gamma, src);
+    let lin_src = src_space.to_luma(src);
     // Guess at the dst. The perceptual inverse provides smaller visual
     // discontinuities when slight changes to desaturated colors cause a channel
     // to map to a different correcting lut with neighboring srcI.
     // See https://code.google.com/p/chromium/issues/detail?id=141425#c59 .
     let dst = 1.0 - src;
-    let lin_dst = dst_convert.to_luma(dst_gamma, dst);
+    let lin_dst = dst_convert.to_luma(dst);
 
     // Contrast value tapers off to 0 as the src luminance becomes white
     let adjusted_contrast = contrast * lin_dst;
 
     // Remove discontinuity and instability when src is close to dst.
     // The value 1/256 is arbitrary and appears to contain the instability.
     if (src - dst).abs() < (1.0 / 256.0) {
         let mut ii : f32 = 0.0;
-        for i in 0..256 {
+        for v in table.iter_mut() {
             let raw_srca = ii / 255.0;
             let srca = apply_contrast(raw_srca, adjusted_contrast);
 
-            table[i] = round_to_u8(255.0 * srca);
+            *v = round_to_u8(255.0 * srca);
             ii += 1.0;
         }
     } else {
         // Avoid slow int to float conversion.
         let mut ii : f32 = 0.0;
-        for i in 0..256 {
+        for v in table.iter_mut() {
             // 'raw_srca += 1.0f / 255.0f' and even
             // 'raw_srca = i * (1.0f / 255.0f)' can add up to more than 1.0f.
             // When this happens the table[255] == 0x0 instead of 0xff.
             // See http://code.google.com/p/chromium/issues/detail?id=146466
             let raw_srca = ii / 255.0;
             let srca = apply_contrast(raw_srca, adjusted_contrast);
             assert!(srca <= 1.0);
             let dsta = 1.0 - srca;
 
             // Calculate the output we want.
             let lin_out = lin_src * srca + dsta * lin_dst;
             assert!(lin_out <= 1.0);
-            let out = dst_convert.from_luma(dst_gamma, lin_out);
+            let out = dst_convert.from_luma(lin_out);
 
             // Undo what the blit blend will do.
             // i.e. given the formula for OVER: out = src * result + (1 - result) * dst
             // solving for result gives:
             let result = (out - dst) / (src - dst);
 
-            //println!("Setting {:?} to {:?}", i, round_to_u8(255.0 * result));
-            table[i] = round_to_u8(255.0 * result);
+            *v = round_to_u8(255.0 * result);
+            debug!("Setting {:?} to {:?}", ii as u8, *v);
 
             ii += 1.0;
         }
     }
 }
 
-fn fetch_color_space(gamma: f32) -> Box<ColorSpaceLuminance> {
-    if 0.0 == gamma {
-        return Box::new( SRGBColorSpaceLuminance{} );
-    } else if 1.0 == gamma {
-        return Box::new( LinearColorSpaceLuminance{} );
-    } else {
-        return Box::new( GammaColorSpaceLuminance{} );
-    }
-}
-
 // Computes the luminance from the given r, g, and b in accordance with
 // SK_LUM_COEFF_X. For correct results, r, g, and b should be in linear space.
 fn compute_luminance(r: u8, g: u8, b: u8) -> u8 {
-	// The following is
-	// r * SK_LUM_COEFF_R + g * SK_LUM_COEFF_G + b * SK_LUM_COEFF_B
-	// with SK_LUM_COEFF_X in 1.8 fixed point (rounding adjusted to sum to 256).
-	let val : u32 = r as u32 * 54 + g as u32 * 183 + b as u32 * 19;
-	return (val >> 8) as u8;
+    // The following is
+    // r * SK_LUM_COEFF_R + g * SK_LUM_COEFF_G + b * SK_LUM_COEFF_B
+    // with SK_LUM_COEFF_X in 1.8 fixed point (rounding adjusted to sum to 256).
+    let val: u32 = r as u32 * 54 + g as u32 * 183 + b as u32 * 19;
+    assert!(val < 0x10000);
+    (val >> 8) as u8
 }
 
 // Skia uses 3 bits per channel for luminance.
-pub const LUM_BITS :u8 = 3;
-#[allow(dead_code)]
+pub const LUM_BITS: u8 = 3;
+
 pub struct GammaLut {
-    tables: [[u8; 256 ]; 1 << LUM_BITS],
+    tables: [[u8; 256]; 1 << LUM_BITS],
+    #[cfg(target_os="macos")]
     cg_inverse_gamma: [u8; 256],
 }
 
 impl GammaLut {
     // Skia actually makes 9 gamma tables, then based on the luminance color,
     // fetches the RGB gamma table for that color.
     fn generate_tables(&mut self, contrast: f32, paint_gamma: f32, device_gamma: f32) {
-        let paint_color_space = fetch_color_space(paint_gamma);
-        let device_color_space = fetch_color_space(device_gamma);
+        let paint_color_space = LuminanceColorSpace::new(paint_gamma);
+        let device_color_space = LuminanceColorSpace::new(device_gamma);
 
-        for i in 0..(1 << LUM_BITS) {
-            let luminance = scale255(LUM_BITS, i);
-            build_gamma_correcting_lut(&mut self.tables[i as usize],
+        for (i, entry) in self.tables.iter_mut().enumerate() {
+            let luminance = scale255(LUM_BITS, i as u8);
+            build_gamma_correcting_lut(entry,
                                        luminance,
                                        contrast,
-                                       &*paint_color_space,
-                                       paint_gamma,
-                                       &*device_color_space,
-                                       device_gamma);
+                                       paint_color_space,
+                                       device_color_space);
         }
     }
 
-    #[allow(dead_code)]
-    fn table_count() -> usize {
-        return 1 << LUM_BITS;
+    pub fn table_count(&self) -> usize {
+        self.tables.len()
     }
 
-    pub fn print_values(&self, table: usize) {
-        for x in 0..256 {
-            println!("[{:?}] = {:?}", x, self.tables[table][x])
-        }
-    }
-
-    pub fn get_table(&self, color: u8) -> [u8; 256] {
-        return self.tables[(color >> (8 - LUM_BITS)) as usize];
+    pub fn get_table(&self, color: u8) -> &[u8; 256] {
+        &self.tables[(color >> (8 - LUM_BITS)) as usize]
     }
 
     pub fn new(contrast: f32, paint_gamma: f32, device_gamma: f32) -> GammaLut {
+        #[cfg(target_os="macos")]
         let mut table = GammaLut {
             tables: [[0; 256]; 1 << LUM_BITS],
             cg_inverse_gamma: get_inverse_gamma_table_coregraphics_smoothing(),
         };
+        #[cfg(not(target_os="macos"))]
+        let mut table = GammaLut {
+            tables: [[0; 256]; 1 << LUM_BITS],
+        };
 
         table.generate_tables(contrast, paint_gamma, device_gamma);
 
         table
     }
 
     // Skia normally preblends based on what the text color is.
     // If we can't do that, use Skia default colors.
-    pub fn preblend_default_colors_bgra(&self, pixels: &mut Vec<u8>, width: usize, height: usize) {
+    pub fn preblend_default_colors_bgra(&self, pixels: &mut [u8], width: usize, height: usize) {
         let preblend_color = Color {
             r: 0x7f,
             g: 0x80,
             b: 0x7f,
-            a: 0xff,
+            _a: 0xff,
         };
         self.preblend_bgra(pixels, width, height, preblend_color);
     }
 
-    fn replace_pixels_bgra(&self, pixels: &mut Vec<u8>, width: usize, height: usize,
-                           table_r: [u8; 256], table_g: [u8; 256], table_b: [u8; 256]) {
+    fn replace_pixels_bgra(&self, pixels: &mut [u8], width: usize, height: usize,
+                           table_r: &[u8; 256], table_g: &[u8; 256], table_b: &[u8; 256]) {
          for y in 0..height {
             let current_height = y * width * 4;
 
             for pixel in pixels[current_height..current_height + (width * 4)].chunks_mut(4) {
                 pixel[0] = table_b[pixel[0] as usize];
                 pixel[1] = table_g[pixel[1] as usize];
                 pixel[2] = table_r[pixel[2] as usize];
                 // Don't touch alpha
             }
         }
     }
 
     // Mostly used by windows and GlyphRunAnalysis::GetAlphaTexture
-    fn replace_pixels_rgb(&self, pixels: &mut Vec<u8>, width: usize, height: usize,
-                          table_r: [u8; 256], table_g: [u8; 256], table_b: [u8; 256]) {
+    fn replace_pixels_rgb(&self, pixels: &mut [u8], width: usize, height: usize,
+                          table_r: &[u8; 256], table_g: &[u8; 256], table_b: &[u8; 256]) {
          for y in 0..height {
             let current_height = y * width * 3;
 
             for pixel in pixels[current_height..current_height + (width * 3)].chunks_mut(3) {
                 pixel[0] = table_r[pixel[0] as usize];
                 pixel[1] = table_g[pixel[1] as usize];
                 pixel[2] = table_b[pixel[2] as usize];
             }
         }
     }
 
     // Assumes pixels are in BGRA format. Assumes pixel values are in linear space already.
-    pub fn preblend_bgra(&self, pixels: &mut Vec<u8>, width: usize, height: usize, color: Color) {
+    pub fn preblend_bgra(&self, pixels: &mut [u8], width: usize, height: usize, color: Color) {
         let table_r = self.get_table(color.r);
         let table_g = self.get_table(color.g);
         let table_b = self.get_table(color.b);
 
         self.replace_pixels_bgra(pixels, width, height, table_r, table_g, table_b);
     }
 
     // Assumes pixels are in RGB format. Assumes pixel values are in linear space already. NOTE:
     // there is no alpha here.
-    pub fn preblend_rgb(&self, pixels: &mut Vec<u8>, width: usize, height: usize, color: Color) {
+    pub fn preblend_rgb(&self, pixels: &mut [u8], width: usize, height: usize, color: Color) {
         let table_r = self.get_table(color.r);
         let table_g = self.get_table(color.g);
         let table_b = self.get_table(color.b);
 
         self.replace_pixels_rgb(pixels, width, height, table_r, table_g, table_b);
     }
 
     #[cfg(target_os="macos")]
-    pub fn coregraphics_convert_to_linear_bgra(&self, pixels: &mut Vec<u8>, width: usize, height: usize) {
+    pub fn coregraphics_convert_to_linear_bgra(&self, pixels: &mut [u8], width: usize, height: usize) {
         self.replace_pixels_bgra(pixels, width, height,
-                                 self.cg_inverse_gamma,
-                                 self.cg_inverse_gamma,
-                                 self.cg_inverse_gamma);
+                                 &self.cg_inverse_gamma,
+                                 &self.cg_inverse_gamma,
+                                 &self.cg_inverse_gamma);
     }
 
     // Assumes pixels are in BGRA format. Assumes pixel values are in linear space already.
-    pub fn preblend_grayscale_bgra(&self, pixels: &mut Vec<u8>, width: usize, height: usize, color: Color) {
+    pub fn preblend_grayscale_bgra(&self, pixels: &mut [u8], width: usize, height: usize, color: Color) {
         let table_g = self.get_table(color.g);
 
          for y in 0..height {
             let current_height = y * width * 4;
 
             for pixel in pixels[current_height..current_height + (width * 4)].chunks_mut(4) {
                 let luminance = compute_luminance(pixel[0], pixel[1], pixel[2]);
                 pixel[0] = table_g[luminance as usize];
                 pixel[1] = table_g[luminance as usize];
                 pixel[2] = table_g[luminance as usize];
                 // Don't touch alpha
             }
-		}
+        }
     }
 
 } // end impl GammaLut
 
 #[cfg(test)]
 mod tests {
     use std::cmp;
-    use std::mem;
+    use super::*;
 
     fn over(dst: u32, src: u32, alpha: u32) -> u32 {
         (src * alpha + dst * (255 - alpha))/255
     }
 
     fn overf(dst: f32, src: f32, alpha: f32) -> f32 {
         ((src * alpha + dst * (255. - alpha))/255.) as f32
     }
 
 
     fn absdiff(a: u32, b: u32) -> u32 {
         if a < b  { b - a } else { a - b }
     }
 
     #[test]
     fn gamma() {
-        let mut table: [u8; 256] = unsafe{ mem::uninitialized() } ;
-        let space = ::GammaColorSpaceLuminance{};
-        let g : f32 = 2.;
+        let mut table = [0u8; 256];
+        let g = 2.0;
+        let space = LuminanceColorSpace::Gamma(g);
         let mut src : u32 = 131;
         while src < 256 {
-            ::build_gamma_correcting_lut(&mut table, src as u8, 0., &space, g, &space, g);
+            build_gamma_correcting_lut(&mut table, src as u8, 0., space, space);
             let mut max_diff = 0;
             let mut dst = 0;
             while dst < 256 {
                 for alpha in 0u32..256 {
                     let preblend = table[alpha as usize];
                     let lin_dst = (dst as f32 / 255.).powf(g) * 255.;
                     let lin_src = (src as f32 / 255.).powf(g) * 255.;
 
deleted file mode 100644
--- a/third_party/rust/gamma-lut/src/main.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-extern crate gamma_lut;
-
-fn main() {
-    let contrast = 0.0;
-    let gamma = 0.0;
-
-    let table = gamma_lut::GammaLut::new(contrast, gamma, gamma);
-    table.print_values(0);
-}
--- a/third_party/rust/gleam/.cargo-checksum.json
+++ b/third_party/rust/gleam/.cargo-checksum.json
@@ -1,1 +1,1 @@
-{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"c1e953ee360e77de57f7b02f1b7880bd6a3dc22d1a69e953c2ac2c52cc52d247",".travis.yml":"29b74b95210896ce634c11a9037638668473b5a1b3b1716c505cb04dbb6341fa","COPYING":"ec82b96487e9e778ee610c7ab245162464782cfa1f555c2299333f8dbe5c036a","Cargo.toml":"73e953c91e925c7fdb4666e7c4a578f5531eeb442677a361c8b2e2cf87252b55","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"62065228e42caebca7e7d7db1204cbb867033de5982ca4009928915e4095f3a3","README.md":"2de24b7458d6b88f20324303a48acf64a4f2bbfb83d2ec4d6ff2b4f4a1fd2275","build.rs":"a9e320b7ebeb61be7f1ae594a0dcc022a6629f18c335e1b9ace11f573201c610","src/gl.rs":"f9070d602edb0ebf2e481614d4541f53b2031578ddbbfa47656dc375a7456a18","src/gl_fns.rs":"5e917e19b6a3a65133df4f47d7d4a387bb68e4f76ffa5807ab1de12d14b80095","src/gles_fns.rs":"761f998fc44c30145132f725728e8e86fd43e73f840c0221868c21539dcfc63c","src/lib.rs":"16610c19b45a3f26d56b379a3591aa2e4fc9477e7bd88f86b31c6ea32e834861"},"package":"9c46ff982a2e6abed1f50b3077d3176836875d9720906b248335f4c93827a345"}
\ No newline at end of file
+{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"c1e953ee360e77de57f7b02f1b7880bd6a3dc22d1a69e953c2ac2c52cc52d247",".travis.yml":"29b74b95210896ce634c11a9037638668473b5a1b3b1716c505cb04dbb6341fa","COPYING":"ec82b96487e9e778ee610c7ab245162464782cfa1f555c2299333f8dbe5c036a","Cargo.toml":"3f5176487c0bdc07d6deb54137d671b37db706a394ec9c3820fb9c7e4c6f97a3","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"62065228e42caebca7e7d7db1204cbb867033de5982ca4009928915e4095f3a3","README.md":"2de24b7458d6b88f20324303a48acf64a4f2bbfb83d2ec4d6ff2b4f4a1fd2275","build.rs":"a9e320b7ebeb61be7f1ae594a0dcc022a6629f18c335e1b9ace11f573201c610","src/gl.rs":"4091686fedd22df293746008e1896ead67e769ff8b77eaad027e86d8692028d3","src/gl_fns.rs":"58a83def91e9d47b3cd10d9f61fa4640a0293384d9617a80c5a7de2eab3a097e","src/gles_fns.rs":"43f98589569002315cdce7835c91b71124d003d8b605924f98c9632a4a9a7c2e","src/lib.rs":"16610c19b45a3f26d56b379a3591aa2e4fc9477e7bd88f86b31c6ea32e834861"},"package":"a86944a6a4d7f54507f8ee930192d971f18a7b1da526ff529b7a0d4043935380"}
\ No newline at end of file
--- a/third_party/rust/gleam/Cargo.toml
+++ b/third_party/rust/gleam/Cargo.toml
@@ -1,11 +1,11 @@
 [package]
 name = "gleam"
-version = "0.4.3"
+version = "0.4.5"
 license = "Apache-2.0/MIT"
 authors = ["The Servo Project Developers"]
 build = "build.rs"
 documentation = "http://doc.servo.org/gleam/"
 repository = "https://github.com/servo/gleam"
 description = "Generated OpenGL bindings and wrapper for Servo."
 
 [build-dependencies]
--- a/third_party/rust/gleam/src/gl.rs
+++ b/third_party/rust/gleam/src/gl.rs
@@ -67,16 +67,17 @@ pub trait Gl {
                            size: GLsizeiptr,
                            data: *const GLvoid,
                            usage: GLenum);
     fn buffer_sub_data_untyped(&self,
                                target: GLenum,
                                offset: isize,
                                size: GLsizeiptr,
                                data: *const GLvoid);
+    fn tex_buffer(&self, target: GLenum, internal_format: GLenum, buffer: GLuint);
     fn shader_source(&self, shader: GLuint, strings: &[&[u8]]);
     fn read_buffer(&self, mode: GLenum);
     fn read_pixels_into_buffer(&self,
                                x: GLint,
                                y: GLint,
                                width: GLsizei,
                                height: GLsizei,
                                format: GLenum,
@@ -348,16 +349,17 @@ pub trait Gl {
     fn get_active_uniform(&self, program: GLuint, index: GLuint) -> (i32, u32, String);
     fn get_attrib_location(&self, program: GLuint, name: &str) -> c_int;
     fn get_frag_data_location(&self, program: GLuint, name: &str) -> c_int;
     fn get_uniform_location(&self, program: GLuint, name: &str) -> c_int;
     fn get_program_info_log(&self, program: GLuint) -> String;
     fn get_program_iv(&self, program: GLuint, pname: GLenum) -> GLint;
     fn get_vertex_attrib_iv(&self, index: GLuint, pname: GLenum) -> GLint;
     fn get_vertex_attrib_fv(&self, index: GLuint, pname: GLenum) -> Vec<GLfloat>;
+    fn get_vertex_attrib_pointer_v(&self, index: GLuint, pname: GLenum) -> GLsizeiptr;
     fn get_buffer_parameter_iv(&self, target: GLuint, pname: GLenum) -> GLint;
     fn get_shader_info_log(&self, shader: GLuint) -> String;
     fn get_string(&self, which: GLenum) -> String;
     fn get_shader_iv(&self, shader: GLuint, pname: GLenum) -> GLint;
     fn get_shader_precision_format(&self,
                                    shader_type: GLuint,
                                    precision_type: GLuint)
                                    -> (GLint, GLint, GLint);
--- a/third_party/rust/gleam/src/gl_fns.rs
+++ b/third_party/rust/gleam/src/gl_fns.rs
@@ -50,16 +50,22 @@ impl Gl for GlFns {
         unsafe {
             self.ffi_gl_.ShaderSource(shader, pointers.len() as GLsizei,
                                       pointers.as_ptr() as *const *const GLchar, lengths.as_ptr());
         }
         drop(lengths);
         drop(pointers);
     }
 
+    fn tex_buffer(&self, target: GLenum, internal_format: GLenum, buffer: GLuint) {
+        unsafe {
+            self.ffi_gl_.TexBuffer(target, internal_format, buffer);
+        }
+    }
+
     fn read_buffer(&self, mode: GLenum) {
         unsafe {
             self.ffi_gl_.ReadBuffer(mode);
         }
     }
 
     fn read_pixels_into_buffer(&self, x: GLint, y: GLint, width: GLsizei, height: GLsizei,
                                format: GLenum, pixel_type: GLenum, dst_buffer: &mut [u8]) {
@@ -1112,16 +1118,24 @@ impl Gl for GlFns {
     fn get_vertex_attrib_fv(&self, index: GLuint, pname: GLenum) -> Vec<GLfloat> {
         unsafe {
             let mut result = vec![0 as GLfloat; 4];
             self.ffi_gl_.GetVertexAttribfv(index, pname, result.as_mut_ptr());
             return result;
         }
     }
 
+    fn get_vertex_attrib_pointer_v(&self, index: GLuint, pname: GLenum) -> GLsizeiptr {
+        let mut result = 0 as *mut GLvoid;
+        unsafe {
+            self.ffi_gl_.GetVertexAttribPointerv(index, pname, &mut result)
+        }
+        result as GLsizeiptr
+    }
+
     fn get_buffer_parameter_iv(&self, target: GLuint, pname: GLenum) -> GLint {
         unsafe {
             let mut result: GLint = 0 as GLint;
             self.ffi_gl_.GetBufferParameteriv(target, pname, &mut result);
             return result;
         }
     }
 
--- a/third_party/rust/gleam/src/gles_fns.rs
+++ b/third_party/rust/gleam/src/gles_fns.rs
@@ -30,16 +30,20 @@ impl Gl for GlesFns {
         unsafe {
             self.ffi_gl_.BufferData(target,
                                     size,
                                     data,
                                     usage);
         }
     }
 
+    fn tex_buffer(&self, _target: GLenum, _internal_format: GLenum, _buffer: GLuint) {
+        panic!("not supported")
+    }
+
     fn buffer_sub_data_untyped(&self, target: GLenum, offset: isize, size: GLsizeiptr, data: *const GLvoid) {
         unsafe {
             self.ffi_gl_.BufferSubData(target,
                                        offset,
                                        size,
                                        data);
         }
     }
@@ -1086,16 +1090,24 @@ impl Gl for GlesFns {
     fn get_vertex_attrib_fv(&self, index: GLuint, pname: GLenum) -> Vec<GLfloat> {
         unsafe {
             let mut result = vec![0 as GLfloat; 4];
             self.ffi_gl_.GetVertexAttribfv(index, pname, result.as_mut_ptr());
             return result;
         }
     }
 
+    fn get_vertex_attrib_pointer_v(&self, index: GLuint, pname: GLenum) -> GLsizeiptr {
+        let mut result = 0 as *mut GLvoid;
+        unsafe {
+            self.ffi_gl_.GetVertexAttribPointerv(index, pname, &mut result)
+        }
+        result as GLsizeiptr
+    }
+
     fn get_buffer_parameter_iv(&self, target: GLuint, pname: GLenum) -> GLint {
         unsafe {
             let mut result: GLint = 0 as GLint;
             self.ffi_gl_.GetBufferParameteriv(target, pname, &mut result);
             return result;
         }
     }
 
--- a/third_party/rust/plane-split/.cargo-checksum.json
+++ b/third_party/rust/plane-split/.cargo-checksum.json
@@ -1,1 +1,1 @@
-{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"f9b1ca6ae27d1c18215265024629a8960c31379f206d9ed20f64e0b2dcf79805",".travis.yml":"b76d49f66f842c652d40825c67791352364a6b6bbb7d8d1009f2ac79eb413e66","Cargo.toml":"b7991659a5ad212104ef390baee63066645a20af5b7d0891bd9166b38cab1f7d","LICENSE":"b946744aeda89b467929585fe8eeb5461847695220c1b168fb375d8abd4ea3d0","README.md":"62f99334c17b451342fcea70eb1cc27b26612616b7c1a58fab50dd493f766f32","benches/split.rs":"49befe22321f34280106fdea53d93644b7757873407376247f86f9d55d09b4ab","src/bsp.rs":"6ec056292b3499f16ad520af7b0480471e34c136bb29429c3c4e1d68efd42a57","src/lib.rs":"368c320c9d4f4bb788b3fb5c0b0e0a6b9756d0da02035539e845639ab9bff80e","src/naive.rs":"8c0e93fcdc30e90fa9da4a032a55fe58619e8e8928000583575eb2f3e001e331","tests/main.rs":"7177353c68b31a78cda67da0485b45d8551961b36e23121d549aa535e68dd287","tests/split.rs":"a4681a788f9a9a515d4084d97ba33406a54bc0725711ade9fc955348d1703368"},"package":"a05e1e40e37630095627acfd2c7c6cf259e8b4f4ef4f01b2adf2a35331e45975"}
\ No newline at end of file
+{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"f9b1ca6ae27d1c18215265024629a8960c31379f206d9ed20f64e0b2dcf79805",".travis.yml":"b76d49f66f842c652d40825c67791352364a6b6bbb7d8d1009f2ac79eb413e66","Cargo.toml":"3100d538a6cd25f84ae7d502f37ec09603f4a7fb902e46583df5bdbb50b73538","LICENSE":"b946744aeda89b467929585fe8eeb5461847695220c1b168fb375d8abd4ea3d0","README.md":"62f99334c17b451342fcea70eb1cc27b26612616b7c1a58fab50dd493f766f32","benches/split.rs":"49befe22321f34280106fdea53d93644b7757873407376247f86f9d55d09b4ab","src/bsp.rs":"83f1a84b4dda5668727eb27070f22676d1f77ab9eaff0c777b32651f75ecf5b6","src/lib.rs":"c6bdf6ac6db519b79b3dbf0d4805bbba3e761e0d5cf19b4ae5388a5b93ff7454","src/naive.rs":"c7e50de094d24b609f03e3dc9599bb040a6baef84bce93ffab7af7f049fb805b","tests/main.rs":"915d915c5ca82befef82f1604cc974b072238a8d69043341589d8dd569d412d3","tests/split.rs":"a4681a788f9a9a515d4084d97ba33406a54bc0725711ade9fc955348d1703368"},"package":"8b3624c9e5e728dcc6347bde5762406b0f0707bea527d585e8f7b6ac44fdd33a"}
\ No newline at end of file
--- a/third_party/rust/plane-split/Cargo.toml
+++ b/third_party/rust/plane-split/Cargo.toml
@@ -1,15 +1,15 @@
 [package]
 name = "plane-split"
-version = "0.2.1"
+version = "0.3.0"
 description = "Plane splitting"
 authors = ["Dzmitry Malyshau <kvark@mozilla.com>"]
 license = "MPL-2.0"
 repository = "https://github.com/kvark/plane-split"
 keywords = ["geometry", "math"]
 documentation = "https://docs.rs/plane-split"
 
 [dependencies]
-binary-space-partition = "0.1.1"
+binary-space-partition = "0.1.2"
 euclid = "0.11.2"
 log = "0.3"
 num-traits = {version = "0.1.37", default-features = false}
--- a/third_party/rust/plane-split/src/bsp.rs
+++ b/third_party/rust/plane-split/src/bsp.rs
@@ -1,29 +1,34 @@
 use binary_space_partition::{BspNode, Plane, PlaneCut};
 use euclid::TypedPoint3D;
 use euclid::approxeq::ApproxEq;
 use num_traits::{Float, One, Zero};
 use std::{fmt, ops};
 use {Intersection, Polygon, Splitter};
 
 
-impl<T: Copy + fmt::Debug + PartialOrd + ApproxEq<T> +
+impl<T, U> Plane for Polygon<T, U> where
+    T: Copy + fmt::Debug + ApproxEq<T> +
         ops::Sub<T, Output=T> + ops::Add<T, Output=T> +
         ops::Mul<T, Output=T> + ops::Div<T, Output=T> +
         Zero + One + Float,
-     U> Plane for Polygon<T, U> {
+    U: fmt::Debug,
+{
+    fn cut(&self, mut plane: Self) -> PlaneCut<Self> {
+        debug!("\tCutting anchor {}", plane.anchor);
+        let dist = self.signed_distance_sum_to(&plane);
 
-    fn cut(&self, mut plane: Self) -> PlaneCut<Self> {
-        let dist = self.signed_distance_sum_to(&plane);
         match self.intersect(&plane) {
             Intersection::Coplanar if dist.approx_eq(&T::zero()) => {
+                debug!("\t\tcoplanar and matching");
                 PlaneCut::Sibling(plane)
             }
             Intersection::Coplanar | Intersection::Outside => {
+                debug!("\t\tcoplanar at {:?}", dist);
                 if dist > T::zero() {
                     PlaneCut::Cut {
                         front: vec![plane],
                         back: vec![],
                     }
                 } else {
                     PlaneCut::Cut {
                         front: vec![],
@@ -38,16 +43,18 @@ impl<T: Copy + fmt::Debug + PartialOrd +
 
                 for sub in Some(plane).into_iter().chain(res_add1).chain(res_add2) {
                     if self.signed_distance_sum_to(&sub) > T::zero() {
                         front.push(sub)
                     } else {
                         back.push(sub)
                     }
                 }
+                debug!("\t\tcut across {:?} by {} in front and {} in back",
+                    line, front.len(), back.len());
 
                 PlaneCut::Cut {
                     front: front,
                     back: back,
                 }
             },
         }
     }
@@ -69,33 +76,36 @@ impl<T, U> BspSplitter<T, U> {
     pub fn new() -> Self {
         BspSplitter {
             tree: BspNode::new(),
             result: Vec::new(),
         }
     }
 }
 
-impl<T: Copy + fmt::Debug + PartialOrd + ApproxEq<T> +
+impl<T, U> Splitter<T, U> for BspSplitter<T, U> where
+    T: Copy + fmt::Debug + ApproxEq<T> +
         ops::Sub<T, Output=T> + ops::Add<T, Output=T> +
         ops::Mul<T, Output=T> + ops::Div<T, Output=T> +
         Zero + One + Float,
-     U> Splitter<T, U> for BspSplitter<T, U> {
-
+    U: fmt::Debug,
+{
     fn reset(&mut self) {
         self.tree = BspNode::new();
     }
 
     fn add(&mut self, poly: Polygon<T, U>) {
         self.tree.insert(poly);
     }
 
     fn sort(&mut self, view: TypedPoint3D<T, U>) -> &[Polygon<T, U>] {
+        //debug!("\t\ttree before sorting {:?}", self.tree);
         let poly = Polygon {
             points: [TypedPoint3D::zero(); 4],
-            normal: view,
+            normal: -view, //Note: BSP `order()` is back to front
             offset: T::zero(),
             anchor: 0,
         };
+        self.result.clear();
         self.tree.order(&poly, &mut self.result);
         &self.result
     }
 }
--- a/third_party/rust/plane-split/src/lib.rs
+++ b/third_party/rust/plane-split/src/lib.rs
@@ -23,40 +23,51 @@ use std::{fmt, mem, ops};
 use euclid::{Point2D, TypedMatrix4D, TypedPoint3D, TypedRect};
 use euclid::approxeq::ApproxEq;
 use euclid::trig::Trig;
 use num_traits::{Float, One, Zero};
 
 pub use self::bsp::BspSplitter;
 pub use self::naive::NaiveSplitter;
 
+
+fn is_zero<T>(value: T) -> bool where
+    T: Copy + Zero + ApproxEq<T> + ops::Mul<T, Output=T> {
+    //HACK: this is rough, but the original Epsilon is too strict
+    (value * value).approx_eq(&T::zero())
+}
+
+fn is_zero_vec<T, U>(vec: TypedPoint3D<T, U>) -> bool where
+   T: Copy + Zero + ApproxEq<T> +
+      ops::Add<T, Output=T> + ops::Sub<T, Output=T> + ops::Mul<T, Output=T> {
+    vec.dot(vec).approx_eq(&T::zero())
+}
+
 /// A generic line.
 #[derive(Debug)]
 pub struct Line<T, U> {
     /// Arbitrary point on the line.
     pub origin: TypedPoint3D<T, U>,
     /// Normalized direction of the line.
     pub dir: TypedPoint3D<T, U>,
 }
 
-impl<
-    T: Copy + One + Zero + PartialEq + ApproxEq<T> +
-       ops::Add<T, Output=T> + ops::Sub<T, Output=T> + ops::Mul<T, Output=T>,
-    U,
-> Line<T, U> {
+impl<T, U> Line<T, U> where
+    T: Copy + One + Zero + ApproxEq<T> +
+       ops::Add<T, Output=T> + ops::Sub<T, Output=T> + ops::Mul<T, Output=T>
+{
     /// Check if the line has consistent parameters.
     pub fn is_valid(&self) -> bool {
-        self.dir.dot(self.dir).approx_eq(&T::one())
+        is_zero(self.dir.dot(self.dir) - T::one())
     }
     /// Check if two lines match each other.
     pub fn matches(&self, other: &Self) -> bool {
         let diff = self.origin - other.origin;
-        let zero = TypedPoint3D::zero();
-        self.dir.cross(other.dir).approx_eq(&zero) &&
-        self.dir.cross(diff).approx_eq(&zero)
+        is_zero_vec(self.dir.cross(other.dir)) &&
+        is_zero_vec(self.dir.cross(diff))
     }
 }
 
 /// A convex flat polygon with 4 points, defined by equation:
 /// dot(v, normal) + offset = 0
 #[derive(Debug, PartialEq)]
 pub struct Polygon<T, U> {
     /// Points making the polygon.
@@ -86,22 +97,25 @@ impl<T: Clone, U> Clone for Polygon<T, U
 }
 
 /// The projection of a `Polygon` on a line.
 pub struct LineProjection<T> {
     /// Projected value of each point in the polygon.
     pub markers: [T; 4],
 }
 
-impl<T: Copy + PartialOrd + ops::Sub<T, Output=T> + ops::Add<T, Output=T>> LineProjection<T> {
+impl<T> LineProjection<T> where
+    T : Copy + PartialOrd + ops::Sub<T, Output=T> + ops::Add<T, Output=T>
+{
     /// Get the min/max of the line projection markers.
     pub fn get_bounds(&self) -> (T, T) {
         let (mut a, mut b, mut c, mut d) = (self.markers[0], self.markers[1], self.markers[2], self.markers[3]);
         // bitonic sort of 4 elements
         // we could not just use `min/max` since they require `Ord` bound
+        //TODO: make it nicer
         if a > c {
             mem::swap(&mut a, &mut c);
         }
         if b > d {
             mem::swap(&mut b, &mut d);
         }
         if a > b {
             mem::swap(&mut a, &mut b);
@@ -151,22 +165,23 @@ impl<T> Intersection<T> {
     pub fn is_inside(&self) -> bool {
         match *self {
             Intersection::Inside(_) => true,
             _ => false,
         }
     }
 }
 
-impl<T: Copy + fmt::Debug + PartialOrd + ApproxEq<T> +
+impl<T, U> Polygon<T, U> where
+    T: Copy + fmt::Debug + ApproxEq<T> +
         ops::Sub<T, Output=T> + ops::Add<T, Output=T> +
         ops::Mul<T, Output=T> + ops::Div<T, Output=T> +
         Zero + One + Float,
-     U> Polygon<T, U> {
-
+    U: fmt::Debug,
+{
     /// Construct a polygon from a transformed rectangle.
     pub fn from_transformed_rect<V>(rect: TypedRect<T, V>,
                                     transform: TypedMatrix4D<T, V, U>,
                                     anchor: usize)
                                     -> Polygon<T, U>
     where T: Trig + ops::Neg<Output=T> {
         let points = [
             transform.transform_point3d(&rect.origin.to_3d()),
@@ -232,36 +247,30 @@ impl<T: Copy + fmt::Debug + PartialOrd +
     pub fn signed_distance_sum_to(&self, other: &Self) -> T {
         other.points.iter().fold(T::zero(), |sum, p| {
             sum + self.signed_distance_to(p)
         })
     }
 
     /// Check if all the points are indeed placed on the plane defined by
     /// the normal and offset, and the winding order is consistent.
-    /// The epsion is specified for the plane distance calculations.
-    pub fn is_valid_eps(&self, eps: T) -> bool {
+    pub fn is_valid(&self) -> bool {
         let is_planar = self.points.iter()
-                                   .all(|p| self.signed_distance_to(p).approx_eq_eps(&T::zero(), &eps));
+                                   .all(|p| is_zero(self.signed_distance_to(p)));
         let edges = [self.points[1] - self.points[0],
                      self.points[2] - self.points[1],
                      self.points[3] - self.points[2],
                      self.points[0] - self.points[3]];
         let anchor = edges[3].cross(edges[0]);
         let is_winding = edges.iter()
                               .zip(edges[1..].iter())
                               .all(|(a, &b)| a.cross(b).dot(anchor) >= T::zero());
         is_planar && is_winding
     }
 
-    /// Check validity. Similar to `is_valid_eps` but with default epsilon.
-    pub fn is_valid(&self) -> bool {
-        self.is_valid_eps(T::approx_epsilon())
-    }
-
     /// Check if a convex shape defined by a set of points is completely
     /// outside of this polygon. Merely touching the surface is not
     /// considered an intersection.
     pub fn are_outside(&self, points: &[TypedPoint3D<T, U>]) -> bool {
         let d0 = self.signed_distance_to(&points[0]);
         points[1..].iter()
                    .all(|p| self.signed_distance_to(p) * d0 > T::zero())
     }
@@ -284,27 +293,30 @@ impl<T: Copy + fmt::Debug + PartialOrd +
             ],
         }
     }
 
     /// Compute the line of intersection with another polygon.
     pub fn intersect(&self, other: &Self) -> Intersection<Line<T, U>> {
         if self.are_outside(&other.points) || other.are_outside(&self.points) {
             // one is completely outside the other
+            debug!("\t\toutside");
             return Intersection::Outside
         }
         let cross_dir = self.normal.cross(other.normal);
         if cross_dir.dot(cross_dir) < T::approx_epsilon() {
             // polygons are co-planar
+            debug!("\t\tcoplanar");
             return Intersection::Coplanar
         }
         let self_proj = self.project_on(&cross_dir);
         let other_proj = other.project_on(&cross_dir);
         if !self_proj.intersect(&other_proj) {
             // projections on the line don't intersect
+            debug!("\t\tprojection outside");
             return Intersection::Outside
         }
         // compute any point on the intersection between planes
         // (n1, v) + d1 = 0
         // (n2, v) + d2 = 0
         // v = a*n1/w + b*n2/w; w = (n1, n2)
         // v = (d2*w - d1) / (1 - w*w) * n1 - (d2 - d1*w) / (1 - w*w) * n2
         let w = self.normal.dot(other.normal);
@@ -316,19 +328,22 @@ impl<T: Copy + fmt::Debug + PartialOrd +
             dir: cross_dir.normalize(),
         })
     }
 
     /// Split the polygon along the specified `Line`. Will do nothing if the line
     /// doesn't belong to the polygon plane.
     pub fn split(&mut self, line: &Line<T, U>)
                  -> (Option<Polygon<T, U>>, Option<Polygon<T, U>>) {
+        debug!("\tSplitting");
         // check if the cut is within the polygon plane first
-        if !self.normal.dot(line.dir).approx_eq(&T::zero()) ||
-           !self.signed_distance_to(&line.origin).approx_eq(&T::zero()) {
+        if !is_zero(self.normal.dot(line.dir)) ||
+           !is_zero(self.signed_distance_to(&line.origin)) {
+            debug!("\t\tDoes not belong to the plane, normal dot={:?}, origin distance={:?}",
+                self.normal.dot(line.dir), self.signed_distance_to(&line.origin));
             return (None, None)
         }
         // compute the intersection points for each edge
         let mut cuts = [None; 4];
         for ((&b, &a), cut) in self.points.iter()
                                           .cycle()
                                           .skip(1)
                                           .zip(self.points.iter())
@@ -352,17 +367,19 @@ impl<T: Copy + fmt::Debug + PartialOrd +
         let first = match cuts.iter().position(|c| c.is_some()) {
             Some(pos) => pos,
             None => return (None, None),
         };
         let second = match cuts[first+1 ..].iter().position(|c| c.is_some()) {
             Some(pos) => first + 1 + pos,
             None => return (None, None),
         };
+        debug!("\t\tReached complex case [{}, {}]", first, second);
         //TODO: can be optimized for when the polygon has a redundant 4th vertex
+        //TODO: can be simplified greatly if only working with triangles
         let (a, b) = (cuts[first].unwrap(), cuts[second].unwrap());
         match second-first {
             2 => {
                 let mut other_points = self.points;
                 other_points[first] = a;
                 other_points[(first+3) % 4] = b;
                 self.points[first+1] = a;
                 self.points[first+2] = b;
@@ -410,17 +427,17 @@ impl<T: Copy + fmt::Debug + PartialOrd +
                 (Some(poly1), Some(poly2))
             }
             _ => panic!("Unexpected indices {} {}", first, second),
         }
     }
 }
 
 
-/// Generic plane splitter interface.
+/// Generic plane splitter interface
 pub trait Splitter<T, U> {
     /// Reset the splitter results.
     fn reset(&mut self);
 
     /// Add a new polygon and return a slice of the subdivisions
     /// that avoid collision with any of the previously added polygons.
     fn add(&mut self, Polygon<T, U>);
 
--- a/third_party/rust/plane-split/src/naive.rs
+++ b/third_party/rust/plane-split/src/naive.rs
@@ -29,31 +29,32 @@ impl<T, U> NaiveSplitter<T, U> {
 fn intersect_across<T, U>(a: &Polygon<T, U>, b: &Polygon<T, U>,
                           dir: TypedPoint3D<T, U>)
                           -> TypedPoint3D<T, U>
 where
     T: Copy + fmt::Debug + PartialOrd + ApproxEq<T> +
         ops::Sub<T, Output=T> + ops::Add<T, Output=T> +
         ops::Mul<T, Output=T> + ops::Div<T, Output=T> +
         Zero + One + Float,
+    U: fmt::Debug,
 {
     let pa = a.project_on(&dir).get_bounds();
     let pb = b.project_on(&dir).get_bounds();
     let pmin = pa.0.max(pb.0);
     let pmax = pa.1.min(pb.1);
     let k = (pmin + pmax) / (T::one() + T::one());
     debug!("\t\tIntersection pa {:?} pb {:?} k {:?}", pa, pb, k);
     dir * k
 }
 
 fn partial_sort_by<T, F>(array: &mut [T], fun: F) where
     F: Fn(&T, &T) -> Ordering,
     T: fmt::Debug,
 {
-    debug!("\nSorting");
+    debug!("Sorting");
     if array.is_empty() {
         return
     }
     for i in 0 .. array.len() - 1 {
         let mut up_start = array.len();
         // placement is: [i, ... equals ..., up_start, ... greater ..., j]
         // if this condition fails, everything to the right is greater
         'find_smallest: while i + 1 != up_start {
@@ -147,18 +148,17 @@ impl<
             }
         };
         // do the orthogonalization
         let axis_x = view.cross(axis_pre);
         let axis_y = view.cross(axis_x);
         debug!("Chosen axis {:?} {:?}", axis_x, axis_y);
         // sort everything
         partial_sort_by(&mut self.result, |a, b| {
-            debug!("\t\t{:?}", a);
-            debug!("\t\t{:?}", b);
+            debug!("\t\t{:?}\n\t\t{:?}", a, b);
             //TODO: proper intersection
             // compute the origin
             let comp_x = intersect_across(a, b, axis_x);
             let comp_y = intersect_across(a, b, axis_y);
             // line that tries to intersect both
             let line = Line {
                 origin: comp_x + comp_y,
                 dir: view,
--- a/third_party/rust/plane-split/tests/main.rs
+++ b/third_party/rust/plane-split/tests/main.rs
@@ -54,17 +54,17 @@ fn valid() {
 
 #[test]
 fn from_transformed_rect() {
     let rect: TypedRect<f32, ()> = TypedRect::new(TypedPoint2D::new(10.0, 10.0), TypedSize2D::new(20.0, 30.0));
     let transform: TypedMatrix4D<f32, (), ()> =
         TypedMatrix4D::create_rotation(0.5f32.sqrt(), 0.0, 0.5f32.sqrt(), Radians::new(5.0))
         .pre_translated(0.0, 0.0, 10.0);
     let poly = Polygon::from_transformed_rect(rect, transform, 0);
-    assert!(poly.is_valid_eps(1e-5));
+    assert!(poly.is_valid());
 }
 
 #[test]
 fn untransform_point() {
     let poly: Polygon<f32, ()> = Polygon {
         points: [
             TypedPoint3D::new(0.0, 0.0, 0.0),
             TypedPoint3D::new(0.5, 1.0, 0.0),
deleted file mode 100644
--- a/third_party/rust/threadpool/.cargo-checksum.json
+++ /dev/null
@@ -1,1 +0,0 @@
-{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"f9b1ca6ae27d1c18215265024629a8960c31379f206d9ed20f64e0b2dcf79805",".travis.yml":"756d519d94a7e5d43ef561988fee0c379ffa886a8f583be116cd494aa51aa4ef","CHANGES.md":"1536216b7036f7eea56e76f1c7e1eb5abc781ab958ebb4e1832fe3cd51e06e53","Cargo.toml":"221d91ce4e5478a63ef109f8ca8a671fba0100dd7b6b0cde602423841c170f65","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"0eef0e011513546062a7907bbbfe79ef4071562036175974c082a1f6d1c0b962","lib.rs":"6c09f54c161346f0b36220823eff6c58c07e9438afa06e90ffaae222168e1397"},"package":"59f6d3eff89920113dac9db44dde461d71d01e88a5b57b258a0466c32b5d7fe1"}
\ No newline at end of file
deleted file mode 100644
deleted file mode 100644
--- a/third_party/rust/threadpool/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-target
-Cargo.lock
deleted file mode 100644
--- a/third_party/rust/threadpool/.travis.yml
+++ /dev/null
@@ -1,21 +0,0 @@
-sudo: false
-language: rust
-cache: cargo
-rust:
-  - 1.9.0
-  - beta
-  - nightly
-before_script:
-  - pip install 'travis-cargo<0.2' --user && export PATH=$HOME/.local/bin:$PATH
-script:
-  - cargo build --verbose
-  - cargo test --verbose
-  - cargo doc
-after_success:
-  - travis-cargo --only nightly doc-upload
-notifications:
-  email:
-    on_success: never
-env:
-  global:
-    secure: Zv3wjS0darxSMdEa3R0rHLgbUmHlfKFbdzNJ5BMni7NV9ZGmzZAzKRbRSPjNxmhaWBT0fWgRA/eSxIk1n3bHXs4XWaM0EJmC9Oo3boNUCi7AgmwzHdN0T1fct95p6AYfNe0LZh88mbM98LxPdRHc+hVIZ3ah2Fyb6kDH2YKmvDo=
deleted file mode 100644
--- a/third_party/rust/threadpool/CHANGES.md
+++ /dev/null
@@ -1,36 +0,0 @@
-# Changes
-
-## 1.3.2
-
-* [Enable `#[deprecated]` doc, requires Rust 1.9](https://github.com/frewsxcv/rust-threadpool/pull/38)
-
-## 1.3.1
-
-* [Implement std::fmt::Debug for ThreadPool](https://github.com/frewsxcv/rust-threadpool/pull/50)
-
-## 1.3.0
-
-* [Add barrier sync example](https://github.com/frewsxcv/rust-threadpool/pull/35)
-* [Rename `threads` method/params to `num_threads`, deprecate old usage](https://github.com/frewsxcv/rust-threadpool/pull/34)
-* [Stop using deprecated `sleep_ms` function in tests](https://github.com/frewsxcv/rust-threadpool/pull/33)
-
-## 1.2.0
-
-* [New method to determine number of panicked threads](https://github.com/frewsxcv/rust-threadpool/pull/31)
-
-## 1.1.1
-
-* [Silence warning related to unused result](https://github.com/frewsxcv/rust-threadpool/pull/30)
-* [Minor doc improvements](https://github.com/frewsxcv/rust-threadpool/pull/30)
-
-## 1.1.0
-
-* [New constructor for specifying thread names for a thread pool](https://github.com/frewsxcv/rust-threadpool/pull/28)
-
-## 1.0.2
-
-* [Use atomic counters](https://github.com/frewsxcv/rust-threadpool/pull/25)
-
-## 1.0.1
-
-* [Switch active_count from Mutex to RwLock for more performance](https://github.com/frewsxcv/rust-threadpool/pull/23)
deleted file mode 100644
--- a/third_party/rust/threadpool/Cargo.toml
+++ /dev/null
@@ -1,16 +0,0 @@
-[package]
-
-name = "threadpool"
-version = "1.3.2"
-authors = ["The Rust Project Developers", "Corey Farwell <coreyf@rwell.org>"]
-license = "MIT/Apache-2.0"
-readme = "README.md"
-repository = "https://github.com/frewsxcv/rust-threadpool"
-homepage = "https://github.com/frewsxcv/rust-threadpool"
-documentation = "https://frewsxcv.github.io/rust-threadpool"
-description = """
-A thread pool for running a number of jobs on a fixed set of worker threads.
-"""
-
-[lib]
-path = "lib.rs"
deleted file mode 100644
--- a/third_party/rust/threadpool/LICENSE-APACHE
+++ /dev/null
@@ -1,201 +0,0 @@
-                              Apache License
-                        Version 2.0, January 2004
-                     http://www.apache.org/licenses/
-
-TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-1. Definitions.
-
-   "License" shall mean the terms and conditions for use, reproduction,
-   and distribution as defined by Sections 1 through 9 of this document.
-
-   "Licensor" shall mean the copyright owner or entity authorized by
-   the copyright owner that is granting the License.
-
-   "Legal Entity" shall mean the union of the acting entity and all
-   other entities that control, are controlled by, or are under common
-   control with that entity. For the purposes of this definition,
-   "control" means (i) the power, direct or indirect, to cause the
-   direction or management of such entity, whether by contract or
-   otherwise, or (ii) ownership of fifty percent (50%) or more of the
-   outstanding shares, or (iii) beneficial ownership of such entity.
-
-   "You" (or "Your") shall mean an individual or Legal Entity
-   exercising permissions granted by this License.
-
-   "Source" form shall mean the preferred form for making modifications,
-   including but not limited to software source code, documentation
-   source, and configuration files.
-
-   "Object" form shall mean any form resulting from mechanical
-   transformation or translation of a Source form, including but
-   not limited to compiled object code, generated documentation,
-   and conversions to other media types.
-
-   "Work" shall mean the work of authorship, whether in Source or
-   Object form, made available under the License, as indicated by a
-   copyright notice that is included in or attached to the work
-   (an example is provided in the Appendix below).
-
-   "Derivative Works" shall mean any work, whether in Source or Object
-   form, that is based on (or derived from) the Work and for which the
-   editorial revisions, annotations, elaborations, or other modifications
-   represent, as a whole, an original work of authorship. For the purposes
-   of this License, Derivative Works shall not include works that remain
-   separable from, or merely link (or bind by name) to the interfaces of,
-   the Work and Derivative Works thereof.
-
-   "Contribution" shall mean any work of authorship, including
-   the original version of the Work and any modifications or additions
-   to that Work or Derivative Works thereof, that is intentionally
-   submitted to Licensor for inclusion in the Work by the copyright owner
-   or by an individual or Legal Entity authorized to submit on behalf of
-   the copyright owner. For the purposes of this definition, "submitted"
-   means any form of electronic, verbal, or written communication sent
-   to the Licensor or its representatives, including but not limited to
-   communication on electronic mailing lists, source code control systems,
-   and issue tracking systems that are managed by, or on behalf of, the
-   Licensor for the purpose of discussing and improving the Work, but
-   excluding communication that is conspicuously marked or otherwise
-   designated in writing by the copyright owner as "Not a Contribution."
-
-   "Contributor" shall mean Licensor and any individual or Legal Entity
-   on behalf of whom a Contribution has been received by Licensor and
-   subsequently incorporated within the Work.
-
-2. Grant of Copyright License. Subject to the terms and conditions of
-   this License, each Contributor hereby grants to You a perpetual,
-   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-   copyright license to reproduce, prepare Derivative Works of,
-   publicly display, publicly perform, sublicense, and distribute the
-   Work and such Derivative Works in Source or Object form.
-
-3. Grant of Patent License. Subject to the terms and conditions of
-   this License, each Contributor hereby grants to You a perpetual,
-   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-   (except as stated in this section) patent license to make, have made,
-   use, offer to sell, sell, import, and otherwise transfer the Work,
-   where such license applies only to those patent claims licensable
-   by such Contributor that are necessarily infringed by their
-   Contribution(s) alone or by combination of their Contribution(s)
-   with the Work to which such Contribution(s) was submitted. If You
-   institute patent litigation against any entity (including a
-   cross-claim or counterclaim in a lawsuit) alleging that the Work
-   or a Contribution incorporated within the Work constitutes direct
-   or contributory patent infringement, then any patent licenses
-   granted to You under this License for that Work shall terminate
-   as of the date such litigation is filed.
-
-4. Redistribution. You may reproduce and distribute copies of the
-   Work or Derivative Works thereof in any medium, with or without
-   modifications, and in Source or Object form, provided that You
-   meet the following conditions:
-
-   (a) You must give any other recipients of the Work or
-       Derivative Works a copy of this License; and
-
-   (b) You must cause any modified files to carry prominent notices
-       stating that You changed the files; and
-
-   (c) You must retain, in the Source form of any Derivative Works
-       that You distribute, all copyright, patent, trademark, and
-       attribution notices from the Source form of the Work,
-       excluding those notices that do not pertain to any part of
-       the Derivative Works; and
-
-   (d) If the Work includes a "NOTICE" text file as part of its
-       distribution, then any Derivative Works that You distribute must
-       include a readable copy of the attribution notices contained
-       within such NOTICE file, excluding those notices that do not
-       pertain to any part of the Derivative Works, in at least one
-       of the following places: within a NOTICE text file distributed
-       as part of the Derivative Works; within the Source form or
-       documentation, if provided along with the Derivative Works; or,
-       within a display generated by the Derivative Works, if and
-       wherever such third-party notices normally appear. The contents
-       of the NOTICE file are for informational purposes only and
-       do not modify the License. You may add Your own attribution
-       notices within Derivative Works that You distribute, alongside
-       or as an addendum to the NOTICE text from the Work, provided
-       that such additional attribution notices cannot be construed
-       as modifying the License.
-
-   You may add Your own copyright statement to Your modifications and
-   may provide additional or different license terms and conditions
-   for use, reproduction, or distribution of Your modifications, or
-   for any such Derivative Works as a whole, provided Your use,
-   reproduction, and distribution of the Work otherwise complies with
-   the conditions stated in this License.
-
-5. Submission of Contributions. Unless You explicitly state otherwise,
-   any Contribution intentionally submitted for inclusion in the Work
-   by You to the Licensor shall be under the terms and conditions of
-   this License, without any additional terms or conditions.
-   Notwithstanding the above, nothing herein shall supersede or modify
-   the terms of any separate license agreement you may have executed
-   with Licensor regarding such Contributions.
-
-6. Trademarks. This License does not grant permission to use the trade
-   names, trademarks, service marks, or product names of the Licensor,
-   except as required for reasonable and customary use in describing the
-   origin of the Work and reproducing the content of the NOTICE file.
-
-7. Disclaimer of Warranty. Unless required by applicable law or
-   agreed to in writing, Licensor provides the Work (and each
-   Contributor provides its Contributions) on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-   implied, including, without limitation, any warranties or conditions
-   of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-   PARTICULAR PURPOSE. You are solely responsible for determining the
-   appropriateness of using or redistributing the Work and assume any
-   risks associated with Your exercise of permissions under this License.
-
-8. Limitation of Liability. In no event and under no legal theory,
-   whether in tort (including negligence), contract, or otherwise,
-   unless required by applicable law (such as deliberate and grossly
-   negligent acts) or agreed to in writing, shall any Contributor be
-   liable to You for damages, including any direct, indirect, special,
-   incidental, or consequential damages of any character arising as a
-   result of this License or out of the use or inability to use the
-   Work (including but not limited to damages for loss of goodwill,
-   work stoppage, computer failure or malfunction, or any and all
-   other commercial damages or losses), even if such Contributor
-   has been advised of the possibility of such damages.
-
-9. Accepting Warranty or Additional Liability. While redistributing
-   the Work or Derivative Works thereof, You may choose to offer,
-   and charge a fee for, acceptance of support, warranty, indemnity,
-   or other liability obligations and/or rights consistent with this
-   License. However, in accepting such obligations, You may act only
-   on Your own behalf and on Your sole responsibility, not on behalf
-   of any other Contributor, and only if You agree to indemnify,
-   defend, and hold each Contributor harmless for any liability
-   incurred by, or claims asserted against, such Contributor by reason
-   of your accepting any such warranty or additional liability.
-
-END OF TERMS AND CONDITIONS
-
-APPENDIX: How to apply the Apache License to your work.
-
-   To apply the Apache License to your work, attach the following
-   boilerplate notice, with the fields enclosed by brackets "[]"
-   replaced with your own identifying information. (Don't include
-   the brackets!)  The text should be enclosed in the appropriate
-   comment syntax for the file format. We also recommend that a
-   file or class name and description of purpose be included on the
-   same "printed page" as the copyright notice for easier
-   identification within third-party archives.
-
-Copyright [yyyy] [name of copyright owner]
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-	http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
deleted file mode 100644
--- a/third_party/rust/threadpool/LICENSE-MIT
+++ /dev/null
@@ -1,25 +0,0 @@
-Copyright (c) 2014 The Rust Project Developers
-
-Permission is hereby granted, free of charge, to any
-person obtaining a copy of this software and associated
-documentation files (the "Software"), to deal in the
-Software without restriction, including without
-limitation the rights to use, copy, modify, merge,
-publish, distribute, sublicense, and/or sell copies of
-the Software, and to permit persons to whom the Software
-is furnished to do so, subject to the following
-conditions:
-
-The above copyright notice and this permission notice
-shall be included in all copies or substantial portions
-of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
-ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
-TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
-SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
-IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-DEALINGS IN THE SOFTWARE.
deleted file mode 100644
--- a/third_party/rust/threadpool/README.md
+++ /dev/null
@@ -1,48 +0,0 @@
-# threadpool
-
-A thread pool for running a number of jobs on a fixed set of worker threads.
-
-[![Build Status](https://travis-ci.org/frewsxcv/rust-threadpool.svg?branch=master)](https://travis-ci.org/frewsxcv/rust-threadpool)
-
-[Documentation](https://frewsxcv.github.io/rust-threadpool/threadpool/index.html)
-
-## Usage
-
-Add this to your `Cargo.toml`:
-
-```toml
-[dependencies]
-threadpool = "1.0"
-```
-
-and this to your crate root:
-
-```rust
-extern crate threadpool;
-```
-
-## Minimal requirements
-
-This crate requires Rust >= 1.9.0
-
-## Similar libraries
-
-* [rust-scoped-pool](http://github.com/reem/rust-scoped-pool)
-* [scoped-threadpool-rs](https://github.com/Kimundi/scoped-threadpool-rs)
-* [crossbeam](https://github.com/aturon/crossbeam)
-
-## License
-
-Licensed under either of
-
- * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
- * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
-
-at your option.
-
-### Contribution
-
-Unless you explicitly state otherwise, any contribution intentionally
-submitted for inclusion in the work by you, as defined in the Apache-2.0
-license, shall be dual licensed as above, without any additional terms or
-conditions.
deleted file mode 100644
--- a/third_party/rust/threadpool/lib.rs
+++ /dev/null
@@ -1,646 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-//! A thread pool used to execute functions in parallel.
-//!
-//! Spawns a specified number of worker threads and replenishes the pool if any worker threads
-//! panic.
-//!
-//! # Examples
-//!
-//! ## Syncronized with a channel
-//!
-//! Every thread sends one message over the channel, which then is collected with the `take()`.
-//!
-//! ```
-//! use threadpool::ThreadPool;
-//! use std::sync::mpsc::channel;
-//!
-//! let n_workers = 4;
-//! let n_jobs = 8;
-//! let pool = ThreadPool::new(n_workers);
-//!
-//! let (tx, rx) = channel();
-//! for _ in 0..n_jobs {
-//!     let tx = tx.clone();
-//!     pool.execute(move|| {
-//!         tx.send(1).unwrap();
-//!     });
-//! }
-//!
-//! assert_eq!(rx.iter().take(n_jobs).fold(0, |a, b| a + b), 8);
-//! ```
-//!
-//! ## Syncronized with a barrier
-//!
-//! Keep in mind, if you put more jobs in the pool than you have workers,
-//! you will end up with a [deadlock](https://en.wikipedia.org/wiki/Deadlock)
-//! which is [not considered unsafe]
-//! (http://doc.rust-lang.org/reference.html#behavior-not-considered-unsafe).
-//!
-//! ```
-//! use threadpool::ThreadPool;
-//! use std::sync::{Arc, Barrier};
-//! use std::sync::atomic::{AtomicUsize, Ordering};
-//!
-//! // create at least as many workers as jobs or you will deadlock yourself
-//! let n_workers = 42;
-//! let n_jobs = 23;
-//! let pool = ThreadPool::new(n_workers);
-//! let an_atomic = Arc::new(AtomicUsize::new(0));
-//!
-//! // create a barrier that wait all jobs plus the starter thread
-//! let barrier = Arc::new(Barrier::new(n_jobs + 1));
-//! for _ in 0..n_jobs {
-//!     let barrier = barrier.clone();
-//!     let an_atomic = an_atomic.clone();
-//!
-//!     pool.execute(move|| {
-//!         // do the heavy work
-//!         an_atomic.fetch_add(1, Ordering::Relaxed);
-//!
-//!         // then wait for the other threads
-//!         barrier.wait();
-//!     });
-//! }
-//!
-//! // wait for the threads to finish the work
-//! barrier.wait();
-//! assert_eq!(an_atomic.load(Ordering::SeqCst), 23);
-//! ```
-
-use std::fmt;
-use std::sync::mpsc::{channel, Sender, Receiver};
-use std::sync::{Arc, Mutex};
-use std::sync::atomic::{AtomicUsize, Ordering};
-use std::thread::{Builder, panicking};
-
-trait FnBox {
-    fn call_box(self: Box<Self>);
-}
-
-impl<F: FnOnce()> FnBox for F {
-    fn call_box(self: Box<F>) {
-        (*self)()
-    }
-}
-
-type Thunk<'a> = Box<FnBox + Send + 'a>;
-
-struct Sentinel<'a> {
-    name: Option<String>,
-    jobs: &'a Arc<Mutex<Receiver<Thunk<'static>>>>,
-    thread_counter: &'a Arc<AtomicUsize>,
-    thread_count_max: &'a Arc<AtomicUsize>,
-    thread_count_panic: &'a Arc<AtomicUsize>,
-    active: bool,
-}
-
-impl<'a> Sentinel<'a> {
-    fn new(name: Option<String>,
-           jobs: &'a Arc<Mutex<Receiver<Thunk<'static>>>>,
-           thread_counter: &'a Arc<AtomicUsize>,
-           thread_count_max: &'a Arc<AtomicUsize>,
-           thread_count_panic: &'a Arc<AtomicUsize>)
-           -> Sentinel<'a> {
-        Sentinel {
-            name: name,
-            jobs: jobs,
-            thread_counter: thread_counter,
-            thread_count_max: thread_count_max,
-            thread_count_panic: thread_count_panic,
-            active: true,
-        }
-    }
-
-    // Cancel and destroy this sentinel.
-    fn cancel(mut self) {
-        self.active = false;
-    }
-}
-
-impl<'a> Drop for Sentinel<'a> {
-    fn drop(&mut self) {
-        if self.active {
-            self.thread_counter.fetch_sub(1, Ordering::SeqCst);
-            if panicking() {
-                self.thread_count_panic.fetch_add(1, Ordering::SeqCst);
-            }
-            spawn_in_pool(self.name.clone(),
-                          self.jobs.clone(),
-                          self.thread_counter.clone(),
-                          self.thread_count_max.clone(),
-                          self.thread_count_panic.clone())
-        }
-    }
-}
-
-/// Abstraction of a thread pool for basic parallelism.
-#[derive(Clone)]
-pub struct ThreadPool {
-    // How the threadpool communicates with subthreads.
-    //
-    // This is the only such Sender, so when it is dropped all subthreads will
-    // quit.
-    name: Option<String>,
-    jobs: Sender<Thunk<'static>>,
-    job_receiver: Arc<Mutex<Receiver<Thunk<'static>>>>,
-    active_count: Arc<AtomicUsize>,
-    max_count: Arc<AtomicUsize>,
-    panic_count: Arc<AtomicUsize>,
-}
-
-impl ThreadPool {
-    /// Spawns a new thread pool with `num_threads` threads.
-    ///
-    /// # Panics
-    ///
-    /// This function will panic if `num_threads` is 0.
-    pub fn new(num_threads: usize) -> ThreadPool {
-        ThreadPool::new_pool(None, num_threads)
-    }
-
-    /// Spawns a new thread pool with `num_threads` threads. Each thread will have the
-    /// [name][thread name] `name`.
-    ///
-    /// # Panics
-    ///
-    /// This function will panic if `num_threads` is 0.
-    ///
-    /// # Examples
-    ///
-    /// ```rust
-    /// use std::sync::mpsc::sync_channel;
-    /// use std::thread;
-    /// use threadpool::ThreadPool;
-    ///
-    /// let (tx, rx) = sync_channel(0);
-    /// let mut pool = ThreadPool::new_with_name("worker".into(), 2);
-    /// for _ in 0..2 {
-    ///     let tx = tx.clone();
-    ///     pool.execute(move || {
-    ///         let name = thread::current().name().unwrap().to_owned();
-    ///         tx.send(name).unwrap();
-    ///     });
-    /// }
-    ///
-    /// for thread_name in rx.iter().take(2) {
-    ///     assert_eq!("worker", thread_name);
-    /// }
-    /// ```
-    ///
-    /// [thread name]: https://doc.rust-lang.org/std/thread/struct.Thread.html#method.name
-    pub fn new_with_name(name: String, num_threads: usize) -> ThreadPool {
-        ThreadPool::new_pool(Some(name), num_threads)
-    }
-
-    #[inline]
-    fn new_pool(name: Option<String>, num_threads: usize) -> ThreadPool {
-        assert!(num_threads >= 1);
-
-        let (tx, rx) = channel::<Thunk<'static>>();
-        let rx = Arc::new(Mutex::new(rx));
-        let active_count = Arc::new(AtomicUsize::new(0));
-        let max_count = Arc::new(AtomicUsize::new(num_threads));
-        let panic_count = Arc::new(AtomicUsize::new(0));
-
-        // Threadpool threads
-        for _ in 0..num_threads {
-            spawn_in_pool(name.clone(),
-                          rx.clone(),
-                          active_count.clone(),
-                          max_count.clone(),
-                          panic_count.clone());
-        }
-
-        ThreadPool {
-            name: name,
-            jobs: tx,
-            job_receiver: rx.clone(),
-            active_count: active_count,
-            max_count: max_count,
-            panic_count: panic_count,
-        }
-    }
-
-    /// Executes the function `job` on a thread in the pool.
-    pub fn execute<F>(&self, job: F)
-        where F: FnOnce() + Send + 'static
-    {
-        self.jobs.send(Box::new(move || job())).unwrap();
-    }
-
-    /// Returns the number of currently active threads.
-    ///
-    /// # Examples
-    ///
-    /// ```
-    /// use threadpool::ThreadPool;
-    /// use std::time::Duration;
-    /// use std::thread::sleep;
-    ///
-    /// let num_threads = 10;
-    /// let pool = ThreadPool::new(num_threads);
-    /// for _ in 0..num_threads {
-    ///     pool.execute(move || {
-    ///         sleep(Duration::from_secs(5));
-    ///     });
-    /// }
-    /// sleep(Duration::from_secs(1));
-    /// assert_eq!(pool.active_count(), num_threads);
-    /// ```
-    pub fn active_count(&self) -> usize {
-        self.active_count.load(Ordering::Relaxed)
-    }
-
-    /// Returns the number of created threads
-    pub fn max_count(&self) -> usize {
-        self.max_count.load(Ordering::Relaxed)
-    }
-
-    /// Returns the number of panicked threads over the lifetime of the pool.
-    ///
-    /// # Examples
-    ///
-    /// ```
-    /// use threadpool::ThreadPool;
-    /// use std::time::Duration;
-    /// use std::thread::sleep;
-    ///
-    /// let num_threads = 10;
-    /// let pool = ThreadPool::new(num_threads);
-    /// for _ in 0..num_threads {
-    ///     pool.execute(move || {
-    ///         panic!()
-    ///     });
-    /// }
-    /// sleep(Duration::from_secs(1));
-    /// assert_eq!(pool.panic_count(), num_threads);
-    /// ```
-    pub fn panic_count(&self) -> usize {
-        self.panic_count.load(Ordering::Relaxed)
-    }
-
-    /// **Deprecated: Use `ThreadPool::set_num_threads`**
-    #[deprecated(since = "1.3.0", note = "use ThreadPool::set_num_threads")]
-    pub fn set_threads(&mut self, num_threads: usize) {
-        self.set_num_threads(num_threads)
-    }
-
-    /// Sets the number of worker-threads to use as `num_threads`.
-    /// Can be used to change the threadpool size during runtime.
-    /// Will not abort already running or waiting threads.
-    ///
-    /// # Panics
-    ///
-    /// This function will panic if `num_threads` is 0.
-    pub fn set_num_threads(&mut self, num_threads: usize) {
-        assert!(num_threads >= 1);
-        let prev_num_threads = (*self.max_count).swap(num_threads, Ordering::Release);
-        if let Some(num_spawn) = num_threads.checked_sub(prev_num_threads) {
-            // Spawn new threads
-            for _ in 0..num_spawn {
-                spawn_in_pool(self.name.clone(),
-                              self.job_receiver.clone(),
-                              self.active_count.clone(),
-                              self.max_count.clone(),
-                              self.panic_count.clone());
-            }
-        }
-    }
-}
-
-
-impl fmt::Debug for ThreadPool {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f,
-               "ThreadPool {{ name: {:?}, active_count: {}, max_count: {} }}",
-               self.name,
-               self.active_count(),
-               self.max_count())
-    }
-}
-
-
-fn spawn_in_pool(name: Option<String>,
-                 jobs: Arc<Mutex<Receiver<Thunk<'static>>>>,
-                 thread_counter: Arc<AtomicUsize>,
-                 thread_count_max: Arc<AtomicUsize>,
-                 thread_count_panic: Arc<AtomicUsize>) {
-    let mut builder = Builder::new();
-    if let Some(ref name) = name {
-        builder = builder.name(name.clone());
-    }
-    builder.spawn(move || {
-            // Will spawn a new thread on panic unless it is cancelled.
-            let sentinel = Sentinel::new(name,
-                                         &jobs,
-                                         &thread_counter,
-                                         &thread_count_max,
-                                         &thread_count_panic);
-
-            loop {
-                // Shutdown this thread if the pool has become smaller
-                let thread_counter_val = thread_counter.load(Ordering::Acquire);
-                let thread_count_max_val = thread_count_max.load(Ordering::Relaxed);
-                if thread_counter_val >= thread_count_max_val {
-                    break;
-                }
-                let message = {
-                    // Only lock jobs for the time it takes
-                    // to get a job, not run it.
-                    let lock = jobs.lock().unwrap();
-                    lock.recv()
-                };
-
-                let job = match message {
-                    Ok(job) => job,
-                    // The ThreadPool was dropped.
-                    Err(..) => break,
-                };
-                // Do not allow IR around the job execution
-                thread_counter.fetch_add(1, Ordering::SeqCst);
-                job.call_box();
-                thread_counter.fetch_sub(1, Ordering::SeqCst);
-            }
-
-            sentinel.cancel();
-        })
-        .unwrap();
-}
-
-#[cfg(test)]
-mod test {
-    use super::ThreadPool;
-    use std::sync::mpsc::{sync_channel, channel};
-    use std::sync::{Arc, Barrier};
-    use std::thread::{self, sleep};
-    use std::time::Duration;
-
-    const TEST_TASKS: usize = 4;
-
-    #[test]
-    fn test_set_num_threads_increasing() {
-        let new_thread_amount = TEST_TASKS + 8;
-        let mut pool = ThreadPool::new(TEST_TASKS);
-        for _ in 0..TEST_TASKS {
-            pool.execute(move || {
-                loop {
-                    sleep(Duration::from_secs(10))
-                }
-            });
-        }
-        pool.set_num_threads(new_thread_amount);
-        for _ in 0..(new_thread_amount - TEST_TASKS) {
-            pool.execute(move || {
-                loop {
-                    sleep(Duration::from_secs(10))
-                }
-            });
-        }
-        sleep(Duration::from_secs(1));
-        assert_eq!(pool.active_count(), new_thread_amount);
-    }
-
-    #[test]
-    fn test_set_num_threads_decreasing() {
-        let new_thread_amount = 2;
-        let mut pool = ThreadPool::new(TEST_TASKS);
-        for _ in 0..TEST_TASKS {
-            pool.execute(move || {
-                1 + 1;
-            });
-        }
-        pool.set_num_threads(new_thread_amount);
-        for _ in 0..new_thread_amount {
-            pool.execute(move || {
-                loop {
-                    sleep(Duration::from_secs(10))
-                }
-            });
-        }
-        sleep(Duration::from_secs(1));
-        assert_eq!(pool.active_count(), new_thread_amount);
-    }
-
-    #[test]
-    fn test_active_count() {
-        let pool = ThreadPool::new(TEST_TASKS);
-        for _ in 0..TEST_TASKS {
-            pool.execute(move || {
-                loop {
-                    sleep(Duration::from_secs(10))
-                }
-            });
-        }
-        sleep(Duration::from_secs(1));
-        let active_count = pool.active_count();
-        assert_eq!(active_count, TEST_TASKS);
-        let initialized_count = pool.max_count();
-        assert_eq!(initialized_count, TEST_TASKS);
-    }
-
-    #[test]
-    fn test_works() {
-        let pool = ThreadPool::new(TEST_TASKS);
-
-        let (tx, rx) = channel();
-        for _ in 0..TEST_TASKS {
-            let tx = tx.clone();
-            pool.execute(move || {
-                tx.send(1).unwrap();
-            });
-        }
-
-        assert_eq!(rx.iter().take(TEST_TASKS).fold(0, |a, b| a + b), TEST_TASKS);
-    }
-
-    #[test]
-    #[should_panic]
-    fn test_zero_tasks_panic() {
-        ThreadPool::new(0);
-    }
-
-    #[test]
-    fn test_recovery_from_subtask_panic() {
-        let pool = ThreadPool::new(TEST_TASKS);
-
-        // Panic all the existing threads.
-        for _ in 0..TEST_TASKS {
-            pool.execute(move || { panic!() });
-        }
-        sleep(Duration::from_secs(1));
-
-        assert_eq!(pool.panic_count(), TEST_TASKS);
-
-        // Ensure new threads were spawned to compensate.
-        let (tx, rx) = channel();
-        for _ in 0..TEST_TASKS {
-            let tx = tx.clone();
-            pool.execute(move || {
-                tx.send(1).unwrap();
-            });
-        }
-
-        assert_eq!(rx.iter().take(TEST_TASKS).fold(0, |a, b| a + b), TEST_TASKS);
-    }
-
-    #[test]
-    fn test_should_not_panic_on_drop_if_subtasks_panic_after_drop() {
-
-        let pool = ThreadPool::new(TEST_TASKS);
-        let waiter = Arc::new(Barrier::new(TEST_TASKS + 1));
-
-        // Panic all the existing threads in a bit.
-        for _ in 0..TEST_TASKS {
-            let waiter = waiter.clone();
-            pool.execute(move || {
-                waiter.wait();
-                panic!("Ignore this panic, it should!");
-            });
-        }
-
-        drop(pool);
-
-        // Kick off the failure.
-        waiter.wait();
-    }
-
-    #[test]
-    fn test_massive_task_creation() {
-        let test_tasks = 4_200_000;
-
-        let pool = ThreadPool::new(TEST_TASKS);
-        let b0 = Arc::new(Barrier::new(TEST_TASKS + 1));
-        let b1 = Arc::new(Barrier::new(TEST_TASKS + 1));
-
-        let (tx, rx) = channel();
-
-        for i in 0..test_tasks {
-            let tx = tx.clone();
-            let (b0, b1) = (b0.clone(), b1.clone());
-
-            pool.execute(move || {
-
-                // Wait until the pool has been filled once.
-                if i < TEST_TASKS {
-                    b0.wait();
-                    // wait so the pool can be measured
-                    b1.wait();
-                }
-
-                tx.send(1).is_ok();
-            });
-        }
-
-        b0.wait();
-        assert_eq!(pool.active_count(), TEST_TASKS);
-        b1.wait();
-
-        assert_eq!(rx.iter().take(test_tasks).fold(0, |a, b| a + b), test_tasks);
-        // `iter().take(test_tasks).fold` may be faster than the last thread finishing itself, so
-        // values of 0 or 1 are ok.
-        let atomic_active_count = pool.active_count();
-        assert!(atomic_active_count <= 1, "atomic_active_count: {}", atomic_active_count);
-    }
-
-    #[test]
-    fn test_shrink() {
-        let test_tasks_begin = TEST_TASKS + 2;
-
-        let mut pool = ThreadPool::new(test_tasks_begin);
-        let b0 = Arc::new(Barrier::new(test_tasks_begin + 1));
-        let b1 = Arc::new(Barrier::new(test_tasks_begin + 1));
-
-        for _ in 0..test_tasks_begin {
-            let (b0, b1) = (b0.clone(), b1.clone());
-            pool.execute(move || {
-                b0.wait();
-                b1.wait();
-            });
-        }
-
-        let b2 = Arc::new(Barrier::new(TEST_TASKS + 1));
-        let b3 = Arc::new(Barrier::new(TEST_TASKS + 1));
-
-        for _ in 0..TEST_TASKS {
-            let (b2, b3) = (b2.clone(), b3.clone());
-            pool.execute(move || {
-                b2.wait();
-                b3.wait();
-            });
-        }
-
-        b0.wait();
-        pool.set_num_threads(TEST_TASKS);
-
-        assert_eq!(pool.active_count(), test_tasks_begin);
-        b1.wait();
-
-
-        b2.wait();
-        assert_eq!(pool.active_count(), TEST_TASKS);
-        b3.wait();
-    }
-
-    #[test]
-    fn test_name() {
-        let name = "test";
-        let mut pool = ThreadPool::new_with_name(name.to_owned(), 2);
-        let (tx, rx) = sync_channel(0);
-
-        // initial thread should share the name "test"
-        for _ in 0..2 {
-            let tx = tx.clone();
-            pool.execute(move || {
-                let name = thread::current().name().unwrap().to_owned();
-                tx.send(name).unwrap();
-            });
-        }
-
-        // new spawn thread should share the name "test" too.
-        pool.set_num_threads(3);
-        let tx_clone = tx.clone();
-        pool.execute(move || {
-            let name = thread::current().name().unwrap().to_owned();
-            tx_clone.send(name).unwrap();
-            panic!();
-        });
-
-        // recover thread should share the name "test" too.
-        pool.execute(move || {
-            let name = thread::current().name().unwrap().to_owned();
-            tx.send(name).unwrap();
-        });
-
-        for thread_name in rx.iter().take(4) {
-            assert_eq!(name, thread_name);
-        }
-    }
-
-    #[test]
-    fn test_debug() {
-        let pool = ThreadPool::new(4);
-        let debug = format!("{:?}", pool);
-        assert_eq!(debug, "ThreadPool { name: None, active_count: 0, max_count: 4 }");
-
-        let pool = ThreadPool::new_with_name("hello".into(), 4);
-        let debug = format!("{:?}", pool);
-        assert_eq!(debug, "ThreadPool { name: Some(\"hello\"), active_count: 0, max_count: 4 }");
-
-        let pool = ThreadPool::new(4);
-        pool.execute(move || {
-            sleep(Duration::from_secs(5))
-        });
-        sleep(Duration::from_secs(1));
-        let debug = format!("{:?}", pool);
-        assert_eq!(debug, "ThreadPool { name: None, active_count: 1, max_count: 4 }");
-    }
-}