Skip to content

Commit 37e1298

Browse files
committed
rebase
1 parent 899c895 commit 37e1298

File tree

4 files changed

+1650
-3
lines changed

4 files changed

+1650
-3
lines changed

library/core/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -281,10 +281,11 @@
281281
#[allow(unused_extern_crates)]
282282
extern crate self as core;
283283

284+
#[allow(unused_imports)]
285+
use crate::marker::FnPtr;
284286
#[prelude_import]
285287
#[allow(unused)]
286288
use prelude::v1::*;
287-
288289
#[cfg(not(test))] // See #65860
289290
#[macro_use]
290291
mod macros;
@@ -453,5 +454,4 @@ pub mod simd {
453454
#[unstable(feature = "portable_simd", issue = "86656")]
454455
pub use crate::core_simd::simd::*;
455456
}
456-
457457
include!("primitive_docs.rs");

library/core/src/primitive_docs.rs

+36
Original file line numberDiff line numberDiff line change
@@ -1655,6 +1655,7 @@ mod prim_ref {}
16551655
/// * [`Clone`]
16561656
/// * [`Copy`]
16571657
/// * [`Send`]
1658+
/// * [`Sized`]
16581659
/// * [`Sync`]
16591660
/// * [`Unpin`]
16601661
/// * [`UnwindSafe`]
@@ -1670,6 +1671,41 @@ mod prim_ref {}
16701671
#[stable(feature = "rust1", since = "1.0.0")]
16711672
mod prim_fn {}
16721673

1674+
// Fake impl that's only really used for docs.
1675+
#[cfg(doc)]
1676+
#[stable(feature = "rust1", since = "1.0.0")]
1677+
#[doc(fake_variadic)]
1678+
/// This trait is implemented on function pointers with any number of arguments.
1679+
impl<Ret, T> Clone for fn(T) -> Ret {
1680+
fn clone(&self) -> Self {
1681+
loop {}
1682+
}
1683+
}
1684+
1685+
// Fake impl that's only really used for docs.
1686+
#[cfg(doc)]
1687+
#[stable(feature = "rust1", since = "1.0.0")]
1688+
#[doc(fake_variadic)]
1689+
/// This trait is implemented on function pointers with any number of arguments.
1690+
impl<Ret, T> Copy for fn(T) -> Ret {
1691+
// empty
1692+
}
1693+
1694+
// Fake impl that's only really used for docs.
1695+
#[cfg(doc)]
1696+
#[unstable(
1697+
feature = "fn_ptr_trait",
1698+
issue = "none",
1699+
reason = "internal trait for implementing various traits for all function pointers"
1700+
)]
1701+
#[doc(fake_variadic)]
1702+
/// This trait is implemented on function pointers with any number of arguments.
1703+
impl<Ret, T> FnPtr for fn(T) -> Ret {
1704+
fn addr(self) -> *const () {
1705+
// empty
1706+
}
1707+
}
1708+
16731709
// Required to make auto trait impls render.
16741710
// See src/librustdoc/passes/collect_trait_impls.rs:collect_trait_impls
16751711
#[doc(hidden)]

library/std/src/lib.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,7 @@
381381
#![feature(const_format_args)]
382382
#![feature(custom_test_frameworks)]
383383
#![feature(edition_panic)]
384+
#![feature(fn_ptr_trait)]
384385
#![feature(format_args_nl)]
385386
#![feature(get_many_mut)]
386387
#![feature(lazy_cell)]
@@ -408,10 +409,11 @@
408409

409410
// Explicitly import the prelude. The compiler uses this same unstable attribute
410411
// to import the prelude implicitly when building crates that depend on std.
412+
#[allow(unused_imports)]
413+
use crate::marker::FnPtr;
411414
#[prelude_import]
412415
#[allow(unused)]
413416
use prelude::rust_2021::*;
414-
415417
// Access to Bencher, etc.
416418
#[cfg(test)]
417419
extern crate test;

0 commit comments

Comments
 (0)