diff --git a/rust-version b/rust-version index c2850a9f9f..58b6e1f49e 100644 --- a/rust-version +++ b/rust-version @@ -1 +1 @@ -6c65d4f47f82836f303026ec70f752e30d586bd4 +23b04c0513472f3728ad482398008e077979e5c4 diff --git a/src/intrinsics/simd.rs b/src/intrinsics/simd.rs index 85d7459bb4..aa91b89d0e 100644 --- a/src/intrinsics/simd.rs +++ b/src/intrinsics/simd.rs @@ -50,8 +50,8 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { | "bitreverse" => { let [op] = check_arg_count(args)?; - let (op, op_len) = this.operand_to_simd(op)?; - let (dest, dest_len) = this.mplace_to_simd(dest)?; + let (op, op_len) = this.project_to_simd(op)?; + let (dest, dest_len) = this.project_to_simd(dest)?; assert_eq!(dest_len, op_len); @@ -200,9 +200,9 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { use mir::BinOp; let [left, right] = check_arg_count(args)?; - let (left, left_len) = this.operand_to_simd(left)?; - let (right, right_len) = this.operand_to_simd(right)?; - let (dest, dest_len) = this.mplace_to_simd(dest)?; + let (left, left_len) = this.project_to_simd(left)?; + let (right, right_len) = this.project_to_simd(right)?; + let (dest, dest_len) = this.project_to_simd(dest)?; assert_eq!(dest_len, left_len); assert_eq!(dest_len, right_len); @@ -291,10 +291,10 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { } "fma" => { let [a, b, c] = check_arg_count(args)?; - let (a, a_len) = this.operand_to_simd(a)?; - let (b, b_len) = this.operand_to_simd(b)?; - let (c, c_len) = this.operand_to_simd(c)?; - let (dest, dest_len) = this.mplace_to_simd(dest)?; + let (a, a_len) = this.project_to_simd(a)?; + let (b, b_len) = this.project_to_simd(b)?; + let (c, c_len) = this.project_to_simd(c)?; + let (dest, dest_len) = this.project_to_simd(dest)?; assert_eq!(dest_len, a_len); assert_eq!(dest_len, b_len); @@ -345,7 +345,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { use mir::BinOp; let [op] = check_arg_count(args)?; - let (op, op_len) = this.operand_to_simd(op)?; + let (op, op_len) = this.project_to_simd(op)?; let imm_from_bool = |b| ImmTy::from_scalar(Scalar::from_bool(b), this.machine.layouts.bool); @@ -408,7 +408,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { use mir::BinOp; let [op, init] = check_arg_count(args)?; - let (op, op_len) = this.operand_to_simd(op)?; + let (op, op_len) = this.project_to_simd(op)?; let init = this.read_immediate(init)?; let mir_op = match intrinsic_name { @@ -426,10 +426,10 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { } "select" => { let [mask, yes, no] = check_arg_count(args)?; - let (mask, mask_len) = this.operand_to_simd(mask)?; - let (yes, yes_len) = this.operand_to_simd(yes)?; - let (no, no_len) = this.operand_to_simd(no)?; - let (dest, dest_len) = this.mplace_to_simd(dest)?; + let (mask, mask_len) = this.project_to_simd(mask)?; + let (yes, yes_len) = this.project_to_simd(yes)?; + let (no, no_len) = this.project_to_simd(no)?; + let (dest, dest_len) = this.project_to_simd(dest)?; assert_eq!(dest_len, mask_len); assert_eq!(dest_len, yes_len); @@ -448,9 +448,9 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { // Variant of `select` that takes a bitmask rather than a "vector of bool". "select_bitmask" => { let [mask, yes, no] = check_arg_count(args)?; - let (yes, yes_len) = this.operand_to_simd(yes)?; - let (no, no_len) = this.operand_to_simd(no)?; - let (dest, dest_len) = this.mplace_to_simd(dest)?; + let (yes, yes_len) = this.project_to_simd(yes)?; + let (no, no_len) = this.project_to_simd(no)?; + let (dest, dest_len) = this.project_to_simd(dest)?; let bitmask_len = dest_len.next_multiple_of(8); if bitmask_len > 64 { throw_unsup_format!( @@ -522,7 +522,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { // Converts a "vector of bool" into a bitmask. "bitmask" => { let [op] = check_arg_count(args)?; - let (op, op_len) = this.operand_to_simd(op)?; + let (op, op_len) = this.project_to_simd(op)?; let bitmask_len = op_len.next_multiple_of(8); if bitmask_len > 64 { throw_unsup_format!( @@ -570,8 +570,8 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { } "cast" | "as" | "cast_ptr" | "expose_provenance" | "with_exposed_provenance" => { let [op] = check_arg_count(args)?; - let (op, op_len) = this.operand_to_simd(op)?; - let (dest, dest_len) = this.mplace_to_simd(dest)?; + let (op, op_len) = this.project_to_simd(op)?; + let (dest, dest_len) = this.project_to_simd(dest)?; assert_eq!(dest_len, op_len); @@ -627,9 +627,9 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { } "shuffle_generic" => { let [left, right] = check_arg_count(args)?; - let (left, left_len) = this.operand_to_simd(left)?; - let (right, right_len) = this.operand_to_simd(right)?; - let (dest, dest_len) = this.mplace_to_simd(dest)?; + let (left, left_len) = this.project_to_simd(left)?; + let (right, right_len) = this.project_to_simd(right)?; + let (dest, dest_len) = this.project_to_simd(dest)?; let index = generic_args[2] .expect_const() @@ -662,15 +662,15 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { } "shuffle" => { let [left, right, index] = check_arg_count(args)?; - let (left, left_len) = this.operand_to_simd(left)?; - let (right, right_len) = this.operand_to_simd(right)?; - let (dest, dest_len) = this.mplace_to_simd(dest)?; + let (left, left_len) = this.project_to_simd(left)?; + let (right, right_len) = this.project_to_simd(right)?; + let (dest, dest_len) = this.project_to_simd(dest)?; // `index` is an array or a SIMD type let (index, index_len) = match index.layout.ty.kind() { // FIXME: remove this once `index` must always be a SIMD vector. - ty::Array(..) => (index.assert_mem_place(), index.len(this)?), - _ => this.operand_to_simd(index)?, + ty::Array(..) => (index.clone(), index.len(this)?), + _ => this.project_to_simd(index)?, }; assert_eq!(left_len, right_len); @@ -699,10 +699,10 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { } "gather" => { let [passthru, ptrs, mask] = check_arg_count(args)?; - let (passthru, passthru_len) = this.operand_to_simd(passthru)?; - let (ptrs, ptrs_len) = this.operand_to_simd(ptrs)?; - let (mask, mask_len) = this.operand_to_simd(mask)?; - let (dest, dest_len) = this.mplace_to_simd(dest)?; + let (passthru, passthru_len) = this.project_to_simd(passthru)?; + let (ptrs, ptrs_len) = this.project_to_simd(ptrs)?; + let (mask, mask_len) = this.project_to_simd(mask)?; + let (dest, dest_len) = this.project_to_simd(dest)?; assert_eq!(dest_len, passthru_len); assert_eq!(dest_len, ptrs_len); @@ -725,9 +725,9 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { } "scatter" => { let [value, ptrs, mask] = check_arg_count(args)?; - let (value, value_len) = this.operand_to_simd(value)?; - let (ptrs, ptrs_len) = this.operand_to_simd(ptrs)?; - let (mask, mask_len) = this.operand_to_simd(mask)?; + let (value, value_len) = this.project_to_simd(value)?; + let (ptrs, ptrs_len) = this.project_to_simd(ptrs)?; + let (mask, mask_len) = this.project_to_simd(mask)?; assert_eq!(ptrs_len, value_len); assert_eq!(ptrs_len, mask_len); @@ -745,10 +745,10 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { } "masked_load" => { let [mask, ptr, default] = check_arg_count(args)?; - let (mask, mask_len) = this.operand_to_simd(mask)?; + let (mask, mask_len) = this.project_to_simd(mask)?; let ptr = this.read_pointer(ptr)?; - let (default, default_len) = this.operand_to_simd(default)?; - let (dest, dest_len) = this.mplace_to_simd(dest)?; + let (default, default_len) = this.project_to_simd(default)?; + let (dest, dest_len) = this.project_to_simd(dest)?; assert_eq!(dest_len, mask_len); assert_eq!(dest_len, default_len); @@ -772,9 +772,9 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { } "masked_store" => { let [mask, ptr, vals] = check_arg_count(args)?; - let (mask, mask_len) = this.operand_to_simd(mask)?; + let (mask, mask_len) = this.project_to_simd(mask)?; let ptr = this.read_pointer(ptr)?; - let (vals, vals_len) = this.operand_to_simd(vals)?; + let (vals, vals_len) = this.project_to_simd(vals)?; assert_eq!(mask_len, vals_len); diff --git a/src/shims/foreign_items.rs b/src/shims/foreign_items.rs index 1b45bc2203..88ab012f97 100644 --- a/src/shims/foreign_items.rs +++ b/src/shims/foreign_items.rs @@ -903,8 +903,8 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> { name if name.starts_with("llvm.ctpop.v") => { let [op] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?; - let (op, op_len) = this.operand_to_simd(op)?; - let (dest, dest_len) = this.mplace_to_simd(dest)?; + let (op, op_len) = this.project_to_simd(op)?; + let (dest, dest_len) = this.project_to_simd(dest)?; assert_eq!(dest_len, op_len); diff --git a/src/shims/x86/avx.rs b/src/shims/x86/avx.rs index 2f6569e182..1ddc9efcf6 100644 --- a/src/shims/x86/avx.rs +++ b/src/shims/x86/avx.rs @@ -159,9 +159,9 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { let [data, control] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?; - let (data, data_len) = this.operand_to_simd(data)?; - let (control, control_len) = this.operand_to_simd(control)?; - let (dest, dest_len) = this.mplace_to_simd(dest)?; + let (data, data_len) = this.project_to_simd(data)?; + let (control, control_len) = this.project_to_simd(control)?; + let (dest, dest_len) = this.project_to_simd(dest)?; assert_eq!(dest_len, data_len); assert_eq!(dest_len, control_len); @@ -193,9 +193,9 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { let [data, control] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?; - let (data, data_len) = this.operand_to_simd(data)?; - let (control, control_len) = this.operand_to_simd(control)?; - let (dest, dest_len) = this.mplace_to_simd(dest)?; + let (data, data_len) = this.project_to_simd(data)?; + let (control, control_len) = this.project_to_simd(control)?; + let (dest, dest_len) = this.project_to_simd(dest)?; assert_eq!(dest_len, data_len); assert_eq!(dest_len, control_len); diff --git a/src/shims/x86/avx2.rs b/src/shims/x86/avx2.rs index 7f6c9336a9..74d4673bd8 100644 --- a/src/shims/x86/avx2.rs +++ b/src/shims/x86/avx2.rs @@ -62,10 +62,10 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { assert_eq!(dest.layout, src.layout); - let (src, _) = this.operand_to_simd(src)?; - let (offsets, offsets_len) = this.operand_to_simd(offsets)?; - let (mask, mask_len) = this.operand_to_simd(mask)?; - let (dest, dest_len) = this.mplace_to_simd(dest)?; + let (src, _) = this.project_to_simd(src)?; + let (offsets, offsets_len) = this.project_to_simd(offsets)?; + let (mask, mask_len) = this.project_to_simd(mask)?; + let (dest, dest_len) = this.project_to_simd(dest)?; // There are cases like dest: i32x4, offsets: i64x2 // If dest has more elements than offset, extra dest elements are filled with zero. @@ -118,9 +118,9 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { let [left, right] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?; - let (left, left_len) = this.operand_to_simd(left)?; - let (right, right_len) = this.operand_to_simd(right)?; - let (dest, dest_len) = this.mplace_to_simd(dest)?; + let (left, left_len) = this.project_to_simd(left)?; + let (right, right_len) = this.project_to_simd(right)?; + let (dest, dest_len) = this.project_to_simd(dest)?; assert_eq!(left_len, right_len); assert_eq!(dest_len.strict_mul(2), left_len); @@ -155,9 +155,9 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { let [left, right] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?; - let (left, left_len) = this.operand_to_simd(left)?; - let (right, right_len) = this.operand_to_simd(right)?; - let (dest, dest_len) = this.mplace_to_simd(dest)?; + let (left, left_len) = this.project_to_simd(left)?; + let (right, right_len) = this.project_to_simd(right)?; + let (dest, dest_len) = this.project_to_simd(dest)?; assert_eq!(left_len, right_len); assert_eq!(dest_len.strict_mul(2), left_len); @@ -271,9 +271,9 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { let [left, right] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?; - let (left, left_len) = this.operand_to_simd(left)?; - let (right, right_len) = this.operand_to_simd(right)?; - let (dest, dest_len) = this.mplace_to_simd(dest)?; + let (left, left_len) = this.project_to_simd(left)?; + let (right, right_len) = this.project_to_simd(right)?; + let (dest, dest_len) = this.project_to_simd(dest)?; assert_eq!(dest_len, left_len); assert_eq!(dest_len, right_len); @@ -330,9 +330,9 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { let [left, right] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?; - let (left, left_len) = this.operand_to_simd(left)?; - let (right, right_len) = this.operand_to_simd(right)?; - let (dest, dest_len) = this.mplace_to_simd(dest)?; + let (left, left_len) = this.project_to_simd(left)?; + let (right, right_len) = this.project_to_simd(right)?; + let (dest, dest_len) = this.project_to_simd(dest)?; assert_eq!(left_len, right_len); assert_eq!(left_len, dest_len.strict_mul(8)); @@ -363,9 +363,9 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { let [left, right] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?; - let (left, left_len) = this.operand_to_simd(left)?; - let (right, right_len) = this.operand_to_simd(right)?; - let (dest, dest_len) = this.mplace_to_simd(dest)?; + let (left, left_len) = this.project_to_simd(left)?; + let (right, right_len) = this.project_to_simd(right)?; + let (dest, dest_len) = this.project_to_simd(dest)?; assert_eq!(dest_len, left_len); assert_eq!(dest_len, right_len); diff --git a/src/shims/x86/mod.rs b/src/shims/x86/mod.rs index 305e59fa0c..d7241f87d0 100644 --- a/src/shims/x86/mod.rs +++ b/src/shims/x86/mod.rs @@ -314,9 +314,9 @@ fn bin_op_simd_float_first<'tcx, F: rustc_apfloat::Float>( right: &OpTy<'tcx>, dest: &MPlaceTy<'tcx>, ) -> InterpResult<'tcx, ()> { - let (left, left_len) = this.operand_to_simd(left)?; - let (right, right_len) = this.operand_to_simd(right)?; - let (dest, dest_len) = this.mplace_to_simd(dest)?; + let (left, left_len) = this.project_to_simd(left)?; + let (right, right_len) = this.project_to_simd(right)?; + let (dest, dest_len) = this.project_to_simd(dest)?; assert_eq!(dest_len, left_len); assert_eq!(dest_len, right_len); @@ -344,9 +344,9 @@ fn bin_op_simd_float_all<'tcx, F: rustc_apfloat::Float>( right: &OpTy<'tcx>, dest: &MPlaceTy<'tcx>, ) -> InterpResult<'tcx, ()> { - let (left, left_len) = this.operand_to_simd(left)?; - let (right, right_len) = this.operand_to_simd(right)?; - let (dest, dest_len) = this.mplace_to_simd(dest)?; + let (left, left_len) = this.project_to_simd(left)?; + let (right, right_len) = this.project_to_simd(right)?; + let (dest, dest_len) = this.project_to_simd(dest)?; assert_eq!(dest_len, left_len); assert_eq!(dest_len, right_len); @@ -430,8 +430,8 @@ fn unary_op_ss<'tcx>( op: &OpTy<'tcx>, dest: &MPlaceTy<'tcx>, ) -> InterpResult<'tcx, ()> { - let (op, op_len) = this.operand_to_simd(op)?; - let (dest, dest_len) = this.mplace_to_simd(dest)?; + let (op, op_len) = this.project_to_simd(op)?; + let (dest, dest_len) = this.project_to_simd(dest)?; assert_eq!(dest_len, op_len); @@ -453,8 +453,8 @@ fn unary_op_ps<'tcx>( op: &OpTy<'tcx>, dest: &MPlaceTy<'tcx>, ) -> InterpResult<'tcx, ()> { - let (op, op_len) = this.operand_to_simd(op)?; - let (dest, dest_len) = this.mplace_to_simd(dest)?; + let (op, op_len) = this.project_to_simd(op)?; + let (dest, dest_len) = this.project_to_simd(dest)?; assert_eq!(dest_len, op_len); @@ -491,8 +491,8 @@ fn shift_simd_by_scalar<'tcx>( which: ShiftOp, dest: &MPlaceTy<'tcx>, ) -> InterpResult<'tcx, ()> { - let (left, left_len) = this.operand_to_simd(left)?; - let (dest, dest_len) = this.mplace_to_simd(dest)?; + let (left, left_len) = this.project_to_simd(left)?; + let (dest, dest_len) = this.project_to_simd(dest)?; assert_eq!(dest_len, left_len); // `right` may have a different length, and we only care about its @@ -547,9 +547,9 @@ fn shift_simd_by_simd<'tcx>( which: ShiftOp, dest: &MPlaceTy<'tcx>, ) -> InterpResult<'tcx, ()> { - let (left, left_len) = this.operand_to_simd(left)?; - let (right, right_len) = this.operand_to_simd(right)?; - let (dest, dest_len) = this.mplace_to_simd(dest)?; + let (left, left_len) = this.project_to_simd(left)?; + let (right, right_len) = this.project_to_simd(right)?; + let (dest, dest_len) = this.project_to_simd(dest)?; assert_eq!(dest_len, left_len); assert_eq!(dest_len, right_len); @@ -613,9 +613,9 @@ fn round_first<'tcx, F: rustc_apfloat::Float>( rounding: &OpTy<'tcx>, dest: &MPlaceTy<'tcx>, ) -> InterpResult<'tcx, ()> { - let (left, left_len) = this.operand_to_simd(left)?; - let (right, right_len) = this.operand_to_simd(right)?; - let (dest, dest_len) = this.mplace_to_simd(dest)?; + let (left, left_len) = this.project_to_simd(left)?; + let (right, right_len) = this.project_to_simd(right)?; + let (dest, dest_len) = this.project_to_simd(dest)?; assert_eq!(dest_len, left_len); assert_eq!(dest_len, right_len); @@ -643,8 +643,8 @@ fn round_all<'tcx, F: rustc_apfloat::Float>( rounding: &OpTy<'tcx>, dest: &MPlaceTy<'tcx>, ) -> InterpResult<'tcx, ()> { - let (op, op_len) = this.operand_to_simd(op)?; - let (dest, dest_len) = this.mplace_to_simd(dest)?; + let (op, op_len) = this.project_to_simd(op)?; + let (dest, dest_len) = this.project_to_simd(dest)?; assert_eq!(dest_len, op_len); @@ -695,8 +695,8 @@ fn convert_float_to_int<'tcx>( rnd: rustc_apfloat::Round, dest: &MPlaceTy<'tcx>, ) -> InterpResult<'tcx, ()> { - let (op, op_len) = this.operand_to_simd(op)?; - let (dest, dest_len) = this.mplace_to_simd(dest)?; + let (op, op_len) = this.project_to_simd(op)?; + let (dest, dest_len) = this.project_to_simd(dest)?; // Output must be *signed* integers. assert!(matches!(dest.layout.field(this, 0).ty.kind(), ty::Int(_))); @@ -729,8 +729,8 @@ fn int_abs<'tcx>( op: &OpTy<'tcx>, dest: &MPlaceTy<'tcx>, ) -> InterpResult<'tcx, ()> { - let (op, op_len) = this.operand_to_simd(op)?; - let (dest, dest_len) = this.mplace_to_simd(dest)?; + let (op, op_len) = this.project_to_simd(op)?; + let (dest, dest_len) = this.project_to_simd(dest)?; assert_eq!(op_len, dest_len); @@ -906,8 +906,8 @@ fn test_bits_masked<'tcx>( ) -> InterpResult<'tcx, (bool, bool)> { assert_eq!(op.layout, mask.layout); - let (op, op_len) = this.operand_to_simd(op)?; - let (mask, mask_len) = this.operand_to_simd(mask)?; + let (op, op_len) = this.project_to_simd(op)?; + let (mask, mask_len) = this.project_to_simd(mask)?; assert_eq!(op_len, mask_len); @@ -937,8 +937,8 @@ fn test_high_bits_masked<'tcx>( ) -> InterpResult<'tcx, (bool, bool)> { assert_eq!(op.layout, mask.layout); - let (op, op_len) = this.operand_to_simd(op)?; - let (mask, mask_len) = this.operand_to_simd(mask)?; + let (op, op_len) = this.project_to_simd(op)?; + let (mask, mask_len) = this.project_to_simd(mask)?; assert_eq!(op_len, mask_len); @@ -967,8 +967,8 @@ fn mask_load<'tcx>( mask: &OpTy<'tcx>, dest: &MPlaceTy<'tcx>, ) -> InterpResult<'tcx, ()> { - let (mask, mask_len) = this.operand_to_simd(mask)?; - let (dest, dest_len) = this.mplace_to_simd(dest)?; + let (mask, mask_len) = this.project_to_simd(mask)?; + let (dest, dest_len) = this.project_to_simd(dest)?; assert_eq!(dest_len, mask_len); @@ -1000,8 +1000,8 @@ fn mask_store<'tcx>( mask: &OpTy<'tcx>, value: &OpTy<'tcx>, ) -> InterpResult<'tcx, ()> { - let (mask, mask_len) = this.operand_to_simd(mask)?; - let (value, value_len) = this.operand_to_simd(value)?; + let (mask, mask_len) = this.project_to_simd(mask)?; + let (value, value_len) = this.project_to_simd(value)?; assert_eq!(value_len, mask_len); @@ -1014,9 +1014,12 @@ fn mask_store<'tcx>( let value = this.project_index(&value, i)?; if this.read_scalar(&mask)?.to_uint(mask_item_size)? >> high_bit_offset != 0 { + // *Non-inbounds* pointer arithmetic to compute the destination. + // (That's why we can't use a place projection.) let ptr = ptr.wrapping_offset(value.layout.size * i, &this.tcx); - // Unaligned copy, which is what we want. - this.mem_copy(value.ptr(), ptr, value.layout.size, /*nonoverlapping*/ true)?; + // Deref the pointer *unaligned*, and do the copy. + let dest = this.ptr_to_mplace_unaligned(ptr, value.layout); + this.copy_op(&value, &dest)?; } } @@ -1095,9 +1098,9 @@ fn pmulhrsw<'tcx>( right: &OpTy<'tcx>, dest: &MPlaceTy<'tcx>, ) -> InterpResult<'tcx, ()> { - let (left, left_len) = this.operand_to_simd(left)?; - let (right, right_len) = this.operand_to_simd(right)?; - let (dest, dest_len) = this.mplace_to_simd(dest)?; + let (left, left_len) = this.project_to_simd(left)?; + let (right, right_len) = this.project_to_simd(right)?; + let (dest, dest_len) = this.project_to_simd(dest)?; assert_eq!(dest_len, left_len); assert_eq!(dest_len, right_len); @@ -1313,9 +1316,9 @@ fn psign<'tcx>( right: &OpTy<'tcx>, dest: &MPlaceTy<'tcx>, ) -> InterpResult<'tcx, ()> { - let (left, left_len) = this.operand_to_simd(left)?; - let (right, right_len) = this.operand_to_simd(right)?; - let (dest, dest_len) = this.mplace_to_simd(dest)?; + let (left, left_len) = this.project_to_simd(left)?; + let (right, right_len) = this.project_to_simd(right)?; + let (dest, dest_len) = this.project_to_simd(dest)?; assert_eq!(dest_len, left_len); assert_eq!(dest_len, right_len); diff --git a/src/shims/x86/sha.rs b/src/shims/x86/sha.rs index e9cc28be34..d9cd34377e 100644 --- a/src/shims/x86/sha.rs +++ b/src/shims/x86/sha.rs @@ -23,7 +23,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { // Prefix should have already been checked. let unprefixed_name = link_name.as_str().strip_prefix("llvm.x86.sha").unwrap(); - fn read<'c>(this: &mut MiriInterpCx<'c>, reg: &MPlaceTy<'c>) -> InterpResult<'c, [u32; 4]> { + fn read<'c>(this: &mut MiriInterpCx<'c>, reg: &OpTy<'c>) -> InterpResult<'c, [u32; 4]> { let mut res = [0; 4]; // We reverse the order because x86 is little endian but the copied implementation uses // big endian. @@ -53,10 +53,10 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { "256rnds2" => { let [a, b, k] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?; - let (a_reg, a_len) = this.operand_to_simd(a)?; - let (b_reg, b_len) = this.operand_to_simd(b)?; - let (k_reg, k_len) = this.operand_to_simd(k)?; - let (dest, dest_len) = this.mplace_to_simd(dest)?; + let (a_reg, a_len) = this.project_to_simd(a)?; + let (b_reg, b_len) = this.project_to_simd(b)?; + let (k_reg, k_len) = this.project_to_simd(k)?; + let (dest, dest_len) = this.project_to_simd(dest)?; assert_eq!(a_len, 4); assert_eq!(b_len, 4); @@ -74,9 +74,9 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { "256msg1" => { let [a, b] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?; - let (a_reg, a_len) = this.operand_to_simd(a)?; - let (b_reg, b_len) = this.operand_to_simd(b)?; - let (dest, dest_len) = this.mplace_to_simd(dest)?; + let (a_reg, a_len) = this.project_to_simd(a)?; + let (b_reg, b_len) = this.project_to_simd(b)?; + let (dest, dest_len) = this.project_to_simd(dest)?; assert_eq!(a_len, 4); assert_eq!(b_len, 4); @@ -92,9 +92,9 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { "256msg2" => { let [a, b] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?; - let (a_reg, a_len) = this.operand_to_simd(a)?; - let (b_reg, b_len) = this.operand_to_simd(b)?; - let (dest, dest_len) = this.mplace_to_simd(dest)?; + let (a_reg, a_len) = this.project_to_simd(a)?; + let (b_reg, b_len) = this.project_to_simd(b)?; + let (dest, dest_len) = this.project_to_simd(dest)?; assert_eq!(a_len, 4); assert_eq!(b_len, 4); diff --git a/src/shims/x86/sse.rs b/src/shims/x86/sse.rs index 07a4eaa85f..8de7ddc793 100644 --- a/src/shims/x86/sse.rs +++ b/src/shims/x86/sse.rs @@ -130,8 +130,8 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { let [left, right] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?; - let (left, left_len) = this.operand_to_simd(left)?; - let (right, right_len) = this.operand_to_simd(right)?; + let (left, left_len) = this.project_to_simd(left)?; + let (right, right_len) = this.project_to_simd(right)?; assert_eq!(left_len, right_len); @@ -157,7 +157,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { // Converts the first component of `op` from f32 to i32/i64. "cvtss2si" | "cvttss2si" | "cvtss2si64" | "cvttss2si64" => { let [op] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?; - let (op, _) = this.operand_to_simd(op)?; + let (op, _) = this.project_to_simd(op)?; let op = this.read_immediate(&this.project_index(&op, 0)?)?; @@ -187,8 +187,8 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { let [left, right] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?; - let (left, left_len) = this.operand_to_simd(left)?; - let (dest, dest_len) = this.mplace_to_simd(dest)?; + let (left, left_len) = this.project_to_simd(left)?; + let (dest, dest_len) = this.project_to_simd(dest)?; assert_eq!(dest_len, left_len); diff --git a/src/shims/x86/sse2.rs b/src/shims/x86/sse2.rs index 163d74a6de..bdb52a04a9 100644 --- a/src/shims/x86/sse2.rs +++ b/src/shims/x86/sse2.rs @@ -42,9 +42,9 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { let [left, right] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?; - let (left, left_len) = this.operand_to_simd(left)?; - let (right, right_len) = this.operand_to_simd(right)?; - let (dest, dest_len) = this.mplace_to_simd(dest)?; + let (left, left_len) = this.project_to_simd(left)?; + let (right, right_len) = this.project_to_simd(right)?; + let (dest, dest_len) = this.project_to_simd(dest)?; assert_eq!(left_len, right_len); assert_eq!(dest_len.strict_mul(2), left_len); @@ -81,9 +81,9 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { let [left, right] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?; - let (left, left_len) = this.operand_to_simd(left)?; - let (right, right_len) = this.operand_to_simd(right)?; - let (dest, dest_len) = this.mplace_to_simd(dest)?; + let (left, left_len) = this.project_to_simd(left)?; + let (right, right_len) = this.project_to_simd(right)?; + let (dest, dest_len) = this.project_to_simd(dest)?; // left and right are u8x16, dest is u64x2 assert_eq!(left_len, right_len); @@ -270,8 +270,8 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { let [left, right] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?; - let (left, left_len) = this.operand_to_simd(left)?; - let (right, right_len) = this.operand_to_simd(right)?; + let (left, left_len) = this.project_to_simd(left)?; + let (right, right_len) = this.project_to_simd(right)?; assert_eq!(left_len, right_len); @@ -297,7 +297,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { // Converts the first component of `op` from f64 to i32/i64. "cvtsd2si" | "cvttsd2si" | "cvtsd2si64" | "cvttsd2si64" => { let [op] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?; - let (op, _) = this.operand_to_simd(op)?; + let (op, _) = this.project_to_simd(op)?; let op = this.read_immediate(&this.project_index(&op, 0)?)?; @@ -325,9 +325,9 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { let [left, right] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?; - let (left, left_len) = this.operand_to_simd(left)?; - let (right, _) = this.operand_to_simd(right)?; - let (dest, dest_len) = this.mplace_to_simd(dest)?; + let (left, left_len) = this.project_to_simd(left)?; + let (right, _) = this.project_to_simd(right)?; + let (dest, dest_len) = this.project_to_simd(dest)?; assert_eq!(dest_len, left_len); diff --git a/src/shims/x86/sse41.rs b/src/shims/x86/sse41.rs index 9e048fb9eb..8fcdc491c0 100644 --- a/src/shims/x86/sse41.rs +++ b/src/shims/x86/sse41.rs @@ -29,9 +29,9 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { let [left, right, imm] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?; - let (left, left_len) = this.operand_to_simd(left)?; - let (right, right_len) = this.operand_to_simd(right)?; - let (dest, dest_len) = this.mplace_to_simd(dest)?; + let (left, left_len) = this.project_to_simd(left)?; + let (right, right_len) = this.project_to_simd(right)?; + let (dest, dest_len) = this.project_to_simd(dest)?; assert_eq!(dest_len, left_len); assert_eq!(dest_len, right_len); @@ -118,8 +118,8 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { "phminposuw" => { let [op] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?; - let (op, op_len) = this.operand_to_simd(op)?; - let (dest, dest_len) = this.mplace_to_simd(dest)?; + let (op, op_len) = this.project_to_simd(op)?; + let (dest, dest_len) = this.project_to_simd(dest)?; // Find minimum let mut min_value = u16::MAX; diff --git a/src/shims/x86/ssse3.rs b/src/shims/x86/ssse3.rs index ecacaeb9af..096b0fb9e4 100644 --- a/src/shims/x86/ssse3.rs +++ b/src/shims/x86/ssse3.rs @@ -34,9 +34,9 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { let [left, right] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?; - let (left, left_len) = this.operand_to_simd(left)?; - let (right, right_len) = this.operand_to_simd(right)?; - let (dest, dest_len) = this.mplace_to_simd(dest)?; + let (left, left_len) = this.project_to_simd(left)?; + let (right, right_len) = this.project_to_simd(right)?; + let (dest, dest_len) = this.project_to_simd(dest)?; assert_eq!(dest_len, left_len); assert_eq!(dest_len, right_len); @@ -84,9 +84,9 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { let [left, right] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?; - let (left, left_len) = this.operand_to_simd(left)?; - let (right, right_len) = this.operand_to_simd(right)?; - let (dest, dest_len) = this.mplace_to_simd(dest)?; + let (left, left_len) = this.project_to_simd(left)?; + let (right, right_len) = this.project_to_simd(right)?; + let (dest, dest_len) = this.project_to_simd(dest)?; assert_eq!(left_len, right_len); assert_eq!(dest_len.strict_mul(2), left_len); diff --git a/tests/fail/alloc/deallocate-bad-alignment.rs b/tests/fail/alloc/deallocate-bad-alignment.rs index e8ba824db7..552a67419b 100644 --- a/tests/fail/alloc/deallocate-bad-alignment.rs +++ b/tests/fail/alloc/deallocate-bad-alignment.rs @@ -1,10 +1,8 @@ use std::alloc::{alloc, dealloc, Layout}; -//@error-in-other-file: has size 1 and alignment 1, but gave size 1 and alignment 2 - fn main() { unsafe { let x = alloc(Layout::from_size_align_unchecked(1, 1)); - dealloc(x, Layout::from_size_align_unchecked(1, 2)); + dealloc(x, Layout::from_size_align_unchecked(1, 2)); //~ERROR: has size 1 and alignment 1, but gave size 1 and alignment 2 } } diff --git a/tests/fail/alloc/deallocate-bad-alignment.stderr b/tests/fail/alloc/deallocate-bad-alignment.stderr index 40ed093198..d340413d23 100644 --- a/tests/fail/alloc/deallocate-bad-alignment.stderr +++ b/tests/fail/alloc/deallocate-bad-alignment.stderr @@ -1,18 +1,13 @@ error: Undefined Behavior: incorrect layout on deallocation: ALLOC has size 1 and alignment ALIGN, but gave size 1 and alignment ALIGN - --> RUSTLIB/alloc/src/alloc.rs:LL:CC + --> $DIR/deallocate-bad-alignment.rs:LL:CC | -LL | unsafe { __rust_dealloc(ptr, layout.size(), layout.align()) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect layout on deallocation: ALLOC has size 1 and alignment ALIGN, but gave size 1 and alignment ALIGN +LL | dealloc(x, Layout::from_size_align_unchecked(1, 2)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect layout on deallocation: ALLOC has size 1 and alignment ALIGN, but gave size 1 and alignment ALIGN | = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information = note: BACKTRACE: - = note: inside `std::alloc::dealloc` at RUSTLIB/alloc/src/alloc.rs:LL:CC -note: inside `main` - --> $DIR/deallocate-bad-alignment.rs:LL:CC - | -LL | dealloc(x, Layout::from_size_align_unchecked(1, 2)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: inside `main` at $DIR/deallocate-bad-alignment.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/alloc/deallocate-bad-size.rs b/tests/fail/alloc/deallocate-bad-size.rs index e3f9a20ac3..906a3b52a2 100644 --- a/tests/fail/alloc/deallocate-bad-size.rs +++ b/tests/fail/alloc/deallocate-bad-size.rs @@ -1,10 +1,8 @@ use std::alloc::{alloc, dealloc, Layout}; -//@error-in-other-file: has size 1 and alignment 1, but gave size 2 and alignment 1 - fn main() { unsafe { let x = alloc(Layout::from_size_align_unchecked(1, 1)); - dealloc(x, Layout::from_size_align_unchecked(2, 1)); + dealloc(x, Layout::from_size_align_unchecked(2, 1)); //~ERROR: has size 1 and alignment 1, but gave size 2 and alignment 1 } } diff --git a/tests/fail/alloc/deallocate-bad-size.stderr b/tests/fail/alloc/deallocate-bad-size.stderr index e9b935d2c8..b661b49c9f 100644 --- a/tests/fail/alloc/deallocate-bad-size.stderr +++ b/tests/fail/alloc/deallocate-bad-size.stderr @@ -1,18 +1,13 @@ error: Undefined Behavior: incorrect layout on deallocation: ALLOC has size 1 and alignment ALIGN, but gave size 2 and alignment ALIGN - --> RUSTLIB/alloc/src/alloc.rs:LL:CC + --> $DIR/deallocate-bad-size.rs:LL:CC | -LL | unsafe { __rust_dealloc(ptr, layout.size(), layout.align()) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect layout on deallocation: ALLOC has size 1 and alignment ALIGN, but gave size 2 and alignment ALIGN +LL | dealloc(x, Layout::from_size_align_unchecked(2, 1)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect layout on deallocation: ALLOC has size 1 and alignment ALIGN, but gave size 2 and alignment ALIGN | = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information = note: BACKTRACE: - = note: inside `std::alloc::dealloc` at RUSTLIB/alloc/src/alloc.rs:LL:CC -note: inside `main` - --> $DIR/deallocate-bad-size.rs:LL:CC - | -LL | dealloc(x, Layout::from_size_align_unchecked(2, 1)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: inside `main` at $DIR/deallocate-bad-size.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/alloc/deallocate-twice.rs b/tests/fail/alloc/deallocate-twice.rs index 7a3ff84b2c..ee514f4c55 100644 --- a/tests/fail/alloc/deallocate-twice.rs +++ b/tests/fail/alloc/deallocate-twice.rs @@ -1,11 +1,9 @@ use std::alloc::{alloc, dealloc, Layout}; -//@error-in-other-file: has been freed - fn main() { unsafe { let x = alloc(Layout::from_size_align_unchecked(1, 1)); dealloc(x, Layout::from_size_align_unchecked(1, 1)); - dealloc(x, Layout::from_size_align_unchecked(1, 1)); + dealloc(x, Layout::from_size_align_unchecked(1, 1)); //~ERROR: has been freed } } diff --git a/tests/fail/alloc/deallocate-twice.stderr b/tests/fail/alloc/deallocate-twice.stderr index 76abd96e24..32cdfa0d22 100644 --- a/tests/fail/alloc/deallocate-twice.stderr +++ b/tests/fail/alloc/deallocate-twice.stderr @@ -1,8 +1,8 @@ error: Undefined Behavior: memory access failed: ALLOC has been freed, so this pointer is dangling - --> RUSTLIB/alloc/src/alloc.rs:LL:CC + --> $DIR/deallocate-twice.rs:LL:CC | -LL | unsafe { __rust_dealloc(ptr, layout.size(), layout.align()) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: ALLOC has been freed, so this pointer is dangling +LL | dealloc(x, Layout::from_size_align_unchecked(1, 1)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: ALLOC has been freed, so this pointer is dangling | = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information @@ -17,12 +17,7 @@ help: ALLOC was deallocated here: LL | dealloc(x, Layout::from_size_align_unchecked(1, 1)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: BACKTRACE (of the first span): - = note: inside `std::alloc::dealloc` at RUSTLIB/alloc/src/alloc.rs:LL:CC -note: inside `main` - --> $DIR/deallocate-twice.rs:LL:CC - | -LL | dealloc(x, Layout::from_size_align_unchecked(1, 1)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: inside `main` at $DIR/deallocate-twice.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/alloc/reallocate-bad-size.rs b/tests/fail/alloc/reallocate-bad-size.rs index 49b2c62d7e..174e4f2276 100644 --- a/tests/fail/alloc/reallocate-bad-size.rs +++ b/tests/fail/alloc/reallocate-bad-size.rs @@ -1,10 +1,8 @@ use std::alloc::{alloc, realloc, Layout}; -//@error-in-other-file: has size 1 and alignment 1, but gave size 2 and alignment 1 - fn main() { unsafe { let x = alloc(Layout::from_size_align_unchecked(1, 1)); - let _y = realloc(x, Layout::from_size_align_unchecked(2, 1), 1); + let _y = realloc(x, Layout::from_size_align_unchecked(2, 1), 1); //~ERROR: has size 1 and alignment 1, but gave size 2 and alignment 1 } } diff --git a/tests/fail/alloc/reallocate-bad-size.stderr b/tests/fail/alloc/reallocate-bad-size.stderr index 5347e7a95a..965cbc4dd0 100644 --- a/tests/fail/alloc/reallocate-bad-size.stderr +++ b/tests/fail/alloc/reallocate-bad-size.stderr @@ -1,18 +1,13 @@ error: Undefined Behavior: incorrect layout on deallocation: ALLOC has size 1 and alignment ALIGN, but gave size 2 and alignment ALIGN - --> RUSTLIB/alloc/src/alloc.rs:LL:CC + --> $DIR/reallocate-bad-size.rs:LL:CC | -LL | unsafe { __rust_realloc(ptr, layout.size(), layout.align(), new_size) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect layout on deallocation: ALLOC has size 1 and alignment ALIGN, but gave size 2 and alignment ALIGN +LL | let _y = realloc(x, Layout::from_size_align_unchecked(2, 1), 1); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect layout on deallocation: ALLOC has size 1 and alignment ALIGN, but gave size 2 and alignment ALIGN | = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information = note: BACKTRACE: - = note: inside `std::alloc::realloc` at RUSTLIB/alloc/src/alloc.rs:LL:CC -note: inside `main` - --> $DIR/reallocate-bad-size.rs:LL:CC - | -LL | let _y = realloc(x, Layout::from_size_align_unchecked(2, 1), 1); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: inside `main` at $DIR/reallocate-bad-size.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/alloc/reallocate-dangling.rs b/tests/fail/alloc/reallocate-dangling.rs index 622348ad19..c605f68a7f 100644 --- a/tests/fail/alloc/reallocate-dangling.rs +++ b/tests/fail/alloc/reallocate-dangling.rs @@ -1,11 +1,9 @@ use std::alloc::{alloc, dealloc, realloc, Layout}; -//@error-in-other-file: has been freed - fn main() { unsafe { let x = alloc(Layout::from_size_align_unchecked(1, 1)); dealloc(x, Layout::from_size_align_unchecked(1, 1)); - let _z = realloc(x, Layout::from_size_align_unchecked(1, 1), 1); + let _z = realloc(x, Layout::from_size_align_unchecked(1, 1), 1); //~ERROR: has been freed } } diff --git a/tests/fail/alloc/reallocate-dangling.stderr b/tests/fail/alloc/reallocate-dangling.stderr index 9b8a892620..9a582b9b4c 100644 --- a/tests/fail/alloc/reallocate-dangling.stderr +++ b/tests/fail/alloc/reallocate-dangling.stderr @@ -1,8 +1,8 @@ error: Undefined Behavior: memory access failed: ALLOC has been freed, so this pointer is dangling - --> RUSTLIB/alloc/src/alloc.rs:LL:CC + --> $DIR/reallocate-dangling.rs:LL:CC | -LL | unsafe { __rust_realloc(ptr, layout.size(), layout.align(), new_size) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: ALLOC has been freed, so this pointer is dangling +LL | let _z = realloc(x, Layout::from_size_align_unchecked(1, 1), 1); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: ALLOC has been freed, so this pointer is dangling | = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information @@ -17,12 +17,7 @@ help: ALLOC was deallocated here: LL | dealloc(x, Layout::from_size_align_unchecked(1, 1)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: BACKTRACE (of the first span): - = note: inside `std::alloc::realloc` at RUSTLIB/alloc/src/alloc.rs:LL:CC -note: inside `main` - --> $DIR/reallocate-dangling.rs:LL:CC - | -LL | let _z = realloc(x, Layout::from_size_align_unchecked(1, 1), 1); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: inside `main` at $DIR/reallocate-dangling.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/alloc/stack_free.stderr b/tests/fail/alloc/stack_free.stderr index 2adec68c0d..36e78c1b7f 100644 --- a/tests/fail/alloc/stack_free.stderr +++ b/tests/fail/alloc/stack_free.stderr @@ -1,14 +1,12 @@ error: Undefined Behavior: deallocating ALLOC, which is stack variable memory, using Rust heap deallocation operation - --> RUSTLIB/alloc/src/alloc.rs:LL:CC + --> RUSTLIB/alloc/src/boxed.rs:LL:CC | -LL | unsafe { __rust_dealloc(ptr, layout.size(), layout.align()) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ deallocating ALLOC, which is stack variable memory, using Rust heap deallocation operation +LL | self.1.deallocate(From::from(ptr.cast()), layout); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ deallocating ALLOC, which is stack variable memory, using Rust heap deallocation operation | = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information = note: BACKTRACE: - = note: inside `std::alloc::dealloc` at RUSTLIB/alloc/src/alloc.rs:LL:CC - = note: inside `::deallocate` at RUSTLIB/alloc/src/alloc.rs:LL:CC = note: inside ` as std::ops::Drop>::drop` at RUSTLIB/alloc/src/boxed.rs:LL:CC = note: inside `std::ptr::drop_in_place::> - shim(Some(std::boxed::Box))` at RUSTLIB/core/src/ptr/mod.rs:LL:CC = note: inside `std::mem::drop::>` at RUSTLIB/core/src/mem/mod.rs:LL:CC diff --git a/tests/fail/both_borrows/newtype_pair_retagging.tree.stderr b/tests/fail/both_borrows/newtype_pair_retagging.tree.stderr index 0a54f14bb5..a344229eeb 100644 --- a/tests/fail/both_borrows/newtype_pair_retagging.tree.stderr +++ b/tests/fail/both_borrows/newtype_pair_retagging.tree.stderr @@ -1,8 +1,8 @@ error: Undefined Behavior: deallocation through at ALLOC[0x0] is forbidden - --> RUSTLIB/alloc/src/alloc.rs:LL:CC + --> RUSTLIB/alloc/src/boxed.rs:LL:CC | -LL | unsafe { __rust_dealloc(ptr, layout.size(), layout.align()) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ deallocation through at ALLOC[0x0] is forbidden +LL | self.1.deallocate(From::from(ptr.cast()), layout); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ deallocation through at ALLOC[0x0] is forbidden | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: the accessed tag is foreign to the protected tag (i.e., it is not a child) @@ -25,8 +25,6 @@ LL | || drop(Box::from_raw(ptr)), | ^^^^^^^^^^^^^^^^^^ = help: this transition corresponds to a temporary loss of write permissions until function exit = note: BACKTRACE (of the first span): - = note: inside `std::alloc::dealloc` at RUSTLIB/alloc/src/alloc.rs:LL:CC - = note: inside `::deallocate` at RUSTLIB/alloc/src/alloc.rs:LL:CC = note: inside ` as std::ops::Drop>::drop` at RUSTLIB/alloc/src/boxed.rs:LL:CC = note: inside `std::ptr::drop_in_place::> - shim(Some(std::boxed::Box))` at RUSTLIB/core/src/ptr/mod.rs:LL:CC = note: inside `std::mem::drop::>` at RUSTLIB/core/src/mem/mod.rs:LL:CC diff --git a/tests/fail/both_borrows/newtype_retagging.tree.stderr b/tests/fail/both_borrows/newtype_retagging.tree.stderr index 05f1d8822c..321ef39e62 100644 --- a/tests/fail/both_borrows/newtype_retagging.tree.stderr +++ b/tests/fail/both_borrows/newtype_retagging.tree.stderr @@ -1,8 +1,8 @@ error: Undefined Behavior: deallocation through at ALLOC[0x0] is forbidden - --> RUSTLIB/alloc/src/alloc.rs:LL:CC + --> RUSTLIB/alloc/src/boxed.rs:LL:CC | -LL | unsafe { __rust_dealloc(ptr, layout.size(), layout.align()) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ deallocation through at ALLOC[0x0] is forbidden +LL | self.1.deallocate(From::from(ptr.cast()), layout); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ deallocation through at ALLOC[0x0] is forbidden | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: the accessed tag is foreign to the protected tag (i.e., it is not a child) @@ -25,8 +25,6 @@ LL | || drop(Box::from_raw(ptr)), | ^^^^^^^^^^^^^^^^^^ = help: this transition corresponds to a temporary loss of write permissions until function exit = note: BACKTRACE (of the first span): - = note: inside `std::alloc::dealloc` at RUSTLIB/alloc/src/alloc.rs:LL:CC - = note: inside `::deallocate` at RUSTLIB/alloc/src/alloc.rs:LL:CC = note: inside ` as std::ops::Drop>::drop` at RUSTLIB/alloc/src/boxed.rs:LL:CC = note: inside `std::ptr::drop_in_place::> - shim(Some(std::boxed::Box))` at RUSTLIB/core/src/ptr/mod.rs:LL:CC = note: inside `std::mem::drop::>` at RUSTLIB/core/src/mem/mod.rs:LL:CC diff --git a/tests/fail/both_borrows/zero-sized-protected.rs b/tests/fail/both_borrows/zero-sized-protected.rs index aed5cb1125..c8060d4c9c 100644 --- a/tests/fail/both_borrows/zero-sized-protected.rs +++ b/tests/fail/both_borrows/zero-sized-protected.rs @@ -1,13 +1,12 @@ //@revisions: stack tree //@[tree]compile-flags: -Zmiri-tree-borrows -//@[tree]error-in-other-file: /deallocation .* is forbidden/ use std::alloc::{alloc, dealloc, Layout}; // `x` is strongly protected but covers zero bytes. // Let's see if deallocating the allocation x points to is UB: // in TB, it is UB, but in SB it is not. fn test(_x: &mut (), ptr: *mut u8, l: Layout) { - unsafe { dealloc(ptr, l) }; + unsafe { dealloc(ptr, l) }; //~[tree] ERROR: /deallocation .* is forbidden/ } fn main() { diff --git a/tests/fail/both_borrows/zero-sized-protected.tree.stderr b/tests/fail/both_borrows/zero-sized-protected.tree.stderr index ef981038e5..e798833058 100644 --- a/tests/fail/both_borrows/zero-sized-protected.tree.stderr +++ b/tests/fail/both_borrows/zero-sized-protected.tree.stderr @@ -1,8 +1,8 @@ error: Undefined Behavior: deallocation through (root of the allocation) at ALLOC[0x0] is forbidden - --> RUSTLIB/alloc/src/alloc.rs:LL:CC + --> $DIR/zero-sized-protected.rs:LL:CC | -LL | unsafe { __rust_dealloc(ptr, layout.size(), layout.align()) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ deallocation through (root of the allocation) at ALLOC[0x0] is forbidden +LL | unsafe { dealloc(ptr, l) }; + | ^^^^^^^^^^^^^^^ deallocation through (root of the allocation) at ALLOC[0x0] is forbidden | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: the allocation of the accessed tag (root of the allocation) also contains the strongly protected tag @@ -18,12 +18,7 @@ help: the strongly protected tag was created here, in the initial state Re LL | fn test(_x: &mut (), ptr: *mut u8, l: Layout) { | ^^ = note: BACKTRACE (of the first span): - = note: inside `std::alloc::dealloc` at RUSTLIB/alloc/src/alloc.rs:LL:CC -note: inside `test` - --> $DIR/zero-sized-protected.rs:LL:CC - | -LL | unsafe { dealloc(ptr, l) }; - | ^^^^^^^^^^^^^^^ + = note: inside `test` at $DIR/zero-sized-protected.rs:LL:CC note: inside `main` --> $DIR/zero-sized-protected.rs:LL:CC | diff --git a/tests/fail/memleak.rs b/tests/fail/memleak.rs index 984b44d6d4..8ffa457be9 100644 --- a/tests/fail/memleak.rs +++ b/tests/fail/memleak.rs @@ -1,6 +1,5 @@ -//@error-in-other-file: memory leaked //@normalize-stderr-test: ".*│.*" -> "$$stripped$$" fn main() { - std::mem::forget(Box::new(42)); + std::mem::forget(Box::new(42)); //~ERROR: memory leaked } diff --git a/tests/fail/memleak.stderr b/tests/fail/memleak.stderr index a9ee76fbe8..d303225516 100644 --- a/tests/fail/memleak.stderr +++ b/tests/fail/memleak.stderr @@ -1,20 +1,11 @@ error: memory leaked: ALLOC (Rust heap, size: 4, align: 4), allocated here: - --> RUSTLIB/alloc/src/alloc.rs:LL:CC - | -LL | __rust_alloc(layout.size(), layout.align()) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: BACKTRACE: - = note: inside `std::alloc::alloc` at RUSTLIB/alloc/src/alloc.rs:LL:CC - = note: inside `std::alloc::Global::alloc_impl` at RUSTLIB/alloc/src/alloc.rs:LL:CC - = note: inside `::allocate` at RUSTLIB/alloc/src/alloc.rs:LL:CC - = note: inside `alloc::alloc::exchange_malloc` at RUSTLIB/alloc/src/alloc.rs:LL:CC - = note: inside `std::boxed::Box::::new` at RUSTLIB/alloc/src/boxed.rs:LL:CC -note: inside `main` --> $DIR/memleak.rs:LL:CC | LL | std::mem::forget(Box::new(42)); | ^^^^^^^^^^^^ + | + = note: BACKTRACE: + = note: inside `main` at $DIR/memleak.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/memleak_rc.stderr b/tests/fail/memleak_rc.stderr index dbf2daf818..91166384ad 100644 --- a/tests/fail/memleak_rc.stderr +++ b/tests/fail/memleak_rc.stderr @@ -1,15 +1,10 @@ error: memory leaked: ALLOC (Rust heap, SIZE, ALIGN), allocated here: - --> RUSTLIB/alloc/src/alloc.rs:LL:CC + --> RUSTLIB/alloc/src/rc.rs:LL:CC | -LL | __rust_alloc(layout.size(), layout.align()) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | Box::leak(Box::new(RcBox { strong: Cell::new(1), weak: Cell::new(1), value })) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: BACKTRACE: - = note: inside `std::alloc::alloc` at RUSTLIB/alloc/src/alloc.rs:LL:CC - = note: inside `std::alloc::Global::alloc_impl` at RUSTLIB/alloc/src/alloc.rs:LL:CC - = note: inside `::allocate` at RUSTLIB/alloc/src/alloc.rs:LL:CC - = note: inside `alloc::alloc::exchange_malloc` at RUSTLIB/alloc/src/alloc.rs:LL:CC - = note: inside `std::boxed::Box::>>>::new` at RUSTLIB/alloc/src/boxed.rs:LL:CC = note: inside `std::rc::Rc::>>::new` at RUSTLIB/alloc/src/rc.rs:LL:CC note: inside `main` --> $DIR/memleak_rc.rs:LL:CC diff --git a/tests/fail/stacked_borrows/deallocate_against_protector1.stderr b/tests/fail/stacked_borrows/deallocate_against_protector1.stderr index 2a8d4f3aea..31a6722ea0 100644 --- a/tests/fail/stacked_borrows/deallocate_against_protector1.stderr +++ b/tests/fail/stacked_borrows/deallocate_against_protector1.stderr @@ -1,14 +1,12 @@ error: Undefined Behavior: deallocating while item [Unique for ] is strongly protected - --> RUSTLIB/alloc/src/alloc.rs:LL:CC + --> RUSTLIB/alloc/src/boxed.rs:LL:CC | -LL | unsafe { __rust_dealloc(ptr, layout.size(), layout.align()) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ deallocating while item [Unique for ] is strongly protected +LL | self.1.deallocate(From::from(ptr.cast()), layout); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ deallocating while item [Unique for ] is strongly protected | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Stacked Borrows rules it violated are still experimental = help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md for further information = note: BACKTRACE: - = note: inside `std::alloc::dealloc` at RUSTLIB/alloc/src/alloc.rs:LL:CC - = note: inside `::deallocate` at RUSTLIB/alloc/src/alloc.rs:LL:CC = note: inside ` as std::ops::Drop>::drop` at RUSTLIB/alloc/src/boxed.rs:LL:CC = note: inside `std::ptr::drop_in_place::> - shim(Some(std::boxed::Box))` at RUSTLIB/core/src/ptr/mod.rs:LL:CC = note: inside `std::mem::drop::>` at RUSTLIB/core/src/mem/mod.rs:LL:CC diff --git a/tests/fail/stacked_borrows/illegal_dealloc1.rs b/tests/fail/stacked_borrows/illegal_dealloc1.rs index b2ec23bda0..76a5e6a0b6 100644 --- a/tests/fail/stacked_borrows/illegal_dealloc1.rs +++ b/tests/fail/stacked_borrows/illegal_dealloc1.rs @@ -1,4 +1,3 @@ -//@error-in-other-file: /deallocation .* tag does not exist in the borrow stack/ use std::alloc::{alloc, dealloc, Layout}; fn main() { @@ -10,5 +9,6 @@ fn main() { ptr1.write(0); // Deallocate through ptr2. dealloc(ptr2, Layout::from_size_align_unchecked(1, 1)); + //~^ERROR: /deallocation .* tag does not exist in the borrow stack/ } } diff --git a/tests/fail/stacked_borrows/illegal_dealloc1.stderr b/tests/fail/stacked_borrows/illegal_dealloc1.stderr index 7a44c8384a..d06584d19d 100644 --- a/tests/fail/stacked_borrows/illegal_dealloc1.stderr +++ b/tests/fail/stacked_borrows/illegal_dealloc1.stderr @@ -1,8 +1,8 @@ error: Undefined Behavior: attempting deallocation using at ALLOC, but that tag does not exist in the borrow stack for this location - --> RUSTLIB/alloc/src/alloc.rs:LL:CC + --> $DIR/illegal_deALLOC.rs:LL:CC | -LL | unsafe { __rust_dealloc(ptr, layout.size(), layout.align()) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempting deallocation using at ALLOC, but that tag does not exist in the borrow stack for this location +LL | dealloc(ptr2, Layout::from_size_align_unchecked(1, 1)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempting deallocation using at ALLOC, but that tag does not exist in the borrow stack for this location | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Stacked Borrows rules it violated are still experimental = help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md for further information @@ -17,12 +17,7 @@ help: was later invalidated at offsets [0x0..0x1] by a write access LL | ptr1.write(0); | ^^^^^^^^^^^^^ = note: BACKTRACE (of the first span): - = note: inside `std::alloc::dealloc` at RUSTLIB/alloc/src/alloc.rs:LL:CC -note: inside `main` - --> $DIR/illegal_deALLOC.rs:LL:CC - | -LL | dealloc(ptr2, Layout::from_size_align_unchecked(1, 1)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: inside `main` at $DIR/illegal_deALLOC.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/tls_macro_leak.rs b/tests/fail/tls_macro_leak.rs index 996d7ed4a2..b8a4b81911 100644 --- a/tests/fail/tls_macro_leak.rs +++ b/tests/fail/tls_macro_leak.rs @@ -1,4 +1,3 @@ -//@error-in-other-file: memory leaked //@normalize-stderr-test: ".*│.*" -> "$$stripped$$" use std::cell::Cell; @@ -10,7 +9,7 @@ pub fn main() { std::thread::spawn(|| { TLS.with(|cell| { - cell.set(Some(Box::leak(Box::new(123)))); + cell.set(Some(Box::leak(Box::new(123)))); //~ERROR: memory leaked }); }) .join() diff --git a/tests/fail/tls_macro_leak.stderr b/tests/fail/tls_macro_leak.stderr index c7c641a30f..e485432815 100644 --- a/tests/fail/tls_macro_leak.stderr +++ b/tests/fail/tls_macro_leak.stderr @@ -1,20 +1,11 @@ error: memory leaked: ALLOC (Rust heap, size: 4, align: 4), allocated here: - --> RUSTLIB/alloc/src/alloc.rs:LL:CC - | -LL | __rust_alloc(layout.size(), layout.align()) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: BACKTRACE: - = note: inside `std::alloc::alloc` at RUSTLIB/alloc/src/alloc.rs:LL:CC - = note: inside `std::alloc::Global::alloc_impl` at RUSTLIB/alloc/src/alloc.rs:LL:CC - = note: inside `::allocate` at RUSTLIB/alloc/src/alloc.rs:LL:CC - = note: inside `alloc::alloc::exchange_malloc` at RUSTLIB/alloc/src/alloc.rs:LL:CC - = note: inside `std::boxed::Box::::new` at RUSTLIB/alloc/src/boxed.rs:LL:CC -note: inside closure --> $DIR/tls_macro_leak.rs:LL:CC | LL | cell.set(Some(Box::leak(Box::new(123)))); | ^^^^^^^^^^^^^ + | + = note: BACKTRACE: + = note: inside closure at $DIR/tls_macro_leak.rs:LL:CC = note: inside `std::thread::LocalKey::>>::try_with::<{closure@$DIR/tls_macro_leak.rs:LL:CC}, ()>` at RUSTLIB/std/src/thread/local.rs:LL:CC = note: inside `std::thread::LocalKey::>>::with::<{closure@$DIR/tls_macro_leak.rs:LL:CC}, ()>` at RUSTLIB/std/src/thread/local.rs:LL:CC note: inside closure diff --git a/tests/fail/tls_static_leak.rs b/tests/fail/tls_static_leak.rs index 637d648fb3..4d52803363 100644 --- a/tests/fail/tls_static_leak.rs +++ b/tests/fail/tls_static_leak.rs @@ -1,4 +1,3 @@ -//@error-in-other-file: memory leaked //@normalize-stderr-test: ".*│.*" -> "$$stripped$$" #![feature(thread_local)] @@ -12,7 +11,7 @@ pub fn main() { static TLS: Cell> = Cell::new(None); std::thread::spawn(|| { - TLS.set(Some(Box::leak(Box::new(123)))); + TLS.set(Some(Box::leak(Box::new(123)))); //~ERROR: memory leaked }) .join() .unwrap(); diff --git a/tests/fail/tls_static_leak.stderr b/tests/fail/tls_static_leak.stderr index f7b90a1118..06d71fb456 100644 --- a/tests/fail/tls_static_leak.stderr +++ b/tests/fail/tls_static_leak.stderr @@ -1,20 +1,11 @@ error: memory leaked: ALLOC (Rust heap, size: 4, align: 4), allocated here: - --> RUSTLIB/alloc/src/alloc.rs:LL:CC - | -LL | __rust_alloc(layout.size(), layout.align()) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: BACKTRACE: - = note: inside `std::alloc::alloc` at RUSTLIB/alloc/src/alloc.rs:LL:CC - = note: inside `std::alloc::Global::alloc_impl` at RUSTLIB/alloc/src/alloc.rs:LL:CC - = note: inside `::allocate` at RUSTLIB/alloc/src/alloc.rs:LL:CC - = note: inside `alloc::alloc::exchange_malloc` at RUSTLIB/alloc/src/alloc.rs:LL:CC - = note: inside `std::boxed::Box::::new` at RUSTLIB/alloc/src/boxed.rs:LL:CC -note: inside closure --> $DIR/tls_static_leak.rs:LL:CC | LL | TLS.set(Some(Box::leak(Box::new(123)))); | ^^^^^^^^^^^^^ + | + = note: BACKTRACE: + = note: inside closure at $DIR/tls_static_leak.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/tree_borrows/strongly-protected.stderr b/tests/fail/tree_borrows/strongly-protected.stderr index 9da43055af..2a7f69ff20 100644 --- a/tests/fail/tree_borrows/strongly-protected.stderr +++ b/tests/fail/tree_borrows/strongly-protected.stderr @@ -1,8 +1,8 @@ error: Undefined Behavior: deallocation through at ALLOC[0x0] is forbidden - --> RUSTLIB/alloc/src/alloc.rs:LL:CC + --> RUSTLIB/alloc/src/boxed.rs:LL:CC | -LL | unsafe { __rust_dealloc(ptr, layout.size(), layout.align()) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ deallocation through at ALLOC[0x0] is forbidden +LL | self.1.deallocate(From::from(ptr.cast()), layout); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ deallocation through at ALLOC[0x0] is forbidden | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: the allocation of the accessed tag also contains the strongly protected tag @@ -18,8 +18,6 @@ help: the strongly protected tag was created here, in the initial state Re LL | fn inner(x: &mut i32, f: fn(*mut i32)) { | ^ = note: BACKTRACE (of the first span): - = note: inside `std::alloc::dealloc` at RUSTLIB/alloc/src/alloc.rs:LL:CC - = note: inside `::deallocate` at RUSTLIB/alloc/src/alloc.rs:LL:CC = note: inside ` as std::ops::Drop>::drop` at RUSTLIB/alloc/src/boxed.rs:LL:CC = note: inside `std::ptr::drop_in_place::> - shim(Some(std::boxed::Box))` at RUSTLIB/core/src/ptr/mod.rs:LL:CC = note: inside `std::mem::drop::>` at RUSTLIB/core/src/mem/mod.rs:LL:CC