mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-21 20:17:55 +00:00
Auto merge of #57737 - Centril:rollup, r=Centril
Rollup of 10 pull requests Successful merges: - #56594 (Remove confusing comment about ideally using `!` for `c_void`) - #57340 (Use correct tracking issue for c_variadic) - #57357 (Cleanup PartialEq docs.) - #57551 (resolve: Add a test for issue #57539) - #57636 (Fix sources sidebar not showing up) - #57646 (Fixes text becoming invisible when element targetted) - #57654 (Add some links in std::fs.) - #57683 (Document Unpin in std::prelude documentation) - #57685 (Enhance `Pin` impl applicability for `PartialEq` and `PartialOrd`.) - #57710 (Fix non-clickable urls) Failed merges: r? @ghost
This commit is contained in:
commit
c76f3c374f
@ -91,6 +91,8 @@ use self::Ordering::*;
|
|||||||
/// For example, let's tweak our previous code a bit:
|
/// For example, let's tweak our previous code a bit:
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
|
/// // The derive implements <BookFormat> == <BookFormat> comparisons
|
||||||
|
/// #[derive(PartialEq)]
|
||||||
/// enum BookFormat {
|
/// enum BookFormat {
|
||||||
/// Paperback,
|
/// Paperback,
|
||||||
/// Hardback,
|
/// Hardback,
|
||||||
@ -102,31 +104,34 @@ use self::Ordering::*;
|
|||||||
/// format: BookFormat,
|
/// format: BookFormat,
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
|
/// // Implement <Book> == <BookFormat> comparisons
|
||||||
/// impl PartialEq<BookFormat> for Book {
|
/// impl PartialEq<BookFormat> for Book {
|
||||||
/// fn eq(&self, other: &BookFormat) -> bool {
|
/// fn eq(&self, other: &BookFormat) -> bool {
|
||||||
/// match (&self.format, other) {
|
/// self.format == *other
|
||||||
/// (BookFormat::Paperback, BookFormat::Paperback) => true,
|
/// }
|
||||||
/// (BookFormat::Hardback, BookFormat::Hardback) => true,
|
/// }
|
||||||
/// (BookFormat::Ebook, BookFormat::Ebook) => true,
|
///
|
||||||
/// (_, _) => false,
|
/// // Implement <BookFormat> == <Book> comparisons
|
||||||
/// }
|
/// impl PartialEq<Book> for BookFormat {
|
||||||
|
/// fn eq(&self, other: &Book) -> bool {
|
||||||
|
/// *self == other.format
|
||||||
/// }
|
/// }
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// let b1 = Book { isbn: 3, format: BookFormat::Paperback };
|
/// let b1 = Book { isbn: 3, format: BookFormat::Paperback };
|
||||||
///
|
///
|
||||||
/// assert!(b1 == BookFormat::Paperback);
|
/// assert!(b1 == BookFormat::Paperback);
|
||||||
/// assert!(b1 != BookFormat::Ebook);
|
/// assert!(BookFormat::Ebook != b1);
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// By changing `impl PartialEq for Book` to `impl PartialEq<BookFormat> for Book`,
|
/// By changing `impl PartialEq for Book` to `impl PartialEq<BookFormat> for Book`,
|
||||||
/// we've changed what type we can use on the right side of the `==` operator.
|
/// we allow `BookFormat`s to be compared with `Book`s.
|
||||||
/// This lets us use it in the `assert!` statements at the bottom.
|
|
||||||
///
|
///
|
||||||
/// You can also combine these implementations to let the `==` operator work with
|
/// You can also combine these implementations to let the `==` operator work with
|
||||||
/// two different types:
|
/// two different types:
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
|
/// #[derive(PartialEq)]
|
||||||
/// enum BookFormat {
|
/// enum BookFormat {
|
||||||
/// Paperback,
|
/// Paperback,
|
||||||
/// Hardback,
|
/// Hardback,
|
||||||
@ -140,12 +145,13 @@ use self::Ordering::*;
|
|||||||
///
|
///
|
||||||
/// impl PartialEq<BookFormat> for Book {
|
/// impl PartialEq<BookFormat> for Book {
|
||||||
/// fn eq(&self, other: &BookFormat) -> bool {
|
/// fn eq(&self, other: &BookFormat) -> bool {
|
||||||
/// match (&self.format, other) {
|
/// self.format == *other
|
||||||
/// (&BookFormat::Paperback, &BookFormat::Paperback) => true,
|
/// }
|
||||||
/// (&BookFormat::Hardback, &BookFormat::Hardback) => true,
|
/// }
|
||||||
/// (&BookFormat::Ebook, &BookFormat::Ebook) => true,
|
///
|
||||||
/// (_, _) => false,
|
/// impl PartialEq<Book> for BookFormat {
|
||||||
/// }
|
/// fn eq(&self, other: &Book) -> bool {
|
||||||
|
/// *self == other.format
|
||||||
/// }
|
/// }
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
@ -159,7 +165,7 @@ use self::Ordering::*;
|
|||||||
/// let b2 = Book { isbn: 3, format: BookFormat::Ebook };
|
/// let b2 = Book { isbn: 3, format: BookFormat::Ebook };
|
||||||
///
|
///
|
||||||
/// assert!(b1 == BookFormat::Paperback);
|
/// assert!(b1 == BookFormat::Paperback);
|
||||||
/// assert!(b1 != BookFormat::Ebook);
|
/// assert!(BookFormat::Ebook != b1);
|
||||||
/// assert!(b1 == b2);
|
/// assert!(b1 == b2);
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
|
@ -12,24 +12,27 @@ use ::fmt;
|
|||||||
/// and `*mut c_void` is equivalent to C's `void*`. That said, this is
|
/// and `*mut c_void` is equivalent to C's `void*`. That said, this is
|
||||||
/// *not* the same as C's `void` return type, which is Rust's `()` type.
|
/// *not* the same as C's `void` return type, which is Rust's `()` type.
|
||||||
///
|
///
|
||||||
/// Ideally, this type would be equivalent to [`!`], but currently it may
|
/// To model pointers to opaque types in FFI, until `extern type` is
|
||||||
/// be more ideal to use `c_void` for FFI purposes.
|
/// stabilized, it is recommended to use a newtype wrapper around an empty
|
||||||
|
/// byte array. See the [Nomicon] for details.
|
||||||
///
|
///
|
||||||
/// [`!`]: ../../std/primitive.never.html
|
|
||||||
/// [pointer]: ../../std/primitive.pointer.html
|
/// [pointer]: ../../std/primitive.pointer.html
|
||||||
|
/// [Nomicon]: https://doc.rust-lang.org/nomicon/ffi.html#representing-opaque-structs
|
||||||
// N.B., for LLVM to recognize the void pointer type and by extension
|
// N.B., for LLVM to recognize the void pointer type and by extension
|
||||||
// functions like malloc(), we need to have it represented as i8* in
|
// functions like malloc(), we need to have it represented as i8* in
|
||||||
// LLVM bitcode. The enum used here ensures this and prevents misuse
|
// LLVM bitcode. The enum used here ensures this and prevents misuse
|
||||||
// of the "raw" type by only having private variants.. We need two
|
// of the "raw" type by only having private variants. We need two
|
||||||
// variants, because the compiler complains about the repr attribute
|
// variants, because the compiler complains about the repr attribute
|
||||||
// otherwise.
|
// otherwise and we need at least one variant as otherwise the enum
|
||||||
|
// would be uninhabited and at least dereferencing such pointers would
|
||||||
|
// be UB.
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
#[stable(feature = "raw_os", since = "1.1.0")]
|
#[stable(feature = "raw_os", since = "1.1.0")]
|
||||||
pub enum c_void {
|
pub enum c_void {
|
||||||
#[unstable(feature = "c_void_variant", reason = "should not have to exist",
|
#[unstable(feature = "c_void_variant", reason = "temporary implementation detail",
|
||||||
issue = "0")]
|
issue = "0")]
|
||||||
#[doc(hidden)] __variant1,
|
#[doc(hidden)] __variant1,
|
||||||
#[unstable(feature = "c_void_variant", reason = "should not have to exist",
|
#[unstable(feature = "c_void_variant", reason = "temporary implementation detail",
|
||||||
issue = "0")]
|
issue = "0")]
|
||||||
#[doc(hidden)] __variant2,
|
#[doc(hidden)] __variant2,
|
||||||
}
|
}
|
||||||
@ -49,7 +52,7 @@ impl fmt::Debug for c_void {
|
|||||||
#[unstable(feature = "c_variadic",
|
#[unstable(feature = "c_variadic",
|
||||||
reason = "the `c_variadic` feature has not been properly tested on \
|
reason = "the `c_variadic` feature has not been properly tested on \
|
||||||
all supported platforms",
|
all supported platforms",
|
||||||
issue = "27745")]
|
issue = "44930")]
|
||||||
extern {
|
extern {
|
||||||
type VaListImpl;
|
type VaListImpl;
|
||||||
}
|
}
|
||||||
@ -74,7 +77,7 @@ impl fmt::Debug for VaListImpl {
|
|||||||
#[unstable(feature = "c_variadic",
|
#[unstable(feature = "c_variadic",
|
||||||
reason = "the `c_variadic` feature has not been properly tested on \
|
reason = "the `c_variadic` feature has not been properly tested on \
|
||||||
all supported platforms",
|
all supported platforms",
|
||||||
issue = "27745")]
|
issue = "44930")]
|
||||||
struct VaListImpl {
|
struct VaListImpl {
|
||||||
stack: *mut (),
|
stack: *mut (),
|
||||||
gr_top: *mut (),
|
gr_top: *mut (),
|
||||||
@ -90,7 +93,7 @@ struct VaListImpl {
|
|||||||
#[unstable(feature = "c_variadic",
|
#[unstable(feature = "c_variadic",
|
||||||
reason = "the `c_variadic` feature has not been properly tested on \
|
reason = "the `c_variadic` feature has not been properly tested on \
|
||||||
all supported platforms",
|
all supported platforms",
|
||||||
issue = "27745")]
|
issue = "44930")]
|
||||||
struct VaListImpl {
|
struct VaListImpl {
|
||||||
gpr: u8,
|
gpr: u8,
|
||||||
fpr: u8,
|
fpr: u8,
|
||||||
@ -106,7 +109,7 @@ struct VaListImpl {
|
|||||||
#[unstable(feature = "c_variadic",
|
#[unstable(feature = "c_variadic",
|
||||||
reason = "the `c_variadic` feature has not been properly tested on \
|
reason = "the `c_variadic` feature has not been properly tested on \
|
||||||
all supported platforms",
|
all supported platforms",
|
||||||
issue = "27745")]
|
issue = "44930")]
|
||||||
struct VaListImpl {
|
struct VaListImpl {
|
||||||
gp_offset: i32,
|
gp_offset: i32,
|
||||||
fp_offset: i32,
|
fp_offset: i32,
|
||||||
@ -120,7 +123,7 @@ struct VaListImpl {
|
|||||||
#[unstable(feature = "c_variadic",
|
#[unstable(feature = "c_variadic",
|
||||||
reason = "the `c_variadic` feature has not been properly tested on \
|
reason = "the `c_variadic` feature has not been properly tested on \
|
||||||
all supported platforms",
|
all supported platforms",
|
||||||
issue = "27745")]
|
issue = "44930")]
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
pub struct VaList<'a>(&'a mut VaListImpl);
|
pub struct VaList<'a>(&'a mut VaListImpl);
|
||||||
|
|
||||||
@ -140,7 +143,7 @@ mod sealed_trait {
|
|||||||
#[unstable(feature = "c_variadic",
|
#[unstable(feature = "c_variadic",
|
||||||
reason = "the `c_variadic` feature has not been properly tested on \
|
reason = "the `c_variadic` feature has not been properly tested on \
|
||||||
all supported platforms",
|
all supported platforms",
|
||||||
issue = "27745")]
|
issue = "44930")]
|
||||||
pub trait VaArgSafe {}
|
pub trait VaArgSafe {}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,7 +153,7 @@ macro_rules! impl_va_arg_safe {
|
|||||||
#[unstable(feature = "c_variadic",
|
#[unstable(feature = "c_variadic",
|
||||||
reason = "the `c_variadic` feature has not been properly tested on \
|
reason = "the `c_variadic` feature has not been properly tested on \
|
||||||
all supported platforms",
|
all supported platforms",
|
||||||
issue = "27745")]
|
issue = "44930")]
|
||||||
impl sealed_trait::VaArgSafe for $t {}
|
impl sealed_trait::VaArgSafe for $t {}
|
||||||
)+
|
)+
|
||||||
}
|
}
|
||||||
@ -163,12 +166,12 @@ impl_va_arg_safe!{f64}
|
|||||||
#[unstable(feature = "c_variadic",
|
#[unstable(feature = "c_variadic",
|
||||||
reason = "the `c_variadic` feature has not been properly tested on \
|
reason = "the `c_variadic` feature has not been properly tested on \
|
||||||
all supported platforms",
|
all supported platforms",
|
||||||
issue = "27745")]
|
issue = "44930")]
|
||||||
impl<T> sealed_trait::VaArgSafe for *mut T {}
|
impl<T> sealed_trait::VaArgSafe for *mut T {}
|
||||||
#[unstable(feature = "c_variadic",
|
#[unstable(feature = "c_variadic",
|
||||||
reason = "the `c_variadic` feature has not been properly tested on \
|
reason = "the `c_variadic` feature has not been properly tested on \
|
||||||
all supported platforms",
|
all supported platforms",
|
||||||
issue = "27745")]
|
issue = "44930")]
|
||||||
impl<T> sealed_trait::VaArgSafe for *const T {}
|
impl<T> sealed_trait::VaArgSafe for *const T {}
|
||||||
|
|
||||||
impl<'a> VaList<'a> {
|
impl<'a> VaList<'a> {
|
||||||
@ -176,7 +179,7 @@ impl<'a> VaList<'a> {
|
|||||||
#[unstable(feature = "c_variadic",
|
#[unstable(feature = "c_variadic",
|
||||||
reason = "the `c_variadic` feature has not been properly tested on \
|
reason = "the `c_variadic` feature has not been properly tested on \
|
||||||
all supported platforms",
|
all supported platforms",
|
||||||
issue = "27745")]
|
issue = "44930")]
|
||||||
pub unsafe fn arg<T: sealed_trait::VaArgSafe>(&mut self) -> T {
|
pub unsafe fn arg<T: sealed_trait::VaArgSafe>(&mut self) -> T {
|
||||||
va_arg(self)
|
va_arg(self)
|
||||||
}
|
}
|
||||||
@ -185,7 +188,7 @@ impl<'a> VaList<'a> {
|
|||||||
#[unstable(feature = "c_variadic",
|
#[unstable(feature = "c_variadic",
|
||||||
reason = "the `c_variadic` feature has not been properly tested on \
|
reason = "the `c_variadic` feature has not been properly tested on \
|
||||||
all supported platforms",
|
all supported platforms",
|
||||||
issue = "27745")]
|
issue = "44930")]
|
||||||
pub unsafe fn copy<F, R>(&self, f: F) -> R
|
pub unsafe fn copy<F, R>(&self, f: F) -> R
|
||||||
where F: for<'copy> FnOnce(VaList<'copy>) -> R {
|
where F: for<'copy> FnOnce(VaList<'copy>) -> R {
|
||||||
#[cfg(any(all(not(target_arch = "aarch64"), not(target_arch = "powerpc"),
|
#[cfg(any(all(not(target_arch = "aarch64"), not(target_arch = "powerpc"),
|
||||||
|
@ -99,6 +99,7 @@
|
|||||||
|
|
||||||
use fmt;
|
use fmt;
|
||||||
use marker::{Sized, Unpin};
|
use marker::{Sized, Unpin};
|
||||||
|
use cmp::{self, PartialEq, PartialOrd};
|
||||||
use ops::{Deref, DerefMut, Receiver, CoerceUnsized, DispatchFromDyn};
|
use ops::{Deref, DerefMut, Receiver, CoerceUnsized, DispatchFromDyn};
|
||||||
|
|
||||||
/// A pinned pointer.
|
/// A pinned pointer.
|
||||||
@ -112,16 +113,57 @@ use ops::{Deref, DerefMut, Receiver, CoerceUnsized, DispatchFromDyn};
|
|||||||
/// [`Unpin`]: ../../std/marker/trait.Unpin.html
|
/// [`Unpin`]: ../../std/marker/trait.Unpin.html
|
||||||
/// [`pin` module]: ../../std/pin/index.html
|
/// [`pin` module]: ../../std/pin/index.html
|
||||||
//
|
//
|
||||||
// Note: the derives below are allowed because they all only use `&P`, so they
|
// Note: the derives below, and the explicit `PartialEq` and `PartialOrd`
|
||||||
// cannot move the value behind `pointer`.
|
// implementations, are allowed because they all only use `&P`, so they cannot move
|
||||||
|
// the value behind `pointer`.
|
||||||
#[stable(feature = "pin", since = "1.33.0")]
|
#[stable(feature = "pin", since = "1.33.0")]
|
||||||
#[fundamental]
|
#[fundamental]
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
#[derive(Copy, Clone, Hash, Eq, PartialEq, Ord, PartialOrd)]
|
#[derive(Copy, Clone, Hash, Eq, Ord)]
|
||||||
pub struct Pin<P> {
|
pub struct Pin<P> {
|
||||||
pointer: P,
|
pointer: P,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[stable(feature = "pin_partialeq_partialord_impl_applicability", since = "1.34.0")]
|
||||||
|
impl<P, Q> PartialEq<Pin<Q>> for Pin<P>
|
||||||
|
where
|
||||||
|
P: PartialEq<Q>,
|
||||||
|
{
|
||||||
|
fn eq(&self, other: &Pin<Q>) -> bool {
|
||||||
|
self.pointer == other.pointer
|
||||||
|
}
|
||||||
|
|
||||||
|
fn ne(&self, other: &Pin<Q>) -> bool {
|
||||||
|
self.pointer != other.pointer
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[stable(feature = "pin_partialeq_partialord_impl_applicability", since = "1.34.0")]
|
||||||
|
impl<P, Q> PartialOrd<Pin<Q>> for Pin<P>
|
||||||
|
where
|
||||||
|
P: PartialOrd<Q>,
|
||||||
|
{
|
||||||
|
fn partial_cmp(&self, other: &Pin<Q>) -> Option<cmp::Ordering> {
|
||||||
|
self.pointer.partial_cmp(&other.pointer)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn lt(&self, other: &Pin<Q>) -> bool {
|
||||||
|
self.pointer < other.pointer
|
||||||
|
}
|
||||||
|
|
||||||
|
fn le(&self, other: &Pin<Q>) -> bool {
|
||||||
|
self.pointer <= other.pointer
|
||||||
|
}
|
||||||
|
|
||||||
|
fn gt(&self, other: &Pin<Q>) -> bool {
|
||||||
|
self.pointer > other.pointer
|
||||||
|
}
|
||||||
|
|
||||||
|
fn ge(&self, other: &Pin<Q>) -> bool {
|
||||||
|
self.pointer >= other.pointer
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<P: Deref> Pin<P>
|
impl<P: Deref> Pin<P>
|
||||||
where
|
where
|
||||||
P::Target: Unpin,
|
P::Target: Unpin,
|
||||||
|
@ -1076,7 +1076,7 @@ themePicker.onblur = handleThemeButtonsBlur;
|
|||||||
all_sources.sort();
|
all_sources.sort();
|
||||||
let mut w = try_err!(File::create(&dst), &dst);
|
let mut w = try_err!(File::create(&dst), &dst);
|
||||||
try_err!(writeln!(&mut w,
|
try_err!(writeln!(&mut w,
|
||||||
"var N = null;var sourcesIndex = {{}};\n{}",
|
"var N = null;var sourcesIndex = {{}};\n{}\ncreateSourceSidebar();",
|
||||||
all_sources.join("\n")),
|
all_sources.join("\n")),
|
||||||
&dst);
|
&dst);
|
||||||
}
|
}
|
||||||
|
@ -391,10 +391,6 @@ h4 > code, h3 > code, .invisible > code {
|
|||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.in-band, code {
|
|
||||||
z-index: -5;
|
|
||||||
}
|
|
||||||
|
|
||||||
.invisible {
|
.invisible {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
@ -137,5 +137,3 @@ function createSourceSidebar() {
|
|||||||
|
|
||||||
main.insertBefore(sidebar, main.firstChild);
|
main.insertBefore(sidebar, main.firstChild);
|
||||||
}
|
}
|
||||||
|
|
||||||
createSourceSidebar();
|
|
||||||
|
@ -82,12 +82,6 @@ pre {
|
|||||||
border-bottom-color: #ddd;
|
border-bottom-color: #ddd;
|
||||||
}
|
}
|
||||||
|
|
||||||
:target { background: #494a3d; }
|
|
||||||
|
|
||||||
:target > .in-band {
|
|
||||||
background: #494a3d;
|
|
||||||
}
|
|
||||||
|
|
||||||
.content .method .where,
|
.content .method .where,
|
||||||
.content .fn .where,
|
.content .fn .where,
|
||||||
.content .where.fmt-newline {
|
.content .where.fmt-newline {
|
||||||
@ -252,7 +246,7 @@ a.test-arrow:hover{
|
|||||||
color: #999;
|
color: #999;
|
||||||
}
|
}
|
||||||
|
|
||||||
:target > code {
|
:target > code, :target > .in-band {
|
||||||
background-color: #494a3d;
|
background-color: #494a3d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,12 +84,6 @@ pre {
|
|||||||
border-bottom-color: #ddd;
|
border-bottom-color: #ddd;
|
||||||
}
|
}
|
||||||
|
|
||||||
:target { background: #FDFFD3; }
|
|
||||||
|
|
||||||
:target > .in-band {
|
|
||||||
background: #FDFFD3;
|
|
||||||
}
|
|
||||||
|
|
||||||
.content .method .where,
|
.content .method .where,
|
||||||
.content .fn .where,
|
.content .fn .where,
|
||||||
.content .where.fmt-newline {
|
.content .where.fmt-newline {
|
||||||
@ -247,7 +241,7 @@ a.test-arrow:hover{
|
|||||||
color: #999;
|
color: #999;
|
||||||
}
|
}
|
||||||
|
|
||||||
:target > code {
|
:target > code, :target > .in-band {
|
||||||
background: #FDFFD3;
|
background: #FDFFD3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,7 +169,7 @@ pub use core::ffi::c_void;
|
|||||||
#[unstable(feature = "c_variadic",
|
#[unstable(feature = "c_variadic",
|
||||||
reason = "the `c_variadic` feature has not been properly tested on \
|
reason = "the `c_variadic` feature has not been properly tested on \
|
||||||
all supported platforms",
|
all supported platforms",
|
||||||
issue = "27745")]
|
issue = "44930")]
|
||||||
pub use core::ffi::VaList;
|
pub use core::ffi::VaList;
|
||||||
|
|
||||||
mod c_str;
|
mod c_str;
|
||||||
|
@ -1121,7 +1121,9 @@ impl Permissions {
|
|||||||
/// writing.
|
/// writing.
|
||||||
///
|
///
|
||||||
/// This operation does **not** modify the filesystem. To modify the
|
/// This operation does **not** modify the filesystem. To modify the
|
||||||
/// filesystem use the `fs::set_permissions` function.
|
/// filesystem use the [`fs::set_permissions`] function.
|
||||||
|
///
|
||||||
|
/// [`fs::set_permissions`]: fn.set_permissions.html
|
||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
@ -1639,10 +1641,15 @@ pub fn hard_link<P: AsRef<Path>, Q: AsRef<Path>>(src: P, dst: Q) -> io::Result<(
|
|||||||
///
|
///
|
||||||
/// The `dst` path will be a symbolic link pointing to the `src` path.
|
/// The `dst` path will be a symbolic link pointing to the `src` path.
|
||||||
/// On Windows, this will be a file symlink, not a directory symlink;
|
/// On Windows, this will be a file symlink, not a directory symlink;
|
||||||
/// for this reason, the platform-specific `std::os::unix::fs::symlink`
|
/// for this reason, the platform-specific [`std::os::unix::fs::symlink`]
|
||||||
/// and `std::os::windows::fs::{symlink_file, symlink_dir}` should be
|
/// and [`std::os::windows::fs::symlink_file`] or [`symlink_dir`] should be
|
||||||
/// used instead to make the intent explicit.
|
/// used instead to make the intent explicit.
|
||||||
///
|
///
|
||||||
|
/// [`std::os::unix::fs::symlink`]: ../os/unix/fs/fn.symlink.html
|
||||||
|
/// [`std::os::windows::fs::symlink_file`]: ../os/windows/fs/fn.symlink_file.html
|
||||||
|
/// [`symlink_dir`]: ../os/windows/fs/fn.symlink_dir.html
|
||||||
|
///
|
||||||
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```no_run
|
/// ```no_run
|
||||||
@ -1795,7 +1802,7 @@ pub fn create_dir<P: AsRef<Path>>(path: P) -> io::Result<()> {
|
|||||||
/// * If any directory in the path specified by `path`
|
/// * If any directory in the path specified by `path`
|
||||||
/// does not already exist and it could not be created otherwise. The specific
|
/// does not already exist and it could not be created otherwise. The specific
|
||||||
/// error conditions for when a directory is being created (after it is
|
/// error conditions for when a directory is being created (after it is
|
||||||
/// determined to not exist) are outlined by `fs::create_dir`.
|
/// determined to not exist) are outlined by [`fs::create_dir`].
|
||||||
///
|
///
|
||||||
/// Notable exception is made for situations where any of the directories
|
/// Notable exception is made for situations where any of the directories
|
||||||
/// specified in the `path` could not be created as it was being created concurrently.
|
/// specified in the `path` could not be created as it was being created concurrently.
|
||||||
@ -1803,6 +1810,8 @@ pub fn create_dir<P: AsRef<Path>>(path: P) -> io::Result<()> {
|
|||||||
/// concurrently from multiple threads or processes is guaranteed not to fail
|
/// concurrently from multiple threads or processes is guaranteed not to fail
|
||||||
/// due to a race condition with itself.
|
/// due to a race condition with itself.
|
||||||
///
|
///
|
||||||
|
/// [`fs::create_dir`]: fn.create_dir.html
|
||||||
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```no_run
|
/// ```no_run
|
||||||
@ -1868,7 +1877,10 @@ pub fn remove_dir<P: AsRef<Path>>(path: P) -> io::Result<()> {
|
|||||||
///
|
///
|
||||||
/// # Errors
|
/// # Errors
|
||||||
///
|
///
|
||||||
/// See `file::remove_file` and `fs::remove_dir`.
|
/// See [`fs::remove_file`] and [`fs::remove_dir`].
|
||||||
|
///
|
||||||
|
/// [`fs::remove_file`]: fn.remove_file.html
|
||||||
|
/// [`fs::remove_dir`]: fn.remove_dir.html
|
||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
|
@ -44,8 +44,8 @@
|
|||||||
//! The current version of the prelude (version 1) lives in
|
//! The current version of the prelude (version 1) lives in
|
||||||
//! [`std::prelude::v1`], and re-exports the following.
|
//! [`std::prelude::v1`], and re-exports the following.
|
||||||
//!
|
//!
|
||||||
//! * [`std::marker`]::{[`Copy`], [`Send`], [`Sized`], [`Sync`]}. The marker
|
//! * [`std::marker`]::{[`Copy`], [`Send`], [`Sized`], [`Sync`], [`Unpin`]}. The
|
||||||
//! traits indicate fundamental properties of types.
|
//! marker traits indicate fundamental properties of types.
|
||||||
//! * [`std::ops`]::{[`Drop`], [`Fn`], [`FnMut`], [`FnOnce`]}. Various
|
//! * [`std::ops`]::{[`Drop`], [`Fn`], [`FnMut`], [`FnOnce`]}. Various
|
||||||
//! operations for both destructors and overloading `()`.
|
//! operations for both destructors and overloading `()`.
|
||||||
//! * [`std::mem`]::[`drop`][`mem::drop`], a convenience function for explicitly
|
//! * [`std::mem`]::[`drop`][`mem::drop`], a convenience function for explicitly
|
||||||
@ -108,6 +108,7 @@
|
|||||||
//! [`Sync`]: ../marker/trait.Sync.html
|
//! [`Sync`]: ../marker/trait.Sync.html
|
||||||
//! [`ToOwned`]: ../borrow/trait.ToOwned.html
|
//! [`ToOwned`]: ../borrow/trait.ToOwned.html
|
||||||
//! [`ToString`]: ../string/trait.ToString.html
|
//! [`ToString`]: ../string/trait.ToString.html
|
||||||
|
//! [`Unpin`]: ../marker/trait.Unpin.html
|
||||||
//! [`Vec`]: ../vec/struct.Vec.html
|
//! [`Vec`]: ../vec/struct.Vec.html
|
||||||
//! [`Clone::clone`]: ../clone/trait.Clone.html#tymethod.clone
|
//! [`Clone::clone`]: ../clone/trait.Clone.html#tymethod.clone
|
||||||
//! [`mem::drop`]: ../mem/fn.drop.html
|
//! [`mem::drop`]: ../mem/fn.drop.html
|
||||||
|
8
src/test/ui/imports/issue-57539.rs
Normal file
8
src/test/ui/imports/issue-57539.rs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
// edition:2018
|
||||||
|
|
||||||
|
mod core {
|
||||||
|
use core; //~ ERROR `core` is ambiguous
|
||||||
|
use crate::*;
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
18
src/test/ui/imports/issue-57539.stderr
Normal file
18
src/test/ui/imports/issue-57539.stderr
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
error[E0659]: `core` is ambiguous (name vs any other name during import resolution)
|
||||||
|
--> $DIR/issue-57539.rs:4:9
|
||||||
|
|
|
||||||
|
LL | use core; //~ ERROR `core` is ambiguous
|
||||||
|
| ^^^^ ambiguous name
|
||||||
|
|
|
||||||
|
= note: `core` could refer to a built-in extern crate
|
||||||
|
= help: use `::core` to refer to this extern crate unambiguously
|
||||||
|
note: `core` could also refer to the module imported here
|
||||||
|
--> $DIR/issue-57539.rs:5:9
|
||||||
|
|
|
||||||
|
LL | use crate::*;
|
||||||
|
| ^^^^^^^^
|
||||||
|
= help: use `self::core` to refer to this module unambiguously
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0659`.
|
Loading…
Reference in New Issue
Block a user