@@ -227,7 +227,7 @@ impl dyn Any {
227227 // SAFETY: just checked whether we are pointing to the correct type, and we can rely on
228228 // that check for memory safety because we have implemented Any for all types; no other
229229 // impls can exist as they would conflict with our impl.
230- unsafe { Some ( self . downcast_ref_unchecked ( ) ) }
230+ unsafe { Some ( self . downcast_unchecked_ref ( ) ) }
231231 } else {
232232 None
233233 }
@@ -263,7 +263,7 @@ impl dyn Any {
263263 // SAFETY: just checked whether we are pointing to the correct type, and we can rely on
264264 // that check for memory safety because we have implemented Any for all types; no other
265265 // impls can exist as they would conflict with our impl.
266- unsafe { Some ( self . downcast_mut_unchecked ( ) ) }
266+ unsafe { Some ( self . downcast_unchecked_mut ( ) ) }
267267 } else {
268268 None
269269 }
@@ -281,7 +281,7 @@ impl dyn Any {
281281 /// let x: Box<dyn Any> = Box::new(1_usize);
282282 ///
283283 /// unsafe {
284- /// assert_eq!(*x.downcast_ref_unchecked ::<usize>(), 1);
284+ /// assert_eq!(*x.downcast_unchecked_ref ::<usize>(), 1);
285285 /// }
286286 /// ```
287287 ///
@@ -291,7 +291,7 @@ impl dyn Any {
291291 /// with the incorrect type is *undefined behavior*.
292292 #[ unstable( feature = "downcast_unchecked" , issue = "90850" ) ]
293293 #[ inline]
294- pub unsafe fn downcast_ref_unchecked < T : Any > ( & self ) -> & T {
294+ pub unsafe fn downcast_unchecked_ref < T : Any > ( & self ) -> & T {
295295 debug_assert ! ( self . is:: <T >( ) ) ;
296296 // SAFETY: caller guarantees that T is the correct type
297297 unsafe { & * ( self as * const dyn Any as * const T ) }
@@ -309,7 +309,7 @@ impl dyn Any {
309309 /// let mut x: Box<dyn Any> = Box::new(1_usize);
310310 ///
311311 /// unsafe {
312- /// *x.downcast_mut_unchecked ::<usize>() += 1;
312+ /// *x.downcast_unchecked_mut ::<usize>() += 1;
313313 /// }
314314 ///
315315 /// assert_eq!(*x.downcast_ref::<usize>().unwrap(), 2);
@@ -321,7 +321,7 @@ impl dyn Any {
321321 /// with the incorrect type is *undefined behavior*.
322322 #[ unstable( feature = "downcast_unchecked" , issue = "90850" ) ]
323323 #[ inline]
324- pub unsafe fn downcast_mut_unchecked < T : Any > ( & mut self ) -> & mut T {
324+ pub unsafe fn downcast_unchecked_mut < T : Any > ( & mut self ) -> & mut T {
325325 debug_assert ! ( self . is:: <T >( ) ) ;
326326 // SAFETY: caller guarantees that T is the correct type
327327 unsafe { & mut * ( self as * mut dyn Any as * mut T ) }
@@ -417,7 +417,7 @@ impl dyn Any + Send {
417417 /// let x: Box<dyn Any> = Box::new(1_usize);
418418 ///
419419 /// unsafe {
420- /// assert_eq!(*x.downcast_ref_unchecked ::<usize>(), 1);
420+ /// assert_eq!(*x.downcast_unchecked_ref ::<usize>(), 1);
421421 /// }
422422 /// ```
423423 ///
@@ -427,9 +427,9 @@ impl dyn Any + Send {
427427 /// with the incorrect type is *undefined behavior*.
428428 #[ unstable( feature = "downcast_unchecked" , issue = "90850" ) ]
429429 #[ inline]
430- pub unsafe fn downcast_ref_unchecked < T : Any > ( & self ) -> & T {
430+ pub unsafe fn downcast_unchecked_ref < T : Any > ( & self ) -> & T {
431431 // SAFETY: guaranteed by caller
432- unsafe { <dyn Any >:: downcast_ref_unchecked :: < T > ( self ) }
432+ unsafe { <dyn Any >:: downcast_unchecked_ref :: < T > ( self ) }
433433 }
434434
435435 /// Forwards to the method defined on the type `dyn Any`.
@@ -444,7 +444,7 @@ impl dyn Any + Send {
444444 /// let mut x: Box<dyn Any> = Box::new(1_usize);
445445 ///
446446 /// unsafe {
447- /// *x.downcast_mut_unchecked ::<usize>() += 1;
447+ /// *x.downcast_unchecked_mut ::<usize>() += 1;
448448 /// }
449449 ///
450450 /// assert_eq!(*x.downcast_ref::<usize>().unwrap(), 2);
@@ -456,9 +456,9 @@ impl dyn Any + Send {
456456 /// with the incorrect type is *undefined behavior*.
457457 #[ unstable( feature = "downcast_unchecked" , issue = "90850" ) ]
458458 #[ inline]
459- pub unsafe fn downcast_mut_unchecked < T : Any > ( & mut self ) -> & mut T {
459+ pub unsafe fn downcast_unchecked_mut < T : Any > ( & mut self ) -> & mut T {
460460 // SAFETY: guaranteed by caller
461- unsafe { <dyn Any >:: downcast_mut_unchecked :: < T > ( self ) }
461+ unsafe { <dyn Any >:: downcast_unchecked_mut :: < T > ( self ) }
462462 }
463463}
464464
@@ -551,7 +551,7 @@ impl dyn Any + Send + Sync {
551551 /// let x: Box<dyn Any> = Box::new(1_usize);
552552 ///
553553 /// unsafe {
554- /// assert_eq!(*x.downcast_ref_unchecked ::<usize>(), 1);
554+ /// assert_eq!(*x.downcast_unchecked_ref ::<usize>(), 1);
555555 /// }
556556 /// ```
557557 /// # Safety
@@ -560,9 +560,9 @@ impl dyn Any + Send + Sync {
560560 /// with the incorrect type is *undefined behavior*.
561561 #[ unstable( feature = "downcast_unchecked" , issue = "90850" ) ]
562562 #[ inline]
563- pub unsafe fn downcast_ref_unchecked < T : Any > ( & self ) -> & T {
563+ pub unsafe fn downcast_unchecked_ref < T : Any > ( & self ) -> & T {
564564 // SAFETY: guaranteed by caller
565- unsafe { <dyn Any >:: downcast_ref_unchecked :: < T > ( self ) }
565+ unsafe { <dyn Any >:: downcast_unchecked_ref :: < T > ( self ) }
566566 }
567567
568568 /// Forwards to the method defined on the type `Any`.
@@ -577,7 +577,7 @@ impl dyn Any + Send + Sync {
577577 /// let mut x: Box<dyn Any> = Box::new(1_usize);
578578 ///
579579 /// unsafe {
580- /// *x.downcast_mut_unchecked ::<usize>() += 1;
580+ /// *x.downcast_unchecked_mut ::<usize>() += 1;
581581 /// }
582582 ///
583583 /// assert_eq!(*x.downcast_ref::<usize>().unwrap(), 2);
@@ -588,9 +588,9 @@ impl dyn Any + Send + Sync {
588588 /// with the incorrect type is *undefined behavior*.
589589 #[ unstable( feature = "downcast_unchecked" , issue = "90850" ) ]
590590 #[ inline]
591- pub unsafe fn downcast_mut_unchecked < T : Any > ( & mut self ) -> & mut T {
591+ pub unsafe fn downcast_unchecked_mut < T : Any > ( & mut self ) -> & mut T {
592592 // SAFETY: guaranteed by caller
593- unsafe { <dyn Any >:: downcast_mut_unchecked :: < T > ( self ) }
593+ unsafe { <dyn Any >:: downcast_unchecked_mut :: < T > ( self ) }
594594 }
595595}
596596
0 commit comments