From 04fa1d81dd435fc5eaf22ed72efdfd699e1d6c97 Mon Sep 17 00:00:00 2001 From: Frank Steffahn Date: Sun, 22 Aug 2021 12:33:27 +0200 Subject: [PATCH 1/3] =?UTF-8?q?Fix=20typo=20=E2=80=9Ca=20Rc=E2=80=9D=20?= =?UTF-8?q?=E2=86=92=20=E2=80=9Can=20Rc=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- compiler/rustc_data_structures/src/owning_ref/mod.rs | 2 +- library/alloc/src/rc.rs | 2 +- library/std/src/ffi/c_str.rs | 2 +- library/std/src/ffi/os_str.rs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/rustc_data_structures/src/owning_ref/mod.rs b/compiler/rustc_data_structures/src/owning_ref/mod.rs index 5b27a407ad42..251195204da4 100644 --- a/compiler/rustc_data_structures/src/owning_ref/mod.rs +++ b/compiler/rustc_data_structures/src/owning_ref/mod.rs @@ -1146,7 +1146,7 @@ pub type VecRef = OwningRef, U>; /// Typedef of an owning reference that uses a `String` as the owner. pub type StringRef = OwningRef; -/// Typedef of an owning reference that uses a `Rc` as the owner. +/// Typedef of an owning reference that uses an `Rc` as the owner. pub type RcRef = OwningRef, U>; /// Typedef of an owning reference that uses an `Arc` as the owner. pub type ArcRef = OwningRef, U>; diff --git a/library/alloc/src/rc.rs b/library/alloc/src/rc.rs index 0b3079fa59db..c19c61b65cd0 100644 --- a/library/alloc/src/rc.rs +++ b/library/alloc/src/rc.rs @@ -1743,7 +1743,7 @@ impl fmt::Pointer for Rc { #[cfg(not(no_global_oom_handling))] #[stable(feature = "from_for_ptrs", since = "1.6.0")] impl From for Rc { - /// Converts a generic type `T` into a `Rc` + /// Converts a generic type `T` into an `Rc` /// /// The conversion allocates on the heap and moves `t` /// from the stack into it. diff --git a/library/std/src/ffi/c_str.rs b/library/std/src/ffi/c_str.rs index 0d082648591c..de05c3778529 100644 --- a/library/std/src/ffi/c_str.rs +++ b/library/std/src/ffi/c_str.rs @@ -958,7 +958,7 @@ impl From<&CStr> for Arc { #[stable(feature = "shared_from_slice2", since = "1.24.0")] impl From for Rc { - /// Converts a [`CString`] into a [`Rc`]`` without copying or allocating. + /// Converts a [`CString`] into an [`Rc`]`` without copying or allocating. #[inline] fn from(s: CString) -> Rc { let rc: Rc<[u8]> = Rc::from(s.into_inner()); diff --git a/library/std/src/ffi/os_str.rs b/library/std/src/ffi/os_str.rs index f05295f89af1..21f354caf6ae 100644 --- a/library/std/src/ffi/os_str.rs +++ b/library/std/src/ffi/os_str.rs @@ -916,7 +916,7 @@ impl From<&OsStr> for Arc { #[stable(feature = "shared_from_slice2", since = "1.24.0")] impl From for Rc { - /// Converts an [`OsString`] into a [`Rc`]`` without copying or allocating. + /// Converts an [`OsString`] into an [`Rc`]`` without copying or allocating. #[inline] fn from(s: OsString) -> Rc { let rc = s.inner.into_rc(); From b823dc1bbd57c6525b2cc2420c87795a7264edb4 Mon Sep 17 00:00:00 2001 From: Frank Steffahn Date: Sun, 22 Aug 2021 12:39:39 +0200 Subject: [PATCH 2/3] =?UTF-8?q?Also=20fix=20=E2=80=9Ca=20RwLock*=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- compiler/rustc_data_structures/src/owning_ref/mod.rs | 6 +++--- src/test/ui/drop/dropck_legal_cycles.rs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/rustc_data_structures/src/owning_ref/mod.rs b/compiler/rustc_data_structures/src/owning_ref/mod.rs index 251195204da4..4689a027895c 100644 --- a/compiler/rustc_data_structures/src/owning_ref/mod.rs +++ b/compiler/rustc_data_structures/src/owning_ref/mod.rs @@ -1157,9 +1157,9 @@ pub type RefRef<'a, T, U = T> = OwningRef, U>; pub type RefMutRef<'a, T, U = T> = OwningRef, U>; /// Typedef of an owning reference that uses a `MutexGuard` as the owner. pub type MutexGuardRef<'a, T, U = T> = OwningRef, U>; -/// Typedef of an owning reference that uses a `RwLockReadGuard` as the owner. +/// Typedef of an owning reference that uses an `RwLockReadGuard` as the owner. pub type RwLockReadGuardRef<'a, T, U = T> = OwningRef, U>; -/// Typedef of an owning reference that uses a `RwLockWriteGuard` as the owner. +/// Typedef of an owning reference that uses an `RwLockWriteGuard` as the owner. pub type RwLockWriteGuardRef<'a, T, U = T> = OwningRef, U>; /// Typedef of a mutable owning reference that uses a `Box` as the owner. @@ -1173,7 +1173,7 @@ pub type StringRefMut = OwningRefMut; pub type RefMutRefMut<'a, T, U = T> = OwningRefMut, U>; /// Typedef of a mutable owning reference that uses a `MutexGuard` as the owner. pub type MutexGuardRefMut<'a, T, U = T> = OwningRefMut, U>; -/// Typedef of a mutable owning reference that uses a `RwLockWriteGuard` as the owner. +/// Typedef of a mutable owning reference that uses an `RwLockWriteGuard` as the owner. pub type RwLockWriteGuardRefMut<'a, T, U = T> = OwningRef, U>; unsafe impl<'a, T: 'a> IntoErased<'a> for Box { diff --git a/src/test/ui/drop/dropck_legal_cycles.rs b/src/test/ui/drop/dropck_legal_cycles.rs index fb13fd764bfa..27a599315dc1 100644 --- a/src/test/ui/drop/dropck_legal_cycles.rs +++ b/src/test/ui/drop/dropck_legal_cycles.rs @@ -368,7 +368,7 @@ pub fn main() { // We can use refcells if we're single-threaded (as this test is). // If one were to generalize these constructions to a // multi-threaded context, then it might seem like we could choose - // between either a RwLock or a Mutex to hold the owned arcs on + // between either an RwLock or a Mutex to hold the owned arcs on // each node. // // Part of the point of this test is to actually confirm that the From 6248dbcf70fbae9cf6fda9e2b2ba55aeb5837b36 Mon Sep 17 00:00:00 2001 From: Frank Steffahn Date: Sun, 22 Aug 2021 12:41:53 +0200 Subject: [PATCH 3/3] =?UTF-8?q?Also=20fix=20=E2=80=9Ca=20`OwningRef`?= =?UTF-8?q?=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- compiler/rustc_data_structures/src/owning_ref/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_data_structures/src/owning_ref/mod.rs b/compiler/rustc_data_structures/src/owning_ref/mod.rs index 4689a027895c..e7397bf13bad 100644 --- a/compiler/rustc_data_structures/src/owning_ref/mod.rs +++ b/compiler/rustc_data_structures/src/owning_ref/mod.rs @@ -5,7 +5,7 @@ This crate provides the _owning reference_ types `OwningRef` and `OwningRefMut` that enables it to bundle a reference together with the owner of the data it points to. -This allows moving and dropping of a `OwningRef` without needing to recreate the reference. +This allows moving and dropping of an `OwningRef` without needing to recreate the reference. This can sometimes be useful because Rust borrowing rules normally prevent moving a type that has been moved from. For example, this kind of code gets rejected: