Skip to content

Commit cc2a127

Browse files
Rollup merge of #88226 - steffahn:an_rc, r=michaelwoerister
Fix typo “a Rc” → “an Rc” (and a few more) After stumbling about it in the dev-guide, I’ve devided to eliminate all mentions of “a Rc”, replacing it with “an Rc”. E.g. ```plain $ rg "(^|[^'])\ba\b[^\w=:]*\bRc" compiler/rustc_data_structures/src/owning_ref/mod.rs 1149:/// Typedef of a owning reference that uses a `Rc` as the owner. library/std/src/ffi/os_str.rs 919: /// Converts a [`OsString`] into a [`Rc`]`<OsStr>` without copying or allocating. library/std/src/ffi/c_str.rs 961: /// Converts a [`CString`] into a [`Rc`]`<CStr>` without copying or allocating. src/doc/rustc-dev-guide/src/query.md 61:are cheaply cloneable; insert a `Rc` if necessary). src/doc/book/src/ch15-06-reference-cycles.md 72:decreases the reference count of the `a` `Rc<List>` instance from 2 to 1 as library/alloc/src/rc.rs 1746: /// Converts a generic type `T` into a `Rc<T>` ``` _(the match in the book is a false positive)_ Since the dev-guide is a submodule, it’s getting a separate PR: rust-lang/rustc-dev-guide#1191 I’ve also gone ahead and done the same search for `RwLock` and hit a few cases in the `OwningRef` adaption. Then, I couldn’t keep the countless cases of “a owning …” or “a owner” unaddressed, which concludes this PR. `@rustbot` label C-cleanup
2 parents b09c254 + 6248dbc commit cc2a127

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

compiler/rustc_data_structures/src/owning_ref/mod.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
This crate provides the _owning reference_ types `OwningRef` and `OwningRefMut`
77
that enables it to bundle a reference together with the owner of the data it points to.
8-
This allows moving and dropping of a `OwningRef` without needing to recreate the reference.
8+
This allows moving and dropping of an `OwningRef` without needing to recreate the reference.
99
1010
This can sometimes be useful because Rust borrowing rules normally prevent
1111
moving a type that has been moved from. For example, this kind of code gets rejected:
@@ -1146,7 +1146,7 @@ pub type VecRef<T, U = T> = OwningRef<Vec<T>, U>;
11461146
/// Typedef of an owning reference that uses a `String` as the owner.
11471147
pub type StringRef = OwningRef<String, str>;
11481148

1149-
/// Typedef of an owning reference that uses a `Rc` as the owner.
1149+
/// Typedef of an owning reference that uses an `Rc` as the owner.
11501150
pub type RcRef<T, U = T> = OwningRef<Rc<T>, U>;
11511151
/// Typedef of an owning reference that uses an `Arc` as the owner.
11521152
pub type ArcRef<T, U = T> = OwningRef<Arc<T>, U>;
@@ -1157,9 +1157,9 @@ pub type RefRef<'a, T, U = T> = OwningRef<Ref<'a, T>, U>;
11571157
pub type RefMutRef<'a, T, U = T> = OwningRef<RefMut<'a, T>, U>;
11581158
/// Typedef of an owning reference that uses a `MutexGuard` as the owner.
11591159
pub type MutexGuardRef<'a, T, U = T> = OwningRef<MutexGuard<'a, T>, U>;
1160-
/// Typedef of an owning reference that uses a `RwLockReadGuard` as the owner.
1160+
/// Typedef of an owning reference that uses an `RwLockReadGuard` as the owner.
11611161
pub type RwLockReadGuardRef<'a, T, U = T> = OwningRef<RwLockReadGuard<'a, T>, U>;
1162-
/// Typedef of an owning reference that uses a `RwLockWriteGuard` as the owner.
1162+
/// Typedef of an owning reference that uses an `RwLockWriteGuard` as the owner.
11631163
pub type RwLockWriteGuardRef<'a, T, U = T> = OwningRef<RwLockWriteGuard<'a, T>, U>;
11641164

11651165
/// Typedef of a mutable owning reference that uses a `Box` as the owner.
@@ -1173,7 +1173,7 @@ pub type StringRefMut = OwningRefMut<String, str>;
11731173
pub type RefMutRefMut<'a, T, U = T> = OwningRefMut<RefMut<'a, T>, U>;
11741174
/// Typedef of a mutable owning reference that uses a `MutexGuard` as the owner.
11751175
pub type MutexGuardRefMut<'a, T, U = T> = OwningRefMut<MutexGuard<'a, T>, U>;
1176-
/// Typedef of a mutable owning reference that uses a `RwLockWriteGuard` as the owner.
1176+
/// Typedef of a mutable owning reference that uses an `RwLockWriteGuard` as the owner.
11771177
pub type RwLockWriteGuardRefMut<'a, T, U = T> = OwningRef<RwLockWriteGuard<'a, T>, U>;
11781178

11791179
unsafe impl<'a, T: 'a> IntoErased<'a> for Box<T> {

library/alloc/src/rc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1745,7 +1745,7 @@ impl<T: ?Sized> fmt::Pointer for Rc<T> {
17451745
#[cfg(not(no_global_oom_handling))]
17461746
#[stable(feature = "from_for_ptrs", since = "1.6.0")]
17471747
impl<T> From<T> for Rc<T> {
1748-
/// Converts a generic type `T` into a `Rc<T>`
1748+
/// Converts a generic type `T` into an `Rc<T>`
17491749
///
17501750
/// The conversion allocates on the heap and moves `t`
17511751
/// from the stack into it.

library/std/src/ffi/c_str.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,7 @@ impl From<&CStr> for Arc<CStr> {
958958

959959
#[stable(feature = "shared_from_slice2", since = "1.24.0")]
960960
impl From<CString> for Rc<CStr> {
961-
/// Converts a [`CString`] into a [`Rc`]`<CStr>` without copying or allocating.
961+
/// Converts a [`CString`] into an [`Rc`]`<CStr>` without copying or allocating.
962962
#[inline]
963963
fn from(s: CString) -> Rc<CStr> {
964964
let rc: Rc<[u8]> = Rc::from(s.into_inner());

library/std/src/ffi/os_str.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,7 @@ impl From<&OsStr> for Arc<OsStr> {
916916

917917
#[stable(feature = "shared_from_slice2", since = "1.24.0")]
918918
impl From<OsString> for Rc<OsStr> {
919-
/// Converts an [`OsString`] into a [`Rc`]`<OsStr>` without copying or allocating.
919+
/// Converts an [`OsString`] into an [`Rc`]`<OsStr>` without copying or allocating.
920920
#[inline]
921921
fn from(s: OsString) -> Rc<OsStr> {
922922
let rc = s.inner.into_rc();

src/test/ui/drop/dropck_legal_cycles.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ pub fn main() {
368368
// We can use refcells if we're single-threaded (as this test is).
369369
// If one were to generalize these constructions to a
370370
// multi-threaded context, then it might seem like we could choose
371-
// between either a RwLock or a Mutex to hold the owned arcs on
371+
// between either an RwLock or a Mutex to hold the owned arcs on
372372
// each node.
373373
//
374374
// Part of the point of this test is to actually confirm that the

0 commit comments

Comments
 (0)