@@ -26,15 +26,15 @@ use hash::Hasher;
2626/// appropriate.
2727///
2828/// An example of a non-`Send` type is the reference-counting pointer
29- /// [`rc::Rc`][rc ]. If two threads attempt to clone `Rc`s that point to the same
29+ /// [`rc::Rc`][`Rc` ]. If two threads attempt to clone [ `Rc`] s that point to the same
3030/// reference-counted value, they might try to update the reference count at the
31- /// same time, which is [undefined behavior][ub] because `Rc` doesn't use atomic
31+ /// same time, which is [undefined behavior][ub] because [ `Rc`] doesn't use atomic
3232/// operations. Its cousin [`sync::Arc`][arc] does use atomic operations (incurring
3333/// some overhead) and thus is `Send`.
3434///
3535/// See [the Nomicon](../../nomicon/send-and-sync.html) for more details.
3636///
37- /// [rc ]: ../../std/rc/struct.Rc.html
37+ /// [`Rc` ]: ../../std/rc/struct.Rc.html
3838/// [arc]: ../../std/sync/struct.Arc.html
3939/// [ub]: ../../reference.html#behavior-considered-undefined
4040#[ stable( feature = "rust1" , since = "1.0.0" ) ]
@@ -183,20 +183,17 @@ pub trait Unsize<T: ?Sized> {
183183/// Copies happen implicitly, for example as part of an assignment `y = x`. The behavior of
184184/// `Copy` is not overloadable; it is always a simple bit-wise copy.
185185///
186- /// Cloning is an explicit action, `x.clone()`. The implementation of [`Clone`][clone] can
186+ /// Cloning is an explicit action, `x.clone()`. The implementation of [`Clone`] can
187187/// provide any type-specific behavior necessary to duplicate values safely. For example,
188- /// the implementation of `Clone` for [`String`][string ] needs to copy the pointed-to string
189- /// buffer in the heap. A simple bitwise copy of `String` values would merely copy the
190- /// pointer, leading to a double free down the line. For this reason, `String` is `Clone`
188+ /// the implementation of [ `Clone`] for [`String`] needs to copy the pointed-to string
189+ /// buffer in the heap. A simple bitwise copy of [ `String`] values would merely copy the
190+ /// pointer, leading to a double free down the line. For this reason, [ `String`] is [ `Clone`]
191191/// but not `Copy`.
192192///
193- /// `Clone` is a supertrait of `Copy`, so everything which is `Copy` must also implement
194- /// `Clone`. If a type is `Copy` then its `Clone` implementation need only return `*self`
193+ /// [ `Clone`] is a supertrait of `Copy`, so everything which is `Copy` must also implement
194+ /// [ `Clone`] . If a type is `Copy` then its [ `Clone`] implementation need only return `*self`
195195/// (see the example above).
196196///
197- /// [clone]: ../clone/trait.Clone.html
198- /// [string]: ../../std/string/struct.String.html
199- ///
200197/// ## When can my type be `Copy`?
201198///
202199/// A type can implement `Copy` if all of its components implement `Copy`. For example, this
@@ -210,7 +207,7 @@ pub trait Unsize<T: ?Sized> {
210207/// }
211208/// ```
212209///
213- /// A struct can be `Copy`, and `i32` is `Copy`, therefore `Point` is eligible to be `Copy`.
210+ /// A struct can be `Copy`, and [ `i32`] is `Copy`, therefore `Point` is eligible to be `Copy`.
214211/// By contrast, consider
215212///
216213/// ```
@@ -231,8 +228,8 @@ pub trait Unsize<T: ?Sized> {
231228/// ## When *can't* my type be `Copy`?
232229///
233230/// Some types can't be copied safely. For example, copying `&mut T` would create an aliased
234- /// mutable reference. Copying [`String`] would duplicate responsibility for managing the `String`'s
235- /// buffer, leading to a double free.
231+ /// mutable reference. Copying [`String`] would duplicate responsibility for managing the
232+ /// [`String`]'s buffer, leading to a double free.
236233///
237234/// Generalizing the latter case, any type implementing [`Drop`] can't be `Copy`, because it's
238235/// managing some resource besides its own [`size_of::<T>()`] bytes.
@@ -255,6 +252,9 @@ pub trait Unsize<T: ?Sized> {
255252/// [`String`]: ../../std/string/struct.String.html
256253/// [`Drop`]: ../../std/ops/trait.Drop.html
257254/// [`size_of::<T>()`]: ../../std/mem/fn.size_of.html
255+ /// [`Clone`]: ../clone/trait.Clone.html
256+ /// [`String`]: ../../std/string/struct.String.html
257+ /// [`i32`]: ../../std/primitive.i32.html
258258#[ stable( feature = "rust1" , since = "1.0.0" ) ]
259259#[ lang = "copy" ]
260260pub trait Copy : Clone {
@@ -290,20 +290,20 @@ pub trait Copy : Clone {
290290/// mutability" in a non-thread-safe form, such as [`cell::Cell`][cell]
291291/// and [`cell::RefCell`][refcell]. These types allow for mutation of
292292/// their contents even through an immutable, shared reference. For
293- /// example the `set` method on `Cell<T>` takes `&self`, so it requires
294- /// only a shared reference `&Cell<T>`. The method performs no
295- /// synchronization, thus `Cell` cannot be `Sync`.
293+ /// example the `set` method on [ `Cell<T>`][cell] takes `&self`, so it requires
294+ /// only a shared reference [ `&Cell<T>`][cell] . The method performs no
295+ /// synchronization, thus [ `Cell`][cell] cannot be `Sync`.
296296///
297297/// Another example of a non-`Sync` type is the reference-counting
298- /// pointer [`rc::Rc`][rc]. Given any reference `&Rc<T>`, you can clone
299- /// a new `Rc<T>`, modifying the reference counts in a non-atomic way.
298+ /// pointer [`rc::Rc`][rc]. Given any reference [ `&Rc<T>`][rc] , you can clone
299+ /// a new [ `Rc<T>`][rc] , modifying the reference counts in a non-atomic way.
300300///
301301/// For cases when one does need thread-safe interior mutability,
302302/// Rust provides [atomic data types], as well as explicit locking via
303303/// [`sync::Mutex`][mutex] and [`sync::RWLock`][rwlock]. These types
304304/// ensure that any mutation cannot cause data races, hence the types
305305/// are `Sync`. Likewise, [`sync::Arc`][arc] provides a thread-safe
306- /// analogue of `Rc`.
306+ /// analogue of [ `Rc`][rc] .
307307///
308308/// Any types with interior mutability must also use the
309309/// [`cell::UnsafeCell`][unsafecell] wrapper around the value(s) which
0 commit comments