Auto merge of #124208 - jieyouxu:rollup-gbgpu4u, r=jieyouxu
Rollup of 10 pull requests Successful merges: - #123379 (Print note with closure signature on type mismatch) - #123967 (static_mut_refs: use raw pointers to remove the remaining FIXME) - #123976 (Use fake libc in core test) - #123986 (lint-docs: Add redirects for renamed lints.) - #124053 (coverage: Branch coverage tests for lazy boolean operators) - #124071 (Add llvm-bitcode-linker to build manifest) - #124103 (Improve std::fs::Metadata Debug representation) - #124132 (llvm RustWrapper: explain OpBundlesIndirect argument type) - #124191 (Give a name to each distinct manipulation of pretty-printer FixupContext) - #124196 (mir-opt tests: rename unit-test -> test-mir-pass) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
453ceafce3
184 changed files with 912 additions and 421 deletions
|
@ -537,7 +537,11 @@ impl () {}
|
|||
/// ## 4. Get it from C.
|
||||
///
|
||||
/// ```
|
||||
/// # #![feature(rustc_private)]
|
||||
/// # mod libc {
|
||||
/// # pub unsafe fn malloc(_size: usize) -> *mut core::ffi::c_void { core::ptr::NonNull::dangling().as_ptr() }
|
||||
/// # pub unsafe fn free(_ptr: *mut core::ffi::c_void) {}
|
||||
/// # }
|
||||
/// # #[cfg(any())]
|
||||
/// #[allow(unused_extern_crates)]
|
||||
/// extern crate libc;
|
||||
///
|
||||
|
@ -548,7 +552,7 @@ impl () {}
|
|||
/// if my_num.is_null() {
|
||||
/// panic!("failed to allocate memory");
|
||||
/// }
|
||||
/// libc::free(my_num as *mut libc::c_void);
|
||||
/// libc::free(my_num as *mut core::ffi::c_void);
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
|
|
|
@ -214,7 +214,7 @@ pub struct Permissions(fs_imp::FilePermissions);
|
|||
/// A structure representing a type of file with accessors for each file type.
|
||||
/// It is returned by [`Metadata::file_type`] method.
|
||||
#[stable(feature = "file_type", since = "1.1.0")]
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(not(test), rustc_diagnostic_item = "FileType")]
|
||||
pub struct FileType(fs_imp::FileType);
|
||||
|
||||
|
@ -1410,15 +1410,20 @@ impl Metadata {
|
|||
#[stable(feature = "std_debug", since = "1.16.0")]
|
||||
impl fmt::Debug for Metadata {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("Metadata")
|
||||
.field("file_type", &self.file_type())
|
||||
.field("is_dir", &self.is_dir())
|
||||
.field("is_file", &self.is_file())
|
||||
.field("permissions", &self.permissions())
|
||||
.field("modified", &self.modified())
|
||||
.field("accessed", &self.accessed())
|
||||
.field("created", &self.created())
|
||||
.finish_non_exhaustive()
|
||||
let mut debug = f.debug_struct("Metadata");
|
||||
debug.field("file_type", &self.file_type());
|
||||
debug.field("permissions", &self.permissions());
|
||||
debug.field("len", &self.len());
|
||||
if let Ok(modified) = self.modified() {
|
||||
debug.field("modified", &modified);
|
||||
}
|
||||
if let Ok(accessed) = self.accessed() {
|
||||
debug.field("accessed", &accessed);
|
||||
}
|
||||
if let Ok(created) = self.created() {
|
||||
debug.field("created", &created);
|
||||
}
|
||||
debug.finish_non_exhaustive()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1684,6 +1689,17 @@ impl FileType {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "std_debug", since = "1.16.0")]
|
||||
impl fmt::Debug for FileType {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("FileType")
|
||||
.field("is_file", &self.is_file())
|
||||
.field("is_dir", &self.is_dir())
|
||||
.field("is_symlink", &self.is_symlink())
|
||||
.finish_non_exhaustive()
|
||||
}
|
||||
}
|
||||
|
||||
impl AsInner<fs_imp::FileType> for FileType {
|
||||
#[inline]
|
||||
fn as_inner(&self) -> &fs_imp::FileType {
|
||||
|
|
|
@ -11,8 +11,6 @@ pub macro thread_local_inner {
|
|||
(@key $t:ty, const $init:expr) => {{
|
||||
#[inline] // see comments below
|
||||
#[deny(unsafe_op_in_unsafe_fn)]
|
||||
// FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_refs` lint
|
||||
#[allow(static_mut_refs)]
|
||||
unsafe fn __getit(
|
||||
_init: $crate::option::Option<&mut $crate::option::Option<$t>>,
|
||||
) -> $crate::option::Option<&'static $t> {
|
||||
|
@ -25,7 +23,8 @@ pub macro thread_local_inner {
|
|||
// FIXME(#84224) this should come after the `target_thread_local`
|
||||
// block.
|
||||
static mut VAL: $t = INIT_EXPR;
|
||||
unsafe { $crate::option::Option::Some(&VAL) }
|
||||
// SAFETY: we only ever create shared references, so there's no mutable aliasing.
|
||||
unsafe { $crate::option::Option::Some(&*$crate::ptr::addr_of!(VAL)) }
|
||||
}
|
||||
|
||||
unsafe {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue