Skip to content

Commit 6eceb94

Browse files
Don't link "Undefined Behavior" heading
The rendered version does not make clear that this is a link to another page, and it breaks the anchor link.
1 parent b564c4a commit 6eceb94

File tree

2 files changed

+12
-28
lines changed

2 files changed

+12
-28
lines changed

src/libcore/intrinsics.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -975,7 +975,7 @@ extern "rust-intrinsic" {
975975
/// The caller must ensure that `src` points to a valid sequence of type
976976
/// `T`.
977977
///
978-
/// # [Undefined Behavior]
978+
/// # Undefined Behavior
979979
///
980980
/// Behavior is undefined if any of the following conditions are violated:
981981
///
@@ -998,8 +998,6 @@ extern "rust-intrinsic" {
998998
/// copies of `T`, regardless of whether `T: Copy`, which can result in
999999
/// undefined behavior if both copies are used.
10001000
///
1001-
/// [Undefined Behavior]: ../../reference/behavior-considered-undefined.html
1002-
///
10031001
/// # Examples
10041002
///
10051003
/// Manually implement [`Vec::append`]:
@@ -1065,7 +1063,7 @@ extern "rust-intrinsic" {
10651063
/// `copy` is unsafe because it dereferences a raw pointer. The caller must
10661064
/// ensure that `src` points to a valid sequence of type `T`.
10671065
///
1068-
/// # [Undefined Behavior]
1066+
/// # Undefined Behavior
10691067
///
10701068
/// Behavior is undefined if any of the following conditions are violated:
10711069
///
@@ -1086,7 +1084,6 @@ extern "rust-intrinsic" {
10861084
/// can result in undefined behavior if both copies are used.
10871085
///
10881086
/// [`Copy`]: ../marker/trait.Copy.html
1089-
/// [Undefined Behavior]: ../../reference/behavior-considered-undefined.html
10901087
///
10911088
/// # Examples
10921089
///
@@ -1118,7 +1115,7 @@ extern "rust-intrinsic" {
11181115
/// `write_bytes` is unsafe because it dereferences a raw pointer. The
11191116
/// caller must ensure that the poiinter points to a valid value of type `T`.
11201117
///
1121-
/// # [Undefined Behavior]
1118+
/// # Undefined Behavior
11221119
///
11231120
/// Behavior is undefined if any of the following conditions are violated:
11241121
///

src/libcore/ptr.rs

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ pub use intrinsics::write_bytes;
5757
/// `drop_in_place` is unsafe because it dereferences a raw pointer. The caller
5858
/// must ensure that the pointer points to a valid value of type `T`.
5959
///
60-
/// # [Undefined Behavior]
60+
/// # Undefined Behavior
6161
///
6262
/// Behavior is undefined if any of the following conditions are violated:
6363
///
@@ -73,7 +73,6 @@ pub use intrinsics::write_bytes;
7373
///
7474
/// [`Copy`]: ../marker/trait.Copy.html
7575
/// [`write`]: ./fn.write.html
76-
/// [Undefined Behavior]: ../../reference/behavior-considered-undefined.html
7776
///
7877
/// # Examples
7978
///
@@ -157,16 +156,14 @@ pub const fn null_mut<T>() -> *mut T { 0 as *mut T }
157156
/// `swap` is unsafe because it dereferences a raw pointer. The caller must
158157
/// ensure that both pointers point to valid values of type `T`.
159158
///
160-
/// # [Undefined Behavior]
159+
/// # Undefined Behavior
161160
///
162161
/// Behavior is undefined if any of the following conditions are violated:
163162
///
164163
/// * `x` and `y` must point to valid, initialized memory.
165164
///
166165
/// * `x` and `y` must be properly aligned.
167166
///
168-
/// [Undefined Behavior]: ../../reference/behavior-considered-undefined.html
169-
///
170167
/// # Examples
171168
///
172169
/// Swapping two non-overlapping regions:
@@ -317,16 +314,14 @@ unsafe fn swap_nonoverlapping_bytes(x: *mut u8, y: *mut u8, len: usize) {
317314
///
318315
/// [`mem::replace`]: ../mem/fn.replace.html
319316
///
320-
/// # [Undefined Behavior]
317+
/// # Undefined Behavior
321318
///
322319
/// Behavior is undefined if any of the following conditions are violated:
323320
///
324321
/// * `dest` must point to valid, initialized memory.
325322
///
326323
/// * `dest` must be properly aligned.
327324
///
328-
/// [Undefined Behavior]: ../../reference/behavior-considered-undefined.html
329-
///
330325
/// # Examples
331326
///
332327
/// ```
@@ -358,7 +353,7 @@ pub unsafe fn replace<T>(dest: *mut T, mut src: T) -> T {
358353
/// `read` is unsafe because it dereferences a raw pointer. The caller
359354
/// must ensure that the pointer points to a valid value of type `T`.
360355
///
361-
/// # [Undefined Behavior]
356+
/// # Undefined Behavior
362357
///
363358
/// Behavior is undefined if any of the following conditions are violated:
364359
///
@@ -377,7 +372,6 @@ pub unsafe fn replace<T>(dest: *mut T, mut src: T) -> T {
377372
/// [`Copy`]: ../marker/trait.Copy.html
378373
/// [`read_unaligned`]: ./fn.read_unaligned.html
379374
/// [`write`]: ./fn.write.html
380-
/// [Undefined Behavior]: ../../reference/behavior-considered-undefined.html
381375
///
382376
/// # Examples
383377
///
@@ -447,7 +441,7 @@ pub unsafe fn read<T>(src: *const T) -> T {
447441
/// `read_unaligned` is unsafe because it dereferences a raw pointer. The caller
448442
/// must ensure that the pointer points to a valid value of type `T`.
449443
///
450-
/// # [Undefined Behavior]
444+
/// # Undefined Behavior
451445
///
452446
/// Behavior is undefined if any of the following conditions are violated:
453447
///
@@ -463,7 +457,6 @@ pub unsafe fn read<T>(src: *const T) -> T {
463457
///
464458
/// [`Copy`]: ../marker/trait.Copy.html
465459
/// [`write_unaligned`]: ./fn.write_unaligned.html
466-
/// [Undefined Behavior]: ../../reference/behavior-considered-undefined.html
467460
///
468461
/// # Examples
469462
///
@@ -530,7 +523,7 @@ pub unsafe fn read_unaligned<T>(src: *const T) -> T {
530523
///
531524
/// `write` is unsafe because it dereferences a raw pointer.
532525
///
533-
/// # [Undefined Behavior]
526+
/// # Undefined Behavior
534527
///
535528
/// `write` can trigger undefined behavior if any of the following conditions
536529
/// are violated:
@@ -540,7 +533,6 @@ pub unsafe fn read_unaligned<T>(src: *const T) -> T {
540533
/// * `dst` must be properly aligned. Use [`write_unaligned`] if this is not the
541534
/// case.
542535
///
543-
/// [Undefined Behavior]: ../../reference/behavior-considered-undefined.html
544536
/// [`write_unaligned`]: ./fn.write_unaligned.html
545537
///
546538
/// # Examples
@@ -609,15 +601,13 @@ pub unsafe fn write<T>(dst: *mut T, src: T) {
609601
///
610602
/// `write_unaligned` is unsafe because it dereferences a raw pointer.
611603
///
612-
/// # [Undefined Behavior]
604+
/// # Undefined Behavior
613605
///
614606
/// `write_unaligned` can trigger undefined behavior if any of the following
615607
/// conditions are violated:
616608
///
617609
/// * `dst` must point to valid memory.
618610
///
619-
/// [Undefined Behavior]: ../../reference/behavior-considered-undefined.html
620-
///
621611
/// # Examples
622612
///
623613
/// Access fields in a packed struct:
@@ -684,7 +674,7 @@ pub unsafe fn write_unaligned<T>(dst: *mut T, src: T) {
684674
/// `read_volatile` is unsafe because it dereferences a raw pointer. The caller
685675
/// must ensure that the pointer points to a valid value of type `T`.
686676
///
687-
/// # [Undefined Behavior]
677+
/// # Undefined Behavior
688678
///
689679
/// Behavior is undefined if any of the following conditions are violated:
690680
///
@@ -702,7 +692,6 @@ pub unsafe fn write_unaligned<T>(dst: *mut T, src: T) {
702692
///
703693
/// [`Copy`]: ../marker/trait.Copy.html
704694
/// [`write_volatile`]: ./fn.write_volatile.html
705-
/// [Undefined Behavior]: ../../reference/behavior-considered-undefined.html
706695
///
707696
/// # Examples
708697
///
@@ -754,7 +743,7 @@ pub unsafe fn read_volatile<T>(src: *const T) -> T {
754743
///
755744
/// `write_volatile` is unsafe because it dereferences a raw pointer.
756745
///
757-
/// # [Undefined Behavior]
746+
/// # Undefined Behavior
758747
///
759748
/// `write_volatile` can trigger undefined behavior if any of the following
760749
/// conditions are violated:
@@ -763,8 +752,6 @@ pub unsafe fn read_volatile<T>(src: *const T) -> T {
763752
///
764753
/// * `dst` must be properly aligned.
765754
///
766-
/// [Undefined Behavior]: ../../reference/behavior-considered-undefined.html
767-
///
768755
/// # Examples
769756
///
770757
/// Basic usage:

0 commit comments

Comments
 (0)