diff options
| author | bors <bors@rust-lang.org> | 2019-09-14 14:43:32 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-09-14 14:43:32 +0000 |
| commit | ca3766e2e58f462a20922e42c821a37eaf0e13db (patch) | |
| tree | 02f2665ed12dcf87a18bf431eee4d8ae31a90adc /src/libstd/error.rs | |
| parent | 457666860cf198ddacc3d235b7360499eec3b897 (diff) | |
| parent | 1c7959bb5d8d780e84eef29db9ae32b4d4b4b3d2 (diff) | |
| download | rust-ca3766e2e58f462a20922e42c821a37eaf0e13db.tar.gz rust-ca3766e2e58f462a20922e42c821a37eaf0e13db.zip | |
Auto merge of #64456 - Centril:rollup-ytqdwaq, r=Centril
Rollup of 17 pull requests Successful merges: - #63846 (Added table containing the system calls used by Instant and SystemTime.) - #64116 (Fix minor typo in docs.) - #64203 (A few cosmetic improvements to code & comments in liballoc and libcore) - #64302 (Shrink `ObligationCauseCode`) - #64372 (use randSecure and randABytes) - #64374 (Box `DiagnosticBuilder`.) - #64375 (Fast path for vec.clear/truncate ) - #64378 (Fix inconsistent link formatting.) - #64384 (Trim rustc-workspace-hack) - #64393 ( declare EnvKey before use to fix build error) - #64420 (Inline `mark_neighbours_as_waiting_from`.) - #64422 (Remove raw string literal quotes from error index descriptions) - #64423 (Add self to .mailmap) - #64425 (typo fix) - #64431 (fn ptr is structural match) - #64435 (codegen: use "_N" (like for other locals) instead of "argN", for argument names.) - #64439 (fix #64430, confusing `owned_box` error message in no_std build) Failed merges: r? @ghost
Diffstat (limited to 'src/libstd/error.rs')
| -rw-r--r-- | src/libstd/error.rs | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/libstd/error.rs b/src/libstd/error.rs index 998d59f90a2..4a1bb75d588 100644 --- a/src/libstd/error.rs +++ b/src/libstd/error.rs @@ -197,10 +197,10 @@ pub trait Error: Debug + Display { #[stable(feature = "error_source", since = "1.30.0")] fn source(&self) -> Option<&(dyn Error + 'static)> { None } - /// Gets the `TypeId` of `self` + /// Gets the `TypeId` of `self`. #[doc(hidden)] #[unstable(feature = "error_type_id", - reason = "this is memory unsafe to override in user code", + reason = "this is memory-unsafe to override in user code", issue = "60784")] fn type_id(&self, _: private::Internal) -> TypeId where Self: 'static { TypeId::of::<Self>() @@ -616,19 +616,19 @@ impl Error for char::ParseCharError { } } -// copied from any.rs +// Copied from `any.rs`. impl dyn Error + 'static { /// Returns `true` if the boxed type is the same as `T` #[stable(feature = "error_downcast", since = "1.3.0")] #[inline] pub fn is<T: Error + 'static>(&self) -> bool { - // Get TypeId of the type this function is instantiated with + // Get `TypeId` of the type this function is instantiated with. let t = TypeId::of::<T>(); - // Get TypeId of the type in the trait object + // Get `TypeId` of the type in the trait object. let boxed = self.type_id(private::Internal); - // Compare both TypeIds on equality + // Compare both `TypeId`s on equality. t == boxed } @@ -662,21 +662,21 @@ impl dyn Error + 'static { } impl dyn Error + 'static + Send { - /// Forwards to the method defined on the type `Any`. + /// Forwards to the method defined on the type `dyn Error`. #[stable(feature = "error_downcast", since = "1.3.0")] #[inline] pub fn is<T: Error + 'static>(&self) -> bool { <dyn Error + 'static>::is::<T>(self) } - /// Forwards to the method defined on the type `Any`. + /// Forwards to the method defined on the type `dyn Error`. #[stable(feature = "error_downcast", since = "1.3.0")] #[inline] pub fn downcast_ref<T: Error + 'static>(&self) -> Option<&T> { <dyn Error + 'static>::downcast_ref::<T>(self) } - /// Forwards to the method defined on the type `Any`. + /// Forwards to the method defined on the type `dyn Error`. #[stable(feature = "error_downcast", since = "1.3.0")] #[inline] pub fn downcast_mut<T: Error + 'static>(&mut self) -> Option<&mut T> { @@ -685,21 +685,21 @@ impl dyn Error + 'static + Send { } impl dyn Error + 'static + Send + Sync { - /// Forwards to the method defined on the type `Any`. + /// Forwards to the method defined on the type `dyn Error`. #[stable(feature = "error_downcast", since = "1.3.0")] #[inline] pub fn is<T: Error + 'static>(&self) -> bool { <dyn Error + 'static>::is::<T>(self) } - /// Forwards to the method defined on the type `Any`. + /// Forwards to the method defined on the type `dyn Error`. #[stable(feature = "error_downcast", since = "1.3.0")] #[inline] pub fn downcast_ref<T: Error + 'static>(&self) -> Option<&T> { <dyn Error + 'static>::downcast_ref::<T>(self) } - /// Forwards to the method defined on the type `Any`. + /// Forwards to the method defined on the type `dyn Error`. #[stable(feature = "error_downcast", since = "1.3.0")] #[inline] pub fn downcast_mut<T: Error + 'static>(&mut self) -> Option<&mut T> { @@ -710,7 +710,7 @@ impl dyn Error + 'static + Send + Sync { impl dyn Error { #[inline] #[stable(feature = "error_downcast", since = "1.3.0")] - /// Attempt to downcast the box to a concrete type. + /// Attempts to downcast the box to a concrete type. pub fn downcast<T: Error + 'static>(self: Box<Self>) -> Result<Box<T>, Box<dyn Error>> { if self.is::<T>() { unsafe { @@ -878,12 +878,12 @@ impl<'a> Iterator for ErrorIter<'a> { impl dyn Error + Send { #[inline] #[stable(feature = "error_downcast", since = "1.3.0")] - /// Attempt to downcast the box to a concrete type. + /// Attempts to downcast the box to a concrete type. pub fn downcast<T: Error + 'static>(self: Box<Self>) -> Result<Box<T>, Box<dyn Error + Send>> { let err: Box<dyn Error> = self; <dyn Error>::downcast(err).map_err(|s| unsafe { - // reapply the Send marker + // Reapply the `Send` marker. transmute::<Box<dyn Error>, Box<dyn Error + Send>>(s) }) } @@ -892,12 +892,12 @@ impl dyn Error + Send { impl dyn Error + Send + Sync { #[inline] #[stable(feature = "error_downcast", since = "1.3.0")] - /// Attempt to downcast the box to a concrete type. + /// Attempts to downcast the box to a concrete type. pub fn downcast<T: Error + 'static>(self: Box<Self>) -> Result<Box<T>, Box<Self>> { let err: Box<dyn Error> = self; <dyn Error>::downcast(err).map_err(|s| unsafe { - // reapply the Send+Sync marker + // Reapply the `Send + Sync` marker. transmute::<Box<dyn Error>, Box<dyn Error + Send + Sync>>(s) }) } |
