Bug 1524822 - Fix warnings with rust 1.34+. r=jrmuizel
authorEmilio Cobos Álvarez <emilio@crisal.io>
Sun, 03 Feb 2019 03:20:52 +0000
changeset 456578 5f006a3c652c3a5def8800b9b0e65c4213b86785
parent 456577 96fd408e650f21a4d63ea3ff09f9a3bc25676360
child 456579 12b2328eedd1c1d8863a4ee2c18591eaf2a522dd
push id35490
push useraiakab@mozilla.com
push dateSun, 03 Feb 2019 09:50:26 +0000
treeherdermozilla-central@12b2328eedd1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs1524822
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1524822 - Fix warnings with rust 1.34+. r=jrmuizel There's some new limited const fn support in stable, and this is the recommended way to initialize atomics now. If this for some reason doesn't compile in all platforms / versions we support I'll just sprinkle some #[allow(deprecated)] instead. Also, cargo changes the output of Cargo.lock, see https://github.com/rust-lang/cargo/issues/6180. So also update those comments. Differential Revision: https://phabricator.services.mozilla.com/D18495
Cargo.lock
gfx/wr/Cargo.lock
gfx/wr/webrender/src/device/gl.rs
gfx/wr/webrender/src/picture.rs
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1,9 +1,11 @@
-[[package]]
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+[[package]]
 name = "Inflector"
 version = "0.11.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "lazy_static 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
--- a/gfx/wr/Cargo.lock
+++ b/gfx/wr/Cargo.lock
@@ -1,8 +1,10 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
 [[package]]
 name = "adler32"
 version = "1.0.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
 name = "aho-corasick"
 version = "0.6.4"
--- a/gfx/wr/webrender/src/device/gl.rs
+++ b/gfx/wr/webrender/src/device/gl.rs
@@ -22,34 +22,34 @@ use std::marker::PhantomData;
 use std::mem;
 use std::os::raw::c_void;
 use std::ops::Add;
 use std::path::PathBuf;
 use std::ptr;
 use std::rc::Rc;
 use std::slice;
 use std::sync::Arc;
-use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering};
+use std::sync::atomic::{AtomicUsize, Ordering};
 use std::thread;
 use webrender_build::shader::ProgramSourceDigest;
 use webrender_build::shader::{parse_shader_source, shader_source_from_file};
 
 /// Sequence number for frames, as tracked by the device layer.
 #[derive(Debug, Copy, Clone, PartialEq, Ord, Eq, PartialOrd)]
 #[cfg_attr(feature = "capture", derive(Serialize))]
 #[cfg_attr(feature = "replay", derive(Deserialize))]
 pub struct GpuFrameId(usize);
 
 /// Tracks the total number of GPU bytes allocated across all WebRender instances.
 ///
 /// Assuming all WebRender instances run on the same thread, this doesn't need
 /// to be atomic per se, but we make it atomic to satisfy the thread safety
 /// invariants in the type system. We could also put the value in TLS, but that
 /// would be more expensive to access.
-static GPU_BYTES_ALLOCATED: AtomicUsize = ATOMIC_USIZE_INIT;
+static GPU_BYTES_ALLOCATED: AtomicUsize = AtomicUsize::new(0);
 
 /// Returns the number of GPU bytes currently allocated.
 pub fn total_gpu_bytes_allocated() -> usize {
     GPU_BYTES_ALLOCATED.load(Ordering::Relaxed)
 }
 
 /// Records an allocation in VRAM.
 fn record_gpu_alloc(num_bytes: usize) {
--- a/gfx/wr/webrender/src/picture.rs
+++ b/gfx/wr/webrender/src/picture.rs
@@ -29,17 +29,17 @@ use print_tree::PrintTreePrinter;
 use render_backend::DataStores;
 use render_task::{ClearMode, RenderTask, RenderTaskCacheEntryHandle, TileBlit};
 use render_task::{RenderTaskId, RenderTaskLocation};
 use resource_cache::ResourceCache;
 use scene::{FilterOpHelpers, SceneProperties};
 use scene_builder::Interners;
 use smallvec::SmallVec;
 use std::{mem, u16};
-use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering};
+use std::sync::atomic::{AtomicUsize, Ordering};
 use texture_cache::{Eviction, TextureCacheHandle};
 use tiling::RenderTargetKind;
 use util::{ComparableVec, TransformedRectKind, MatrixHelpers, MaxRect};
 
 /*
  A picture represents a dynamically rendered image. It consists of:
 
  * A number of primitives that are drawn onto the picture.
@@ -111,17 +111,17 @@ const MAX_SURFACE_SIZE: f32 = 4096.0;
 
 
 /// The maximum number of primitives to look for in a display
 /// list, trying to find unique primitives.
 const MAX_PRIMS_TO_SEARCH: usize = 128;
 
 /// Used to get unique tile IDs, even when the tile cache is
 /// destroyed between display lists / scenes.
-static NEXT_TILE_ID: AtomicUsize = ATOMIC_USIZE_INIT;
+static NEXT_TILE_ID: AtomicUsize = AtomicUsize::new(0);
 
 fn clamp(value: i32, low: i32, high: i32) -> i32 {
     value.max(low).min(high)
 }
 
 /// Information about the state of an opacity binding.
 #[derive(Debug)]
 pub struct OpacityBindingInfo {