Auto merge of #138279 - matthiaskrgr:rollup-ndnoipr, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #122790 (Apply dllimport in ThinLTO) - #137650 (Move `fs` into `sys`) - #138228 (Use `disjoint_bitor` inside `borrowing_sub`) - #138233 (Windows: Don't link std (and run-make) against advapi32, except on win7) - #138253 (Continue to check attr if meet empty repr for adt) - #138263 (Fix `repr128-dwarf` test) - #138276 (Lazy load NtOpenFile for UWP) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
@@ -16,7 +16,6 @@ use rustc_middle::mir::mono::MonoItem;
|
|||||||
use rustc_middle::ty::Instance;
|
use rustc_middle::ty::Instance;
|
||||||
use rustc_middle::ty::layout::{HasTypingEnv, LayoutOf};
|
use rustc_middle::ty::layout::{HasTypingEnv, LayoutOf};
|
||||||
use rustc_middle::{bug, span_bug};
|
use rustc_middle::{bug, span_bug};
|
||||||
use rustc_session::config::Lto;
|
|
||||||
use tracing::{debug, instrument, trace};
|
use tracing::{debug, instrument, trace};
|
||||||
|
|
||||||
use crate::common::{AsCCharPtr, CodegenCx};
|
use crate::common::{AsCCharPtr, CodegenCx};
|
||||||
@@ -344,11 +343,11 @@ impl<'ll> CodegenCx<'ll, '_> {
|
|||||||
// Local definitions can never be imported, so we must not apply
|
// Local definitions can never be imported, so we must not apply
|
||||||
// the DLLImport annotation.
|
// the DLLImport annotation.
|
||||||
&& !dso_local
|
&& !dso_local
|
||||||
// ThinLTO can't handle this workaround in all cases, so we don't
|
// Linker plugin ThinLTO doesn't create the self-dllimport Rust uses for rlibs
|
||||||
// emit the attrs. Instead we make them unnecessary by disallowing
|
// as the code generation happens out of process. Instead we assume static linkage
|
||||||
// dynamic linking when linker plugin based LTO is enabled.
|
// and disallow dynamic linking when linker plugin based LTO is enabled.
|
||||||
&& !self.tcx.sess.opts.cg.linker_plugin_lto.enabled()
|
// Regular in-process ThinLTO doesn't need this workaround.
|
||||||
&& self.tcx.sess.lto() != Lto::Thin;
|
&& !self.tcx.sess.opts.cg.linker_plugin_lto.enabled();
|
||||||
|
|
||||||
// If this assertion triggers, there's something wrong with commandline
|
// If this assertion triggers, there's something wrong with commandline
|
||||||
// argument validation.
|
// argument validation.
|
||||||
|
|||||||
@@ -1998,7 +1998,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
|||||||
// catch `repr()` with no arguments, applied to an item (i.e. not `#![repr()]`)
|
// catch `repr()` with no arguments, applied to an item (i.e. not `#![repr()]`)
|
||||||
if item.is_some() {
|
if item.is_some() {
|
||||||
match target {
|
match target {
|
||||||
Target::Struct | Target::Union | Target::Enum => {}
|
Target::Struct | Target::Union | Target::Enum => continue,
|
||||||
Target::Fn | Target::Method(_) => {
|
Target::Fn | Target::Method(_) => {
|
||||||
feature_err(
|
feature_err(
|
||||||
&self.tcx.sess,
|
&self.tcx.sess,
|
||||||
|
|||||||
@@ -2533,15 +2533,20 @@ macro_rules! uint_impl {
|
|||||||
#[doc = concat!("assert_eq!((diff1, diff0), (3, ", stringify!($SelfT), "::MAX));")]
|
#[doc = concat!("assert_eq!((diff1, diff0), (3, ", stringify!($SelfT), "::MAX));")]
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "bigint_helper_methods", issue = "85532")]
|
#[unstable(feature = "bigint_helper_methods", issue = "85532")]
|
||||||
|
#[rustc_const_unstable(feature = "bigint_helper_methods", issue = "85532")]
|
||||||
#[must_use = "this returns the result of the operation, \
|
#[must_use = "this returns the result of the operation, \
|
||||||
without modifying the original"]
|
without modifying the original"]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn borrowing_sub(self, rhs: Self, borrow: bool) -> (Self, bool) {
|
pub const fn borrowing_sub(self, rhs: Self, borrow: bool) -> (Self, bool) {
|
||||||
// note: longer-term this should be done via an intrinsic, but this has been shown
|
// note: longer-term this should be done via an intrinsic, but this has been shown
|
||||||
// to generate optimal code for now, and LLVM doesn't have an equivalent intrinsic
|
// to generate optimal code for now, and LLVM doesn't have an equivalent intrinsic
|
||||||
let (a, b) = self.overflowing_sub(rhs);
|
let (a, c1) = self.overflowing_sub(rhs);
|
||||||
let (c, d) = a.overflowing_sub(borrow as $SelfT);
|
let (b, c2) = a.overflowing_sub(borrow as $SelfT);
|
||||||
(c, b | d)
|
// SAFETY: Only one of `c1` and `c2` can be set.
|
||||||
|
// For c1 to be set we need to have underflowed, but if we did then
|
||||||
|
// `a` is nonzero, which means that `c2` cannot possibly
|
||||||
|
// underflow because it's subtracting at most `1` (since it came from `bool`)
|
||||||
|
(b, unsafe { intrinsics::disjoint_bitor(c1, c2) })
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Calculates `self` - `rhs` with a signed `rhs`
|
/// Calculates `self` - `rhs` with a signed `rhs`
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
use super::fd::FileDesc;
|
|
||||||
use super::hermit_abi::{
|
|
||||||
self, DT_DIR, DT_LNK, DT_REG, DT_UNKNOWN, O_APPEND, O_CREAT, O_DIRECTORY, O_EXCL, O_RDONLY,
|
|
||||||
O_RDWR, O_TRUNC, O_WRONLY, S_IFDIR, S_IFLNK, S_IFMT, S_IFREG, dirent64, stat as stat_struct,
|
|
||||||
};
|
|
||||||
use crate::ffi::{CStr, OsStr, OsString, c_char};
|
use crate::ffi::{CStr, OsStr, OsString, c_char};
|
||||||
use crate::io::{self, BorrowedCursor, Error, ErrorKind, IoSlice, IoSliceMut, SeekFrom};
|
use crate::io::{self, BorrowedCursor, Error, ErrorKind, IoSlice, IoSliceMut, SeekFrom};
|
||||||
use crate::os::hermit::ffi::OsStringExt;
|
use crate::os::hermit::ffi::OsStringExt;
|
||||||
|
use crate::os::hermit::hermit_abi::{
|
||||||
|
self, DT_DIR, DT_LNK, DT_REG, DT_UNKNOWN, O_APPEND, O_CREAT, O_DIRECTORY, O_EXCL, O_RDONLY,
|
||||||
|
O_RDWR, O_TRUNC, O_WRONLY, S_IFDIR, S_IFLNK, S_IFMT, S_IFREG, dirent64, stat as stat_struct,
|
||||||
|
};
|
||||||
use crate::os::hermit::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, RawFd};
|
use crate::os::hermit::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, RawFd};
|
||||||
use crate::path::{Path, PathBuf};
|
use crate::path::{Path, PathBuf};
|
||||||
use crate::sync::Arc;
|
use crate::sync::Arc;
|
||||||
use crate::sys::common::small_c_string::run_path_with_cstr;
|
use crate::sys::common::small_c_string::run_path_with_cstr;
|
||||||
|
pub use crate::sys::fs::common::{copy, exists};
|
||||||
|
use crate::sys::pal::fd::FileDesc;
|
||||||
use crate::sys::time::SystemTime;
|
use crate::sys::time::SystemTime;
|
||||||
use crate::sys::{cvt, unsupported};
|
use crate::sys::{cvt, unsupported};
|
||||||
pub use crate::sys_common::fs::{copy, exists};
|
|
||||||
use crate::sys_common::{AsInner, AsInnerMut, FromInner, IntoInner};
|
use crate::sys_common::{AsInner, AsInnerMut, FromInner, IntoInner};
|
||||||
use crate::{fmt, mem};
|
use crate::{fmt, mem};
|
||||||
|
|
||||||
28
library/std/src/sys/fs/mod.rs
Normal file
28
library/std/src/sys/fs/mod.rs
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
#![deny(unsafe_op_in_unsafe_fn)]
|
||||||
|
|
||||||
|
pub mod common;
|
||||||
|
|
||||||
|
cfg_if::cfg_if! {
|
||||||
|
if #[cfg(target_family = "unix")] {
|
||||||
|
mod unix;
|
||||||
|
pub use unix::*;
|
||||||
|
} else if #[cfg(target_os = "windows")] {
|
||||||
|
mod windows;
|
||||||
|
pub use windows::*;
|
||||||
|
} else if #[cfg(target_os = "hermit")] {
|
||||||
|
mod hermit;
|
||||||
|
pub use hermit::*;
|
||||||
|
} else if #[cfg(target_os = "solid_asp3")] {
|
||||||
|
mod solid;
|
||||||
|
pub use solid::*;
|
||||||
|
} else if #[cfg(target_os = "uefi")] {
|
||||||
|
mod uefi;
|
||||||
|
pub use uefi::*;
|
||||||
|
} else if #[cfg(target_os = "wasi")] {
|
||||||
|
mod wasi;
|
||||||
|
pub use wasi::*;
|
||||||
|
} else {
|
||||||
|
mod unsupported;
|
||||||
|
pub use unsupported::*;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
use super::{abi, error};
|
#![allow(dead_code)]
|
||||||
|
|
||||||
use crate::ffi::{CStr, CString, OsStr, OsString};
|
use crate::ffi::{CStr, CString, OsStr, OsString};
|
||||||
use crate::fmt;
|
use crate::fmt;
|
||||||
use crate::io::{self, BorrowedCursor, IoSlice, IoSliceMut, SeekFrom};
|
use crate::io::{self, BorrowedCursor, IoSlice, IoSliceMut, SeekFrom};
|
||||||
@@ -7,9 +8,10 @@ use crate::os::raw::{c_int, c_short};
|
|||||||
use crate::os::solid::ffi::OsStrExt;
|
use crate::os::solid::ffi::OsStrExt;
|
||||||
use crate::path::{Path, PathBuf};
|
use crate::path::{Path, PathBuf};
|
||||||
use crate::sync::Arc;
|
use crate::sync::Arc;
|
||||||
|
pub use crate::sys::fs::common::exists;
|
||||||
|
use crate::sys::pal::{abi, error};
|
||||||
use crate::sys::time::SystemTime;
|
use crate::sys::time::SystemTime;
|
||||||
use crate::sys::unsupported;
|
use crate::sys::unsupported;
|
||||||
pub use crate::sys_common::fs::exists;
|
|
||||||
use crate::sys_common::ignore_notfound;
|
use crate::sys_common::ignore_notfound;
|
||||||
|
|
||||||
type CIntNotMinusOne = core::num::niche_types::NotAllOnes<c_int>;
|
type CIntNotMinusOne = core::num::niche_types::NotAllOnes<c_int>;
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
#![allow(nonstandard_style)]
|
||||||
|
#![allow(unsafe_op_in_unsafe_fn)]
|
||||||
// miri has some special hacks here that make things unused.
|
// miri has some special hacks here that make things unused.
|
||||||
#![cfg_attr(miri, allow(unused))]
|
#![cfg_attr(miri, allow(unused))]
|
||||||
|
|
||||||
@@ -79,13 +81,13 @@ use crate::path::{Path, PathBuf};
|
|||||||
use crate::sync::Arc;
|
use crate::sync::Arc;
|
||||||
use crate::sys::common::small_c_string::run_path_with_cstr;
|
use crate::sys::common::small_c_string::run_path_with_cstr;
|
||||||
use crate::sys::fd::FileDesc;
|
use crate::sys::fd::FileDesc;
|
||||||
|
pub use crate::sys::fs::common::exists;
|
||||||
use crate::sys::time::SystemTime;
|
use crate::sys::time::SystemTime;
|
||||||
#[cfg(all(target_os = "linux", target_env = "gnu"))]
|
#[cfg(all(target_os = "linux", target_env = "gnu"))]
|
||||||
use crate::sys::weak::syscall;
|
use crate::sys::weak::syscall;
|
||||||
#[cfg(target_os = "android")]
|
#[cfg(target_os = "android")]
|
||||||
use crate::sys::weak::weak;
|
use crate::sys::weak::weak;
|
||||||
use crate::sys::{cvt, cvt_r};
|
use crate::sys::{cvt, cvt_r};
|
||||||
pub use crate::sys_common::fs::exists;
|
|
||||||
use crate::sys_common::{AsInner, AsInnerMut, FromInner, IntoInner};
|
use crate::sys_common::{AsInner, AsInnerMut, FromInner, IntoInner};
|
||||||
use crate::{mem, ptr};
|
use crate::{mem, ptr};
|
||||||
|
|
||||||
@@ -699,6 +701,8 @@ impl Iterator for ReadDir {
|
|||||||
target_os = "hurd",
|
target_os = "hurd",
|
||||||
))]
|
))]
|
||||||
fn next(&mut self) -> Option<io::Result<DirEntry>> {
|
fn next(&mut self) -> Option<io::Result<DirEntry>> {
|
||||||
|
use crate::sys::os::{errno, set_errno};
|
||||||
|
|
||||||
if self.end_of_stream {
|
if self.end_of_stream {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
@@ -710,7 +714,7 @@ impl Iterator for ReadDir {
|
|||||||
// with unlimited or variable NAME_MAX. Many modern platforms guarantee
|
// with unlimited or variable NAME_MAX. Many modern platforms guarantee
|
||||||
// thread safety for readdir() as long an individual DIR* is not accessed
|
// thread safety for readdir() as long an individual DIR* is not accessed
|
||||||
// concurrently, which is sufficient for Rust.
|
// concurrently, which is sufficient for Rust.
|
||||||
super::os::set_errno(0);
|
set_errno(0);
|
||||||
let entry_ptr: *const dirent64 = readdir64(self.inner.dirp.0);
|
let entry_ptr: *const dirent64 = readdir64(self.inner.dirp.0);
|
||||||
if entry_ptr.is_null() {
|
if entry_ptr.is_null() {
|
||||||
// We either encountered an error, or reached the end. Either way,
|
// We either encountered an error, or reached the end. Either way,
|
||||||
@@ -719,7 +723,7 @@ impl Iterator for ReadDir {
|
|||||||
|
|
||||||
// To distinguish between errors and end-of-directory, we had to clear
|
// To distinguish between errors and end-of-directory, we had to clear
|
||||||
// errno beforehand to check for an error now.
|
// errno beforehand to check for an error now.
|
||||||
return match super::os::errno() {
|
return match errno() {
|
||||||
0 => None,
|
0 => None,
|
||||||
e => Some(Err(Error::from_raw_os_error(e))),
|
e => Some(Err(Error::from_raw_os_error(e))),
|
||||||
};
|
};
|
||||||
@@ -1932,7 +1936,7 @@ pub fn canonicalize(p: &Path) -> io::Result<PathBuf> {
|
|||||||
|
|
||||||
fn open_from(from: &Path) -> io::Result<(crate::fs::File, crate::fs::Metadata)> {
|
fn open_from(from: &Path) -> io::Result<(crate::fs::File, crate::fs::Metadata)> {
|
||||||
use crate::fs::File;
|
use crate::fs::File;
|
||||||
use crate::sys_common::fs::NOT_FILE_ERROR;
|
use crate::sys::fs::common::NOT_FILE_ERROR;
|
||||||
|
|
||||||
let reader = File::open(from)?;
|
let reader = File::open(from)?;
|
||||||
let metadata = reader.metadata()?;
|
let metadata = reader.metadata()?;
|
||||||
@@ -2151,7 +2155,7 @@ pub use remove_dir_impl::remove_dir_all;
|
|||||||
miri
|
miri
|
||||||
))]
|
))]
|
||||||
mod remove_dir_impl {
|
mod remove_dir_impl {
|
||||||
pub use crate::sys_common::fs::remove_dir_all;
|
pub use crate::sys::fs::common::remove_dir_all;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Modern implementation using openat(), unlinkat() and fdopendir()
|
// Modern implementation using openat(), unlinkat() and fdopendir()
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
use crate::sys::pal::unix::fs::FilePermissions;
|
use crate::sys::fs::FilePermissions;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_debug_permissions() {
|
fn test_debug_permissions() {
|
||||||
@@ -1,6 +1,3 @@
|
|||||||
#![forbid(unsafe_op_in_unsafe_fn)]
|
|
||||||
|
|
||||||
use super::fd::WasiFd;
|
|
||||||
use crate::ffi::{CStr, OsStr, OsString};
|
use crate::ffi::{CStr, OsStr, OsString};
|
||||||
use crate::io::{self, BorrowedCursor, IoSlice, IoSliceMut, SeekFrom};
|
use crate::io::{self, BorrowedCursor, IoSlice, IoSliceMut, SeekFrom};
|
||||||
use crate::mem::{self, ManuallyDrop};
|
use crate::mem::{self, ManuallyDrop};
|
||||||
@@ -10,9 +7,10 @@ use crate::os::wasi::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, RawFd
|
|||||||
use crate::path::{Path, PathBuf};
|
use crate::path::{Path, PathBuf};
|
||||||
use crate::sync::Arc;
|
use crate::sync::Arc;
|
||||||
use crate::sys::common::small_c_string::run_path_with_cstr;
|
use crate::sys::common::small_c_string::run_path_with_cstr;
|
||||||
|
use crate::sys::fd::WasiFd;
|
||||||
|
pub use crate::sys::fs::common::exists;
|
||||||
use crate::sys::time::SystemTime;
|
use crate::sys::time::SystemTime;
|
||||||
use crate::sys::unsupported;
|
use crate::sys::unsupported;
|
||||||
pub use crate::sys_common::fs::exists;
|
|
||||||
use crate::sys_common::{AsInner, FromInner, IntoInner, ignore_notfound};
|
use crate::sys_common::{AsInner, FromInner, IntoInner, ignore_notfound};
|
||||||
use crate::{fmt, iter, ptr};
|
use crate::{fmt, iter, ptr};
|
||||||
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
use super::api::{self, WinError, set_file_information_by_handle};
|
#![allow(nonstandard_style)]
|
||||||
use super::{IoResult, to_u16s};
|
|
||||||
use crate::alloc::{Layout, alloc, dealloc};
|
use crate::alloc::{Layout, alloc, dealloc};
|
||||||
use crate::borrow::Cow;
|
use crate::borrow::Cow;
|
||||||
use crate::ffi::{OsStr, OsString, c_void};
|
use crate::ffi::{OsStr, OsString, c_void};
|
||||||
@@ -10,6 +10,8 @@ use crate::os::windows::prelude::*;
|
|||||||
use crate::path::{Path, PathBuf};
|
use crate::path::{Path, PathBuf};
|
||||||
use crate::sync::Arc;
|
use crate::sync::Arc;
|
||||||
use crate::sys::handle::Handle;
|
use crate::sys::handle::Handle;
|
||||||
|
use crate::sys::pal::api::{self, WinError, set_file_information_by_handle};
|
||||||
|
use crate::sys::pal::{IoResult, fill_utf16_buf, to_u16s, truncate_utf16_at_nul};
|
||||||
use crate::sys::path::maybe_verbatim;
|
use crate::sys::path::maybe_verbatim;
|
||||||
use crate::sys::time::SystemTime;
|
use crate::sys::time::SystemTime;
|
||||||
use crate::sys::{Align8, c, cvt};
|
use crate::sys::{Align8, c, cvt};
|
||||||
@@ -167,7 +169,7 @@ impl DirEntry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn file_name(&self) -> OsString {
|
pub fn file_name(&self) -> OsString {
|
||||||
let filename = super::truncate_utf16_at_nul(&self.data.cFileName);
|
let filename = truncate_utf16_at_nul(&self.data.cFileName);
|
||||||
OsString::from_wide(filename)
|
OsString::from_wide(filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -695,7 +697,7 @@ impl File {
|
|||||||
// Turn `\??\` into `\\?\` (a verbatim path).
|
// Turn `\??\` into `\\?\` (a verbatim path).
|
||||||
subst[1] = b'\\' as u16;
|
subst[1] = b'\\' as u16;
|
||||||
// Attempt to convert to a more user-friendly path.
|
// Attempt to convert to a more user-friendly path.
|
||||||
let user = super::args::from_wide_to_user_path(
|
let user = crate::sys::args::from_wide_to_user_path(
|
||||||
subst.iter().copied().chain([0]).collect(),
|
subst.iter().copied().chain([0]).collect(),
|
||||||
)?;
|
)?;
|
||||||
Ok(PathBuf::from(OsString::from_wide(user.strip_suffix(&[0]).unwrap_or(&user))))
|
Ok(PathBuf::from(OsString::from_wide(user.strip_suffix(&[0]).unwrap_or(&user))))
|
||||||
@@ -1492,7 +1494,7 @@ pub fn set_perm(p: &Path, perm: FilePermissions) -> io::Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn get_path(f: &File) -> io::Result<PathBuf> {
|
fn get_path(f: &File) -> io::Result<PathBuf> {
|
||||||
super::fill_utf16_buf(
|
fill_utf16_buf(
|
||||||
|buf, sz| unsafe {
|
|buf, sz| unsafe {
|
||||||
c::GetFinalPathNameByHandleW(f.handle.as_raw_handle(), buf, sz, c::VOLUME_NAME_DOS)
|
c::GetFinalPathNameByHandleW(f.handle.as_raw_handle(), buf, sz, c::VOLUME_NAME_DOS)
|
||||||
},
|
},
|
||||||
@@ -33,7 +33,7 @@ use core::sync::atomic::{AtomicU32, Ordering};
|
|||||||
|
|
||||||
use super::{AsRawHandle, DirBuff, File, FromRawHandle};
|
use super::{AsRawHandle, DirBuff, File, FromRawHandle};
|
||||||
use crate::sys::c;
|
use crate::sys::c;
|
||||||
use crate::sys::pal::windows::api::WinError;
|
use crate::sys::pal::api::WinError;
|
||||||
use crate::thread;
|
use crate::thread;
|
||||||
|
|
||||||
// The maximum number of times to spin when waiting for deletes to complete.
|
// The maximum number of times to spin when waiting for deletes to complete.
|
||||||
@@ -12,6 +12,7 @@ pub mod anonymous_pipe;
|
|||||||
pub mod backtrace;
|
pub mod backtrace;
|
||||||
pub mod cmath;
|
pub mod cmath;
|
||||||
pub mod exit_guard;
|
pub mod exit_guard;
|
||||||
|
pub mod fs;
|
||||||
pub mod io;
|
pub mod io;
|
||||||
pub mod net;
|
pub mod net;
|
||||||
pub mod os_str;
|
pub mod os_str;
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ use crate::os::raw::c_char;
|
|||||||
pub mod args;
|
pub mod args;
|
||||||
pub mod env;
|
pub mod env;
|
||||||
pub mod fd;
|
pub mod fd;
|
||||||
pub mod fs;
|
|
||||||
pub mod futex;
|
pub mod futex;
|
||||||
pub mod os;
|
pub mod os;
|
||||||
#[path = "../unsupported/pipe.rs"]
|
#[path = "../unsupported/pipe.rs"]
|
||||||
|
|||||||
@@ -12,8 +12,6 @@ pub mod abi;
|
|||||||
pub mod args;
|
pub mod args;
|
||||||
pub mod env;
|
pub mod env;
|
||||||
pub mod fd;
|
pub mod fd;
|
||||||
#[path = "../unsupported/fs.rs"]
|
|
||||||
pub mod fs;
|
|
||||||
mod libunwind_integration;
|
mod libunwind_integration;
|
||||||
pub mod os;
|
pub mod os;
|
||||||
#[path = "../unsupported/pipe.rs"]
|
#[path = "../unsupported/pipe.rs"]
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ pub mod env;
|
|||||||
// `error` is `pub(crate)` so that it can be accessed by `itron/error.rs` as
|
// `error` is `pub(crate)` so that it can be accessed by `itron/error.rs` as
|
||||||
// `crate::sys::error`
|
// `crate::sys::error`
|
||||||
pub(crate) mod error;
|
pub(crate) mod error;
|
||||||
pub mod fs;
|
|
||||||
pub mod os;
|
pub mod os;
|
||||||
#[path = "../unsupported/pipe.rs"]
|
#[path = "../unsupported/pipe.rs"]
|
||||||
pub mod pipe;
|
pub mod pipe;
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ impl SystemTime {
|
|||||||
SystemTime(t)
|
SystemTime(t)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn from_time_t(t: abi::time_t) -> Self {
|
pub fn from_time_t(t: abi::time_t) -> Self {
|
||||||
Self(t)
|
Self(t)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,8 +11,6 @@ pub mod args;
|
|||||||
#[path = "../unsupported/env.rs"]
|
#[path = "../unsupported/env.rs"]
|
||||||
pub mod env;
|
pub mod env;
|
||||||
//pub mod fd;
|
//pub mod fd;
|
||||||
#[path = "../unsupported/fs.rs"]
|
|
||||||
pub mod fs;
|
|
||||||
pub mod os;
|
pub mod os;
|
||||||
#[path = "../unsupported/pipe.rs"]
|
#[path = "../unsupported/pipe.rs"]
|
||||||
pub mod pipe;
|
pub mod pipe;
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
|
|
||||||
pub mod args;
|
pub mod args;
|
||||||
pub mod env;
|
pub mod env;
|
||||||
pub mod fs;
|
|
||||||
pub mod helpers;
|
pub mod helpers;
|
||||||
pub mod os;
|
pub mod os;
|
||||||
#[path = "../unsupported/pipe.rs"]
|
#[path = "../unsupported/pipe.rs"]
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ pub mod weak;
|
|||||||
pub mod args;
|
pub mod args;
|
||||||
pub mod env;
|
pub mod env;
|
||||||
pub mod fd;
|
pub mod fd;
|
||||||
pub mod fs;
|
|
||||||
pub mod futex;
|
pub mod futex;
|
||||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||||
pub mod kernel_copy;
|
pub mod kernel_copy;
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
pub mod args;
|
pub mod args;
|
||||||
pub mod env;
|
pub mod env;
|
||||||
pub mod fs;
|
|
||||||
pub mod os;
|
pub mod os;
|
||||||
pub mod pipe;
|
pub mod pipe;
|
||||||
pub mod process;
|
pub mod process;
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
pub mod args;
|
pub mod args;
|
||||||
pub mod env;
|
pub mod env;
|
||||||
pub mod fd;
|
pub mod fd;
|
||||||
pub mod fs;
|
|
||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
#[path = "../wasm/atomics/futex.rs"]
|
#[path = "../wasm/atomics/futex.rs"]
|
||||||
pub mod futex;
|
pub mod futex;
|
||||||
|
|||||||
@@ -12,8 +12,6 @@ pub mod args;
|
|||||||
pub mod env;
|
pub mod env;
|
||||||
#[path = "../wasi/fd.rs"]
|
#[path = "../wasi/fd.rs"]
|
||||||
pub mod fd;
|
pub mod fd;
|
||||||
#[path = "../wasi/fs.rs"]
|
|
||||||
pub mod fs;
|
|
||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
#[path = "../wasm/atomics/futex.rs"]
|
#[path = "../wasm/atomics/futex.rs"]
|
||||||
pub mod futex;
|
pub mod futex;
|
||||||
|
|||||||
@@ -19,8 +19,6 @@
|
|||||||
#[path = "../unsupported/args.rs"]
|
#[path = "../unsupported/args.rs"]
|
||||||
pub mod args;
|
pub mod args;
|
||||||
pub mod env;
|
pub mod env;
|
||||||
#[path = "../unsupported/fs.rs"]
|
|
||||||
pub mod fs;
|
|
||||||
#[path = "../unsupported/os.rs"]
|
#[path = "../unsupported/os.rs"]
|
||||||
pub mod os;
|
pub mod os;
|
||||||
#[path = "../unsupported/pipe.rs"]
|
#[path = "../unsupported/pipe.rs"]
|
||||||
|
|||||||
@@ -237,6 +237,17 @@ compat_fn_with_fallback! {
|
|||||||
STATUS_NOT_IMPLEMENTED
|
STATUS_NOT_IMPLEMENTED
|
||||||
}
|
}
|
||||||
#[cfg(target_vendor = "uwp")]
|
#[cfg(target_vendor = "uwp")]
|
||||||
|
pub fn NtOpenFile(
|
||||||
|
filehandle: *mut HANDLE,
|
||||||
|
desiredaccess: u32,
|
||||||
|
objectattributes: *const OBJECT_ATTRIBUTES,
|
||||||
|
iostatusblock: *mut IO_STATUS_BLOCK,
|
||||||
|
shareaccess: u32,
|
||||||
|
openoptions: u32
|
||||||
|
) -> NTSTATUS {
|
||||||
|
STATUS_NOT_IMPLEMENTED
|
||||||
|
}
|
||||||
|
#[cfg(target_vendor = "uwp")]
|
||||||
pub fn NtReadFile(
|
pub fn NtReadFile(
|
||||||
filehandle: HANDLE,
|
filehandle: HANDLE,
|
||||||
event: HANDLE,
|
event: HANDLE,
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ pub mod api;
|
|||||||
pub mod args;
|
pub mod args;
|
||||||
pub mod c;
|
pub mod c;
|
||||||
pub mod env;
|
pub mod env;
|
||||||
pub mod fs;
|
|
||||||
#[cfg(not(target_vendor = "win7"))]
|
#[cfg(not(target_vendor = "win7"))]
|
||||||
pub mod futex;
|
pub mod futex;
|
||||||
pub mod handle;
|
pub mod handle;
|
||||||
@@ -37,7 +36,7 @@ cfg_if::cfg_if! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Map a [`Result<T, WinError>`] to [`io::Result<T>`](crate::io::Result<T>).
|
/// Map a [`Result<T, WinError>`] to [`io::Result<T>`](crate::io::Result<T>).
|
||||||
trait IoResult<T> {
|
pub trait IoResult<T> {
|
||||||
fn io_result(self) -> crate::io::Result<T>;
|
fn io_result(self) -> crate::io::Result<T>;
|
||||||
}
|
}
|
||||||
impl<T> IoResult<T> for Result<T, api::WinError> {
|
impl<T> IoResult<T> for Result<T, api::WinError> {
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
pub mod args;
|
pub mod args;
|
||||||
#[path = "../unsupported/env.rs"]
|
#[path = "../unsupported/env.rs"]
|
||||||
pub mod env;
|
pub mod env;
|
||||||
#[path = "../unsupported/fs.rs"]
|
|
||||||
pub mod fs;
|
|
||||||
pub mod os;
|
pub mod os;
|
||||||
#[path = "../unsupported/pipe.rs"]
|
#[path = "../unsupported/pipe.rs"]
|
||||||
pub mod pipe;
|
pub mod pipe;
|
||||||
|
|||||||
@@ -14,8 +14,6 @@ pub mod abi;
|
|||||||
#[path = "../zkvm/args.rs"]
|
#[path = "../zkvm/args.rs"]
|
||||||
pub mod args;
|
pub mod args;
|
||||||
pub mod env;
|
pub mod env;
|
||||||
#[path = "../unsupported/fs.rs"]
|
|
||||||
pub mod fs;
|
|
||||||
pub mod os;
|
pub mod os;
|
||||||
#[path = "../unsupported/pipe.rs"]
|
#[path = "../unsupported/pipe.rs"]
|
||||||
pub mod pipe;
|
pub mod pipe;
|
||||||
|
|||||||
@@ -20,7 +20,6 @@
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests;
|
mod tests;
|
||||||
|
|
||||||
pub mod fs;
|
|
||||||
pub mod process;
|
pub mod process;
|
||||||
pub mod wstr;
|
pub mod wstr;
|
||||||
pub mod wtf8;
|
pub mod wtf8;
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ pub macro link {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "windows_raw_dylib"))]
|
#[cfg(not(feature = "windows_raw_dylib"))]
|
||||||
#[link(name = "advapi32")]
|
#[cfg_attr(target_vendor = "win7", link(name = "advapi32"))]
|
||||||
#[link(name = "ntdll")]
|
#[link(name = "ntdll")]
|
||||||
#[link(name = "userenv")]
|
#[link(name = "userenv")]
|
||||||
#[link(name = "ws2_32")]
|
#[link(name = "ws2_32")]
|
||||||
|
|||||||
@@ -230,8 +230,10 @@ fn make_win_dist(
|
|||||||
"libiconv.a",
|
"libiconv.a",
|
||||||
"libmoldname.a",
|
"libmoldname.a",
|
||||||
"libpthread.a",
|
"libpthread.a",
|
||||||
//Windows import libs
|
// Windows import libs
|
||||||
//This should contain only the set of libraries necessary to link the standard library.
|
// This *should* contain only the set of libraries necessary to link the standard library,
|
||||||
|
// however we've had problems with people accidentally depending on extra libs being here,
|
||||||
|
// so we can't easily remove entries.
|
||||||
"libadvapi32.a",
|
"libadvapi32.a",
|
||||||
"libbcrypt.a",
|
"libbcrypt.a",
|
||||||
"libcomctl32.a",
|
"libcomctl32.a",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
error: unsupported operation: `open` not available when isolation is enabled
|
error: unsupported operation: `open` not available when isolation is enabled
|
||||||
--> RUSTLIB/std/src/sys/pal/PLATFORM/fs.rs:LL:CC
|
--> RUSTLIB/std/src/sys/fs/PLATFORM.rs:LL:CC
|
||||||
|
|
|
|
||||||
LL | let fd = cvt_r(|| unsafe { open64(path.as_ptr(), flags, opts.mode as c_int) })?;
|
LL | let fd = cvt_r(|| unsafe { open64(path.as_ptr(), flags, opts.mode as c_int) })?;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `open` not available when isolation is enabled
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `open` not available when isolation is enabled
|
||||||
@@ -7,14 +7,14 @@ LL | let fd = cvt_r(|| unsafe { open64(path.as_ptr(), flags, opts.mode a
|
|||||||
= help: set `MIRIFLAGS=-Zmiri-disable-isolation` to disable isolation;
|
= help: set `MIRIFLAGS=-Zmiri-disable-isolation` to disable isolation;
|
||||||
= help: or set `MIRIFLAGS=-Zmiri-isolation-error=warn` to make Miri return an error code from isolated operations (if supported for that operation) and continue with a warning
|
= help: or set `MIRIFLAGS=-Zmiri-isolation-error=warn` to make Miri return an error code from isolated operations (if supported for that operation) and continue with a warning
|
||||||
= note: BACKTRACE:
|
= note: BACKTRACE:
|
||||||
= note: inside closure at RUSTLIB/std/src/sys/pal/PLATFORM/fs.rs:LL:CC
|
= note: inside closure at RUSTLIB/std/src/sys/fs/PLATFORM.rs:LL:CC
|
||||||
= note: inside `std::sys::pal::PLATFORM::cvt_r::<i32, {closure@std::sys::pal::PLATFORM::fs::File::open_c::{closure#0}}>` at RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC
|
= note: inside `std::sys::pal::PLATFORM::cvt_r::<i32, {closure@std::sys::fs::PLATFORM::File::open_c::{closure#0}}>` at RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC
|
||||||
= note: inside `std::sys::pal::PLATFORM::fs::File::open_c` at RUSTLIB/std/src/sys/pal/PLATFORM/fs.rs:LL:CC
|
= note: inside `std::sys::fs::PLATFORM::File::open_c` at RUSTLIB/std/src/sys/fs/PLATFORM.rs:LL:CC
|
||||||
= note: inside closure at RUSTLIB/std/src/sys/pal/PLATFORM/fs.rs:LL:CC
|
= note: inside closure at RUSTLIB/std/src/sys/fs/PLATFORM.rs:LL:CC
|
||||||
= note: inside `std::sys::pal::PLATFORM::small_c_string::run_with_cstr_stack::<std::sys::pal::PLATFORM::fs::File>` at RUSTLIB/std/src/sys/pal/PLATFORM/small_c_string.rs:LL:CC
|
= note: inside `std::sys::pal::PLATFORM::small_c_string::run_with_cstr_stack::<std::sys::fs::PLATFORM::File>` at RUSTLIB/std/src/sys/pal/PLATFORM/small_c_string.rs:LL:CC
|
||||||
= note: inside `std::sys::pal::PLATFORM::small_c_string::run_with_cstr::<std::sys::pal::PLATFORM::fs::File>` at RUSTLIB/std/src/sys/pal/PLATFORM/small_c_string.rs:LL:CC
|
= note: inside `std::sys::pal::PLATFORM::small_c_string::run_with_cstr::<std::sys::fs::PLATFORM::File>` at RUSTLIB/std/src/sys/pal/PLATFORM/small_c_string.rs:LL:CC
|
||||||
= note: inside `std::sys::pal::PLATFORM::small_c_string::run_path_with_cstr::<std::sys::pal::PLATFORM::fs::File>` at RUSTLIB/std/src/sys/pal/PLATFORM/small_c_string.rs:LL:CC
|
= note: inside `std::sys::pal::PLATFORM::small_c_string::run_path_with_cstr::<std::sys::fs::PLATFORM::File>` at RUSTLIB/std/src/sys/pal/PLATFORM/small_c_string.rs:LL:CC
|
||||||
= note: inside `std::sys::pal::PLATFORM::fs::File::open` at RUSTLIB/std/src/sys/pal/PLATFORM/fs.rs:LL:CC
|
= note: inside `std::sys::fs::PLATFORM::File::open` at RUSTLIB/std/src/sys/fs/PLATFORM.rs:LL:CC
|
||||||
= note: inside `std::fs::OpenOptions::_open` at RUSTLIB/std/src/fs.rs:LL:CC
|
= note: inside `std::fs::OpenOptions::_open` at RUSTLIB/std/src/fs.rs:LL:CC
|
||||||
= note: inside `std::fs::OpenOptions::open::<&std::path::Path>` at RUSTLIB/std/src/fs.rs:LL:CC
|
= note: inside `std::fs::OpenOptions::open::<&std::path::Path>` at RUSTLIB/std/src/fs.rs:LL:CC
|
||||||
= note: inside `std::fs::File::open::<&str>` at RUSTLIB/std/src/fs.rs:LL:CC
|
= note: inside `std::fs::File::open::<&str>` at RUSTLIB/std/src/fs.rs:LL:CC
|
||||||
|
|||||||
@@ -270,13 +270,13 @@ regexes! {
|
|||||||
// erase thread caller ids
|
// erase thread caller ids
|
||||||
r"call [0-9]+" => "call ID",
|
r"call [0-9]+" => "call ID",
|
||||||
// erase platform module paths
|
// erase platform module paths
|
||||||
"sys::pal::[a-z]+::" => "sys::pal::PLATFORM::",
|
r"\bsys::([a-z_]+)::[a-z]+::" => "sys::$1::PLATFORM::",
|
||||||
// Windows file paths
|
// Windows file paths
|
||||||
r"\\" => "/",
|
r"\\" => "/",
|
||||||
// erase Rust stdlib path
|
// erase Rust stdlib path
|
||||||
"[^ \n`]*/(rust[^/]*|checkout)/library/" => "RUSTLIB/",
|
"[^ \n`]*/(rust[^/]*|checkout)/library/" => "RUSTLIB/",
|
||||||
// erase platform file paths
|
// erase platform file paths
|
||||||
"sys/pal/[a-z]+/" => "sys/pal/PLATFORM/",
|
r"\bsys/([a-z_]+)/[a-z]+\b" => "sys/$1/PLATFORM",
|
||||||
// erase paths into the crate registry
|
// erase paths into the crate registry
|
||||||
r"[^ ]*/\.?cargo/registry/.*/(.*\.rs)" => "CARGO_REGISTRY/.../$1",
|
r"[^ ]*/\.?cargo/registry/.*/(.*\.rs)" => "CARGO_REGISTRY/.../$1",
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,15 @@
|
|||||||
use crate::{is_msvc, is_windows, uname};
|
use crate::{is_msvc, is_win7, is_windows, uname};
|
||||||
|
|
||||||
/// `EXTRACFLAGS`
|
/// `EXTRACFLAGS`
|
||||||
pub fn extra_c_flags() -> Vec<&'static str> {
|
pub fn extra_c_flags() -> Vec<&'static str> {
|
||||||
if is_windows() {
|
if is_windows() {
|
||||||
if is_msvc() {
|
if is_msvc() {
|
||||||
vec![
|
let mut libs =
|
||||||
"ws2_32.lib",
|
vec!["ws2_32.lib", "userenv.lib", "bcrypt.lib", "ntdll.lib", "synchronization.lib"];
|
||||||
"userenv.lib",
|
if is_win7() {
|
||||||
"advapi32.lib",
|
libs.push("advapi32.lib");
|
||||||
"bcrypt.lib",
|
}
|
||||||
"ntdll.lib",
|
libs
|
||||||
"synchronization.lib",
|
|
||||||
]
|
|
||||||
} else {
|
} else {
|
||||||
vec!["-lws2_32", "-luserenv", "-lbcrypt", "-lntdll", "-lsynchronization"]
|
vec!["-lws2_32", "-luserenv", "-lbcrypt", "-lntdll", "-lsynchronization"]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ pub use run::{cmd, run, run_fail, run_with_args};
|
|||||||
|
|
||||||
/// Helpers for checking target information.
|
/// Helpers for checking target information.
|
||||||
pub use targets::{
|
pub use targets::{
|
||||||
apple_os, is_aix, is_darwin, is_msvc, is_windows, is_windows_gnu, llvm_components_contain,
|
apple_os, is_aix, is_darwin, is_msvc, is_windows, is_windows_gnu, is_win7, llvm_components_contain,
|
||||||
target, uname,
|
target, uname,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,12 @@ pub fn is_windows_gnu() -> bool {
|
|||||||
target().ends_with("windows-gnu")
|
target().ends_with("windows-gnu")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Check if target is win7.
|
||||||
|
#[must_use]
|
||||||
|
pub fn is_win7() -> bool {
|
||||||
|
target().contains("win7")
|
||||||
|
}
|
||||||
|
|
||||||
/// Check if target uses macOS.
|
/// Check if target uses macOS.
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn is_darwin() -> bool {
|
pub fn is_darwin() -> bool {
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
use std::sync::atomic::{AtomicPtr, Ordering};
|
|
||||||
|
|
||||||
#[inline(always)]
|
|
||||||
pub fn memrchr() {
|
|
||||||
fn detect() {}
|
|
||||||
|
|
||||||
static CROSS_CRATE_STATIC_ITEM: AtomicPtr<()> = AtomicPtr::new(detect as *mut ());
|
|
||||||
|
|
||||||
unsafe {
|
|
||||||
let fun = CROSS_CRATE_STATIC_ITEM.load(Ordering::SeqCst);
|
|
||||||
std::mem::transmute::<*mut (), fn()>(fun)()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
//@ compile-flags: -Copt-level=3 -C lto=thin -C prefer-dynamic=no
|
|
||||||
//@ only-windows
|
|
||||||
//@ aux-build:static_dllimport_aux.rs
|
|
||||||
|
|
||||||
// Test that on Windows, when performing ThinLTO, we do not mark cross-crate static items with
|
|
||||||
// dllimport because lld does not fix the symbol names for us.
|
|
||||||
|
|
||||||
extern crate static_dllimport_aux;
|
|
||||||
|
|
||||||
// CHECK-LABEL: @{{.+}}CROSS_CRATE_STATIC_ITEM{{.+}} =
|
|
||||||
// CHECK-SAME: external local_unnamed_addr global %"{{.+}}AtomicPtr
|
|
||||||
|
|
||||||
pub fn main() {
|
|
||||||
static_dllimport_aux::memrchr();
|
|
||||||
}
|
|
||||||
@@ -87,14 +87,15 @@ fn main() {
|
|||||||
while let Some((_, entry)) = cursor.next_dfs().unwrap() {
|
while let Some((_, entry)) = cursor.next_dfs().unwrap() {
|
||||||
match entry.tag() {
|
match entry.tag() {
|
||||||
gimli::constants::DW_TAG_variant if !is_old_llvm => {
|
gimli::constants::DW_TAG_variant if !is_old_llvm => {
|
||||||
let value = match entry
|
let Some(value) = entry.attr(gimli::constants::DW_AT_discr_value).unwrap()
|
||||||
.attr(gimli::constants::DW_AT_discr_value)
|
else {
|
||||||
.unwrap()
|
// `std` enums might have variants without `DW_AT_discr_value`.
|
||||||
.unwrap()
|
continue;
|
||||||
.value()
|
};
|
||||||
{
|
let value = match value.value() {
|
||||||
AttributeValue::Block(value) => value.to_slice().unwrap().to_vec(),
|
AttributeValue::Block(value) => value.to_slice().unwrap().to_vec(),
|
||||||
value => panic!("unexpected DW_AT_discr_value of {value:?}"),
|
// `std` has non-repr128 enums which don't use `AttributeValue::Block`.
|
||||||
|
value => continue,
|
||||||
};
|
};
|
||||||
// The `DW_TAG_member` that is a child of `DW_TAG_variant` will contain the
|
// The `DW_TAG_member` that is a child of `DW_TAG_variant` will contain the
|
||||||
// variant's name.
|
// variant's name.
|
||||||
|
|||||||
9
tests/ui/repr/repr-empty-packed.rs
Normal file
9
tests/ui/repr/repr-empty-packed.rs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
//@ compile-flags: --crate-type=lib
|
||||||
|
#![deny(unused_attributes)]
|
||||||
|
|
||||||
|
#[repr()] //~ ERROR unused attribute
|
||||||
|
#[repr(packed)] //~ ERROR attribute should be applied to a struct or union
|
||||||
|
pub enum Foo {
|
||||||
|
Bar,
|
||||||
|
Baz(i32),
|
||||||
|
}
|
||||||
27
tests/ui/repr/repr-empty-packed.stderr
Normal file
27
tests/ui/repr/repr-empty-packed.stderr
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
error: unused attribute
|
||||||
|
--> $DIR/repr-empty-packed.rs:4:1
|
||||||
|
|
|
||||||
|
LL | #[repr()]
|
||||||
|
| ^^^^^^^^^ help: remove this attribute
|
||||||
|
|
|
||||||
|
= note: attribute `repr` with an empty list has no effect
|
||||||
|
note: the lint level is defined here
|
||||||
|
--> $DIR/repr-empty-packed.rs:2:9
|
||||||
|
|
|
||||||
|
LL | #![deny(unused_attributes)]
|
||||||
|
| ^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error[E0517]: attribute should be applied to a struct or union
|
||||||
|
--> $DIR/repr-empty-packed.rs:5:8
|
||||||
|
|
|
||||||
|
LL | #[repr(packed)]
|
||||||
|
| ^^^^^^
|
||||||
|
LL | / pub enum Foo {
|
||||||
|
LL | | Bar,
|
||||||
|
LL | | Baz(i32),
|
||||||
|
LL | | }
|
||||||
|
| |_- not a struct or union
|
||||||
|
|
||||||
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0517`.
|
||||||
Reference in New Issue
Block a user