From 3d4396cce60f7faaf4970a30eed7d3c9bdfb89d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Sun, 3 Feb 2019 03:20:52 +0000 Subject: [PATCH] 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 --HG-- extra : moz-landing-system : lando --- Cargo.lock | 2 ++ gfx/wr/Cargo.lock | 2 ++ gfx/wr/webrender/src/device/gl.rs | 4 ++-- gfx/wr/webrender/src/picture.rs | 4 ++-- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cc221392cf233..3853d14abddd5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,3 +1,5 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. [[package]] name = "Inflector" version = "0.11.2" diff --git a/gfx/wr/Cargo.lock b/gfx/wr/Cargo.lock index be5208b83d351..0b90829ef71a6 100644 --- a/gfx/wr/Cargo.lock +++ b/gfx/wr/Cargo.lock @@ -1,3 +1,5 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. [[package]] name = "adler32" version = "1.0.2" diff --git a/gfx/wr/webrender/src/device/gl.rs b/gfx/wr/webrender/src/device/gl.rs index 92a0220cfa2f0..7424df50f4e45 100644 --- a/gfx/wr/webrender/src/device/gl.rs +++ b/gfx/wr/webrender/src/device/gl.rs @@ -27,7 +27,7 @@ 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}; @@ -44,7 +44,7 @@ pub struct GpuFrameId(usize); /// 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 { diff --git a/gfx/wr/webrender/src/picture.rs b/gfx/wr/webrender/src/picture.rs index 7aafd404a6ad7..f8bee9f6c2fd1 100644 --- a/gfx/wr/webrender/src/picture.rs +++ b/gfx/wr/webrender/src/picture.rs @@ -34,7 +34,7 @@ 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}; @@ -116,7 +116,7 @@ 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)