Auto merge of #154326 - JonathanBrouwer:rollup-MflIdQW, r=JonathanBrouwer

Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#152710 (Unalign `PackedFingerprint` on all hosts, not just x86 and x86-64)
 - rust-lang/rust#153874 (constify const Fn*: Destruct)
 - rust-lang/rust#154097 (improve validation error messages: show surrounding type)
 - rust-lang/rust#154277 (use `minicore` more in testing inline assembly)
 - rust-lang/rust#154293 (Use verbose span suggestion for type const)
This commit is contained in:
bors
2026-03-24 18:37:19 +00:00
167 changed files with 889 additions and 669 deletions
@@ -425,7 +425,7 @@ fn const_validate_mplace<'tcx>(
cid: GlobalId<'tcx>,
) -> Result<(), ErrorHandled> {
let alloc_id = mplace.ptr().provenance.unwrap().alloc_id();
let mut ref_tracking = RefTracking::new(mplace.clone());
let mut ref_tracking = RefTracking::new(mplace.clone(), mplace.layout.ty);
let mut inner = false;
while let Some((mplace, path)) = ref_tracking.next() {
let mode = match ecx.tcx.static_mutability(cid.instance.def_id()) {
@@ -47,9 +47,9 @@
macro_rules! err_validation_failure {
($where:expr, $msg:expr ) => {{
let where_ = &$where;
let path = if !where_.is_empty() {
let path = if !where_.projs.is_empty() {
let mut path = String::new();
write_path(&mut path, where_);
write_path(&mut path, &where_.projs);
Some(path)
} else {
None
@@ -59,6 +59,7 @@ macro_rules! err_validation_failure {
use ValidationErrorKind::*;
let msg = ValidationErrorKind::from($msg);
err_ub!(ValidationError {
orig_ty: where_.orig_ty,
path,
ptr_bytes_warning: msg.ptr_bytes_warning(),
msg: msg.to_string(),
@@ -234,7 +235,7 @@ fn fmt_range(r: WrappingRange, max_hi: u128) -> String {
/// So we track a `Vec<PathElem>` where `PathElem` contains all the data we
/// need to later print something for the user.
#[derive(Copy, Clone, Debug)]
pub enum PathElem {
pub enum PathElem<'tcx> {
Field(Symbol),
Variant(Symbol),
CoroutineState(VariantIdx),
@@ -244,10 +245,22 @@ pub enum PathElem {
Deref,
EnumTag,
CoroutineTag,
DynDowncast,
DynDowncast(Ty<'tcx>),
Vtable,
}
#[derive(Clone, Debug)]
pub struct Path<'tcx> {
orig_ty: Ty<'tcx>,
projs: Vec<PathElem<'tcx>>,
}
impl<'tcx> Path<'tcx> {
fn new(ty: Ty<'tcx>) -> Self {
Self { orig_ty: ty, projs: vec![] }
}
}
/// Extra things to check for during validation of CTFE results.
#[derive(Copy, Clone)]
pub enum CtfeValidationMode {
@@ -280,16 +293,10 @@ pub struct RefTracking<T, PATH = ()> {
todo: Vec<(T, PATH)>,
}
impl<T: Clone + Eq + Hash + std::fmt::Debug, PATH: Default> RefTracking<T, PATH> {
impl<T: Clone + Eq + Hash + std::fmt::Debug, PATH> RefTracking<T, PATH> {
pub fn empty() -> Self {
RefTracking { seen: FxHashSet::default(), todo: vec![] }
}
pub fn new(val: T) -> Self {
let mut ref_tracking_for_consts =
RefTracking { seen: FxHashSet::default(), todo: vec![(val.clone(), PATH::default())] };
ref_tracking_for_consts.seen.insert(val);
ref_tracking_for_consts
}
pub fn next(&mut self) -> Option<(T, PATH)> {
self.todo.pop()
}
@@ -304,8 +311,17 @@ fn track(&mut self, val: T, path: impl FnOnce() -> PATH) {
}
}
impl<'tcx, T: Clone + Eq + Hash + std::fmt::Debug> RefTracking<T, Path<'tcx>> {
pub fn new(val: T, ty: Ty<'tcx>) -> Self {
let mut ref_tracking_for_consts =
RefTracking { seen: FxHashSet::default(), todo: vec![(val.clone(), Path::new(ty))] };
ref_tracking_for_consts.seen.insert(val);
ref_tracking_for_consts
}
}
/// Format a path
fn write_path(out: &mut String, path: &[PathElem]) {
fn write_path(out: &mut String, path: &[PathElem<'_>]) {
use self::PathElem::*;
for elem in path.iter() {
@@ -323,7 +339,7 @@ fn write_path(out: &mut String, path: &[PathElem]) {
// even use the usual syntax because we are just showing the projections,
// not the root.
Deref => write!(out, ".<deref>"),
DynDowncast => write!(out, ".<dyn-downcast>"),
DynDowncast(ty) => write!(out, ".<dyn-downcast({ty})>"),
Vtable => write!(out, ".<vtable>"),
}
.unwrap()
@@ -382,10 +398,9 @@ fn add_range(&mut self, offset: Size, size: Size) {
struct ValidityVisitor<'rt, 'tcx, M: Machine<'tcx>> {
/// The `path` may be pushed to, but the part that is present when a function
/// starts must not be changed! `visit_fields` and `visit_array` rely on
/// this stack discipline.
path: Vec<PathElem>,
ref_tracking: Option<&'rt mut RefTracking<MPlaceTy<'tcx, M::Provenance>, Vec<PathElem>>>,
/// starts must not be changed! `with_elem` relies on this stack discipline.
path: Path<'tcx>,
ref_tracking: Option<&'rt mut RefTracking<MPlaceTy<'tcx, M::Provenance>, Path<'tcx>>>,
/// `None` indicates this is not validating for CTFE (but for runtime).
ctfe_mode: Option<CtfeValidationMode>,
ecx: &'rt mut InterpCx<'tcx, M>,
@@ -404,7 +419,12 @@ struct ValidityVisitor<'rt, 'tcx, M: Machine<'tcx>> {
}
impl<'rt, 'tcx, M: Machine<'tcx>> ValidityVisitor<'rt, 'tcx, M> {
fn aggregate_field_path_elem(&mut self, layout: TyAndLayout<'tcx>, field: usize) -> PathElem {
fn aggregate_field_path_elem(
&mut self,
layout: TyAndLayout<'tcx>,
field: usize,
field_ty: Ty<'tcx>,
) -> PathElem<'tcx> {
// First, check if we are projecting to a variant.
match layout.variants {
Variants::Multiple { tag_field, .. } => {
@@ -474,7 +494,7 @@ fn aggregate_field_path_elem(&mut self, layout: TyAndLayout<'tcx>, field: usize)
// dyn traits
ty::Dynamic(..) => {
assert_eq!(field, 0);
PathElem::DynDowncast
PathElem::DynDowncast(field_ty)
}
// nothing else has an aggregate layout
@@ -484,17 +504,17 @@ fn aggregate_field_path_elem(&mut self, layout: TyAndLayout<'tcx>, field: usize)
fn with_elem<R>(
&mut self,
elem: PathElem,
elem: PathElem<'tcx>,
f: impl FnOnce(&mut Self) -> InterpResult<'tcx, R>,
) -> InterpResult<'tcx, R> {
// Remember the old state
let path_len = self.path.len();
let path_len = self.path.projs.len();
// Record new element
self.path.push(elem);
self.path.projs.push(elem);
// Perform operation
let r = f(self)?;
// Undo changes
self.path.truncate(path_len);
self.path.projs.truncate(path_len);
// Done
interp_ok(r)
}
@@ -796,10 +816,10 @@ fn check_safe_pointer(
ref_tracking.track(place, || {
// We need to clone the path anyway, make sure it gets created
// with enough space for the additional `Deref`.
let mut new_path = Vec::with_capacity(path.len() + 1);
new_path.extend(path);
new_path.push(PathElem::Deref);
new_path
let mut new_projs = Vec::with_capacity(path.projs.len() + 1);
new_projs.extend(&path.projs);
new_projs.push(PathElem::Deref);
Path { projs: new_projs, orig_ty: path.orig_ty }
});
}
interp_ok(())
@@ -1220,7 +1240,7 @@ fn visit_field(
field: usize,
new_val: &PlaceTy<'tcx, M::Provenance>,
) -> InterpResult<'tcx> {
let elem = self.aggregate_field_path_elem(old_val.layout, field);
let elem = self.aggregate_field_path_elem(old_val.layout, field, new_val.layout.ty);
self.with_elem(elem, move |this| this.visit_value(new_val))
}
@@ -1385,7 +1405,7 @@ fn visit_value(&mut self, val: &PlaceTy<'tcx, M::Provenance>) -> InterpResult<'t
access.bad.start.bytes() / layout.size.bytes(),
)
.unwrap();
self.path.push(PathElem::ArrayElem(i));
self.path.projs.push(PathElem::ArrayElem(i));
if matches!(kind, Ub(InvalidUninitBytes(_))) {
err_validation_failure!(self.path, Uninit { expected })
@@ -1515,8 +1535,8 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
fn validate_operand_internal(
&mut self,
val: &PlaceTy<'tcx, M::Provenance>,
path: Vec<PathElem>,
ref_tracking: Option<&mut RefTracking<MPlaceTy<'tcx, M::Provenance>, Vec<PathElem>>>,
path: Path<'tcx>,
ref_tracking: Option<&mut RefTracking<MPlaceTy<'tcx, M::Provenance>, Path<'tcx>>>,
ctfe_mode: Option<CtfeValidationMode>,
reset_provenance_and_padding: bool,
) -> InterpResult<'tcx> {
@@ -1569,8 +1589,8 @@ fn validate_operand_internal(
pub(crate) fn const_validate_operand(
&mut self,
val: &PlaceTy<'tcx, M::Provenance>,
path: Vec<PathElem>,
ref_tracking: &mut RefTracking<MPlaceTy<'tcx, M::Provenance>, Vec<PathElem>>,
path: Path<'tcx>,
ref_tracking: &mut RefTracking<MPlaceTy<'tcx, M::Provenance>, Path<'tcx>>,
ctfe_mode: CtfeValidationMode,
) -> InterpResult<'tcx> {
self.validate_operand_internal(
@@ -1599,14 +1619,13 @@ pub fn validate_operand(
reset_provenance_and_padding,
?val,
);
// Note that we *could* actually be in CTFE here with `-Zextra-const-ub-checks`, but it's
// still correct to not use `ctfe_mode`: that mode is for validation of the final constant
// value, it rules out things like `UnsafeCell` in awkward places.
if !recursive {
return self.validate_operand_internal(
val,
vec![],
Path::new(val.layout.ty),
None,
None,
reset_provenance_and_padding,
@@ -1616,7 +1635,7 @@ pub fn validate_operand(
let mut ref_tracking = RefTracking::empty();
self.validate_operand_internal(
val,
vec![],
Path::new(val.layout.ty),
Some(&mut ref_tracking),
None,
reset_provenance_and_padding,
@@ -181,22 +181,24 @@ fn decode(d: &mut D) -> Self {
}
}
// `PackedFingerprint` wraps a `Fingerprint`. Its purpose is to, on certain
// architectures, behave like a `Fingerprint` without alignment requirements.
// This behavior is only enabled on x86 and x86_64, where the impact of
// unaligned accesses is tolerable in small doses.
//
// This may be preferable to use in large collections of structs containing
// fingerprints, as it can reduce memory consumption by preventing the padding
// that the more strictly-aligned `Fingerprint` can introduce. An application of
// this is in the query dependency graph, which contains a large collection of
// `DepNode`s. As of this writing, the size of a `DepNode` decreases by ~30%
// (from 24 bytes to 17) by using the packed representation here, which
// noticeably decreases total memory usage when compiling large crates.
//
// The wrapped `Fingerprint` is private to reduce the chance of a client
// invoking undefined behavior by taking a reference to the packed field.
#[cfg_attr(any(target_arch = "x86", target_arch = "x86_64"), repr(packed))]
/// `PackedFingerprint` wraps a `Fingerprint`.
/// Its purpose is to behave like a `Fingerprint` without alignment requirements.
///
/// This may be preferable to use in large collections of structs containing
/// fingerprints, as it can reduce memory consumption by preventing the padding
/// that the more strictly-aligned `Fingerprint` can introduce. An application of
/// this is in the query dependency graph, which contains a large collection of
/// `DepNode`s. As of this writing, the size of a `DepNode` decreases by 25%
/// (from 24 bytes to 18) by using the packed representation here, which
/// noticeably decreases total memory usage when compiling large crates.
///
/// (Unalignment was previously restricted to `x86` and `x86_64` hosts, but is
/// now enabled by default for all host architectures, in the hope that the
/// memory and cache savings should outweigh any unaligned access penalty.)
///
/// The wrapped `Fingerprint` is private to reduce the chance of a client
/// invoking undefined behavior by taking a reference to the packed field.
#[repr(packed)]
#[derive(Eq, PartialEq, Ord, PartialOrd, Debug, Clone, Copy, Hash)]
pub struct PackedFingerprint(Fingerprint);
@@ -2947,7 +2947,7 @@ fn require_type_const_attribute(
);
if def_id.is_local() {
let name = tcx.def_path_str(def_id);
err.span_suggestion(
err.span_suggestion_verbose(
tcx.def_span(def_id).shrink_to_lo(),
format!("add `type` before `const` for `{name}`"),
format!("type "),
@@ -412,9 +412,6 @@ mod size_asserts {
use super::*;
// tidy-alphabetical-start
static_assert_size!(DepKind, 2);
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
static_assert_size!(DepNode, 18);
#[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
static_assert_size!(DepNode, 24);
// tidy-alphabetical-end
}
@@ -318,7 +318,12 @@ pub enum UndefinedBehaviorInfo<'tcx> {
/// Free-form case. Only for errors that are never caught! Used by miri
Ub(String),
/// Validation error.
ValidationError { path: Option<String>, msg: String, ptr_bytes_warning: bool },
ValidationError {
orig_ty: Ty<'tcx>,
path: Option<String>,
msg: String,
ptr_bytes_warning: bool,
},
/// Unreachable code was executed.
Unreachable,
@@ -457,11 +462,11 @@ fn fmt_in_alloc_attempt(
match self {
Ub(msg) => write!(f, "{msg}"),
ValidationError { path: None, msg, .. } => {
write!(f, "constructing invalid value: {msg}")
ValidationError { orig_ty, path: None, msg, .. } => {
write!(f, "constructing invalid value of type {orig_ty}: {msg}")
}
ValidationError { path: Some(path), msg, .. } => {
write!(f, "constructing invalid value at {path}: {msg}")
ValidationError { orig_ty, path: Some(path), msg, .. } => {
write!(f, "constructing invalid value of type {orig_ty}: at {path}, {msg}")
}
Unreachable => write!(f, "entering unreachable code"),
@@ -797,12 +797,16 @@ pub(in crate::solve) fn const_conditions_for_destruct<I: Interner>(
| ty::Infer(ty::InferTy::FloatVar(_) | ty::InferTy::IntVar(_))
| ty::Error(_) => Ok(vec![]),
// Coroutines and closures could implement `[const] Drop`,
// Closures are [const] Destruct when all of their upvars (captures) are [const] Destruct.
ty::Closure(_, args) => {
let closure_args = args.as_closure();
Ok(vec![ty::TraitRef::new(cx, destruct_def_id, [closure_args.tupled_upvars_ty()])])
}
// Coroutines could implement `[const] Drop`,
// but they don't really need to right now.
ty::Closure(_, _)
| ty::CoroutineClosure(_, _)
| ty::Coroutine(_, _)
| ty::CoroutineWitness(_, _) => Err(NoSolution),
ty::CoroutineClosure(_, _) | ty::Coroutine(_, _) | ty::CoroutineWitness(_, _) => {
Err(NoSolution)
}
// FIXME(unsafe_binders): Unsafe binders could implement `[const] Drop`
// if their inner type implements it.
@@ -472,12 +472,17 @@ fn evaluate_host_effect_for_destruct_goal<'tcx>(
| ty::Infer(ty::InferTy::FloatVar(_) | ty::InferTy::IntVar(_))
| ty::Error(_) => thin_vec![],
// Coroutines and closures could implement `[const] Drop`,
// Closures are [const] Destruct when all of their upvars (captures) are [const] Destruct.
ty::Closure(_, args) => {
let closure_args = args.as_closure();
thin_vec![ty::TraitRef::new(tcx, destruct_def_id, [closure_args.tupled_upvars_ty()])]
}
// Coroutines could implement `[const] Drop`,
// but they don't really need to right now.
ty::Closure(_, _)
| ty::CoroutineClosure(_, _)
| ty::Coroutine(_, _)
| ty::CoroutineWitness(_, _) => return Err(EvaluationFailure::NoSolution),
ty::CoroutineClosure(_, _) | ty::Coroutine(_, _) | ty::CoroutineWitness(_, _) => {
return Err(EvaluationFailure::NoSolution);
}
// FIXME(unsafe_binders): Unsafe binders could implement `[const] Drop`
// if their inner type implements it.
+15
View File
@@ -741,3 +741,18 @@ const fn maybe_doubler(x: usize) -> Option<usize> {
struct Zst;
assert_eq!([(); 10].try_map(|()| Some(Zst)), Some([const { Zst }; 10]));
}
#[test]
const fn extra_const_array_ops() {
let x: [u8; 4] =
{ std::array::from_fn(const |i| i + 4).map(const |x| x * 2).map(const |x| x as _) };
let y = 4;
struct Z(u16);
impl const Drop for Z {
fn drop(&mut self) {}
}
let w = Z(2);
let _x: [u8; 4] = {
std::array::from_fn(const |_| x[0] + y).map(const |x| x * (w.0 as u8)).map(const |x| x as _)
};
}
+1
View File
@@ -17,6 +17,7 @@
#![feature(const_bool)]
#![feature(const_cell_traits)]
#![feature(const_clone)]
#![feature(const_closures)]
#![feature(const_cmp)]
#![feature(const_convert)]
#![feature(const_default)]
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value at [3]: encountered uninitialized memory, but expected an integer
error: Undefined Behavior: constructing invalid value of type [u8; 4]: at [3], encountered uninitialized memory, but expected an integer
--> tests/fail-dep/libc/libc-read-and-uninit-premature-eof.rs:LL:CC
|
LL | buf.assume_init();
@@ -14,7 +14,7 @@ fn main() {
// However, it drops provenance when transmuting to TwoPtrs, so this is UB.
let val = unsafe {
transmute::<_, &str>(
//~^ ERROR: constructing invalid value: encountered a dangling reference
//~^ ERROR: encountered a dangling reference
!mask & transmute::<_, TwoPtrs>("false !")
| mask & transmute::<_, TwoPtrs>("true !"),
)
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value: encountered a dangling reference ($HEX[noalloc] has no provenance)
error: Undefined Behavior: constructing invalid value of type &str: encountered a dangling reference ($HEX[noalloc] has no provenance)
--> tests/fail/branchless-select-i128-pointer.rs:LL:CC
|
LL | / transmute::<_, &str>(
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value: encountered a dangling box (0x18[noalloc] has no provenance)
error: Undefined Behavior: constructing invalid value of type std::boxed::Box<i32>: encountered a dangling box (0x18[noalloc] has no provenance)
--> tests/fail/dangling_pointers/deref_dangling_box.rs:LL:CC
|
LL | let _val = unsafe { addr_of_mut!(**outer) };
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value: encountered a dangling reference (0x18[noalloc] has no provenance)
error: Undefined Behavior: constructing invalid value of type &mut i32: encountered a dangling reference (0x18[noalloc] has no provenance)
--> tests/fail/dangling_pointers/deref_dangling_ref.rs:LL:CC
|
LL | let _val = unsafe { addr_of_mut!(**outer) };
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value: encountered a dangling reference (going beyond the bounds of its allocation)
error: Undefined Behavior: constructing invalid value of type &SliceWithHead: encountered a dangling reference (going beyond the bounds of its allocation)
--> tests/fail/dangling_pointers/dyn_size.rs:LL:CC
|
LL | let _ptr = unsafe { &*ptr };
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value: wrong trait in wide pointer vtable: expected `std::fmt::Debug + std::marker::Send + std::marker::Sync`, but encountered `std::fmt::Display`
error: Undefined Behavior: constructing invalid value of type *const dyn std::fmt::Debug + std::marker::Send + std::marker::Sync: wrong trait in wide pointer vtable: expected `std::fmt::Debug + std::marker::Send + std::marker::Sync`, but encountered `std::fmt::Display`
--> tests/fail/dyn-upcast-nop-wrong-trait.rs:LL:CC
|
LL | let ptr: *const (dyn fmt::Debug + Send + Sync) = unsafe { std::mem::transmute(ptr) };
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value at [0]: encountered 0x02, but expected a boolean
error: Undefined Behavior: constructing invalid value of type [bool; 100]: at [0], encountered 0x02, but expected a boolean
--> tests/fail/intrinsics/typed-swap-invalid-array.rs:LL:CC
|
LL | typed_swap_nonoverlapping(a, b);
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value: encountered 0x02, but expected a boolean
error: Undefined Behavior: constructing invalid value of type bool: encountered 0x02, but expected a boolean
--> tests/fail/intrinsics/typed-swap-invalid-scalar.rs:LL:CC
|
LL | typed_swap_nonoverlapping(a, b);
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value: encountered 0x03, but expected a boolean
error: Undefined Behavior: constructing invalid value of type bool: encountered 0x03, but expected a boolean
--> tests/fail/intrinsics/typed-swap-invalid-scalar.rs:LL:CC
|
LL | typed_swap_nonoverlapping(a, b);
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value: encountered a value of the never type `!`
error: Undefined Behavior: constructing invalid value of type !: encountered a value of the never type `!`
--> tests/fail/intrinsics/uninit_uninhabited_type.rs:LL:CC
|
LL | let _ = unsafe { std::mem::uninitialized::<!>() };
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value: encountered a null function pointer
error: Undefined Behavior: constructing invalid value of type fn(): encountered a null function pointer
--> tests/fail/intrinsics/zero_fn_ptr.rs:LL:CC
|
LL | let _ = unsafe { std::mem::zeroed::<fn()>() };
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value: encountered $HEX[ALLOC]<TAG>, but expected a vtable pointer
error: Undefined Behavior: constructing invalid value of type *mut FunnyPointer: encountered $HEX[ALLOC]<TAG>, but expected a vtable pointer
--> tests/fail/issue-miri-1112.rs:LL:CC
|
LL | let obj = std::mem::transmute::<FatPointer, *mut FunnyPointer>(obj);
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value: encountered a dangling reference (use-after-free)
error: Undefined Behavior: constructing invalid value of type &u32: encountered a dangling reference (use-after-free)
--> tests/fail/match/closures/deref-in-pattern.rs:LL:CC
|
LL | let _ = || {
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value: encountered a dangling reference (use-after-free)
error: Undefined Behavior: constructing invalid value of type &u32: encountered a dangling reference (use-after-free)
--> tests/fail/match/closures/partial-pattern.rs:LL:CC
|
LL | let _ = || {
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value: encountered a dangling reference ($HEX[noalloc] has no provenance)
error: Undefined Behavior: constructing invalid value of type &i32: encountered a dangling reference ($HEX[noalloc] has no provenance)
--> tests/fail/provenance/int_copy_looses_provenance0.rs:LL:CC
|
LL | let _val = unsafe { *ptr.read() };
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value: encountered a dangling reference ($HEX[noalloc] has no provenance)
error: Undefined Behavior: constructing invalid value of type &i32: encountered a dangling reference ($HEX[noalloc] has no provenance)
--> tests/fail/provenance/int_copy_looses_provenance1.rs:LL:CC
|
LL | let _val = unsafe { *ptr.read() };
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value: encountered a dangling reference ($HEX[noalloc] has no provenance)
error: Undefined Behavior: constructing invalid value of type &i32: encountered a dangling reference ($HEX[noalloc] has no provenance)
--> tests/fail/provenance/int_copy_looses_provenance2.rs:LL:CC
|
LL | let _val = unsafe { *ptr.read() };
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value: encountered uninitialized memory, but expected an integer
error: Undefined Behavior: constructing invalid value of type i32: encountered uninitialized memory, but expected an integer
--> tests/fail/storage-live-resets-var.rs:LL:CC
|
LL | _val2 = val;
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value: encountered an unaligned reference (required ALIGN byte alignment but found ALIGN)
error: Undefined Behavior: constructing invalid value of type &mut PartialDrop: encountered an unaligned reference (required ALIGN byte alignment but found ALIGN)
--> RUSTLIB/core/src/ptr/mod.rs:LL:CC
|
LL | / pub const unsafe fn drop_in_place<T: PointeeSized>(to_drop: *mut T)
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value: encountered an unaligned reference (required ALIGN byte alignment but found ALIGN)
error: Undefined Behavior: constructing invalid value of type &dyn std::fmt::Debug: encountered an unaligned reference (required ALIGN byte alignment but found ALIGN)
--> tests/fail/unaligned_pointers/dyn_alignment.rs:LL:CC
|
LL | let _ptr = &*ptr;
@@ -10,6 +10,6 @@ fn main() {
unsafe {
let unaligned = MaybeDangling::new(a.as_ptr().byte_add(1));
transmute::<MaybeDangling<*const u16>, MaybeDangling<&u16>>(unaligned)
//~^ ERROR: Undefined Behavior: constructing invalid value: encountered an unaligned reference
//~^ ERROR: encountered an unaligned reference
};
}
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value: encountered an unaligned reference (required ALIGN byte alignment but found ALIGN)
error: Undefined Behavior: constructing invalid value of type std::mem::MaybeDangling<&u16>: encountered an unaligned reference (required ALIGN byte alignment but found ALIGN)
--> tests/fail/unaligned_pointers/maybe_dangling_unalighed.rs:LL:CC
|
LL | transmute::<MaybeDangling<*const u16>, MaybeDangling<&u16>>(unaligned)
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value: encountered an unaligned reference (required ALIGN byte alignment but found ALIGN)
error: Undefined Behavior: constructing invalid value of type &i32: encountered an unaligned reference (required ALIGN byte alignment but found ALIGN)
--> tests/fail/unaligned_pointers/reference_to_packed.rs:LL:CC
|
LL | mem::transmute(x)
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value: encountered an unaligned reference (required ALIGN byte alignment but found ALIGN)
error: Undefined Behavior: constructing invalid value of type &u32: encountered an unaligned reference (required ALIGN byte alignment but found ALIGN)
--> tests/fail/unaligned_pointers/unaligned_ref_addr_of.rs:LL:CC
|
LL | let _x = unsafe { &*x };
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value at .bytes[2]: encountered uninitialized memory, but expected an integer
error: Undefined Behavior: constructing invalid value of type Bar: at .bytes[2], encountered uninitialized memory, but expected an integer
--> tests/fail/uninit/padding-struct-in-union.rs:LL:CC
|
LL | let _val = unsafe { (foobar.foo, foobar.bar) };
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value at [1]: encountered uninitialized memory, but expected an integer
error: Undefined Behavior: constructing invalid value of type [u8; 4]: at [1], encountered uninitialized memory, but expected an integer
--> tests/fail/uninit/padding-union.rs:LL:CC
|
LL | let _val = *c;
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value at [1]: encountered uninitialized memory, but expected an integer
error: Undefined Behavior: constructing invalid value of type [u8; 4]: at [1], encountered uninitialized memory, but expected an integer
--> tests/fail/uninit/uninit-after-aggregate-assign.rs:LL:CC
|
LL | _val = *sptr2; // should hence be UB
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value: encountered a dangling box (0x4[noalloc] has no provenance)
error: Undefined Behavior: constructing invalid value of type std::boxed::Box<i32, MyAlloc>: encountered a dangling box (0x4[noalloc] has no provenance)
--> tests/fail/validity/box-custom-alloc-dangling-ptr.rs:LL:CC
|
LL | std::mem::transmute(b)
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value at .1.my_alloc_field1: encountered uninitialized memory, but expected an integer
error: Undefined Behavior: constructing invalid value of type std::boxed::Box<i32, MyAlloc>: at .1.my_alloc_field1, encountered uninitialized memory, but expected an integer
--> tests/fail/validity/box-custom-alloc-invalid-alloc.rs:LL:CC
|
LL | std::mem::transmute(b)
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value: encountered a null reference
error: Undefined Behavior: constructing invalid value of type &i32: encountered a null reference
--> tests/fail/validity/cast_fn_ptr_invalid_callee_arg.rs:LL:CC
|
LL | g(0usize as *const i32)
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value at .0.0: encountered 0, but expected something greater or equal to 1
error: Undefined Behavior: constructing invalid value of type std::num::NonZero<u32>: at .0.0, encountered 0, but expected something greater or equal to 1
--> tests/fail/validity/cast_fn_ptr_invalid_callee_ret.rs:LL:CC
|
LL | f();
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value at .0.0: encountered 0, but expected something greater or equal to 1
error: Undefined Behavior: constructing invalid value of type std::num::NonZero<u32>: at .0.0, encountered 0, but expected something greater or equal to 1
--> tests/fail/validity/cast_fn_ptr_invalid_caller_arg.rs:LL:CC
|
LL | Call(_res = f(*ptr), ReturnTo(retblock), UnwindContinue())
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value: encountered a null reference
error: Undefined Behavior: constructing invalid value of type &i32: encountered a null reference
--> tests/fail/validity/cast_fn_ptr_invalid_caller_ret.rs:LL:CC
|
LL | let _x = g();
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value: encountered a dangling reference (0x10[noalloc] has no provenance)
error: Undefined Behavior: constructing invalid value of type &i32: encountered a dangling reference (0x10[noalloc] has no provenance)
--> tests/fail/validity/dangling_ref1.rs:LL:CC
|
LL | let _x: &i32 = unsafe { mem::transmute(16usize) };
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value: encountered a dangling reference (going beyond the bounds of its allocation)
error: Undefined Behavior: constructing invalid value of type &i32: encountered a dangling reference (going beyond the bounds of its allocation)
--> tests/fail/validity/dangling_ref2.rs:LL:CC
|
LL | let _x: &i32 = unsafe { mem::transmute(ptr) };
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value: encountered a dangling reference (use-after-free)
error: Undefined Behavior: constructing invalid value of type &i32: encountered a dangling reference (use-after-free)
--> tests/fail/validity/dangling_ref3.rs:LL:CC
|
LL | let _x: &i32 = unsafe { mem::transmute(dangling()) };
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value: wrong trait in wide pointer vtable: expected `Trait<for<'a> fn(&'a ())>`, but encountered `Trait<fn(&())>`
error: Undefined Behavior: constructing invalid value of type &dyn Trait<for<'a> fn(&'a ())>: wrong trait in wide pointer vtable: expected `Trait<for<'a> fn(&'a ())>`, but encountered `Trait<fn(&())>`
--> tests/fail/validity/dyn-transmute-inner-binder.rs:LL:CC
|
LL | let y: &dyn Trait<for<'a> fn(&'a ())> = unsafe { std::mem::transmute(x) };
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value: encountered 0x02, but expected a boolean
error: Undefined Behavior: constructing invalid value of type bool: encountered 0x02, but expected a boolean
--> tests/fail/validity/invalid_bool.rs:LL:CC
|
LL | let _b = unsafe { std::mem::transmute::<u8, bool>(2) };
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value at [0]: encountered uninitialized memory, but expected a boolean
error: Undefined Behavior: constructing invalid value of type [bool; 1]: at [0], encountered uninitialized memory, but expected a boolean
--> tests/fail/validity/invalid_bool_uninit.rs:LL:CC
|
LL | let _b = unsafe { MyUninit { init: () }.uninit };
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value: encountered $HEX, but expected a valid unicode scalar value (in `0..=$HEX` but not in `$HEX..=$HEX`)
error: Undefined Behavior: constructing invalid value of type char: encountered $HEX, but expected a valid unicode scalar value (in `0..=$HEX` but not in `$HEX..=$HEX`)
--> tests/fail/validity/invalid_char.rs:LL:CC
|
LL | let _val = match unsafe { std::mem::transmute::<i32, char>(-1) } {
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value at [0]: encountered uninitialized memory, but expected a unicode scalar value
error: Undefined Behavior: constructing invalid value of type [char; 1]: at [0], encountered uninitialized memory, but expected a unicode scalar value
--> tests/fail/validity/invalid_char_uninit.rs:LL:CC
|
LL | let _b = unsafe { MyUninit { init: () }.uninit };
@@ -7,5 +7,5 @@ pub enum Foo {
}
fn main() {
let _f = unsafe { std::mem::transmute::<i32, Foo>(42) }; //~ ERROR: constructing invalid value at .<enum-tag>: encountered 0x0000002a, but expected a valid enum tag
let _f = unsafe { std::mem::transmute::<i32, Foo>(42) }; //~ ERROR: constructing invalid value of type Foo: at .<enum-tag>, encountered 0x0000002a, but expected a valid enum tag
}
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value at .<enum-tag>: encountered $HEX, but expected a valid enum tag
error: Undefined Behavior: constructing invalid value of type Foo: at .<enum-tag>, encountered $HEX, but expected a valid enum tag
--> tests/fail/validity/invalid_enum_tag.rs:LL:CC
|
LL | let _f = unsafe { std::mem::transmute::<i32, Foo>(42) };
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value: encountered a null function pointer
error: Undefined Behavior: constructing invalid value of type fn(): encountered a null function pointer
--> tests/fail/validity/invalid_fnptr_null.rs:LL:CC
|
LL | let _b: fn() = unsafe { std::mem::transmute(0usize) };
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value at [0]: encountered uninitialized memory, but expected a function pointer
error: Undefined Behavior: constructing invalid value of type [fn(); 1]: at [0], encountered uninitialized memory, but expected a function pointer
--> tests/fail/validity/invalid_fnptr_uninit.rs:LL:CC
|
LL | let _b = unsafe { MyUninit { init: () }.uninit };
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value: encountered null pointer, but expected a vtable pointer
error: Undefined Behavior: constructing invalid value of type *mut dyn main::T: encountered null pointer, but expected a vtable pointer
--> tests/fail/validity/invalid_wide_raw.rs:LL:CC
|
LL | dbg!(S { x: unsafe { std::mem::transmute((0usize, 0usize)) } });
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value: encountered a value of uninhabited type `main::Void`
error: Undefined Behavior: constructing invalid value of type main::Void: encountered a value of uninhabited type `main::Void`
--> tests/fail/validity/match_binder_checks_validity1.rs:LL:CC
|
LL | _x => println!("hi from the void!"),
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value: encountered 0x03, but expected a boolean
error: Undefined Behavior: constructing invalid value of type bool: encountered 0x03, but expected a boolean
--> tests/fail/validity/match_binder_checks_validity2.rs:LL:CC
|
LL | _x => println!("hi from the void!"),
@@ -9,5 +9,5 @@
fn main() {
let null = MaybeDangling::new(null());
unsafe { transmute::<MaybeDangling<*const u8>, MaybeDangling<&u8>>(null) };
//~^ ERROR: Undefined Behavior: constructing invalid value: encountered a null reference
//~^ ERROR: encountered a null reference
}
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value: encountered a null reference
error: Undefined Behavior: constructing invalid value of type std::mem::MaybeDangling<&u8>: encountered a null reference
--> tests/fail/validity/maybe_dangling_null.rs:LL:CC
|
LL | unsafe { transmute::<MaybeDangling<*const u8>, MaybeDangling<&u8>>(null) };
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value: encountered 0, but expected something greater or equal to 1
error: Undefined Behavior: constructing invalid value of type NonZero<i32>: encountered 0, but expected something greater or equal to 1
--> tests/fail/validity/nonzero.rs:LL:CC
|
LL | let _x = Some(unsafe { NonZero(0) });
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value at .<deref>: encountered 0x03, but expected a boolean
error: Undefined Behavior: constructing invalid value of type std::boxed::Box<bool>: at .<deref>, encountered 0x03, but expected a boolean
--> tests/fail/validity/recursive-validity-box-bool.rs:LL:CC
|
LL | let xref_wrong_type: Box<bool> = unsafe { std::mem::transmute(xref) };
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value at .<deref>: encountered 0x03, but expected a boolean
error: Undefined Behavior: constructing invalid value of type &bool: at .<deref>, encountered 0x03, but expected a boolean
--> tests/fail/validity/recursive-validity-ref-bool.rs:LL:CC
|
LL | let xref_wrong_type: &bool = unsafe { std::mem::transmute(xref) };
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value: encountered a box pointing to uninhabited type !
error: Undefined Behavior: constructing invalid value of type std::boxed::Box<!>: encountered a box pointing to uninhabited type !
--> tests/fail/validity/ref_to_uninhabited1.rs:LL:CC
|
LL | let x: Box<!> = transmute(&mut 42);
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value: encountered a reference pointing to uninhabited type (i32, Void)
error: Undefined Behavior: constructing invalid value of type &(i32, Void): encountered a reference pointing to uninhabited type (i32, Void)
--> tests/fail/validity/ref_to_uninhabited2.rs:LL:CC
|
LL | let _x: &(i32, Void) = transmute(&42);
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value: encountered invalid reference metadata: slice is bigger than largest supported object
error: Undefined Behavior: constructing invalid value of type &[u8]: encountered invalid reference metadata: slice is bigger than largest supported object
--> tests/fail/validity/too-big-slice.rs:LL:CC
|
LL | ... let _x: &[u8] = mem::transmute((ptr, usize::MAX));
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value: encountered invalid reference metadata: total size is bigger than largest supported object
error: Undefined Behavior: constructing invalid value of type &MySlice: encountered invalid reference metadata: total size is bigger than largest supported object
--> tests/fail/validity/too-big-unsized.rs:LL:CC
|
LL | ... let _x: &MySlice = mem::transmute((ptr, isize::MAX as usize));
@@ -14,6 +14,6 @@ fn main() {
let mut x = Bool::True;
evil(&mut x);
let y = x; // reading this ought to be enough to trigger validation
//~^ ERROR: constructing invalid value at .<enum-tag>: encountered 0x0000002c, but expected a valid enum tag
//~^ ERROR: constructing invalid value of type Bool: at .<enum-tag>, encountered 0x0000002c, but expected a valid enum tag
println!("{:?}", y); // make sure it is used (and not optimized away)
}
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value at .<enum-tag>: encountered $HEX, but expected a valid enum tag
error: Undefined Behavior: constructing invalid value of type Bool: at .<enum-tag>, encountered $HEX, but expected a valid enum tag
--> tests/fail/validity/transmute_through_ptr.rs:LL:CC
|
LL | let y = x; // reading this ought to be enough to trigger validation
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value at .<enum-tag>: encountered an uninhabited enum variant
error: Undefined Behavior: constructing invalid value of type E: at .<enum-tag>, encountered an uninhabited enum variant
--> tests/fail/validity/uninhabited_variant.rs:LL:CC
|
LL | std::mem::transmute::<u32, E>(1);
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value at [0]: encountered uninitialized memory, but expected a floating point number
error: Undefined Behavior: constructing invalid value of type [f32; 1]: at [0], encountered uninitialized memory, but expected a floating point number
--> tests/fail/validity/uninit_float.rs:LL:CC
|
LL | let _val: [f32; 1] = unsafe { std::mem::uninitialized() };
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value at [0]: encountered uninitialized memory, but expected an integer
error: Undefined Behavior: constructing invalid value of type [usize; 1]: at [0], encountered uninitialized memory, but expected an integer
--> tests/fail/validity/uninit_integer.rs:LL:CC
|
LL | let _val = unsafe { std::mem::MaybeUninit::<[usize; 1]>::uninit().assume_init() };
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value at [0]: encountered uninitialized memory, but expected a raw pointer
error: Undefined Behavior: constructing invalid value of type [*const u8; 1]: at [0], encountered uninitialized memory, but expected a raw pointer
--> tests/fail/validity/uninit_raw_ptr.rs:LL:CC
|
LL | let _val = unsafe { std::mem::MaybeUninit::<[*const u8; 1]>::uninit().assume_init() };
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value: wrong trait in wide pointer vtable: expected `Trait<Assoc = bool>`, but encountered `Trait<Assoc = u8>`
error: Undefined Behavior: constructing invalid value of type std::boxed::Box<dyn Trait<Assoc = bool>>: wrong trait in wide pointer vtable: expected `Trait<Assoc = bool>`, but encountered `Trait<Assoc = u8>`
--> tests/fail/validity/wrong-dyn-trait-assoc-type.rs:LL:CC
|
LL | let v: Box<dyn Trait<Assoc = bool>> = unsafe { std::mem::transmute(v) };
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value: wrong trait in wide pointer vtable: expected `Trait<u32>`, but encountered `Trait<i32>`
error: Undefined Behavior: constructing invalid value of type *const dyn Trait<u32>: wrong trait in wide pointer vtable: expected `Trait<u32>`, but encountered `Trait<i32>`
--> tests/fail/validity/wrong-dyn-trait-generic.rs:LL:CC
|
LL | let _y: *const dyn Trait<u32> = unsafe { mem::transmute(x) };
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value: wrong trait in wide pointer vtable: expected `std::fmt::Debug`, but encountered `std::marker::Send`
error: Undefined Behavior: constructing invalid value of type *const dyn std::fmt::Debug: wrong trait in wide pointer vtable: expected `std::fmt::Debug`, but encountered `std::marker::Send`
--> tests/fail/validity/wrong-dyn-trait.rs:LL:CC
|
LL | let _y: *const dyn fmt::Debug = unsafe { mem::transmute(x) };
@@ -9,6 +9,6 @@
fn main() {
unsafe {
u8_id(2); //~ ERROR: invalid value: encountered 0x02, but expected a boolean
u8_id(2); //~ ERROR: encountered 0x02, but expected a boolean
}
}
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value: encountered 0x02, but expected a boolean
error: Undefined Behavior: constructing invalid value of type bool: encountered 0x02, but expected a boolean
--> tests/native-lib/fail/invalid_retval.rs:LL:CC
|
LL | u8_id(2);
@@ -1,4 +1,4 @@
error: Undefined Behavior: constructing invalid value at .part_1.high: encountered uninitialized memory, but expected an integer
error: Undefined Behavior: constructing invalid value of type ComplexStruct: at .part_1.high, encountered uninitialized memory, but expected an integer
--> tests/native-lib/fail/uninit_struct.rs:LL:CC
|
LL | unsafe { pass_struct_complex(*arg.as_ptr(), 0, 0, 0) };
+2
View File
@@ -238,6 +238,8 @@ pub trait Sync {}
impl Sync for () {}
impl<T, const N: usize> Sync for [T; N] {}
#[lang = "drop_in_place"]
fn drop_in_place<T>(_: *mut T) {}
+9 -5
View File
@@ -1,13 +1,17 @@
//@ only-aarch64
//@ build-pass
//@ needs-asm-support
//@ add-minicore
//@ compile-flags: --target aarch64-unknown-linux-gnu
//@ needs-llvm-components: aarch64
//@ ignore-backends: gcc
#![crate_type = "rlib"]
#![feature(no_core)]
#![no_core]
extern crate minicore;
use minicore::*;
// AArch64 test corresponding to arm64ec-sve.rs.
use std::arch::asm;
fn f(x: f64) {
unsafe {
asm!("", out("p0") _);
+9 -2
View File
@@ -1,6 +1,13 @@
//@ only-aarch64
//@ add-minicore
//@ compile-flags: --target aarch64-unknown-linux-gnu
//@ needs-llvm-components: aarch64
//@ ignore-backends: gcc
#![crate_type = "lib"]
#![feature(no_core)]
#![no_core]
use std::arch::{asm, global_asm};
extern crate minicore;
use minicore::*;
fn main() {
let mut foo = 0;
+13 -13
View File
@@ -1,35 +1,35 @@
error: the `nomem` and `readonly` options are mutually exclusive
--> $DIR/bad-options.rs:8:18
--> $DIR/bad-options.rs:15:18
|
LL | asm!("", options(nomem, readonly));
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: the `pure` and `noreturn` options are mutually exclusive
--> $DIR/bad-options.rs:10:18
--> $DIR/bad-options.rs:17:18
|
LL | asm!("", options(pure, nomem, noreturn));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: asm with the `pure` option must have at least one output
--> $DIR/bad-options.rs:10:18
--> $DIR/bad-options.rs:17:18
|
LL | asm!("", options(pure, nomem, noreturn));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: asm with the `pure` option must have at least one output
--> $DIR/bad-options.rs:13:33
--> $DIR/bad-options.rs:20:33
|
LL | asm!("{}", in(reg) foo, options(pure, nomem));
| ^^^^^^^^^^^^^^^^^^^^
error: asm outputs are not allowed with the `noreturn` option
--> $DIR/bad-options.rs:15:20
--> $DIR/bad-options.rs:22:20
|
LL | asm!("{}", out(reg) foo, options(noreturn));
| ^^^^^^^^^^^^
error: asm with `clobber_abi` must specify explicit registers for outputs
--> $DIR/bad-options.rs:22:20
--> $DIR/bad-options.rs:29:20
|
LL | asm!("{}", out(reg) foo, clobber_abi("C"));
| ^^^^^^^^^^^^ ---------------- clobber_abi
@@ -37,43 +37,43 @@ LL | asm!("{}", out(reg) foo, clobber_abi("C"));
| generic outputs
error: the `nomem` option cannot be used with `global_asm!`
--> $DIR/bad-options.rs:28:25
--> $DIR/bad-options.rs:35:25
|
LL | global_asm!("", options(nomem));
| ^^^^^ the `nomem` option is not meaningful for global-scoped inline assembly
error: the `readonly` option cannot be used with `global_asm!`
--> $DIR/bad-options.rs:30:25
--> $DIR/bad-options.rs:37:25
|
LL | global_asm!("", options(readonly));
| ^^^^^^^^ the `readonly` option is not meaningful for global-scoped inline assembly
error: the `noreturn` option cannot be used with `global_asm!`
--> $DIR/bad-options.rs:32:25
--> $DIR/bad-options.rs:39:25
|
LL | global_asm!("", options(noreturn));
| ^^^^^^^^ the `noreturn` option is not meaningful for global-scoped inline assembly
error: the `pure` option cannot be used with `global_asm!`
--> $DIR/bad-options.rs:34:25
--> $DIR/bad-options.rs:41:25
|
LL | global_asm!("", options(pure));
| ^^^^ the `pure` option is not meaningful for global-scoped inline assembly
error: the `nostack` option cannot be used with `global_asm!`
--> $DIR/bad-options.rs:36:25
--> $DIR/bad-options.rs:43:25
|
LL | global_asm!("", options(nostack));
| ^^^^^^^ the `nostack` option is not meaningful for global-scoped inline assembly
error: the `preserves_flags` option cannot be used with `global_asm!`
--> $DIR/bad-options.rs:38:25
--> $DIR/bad-options.rs:45:25
|
LL | global_asm!("", options(preserves_flags));
| ^^^^^^^^^^^^^^^ the `preserves_flags` option is not meaningful for global-scoped inline assembly
error: invalid ABI for `clobber_abi`
--> $DIR/bad-options.rs:20:18
--> $DIR/bad-options.rs:27:18
|
LL | asm!("", clobber_abi("foo"));
| ^^^^^^^^^^^^^^^^^^
+3 -2
View File
@@ -1,6 +1,7 @@
//@ add-minicore
//@ only-aarch64
//@ compile-flags: -C target-feature=+neon
//@ compile-flags: --target aarch64-unknown-linux-gnu -C target-feature=+neon
//@ needs-llvm-components: aarch64
//@ ignore-backends: gcc
#![crate_type = "lib"]
#![feature(no_core)]
#![no_core]
+22 -22
View File
@@ -1,5 +1,5 @@
error: invalid register class `foo`: unknown register class
--> $DIR/bad-reg.rs:17:20
--> $DIR/bad-reg.rs:18:20
|
LL | asm!("{}", in(foo) foo);
| ^^^^^^^^^^^
@@ -7,13 +7,13 @@ LL | asm!("{}", in(foo) foo);
= note: the following register classes are supported on this target: `reg`, `vreg`, `vreg_low16`, and `preg`
error: invalid register `foo`: unknown register
--> $DIR/bad-reg.rs:19:18
--> $DIR/bad-reg.rs:20:18
|
LL | asm!("", in("foo") foo);
| ^^^^^^^^^^^^^
error: invalid asm template modifier `z` for this register class
--> $DIR/bad-reg.rs:21:15
--> $DIR/bad-reg.rs:22:15
|
LL | asm!("{:z}", in(reg) foo);
| ^^^^ ----------- argument
@@ -23,7 +23,7 @@ LL | asm!("{:z}", in(reg) foo);
= note: the `reg` register class supports the following template modifiers: `w` and `x`
error: invalid asm template modifier `r` for this register class
--> $DIR/bad-reg.rs:23:15
--> $DIR/bad-reg.rs:24:15
|
LL | asm!("{:r}", in(vreg) foo);
| ^^^^ ------------ argument
@@ -33,7 +33,7 @@ LL | asm!("{:r}", in(vreg) foo);
= note: the `vreg` register class supports the following template modifiers: `b`, `h`, `s`, `d`, `q`, and `v`
error: invalid asm template modifier `r` for this register class
--> $DIR/bad-reg.rs:25:15
--> $DIR/bad-reg.rs:26:15
|
LL | asm!("{:r}", in(vreg_low16) foo);
| ^^^^ ------------------ argument
@@ -43,7 +43,7 @@ LL | asm!("{:r}", in(vreg_low16) foo);
= note: the `vreg_low16` register class supports the following template modifiers: `b`, `h`, `s`, `d`, `q`, and `v`
error: asm template modifiers are not allowed for `const` arguments
--> $DIR/bad-reg.rs:27:15
--> $DIR/bad-reg.rs:28:15
|
LL | asm!("{:a}", const 0);
| ^^^^ ------- argument
@@ -51,7 +51,7 @@ LL | asm!("{:a}", const 0);
| template modifier
error: asm template modifiers are not allowed for `sym` arguments
--> $DIR/bad-reg.rs:29:15
--> $DIR/bad-reg.rs:30:15
|
LL | asm!("{:a}", sym main);
| ^^^^ -------- argument
@@ -59,49 +59,49 @@ LL | asm!("{:a}", sym main);
| template modifier
error: invalid register `x29`: the frame pointer cannot be used as an operand for inline asm
--> $DIR/bad-reg.rs:31:18
--> $DIR/bad-reg.rs:32:18
|
LL | asm!("", in("x29") foo);
| ^^^^^^^^^^^^^
error: invalid register `sp`: the stack pointer cannot be used as an operand for inline asm
--> $DIR/bad-reg.rs:33:18
--> $DIR/bad-reg.rs:34:18
|
LL | asm!("", in("sp") foo);
| ^^^^^^^^^^^^
error: invalid register `xzr`: the zero register cannot be used as an operand for inline asm
--> $DIR/bad-reg.rs:35:18
--> $DIR/bad-reg.rs:36:18
|
LL | asm!("", in("xzr") foo);
| ^^^^^^^^^^^^^
error: invalid register `x19`: x19 is used internally by LLVM and cannot be used as an operand for inline asm
--> $DIR/bad-reg.rs:37:18
--> $DIR/bad-reg.rs:38:18
|
LL | asm!("", in("x19") foo);
| ^^^^^^^^^^^^^
error: register class `preg` can only be used as a clobber, not as an input or output
--> $DIR/bad-reg.rs:40:18
--> $DIR/bad-reg.rs:41:18
|
LL | asm!("", in("p0") foo);
| ^^^^^^^^^^^^
error: register class `preg` can only be used as a clobber, not as an input or output
--> $DIR/bad-reg.rs:44:20
--> $DIR/bad-reg.rs:45:20
|
LL | asm!("{}", in(preg) foo);
| ^^^^^^^^^^^^
error: register class `preg` can only be used as a clobber, not as an input or output
--> $DIR/bad-reg.rs:47:20
--> $DIR/bad-reg.rs:48:20
|
LL | asm!("{}", out(preg) _);
| ^^^^^^^^^^^
error: register `w0` conflicts with register `x0`
--> $DIR/bad-reg.rs:53:32
--> $DIR/bad-reg.rs:54:32
|
LL | asm!("", in("x0") foo, in("w0") bar);
| ------------ ^^^^^^^^^^^^ register `w0`
@@ -109,7 +109,7 @@ LL | asm!("", in("x0") foo, in("w0") bar);
| register `x0`
error: register `x0` conflicts with register `x0`
--> $DIR/bad-reg.rs:55:32
--> $DIR/bad-reg.rs:56:32
|
LL | asm!("", in("x0") foo, out("x0") bar);
| ------------ ^^^^^^^^^^^^^ register `x0`
@@ -117,13 +117,13 @@ LL | asm!("", in("x0") foo, out("x0") bar);
| register `x0`
|
help: use `lateout` instead of `out` to avoid conflict
--> $DIR/bad-reg.rs:55:18
--> $DIR/bad-reg.rs:56:18
|
LL | asm!("", in("x0") foo, out("x0") bar);
| ^^^^^^^^^^^^
error: register `q0` conflicts with register `v0`
--> $DIR/bad-reg.rs:58:32
--> $DIR/bad-reg.rs:59:32
|
LL | asm!("", in("v0") foo, in("q0") bar);
| ------------ ^^^^^^^^^^^^ register `q0`
@@ -131,7 +131,7 @@ LL | asm!("", in("v0") foo, in("q0") bar);
| register `v0`
error: register `q0` conflicts with register `v0`
--> $DIR/bad-reg.rs:60:32
--> $DIR/bad-reg.rs:61:32
|
LL | asm!("", in("v0") foo, out("q0") bar);
| ------------ ^^^^^^^^^^^^^ register `q0`
@@ -139,13 +139,13 @@ LL | asm!("", in("v0") foo, out("q0") bar);
| register `v0`
|
help: use `lateout` instead of `out` to avoid conflict
--> $DIR/bad-reg.rs:60:18
--> $DIR/bad-reg.rs:61:18
|
LL | asm!("", in("v0") foo, out("q0") bar);
| ^^^^^^^^^^^^
error: type `i32` cannot be used with this register class
--> $DIR/bad-reg.rs:40:27
--> $DIR/bad-reg.rs:41:27
|
LL | asm!("", in("p0") foo);
| ^^^
@@ -153,7 +153,7 @@ LL | asm!("", in("p0") foo);
= note: register class `preg` supports these types:
error: type `i32` cannot be used with this register class
--> $DIR/bad-reg.rs:44:29
--> $DIR/bad-reg.rs:45:29
|
LL | asm!("{}", in(preg) foo);
| ^^^
+9 -3
View File
@@ -1,8 +1,14 @@
//@ only-aarch64
//@ needs-asm-support
//@ run-rustfix
//@ add-minicore
//@ compile-flags: --target aarch64-unknown-linux-gnu
//@ needs-llvm-components: aarch64
//@ needs-asm-support
//@ ignore-backends: gcc
#![feature(no_core)]
#![no_core]
use std::arch::asm;
extern crate minicore;
use minicore::*;
fn main() {
unsafe {
+9 -3
View File
@@ -1,8 +1,14 @@
//@ only-aarch64
//@ needs-asm-support
//@ run-rustfix
//@ add-minicore
//@ compile-flags: --target aarch64-unknown-linux-gnu
//@ needs-llvm-components: aarch64
//@ needs-asm-support
//@ ignore-backends: gcc
#![feature(no_core)]
#![no_core]
use std::arch::asm;
extern crate minicore;
use minicore::*;
fn main() {
unsafe {
@@ -1,53 +1,53 @@
error: the `nomem` option was already provided
--> $DIR/duplicate-options.rs:9:33
--> $DIR/duplicate-options.rs:15:33
|
LL | asm!("", options(nomem, nomem));
| ^^^^^ this option was already provided
error: the `preserves_flags` option was already provided
--> $DIR/duplicate-options.rs:11:43
--> $DIR/duplicate-options.rs:17:43
|
LL | asm!("", options(preserves_flags, preserves_flags));
| ^^^^^^^^^^^^^^^ this option was already provided
error: the `nostack` option was already provided
--> $DIR/duplicate-options.rs:13:61
--> $DIR/duplicate-options.rs:19:61
|
LL | asm!("", options(nostack, preserves_flags), options(nostack));
| ^^^^^^^ this option was already provided
error: the `nostack` option was already provided
--> $DIR/duplicate-options.rs:15:35
--> $DIR/duplicate-options.rs:21:35
|
LL | asm!("", options(nostack, nostack), options(nostack), options(nostack));
| ^^^^^^^ this option was already provided
error: the `nostack` option was already provided
--> $DIR/duplicate-options.rs:15:53
--> $DIR/duplicate-options.rs:21:53
|
LL | asm!("", options(nostack, nostack), options(nostack), options(nostack));
| ^^^^^^^ this option was already provided
error: the `nostack` option was already provided
--> $DIR/duplicate-options.rs:15:71
--> $DIR/duplicate-options.rs:21:71
|
LL | asm!("", options(nostack, nostack), options(nostack), options(nostack));
| ^^^^^^^ this option was already provided
error: the `noreturn` option was already provided
--> $DIR/duplicate-options.rs:22:38
--> $DIR/duplicate-options.rs:28:38
|
LL | options(preserves_flags, noreturn),
| ^^^^^^^^ this option was already provided
error: the `nomem` option was already provided
--> $DIR/duplicate-options.rs:23:21
--> $DIR/duplicate-options.rs:29:21
|
LL | options(nomem, nostack),
| ^^^^^ this option was already provided
error: the `noreturn` option was already provided
--> $DIR/duplicate-options.rs:24:21
--> $DIR/duplicate-options.rs:30:21
|
LL | options(noreturn),
| ^^^^^^^^ this option was already provided
+10 -3
View File
@@ -1,6 +1,13 @@
//@ only-aarch64
//@ needs-asm-support
use std::arch::asm;
//@ add-minicore
//@ compile-flags: --target aarch64-unknown-linux-gnu
//@ needs-llvm-components: aarch64
//@ ignore-backends: gcc
#![crate_type = "lib"]
#![feature(no_core)]
#![no_core]
extern crate minicore;
use minicore::*;
macro_rules! m {
($in:ident $out:ident $lateout:ident $inout:ident $inlateout:ident $const:ident $sym:ident
@@ -1,5 +1,5 @@
error: the `nomem` and `readonly` options are mutually exclusive
--> $DIR/interpolated-idents.rs:13:13
--> $DIR/interpolated-idents.rs:20:13
|
LL | $options($pure, $nomem, $readonly, $preserves_flags, $noreturn, $nostack));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -12,7 +12,7 @@ LL | | noreturn nostack options);
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: the `pure` and `noreturn` options are mutually exclusive
--> $DIR/interpolated-idents.rs:13:13
--> $DIR/interpolated-idents.rs:20:13
|
LL | $options($pure, $nomem, $readonly, $preserves_flags, $noreturn, $nostack));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -25,7 +25,7 @@ LL | | noreturn nostack options);
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: asm outputs are not allowed with the `noreturn` option
--> $DIR/interpolated-idents.rs:10:32
--> $DIR/interpolated-idents.rs:17:32
|
LL | asm!("", $in(x) x, $out(x) x, $lateout(x) x, $inout(x) x, $inlateout(x) x,
| ^^^^^^^^^ ^^^^^^^^^^^^^ ^^^^^^^^^^^ ^^^^^^^^^^^^^^^
+9 -2
View File
@@ -1,6 +1,13 @@
//@ only-aarch64
//@ add-minicore
//@ compile-flags: --target aarch64-unknown-linux-gnu
//@ needs-llvm-components: aarch64
//@ ignore-backends: gcc
#![crate_type = "lib"]
#![feature(no_core)]
#![no_core]
use std::arch::asm;
extern crate minicore;
use minicore::*;
fn main() {
let mut foo = 0;
+5 -5
View File
@@ -1,11 +1,11 @@
error: explicit register arguments cannot have names
--> $DIR/parse-error.rs:9:18
--> $DIR/parse-error.rs:16:18
|
LL | asm!("", a = in("x0") foo);
| ^^^^^^^^^^^^^^^^
error: positional arguments cannot follow named arguments or explicit register arguments
--> $DIR/parse-error.rs:15:35
--> $DIR/parse-error.rs:22:35
|
LL | asm!("{1}", in("x0") foo, const bar);
| ------------ ^^^^^^^^^ positional argument
@@ -13,7 +13,7 @@ LL | asm!("{1}", in("x0") foo, const bar);
| explicit register argument
error[E0435]: attempt to use a non-constant value in a constant
--> $DIR/parse-error.rs:11:45
--> $DIR/parse-error.rs:18:45
|
LL | asm!("{a}", in("x0") foo, a = const bar);
| ^^^ non-constant value
@@ -25,7 +25,7 @@ LL + const bar: /* Type */ = 0;
|
error[E0435]: attempt to use a non-constant value in a constant
--> $DIR/parse-error.rs:13:45
--> $DIR/parse-error.rs:20:45
|
LL | asm!("{a}", in("x0") foo, a = const bar);
| ^^^ non-constant value
@@ -37,7 +37,7 @@ LL + const bar: /* Type */ = 0;
|
error[E0435]: attempt to use a non-constant value in a constant
--> $DIR/parse-error.rs:15:41
--> $DIR/parse-error.rs:22:41
|
LL | asm!("{1}", in("x0") foo, const bar);
| ^^^ non-constant value
+11 -4
View File
@@ -1,12 +1,19 @@
//@ only-aarch64
//@ add-minicore
//@ build-fail
//@ needs-asm-support
//@ compile-flags: -Ccodegen-units=1
//@ compile-flags: --target aarch64-unknown-linux-gnu -Ccodegen-units=1
//@ needs-llvm-components: aarch64
//@ ignore-backends: gcc
#![crate_type = "lib"]
#![feature(no_core)]
#![no_core]
use std::arch::asm;
extern crate minicore;
use minicore::*;
// Checks that inline asm errors are mapped to the correct line in the source code.
#[unsafe(no_mangle)]
#[rustfmt::skip]
fn main() {
unsafe {
asm!("invalid_instruction");
+47 -47
View File
@@ -1,5 +1,5 @@
error: unrecognized instruction mnemonic
--> $DIR/srcloc.rs:12:15
--> $DIR/srcloc.rs:19:15
|
LL | asm!("invalid_instruction");
| ^^^^^^^^^^^^^^^^^^^
@@ -11,7 +11,7 @@ LL | invalid_instruction
| ^
error: unrecognized instruction mnemonic
--> $DIR/srcloc.rs:16:13
--> $DIR/srcloc.rs:23:13
|
LL | invalid_instruction
| ^^^^^^^^^^^^^^^^^^^
@@ -23,7 +23,7 @@ LL | invalid_instruction
| ^
error: unrecognized instruction mnemonic
--> $DIR/srcloc.rs:21:13
--> $DIR/srcloc.rs:28:13
|
LL | invalid_instruction
| ^^^^^^^^^^^^^^^^^^^
@@ -34,18 +34,6 @@ note: instantiated into assembly here
LL | invalid_instruction
| ^
error: unrecognized instruction mnemonic
--> $DIR/srcloc.rs:27:13
|
LL | invalid_instruction
| ^^^^^^^^^^^^^^^^^^^
|
note: instantiated into assembly here
--> <inline asm>:3:13
|
LL | invalid_instruction
| ^
error: unrecognized instruction mnemonic
--> $DIR/srcloc.rs:34:13
|
@@ -59,7 +47,19 @@ LL | invalid_instruction
| ^
error: unrecognized instruction mnemonic
--> $DIR/srcloc.rs:39:14
--> $DIR/srcloc.rs:41:13
|
LL | invalid_instruction
| ^^^^^^^^^^^^^^^^^^^
|
note: instantiated into assembly here
--> <inline asm>:3:13
|
LL | invalid_instruction
| ^
error: unrecognized instruction mnemonic
--> $DIR/srcloc.rs:46:14
|
LL | asm!(concat!("invalid", "_", "instruction"));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -71,7 +71,7 @@ LL | invalid_instruction
| ^
error: unrecognized instruction mnemonic
--> $DIR/srcloc.rs:43:14
--> $DIR/srcloc.rs:50:14
|
LL | "invalid_instruction",
| ^^^^^^^^^^^^^^^^^^^
@@ -82,18 +82,6 @@ note: instantiated into assembly here
LL | invalid_instruction
| ^
error: unrecognized instruction mnemonic
--> $DIR/srcloc.rs:49:14
|
LL | "invalid_instruction",
| ^^^^^^^^^^^^^^^^^^^
|
note: instantiated into assembly here
--> <inline asm>:2:1
|
LL | invalid_instruction
| ^
error: unrecognized instruction mnemonic
--> $DIR/srcloc.rs:56:14
|
@@ -101,19 +89,19 @@ LL | "invalid_instruction",
| ^^^^^^^^^^^^^^^^^^^
|
note: instantiated into assembly here
--> <inline asm>:3:1
--> <inline asm>:2:1
|
LL | invalid_instruction
| ^
error: unrecognized instruction mnemonic
--> $DIR/srcloc.rs:63:13
--> $DIR/srcloc.rs:63:14
|
LL | concat!("invalid", "_", "instruction"),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | "invalid_instruction",
| ^^^^^^^^^^^^^^^^^^^
|
note: instantiated into assembly here
--> <inline asm>:2:1
--> <inline asm>:3:1
|
LL | invalid_instruction
| ^
@@ -131,7 +119,19 @@ LL | invalid_instruction
| ^
error: unrecognized instruction mnemonic
--> $DIR/srcloc.rs:77:14
--> $DIR/srcloc.rs:77:13
|
LL | concat!("invalid", "_", "instruction"),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: instantiated into assembly here
--> <inline asm>:2:1
|
LL | invalid_instruction
| ^
error: unrecognized instruction mnemonic
--> $DIR/srcloc.rs:84:14
|
LL | "invalid_instruction1",
| ^^^^^^^^^^^^^^^^^^^^
@@ -143,7 +143,7 @@ LL | invalid_instruction1
| ^
error: unrecognized instruction mnemonic
--> $DIR/srcloc.rs:78:14
--> $DIR/srcloc.rs:85:14
|
LL | "invalid_instruction2",
| ^^^^^^^^^^^^^^^^^^^^
@@ -155,7 +155,7 @@ LL | invalid_instruction2
| ^
error: unrecognized instruction mnemonic
--> $DIR/srcloc.rs:84:13
--> $DIR/srcloc.rs:91:13
|
LL | / concat!(
LL | | "invalid", "_", "instruction1", "\n",
@@ -170,7 +170,7 @@ LL | invalid_instruction1
| ^
error: unrecognized instruction mnemonic
--> $DIR/srcloc.rs:84:13
--> $DIR/srcloc.rs:91:13
|
LL | / concat!(
LL | | "invalid", "_", "instruction1", "\n",
@@ -185,7 +185,7 @@ LL | invalid_instruction2
| ^
error: unrecognized instruction mnemonic
--> $DIR/srcloc.rs:93:13
--> $DIR/srcloc.rs:100:13
|
LL | / concat!(
LL | | "invalid", "_", "instruction1", "\n",
@@ -200,7 +200,7 @@ LL | invalid_instruction1
| ^
error: unrecognized instruction mnemonic
--> $DIR/srcloc.rs:93:13
--> $DIR/srcloc.rs:100:13
|
LL | / concat!(
LL | | "invalid", "_", "instruction1", "\n",
@@ -215,7 +215,7 @@ LL | invalid_instruction2
| ^
error: unrecognized instruction mnemonic
--> $DIR/srcloc.rs:97:13
--> $DIR/srcloc.rs:104:13
|
LL | / concat!(
LL | | "invalid", "_", "instruction3", "\n",
@@ -230,7 +230,7 @@ LL | invalid_instruction3
| ^
error: unrecognized instruction mnemonic
--> $DIR/srcloc.rs:97:13
--> $DIR/srcloc.rs:104:13
|
LL | / concat!(
LL | | "invalid", "_", "instruction3", "\n",
@@ -245,7 +245,7 @@ LL | invalid_instruction4
| ^
error: unrecognized instruction mnemonic
--> $DIR/srcloc.rs:108:13
--> $DIR/srcloc.rs:115:13
|
LL | / concat!(
LL | | "invalid", "_", "instruction1", "\n",
@@ -260,7 +260,7 @@ LL | invalid_instruction1
| ^
error: unrecognized instruction mnemonic
--> $DIR/srcloc.rs:108:13
--> $DIR/srcloc.rs:115:13
|
LL | / concat!(
LL | | "invalid", "_", "instruction1", "\n",
@@ -275,7 +275,7 @@ LL | invalid_instruction2
| ^
error: unrecognized instruction mnemonic
--> $DIR/srcloc.rs:112:13
--> $DIR/srcloc.rs:119:13
|
LL | / concat!(
LL | | "invalid", "_", "instruction3", "\n",
@@ -290,7 +290,7 @@ LL | invalid_instruction3
| ^
error: unrecognized instruction mnemonic
--> $DIR/srcloc.rs:112:13
--> $DIR/srcloc.rs:119:13
|
LL | / concat!(
LL | | "invalid", "_", "instruction3", "\n",
@@ -305,7 +305,7 @@ LL | invalid_instruction4
| ^
error: unrecognized instruction mnemonic
--> $DIR/srcloc.rs:125:14
--> $DIR/srcloc.rs:132:14
|
LL | "invalid_instruction"
| ^^^^^^^^^^^^^^^^^^^
+10 -2
View File
@@ -1,7 +1,15 @@
//! Regression test for #97724, recognising ttbr0_el2 as a valid armv8 system register
//@ only-aarch64
//@ add-minicore
//@ build-pass
use std::arch::asm;
//@ compile-flags: --target aarch64-unknown-linux-gnu
//@ needs-llvm-components: aarch64
//@ ignore-backends: gcc
#![crate_type = "lib"]
#![feature(no_core)]
#![no_core]
extern crate minicore;
use minicore::*;
static PT: [u64; 512] = [0; 512];
fn main() {
+8 -3
View File
@@ -1,7 +1,12 @@
//@ needs-asm-support
//@ only-x86_64
//@ add-minicore
//@ compile-flags: --target x86_64-unknown-linux-gnu
//@ needs-llvm-components: x86
#![crate_type = "lib"]
#![feature(no_core)]
#![no_core]
use std::arch::asm;
extern crate minicore;
use minicore::*;
// checks various modes of failure for the `clobber_abi` argument (after parsing)
+10 -10
View File
@@ -1,5 +1,5 @@
error: invalid ABI for `clobber_abi`
--> $DIR/bad-clobber-abi.rs:11:18
--> $DIR/bad-clobber-abi.rs:16:18
|
LL | asm!("", clobber_abi("foo"));
| ^^^^^^^^^^^^^^^^^^
@@ -7,7 +7,7 @@ LL | asm!("", clobber_abi("foo"));
= note: the following ABIs are supported on this target: `C`, `system`, `efiapi`, `win64`, and `sysv64`
error: invalid ABI for `clobber_abi`
--> $DIR/bad-clobber-abi.rs:13:35
--> $DIR/bad-clobber-abi.rs:18:35
|
LL | asm!("", clobber_abi("C", "foo"));
| ^^^^^
@@ -15,7 +15,7 @@ LL | asm!("", clobber_abi("C", "foo"));
= note: the following ABIs are supported on this target: `C`, `system`, `efiapi`, `win64`, and `sysv64`
error: `C` ABI specified multiple times
--> $DIR/bad-clobber-abi.rs:15:35
--> $DIR/bad-clobber-abi.rs:20:35
|
LL | asm!("", clobber_abi("C", "C"));
| --- ^^^
@@ -23,7 +23,7 @@ LL | asm!("", clobber_abi("C", "C"));
| previously specified here
error: `win64` ABI specified multiple times
--> $DIR/bad-clobber-abi.rs:18:39
--> $DIR/bad-clobber-abi.rs:23:39
|
LL | asm!("", clobber_abi("win64", "efiapi"));
| ------- ^^^^^^^^
@@ -33,7 +33,7 @@ LL | asm!("", clobber_abi("win64", "efiapi"));
= note: these ABIs are equivalent on the current target
error: invalid ABI for `clobber_abi`
--> $DIR/bad-clobber-abi.rs:20:35
--> $DIR/bad-clobber-abi.rs:25:35
|
LL | asm!("", clobber_abi("C", "foo", "C"));
| ^^^^^
@@ -41,7 +41,7 @@ LL | asm!("", clobber_abi("C", "foo", "C"));
= note: the following ABIs are supported on this target: `C`, `system`, `efiapi`, `win64`, and `sysv64`
error: `C` ABI specified multiple times
--> $DIR/bad-clobber-abi.rs:20:42
--> $DIR/bad-clobber-abi.rs:25:42
|
LL | asm!("", clobber_abi("C", "foo", "C"));
| --- ^^^
@@ -49,7 +49,7 @@ LL | asm!("", clobber_abi("C", "foo", "C"));
| previously specified here
error: invalid ABI for `clobber_abi`
--> $DIR/bad-clobber-abi.rs:23:39
--> $DIR/bad-clobber-abi.rs:28:39
|
LL | asm!("", clobber_abi("win64", "foo", "efiapi"));
| ^^^^^
@@ -57,7 +57,7 @@ LL | asm!("", clobber_abi("win64", "foo", "efiapi"));
= note: the following ABIs are supported on this target: `C`, `system`, `efiapi`, `win64`, and `sysv64`
error: `win64` ABI specified multiple times
--> $DIR/bad-clobber-abi.rs:23:46
--> $DIR/bad-clobber-abi.rs:28:46
|
LL | asm!("", clobber_abi("win64", "foo", "efiapi"));
| ------- ^^^^^^^^
@@ -67,7 +67,7 @@ LL | asm!("", clobber_abi("win64", "foo", "efiapi"));
= note: these ABIs are equivalent on the current target
error: `C` ABI specified multiple times
--> $DIR/bad-clobber-abi.rs:26:36
--> $DIR/bad-clobber-abi.rs:31:36
|
LL | asm!("", clobber_abi("C"), clobber_abi("C"));
| ---------------- ^^^^^^^^^^^^^^^^
@@ -75,7 +75,7 @@ LL | asm!("", clobber_abi("C"), clobber_abi("C"));
| previously specified here
error: `win64` ABI specified multiple times
--> $DIR/bad-clobber-abi.rs:29:40
--> $DIR/bad-clobber-abi.rs:34:40
|
LL | asm!("", clobber_abi("win64"), clobber_abi("efiapi"));
| -------------------- ^^^^^^^^^^^^^^^^^^^^^
+8 -3
View File
@@ -1,8 +1,13 @@
//@ only-x86_64
//@ add-minicore
//@ compile-flags: --target x86_64-unknown-linux-gnu
//@ needs-llvm-components: x86
#![crate_type = "lib"]
#![feature(no_core)]
#![no_core]
#![feature(asm_unwind)]
use std::arch::{asm, global_asm};
extern crate minicore;
use minicore::*;
fn main() {
let mut foo = 0;
+16 -16
View File
@@ -1,41 +1,41 @@
error: the `nomem` and `readonly` options are mutually exclusive
--> $DIR/bad-options.rs:10:18
--> $DIR/bad-options.rs:15:18
|
LL | asm!("", options(nomem, readonly));
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: the `pure` and `noreturn` options are mutually exclusive
--> $DIR/bad-options.rs:12:18
--> $DIR/bad-options.rs:17:18
|
LL | asm!("", options(pure, nomem, noreturn));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: asm with the `pure` option must have at least one output
--> $DIR/bad-options.rs:12:18
--> $DIR/bad-options.rs:17:18
|
LL | asm!("", options(pure, nomem, noreturn));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: asm with the `pure` option must have at least one output
--> $DIR/bad-options.rs:15:33
--> $DIR/bad-options.rs:20:33
|
LL | asm!("{}", in(reg) foo, options(pure, nomem));
| ^^^^^^^^^^^^^^^^^^^^
error: asm outputs are not allowed with the `noreturn` option
--> $DIR/bad-options.rs:17:20
--> $DIR/bad-options.rs:22:20
|
LL | asm!("{}", out(reg) foo, options(noreturn));
| ^^^^^^^^^^^^
error: asm labels are not allowed with the `may_unwind` option
--> $DIR/bad-options.rs:19:20
--> $DIR/bad-options.rs:24:20
|
LL | asm!("{}", label {}, options(may_unwind));
| ^^^^^^^^
error: asm with `clobber_abi` must specify explicit registers for outputs
--> $DIR/bad-options.rs:26:20
--> $DIR/bad-options.rs:31:20
|
LL | asm!("{}", out(reg) foo, clobber_abi("C"));
| ^^^^^^^^^^^^ ---------------- clobber_abi
@@ -43,7 +43,7 @@ LL | asm!("{}", out(reg) foo, clobber_abi("C"));
| generic outputs
error: asm with `clobber_abi` must specify explicit registers for outputs
--> $DIR/bad-options.rs:28:20
--> $DIR/bad-options.rs:33:20
|
LL | asm!("{}", out(reg) foo, clobber_abi("C"), clobber_abi("C"));
| ^^^^^^^^^^^^ ---------------- ---------------- clobber_abi
@@ -52,43 +52,43 @@ LL | asm!("{}", out(reg) foo, clobber_abi("C"), clobber_abi("C"));
| generic outputs
error: the `nomem` option cannot be used with `global_asm!`
--> $DIR/bad-options.rs:35:25
--> $DIR/bad-options.rs:40:25
|
LL | global_asm!("", options(nomem));
| ^^^^^ the `nomem` option is not meaningful for global-scoped inline assembly
error: the `readonly` option cannot be used with `global_asm!`
--> $DIR/bad-options.rs:37:25
--> $DIR/bad-options.rs:42:25
|
LL | global_asm!("", options(readonly));
| ^^^^^^^^ the `readonly` option is not meaningful for global-scoped inline assembly
error: the `noreturn` option cannot be used with `global_asm!`
--> $DIR/bad-options.rs:39:25
--> $DIR/bad-options.rs:44:25
|
LL | global_asm!("", options(noreturn));
| ^^^^^^^^ the `noreturn` option is not meaningful for global-scoped inline assembly
error: the `pure` option cannot be used with `global_asm!`
--> $DIR/bad-options.rs:41:25
--> $DIR/bad-options.rs:46:25
|
LL | global_asm!("", options(pure));
| ^^^^ the `pure` option is not meaningful for global-scoped inline assembly
error: the `nostack` option cannot be used with `global_asm!`
--> $DIR/bad-options.rs:43:25
--> $DIR/bad-options.rs:48:25
|
LL | global_asm!("", options(nostack));
| ^^^^^^^ the `nostack` option is not meaningful for global-scoped inline assembly
error: the `preserves_flags` option cannot be used with `global_asm!`
--> $DIR/bad-options.rs:45:25
--> $DIR/bad-options.rs:50:25
|
LL | global_asm!("", options(preserves_flags));
| ^^^^^^^^^^^^^^^ the `preserves_flags` option is not meaningful for global-scoped inline assembly
error: invalid ABI for `clobber_abi`
--> $DIR/bad-options.rs:24:18
--> $DIR/bad-options.rs:29:18
|
LL | asm!("", clobber_abi("foo"));
| ^^^^^^^^^^^^^^^^^^
@@ -96,7 +96,7 @@ LL | asm!("", clobber_abi("foo"));
= note: the following ABIs are supported on this target: `C`, `system`, `efiapi`, `win64`, and `sysv64`
error: `C` ABI specified multiple times
--> $DIR/bad-options.rs:28:52
--> $DIR/bad-options.rs:33:52
|
LL | asm!("{}", out(reg) foo, clobber_abi("C"), clobber_abi("C"));
| ---------------- ^^^^^^^^^^^^^^^^

Some files were not shown because too many files have changed in this diff Show More