Skip to content

Commit a8136c2

Browse files
authored
Rollup merge of rust-lang#84755 - jyn514:core-links, r=kennytm
Allow using `core::` in intra-doc links within core itself I came up with this idea ages ago, but rustdoc used to ICE on it. Now it doesn't. Helps with rust-lang#73445. Doesn't fix it completely since `extern crate self as std;` in std still gives strange errors.
2 parents ab9c15e + 4a63e1e commit a8136c2

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

library/core/src/intrinsics.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,7 @@ extern "rust-intrinsic" {
723723
/// macro, which panics when it is executed, it is *undefined behavior* to
724724
/// reach code marked with this function.
725725
///
726-
/// The stabilized version of this intrinsic is [`core::hint::unreachable_unchecked`](crate::hint::unreachable_unchecked).
726+
/// The stabilized version of this intrinsic is [`core::hint::unreachable_unchecked`].
727727
#[rustc_const_unstable(feature = "const_unreachable_unchecked", issue = "53188")]
728728
pub fn unreachable() -> !;
729729

@@ -768,13 +768,13 @@ extern "rust-intrinsic" {
768768
/// More specifically, this is the offset in bytes between successive
769769
/// items of the same type, including alignment padding.
770770
///
771-
/// The stabilized version of this intrinsic is [`core::mem::size_of`](crate::mem::size_of).
771+
/// The stabilized version of this intrinsic is [`core::mem::size_of`].
772772
#[rustc_const_stable(feature = "const_size_of", since = "1.40.0")]
773773
pub fn size_of<T>() -> usize;
774774

775775
/// The minimum alignment of a type.
776776
///
777-
/// The stabilized version of this intrinsic is [`core::mem::align_of`](crate::mem::align_of).
777+
/// The stabilized version of this intrinsic is [`core::mem::align_of`].
778778
#[rustc_const_stable(feature = "const_min_align_of", since = "1.40.0")]
779779
pub fn min_align_of<T>() -> usize;
780780
/// The preferred alignment of a type.
@@ -790,21 +790,21 @@ extern "rust-intrinsic" {
790790
pub fn size_of_val<T: ?Sized>(_: *const T) -> usize;
791791
/// The required alignment of the referenced value.
792792
///
793-
/// The stabilized version of this intrinsic is [`core::mem::align_of_val`](crate::mem::align_of_val).
793+
/// The stabilized version of this intrinsic is [`core::mem::align_of_val`].
794794
#[rustc_const_unstable(feature = "const_align_of_val", issue = "46571")]
795795
pub fn min_align_of_val<T: ?Sized>(_: *const T) -> usize;
796796

797797
/// Gets a static string slice containing the name of a type.
798798
///
799-
/// The stabilized version of this intrinsic is [`core::any::type_name`](crate::any::type_name).
799+
/// The stabilized version of this intrinsic is [`core::any::type_name`].
800800
#[rustc_const_unstable(feature = "const_type_name", issue = "63084")]
801801
pub fn type_name<T: ?Sized>() -> &'static str;
802802

803803
/// Gets an identifier which is globally unique to the specified type. This
804804
/// function will return the same value for a type regardless of whichever
805805
/// crate it is invoked in.
806806
///
807-
/// The stabilized version of this intrinsic is [`core::any::TypeId::of`](crate::any::TypeId::of).
807+
/// The stabilized version of this intrinsic is [`core::any::TypeId::of`].
808808
#[rustc_const_unstable(feature = "const_type_id", issue = "77125")]
809809
pub fn type_id<T: ?Sized + 'static>() -> u64;
810810

@@ -829,7 +829,7 @@ extern "rust-intrinsic" {
829829

830830
/// Gets a reference to a static `Location` indicating where it was called.
831831
///
832-
/// Consider using [`core::panic::Location::caller`](crate::panic::Location::caller) instead.
832+
/// Consider using [`core::panic::Location::caller`] instead.
833833
#[rustc_const_unstable(feature = "const_caller_location", issue = "76156")]
834834
pub fn caller_location() -> &'static crate::panic::Location<'static>;
835835

@@ -1158,11 +1158,11 @@ extern "rust-intrinsic" {
11581158

11591159
/// Performs a volatile load from the `src` pointer.
11601160
///
1161-
/// The stabilized version of this intrinsic is [`core::ptr::read_volatile`](crate::ptr::read_volatile).
1161+
/// The stabilized version of this intrinsic is [`core::ptr::read_volatile`].
11621162
pub fn volatile_load<T>(src: *const T) -> T;
11631163
/// Performs a volatile store to the `dst` pointer.
11641164
///
1165-
/// The stabilized version of this intrinsic is [`core::ptr::write_volatile`](crate::ptr::write_volatile).
1165+
/// The stabilized version of this intrinsic is [`core::ptr::write_volatile`].
11661166
pub fn volatile_store<T>(dst: *mut T, val: T);
11671167

11681168
/// Performs a volatile load from the `src` pointer
@@ -1703,7 +1703,7 @@ extern "rust-intrinsic" {
17031703
/// Returns the value of the discriminant for the variant in 'v';
17041704
/// if `T` has no discriminant, returns `0`.
17051705
///
1706-
/// The stabilized version of this intrinsic is [`core::mem::discriminant`](crate::mem::discriminant).
1706+
/// The stabilized version of this intrinsic is [`core::mem::discriminant`].
17071707
#[rustc_const_unstable(feature = "const_discriminant", issue = "69821")]
17081708
pub fn discriminant_value<T>(v: &T) -> <T as DiscriminantKind>::Discriminant;
17091709

library/core/src/lib.rs

+4
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,10 @@
169169
#![feature(int_error_matching)]
170170
#![deny(unsafe_op_in_unsafe_fn)]
171171

172+
// allow using `core::` in intra-doc links
173+
#[allow(unused_extern_crates)]
174+
extern crate self as core;
175+
172176
#[prelude_import]
173177
#[allow(unused)]
174178
use prelude::v1::*;

0 commit comments

Comments
 (0)