# HG changeset patch # User Emmanuel Gil Peyrot # Date 1578396851 -3600 # Node ID 0fed350d177854f4e75c89ec1781c1e4d21b5590 # Parent 0a250ddfae79a529e74c197430736765016e6fdb examples: Remove deprecated std::mem::uninitialized(). diff --git a/examples/anmrenderer.rs b/examples/anmrenderer.rs --- a/examples/anmrenderer.rs +++ b/examples/anmrenderer.rs @@ -132,7 +132,10 @@ fn main() { let mut anm_runner = AnmRunner::new(anms, script, sprite.clone(), Rc::downgrade(&prng), 0); assert_eq!(std::mem::size_of::(), std::mem::size_of::()); - let mut vertices: [Vertex; 4] = unsafe { std::mem::uninitialized() }; + let mut vertices: [Vertex; 4] = { + let data = std::mem::MaybeUninit::uninit(); + unsafe { data.assume_init() } + }; fill_vertices(sprite.clone(), &mut vertices); // set the uniform interface to our type so that we can read textures from the shader diff --git a/examples/eclrenderer.rs b/examples/eclrenderer.rs --- a/examples/eclrenderer.rs +++ b/examples/eclrenderer.rs @@ -128,7 +128,10 @@ fn main() { let mut ecl_runner = EclRunner::new(&ecl, enemy.clone(), sub); assert_eq!(std::mem::size_of::(), std::mem::size_of::()); - let vertices: [Vertex; 4] = unsafe { std::mem::uninitialized() }; + let vertices: [Vertex; 4] = { + let data = std::mem::MaybeUninit::uninit(); + unsafe { data.assume_init() } + }; let mut surface = GlfwSurface::new(WindowDim::Windowed(384, 448), "Touhou", WindowOpt::default()).unwrap(); diff --git a/examples/stagerunner.rs b/examples/stagerunner.rs --- a/examples/stagerunner.rs +++ b/examples/stagerunner.rs @@ -128,7 +128,10 @@ fn main() { let game = Rc::new(RefCell::new(game)); assert_eq!(std::mem::size_of::(), std::mem::size_of::()); - let vertices: [Vertex; 4] = unsafe { std::mem::uninitialized() }; + let vertices: [Vertex; 4] = { + let data = std::mem::MaybeUninit::uninit(); + unsafe { data.assume_init() } + }; let mut surface = GlfwSurface::new(WindowDim::Windowed(384, 448), "Touhou", WindowOpt::default()).unwrap(); diff --git a/examples/stdrenderer.rs b/examples/stdrenderer.rs --- a/examples/stdrenderer.rs +++ b/examples/stdrenderer.rs @@ -149,7 +149,10 @@ fn main() { // Create the AnmRunner from the ANM and the sprite. let sprite = Rc::new(RefCell::new(Sprite::with_size(width, height))); let _anm_runner = AnmRunner::new(anms.clone(), quad.anm_script as u8, sprite.clone(), Rc::downgrade(&prng), 0); - let mut new_vertices: [Vertex; 6] = unsafe { std::mem::uninitialized() }; + let mut new_vertices: [Vertex; 6] = { + let data = std::mem::MaybeUninit::uninit(); + unsafe { data.assume_init() } + }; fill_vertices(sprite.clone(), &mut new_vertices, x, y, z); new_vertices[4] = new_vertices[0]; new_vertices[5] = new_vertices[2];