Skip to content

Commit

Permalink
Bug 1524822 - Fix warnings with rust 1.34+. r=jrmuizel
Browse files Browse the repository at this point in the history
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
rust-lang/cargo#6180. So also update those comments.

Differential Revision: https://phabricator.services.mozilla.com/D18495

--HG--
extra : moz-landing-system : lando
  • Loading branch information
emilio committed Feb 3, 2019
1 parent 4ac08cd commit 3d4396c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions gfx/wr/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions gfx/wr/webrender/src/device/gl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand All @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions gfx/wr/webrender/src/picture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 3d4396c

Please sign in to comment.