Auto merge of #140127 - ChrisDenton:rollup-2kye32h, r=ChrisDenton

Rollup of 11 pull requests

Successful merges:

 - #134213 (Stabilize `naked_functions`)
 - #139711 (Hermit: Unify `std::env::args` with Unix)
 - #139795 (Clarify why SGX code specifies linkage/symbol names for certain statics)
 - #140036 (Advent of `tests/ui` (misc cleanups and improvements) [4/N])
 - #140047 (remove a couple clones)
 - #140052 (Fix error when an intra doc link is trying to resolve an empty associated item)
 - #140074 (rustdoc-json: Improve test for auto-trait impls)
 - #140076 (jsondocck: Require command is at start of line)
 - #140107 (rustc-dev-guide subtree update)
 - #140111 (cleanup redundant pattern instances)
 - #140118 ({B,C}Str: minor cleanup)

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2025-04-21 19:28:16 +00:00
commit d6c1e454aa
90 changed files with 325 additions and 405 deletions

View file

@ -596,15 +596,14 @@ mod llvm_enzyme {
} }
}; };
let arg = ty.kind.is_simple_path().unwrap(); let arg = ty.kind.is_simple_path().unwrap();
let sl: Vec<Symbol> = vec![arg, kw::Default]; let tmp = ecx.def_site_path(&[arg, kw::Default]);
let tmp = ecx.def_site_path(&sl);
let default_call_expr = ecx.expr_path(ecx.path(span, tmp)); let default_call_expr = ecx.expr_path(ecx.path(span, tmp));
let default_call_expr = ecx.expr_call(new_decl_span, default_call_expr, thin_vec![]); let default_call_expr = ecx.expr_call(new_decl_span, default_call_expr, thin_vec![]);
body.stmts.push(ecx.stmt_expr(default_call_expr)); body.stmts.push(ecx.stmt_expr(default_call_expr));
return body; return body;
} }
let mut exprs: P<ast::Expr> = primal_call.clone(); let mut exprs: P<ast::Expr> = primal_call;
let d_ret_ty = match d_sig.decl.output { let d_ret_ty = match d_sig.decl.output {
FnRetTy::Ty(ref ty) => ty.clone(), FnRetTy::Ty(ref ty) => ty.clone(),
FnRetTy::Default(span) => { FnRetTy::Default(span) => {
@ -622,7 +621,7 @@ mod llvm_enzyme {
// type due to the Const return activity. // type due to the Const return activity.
exprs = ecx.expr_call(new_decl_span, bb_call_expr, thin_vec![exprs]); exprs = ecx.expr_call(new_decl_span, bb_call_expr, thin_vec![exprs]);
} else { } else {
let q = QSelf { ty: d_ret_ty.clone(), path_span: span, position: 0 }; let q = QSelf { ty: d_ret_ty, path_span: span, position: 0 };
let y = let y =
ExprKind::Path(Some(P(q)), ecx.path_ident(span, Ident::from_str("default"))); ExprKind::Path(Some(P(q)), ecx.path_ident(span, Ident::from_str("default")));
let default_call_expr = ecx.expr(span, y); let default_call_expr = ecx.expr(span, y);
@ -640,8 +639,7 @@ mod llvm_enzyme {
let mut exprs2 = thin_vec![exprs]; let mut exprs2 = thin_vec![exprs];
for arg in args.iter().skip(1) { for arg in args.iter().skip(1) {
let arg = arg.kind.is_simple_path().unwrap(); let arg = arg.kind.is_simple_path().unwrap();
let sl: Vec<Symbol> = vec![arg, kw::Default]; let tmp = ecx.def_site_path(&[arg, kw::Default]);
let tmp = ecx.def_site_path(&sl);
let default_call_expr = ecx.expr_path(ecx.path(span, tmp)); let default_call_expr = ecx.expr_path(ecx.path(span, tmp));
let default_call_expr = let default_call_expr =
ecx.expr_call(new_decl_span, default_call_expr, thin_vec![]); ecx.expr_call(new_decl_span, default_call_expr, thin_vec![]);

View file

@ -1,13 +1,4 @@
#![feature( #![feature(no_core, lang_items, never_type, linkage, extern_types, thread_local, repr_simd)]
no_core,
lang_items,
never_type,
linkage,
extern_types,
naked_functions,
thread_local,
repr_simd
)]
#![no_core] #![no_core]
#![allow(dead_code, non_camel_case_types, internal_features)] #![allow(dead_code, non_camel_case_types, internal_features)]

View file

@ -3,8 +3,6 @@ An unsupported naked function definition.
Erroneous code example: Erroneous code example:
```compile_fail,E0787 ```compile_fail,E0787
#![feature(naked_functions)]
#[unsafe(naked)] #[unsafe(naked)]
pub extern "C" fn f() -> u32 { pub extern "C" fn f() -> u32 {
42 42

View file

@ -300,6 +300,8 @@ declare_features! (
/// Allows patterns with concurrent by-move and by-ref bindings. /// Allows patterns with concurrent by-move and by-ref bindings.
/// For example, you can write `Foo(a, ref b)` where `a` is by-move and `b` is by-ref. /// For example, you can write `Foo(a, ref b)` where `a` is by-move and `b` is by-ref.
(accepted, move_ref_pattern, "1.49.0", Some(68354)), (accepted, move_ref_pattern, "1.49.0", Some(68354)),
/// Allows using `#[naked]` on functions.
(accepted, naked_functions, "CURRENT_RUSTC_VERSION", Some(90957)),
/// Allows specifying modifiers in the link attribute: `#[link(modifiers = "...")]` /// Allows specifying modifiers in the link attribute: `#[link(modifiers = "...")]`
(accepted, native_link_modifiers, "1.61.0", Some(81490)), (accepted, native_link_modifiers, "1.61.0", Some(81490)),
/// Allows specifying the bundle link modifier /// Allows specifying the bundle link modifier

View file

@ -443,6 +443,7 @@ pub static BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
ungated!(unsafe(Edition2024) no_mangle, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::No), ungated!(unsafe(Edition2024) no_mangle, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::No),
ungated!(used, Normal, template!(Word, List: "compiler|linker"), WarnFollowing, EncodeCrossCrate::No), ungated!(used, Normal, template!(Word, List: "compiler|linker"), WarnFollowing, EncodeCrossCrate::No),
ungated!(link_ordinal, Normal, template!(List: "ordinal"), ErrorPreceding, EncodeCrossCrate::Yes), ungated!(link_ordinal, Normal, template!(List: "ordinal"), ErrorPreceding, EncodeCrossCrate::Yes),
ungated!(unsafe naked, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::No),
// Limits: // Limits:
ungated!( ungated!(
@ -515,12 +516,6 @@ pub static BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
// Unstable attributes: // Unstable attributes:
// ========================================================================== // ==========================================================================
// Linking:
gated!(
unsafe naked, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::No,
naked_functions, experimental!(naked)
),
// Testing: // Testing:
gated!( gated!(
test_runner, CrateLevel, template!(List: "path"), ErrorFollowing, test_runner, CrateLevel, template!(List: "path"), ErrorFollowing,

View file

@ -563,8 +563,6 @@ declare_features! (
(unstable, must_not_suspend, "1.57.0", Some(83310)), (unstable, must_not_suspend, "1.57.0", Some(83310)),
/// Allows `mut ref` and `mut ref mut` identifier patterns. /// Allows `mut ref` and `mut ref mut` identifier patterns.
(incomplete, mut_ref, "1.79.0", Some(123076)), (incomplete, mut_ref, "1.79.0", Some(123076)),
/// Allows using `#[naked]` on functions.
(unstable, naked_functions, "1.9.0", Some(90957)),
/// Allows using `#[naked]` on `extern "Rust"` functions. /// Allows using `#[naked]` on `extern "Rust"` functions.
(unstable, naked_functions_rustic_abi, "CURRENT_RUSTC_VERSION", Some(138997)), (unstable, naked_functions_rustic_abi, "CURRENT_RUSTC_VERSION", Some(138997)),
/// Allows using `#[target_feature(enable = "...")]` on `#[naked]` on functions. /// Allows using `#[target_feature(enable = "...")]` on `#[naked]` on functions.

View file

@ -246,6 +246,8 @@ impl AssocItems {
} }
/// Returns an iterator over all associated items with the given name, ignoring hygiene. /// Returns an iterator over all associated items with the given name, ignoring hygiene.
///
/// Panics if `name.is_empty()` returns `true`.
pub fn filter_by_name_unhygienic( pub fn filter_by_name_unhygienic(
&self, &self,
name: Symbol, name: Symbol,

View file

@ -1530,7 +1530,7 @@ fn build_scope_drops<'tcx>(
// path, then don't generate the drop. (We only take this into // path, then don't generate the drop. (We only take this into
// account for non-unwind paths so as not to disturb the // account for non-unwind paths so as not to disturb the
// caching mechanism.) // caching mechanism.)
if scope.moved_locals.iter().any(|&o| o == local) { if scope.moved_locals.contains(&local) {
continue; continue;
} }

View file

@ -690,13 +690,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
} }
} }
} }
// FIXME(#80564): We permit struct fields, match arms and macro defs to have an
// `#[naked]` attribute with just a lint, because we previously
// erroneously allowed it and some crates used it accidentally, to be compatible
// with crates depending on them, we can't throw an error here.
Target::Field | Target::Arm | Target::MacroDef => {
self.inline_attr_str_error_with_macro_def(hir_id, attr, "naked")
}
_ => { _ => {
self.dcx().emit_err(errors::AttrShouldBeAppliedToFn { self.dcx().emit_err(errors::AttrShouldBeAppliedToFn {
attr_span: attr.span(), attr_span: attr.span(),

View file

@ -514,7 +514,7 @@ pub(crate) mod rustc {
} }
} }
ty::Tuple(fields) => fields[i.as_usize()], ty::Tuple(fields) => fields[i.as_usize()],
kind @ _ => unimplemented!( kind => unimplemented!(
"only a subset of `Ty::ty_and_layout_field`'s functionality is implemented. implementation needed for {:?}", "only a subset of `Ty::ty_and_layout_field`'s functionality is implemented. implementation needed for {:?}",
kind kind
), ),

View file

@ -574,7 +574,7 @@ impl CString {
#[stable(feature = "as_c_str", since = "1.20.0")] #[stable(feature = "as_c_str", since = "1.20.0")]
#[rustc_diagnostic_item = "cstring_as_c_str"] #[rustc_diagnostic_item = "cstring_as_c_str"]
pub fn as_c_str(&self) -> &CStr { pub fn as_c_str(&self) -> &CStr {
&*self unsafe { CStr::from_bytes_with_nul_unchecked(self.as_bytes_with_nul()) }
} }
/// Converts this `CString` into a boxed [`CStr`]. /// Converts this `CString` into a boxed [`CStr`].
@ -705,14 +705,14 @@ impl ops::Deref for CString {
#[inline] #[inline]
fn deref(&self) -> &CStr { fn deref(&self) -> &CStr {
unsafe { CStr::from_bytes_with_nul_unchecked(self.as_bytes_with_nul()) } self.as_c_str()
} }
} }
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl fmt::Debug for CString { impl fmt::Debug for CString {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Debug::fmt(&**self, f) fmt::Debug::fmt(self.as_c_str(), f)
} }
} }

View file

@ -33,12 +33,6 @@ fn build_with_zero2() {
assert!(CString::new(vec![0]).is_err()); assert!(CString::new(vec![0]).is_err());
} }
#[test]
fn formatted() {
let s = CString::new(&b"abc\x01\x02\n\xE2\x80\xA6\xFF"[..]).unwrap();
assert_eq!(format!("{s:?}"), r#""abc\x01\x02\n\xe2\x80\xa6\xff""#);
}
#[test] #[test]
fn borrowed() { fn borrowed() {
unsafe { unsafe {

View file

@ -32,7 +32,7 @@ pub macro asm("assembly template", $(operands,)* $(options($(option),*))?) {
/// ///
/// [Rust By Example]: https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html /// [Rust By Example]: https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html
/// [reference]: https://doc.rust-lang.org/nightly/reference/inline-assembly.html /// [reference]: https://doc.rust-lang.org/nightly/reference/inline-assembly.html
#[unstable(feature = "naked_functions", issue = "90957")] #[stable(feature = "naked_functions", since = "CURRENT_RUSTC_VERSION")]
#[rustc_builtin_macro] #[rustc_builtin_macro]
pub macro naked_asm("assembly template", $(operands,)* $(options($(option),*))?) { pub macro naked_asm("assembly template", $(operands,)* $(options($(option),*))?) {
/* compiler built-in */ /* compiler built-in */

View file

@ -36,8 +36,7 @@ use crate::ops::{Deref, DerefMut, DerefPure};
/// presented as hex escape sequences. /// presented as hex escape sequences.
/// ///
/// The `Display` implementation behaves as if the `ByteStr` were first lossily converted to a /// The `Display` implementation behaves as if the `ByteStr` were first lossily converted to a
/// `str`, with invalid UTF-8 presented as the Unicode replacement character: <20> /// `str`, with invalid UTF-8 presented as the Unicode replacement character (<28>).
///
#[unstable(feature = "bstr", issue = "134915")] #[unstable(feature = "bstr", issue = "134915")]
#[repr(transparent)] #[repr(transparent)]
#[doc(alias = "BStr")] #[doc(alias = "BStr")]

View file

@ -150,7 +150,6 @@ impl Error for FromBytesWithNulError {
/// within the slice. /// within the slice.
/// ///
/// This error is created by the [`CStr::from_bytes_until_nul`] method. /// This error is created by the [`CStr::from_bytes_until_nul`] method.
///
#[derive(Clone, PartialEq, Eq, Debug)] #[derive(Clone, PartialEq, Eq, Debug)]
#[stable(feature = "cstr_from_bytes_until_nul", since = "1.69.0")] #[stable(feature = "cstr_from_bytes_until_nul", since = "1.69.0")]
pub struct FromBytesUntilNulError(()); pub struct FromBytesUntilNulError(());

View file

@ -13,3 +13,9 @@ fn compares_as_u8s() {
assert_eq!(Ord::cmp(a, b), Ord::cmp(a_bytes, b_bytes)); assert_eq!(Ord::cmp(a, b), Ord::cmp(a_bytes, b_bytes));
assert_eq!(PartialOrd::partial_cmp(a, b), PartialOrd::partial_cmp(a_bytes, b_bytes)); assert_eq!(PartialOrd::partial_cmp(a, b), PartialOrd::partial_cmp(a_bytes, b_bytes));
} }
#[test]
fn debug() {
let s = c"abc\x01\x02\n\xE2\x80\xA6\xFF";
assert_eq!(format!("{s:?}"), r#""abc\x01\x02\n\xe2\x80\xa6\xff""#);
}

View file

@ -3265,7 +3265,7 @@ impl Hash for Path {
if !verbatim { if !verbatim {
component_start += match tail { component_start += match tail {
[b'.'] => 1, [b'.'] => 1,
[b'.', sep @ _, ..] if is_sep_byte(*sep) => 1, [b'.', sep, ..] if is_sep_byte(*sep) => 1,
_ => 0, _ => 0,
}; };
} }

View file

@ -10,8 +10,10 @@ use crate::sys::pal::waitqueue::SpinMutex;
// The current allocator here is the `dlmalloc` crate which we've got included // The current allocator here is the `dlmalloc` crate which we've got included
// in the rust-lang/rust repository as a submodule. The crate is a port of // in the rust-lang/rust repository as a submodule. The crate is a port of
// dlmalloc.c from C to Rust. // dlmalloc.c from C to Rust.
//
// Specifying linkage/symbol name is solely to ensure a single instance between this crate and its unit tests
#[cfg_attr(test, linkage = "available_externally")] #[cfg_attr(test, linkage = "available_externally")]
#[unsafe(export_name = "_ZN16__rust_internals3std3sys3sgx5alloc8DLMALLOCE")] #[unsafe(export_name = "_ZN16__rust_internals3std3sys5alloc3sgx8DLMALLOCE")]
static DLMALLOC: SpinMutex<dlmalloc::Dlmalloc<Sgx>> = static DLMALLOC: SpinMutex<dlmalloc::Dlmalloc<Sgx>> =
SpinMutex::new(dlmalloc::Dlmalloc::new_with_allocator(Sgx {})); SpinMutex::new(dlmalloc::Dlmalloc::new_with_allocator(Sgx {}));

View file

@ -1,35 +0,0 @@
use crate::ffi::{CStr, OsString, c_char};
use crate::os::hermit::ffi::OsStringExt;
use crate::ptr;
use crate::sync::atomic::Ordering::{Acquire, Relaxed, Release};
use crate::sync::atomic::{AtomicIsize, AtomicPtr};
#[path = "common.rs"]
mod common;
pub use common::Args;
static ARGC: AtomicIsize = AtomicIsize::new(0);
static ARGV: AtomicPtr<*const u8> = AtomicPtr::new(ptr::null_mut());
/// One-time global initialization.
pub unsafe fn init(argc: isize, argv: *const *const u8) {
ARGC.store(argc, Relaxed);
// Use release ordering here to broadcast writes by the OS.
ARGV.store(argv as *mut *const u8, Release);
}
/// Returns the command line arguments
pub fn args() -> Args {
// Synchronize with the store above.
let argv = ARGV.load(Acquire);
// If argv has not been initialized yet, do not return any arguments.
let argc = if argv.is_null() { 0 } else { ARGC.load(Relaxed) };
let args: Vec<OsString> = (0..argc)
.map(|i| unsafe {
let cstr = CStr::from_ptr(*argv.offset(i) as *const c_char);
OsStringExt::from_vec(cstr.to_bytes().to_vec())
})
.collect();
Args::new(args)
}

View file

@ -3,15 +3,15 @@
#![forbid(unsafe_op_in_unsafe_fn)] #![forbid(unsafe_op_in_unsafe_fn)]
cfg_if::cfg_if! { cfg_if::cfg_if! {
if #[cfg(all(target_family = "unix", not(any(target_os = "espidf", target_os = "vita"))))] { if #[cfg(any(
all(target_family = "unix", not(any(target_os = "espidf", target_os = "vita"))),
target_os = "hermit",
))] {
mod unix; mod unix;
pub use unix::*; pub use unix::*;
} else if #[cfg(target_family = "windows")] { } else if #[cfg(target_family = "windows")] {
mod windows; mod windows;
pub use windows::*; pub use windows::*;
} else if #[cfg(target_os = "hermit")] {
mod hermit;
pub use hermit::*;
} else if #[cfg(all(target_vendor = "fortanix", target_env = "sgx"))] { } else if #[cfg(all(target_vendor = "fortanix", target_env = "sgx"))] {
mod sgx; mod sgx;
pub use sgx::*; pub use sgx::*;

View file

@ -8,6 +8,7 @@ use crate::sys::pal::abi::usercalls::raw::ByteBuffer;
use crate::sys_common::FromInner; use crate::sys_common::FromInner;
use crate::{fmt, slice}; use crate::{fmt, slice};
// Specifying linkage/symbol name is solely to ensure a single instance between this crate and its unit tests
#[cfg_attr(test, linkage = "available_externally")] #[cfg_attr(test, linkage = "available_externally")]
#[unsafe(export_name = "_ZN16__rust_internals3std3sys3sgx4args4ARGSE")] #[unsafe(export_name = "_ZN16__rust_internals3std3sys3sgx4args4ARGSE")]
static ARGS: AtomicUsize = AtomicUsize::new(0); static ARGS: AtomicUsize = AtomicUsize::new(0);

View file

@ -6,6 +6,9 @@
#![allow(dead_code)] // runtime init functions not used during testing #![allow(dead_code)] // runtime init functions not used during testing
use crate::ffi::CStr; use crate::ffi::CStr;
#[cfg(target_os = "hermit")]
use crate::os::hermit::ffi::OsStringExt;
#[cfg(not(target_os = "hermit"))]
use crate::os::unix::ffi::OsStringExt; use crate::os::unix::ffi::OsStringExt;
#[path = "common.rs"] #[path = "common.rs"]
@ -73,6 +76,7 @@ pub fn args() -> Args {
target_os = "illumos", target_os = "illumos",
target_os = "emscripten", target_os = "emscripten",
target_os = "haiku", target_os = "haiku",
target_os = "hermit",
target_os = "l4re", target_os = "l4re",
target_os = "fuchsia", target_os = "fuchsia",
target_os = "redox", target_os = "redox",
@ -100,7 +104,7 @@ mod imp {
unsafe fn really_init(argc: isize, argv: *const *const u8) { unsafe fn really_init(argc: isize, argv: *const *const u8) {
// These don't need to be ordered with each other or other stores, // These don't need to be ordered with each other or other stores,
// because they only hold the unmodified system-provide argv/argc. // because they only hold the unmodified system-provided argv/argc.
ARGC.store(argc, Ordering::Relaxed); ARGC.store(argc, Ordering::Relaxed);
ARGV.store(argv as *mut _, Ordering::Relaxed); ARGV.store(argv as *mut _, Ordering::Relaxed);
} }

View file

@ -11,15 +11,17 @@ const USIZE_BITS: usize = 64;
const TLS_KEYS: usize = 128; // Same as POSIX minimum const TLS_KEYS: usize = 128; // Same as POSIX minimum
const TLS_KEYS_BITSET_SIZE: usize = (TLS_KEYS + (USIZE_BITS - 1)) / USIZE_BITS; const TLS_KEYS_BITSET_SIZE: usize = (TLS_KEYS + (USIZE_BITS - 1)) / USIZE_BITS;
// Specifying linkage/symbol name is solely to ensure a single instance between this crate and its unit tests
#[cfg_attr(test, linkage = "available_externally")] #[cfg_attr(test, linkage = "available_externally")]
#[unsafe(export_name = "_ZN16__rust_internals3std3sys3sgx3abi3tls14TLS_KEY_IN_USEE")] #[unsafe(export_name = "_ZN16__rust_internals3std3sys3pal3sgx3abi3tls14TLS_KEY_IN_USEE")]
static TLS_KEY_IN_USE: SyncBitset = SYNC_BITSET_INIT; static TLS_KEY_IN_USE: SyncBitset = SYNC_BITSET_INIT;
macro_rules! dup { macro_rules! dup {
((* $($exp:tt)*) $($val:tt)*) => (dup!( ($($exp)*) $($val)* $($val)* )); ((* $($exp:tt)*) $($val:tt)*) => (dup!( ($($exp)*) $($val)* $($val)* ));
(() $($val:tt)*) => ([$($val),*]) (() $($val:tt)*) => ([$($val),*])
} }
// Specifying linkage/symbol name is solely to ensure a single instance between this crate and its unit tests
#[cfg_attr(test, linkage = "available_externally")] #[cfg_attr(test, linkage = "available_externally")]
#[unsafe(export_name = "_ZN16__rust_internals3std3sys3sgx3abi3tls14TLS_DESTRUCTORE")] #[unsafe(export_name = "_ZN16__rust_internals3std3sys3pal3sgx3abi3tls14TLS_DESTRUCTORE")]
static TLS_DESTRUCTOR: [AtomicUsize; TLS_KEYS] = dup!((* * * * * * *) (AtomicUsize::new(0))); static TLS_DESTRUCTOR: [AtomicUsize; TLS_KEYS] = dup!((* * * * * * *) (AtomicUsize::new(0)));
unsafe extern "C" { unsafe extern "C" {

View file

@ -73,11 +73,13 @@ pub fn current_exe() -> io::Result<PathBuf> {
unsupported() unsupported()
} }
// Specifying linkage/symbol name is solely to ensure a single instance between this crate and its unit tests
#[cfg_attr(test, linkage = "available_externally")] #[cfg_attr(test, linkage = "available_externally")]
#[unsafe(export_name = "_ZN16__rust_internals3std3sys3sgx2os3ENVE")] #[unsafe(export_name = "_ZN16__rust_internals3std3sys3pal3sgx2os3ENVE")]
static ENV: AtomicUsize = AtomicUsize::new(0); static ENV: AtomicUsize = AtomicUsize::new(0);
// Specifying linkage/symbol name is solely to ensure a single instance between this crate and its unit tests
#[cfg_attr(test, linkage = "available_externally")] #[cfg_attr(test, linkage = "available_externally")]
#[unsafe(export_name = "_ZN16__rust_internals3std3sys3sgx2os8ENV_INITE")] #[unsafe(export_name = "_ZN16__rust_internals3std3sys3pal3sgx2os8ENV_INITE")]
static ENV_INIT: Once = Once::new(); static ENV_INIT: Once = Once::new();
type EnvStore = Mutex<HashMap<OsString, OsString>>; type EnvStore = Mutex<HashMap<OsString, OsString>>;

View file

@ -45,8 +45,9 @@ mod task_queue {
} }
} }
// Specifying linkage/symbol name is solely to ensure a single instance between this crate and its unit tests
#[cfg_attr(test, linkage = "available_externally")] #[cfg_attr(test, linkage = "available_externally")]
#[unsafe(export_name = "_ZN16__rust_internals3std3sys3sgx6thread10TASK_QUEUEE")] #[unsafe(export_name = "_ZN16__rust_internals3std3sys3pal3sgx6thread10TASK_QUEUEE")]
static TASK_QUEUE: Mutex<Vec<Task>> = Mutex::new(Vec::new()); static TASK_QUEUE: Mutex<Vec<Task>> = Mutex::new(Vec::new());
pub(super) fn lock() -> MutexGuard<'static, Vec<Task>> { pub(super) fn lock() -> MutexGuard<'static, Vec<Task>> {

View file

@ -1 +1 @@
a7c39b68616668a45f0afd62849a1da7c8ad2516 b8005bff3248cfc6e327faf4fa631ac49bb49ba9

View file

@ -303,7 +303,7 @@ It should be preferred to using `error-pattern`, which is imprecise and non-exha
### `error-pattern` ### `error-pattern`
The `error-pattern` [directive](directives.md) can be used for runtime messages, which don't The `error-pattern` [directive](directives.md) can be used for runtime messages, which don't
have a specific span, or in exceptional cases for compile time messages. have a specific span, or in exceptional cases, for compile time messages.
Let's think about this test: Let's think about this test:
@ -316,7 +316,7 @@ fn main() {
} }
``` ```
We want to ensure this shows "index out of bounds" but we cannot use the `ERROR` We want to ensure this shows "index out of bounds", but we cannot use the `ERROR`
annotation since the runtime error doesn't have any span. Then it's time to use the annotation since the runtime error doesn't have any span. Then it's time to use the
`error-pattern` directive: `error-pattern` directive:
@ -333,18 +333,19 @@ fn main() {
Use of `error-pattern` is not recommended in general. Use of `error-pattern` is not recommended in general.
For strict testing of compile time output, try to use the line annotations `//~` as much as For strict testing of compile time output, try to use the line annotations `//~` as much as
possible, including `//~?` annotations for diagnostics without span. possible, including `//~?` annotations for diagnostics without spans.
If the compile time output is target dependent or too verbose, use directive If the compile time output is target dependent or too verbose, use directive
`//@ dont-require-annotations: <diagnostic-kind>` to make the line annotation checking `//@ dont-require-annotations: <diagnostic-kind>` to make the line annotation checking
non-exhaustive, some of the compiler messages can stay uncovered by annotations in this mode. non-exhaustive.
Some of the compiler messages can stay uncovered by annotations in this mode.
For checking runtime output `//@ check-run-results` may be preferable. For checking runtime output, `//@ check-run-results` may be preferable.
Only use `error-pattern` if none of the above works. Only use `error-pattern` if none of the above works.
Line annotations `//~` are still checked in tests using `error-pattern`. Line annotations `//~` are still checked in tests using `error-pattern`.
In exceptional cases use `//@ compile-flags: --error-format=human` to opt out of these checks. In exceptional cases, use `//@ compile-flags: --error-format=human` to opt out of these checks.
### Diagnostic kinds (error levels) ### Diagnostic kinds (error levels)

View file

@ -245,8 +245,6 @@ See the [Clang ControlFlowIntegrity documentation][clang-cfi] for more details.
## Example 1: Redirecting control flow using an indirect branch/call to an invalid destination ## Example 1: Redirecting control flow using an indirect branch/call to an invalid destination
```rust,ignore (making doc tests pass cross-platform is hard) ```rust,ignore (making doc tests pass cross-platform is hard)
#![feature(naked_functions)]
use std::arch::naked_asm; use std::arch::naked_asm;
use std::mem; use std::mem;

View file

@ -59,7 +59,12 @@ fn filter_assoc_items_by_name_and_namespace(
ident: Ident, ident: Ident,
ns: Namespace, ns: Namespace,
) -> impl Iterator<Item = &ty::AssocItem> { ) -> impl Iterator<Item = &ty::AssocItem> {
tcx.associated_items(assoc_items_of).filter_by_name_unhygienic(ident.name).filter(move |item| { let iter: Box<dyn Iterator<Item = &ty::AssocItem>> = if !ident.name.is_empty() {
Box::new(tcx.associated_items(assoc_items_of).filter_by_name_unhygienic(ident.name))
} else {
Box::new([].iter())
};
iter.filter(move |item| {
item.namespace() == ns && tcx.hygienic_eq(ident, item.ident(tcx), assoc_items_of) item.namespace() == ns && tcx.hygienic_eq(ident, item.ident(tcx), assoc_items_of)
}) })
} }

View file

@ -154,6 +154,7 @@ impl CommandKind {
static LINE_PATTERN: LazyLock<Regex> = LazyLock::new(|| { static LINE_PATTERN: LazyLock<Regex> = LazyLock::new(|| {
RegexBuilder::new( RegexBuilder::new(
r#" r#"
^\s*
//@\s+ //@\s+
(?P<negated>!?) (?P<negated>!?)
(?P<cmd>[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*) (?P<cmd>[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*)

View file

@ -4,7 +4,7 @@
//@ only-aarch64 //@ only-aarch64
#![crate_type = "lib"] #![crate_type = "lib"]
#![feature(naked_functions)]
use std::arch::naked_asm; use std::arch::naked_asm;
// The problem at hand: Rust has adopted a fairly strict meaning for "naked functions", // The problem at hand: Rust has adopted a fairly strict meaning for "naked functions",

View file

@ -9,7 +9,7 @@
//@[aix] needs-llvm-components: powerpc //@[aix] needs-llvm-components: powerpc
#![crate_type = "lib"] #![crate_type = "lib"]
#![feature(no_core, naked_functions, asm_experimental_arch, f128, linkage, fn_align)] #![feature(no_core, asm_experimental_arch, f128, linkage, fn_align)]
#![no_core] #![no_core]
// tests that naked functions work for the `powerpc64-ibm-aix` target. // tests that naked functions work for the `powerpc64-ibm-aix` target.

View file

@ -9,7 +9,7 @@
//@ [wasm32-wasip1] needs-llvm-components: webassembly //@ [wasm32-wasip1] needs-llvm-components: webassembly
#![crate_type = "lib"] #![crate_type = "lib"]
#![feature(no_core, naked_functions, asm_experimental_arch, f128, linkage, fn_align)] #![feature(no_core, asm_experimental_arch, f128, linkage, fn_align)]
#![no_core] #![no_core]
extern crate minicore; extern crate minicore;

View file

@ -4,7 +4,7 @@
//@ only-x86_64 //@ only-x86_64
#![crate_type = "lib"] #![crate_type = "lib"]
#![feature(naked_functions)]
use std::arch::naked_asm; use std::arch::naked_asm;
// The problem at hand: Rust has adopted a fairly strict meaning for "naked functions", // The problem at hand: Rust has adopted a fairly strict meaning for "naked functions",

View file

@ -22,7 +22,6 @@
negative_impls, negative_impls,
rustc_attrs, rustc_attrs,
decl_macro, decl_macro,
naked_functions,
f16, f16,
f128, f128,
asm_experimental_arch, asm_experimental_arch,

View file

@ -5,7 +5,6 @@
#![crate_type = "lib"] #![crate_type = "lib"]
#![feature(c_variadic)] #![feature(c_variadic)]
#![feature(naked_functions)]
#![no_std] #![no_std]
#[unsafe(naked)] #[unsafe(naked)]

View file

@ -6,7 +6,7 @@
#![crate_type = "lib"] #![crate_type = "lib"]
#![no_std] #![no_std]
#![feature(abi_x86_interrupt, naked_functions)] #![feature(abi_x86_interrupt)]
pub fn caller() { pub fn caller() {
page_fault_handler(1, 2); page_fault_handler(1, 2);

View file

@ -3,7 +3,7 @@
//@ ignore-arm no "ret" mnemonic //@ ignore-arm no "ret" mnemonic
#![crate_type = "lib"] #![crate_type = "lib"]
#![feature(naked_functions, fn_align)] #![feature(fn_align)]
use std::arch::naked_asm; use std::arch::naked_asm;
// CHECK: .balign 16 // CHECK: .balign 16

View file

@ -2,7 +2,6 @@
//@ only-x86_64 //@ only-x86_64
#![crate_type = "lib"] #![crate_type = "lib"]
#![feature(naked_functions, asm_const)]
use std::arch::naked_asm; use std::arch::naked_asm;

View file

@ -6,7 +6,7 @@
//@ [thumb-mode] needs-llvm-components: arm //@ [thumb-mode] needs-llvm-components: arm
#![crate_type = "lib"] #![crate_type = "lib"]
#![feature(no_core, lang_items, rustc_attrs, naked_functions)] #![feature(no_core, lang_items, rustc_attrs)]
#![no_core] #![no_core]
extern crate minicore; extern crate minicore;

View file

@ -2,7 +2,7 @@
//@ needs-asm-support //@ needs-asm-support
//@ ignore-arm no "ret" mnemonic //@ ignore-arm no "ret" mnemonic
#![feature(naked_functions, fn_align)] #![feature(fn_align)]
#![crate_type = "lib"] #![crate_type = "lib"]
// functions without explicit alignment use the global minimum // functions without explicit alignment use the global minimum

View file

@ -13,7 +13,7 @@
//@[thumb] needs-llvm-components: arm //@[thumb] needs-llvm-components: arm
#![crate_type = "lib"] #![crate_type = "lib"]
#![feature(no_core, lang_items, rustc_attrs, naked_functions)] #![feature(no_core, lang_items, rustc_attrs)]
#![no_core] #![no_core]
extern crate minicore; extern crate minicore;

View file

@ -1,4 +1,4 @@
#![feature(naked_functions, linkage)] #![feature(linkage)]
#![crate_type = "dylib"] #![crate_type = "dylib"]
use std::arch::naked_asm; use std::arch::naked_asm;

View file

@ -1,6 +1,6 @@
// Regression test for <https://github.com/rust-lang/rust/issues/104851> // Regression test for <https://github.com/rust-lang/rust/issues/104851>
///@ set foo = "$.index[?(@.name=='Foo')].id" //@ set foo = "$.index[?(@.name=='Foo')].id"
pub type Foo = i32; pub type Foo = i32;
//@ is "$.index[?(@.name=='demo')].inner.function.sig.output.resolved_path.id" $foo //@ is "$.index[?(@.name=='demo')].inner.function.sig.output.resolved_path.id" $foo

View file

@ -17,6 +17,8 @@ impl Foo {
// Testing spans, so all tests below code // Testing spans, so all tests below code
//@ is "$.index[?(@.docs=='has span')].span.begin" "[13, 1]" //@ is "$.index[?(@.docs=='has span')].span.begin" "[13, 1]"
//@ is "$.index[?(@.docs=='has span')].span.end" "[15, 2]" //@ is "$.index[?(@.docs=='has span')].span.end" "[15, 2]"
// FIXME: this doesn't work due to https://github.com/freestrings/jsonpath/issues/91 //@ is "$.index[?(@.docs=='has span')].inner.impl.is_synthetic" false
// is "$.index[?(@.inner.impl.is_synthetic==true)].span" null //@ is "$.index[?(@.inner.impl.is_synthetic==true)].span" null
//@ is "$.index[?(@.inner.impl.is_synthetic==true)].inner.impl.for.resolved_path.path" '"Foo"'
//@ is "$.index[?(@.inner.impl.is_synthetic==true)].inner.impl.trait.path" '"Bar"'
pub struct Foo; pub struct Foo;

View file

@ -0,0 +1,8 @@
// This test ensures that an empty associated item will not crash rustdoc.
// This is a regression test for <https://github.com/rust-lang/rust/issues/140026>.
#[deny(rustdoc::broken_intra_doc_links)]
/// [`String::`]
//~^ ERROR
pub struct Foo;

View file

@ -0,0 +1,14 @@
error: unresolved link to `String::`
--> $DIR/empty-associated-items.rs:6:7
|
LL | /// [`String::`]
| ^^^^^^^^ the struct `String` has no field or associated item named ``
|
note: the lint level is defined here
--> $DIR/empty-associated-items.rs:4:8
|
LL | #[deny(rustdoc::broken_intra_doc_links)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 1 previous error

View file

@ -1,18 +0,0 @@
//@ revisions: nocpu cpu
//@ no-prefer-dynamic
//@ compile-flags: --crate-type=cdylib --target=amdgcn-amd-amdhsa
//@ needs-llvm-components: amdgpu
//@ needs-rust-lld
//@[nocpu] build-fail
//@[cpu] compile-flags: -Ctarget-cpu=gfx900
//@[cpu] build-pass
#![feature(no_core, lang_items)]
#![no_core]
#[lang="sized"]
trait Sized {}
pub fn foo() {}
//[nocpu]~? ERROR target requires explicitly specifying a cpu with `-C target-cpu`

View file

@ -3,7 +3,6 @@
//@ ignore-nvptx64 //@ ignore-nvptx64
//@ ignore-spirv //@ ignore-spirv
#![feature(naked_functions)]
#![crate_type = "lib"] #![crate_type = "lib"]
use std::arch::naked_asm; use std::arch::naked_asm;

View file

@ -1,17 +1,17 @@
error: the `naked_asm!` macro can only be used in functions marked with `#[unsafe(naked)]` error: the `naked_asm!` macro can only be used in functions marked with `#[unsafe(naked)]`
--> $DIR/naked-asm-outside-naked-fn.rs:21:5 --> $DIR/naked-asm-outside-naked-fn.rs:20:5
| |
LL | naked_asm!("") LL | naked_asm!("")
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
error: the `naked_asm!` macro can only be used in functions marked with `#[unsafe(naked)]` error: the `naked_asm!` macro can only be used in functions marked with `#[unsafe(naked)]`
--> $DIR/naked-asm-outside-naked-fn.rs:26:9 --> $DIR/naked-asm-outside-naked-fn.rs:25:9
| |
LL | (|| naked_asm!(""))() LL | (|| naked_asm!(""))()
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
error: the `naked_asm!` macro can only be used in functions marked with `#[unsafe(naked)]` error: the `naked_asm!` macro can only be used in functions marked with `#[unsafe(naked)]`
--> $DIR/naked-asm-outside-naked-fn.rs:32:9 --> $DIR/naked-asm-outside-naked-fn.rs:31:9
| |
LL | naked_asm!(""); LL | naked_asm!("");
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^

View file

@ -1,6 +1,5 @@
//@ check-pass //@ check-pass
//@ needs-asm-support //@ needs-asm-support
#![feature(naked_functions)]
#![crate_type = "lib"] #![crate_type = "lib"]
use std::arch::naked_asm; use std::arch::naked_asm;

View file

@ -1,5 +1,5 @@
warning: `extern` fn uses type `char`, which is not FFI-safe warning: `extern` fn uses type `char`, which is not FFI-safe
--> $DIR/naked-functions-ffi.rs:9:28 --> $DIR/naked-functions-ffi.rs:8:28
| |
LL | pub extern "C" fn naked(p: char) -> u128 { LL | pub extern "C" fn naked(p: char) -> u128 {
| ^^^^ not FFI-safe | ^^^^ not FFI-safe
@ -9,7 +9,7 @@ LL | pub extern "C" fn naked(p: char) -> u128 {
= note: `#[warn(improper_ctypes_definitions)]` on by default = note: `#[warn(improper_ctypes_definitions)]` on by default
warning: `extern` fn uses type `u128`, which is not FFI-safe warning: `extern` fn uses type `u128`, which is not FFI-safe
--> $DIR/naked-functions-ffi.rs:9:37 --> $DIR/naked-functions-ffi.rs:8:37
| |
LL | pub extern "C" fn naked(p: char) -> u128 { LL | pub extern "C" fn naked(p: char) -> u128 {
| ^^^^ not FFI-safe | ^^^^ not FFI-safe

View file

@ -1,5 +1,4 @@
//@ needs-asm-support //@ needs-asm-support
#![feature(naked_functions)]
#![crate_type = "lib"] #![crate_type = "lib"]
use std::arch::naked_asm; use std::arch::naked_asm;

View file

@ -1,5 +1,5 @@
error[E0736]: attribute incompatible with `#[unsafe(naked)]` error[E0736]: attribute incompatible with `#[unsafe(naked)]`
--> $DIR/naked-functions-inline.rs:13:1 --> $DIR/naked-functions-inline.rs:12:1
| |
LL | #[unsafe(naked)] LL | #[unsafe(naked)]
| ---------------- function marked with `#[unsafe(naked)]` here | ---------------- function marked with `#[unsafe(naked)]` here
@ -7,7 +7,7 @@ LL | #[inline]
| ^^^^^^^^^ the `inline` attribute is incompatible with `#[unsafe(naked)]` | ^^^^^^^^^ the `inline` attribute is incompatible with `#[unsafe(naked)]`
error[E0736]: attribute incompatible with `#[unsafe(naked)]` error[E0736]: attribute incompatible with `#[unsafe(naked)]`
--> $DIR/naked-functions-inline.rs:20:1 --> $DIR/naked-functions-inline.rs:19:1
| |
LL | #[unsafe(naked)] LL | #[unsafe(naked)]
| ---------------- function marked with `#[unsafe(naked)]` here | ---------------- function marked with `#[unsafe(naked)]` here
@ -15,7 +15,7 @@ LL | #[inline(always)]
| ^^^^^^^^^^^^^^^^^ the `inline` attribute is incompatible with `#[unsafe(naked)]` | ^^^^^^^^^^^^^^^^^ the `inline` attribute is incompatible with `#[unsafe(naked)]`
error[E0736]: attribute incompatible with `#[unsafe(naked)]` error[E0736]: attribute incompatible with `#[unsafe(naked)]`
--> $DIR/naked-functions-inline.rs:27:1 --> $DIR/naked-functions-inline.rs:26:1
| |
LL | #[unsafe(naked)] LL | #[unsafe(naked)]
| ---------------- function marked with `#[unsafe(naked)]` here | ---------------- function marked with `#[unsafe(naked)]` here
@ -23,7 +23,7 @@ LL | #[inline(never)]
| ^^^^^^^^^^^^^^^^ the `inline` attribute is incompatible with `#[unsafe(naked)]` | ^^^^^^^^^^^^^^^^ the `inline` attribute is incompatible with `#[unsafe(naked)]`
error[E0736]: attribute incompatible with `#[unsafe(naked)]` error[E0736]: attribute incompatible with `#[unsafe(naked)]`
--> $DIR/naked-functions-inline.rs:34:19 --> $DIR/naked-functions-inline.rs:33:19
| |
LL | #[unsafe(naked)] LL | #[unsafe(naked)]
| ---------------- function marked with `#[unsafe(naked)]` here | ---------------- function marked with `#[unsafe(naked)]` here

View file

@ -5,7 +5,7 @@
//@ build-pass //@ build-pass
#![crate_type = "lib"] #![crate_type = "lib"]
#![feature(no_core, naked_functions)] #![feature(no_core)]
#![no_core] #![no_core]
extern crate minicore; extern crate minicore;

View file

@ -6,7 +6,7 @@
//@ build-pass //@ build-pass
//@ needs-asm-support //@ needs-asm-support
#![feature(naked_functions, naked_functions_rustic_abi, rust_cold_cc)] #![feature(naked_functions_rustic_abi, rust_cold_cc)]
#![crate_type = "lib"] #![crate_type = "lib"]
use std::arch::{asm, naked_asm}; use std::arch::{asm, naked_asm};

View file

@ -1,7 +1,7 @@
//@ build-pass //@ build-pass
//@ needs-asm-support //@ needs-asm-support
#![feature(naked_functions, naked_functions_target_feature)] #![feature(naked_functions_target_feature)]
#![crate_type = "lib"] #![crate_type = "lib"]
use std::arch::{asm, naked_asm}; use std::arch::{asm, naked_asm};

View file

@ -1,7 +1,6 @@
//@ needs-asm-support //@ needs-asm-support
//@ compile-flags: --test //@ compile-flags: --test
#![feature(naked_functions)]
#![feature(test)] #![feature(test)]
#![crate_type = "lib"] #![crate_type = "lib"]

View file

@ -1,5 +1,5 @@
error[E0736]: cannot use `#[unsafe(naked)]` with testing attributes error[E0736]: cannot use `#[unsafe(naked)]` with testing attributes
--> $DIR/naked-functions-testattrs.rs:11:1 --> $DIR/naked-functions-testattrs.rs:10:1
| |
LL | #[test] LL | #[test]
| ------- function marked with testing attribute here | ------- function marked with testing attribute here
@ -7,7 +7,7 @@ LL | #[unsafe(naked)]
| ^^^^^^^^^^^^^^^^ `#[unsafe(naked)]` is incompatible with testing attributes | ^^^^^^^^^^^^^^^^ `#[unsafe(naked)]` is incompatible with testing attributes
error[E0736]: cannot use `#[unsafe(naked)]` with testing attributes error[E0736]: cannot use `#[unsafe(naked)]` with testing attributes
--> $DIR/naked-functions-testattrs.rs:19:1 --> $DIR/naked-functions-testattrs.rs:18:1
| |
LL | #[test] LL | #[test]
| ------- function marked with testing attribute here | ------- function marked with testing attribute here
@ -15,7 +15,7 @@ LL | #[unsafe(naked)]
| ^^^^^^^^^^^^^^^^ `#[unsafe(naked)]` is incompatible with testing attributes | ^^^^^^^^^^^^^^^^ `#[unsafe(naked)]` is incompatible with testing attributes
error[E0736]: cannot use `#[unsafe(naked)]` with testing attributes error[E0736]: cannot use `#[unsafe(naked)]` with testing attributes
--> $DIR/naked-functions-testattrs.rs:27:1 --> $DIR/naked-functions-testattrs.rs:26:1
| |
LL | #[test] LL | #[test]
| ------- function marked with testing attribute here | ------- function marked with testing attribute here
@ -23,7 +23,7 @@ LL | #[unsafe(naked)]
| ^^^^^^^^^^^^^^^^ `#[unsafe(naked)]` is incompatible with testing attributes | ^^^^^^^^^^^^^^^^ `#[unsafe(naked)]` is incompatible with testing attributes
error[E0736]: cannot use `#[unsafe(naked)]` with testing attributes error[E0736]: cannot use `#[unsafe(naked)]` with testing attributes
--> $DIR/naked-functions-testattrs.rs:34:1 --> $DIR/naked-functions-testattrs.rs:33:1
| |
LL | #[bench] LL | #[bench]
| -------- function marked with testing attribute here | -------- function marked with testing attribute here

View file

@ -1,5 +1,5 @@
error: unused variable: `a` error: unused variable: `a`
--> $DIR/naked-functions-unused.rs:17:32 --> $DIR/naked-functions-unused.rs:16:32
| |
LL | pub extern "C" fn function(a: usize, b: usize) -> usize { LL | pub extern "C" fn function(a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_a` | ^ help: if this is intentional, prefix it with an underscore: `_a`
@ -12,55 +12,55 @@ LL | #![deny(unused)]
= note: `#[deny(unused_variables)]` implied by `#[deny(unused)]` = note: `#[deny(unused_variables)]` implied by `#[deny(unused)]`
error: unused variable: `b` error: unused variable: `b`
--> $DIR/naked-functions-unused.rs:17:42 --> $DIR/naked-functions-unused.rs:16:42
| |
LL | pub extern "C" fn function(a: usize, b: usize) -> usize { LL | pub extern "C" fn function(a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_b` | ^ help: if this is intentional, prefix it with an underscore: `_b`
error: unused variable: `a` error: unused variable: `a`
--> $DIR/naked-functions-unused.rs:28:38 --> $DIR/naked-functions-unused.rs:27:38
| |
LL | pub extern "C" fn associated(a: usize, b: usize) -> usize { LL | pub extern "C" fn associated(a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_a` | ^ help: if this is intentional, prefix it with an underscore: `_a`
error: unused variable: `b` error: unused variable: `b`
--> $DIR/naked-functions-unused.rs:28:48 --> $DIR/naked-functions-unused.rs:27:48
| |
LL | pub extern "C" fn associated(a: usize, b: usize) -> usize { LL | pub extern "C" fn associated(a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_b` | ^ help: if this is intentional, prefix it with an underscore: `_b`
error: unused variable: `a` error: unused variable: `a`
--> $DIR/naked-functions-unused.rs:36:41 --> $DIR/naked-functions-unused.rs:35:41
| |
LL | pub extern "C" fn method(&self, a: usize, b: usize) -> usize { LL | pub extern "C" fn method(&self, a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_a` | ^ help: if this is intentional, prefix it with an underscore: `_a`
error: unused variable: `b` error: unused variable: `b`
--> $DIR/naked-functions-unused.rs:36:51 --> $DIR/naked-functions-unused.rs:35:51
| |
LL | pub extern "C" fn method(&self, a: usize, b: usize) -> usize { LL | pub extern "C" fn method(&self, a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_b` | ^ help: if this is intentional, prefix it with an underscore: `_b`
error: unused variable: `a` error: unused variable: `a`
--> $DIR/naked-functions-unused.rs:46:40 --> $DIR/naked-functions-unused.rs:45:40
| |
LL | extern "C" fn trait_associated(a: usize, b: usize) -> usize { LL | extern "C" fn trait_associated(a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_a` | ^ help: if this is intentional, prefix it with an underscore: `_a`
error: unused variable: `b` error: unused variable: `b`
--> $DIR/naked-functions-unused.rs:46:50 --> $DIR/naked-functions-unused.rs:45:50
| |
LL | extern "C" fn trait_associated(a: usize, b: usize) -> usize { LL | extern "C" fn trait_associated(a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_b` | ^ help: if this is intentional, prefix it with an underscore: `_b`
error: unused variable: `a` error: unused variable: `a`
--> $DIR/naked-functions-unused.rs:54:43 --> $DIR/naked-functions-unused.rs:53:43
| |
LL | extern "C" fn trait_method(&self, a: usize, b: usize) -> usize { LL | extern "C" fn trait_method(&self, a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_a` | ^ help: if this is intentional, prefix it with an underscore: `_a`
error: unused variable: `b` error: unused variable: `b`
--> $DIR/naked-functions-unused.rs:54:53 --> $DIR/naked-functions-unused.rs:53:53
| |
LL | extern "C" fn trait_method(&self, a: usize, b: usize) -> usize { LL | extern "C" fn trait_method(&self, a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_b` | ^ help: if this is intentional, prefix it with an underscore: `_b`

View file

@ -3,7 +3,6 @@
//@[x86_64] only-x86_64 //@[x86_64] only-x86_64
//@[aarch64] only-aarch64 //@[aarch64] only-aarch64
#![deny(unused)] #![deny(unused)]
#![feature(naked_functions)]
#![crate_type = "lib"] #![crate_type = "lib"]
pub trait Trait { pub trait Trait {

View file

@ -1,5 +1,5 @@
error: unused variable: `a` error: unused variable: `a`
--> $DIR/naked-functions-unused.rs:17:32 --> $DIR/naked-functions-unused.rs:16:32
| |
LL | pub extern "C" fn function(a: usize, b: usize) -> usize { LL | pub extern "C" fn function(a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_a` | ^ help: if this is intentional, prefix it with an underscore: `_a`
@ -12,55 +12,55 @@ LL | #![deny(unused)]
= note: `#[deny(unused_variables)]` implied by `#[deny(unused)]` = note: `#[deny(unused_variables)]` implied by `#[deny(unused)]`
error: unused variable: `b` error: unused variable: `b`
--> $DIR/naked-functions-unused.rs:17:42 --> $DIR/naked-functions-unused.rs:16:42
| |
LL | pub extern "C" fn function(a: usize, b: usize) -> usize { LL | pub extern "C" fn function(a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_b` | ^ help: if this is intentional, prefix it with an underscore: `_b`
error: unused variable: `a` error: unused variable: `a`
--> $DIR/naked-functions-unused.rs:28:38 --> $DIR/naked-functions-unused.rs:27:38
| |
LL | pub extern "C" fn associated(a: usize, b: usize) -> usize { LL | pub extern "C" fn associated(a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_a` | ^ help: if this is intentional, prefix it with an underscore: `_a`
error: unused variable: `b` error: unused variable: `b`
--> $DIR/naked-functions-unused.rs:28:48 --> $DIR/naked-functions-unused.rs:27:48
| |
LL | pub extern "C" fn associated(a: usize, b: usize) -> usize { LL | pub extern "C" fn associated(a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_b` | ^ help: if this is intentional, prefix it with an underscore: `_b`
error: unused variable: `a` error: unused variable: `a`
--> $DIR/naked-functions-unused.rs:36:41 --> $DIR/naked-functions-unused.rs:35:41
| |
LL | pub extern "C" fn method(&self, a: usize, b: usize) -> usize { LL | pub extern "C" fn method(&self, a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_a` | ^ help: if this is intentional, prefix it with an underscore: `_a`
error: unused variable: `b` error: unused variable: `b`
--> $DIR/naked-functions-unused.rs:36:51 --> $DIR/naked-functions-unused.rs:35:51
| |
LL | pub extern "C" fn method(&self, a: usize, b: usize) -> usize { LL | pub extern "C" fn method(&self, a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_b` | ^ help: if this is intentional, prefix it with an underscore: `_b`
error: unused variable: `a` error: unused variable: `a`
--> $DIR/naked-functions-unused.rs:46:40 --> $DIR/naked-functions-unused.rs:45:40
| |
LL | extern "C" fn trait_associated(a: usize, b: usize) -> usize { LL | extern "C" fn trait_associated(a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_a` | ^ help: if this is intentional, prefix it with an underscore: `_a`
error: unused variable: `b` error: unused variable: `b`
--> $DIR/naked-functions-unused.rs:46:50 --> $DIR/naked-functions-unused.rs:45:50
| |
LL | extern "C" fn trait_associated(a: usize, b: usize) -> usize { LL | extern "C" fn trait_associated(a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_b` | ^ help: if this is intentional, prefix it with an underscore: `_b`
error: unused variable: `a` error: unused variable: `a`
--> $DIR/naked-functions-unused.rs:54:43 --> $DIR/naked-functions-unused.rs:53:43
| |
LL | extern "C" fn trait_method(&self, a: usize, b: usize) -> usize { LL | extern "C" fn trait_method(&self, a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_a` | ^ help: if this is intentional, prefix it with an underscore: `_a`
error: unused variable: `b` error: unused variable: `b`
--> $DIR/naked-functions-unused.rs:54:53 --> $DIR/naked-functions-unused.rs:53:53
| |
LL | extern "C" fn trait_method(&self, a: usize, b: usize) -> usize { LL | extern "C" fn trait_method(&self, a: usize, b: usize) -> usize {
| ^ help: if this is intentional, prefix it with an underscore: `_b` | ^ help: if this is intentional, prefix it with an underscore: `_b`

View file

@ -2,7 +2,6 @@
//@ ignore-nvptx64 //@ ignore-nvptx64
//@ ignore-spirv //@ ignore-spirv
#![feature(naked_functions)]
#![feature(asm_unwind, linkage)] #![feature(asm_unwind, linkage)]
#![crate_type = "lib"] #![crate_type = "lib"]

View file

@ -1,107 +1,107 @@
error: the `in` operand cannot be used with `naked_asm!` error: the `in` operand cannot be used with `naked_asm!`
--> $DIR/naked-functions.rs:47:29 --> $DIR/naked-functions.rs:46:29
| |
LL | naked_asm!("/* {0} */", in(reg) a) LL | naked_asm!("/* {0} */", in(reg) a)
| ^^ the `in` operand is not meaningful for global-scoped inline assembly, remove it | ^^ the `in` operand is not meaningful for global-scoped inline assembly, remove it
error: the `in` operand cannot be used with `naked_asm!` error: the `in` operand cannot be used with `naked_asm!`
--> $DIR/naked-functions.rs:68:10 --> $DIR/naked-functions.rs:67:10
| |
LL | in(reg) a, LL | in(reg) a,
| ^^ the `in` operand is not meaningful for global-scoped inline assembly, remove it | ^^ the `in` operand is not meaningful for global-scoped inline assembly, remove it
error: the `noreturn` option cannot be used with `naked_asm!` error: the `noreturn` option cannot be used with `naked_asm!`
--> $DIR/naked-functions.rs:88:28 --> $DIR/naked-functions.rs:87:28
| |
LL | naked_asm!("", options(noreturn)); LL | naked_asm!("", options(noreturn));
| ^^^^^^^^ the `noreturn` option is not meaningful for global-scoped inline assembly | ^^^^^^^^ the `noreturn` option is not meaningful for global-scoped inline assembly
error: the `nomem` option cannot be used with `naked_asm!` error: the `nomem` option cannot be used with `naked_asm!`
--> $DIR/naked-functions.rs:105:28 --> $DIR/naked-functions.rs:104:28
| |
LL | naked_asm!("", options(nomem, preserves_flags)); LL | naked_asm!("", options(nomem, preserves_flags));
| ^^^^^ the `nomem` option is not meaningful for global-scoped inline assembly | ^^^^^ the `nomem` option is not meaningful for global-scoped inline assembly
error: the `preserves_flags` option cannot be used with `naked_asm!` error: the `preserves_flags` option cannot be used with `naked_asm!`
--> $DIR/naked-functions.rs:105:35 --> $DIR/naked-functions.rs:104:35
| |
LL | naked_asm!("", options(nomem, preserves_flags)); LL | naked_asm!("", options(nomem, preserves_flags));
| ^^^^^^^^^^^^^^^ the `preserves_flags` option is not meaningful for global-scoped inline assembly | ^^^^^^^^^^^^^^^ the `preserves_flags` option is not meaningful for global-scoped inline assembly
error: the `readonly` option cannot be used with `naked_asm!` error: the `readonly` option cannot be used with `naked_asm!`
--> $DIR/naked-functions.rs:112:28 --> $DIR/naked-functions.rs:111:28
| |
LL | naked_asm!("", options(readonly, nostack), options(pure)); LL | naked_asm!("", options(readonly, nostack), options(pure));
| ^^^^^^^^ the `readonly` option is not meaningful for global-scoped inline assembly | ^^^^^^^^ the `readonly` option is not meaningful for global-scoped inline assembly
error: the `nostack` option cannot be used with `naked_asm!` error: the `nostack` option cannot be used with `naked_asm!`
--> $DIR/naked-functions.rs:112:38 --> $DIR/naked-functions.rs:111:38
| |
LL | naked_asm!("", options(readonly, nostack), options(pure)); LL | naked_asm!("", options(readonly, nostack), options(pure));
| ^^^^^^^ the `nostack` option is not meaningful for global-scoped inline assembly | ^^^^^^^ the `nostack` option is not meaningful for global-scoped inline assembly
error: the `pure` option cannot be used with `naked_asm!` error: the `pure` option cannot be used with `naked_asm!`
--> $DIR/naked-functions.rs:112:56 --> $DIR/naked-functions.rs:111:56
| |
LL | naked_asm!("", options(readonly, nostack), options(pure)); LL | naked_asm!("", options(readonly, nostack), options(pure));
| ^^^^ the `pure` option is not meaningful for global-scoped inline assembly | ^^^^ the `pure` option is not meaningful for global-scoped inline assembly
error: the `may_unwind` option cannot be used with `naked_asm!` error: the `may_unwind` option cannot be used with `naked_asm!`
--> $DIR/naked-functions.rs:120:28 --> $DIR/naked-functions.rs:119:28
| |
LL | naked_asm!("", options(may_unwind)); LL | naked_asm!("", options(may_unwind));
| ^^^^^^^^^^ the `may_unwind` option is not meaningful for global-scoped inline assembly | ^^^^^^^^^^ the `may_unwind` option is not meaningful for global-scoped inline assembly
error: this is a user specified error error: this is a user specified error
--> $DIR/naked-functions.rs:151:5 --> $DIR/naked-functions.rs:150:5
| |
LL | compile_error!("this is a user specified error") LL | compile_error!("this is a user specified error")
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: this is a user specified error error: this is a user specified error
--> $DIR/naked-functions.rs:157:5 --> $DIR/naked-functions.rs:156:5
| |
LL | compile_error!("this is a user specified error"); LL | compile_error!("this is a user specified error");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: asm template must be a string literal error: asm template must be a string literal
--> $DIR/naked-functions.rs:164:16 --> $DIR/naked-functions.rs:163:16
| |
LL | naked_asm!(invalid_syntax) LL | naked_asm!(invalid_syntax)
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
error[E0787]: the `asm!` macro is not allowed in naked functions error[E0787]: the `asm!` macro is not allowed in naked functions
--> $DIR/naked-functions.rs:13:14 --> $DIR/naked-functions.rs:12:14
| |
LL | unsafe { asm!("", options(raw)) }; LL | unsafe { asm!("", options(raw)) };
| ^^^^^^^^^^^^^^^^^^^^^^ consider using the `naked_asm!` macro instead | ^^^^^^^^^^^^^^^^^^^^^^ consider using the `naked_asm!` macro instead
error: patterns not allowed in naked function parameters error: patterns not allowed in naked function parameters
--> $DIR/naked-functions.rs:25:5 --> $DIR/naked-functions.rs:24:5
| |
LL | mut a: u32, LL | mut a: u32,
| ^^^^^ | ^^^^^
error: patterns not allowed in naked function parameters error: patterns not allowed in naked function parameters
--> $DIR/naked-functions.rs:27:5 --> $DIR/naked-functions.rs:26:5
| |
LL | &b: &i32, LL | &b: &i32,
| ^^ | ^^
error: patterns not allowed in naked function parameters error: patterns not allowed in naked function parameters
--> $DIR/naked-functions.rs:29:6 --> $DIR/naked-functions.rs:28:6
| |
LL | (None | Some(_)): Option<std::ptr::NonNull<u8>>, LL | (None | Some(_)): Option<std::ptr::NonNull<u8>>,
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
error: patterns not allowed in naked function parameters error: patterns not allowed in naked function parameters
--> $DIR/naked-functions.rs:31:5 --> $DIR/naked-functions.rs:30:5
| |
LL | P { x, y }: P, LL | P { x, y }: P,
| ^^^^^^^^^^ | ^^^^^^^^^^
error: referencing function parameters is not allowed in naked functions error: referencing function parameters is not allowed in naked functions
--> $DIR/naked-functions.rs:40:5 --> $DIR/naked-functions.rs:39:5
| |
LL | a + 1 LL | a + 1
| ^ | ^
@ -109,7 +109,7 @@ LL | a + 1
= help: follow the calling convention in asm block to use parameters = help: follow the calling convention in asm block to use parameters
error[E0787]: naked functions must contain a single `naked_asm!` invocation error[E0787]: naked functions must contain a single `naked_asm!` invocation
--> $DIR/naked-functions.rs:38:1 --> $DIR/naked-functions.rs:37:1
| |
LL | pub extern "C" fn inc(a: u32) -> u32 { LL | pub extern "C" fn inc(a: u32) -> u32 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -118,7 +118,7 @@ LL | a + 1
| ----- not allowed in naked functions | ----- not allowed in naked functions
error[E0787]: naked functions must contain a single `naked_asm!` invocation error[E0787]: naked functions must contain a single `naked_asm!` invocation
--> $DIR/naked-functions.rs:52:1 --> $DIR/naked-functions.rs:51:1
| |
LL | pub extern "C" fn inc_closure(a: u32) -> u32 { LL | pub extern "C" fn inc_closure(a: u32) -> u32 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -127,7 +127,7 @@ LL | (|| a + 1)()
| ------------ not allowed in naked functions | ------------ not allowed in naked functions
error[E0787]: naked functions must contain a single `naked_asm!` invocation error[E0787]: naked functions must contain a single `naked_asm!` invocation
--> $DIR/naked-functions.rs:58:1 --> $DIR/naked-functions.rs:57:1
| |
LL | pub extern "C" fn unsupported_operands() { LL | pub extern "C" fn unsupported_operands() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -144,13 +144,13 @@ LL | let mut e = 0usize;
| ------------------- not allowed in naked functions | ------------------- not allowed in naked functions
error[E0787]: naked functions must contain a single `naked_asm!` invocation error[E0787]: naked functions must contain a single `naked_asm!` invocation
--> $DIR/naked-functions.rs:80:1 --> $DIR/naked-functions.rs:79:1
| |
LL | pub extern "C" fn missing_assembly() { LL | pub extern "C" fn missing_assembly() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0787]: naked functions must contain a single `naked_asm!` invocation error[E0787]: naked functions must contain a single `naked_asm!` invocation
--> $DIR/naked-functions.rs:85:1 --> $DIR/naked-functions.rs:84:1
| |
LL | pub extern "C" fn too_many_asm_blocks() { LL | pub extern "C" fn too_many_asm_blocks() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -159,7 +159,7 @@ LL | naked_asm!("");
| -------------- multiple `naked_asm!` invocations are not allowed in naked functions | -------------- multiple `naked_asm!` invocations are not allowed in naked functions
error: referencing function parameters is not allowed in naked functions error: referencing function parameters is not allowed in naked functions
--> $DIR/naked-functions.rs:97:11 --> $DIR/naked-functions.rs:96:11
| |
LL | *&y LL | *&y
| ^ | ^
@ -167,7 +167,7 @@ LL | *&y
= help: follow the calling convention in asm block to use parameters = help: follow the calling convention in asm block to use parameters
error[E0787]: naked functions must contain a single `naked_asm!` invocation error[E0787]: naked functions must contain a single `naked_asm!` invocation
--> $DIR/naked-functions.rs:95:5 --> $DIR/naked-functions.rs:94:5
| |
LL | pub extern "C" fn inner(y: usize) -> usize { LL | pub extern "C" fn inner(y: usize) -> usize {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View file

@ -1,7 +1,6 @@
// Checks that #[unsafe(naked)] attribute can be placed on function definitions only. // Checks that the #[unsafe(naked)] attribute can be placed on function definitions only.
// //
//@ needs-asm-support //@ needs-asm-support
#![feature(naked_functions)]
#![unsafe(naked)] //~ ERROR should be applied to a function definition #![unsafe(naked)] //~ ERROR should be applied to a function definition
use std::arch::naked_asm; use std::arch::naked_asm;
@ -14,6 +13,7 @@ extern "C" {
#[unsafe(naked)] //~ ERROR should be applied to a function definition #[unsafe(naked)] //~ ERROR should be applied to a function definition
#[repr(C)] #[repr(C)]
struct S { struct S {
#[unsafe(naked)] //~ ERROR should be applied to a function definition
a: u32, a: u32,
b: u32, b: u32,
} }

View file

@ -1,15 +1,24 @@
error: attribute should be applied to a function definition error: attribute should be applied to a function definition
--> $DIR/naked-invalid-attr.rs:14:1 --> $DIR/naked-invalid-attr.rs:13:1
| |
LL | #[unsafe(naked)] LL | #[unsafe(naked)]
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
LL | #[repr(C)] LL | #[repr(C)]
LL | / struct S { LL | / struct S {
LL | | #[unsafe(naked)]
LL | | a: u32, LL | | a: u32,
LL | | b: u32, LL | | b: u32,
LL | | } LL | | }
| |_- not a function definition | |_- not a function definition
error: attribute should be applied to a function definition
--> $DIR/naked-invalid-attr.rs:16:5
|
LL | #[unsafe(naked)]
| ^^^^^^^^^^^^^^^^
LL | a: u32,
| ------ not a function definition
error: attribute should be applied to a function definition error: attribute should be applied to a function definition
--> $DIR/naked-invalid-attr.rs:51:5 --> $DIR/naked-invalid-attr.rs:51:5
| |
@ -27,7 +36,7 @@ LL | extern "C" fn invoke(&self);
| ---------------------------- not a function definition | ---------------------------- not a function definition
error: attribute should be applied to a function definition error: attribute should be applied to a function definition
--> $DIR/naked-invalid-attr.rs:10:5 --> $DIR/naked-invalid-attr.rs:9:5
| |
LL | #[unsafe(naked)] LL | #[unsafe(naked)]
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
@ -35,10 +44,10 @@ LL | fn f();
| ------- not a function definition | ------- not a function definition
error: attribute should be applied to a function definition error: attribute should be applied to a function definition
--> $DIR/naked-invalid-attr.rs:5:1 --> $DIR/naked-invalid-attr.rs:4:1
| |
LL | #![unsafe(naked)] LL | #![unsafe(naked)]
| ^^^^^^^^^^^^^^^^^ cannot be applied to crates | ^^^^^^^^^^^^^^^^^ cannot be applied to crates
error: aborting due to 5 previous errors error: aborting due to 6 previous errors

View file

@ -1,5 +1,4 @@
//@ needs-asm-support //@ needs-asm-support
#![feature(naked_functions)]
#![feature(fn_align)] #![feature(fn_align)]
#![crate_type = "lib"] #![crate_type = "lib"]
use std::arch::naked_asm; use std::arch::naked_asm;

View file

@ -1,5 +1,5 @@
error[E0517]: attribute should be applied to a struct, enum, or union error[E0517]: attribute should be applied to a struct, enum, or union
--> $DIR/naked-with-invalid-repr-attr.rs:7:8 --> $DIR/naked-with-invalid-repr-attr.rs:6:8
| |
LL | #[repr(C)] LL | #[repr(C)]
| ^ | ^
@ -11,7 +11,7 @@ LL | | }
| |_- not a struct, enum, or union | |_- not a struct, enum, or union
error[E0517]: attribute should be applied to a struct, enum, or union error[E0517]: attribute should be applied to a struct, enum, or union
--> $DIR/naked-with-invalid-repr-attr.rs:15:8 --> $DIR/naked-with-invalid-repr-attr.rs:14:8
| |
LL | #[repr(transparent)] LL | #[repr(transparent)]
| ^^^^^^^^^^^ | ^^^^^^^^^^^
@ -23,7 +23,7 @@ LL | | }
| |_- not a struct, enum, or union | |_- not a struct, enum, or union
error[E0517]: attribute should be applied to a struct, enum, or union error[E0517]: attribute should be applied to a struct, enum, or union
--> $DIR/naked-with-invalid-repr-attr.rs:23:19 --> $DIR/naked-with-invalid-repr-attr.rs:22:19
| |
LL | #[repr(align(16), C)] LL | #[repr(align(16), C)]
| ^ | ^
@ -35,7 +35,7 @@ LL | | }
| |_- not a struct, enum, or union | |_- not a struct, enum, or union
error[E0517]: attribute should be applied to a struct, enum, or union error[E0517]: attribute should be applied to a struct, enum, or union
--> $DIR/naked-with-invalid-repr-attr.rs:32:8 --> $DIR/naked-with-invalid-repr-attr.rs:31:8
| |
LL | #[repr(C, packed)] LL | #[repr(C, packed)]
| ^ | ^
@ -48,7 +48,7 @@ LL | | }
| |_- not a struct, enum, or union | |_- not a struct, enum, or union
error[E0517]: attribute should be applied to a struct or union error[E0517]: attribute should be applied to a struct or union
--> $DIR/naked-with-invalid-repr-attr.rs:32:11 --> $DIR/naked-with-invalid-repr-attr.rs:31:11
| |
LL | #[repr(C, packed)] LL | #[repr(C, packed)]
| ^^^^^^ | ^^^^^^
@ -61,7 +61,7 @@ LL | | }
| |_- not a struct or union | |_- not a struct or union
error[E0517]: attribute should be applied to an enum error[E0517]: attribute should be applied to an enum
--> $DIR/naked-with-invalid-repr-attr.rs:42:8 --> $DIR/naked-with-invalid-repr-attr.rs:41:8
| |
LL | #[repr(u8)] LL | #[repr(u8)]
| ^^ | ^^

View file

@ -10,8 +10,6 @@
// which causes less readable LLVM errors and in the worst cases causes ICEs // which causes less readable LLVM errors and in the worst cases causes ICEs
// or segfaults based on system dependent behavior and codegen flags. // or segfaults based on system dependent behavior and codegen flags.
#![feature(naked_functions)]
use std::arch::{asm, global_asm, naked_asm}; use std::arch::{asm, global_asm, naked_asm};
#[no_mangle] #[no_mangle]

View file

@ -1,5 +1,5 @@
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:23:15 --> $DIR/named-asm-labels.rs:21:15
| |
LL | asm!("bar: nop"); LL | asm!("bar: nop");
| ^^^ | ^^^
@ -9,7 +9,7 @@ LL | asm!("bar: nop");
= note: `#[deny(named_asm_labels)]` on by default = note: `#[deny(named_asm_labels)]` on by default
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:26:15 --> $DIR/named-asm-labels.rs:24:15
| |
LL | asm!("abcd:"); LL | asm!("abcd:");
| ^^^^ | ^^^^
@ -18,7 +18,7 @@ LL | asm!("abcd:");
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:29:15 --> $DIR/named-asm-labels.rs:27:15
| |
LL | asm!("foo: bar1: nop"); LL | asm!("foo: bar1: nop");
| ^^^ | ^^^
@ -27,7 +27,7 @@ LL | asm!("foo: bar1: nop");
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:29:20 --> $DIR/named-asm-labels.rs:27:20
| |
LL | asm!("foo: bar1: nop"); LL | asm!("foo: bar1: nop");
| ^^^^ | ^^^^
@ -36,7 +36,7 @@ LL | asm!("foo: bar1: nop");
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:34:15 --> $DIR/named-asm-labels.rs:32:15
| |
LL | asm!("foo1: nop", "nop"); LL | asm!("foo1: nop", "nop");
| ^^^^ | ^^^^
@ -45,7 +45,7 @@ LL | asm!("foo1: nop", "nop");
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:35:15 --> $DIR/named-asm-labels.rs:33:15
| |
LL | asm!("foo2: foo3: nop", "nop"); LL | asm!("foo2: foo3: nop", "nop");
| ^^^^ | ^^^^
@ -54,7 +54,7 @@ LL | asm!("foo2: foo3: nop", "nop");
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:35:21 --> $DIR/named-asm-labels.rs:33:21
| |
LL | asm!("foo2: foo3: nop", "nop"); LL | asm!("foo2: foo3: nop", "nop");
| ^^^^ | ^^^^
@ -63,7 +63,7 @@ LL | asm!("foo2: foo3: nop", "nop");
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:38:22 --> $DIR/named-asm-labels.rs:36:22
| |
LL | asm!("nop", "foo4: nop"); LL | asm!("nop", "foo4: nop");
| ^^^^ | ^^^^
@ -72,7 +72,7 @@ LL | asm!("nop", "foo4: nop");
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:39:15 --> $DIR/named-asm-labels.rs:37:15
| |
LL | asm!("foo5: nop", "foo6: nop"); LL | asm!("foo5: nop", "foo6: nop");
| ^^^^ | ^^^^
@ -81,7 +81,7 @@ LL | asm!("foo5: nop", "foo6: nop");
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:39:28 --> $DIR/named-asm-labels.rs:37:28
| |
LL | asm!("foo5: nop", "foo6: nop"); LL | asm!("foo5: nop", "foo6: nop");
| ^^^^ | ^^^^
@ -90,7 +90,7 @@ LL | asm!("foo5: nop", "foo6: nop");
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:44:15 --> $DIR/named-asm-labels.rs:42:15
| |
LL | asm!("foo7: nop; foo8: nop"); LL | asm!("foo7: nop; foo8: nop");
| ^^^^ | ^^^^
@ -99,7 +99,7 @@ LL | asm!("foo7: nop; foo8: nop");
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:44:26 --> $DIR/named-asm-labels.rs:42:26
| |
LL | asm!("foo7: nop; foo8: nop"); LL | asm!("foo7: nop; foo8: nop");
| ^^^^ | ^^^^
@ -108,7 +108,7 @@ LL | asm!("foo7: nop; foo8: nop");
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:47:15 --> $DIR/named-asm-labels.rs:45:15
| |
LL | asm!("foo9: nop; nop"); LL | asm!("foo9: nop; nop");
| ^^^^ | ^^^^
@ -117,7 +117,7 @@ LL | asm!("foo9: nop; nop");
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:48:20 --> $DIR/named-asm-labels.rs:46:20
| |
LL | asm!("nop; foo10: nop"); LL | asm!("nop; foo10: nop");
| ^^^^^ | ^^^^^
@ -126,7 +126,7 @@ LL | asm!("nop; foo10: nop");
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:51:15 --> $DIR/named-asm-labels.rs:49:15
| |
LL | asm!("bar2: nop\n bar3: nop"); LL | asm!("bar2: nop\n bar3: nop");
| ^^^^ | ^^^^
@ -135,7 +135,7 @@ LL | asm!("bar2: nop\n bar3: nop");
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:51:27 --> $DIR/named-asm-labels.rs:49:27
| |
LL | asm!("bar2: nop\n bar3: nop"); LL | asm!("bar2: nop\n bar3: nop");
| ^^^^ | ^^^^
@ -144,7 +144,7 @@ LL | asm!("bar2: nop\n bar3: nop");
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:54:15 --> $DIR/named-asm-labels.rs:52:15
| |
LL | asm!("bar4: nop\n nop"); LL | asm!("bar4: nop\n nop");
| ^^^^ | ^^^^
@ -153,7 +153,7 @@ LL | asm!("bar4: nop\n nop");
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:55:21 --> $DIR/named-asm-labels.rs:53:21
| |
LL | asm!("nop\n bar5: nop"); LL | asm!("nop\n bar5: nop");
| ^^^^ | ^^^^
@ -162,7 +162,7 @@ LL | asm!("nop\n bar5: nop");
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:56:21 --> $DIR/named-asm-labels.rs:54:21
| |
LL | asm!("nop\n bar6: bar7: nop"); LL | asm!("nop\n bar6: bar7: nop");
| ^^^^ | ^^^^
@ -171,7 +171,7 @@ LL | asm!("nop\n bar6: bar7: nop");
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:56:27 --> $DIR/named-asm-labels.rs:54:27
| |
LL | asm!("nop\n bar6: bar7: nop"); LL | asm!("nop\n bar6: bar7: nop");
| ^^^^ | ^^^^
@ -180,7 +180,7 @@ LL | asm!("nop\n bar6: bar7: nop");
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:63:13 --> $DIR/named-asm-labels.rs:61:13
| |
LL | blah2: nop LL | blah2: nop
| ^^^^^ | ^^^^^
@ -189,7 +189,7 @@ LL | blah2: nop
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:64:13 --> $DIR/named-asm-labels.rs:62:13
| |
LL | blah3: nop LL | blah3: nop
| ^^^^^ | ^^^^^
@ -198,7 +198,7 @@ LL | blah3: nop
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:73:19 --> $DIR/named-asm-labels.rs:71:19
| |
LL | nop ; blah4: nop LL | nop ; blah4: nop
| ^^^^^ | ^^^^^
@ -207,7 +207,7 @@ LL | nop ; blah4: nop
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:87:15 --> $DIR/named-asm-labels.rs:85:15
| |
LL | asm!("blah1: 2bar: nop"); LL | asm!("blah1: 2bar: nop");
| ^^^^^ | ^^^^^
@ -216,7 +216,7 @@ LL | asm!("blah1: 2bar: nop");
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:90:15 --> $DIR/named-asm-labels.rs:88:15
| |
LL | asm!("def: def: nop"); LL | asm!("def: def: nop");
| ^^^ | ^^^
@ -225,7 +225,7 @@ LL | asm!("def: def: nop");
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:90:15 --> $DIR/named-asm-labels.rs:88:15
| |
LL | asm!("def: def: nop"); LL | asm!("def: def: nop");
| ^^^ | ^^^
@ -235,7 +235,7 @@ LL | asm!("def: def: nop");
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:93:15 --> $DIR/named-asm-labels.rs:91:15
| |
LL | asm!("def: nop\ndef: nop"); LL | asm!("def: nop\ndef: nop");
| ^^^ | ^^^
@ -244,7 +244,7 @@ LL | asm!("def: nop\ndef: nop");
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:93:15 --> $DIR/named-asm-labels.rs:91:15
| |
LL | asm!("def: nop\ndef: nop"); LL | asm!("def: nop\ndef: nop");
| ^^^ | ^^^
@ -254,7 +254,7 @@ LL | asm!("def: nop\ndef: nop");
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:96:15 --> $DIR/named-asm-labels.rs:94:15
| |
LL | asm!("def: nop; def: nop"); LL | asm!("def: nop; def: nop");
| ^^^ | ^^^
@ -263,7 +263,7 @@ LL | asm!("def: nop; def: nop");
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:96:15 --> $DIR/named-asm-labels.rs:94:15
| |
LL | asm!("def: nop; def: nop"); LL | asm!("def: nop; def: nop");
| ^^^ | ^^^
@ -273,7 +273,7 @@ LL | asm!("def: nop; def: nop");
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:106:15 --> $DIR/named-asm-labels.rs:104:15
| |
LL | asm!("fooo\u{003A} nop"); LL | asm!("fooo\u{003A} nop");
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
@ -282,7 +282,7 @@ LL | asm!("fooo\u{003A} nop");
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:107:15 --> $DIR/named-asm-labels.rs:105:15
| |
LL | asm!("foooo\x3A nop"); LL | asm!("foooo\x3A nop");
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
@ -291,7 +291,7 @@ LL | asm!("foooo\x3A nop");
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:110:15 --> $DIR/named-asm-labels.rs:108:15
| |
LL | asm!("fooooo:\u{000A} nop"); LL | asm!("fooooo:\u{000A} nop");
| ^^^^^^ | ^^^^^^
@ -300,7 +300,7 @@ LL | asm!("fooooo:\u{000A} nop");
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:111:15 --> $DIR/named-asm-labels.rs:109:15
| |
LL | asm!("foooooo:\x0A nop"); LL | asm!("foooooo:\x0A nop");
| ^^^^^^^ | ^^^^^^^
@ -309,7 +309,7 @@ LL | asm!("foooooo:\x0A nop");
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:115:14 --> $DIR/named-asm-labels.rs:113:14
| |
LL | asm!("\x41\x42\x43\x3A\x20\x6E\x6F\x70"); LL | asm!("\x41\x42\x43\x3A\x20\x6E\x6F\x70");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -319,7 +319,7 @@ LL | asm!("\x41\x42\x43\x3A\x20\x6E\x6F\x70");
= note: the label may be declared in the expansion of a macro = note: the label may be declared in the expansion of a macro
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:123:13 --> $DIR/named-asm-labels.rs:121:13
| |
LL | ab: nop // ab: does foo LL | ab: nop // ab: does foo
| ^^ | ^^
@ -328,7 +328,7 @@ LL | ab: nop // ab: does foo
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:144:19 --> $DIR/named-asm-labels.rs:142:19
| |
LL | asm!("test_{}: nop", in(reg) 10); LL | asm!("test_{}: nop", in(reg) 10);
| ^^^^^^^ | ^^^^^^^
@ -338,7 +338,7 @@ LL | asm!("test_{}: nop", in(reg) 10);
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:146:15 --> $DIR/named-asm-labels.rs:144:15
| |
LL | asm!("test_{}: nop", const 10); LL | asm!("test_{}: nop", const 10);
| ^^^^^^^ | ^^^^^^^
@ -348,7 +348,7 @@ LL | asm!("test_{}: nop", const 10);
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:147:15 --> $DIR/named-asm-labels.rs:145:15
| |
LL | asm!("test_{}: nop", sym main); LL | asm!("test_{}: nop", sym main);
| ^^^^^^^ | ^^^^^^^
@ -358,7 +358,7 @@ LL | asm!("test_{}: nop", sym main);
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:148:15 --> $DIR/named-asm-labels.rs:146:15
| |
LL | asm!("{}_test: nop", const 10); LL | asm!("{}_test: nop", const 10);
| ^^^^^^^ | ^^^^^^^
@ -368,7 +368,7 @@ LL | asm!("{}_test: nop", const 10);
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:149:15 --> $DIR/named-asm-labels.rs:147:15
| |
LL | asm!("test_{}_test: nop", const 10); LL | asm!("test_{}_test: nop", const 10);
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
@ -378,7 +378,7 @@ LL | asm!("test_{}_test: nop", const 10);
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:150:15 --> $DIR/named-asm-labels.rs:148:15
| |
LL | asm!("{}: nop", const 10); LL | asm!("{}: nop", const 10);
| ^^ | ^^
@ -388,7 +388,7 @@ LL | asm!("{}: nop", const 10);
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:152:15 --> $DIR/named-asm-labels.rs:150:15
| |
LL | asm!("{uwu}: nop", uwu = const 10); LL | asm!("{uwu}: nop", uwu = const 10);
| ^^^^^ | ^^^^^
@ -398,7 +398,7 @@ LL | asm!("{uwu}: nop", uwu = const 10);
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:153:15 --> $DIR/named-asm-labels.rs:151:15
| |
LL | asm!("{0}: nop", const 10); LL | asm!("{0}: nop", const 10);
| ^^^ | ^^^
@ -408,7 +408,7 @@ LL | asm!("{0}: nop", const 10);
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:154:15 --> $DIR/named-asm-labels.rs:152:15
| |
LL | asm!("{1}: nop", "/* {0} */", const 10, const 20); LL | asm!("{1}: nop", "/* {0} */", const 10, const 20);
| ^^^ | ^^^
@ -418,7 +418,7 @@ LL | asm!("{1}: nop", "/* {0} */", const 10, const 20);
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:157:14 --> $DIR/named-asm-labels.rs:155:14
| |
LL | asm!(include_str!("named-asm-labels.s")); LL | asm!(include_str!("named-asm-labels.s"));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -428,7 +428,7 @@ LL | asm!(include_str!("named-asm-labels.s"));
= note: the label may be declared in the expansion of a macro = note: the label may be declared in the expansion of a macro
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:157:14 --> $DIR/named-asm-labels.rs:155:14
| |
LL | asm!(include_str!("named-asm-labels.s")); LL | asm!(include_str!("named-asm-labels.s"));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -439,7 +439,7 @@ LL | asm!(include_str!("named-asm-labels.s"));
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:157:14 --> $DIR/named-asm-labels.rs:155:14
| |
LL | asm!(include_str!("named-asm-labels.s")); LL | asm!(include_str!("named-asm-labels.s"));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -450,7 +450,7 @@ LL | asm!(include_str!("named-asm-labels.s"));
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:157:14 --> $DIR/named-asm-labels.rs:155:14
| |
LL | asm!(include_str!("named-asm-labels.s")); LL | asm!(include_str!("named-asm-labels.s"));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -461,7 +461,7 @@ LL | asm!(include_str!("named-asm-labels.s"));
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: avoid using named labels in inline assembly warning: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:171:19 --> $DIR/named-asm-labels.rs:169:19
| |
LL | asm!("warned: nop"); LL | asm!("warned: nop");
| ^^^^^^ | ^^^^^^
@ -469,13 +469,13 @@ LL | asm!("warned: nop");
= help: only local labels of the form `<number>:` should be used in inline asm = help: only local labels of the form `<number>:` should be used in inline asm
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
note: the lint level is defined here note: the lint level is defined here
--> $DIR/named-asm-labels.rs:169:16 --> $DIR/named-asm-labels.rs:167:16
| |
LL | #[warn(named_asm_labels)] LL | #[warn(named_asm_labels)]
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:180:17 --> $DIR/named-asm-labels.rs:178:17
| |
LL | naked_asm!(".Lfoo: mov rax, {}; ret;", "nop", const 1) LL | naked_asm!(".Lfoo: mov rax, {}; ret;", "nop", const 1)
| ^^^^^ | ^^^^^
@ -484,7 +484,7 @@ LL | naked_asm!(".Lfoo: mov rax, {}; ret;", "nop", const 1)
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:187:20 --> $DIR/named-asm-labels.rs:185:20
| |
LL | unsafe { asm!(".Lbar: mov rax, {}; ret;", "nop", const 1, options(noreturn)) } LL | unsafe { asm!(".Lbar: mov rax, {}; ret;", "nop", const 1, options(noreturn)) }
| ^^^^^ | ^^^^^
@ -493,7 +493,7 @@ LL | unsafe { asm!(".Lbar: mov rax, {}; ret;", "nop", const 1, options(noret
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:195:17 --> $DIR/named-asm-labels.rs:193:17
| |
LL | naked_asm!(".Laaa: nop; ret;") LL | naked_asm!(".Laaa: nop; ret;")
| ^^^^^ | ^^^^^
@ -502,7 +502,7 @@ LL | naked_asm!(".Laaa: nop; ret;")
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:205:21 --> $DIR/named-asm-labels.rs:203:21
| |
LL | naked_asm!(".Lbbb: nop; ret;") LL | naked_asm!(".Lbbb: nop; ret;")
| ^^^^^ | ^^^^^
@ -511,7 +511,7 @@ LL | naked_asm!(".Lbbb: nop; ret;")
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:214:15 --> $DIR/named-asm-labels.rs:212:15
| |
LL | asm!("closure1: nop"); LL | asm!("closure1: nop");
| ^^^^^^^^ | ^^^^^^^^
@ -520,7 +520,7 @@ LL | asm!("closure1: nop");
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:218:15 --> $DIR/named-asm-labels.rs:216:15
| |
LL | asm!("closure2: nop"); LL | asm!("closure2: nop");
| ^^^^^^^^ | ^^^^^^^^
@ -529,7 +529,7 @@ LL | asm!("closure2: nop");
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
error: avoid using named labels in inline assembly error: avoid using named labels in inline assembly
--> $DIR/named-asm-labels.rs:228:19 --> $DIR/named-asm-labels.rs:226:19
| |
LL | asm!("closure3: nop"); LL | asm!("closure3: nop");
| ^^^^^^^^ | ^^^^^^^^

View file

@ -1,7 +1,6 @@
//@ run-pass //@ run-pass
//@ needs-asm-support //@ needs-asm-support
#![feature(naked_functions)]
#![allow(dead_code)] #![allow(dead_code)]
#[cfg(any(target_arch = "x86_64", target_arch = "x86"))] #[cfg(any(target_arch = "x86_64", target_arch = "x86"))]

View file

@ -1,13 +0,0 @@
//@ run-pass
#![allow(dead_code)]
#[derive(Debug)]
struct Pair<T, U> { a: T, b: U }
struct Triple { x: isize, y: isize, z: isize }
fn f<T,U>(x: T, y: U) -> Pair<T, U> { return Pair {a: x, b: y}; }
pub fn main() {
println!("{}", f(Triple {x: 3, y: 4, z: 5}, 4).a.x);
println!("{}", f(5, 6).a);
}

View file

@ -1,3 +1,5 @@
//! Smoke test for overloaded compound assignments cross-crate.
//@ run-pass //@ run-pass
//@ aux-build:augmented_assignments.rs //@ aux-build:augmented_assignments.rs

View file

@ -1,3 +1,6 @@
//! Check that overloaded compound assignment operators respect usual borrowck rules and emit
//! reasonable diagnostics.
use std::ops::AddAssign; use std::ops::AddAssign;
#[derive(Clone)] #[derive(Clone)]

View file

@ -1,5 +1,5 @@
error[E0505]: cannot move out of `x` because it is borrowed error[E0505]: cannot move out of `x` because it is borrowed
--> $DIR/augmented-assignments.rs:17:5 --> $DIR/augmented-assignments.rs:20:5
| |
LL | let mut x = Int(1); LL | let mut x = Int(1);
| ----- binding `x` declared here | ----- binding `x` declared here
@ -10,7 +10,7 @@ LL | x;
| ^ move out of `x` occurs here | ^ move out of `x` occurs here
error[E0596]: cannot borrow `y` as mutable, as it is not declared as mutable error[E0596]: cannot borrow `y` as mutable, as it is not declared as mutable
--> $DIR/augmented-assignments.rs:24:5 --> $DIR/augmented-assignments.rs:27:5
| |
LL | y LL | y
| ^ cannot borrow as mutable | ^ cannot borrow as mutable

View file

@ -1,20 +0,0 @@
//@ needs-asm-support
use std::arch::naked_asm;
//~^ ERROR use of unstable library feature `naked_functions`
#[naked] //~ ERROR unsafe attribute used without unsafe
//~^ ERROR the `#[naked]` attribute is an experimental feature
extern "C" fn naked() {
naked_asm!("")
//~^ ERROR use of unstable library feature `naked_functions`
}
#[naked] //~ ERROR unsafe attribute used without unsafe
//~^ ERROR the `#[naked]` attribute is an experimental feature
extern "C" fn naked_2() -> isize {
naked_asm!("")
//~^ ERROR use of unstable library feature `naked_functions`
}
fn main() {}

View file

@ -1,75 +0,0 @@
error[E0658]: use of unstable library feature `naked_functions`
--> $DIR/feature-gate-naked_functions.rs:9:5
|
LL | naked_asm!("")
| ^^^^^^^^^
|
= note: see issue #90957 <https://github.com/rust-lang/rust/issues/90957> for more information
= help: add `#![feature(naked_functions)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: use of unstable library feature `naked_functions`
--> $DIR/feature-gate-naked_functions.rs:16:5
|
LL | naked_asm!("")
| ^^^^^^^^^
|
= note: see issue #90957 <https://github.com/rust-lang/rust/issues/90957> for more information
= help: add `#![feature(naked_functions)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error: unsafe attribute used without unsafe
--> $DIR/feature-gate-naked_functions.rs:6:3
|
LL | #[naked]
| ^^^^^ usage of unsafe attribute
|
help: wrap the attribute in `unsafe(...)`
|
LL | #[unsafe(naked)]
| +++++++ +
error: unsafe attribute used without unsafe
--> $DIR/feature-gate-naked_functions.rs:13:3
|
LL | #[naked]
| ^^^^^ usage of unsafe attribute
|
help: wrap the attribute in `unsafe(...)`
|
LL | #[unsafe(naked)]
| +++++++ +
error[E0658]: the `#[naked]` attribute is an experimental feature
--> $DIR/feature-gate-naked_functions.rs:6:1
|
LL | #[naked]
| ^^^^^^^^
|
= note: see issue #90957 <https://github.com/rust-lang/rust/issues/90957> for more information
= help: add `#![feature(naked_functions)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: the `#[naked]` attribute is an experimental feature
--> $DIR/feature-gate-naked_functions.rs:13:1
|
LL | #[naked]
| ^^^^^^^^
|
= note: see issue #90957 <https://github.com/rust-lang/rust/issues/90957> for more information
= help: add `#![feature(naked_functions)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: use of unstable library feature `naked_functions`
--> $DIR/feature-gate-naked_functions.rs:3:5
|
LL | use std::arch::naked_asm;
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #90957 <https://github.com/rust-lang/rust/issues/90957> for more information
= help: add `#![feature(naked_functions)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error: aborting due to 7 previous errors
For more information about this error, try `rustc --explain E0658`.

View file

@ -1,7 +1,7 @@
//@ needs-asm-support //@ needs-asm-support
//@ only-x86_64 //@ only-x86_64
#![feature(naked_functions, rust_cold_cc)] #![feature(rust_cold_cc)]
use std::arch::naked_asm; use std::arch::naked_asm;

View file

@ -1,8 +1,6 @@
//@ needs-asm-support //@ needs-asm-support
//@ only-x86_64 //@ only-x86_64
#![feature(naked_functions)]
use std::arch::naked_asm; use std::arch::naked_asm;
#[unsafe(naked)] #[unsafe(naked)]

View file

@ -1,5 +1,5 @@
error[E0658]: `#[target_feature(/* ... */)]` is currently unstable on `#[naked]` functions error[E0658]: `#[target_feature(/* ... */)]` is currently unstable on `#[naked]` functions
--> $DIR/feature-gate-naked_functions_target_feature.rs:9:1 --> $DIR/feature-gate-naked_functions_target_feature.rs:7:1
| |
LL | #[target_feature(enable = "avx2")] LL | #[target_feature(enable = "avx2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View file

@ -0,0 +1,28 @@
//! Check that type parameters in generic function arg position and in "nested" return type position
//! can be inferred on an invocation of the generic function.
//!
//! See <https://github.com/rust-lang/rust/issues/45>.
//@ run-pass
#![allow(dead_code)]
#[derive(Debug)]
struct Pair<T, U> {
a: T,
b: U,
}
struct Triple {
x: isize,
y: isize,
z: isize,
}
fn f<T, U>(x: T, y: U) -> Pair<T, U> {
return Pair { a: x, b: y };
}
pub fn main() {
println!("{}", f(Triple {x: 3, y: 4, z: 5}, 4).a.x);
println!("{}", f(5, 6).a);
}

View file

@ -2,9 +2,7 @@
//! because `#[inline]` is ignored for such functions. //! because `#[inline]` is ignored for such functions.
#![crate_type = "lib"] #![crate_type = "lib"]
#![feature(linkage)] #![feature(linkage)]
#![feature(naked_functions)]
#![deny(unused_attributes)] #![deny(unused_attributes)]
#[inline] #[inline]

View file

@ -1,18 +1,18 @@
error: `#[inline]` is ignored on externally exported functions error: `#[inline]` is ignored on externally exported functions
--> $DIR/inline-exported.rs:10:1 --> $DIR/inline-exported.rs:8:1
| |
LL | #[inline] LL | #[inline]
| ^^^^^^^^^ | ^^^^^^^^^
| |
= help: externally exported functions are functions with `#[no_mangle]`, `#[export_name]`, or `#[linkage]` = help: externally exported functions are functions with `#[no_mangle]`, `#[export_name]`, or `#[linkage]`
note: the lint level is defined here note: the lint level is defined here
--> $DIR/inline-exported.rs:8:9 --> $DIR/inline-exported.rs:6:9
| |
LL | #![deny(unused_attributes)] LL | #![deny(unused_attributes)]
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
error: `#[inline]` is ignored on externally exported functions error: `#[inline]` is ignored on externally exported functions
--> $DIR/inline-exported.rs:15:1 --> $DIR/inline-exported.rs:13:1
| |
LL | #[inline] LL | #[inline]
| ^^^^^^^^^ | ^^^^^^^^^
@ -20,7 +20,7 @@ LL | #[inline]
= help: externally exported functions are functions with `#[no_mangle]`, `#[export_name]`, or `#[linkage]` = help: externally exported functions are functions with `#[no_mangle]`, `#[export_name]`, or `#[linkage]`
error: `#[inline]` is ignored on externally exported functions error: `#[inline]` is ignored on externally exported functions
--> $DIR/inline-exported.rs:20:1 --> $DIR/inline-exported.rs:18:1
| |
LL | #[inline] LL | #[inline]
| ^^^^^^^^^ | ^^^^^^^^^

View file

@ -1,5 +1,4 @@
//@ needs-asm-support //@ needs-asm-support
#![feature(naked_functions)]
use std::arch::naked_asm; use std::arch::naked_asm;

View file

@ -1,5 +1,5 @@
error[E0736]: attribute incompatible with `#[unsafe(naked)]` error[E0736]: attribute incompatible with `#[unsafe(naked)]`
--> $DIR/error-with-naked.rs:6:1 --> $DIR/error-with-naked.rs:5:1
| |
LL | #[track_caller] LL | #[track_caller]
| ^^^^^^^^^^^^^^^ the `track_caller` attribute is incompatible with `#[unsafe(naked)]` | ^^^^^^^^^^^^^^^ the `track_caller` attribute is incompatible with `#[unsafe(naked)]`
@ -8,7 +8,7 @@ LL | #[unsafe(naked)]
| ---------------- function marked with `#[unsafe(naked)]` here | ---------------- function marked with `#[unsafe(naked)]` here
error[E0736]: attribute incompatible with `#[unsafe(naked)]` error[E0736]: attribute incompatible with `#[unsafe(naked)]`
--> $DIR/error-with-naked.rs:18:5 --> $DIR/error-with-naked.rs:17:5
| |
LL | #[track_caller] LL | #[track_caller]
| ^^^^^^^^^^^^^^^ the `track_caller` attribute is incompatible with `#[unsafe(naked)]` | ^^^^^^^^^^^^^^^ the `track_caller` attribute is incompatible with `#[unsafe(naked)]`
@ -17,13 +17,13 @@ LL | #[unsafe(naked)]
| ---------------- function marked with `#[unsafe(naked)]` here | ---------------- function marked with `#[unsafe(naked)]` here
error[E0737]: `#[track_caller]` requires Rust ABI error[E0737]: `#[track_caller]` requires Rust ABI
--> $DIR/error-with-naked.rs:6:1 --> $DIR/error-with-naked.rs:5:1
| |
LL | #[track_caller] LL | #[track_caller]
| ^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^
error[E0737]: `#[track_caller]` requires Rust ABI error[E0737]: `#[track_caller]` requires Rust ABI
--> $DIR/error-with-naked.rs:18:5 --> $DIR/error-with-naked.rs:17:5
| |
LL | #[track_caller] LL | #[track_caller]
| ^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^

View file

@ -0,0 +1,4 @@
error: target requires explicitly specifying a cpu with `-C target-cpu`
error: aborting due to 1 previous error

View file

@ -0,0 +1,37 @@
//! Check that certain target *requires* the user to specify a target CPU via `-C target-cpu`.
//@ revisions: amdgcn_nocpu amdgcn_cpu
//@[amdgcn_nocpu] compile-flags: --target=amdgcn-amd-amdhsa
//@[amdgcn_nocpu] needs-llvm-components: amdgpu
//@[amdgcn_nocpu] build-fail
//@[amdgcn_cpu] compile-flags: --target=amdgcn-amd-amdhsa
//@[amdgcn_cpu] needs-llvm-components: amdgpu
//@[amdgcn_cpu] compile-flags: -Ctarget-cpu=gfx900
//@[amdgcn_cpu] build-pass
//@ revisions: avr_nocpu avr_cpu
//@[avr_nocpu] compile-flags: --target=avr-none
//@[avr_nocpu] needs-llvm-components: avr
//@[avr_nocpu] build-fail
//@[avr_cpu] compile-flags: --target=avr-none
//@[avr_cpu] needs-llvm-components: avr
//@[avr_cpu] compile-flags: -Ctarget-cpu=atmega328p
//@[avr_cpu] build-pass
#![crate_type = "rlib"]
// FIXME(#140038): this can't use `minicore` yet because `minicore` doesn't currently propagate the
// `-C target-cpu` for targets that *require* a `target-cpu` being specified.
#![feature(no_core, lang_items)]
#![no_core]
#[lang="sized"]
trait Sized {}
pub fn foo() {}
//[amdgcn_nocpu,avr_nocpu]~? ERROR target requires explicitly specifying a cpu with `-C target-cpu`