From 460fe94bb95beb71724d8304585d79140adb9642 Mon Sep 17 00:00:00 2001 From: luca paterlini Date: Mon, 19 Jan 2026 16:17:28 +0100 Subject: [PATCH] Update static_lifetime.md update the deprecated example of trait bound, --- src/scope/lifetime/static_lifetime.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/scope/lifetime/static_lifetime.md b/src/scope/lifetime/static_lifetime.md index f4286f6675..88f2244e8b 100644 --- a/src/scope/lifetime/static_lifetime.md +++ b/src/scope/lifetime/static_lifetime.md @@ -71,18 +71,18 @@ live for the entire duration, but only from the leaking point onward. ```rust,editable,compile_fail extern crate rand; -use rand::Fill; +use rand::Rng; -fn random_vec() -> &'static [usize; 100] { - let mut rng = rand::thread_rng(); - let mut boxed = Box::new([0; 100]); - boxed.try_fill(&mut rng).unwrap(); +fn random_vec() -> &'static [u8; 100] { + let mut rng = rand::rng(); + let mut boxed = Box::new([0u8; 100]); + rng.fill(&mut boxed[..]); Box::leak(boxed) } fn main() { - let first: &'static [usize; 100] = random_vec(); - let second: &'static [usize; 100] = random_vec(); + let first: &'static [u8; 100] = random_vec(); + let second: &'static [u8; 100] = random_vec(); assert_ne!(first, second) } ```