@@ -196,10 +196,10 @@ pub trait Error: Debug + Display {
196
196
#[ stable( feature = "error_source" , since = "1.30.0" ) ]
197
197
fn source ( & self ) -> Option < & ( dyn Error + ' static ) > { None }
198
198
199
- /// Gets the `TypeId` of `self`
199
+ /// Gets the `TypeId` of `self`.
200
200
#[ doc( hidden) ]
201
201
#[ unstable( feature = "error_type_id" ,
202
- reason = "this is memory unsafe to override in user code" ,
202
+ reason = "this is memory- unsafe to override in user code" ,
203
203
issue = "60784" ) ]
204
204
fn type_id ( & self , _: private:: Internal ) -> TypeId where Self : ' static {
205
205
TypeId :: of :: < Self > ( )
@@ -601,19 +601,19 @@ impl Error for char::ParseCharError {
601
601
}
602
602
}
603
603
604
- // copied from any.rs
604
+ // Copied from ` any.rs`.
605
605
impl dyn Error + ' static {
606
606
/// Returns `true` if the boxed type is the same as `T`
607
607
#[ stable( feature = "error_downcast" , since = "1.3.0" ) ]
608
608
#[ inline]
609
609
pub fn is < T : Error + ' static > ( & self ) -> bool {
610
- // Get TypeId of the type this function is instantiated with
610
+ // Get ` TypeId` of the type this function is instantiated with.
611
611
let t = TypeId :: of :: < T > ( ) ;
612
612
613
- // Get TypeId of the type in the trait object
613
+ // Get ` TypeId` of the type in the trait object.
614
614
let boxed = self . type_id ( private:: Internal ) ;
615
615
616
- // Compare both TypeIds on equality
616
+ // Compare both `TypeId`s on equality.
617
617
t == boxed
618
618
}
619
619
@@ -647,21 +647,21 @@ impl dyn Error + 'static {
647
647
}
648
648
649
649
impl dyn Error + ' static + Send {
650
- /// Forwards to the method defined on the type `Any `.
650
+ /// Forwards to the method defined on the type `dyn Error `.
651
651
#[ stable( feature = "error_downcast" , since = "1.3.0" ) ]
652
652
#[ inline]
653
653
pub fn is < T : Error + ' static > ( & self ) -> bool {
654
654
<dyn Error + ' static >:: is :: < T > ( self )
655
655
}
656
656
657
- /// Forwards to the method defined on the type `Any `.
657
+ /// Forwards to the method defined on the type `dyn Error `.
658
658
#[ stable( feature = "error_downcast" , since = "1.3.0" ) ]
659
659
#[ inline]
660
660
pub fn downcast_ref < T : Error + ' static > ( & self ) -> Option < & T > {
661
661
<dyn Error + ' static >:: downcast_ref :: < T > ( self )
662
662
}
663
663
664
- /// Forwards to the method defined on the type `Any `.
664
+ /// Forwards to the method defined on the type `dyn Error `.
665
665
#[ stable( feature = "error_downcast" , since = "1.3.0" ) ]
666
666
#[ inline]
667
667
pub fn downcast_mut < T : Error + ' static > ( & mut self ) -> Option < & mut T > {
@@ -670,21 +670,21 @@ impl dyn Error + 'static + Send {
670
670
}
671
671
672
672
impl dyn Error + ' static + Send + Sync {
673
- /// Forwards to the method defined on the type `Any `.
673
+ /// Forwards to the method defined on the type `dyn Error `.
674
674
#[ stable( feature = "error_downcast" , since = "1.3.0" ) ]
675
675
#[ inline]
676
676
pub fn is < T : Error + ' static > ( & self ) -> bool {
677
677
<dyn Error + ' static >:: is :: < T > ( self )
678
678
}
679
679
680
- /// Forwards to the method defined on the type `Any `.
680
+ /// Forwards to the method defined on the type `dyn Error `.
681
681
#[ stable( feature = "error_downcast" , since = "1.3.0" ) ]
682
682
#[ inline]
683
683
pub fn downcast_ref < T : Error + ' static > ( & self ) -> Option < & T > {
684
684
<dyn Error + ' static >:: downcast_ref :: < T > ( self )
685
685
}
686
686
687
- /// Forwards to the method defined on the type `Any `.
687
+ /// Forwards to the method defined on the type `dyn Error `.
688
688
#[ stable( feature = "error_downcast" , since = "1.3.0" ) ]
689
689
#[ inline]
690
690
pub fn downcast_mut < T : Error + ' static > ( & mut self ) -> Option < & mut T > {
@@ -695,7 +695,7 @@ impl dyn Error + 'static + Send + Sync {
695
695
impl dyn Error {
696
696
#[ inline]
697
697
#[ stable( feature = "error_downcast" , since = "1.3.0" ) ]
698
- /// Attempt to downcast the box to a concrete type.
698
+ /// Attempts to downcast the box to a concrete type.
699
699
pub fn downcast < T : Error + ' static > ( self : Box < Self > ) -> Result < Box < T > , Box < dyn Error > > {
700
700
if self . is :: < T > ( ) {
701
701
unsafe {
@@ -863,12 +863,12 @@ impl<'a> Iterator for ErrorIter<'a> {
863
863
impl dyn Error + Send {
864
864
#[ inline]
865
865
#[ stable( feature = "error_downcast" , since = "1.3.0" ) ]
866
- /// Attempt to downcast the box to a concrete type.
866
+ /// Attempts to downcast the box to a concrete type.
867
867
pub fn downcast < T : Error + ' static > ( self : Box < Self > )
868
868
-> Result < Box < T > , Box < dyn Error + Send > > {
869
869
let err: Box < dyn Error > = self ;
870
870
<dyn Error >:: downcast ( err) . map_err ( |s| unsafe {
871
- // reapply the Send marker
871
+ // Reapply the ` Send` marker.
872
872
transmute :: < Box < dyn Error > , Box < dyn Error + Send > > ( s)
873
873
} )
874
874
}
@@ -877,12 +877,12 @@ impl dyn Error + Send {
877
877
impl dyn Error + Send + Sync {
878
878
#[ inline]
879
879
#[ stable( feature = "error_downcast" , since = "1.3.0" ) ]
880
- /// Attempt to downcast the box to a concrete type.
880
+ /// Attempts to downcast the box to a concrete type.
881
881
pub fn downcast < T : Error + ' static > ( self : Box < Self > )
882
882
-> Result < Box < T > , Box < Self > > {
883
883
let err: Box < dyn Error > = self ;
884
884
<dyn Error >:: downcast ( err) . map_err ( |s| unsafe {
885
- // reapply the Send+ Sync marker
885
+ // Reapply the ` Send + Sync` marker.
886
886
transmute :: < Box < dyn Error > , Box < dyn Error + Send + Sync > > ( s)
887
887
} )
888
888
}
0 commit comments