diff options
342 files changed, 2043 insertions, 945 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8b0a33841ad..1d1056de25c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -235,6 +235,9 @@ jobs: - name: dist-loongarch64-linux os: ubuntu-20.04-8core-32gb env: {} + - name: dist-ohos + os: ubuntu-20.04-8core-32gb + env: {} - name: dist-powerpc-linux os: ubuntu-20.04-8core-32gb env: {} diff --git a/compiler/rustc_attr/messages.ftl b/compiler/rustc_attr/messages.ftl index 7281282fec3..eb51e568f81 100644 --- a/compiler/rustc_attr/messages.ftl +++ b/compiler/rustc_attr/messages.ftl @@ -27,10 +27,16 @@ attr_incorrect_meta_item = attr_incorrect_repr_format_align_one_arg = incorrect `repr(align)` attribute format: `align` takes exactly one argument in parentheses +attr_incorrect_repr_format_expect_literal_integer = + incorrect `repr(align)` attribute format: `align` expects a literal integer as argument + attr_incorrect_repr_format_generic = incorrect `repr({$repr_arg})` attribute format .suggestion = use parentheses instead +attr_incorrect_repr_format_packed_expect_integer = + incorrect `repr(packed)` attribute format: `packed` expects a literal integer as argument + attr_incorrect_repr_format_packed_one_or_zero_arg = incorrect `repr(packed)` attribute format: `packed` takes exactly one parenthesized argument, or no parentheses at all diff --git a/compiler/rustc_attr/src/builtin.rs b/compiler/rustc_attr/src/builtin.rs index f414ff746bb..3d2cf25e98b 100644 --- a/compiler/rustc_attr/src/builtin.rs +++ b/compiler/rustc_attr/src/builtin.rs @@ -984,17 +984,24 @@ pub fn parse_repr_attr(sess: &Session, attr: &Attribute) -> Vec<ReprAttr> { } } else if let Some((name, value)) = item.name_value_literal() { let mut literal_error = None; + let mut err_span = item.span(); if name == sym::align { recognised = true; match parse_alignment(&value.kind) { Ok(literal) => acc.push(ReprAlign(literal)), - Err(message) => literal_error = Some(message), + Err(message) => { + err_span = value.span; + literal_error = Some(message) + } }; } else if name == sym::packed { recognised = true; match parse_alignment(&value.kind) { Ok(literal) => acc.push(ReprPacked(literal)), - Err(message) => literal_error = Some(message), + Err(message) => { + err_span = value.span; + literal_error = Some(message) + } }; } else if matches!(name, sym::Rust | sym::C | sym::simd | sym::transparent) || int_type_of_word(name).is_some() @@ -1007,7 +1014,7 @@ pub fn parse_repr_attr(sess: &Session, attr: &Attribute) -> Vec<ReprAttr> { } if let Some(literal_error) = literal_error { sess.dcx().emit_err(session_diagnostics::InvalidReprGeneric { - span: item.span(), + span: err_span, repr_arg: name.to_ident_string(), error_part: literal_error, }); @@ -1039,21 +1046,37 @@ pub fn parse_repr_attr(sess: &Session, attr: &Attribute) -> Vec<ReprAttr> { }); } } - MetaItemKind::List(_) => { + MetaItemKind::List(nested_items) => { if meta_item.has_name(sym::align) { recognised = true; - sess.dcx().emit_err( - session_diagnostics::IncorrectReprFormatAlignOneArg { - span: meta_item.span, - }, - ); + if nested_items.len() == 1 { + sess.dcx().emit_err( + session_diagnostics::IncorrectReprFormatExpectInteger { + span: nested_items[0].span(), + }, + ); + } else { + sess.dcx().emit_err( + session_diagnostics::IncorrectReprFormatAlignOneArg { + span: meta_item.span, + }, + ); + } } else if meta_item.has_name(sym::packed) { recognised = true; - sess.dcx().emit_err( - session_diagnostics::IncorrectReprFormatPackedOneOrZeroArg { - span: meta_item.span, - }, - ); + if nested_items.len() == 1 { + sess.dcx().emit_err( + session_diagnostics::IncorrectReprFormatPackedExpectInteger { + span: nested_items[0].span(), + }, + ); + } else { + sess.dcx().emit_err( + session_diagnostics::IncorrectReprFormatPackedOneOrZeroArg { + span: meta_item.span, + }, + ); + } } else if matches!( meta_item.name_or_empty(), sym::Rust | sym::C | sym::simd | sym::transparent diff --git a/compiler/rustc_attr/src/session_diagnostics.rs b/compiler/rustc_attr/src/session_diagnostics.rs index 8cbd401d300..f489cc87bc7 100644 --- a/compiler/rustc_attr/src/session_diagnostics.rs +++ b/compiler/rustc_attr/src/session_diagnostics.rs @@ -170,6 +170,12 @@ pub(crate) struct IncorrectReprFormatPackedOneOrZeroArg { #[primary_span] pub span: Span, } +#[derive(Diagnostic)] +#[diag(attr_incorrect_repr_format_packed_expect_integer, code = E0552)] +pub(crate) struct IncorrectReprFormatPackedExpectInteger { + #[primary_span] + pub span: Span, +} #[derive(Diagnostic)] #[diag(attr_invalid_repr_hint_no_paren, code = E0552)] @@ -253,6 +259,13 @@ pub(crate) struct IncorrectReprFormatAlignOneArg { } #[derive(Diagnostic)] +#[diag(attr_incorrect_repr_format_expect_literal_integer, code = E0693)] +pub(crate) struct IncorrectReprFormatExpectInteger { + #[primary_span] + pub span: Span, +} + +#[derive(Diagnostic)] #[diag(attr_incorrect_repr_format_generic, code = E0693)] pub(crate) struct IncorrectReprFormatGeneric<'a> { #[primary_span] diff --git a/compiler/rustc_codegen_gcc/src/builder.rs b/compiler/rustc_codegen_gcc/src/builder.rs index 7e2139866f4..71a0a4c2e96 100644 --- a/compiler/rustc_codegen_gcc/src/builder.rs +++ b/compiler/rustc_codegen_gcc/src/builder.rs @@ -834,10 +834,13 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> { } else if let abi::Abi::ScalarPair(ref a, ref b) = place.layout.abi { let b_offset = a.size(self).align_to(b.align(self).abi); - let pair_type = place.layout.gcc_type(self); let mut load = |i, scalar: &abi::Scalar, align| { - let llptr = self.struct_gep(pair_type, place.llval, i as u64); + let llptr = if i == 0 { + place.llval + } else { + self.inbounds_ptradd(place.llval, self.const_usize(b_offset.bytes())) + }; let llty = place.layout.scalar_pair_element_gcc_type(self, i); let load = self.load(llty, llptr, align); scalar_load_metadata(self, load, scalar); @@ -971,33 +974,6 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> { result.get_address(None) } - fn struct_gep(&mut self, value_type: Type<'gcc>, ptr: RValue<'gcc>, idx: u64) -> RValue<'gcc> { - // FIXME(antoyo): it would be better if the API only called this on struct, not on arrays. - assert_eq!(idx as usize as u64, idx); - let value = ptr.dereference(None).to_rvalue(); - - if value_type.dyncast_array().is_some() { - let index = self.context.new_rvalue_from_long(self.u64_type, i64::try_from(idx).expect("i64::try_from")); - let element = self.context.new_array_access(None, value, index); - element.get_address(None) - } - else if let Some(vector_type) = value_type.dyncast_vector() { - let array_type = vector_type.get_element_type().make_pointer(); - let array = self.bitcast(ptr, array_type); - let index = self.context.new_rvalue_from_long(self.u64_type, i64::try_from(idx).expect("i64::try_from")); - let element = self.context.new_array_access(None, array, index); - element.get_address(None) - } - else if let Some(struct_type) = value_type.is_struct() { - // NOTE: due to opaque pointers now being used, we need to bitcast here. - let ptr = self.bitcast_if_needed(ptr, value_type.make_pointer()); - ptr.dereference_field(None, struct_type.get_field(idx as i32)).get_address(None) - } - else { - panic!("Unexpected type {:?}", value_type); - } - } - /* Casts */ fn trunc(&mut self, value: RValue<'gcc>, dest_ty: Type<'gcc>) -> RValue<'gcc> { // TODO(antoyo): check that it indeed truncate the value. diff --git a/compiler/rustc_codegen_gcc/src/type_of.rs b/compiler/rustc_codegen_gcc/src/type_of.rs index 62136d24a2c..5a9212762b7 100644 --- a/compiler/rustc_codegen_gcc/src/type_of.rs +++ b/compiler/rustc_codegen_gcc/src/type_of.rs @@ -151,7 +151,6 @@ pub trait LayoutGccExt<'tcx> { fn immediate_gcc_type<'gcc>(&self, cx: &CodegenCx<'gcc, 'tcx>) -> Type<'gcc>; fn scalar_gcc_type_at<'gcc>(&self, cx: &CodegenCx<'gcc, 'tcx>, scalar: &abi::Scalar, offset: Size) -> Type<'gcc>; fn scalar_pair_element_gcc_type<'gcc>(&self, cx: &CodegenCx<'gcc, 'tcx>, index: usize) -> Type<'gcc>; - fn gcc_field_index(&self, index: usize) -> u64; fn pointee_info_at<'gcc>(&self, cx: &CodegenCx<'gcc, 'tcx>, offset: Size) -> Option<PointeeInfo>; } @@ -306,24 +305,6 @@ impl<'tcx> LayoutGccExt<'tcx> for TyAndLayout<'tcx> { self.scalar_gcc_type_at(cx, scalar, offset) } - fn gcc_field_index(&self, index: usize) -> u64 { - match self.abi { - Abi::Scalar(_) | Abi::ScalarPair(..) => { - bug!("TyAndLayout::gcc_field_index({:?}): not applicable", self) - } - _ => {} - } - match self.fields { - FieldsShape::Primitive | FieldsShape::Union(_) => { - bug!("TyAndLayout::gcc_field_index({:?}): not applicable", self) - } - - FieldsShape::Array { .. } => index as u64, - - FieldsShape::Arbitrary { .. } => 1 + (self.fields.memory_index(index) as u64) * 2, - } - } - fn pointee_info_at<'a>(&self, cx: &CodegenCx<'a, 'tcx>, offset: Size) -> Option<PointeeInfo> { if let Some(&pointee) = cx.pointee_infos.borrow().get(&(self.ty, offset)) { return pointee; @@ -353,10 +334,6 @@ impl<'gcc, 'tcx> LayoutTypeMethods<'tcx> for CodegenCx<'gcc, 'tcx> { layout.is_gcc_scalar_pair() } - fn backend_field_index(&self, layout: TyAndLayout<'tcx>, index: usize) -> u64 { - layout.gcc_field_index(index) - } - fn scalar_pair_element_backend_type(&self, layout: TyAndLayout<'tcx>, index: usize, _immediate: bool) -> Type<'gcc> { layout.scalar_pair_element_gcc_type(self, index) } diff --git a/compiler/rustc_codegen_llvm/src/builder.rs b/compiler/rustc_codegen_llvm/src/builder.rs index 2110e62a9c4..eaedaec635f 100644 --- a/compiler/rustc_codegen_llvm/src/builder.rs +++ b/compiler/rustc_codegen_llvm/src/builder.rs @@ -603,11 +603,7 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { let llptr = if i == 0 { place.llval } else { - self.inbounds_gep( - self.type_i8(), - place.llval, - &[self.const_usize(b_offset.bytes())], - ) + self.inbounds_ptradd(place.llval, self.const_usize(b_offset.bytes())) }; let llty = place.layout.scalar_pair_element_llvm_type(self, i, false); let load = self.load(llty, llptr, align); @@ -778,11 +774,6 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { } } - fn struct_gep(&mut self, ty: &'ll Type, ptr: &'ll Value, idx: u64) -> &'ll Value { - assert_eq!(idx as c_uint as u64, idx); - unsafe { llvm::LLVMBuildStructGEP2(self.llbuilder, ty, ptr, idx as c_uint, UNNAMED) } - } - /* Casts */ fn trunc(&mut self, val: &'ll Value, dest_ty: &'ll Type) -> &'ll Value { unsafe { llvm::LLVMBuildTrunc(self.llbuilder, val, dest_ty, UNNAMED) } diff --git a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs index f4e83330874..952f41fbd90 100644 --- a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs +++ b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs @@ -1306,13 +1306,6 @@ extern "C" { NumIndices: c_uint, Name: *const c_char, ) -> &'a Value; - pub fn LLVMBuildStructGEP2<'a>( - B: &Builder<'a>, - Ty: &'a Type, - Pointer: &'a Value, - Idx: c_uint, - Name: *const c_char, - ) -> &'a Value; // Casts pub fn LLVMBuildTrunc<'a>( diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs b/compiler/rustc_codegen_llvm/src/llvm_util.rs index 1b2beac56a2..75a189aa87c 100644 --- a/compiler/rustc_codegen_llvm/src/llvm_util.rs +++ b/compiler/rustc_codegen_llvm/src/llvm_util.rs @@ -192,14 +192,11 @@ impl<'a> IntoIterator for LLVMFeature<'a> { // to LLVM or the feature detection code will walk past the end of the feature // array, leading to crashes. // -// To find a list of LLVM's names, check llvm-project/llvm/include/llvm/Support/*TargetParser.def -// where the * matches the architecture's name -// -// For targets not present in the above location, see llvm-project/llvm/lib/Target/{ARCH}/*.td +// To find a list of LLVM's names, see llvm-project/llvm/lib/Target/{ARCH}/*.td // where `{ARCH}` is the architecture name. Look for instances of `SubtargetFeature`. // -// Beware to not use the llvm github project for this, but check the git submodule -// found in src/llvm-project +// Check the current rustc fork of LLVM in the repo at https://github.com/rust-lang/llvm-project/. +// The commit in use can be found via the `llvm-project` submodule in https://github.com/rust-lang/rust/tree/master/src // Though note that Rust can also be build with an external precompiled version of LLVM // which might lead to failures if the oldest tested / supported LLVM version // doesn't yet support the relevant intrinsics diff --git a/compiler/rustc_codegen_llvm/src/type_.rs b/compiler/rustc_codegen_llvm/src/type_.rs index 8f180bab3df..07a4861ed73 100644 --- a/compiler/rustc_codegen_llvm/src/type_.rs +++ b/compiler/rustc_codegen_llvm/src/type_.rs @@ -261,9 +261,6 @@ impl<'ll, 'tcx> LayoutTypeMethods<'tcx> for CodegenCx<'ll, 'tcx> { fn is_backend_scalar_pair(&self, layout: TyAndLayout<'tcx>) -> bool { layout.is_llvm_scalar_pair() } - fn backend_field_index(&self, layout: TyAndLayout<'tcx>, index: usize) -> u64 { - layout.llvm_field_index(self, index) - } fn scalar_pair_element_backend_type( &self, layout: TyAndLayout<'tcx>, diff --git a/compiler/rustc_codegen_llvm/src/type_of.rs b/compiler/rustc_codegen_llvm/src/type_of.rs index 369dcfb7b8f..587adefe1d2 100644 --- a/compiler/rustc_codegen_llvm/src/type_of.rs +++ b/compiler/rustc_codegen_llvm/src/type_of.rs @@ -174,7 +174,6 @@ pub trait LayoutLlvmExt<'tcx> { index: usize, immediate: bool, ) -> &'a Type; - fn llvm_field_index<'a>(&self, cx: &CodegenCx<'a, 'tcx>, index: usize) -> u64; fn scalar_copy_llvm_type<'a>(&self, cx: &CodegenCx<'a, 'tcx>) -> Option<&'a Type>; } @@ -326,42 +325,6 @@ impl<'tcx> LayoutLlvmExt<'tcx> for TyAndLayout<'tcx> { self.scalar_llvm_type_at(cx, scalar) } - fn llvm_field_index<'a>(&self, cx: &CodegenCx<'a, 'tcx>, index: usize) -> u64 { - match self.abi { - Abi::Scalar(_) | Abi::ScalarPair(..) => { - bug!("TyAndLayout::llvm_field_index({:?}): not applicable", self) - } - _ => {} - } - match self.fields { - FieldsShape::Primitive | FieldsShape::Union(_) => { - bug!("TyAndLayout::llvm_field_index({:?}): not applicable", self) - } - - FieldsShape::Array { .. } => index as u64, - - FieldsShape::Arbitrary { .. } => { - let variant_index = match self.variants { - Variants::Single { index } => Some(index), - _ => None, - }; - - // Look up llvm field if indexes do not match memory order due to padding. If - // `field_remapping` is `None` no padding was used and the llvm field index - // matches the memory index. - match cx.type_lowering.borrow().get(&(self.ty, variant_index)) { - Some(TypeLowering { field_remapping: Some(ref remap), .. }) => { - remap[index] as u64 - } - Some(_) => self.fields.memory_index(index) as u64, - None => { - bug!("TyAndLayout::llvm_field_index({:?}): type info not found", self) - } - } - } - } - } - fn scalar_copy_llvm_type<'a>(&self, cx: &CodegenCx<'a, 'tcx>) -> Option<&'a Type> { debug_assert!(self.is_sized()); diff --git a/compiler/rustc_codegen_llvm/src/va_arg.rs b/compiler/rustc_codegen_llvm/src/va_arg.rs index 172c66a7af1..b406a04af74 100644 --- a/compiler/rustc_codegen_llvm/src/va_arg.rs +++ b/compiler/rustc_codegen_llvm/src/va_arg.rs @@ -44,12 +44,12 @@ fn emit_direct_ptr_va_arg<'ll, 'tcx>( let aligned_size = size.align_to(slot_size).bytes() as i32; let full_direct_size = bx.cx().const_i32(aligned_size); - let next = bx.inbounds_gep(bx.type_i8(), addr, &[full_direct_size]); + let next = bx.inbounds_ptradd(addr, full_direct_size); bx.store(next, va_list_addr, bx.tcx().data_layout.pointer_align.abi); if size.bytes() < slot_size.bytes() && bx.tcx().sess.target.endian == Endian::Big { let adjusted_size = bx.cx().const_i32((slot_size.bytes() - size.bytes()) as i32); - let adjusted = bx.inbounds_gep(bx.type_i8(), addr, &[adjusted_size]); + let adjusted = bx.inbounds_ptradd(addr, adjusted_size); (adjusted, addr_align) } else { (addr, addr_align) @@ -89,11 +89,31 @@ fn emit_aapcs_va_arg<'ll, 'tcx>( list: OperandRef<'tcx, &'ll Value>, target_ty: Ty<'tcx>, ) -> &'ll Value { + let dl = bx.cx.data_layout(); + // Implementation of the AAPCS64 calling convention for va_args see // https://github.com/ARM-software/abi-aa/blob/master/aapcs64/aapcs64.rst + // + // typedef struct va_list { + // void * stack; // next stack param + // void * gr_top; // end of GP arg reg save area + // void * vr_top; // end of FP/SIMD arg reg save area + // int gr_offs; // offset from gr_top to next GP register arg + // int vr_offs; // offset from vr_top to next FP/SIMD register arg + // } va_list; let va_list_addr = list.immediate(); - let va_list_layout = list.deref(bx.cx).layout; - let va_list_ty = va_list_layout.llvm_type(bx); + + // There is no padding between fields since `void*` is size=8 align=8, `int` is size=4 align=4. + // See https://github.com/ARM-software/abi-aa/blob/master/aapcs64/aapcs64.rst + // Table 1, Byte size and byte alignment of fundamental data types + // Table 3, Mapping of C & C++ built-in data types + let ptr_offset = 8; + let i32_offset = 4; + let gr_top = bx.inbounds_ptradd(va_list_addr, bx.cx.const_usize(ptr_offset)); + let vr_top = bx.inbounds_ptradd(va_list_addr, bx.cx.const_usize(2 * ptr_offset)); + let gr_offs = bx.inbounds_ptradd(va_list_addr, bx.cx.const_usize(3 * ptr_offset)); + let vr_offs = bx.inbounds_ptradd(va_list_addr, bx.cx.const_usize(3 * ptr_offset + i32_offset)); + let layout = bx.cx.layout_of(target_ty); let maybe_reg = bx.append_sibling_block("va_arg.maybe_reg"); @@ -104,16 +124,12 @@ fn emit_aapcs_va_arg<'ll, 'tcx>( let offset_align = Align::from_bytes(4).unwrap(); let gr_type = target_ty.is_any_ptr() || target_ty.is_integral(); - let (reg_off, reg_top_index, slot_size) = if gr_type { - let gr_offs = - bx.struct_gep(va_list_ty, va_list_addr, va_list_layout.llvm_field_index(bx.cx, 3)); + let (reg_off, reg_top, slot_size) = if gr_type { let nreg = (layout.size.bytes() + 7) / 8; - (gr_offs, va_list_layout.llvm_field_index(bx.cx, 1), nreg * 8) + (gr_offs, gr_top, nreg * 8) } else { - let vr_off = - bx.struct_gep(va_list_ty, va_list_addr, va_list_layout.llvm_field_index(bx.cx, 4)); let nreg = (layout.size.bytes() + 15) / 16; - (vr_off, va_list_layout.llvm_field_index(bx.cx, 2), nreg * 16) + (vr_offs, vr_top, nreg * 16) }; // if the offset >= 0 then the value will be on the stack @@ -141,15 +157,14 @@ fn emit_aapcs_va_arg<'ll, 'tcx>( bx.switch_to_block(in_reg); let top_type = bx.type_ptr(); - let top = bx.struct_gep(va_list_ty, va_list_addr, reg_top_index); - let top = bx.load(top_type, top, bx.tcx().data_layout.pointer_align.abi); + let top = bx.load(top_type, reg_top, dl.pointer_align.abi); // reg_value = *(@top + reg_off_v); - let mut reg_addr = bx.gep(bx.type_i8(), top, &[reg_off_v]); + let mut reg_addr = bx.ptradd(top, reg_off_v); if bx.tcx().sess.target.endian == Endian::Big && layout.size.bytes() != slot_size { // On big-endian systems the value is right-aligned in its slot. let offset = bx.const_i32((slot_size - layout.size.bytes()) as i32); - reg_addr = bx.gep(bx.type_i8(), reg_addr, &[offset]); + reg_addr = bx.ptradd(reg_addr, offset); } let reg_type = layout.llvm_type(bx); let reg_value = bx.load(reg_type, reg_addr, layout.align.abi); @@ -173,11 +188,29 @@ fn emit_s390x_va_arg<'ll, 'tcx>( list: OperandRef<'tcx, &'ll Value>, target_ty: Ty<'tcx>, ) -> &'ll Value { + let dl = bx.cx.data_layout(); + // Implementation of the s390x ELF ABI calling convention for va_args see // https://github.com/IBM/s390x-abi (chapter 1.2.4) + // + // typedef struct __va_list_tag { + // long __gpr; + // long __fpr; + // void *__overflow_arg_area; + // void *__reg_save_area; + // } va_list[1]; let va_list_addr = list.immediate(); - let va_list_layout = list.deref(bx.cx).layout; - let va_list_ty = va_list_layout.llvm_type(bx); + + // There is no padding between fields since `long` and `void*` both have size=8 align=8. + // https://github.com/IBM/s390x-abi (Table 1.1.: Scalar types) + let i64_offset = 8; + let ptr_offset = 8; + let gpr = va_list_addr; + let fpr = bx.inbounds_ptradd(va_list_addr, bx.cx.const_usize(i64_offset)); + let overflow_arg_area = bx.inbounds_ptradd(va_list_addr, bx.cx.const_usize(2 * i64_offset)); + let reg_save_area = + bx.inbounds_ptradd(va_list_addr, bx.cx.const_usize(2 * i64_offset + ptr_offset)); + let layout = bx.cx.layout_of(target_ty); let in_reg = bx.append_sibling_block("va_arg.in_reg"); @@ -192,15 +225,10 @@ fn emit_s390x_va_arg<'ll, 'tcx>( let padding = padded_size - unpadded_size; let gpr_type = indirect || !layout.is_single_fp_element(bx.cx); - let (max_regs, reg_count_field, reg_save_index, reg_padding) = - if gpr_type { (5, 0, 2, padding) } else { (4, 1, 16, 0) }; + let (max_regs, reg_count, reg_save_index, reg_padding) = + if gpr_type { (5, gpr, 2, padding) } else { (4, fpr, 16, 0) }; // Check whether the value was passed in a register or in memory. - let reg_count = bx.struct_gep( - va_list_ty, - va_list_addr, - va_list_layout.llvm_field_index(bx.cx, reg_count_field), - ); let reg_count_v = bx.load(bx.type_i64(), reg_count, Align::from_bytes(8).unwrap()); let use_regs = bx.icmp(IntPredicate::IntULT, reg_count_v, bx.const_u64(max_regs)); bx.cond_br(use_regs, in_reg, in_mem); @@ -209,12 +237,10 @@ fn emit_s390x_va_arg<'ll, 'tcx>( bx.switch_to_block(in_reg); // Work out the address of the value in the register save area. - let reg_ptr = - bx.struct_gep(va_list_ty, va_list_addr, va_list_layout.llvm_field_index(bx.cx, 3)); - let reg_ptr_v = bx.load(bx.type_ptr(), reg_ptr, bx.tcx().data_layout.pointer_align.abi); + let reg_ptr_v = bx.load(bx.type_ptr(), reg_save_area, dl.pointer_align.abi); let scaled_reg_count = bx.mul(reg_count_v, bx.const_u64(8)); let reg_off = bx.add(scaled_reg_count, bx.const_u64(reg_save_index * 8 + reg_padding)); - let reg_addr = bx.gep(bx.type_i8(), reg_ptr_v, &[reg_off]); + let reg_addr = bx.ptradd(reg_ptr_v, reg_off); // Update the register count. let new_reg_count_v = bx.add(reg_count_v, bx.const_u64(1)); @@ -225,27 +251,23 @@ fn emit_s390x_va_arg<'ll, 'tcx>( bx.switch_to_block(in_mem); // Work out the address of the value in the argument overflow area. - let arg_ptr = - bx.struct_gep(va_list_ty, va_list_addr, va_list_layout.llvm_field_index(bx.cx, 2)); - let arg_ptr_v = bx.load(bx.type_ptr(), arg_ptr, bx.tcx().data_layout.pointer_align.abi); + let arg_ptr_v = + bx.load(bx.type_ptr(), overflow_arg_area, bx.tcx().data_layout.pointer_align.abi); let arg_off = bx.const_u64(padding); - let mem_addr = bx.gep(bx.type_i8(), arg_ptr_v, &[arg_off]); + let mem_addr = bx.ptradd(arg_ptr_v, arg_off); // Update the argument overflow area pointer. let arg_size = bx.cx().const_u64(padded_size); - let new_arg_ptr_v = bx.inbounds_gep(bx.type_i8(), arg_ptr_v, &[arg_size]); - bx.store(new_arg_ptr_v, arg_ptr, bx.tcx().data_layout.pointer_align.abi); + let new_arg_ptr_v = bx.inbounds_ptradd(arg_ptr_v, arg_size); + bx.store(new_arg_ptr_v, overflow_arg_area, dl.pointer_align.abi); bx.br(end); // Return the appropriate result. bx.switch_to_block(end); let val_addr = bx.phi(bx.type_ptr(), &[reg_addr, mem_addr], &[in_reg, in_mem]); let val_type = layout.llvm_type(bx); - let val_addr = if indirect { - bx.load(bx.cx.type_ptr(), val_addr, bx.tcx().data_layout.pointer_align.abi) - } else { - val_addr - }; + let val_addr = + if indirect { bx.load(bx.cx.type_ptr(), val_addr, dl.pointer_align.abi) } else { val_addr }; bx.load(val_type, val_addr, layout.align.abi) } diff --git a/compiler/rustc_codegen_ssa/src/codegen_attrs.rs b/compiler/rustc_codegen_ssa/src/codegen_attrs.rs index 9e23757fcee..9c9e134f033 100644 --- a/compiler/rustc_codegen_ssa/src/codegen_attrs.rs +++ b/compiler/rustc_codegen_ssa/src/codegen_attrs.rs @@ -441,7 +441,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs { .map_err(|msg| { struct_span_code_err!( tcx.dcx(), - attr.span, + literal.span, E0589, "invalid `repr(align)` attribute: {}", msg diff --git a/compiler/rustc_codegen_ssa/src/mir/operand.rs b/compiler/rustc_codegen_ssa/src/mir/operand.rs index 6f6f010422f..94eb37e78e0 100644 --- a/compiler/rustc_codegen_ssa/src/mir/operand.rs +++ b/compiler/rustc_codegen_ssa/src/mir/operand.rs @@ -437,8 +437,7 @@ impl<'a, 'tcx, V: CodegenObject> OperandValue<V> { let align = dest.align; bx.store_with_flags(val, dest.llval, align, flags); - let llptr = - bx.inbounds_gep(bx.type_i8(), dest.llval, &[bx.const_usize(b_offset.bytes())]); + let llptr = bx.inbounds_ptradd(dest.llval, bx.const_usize(b_offset.bytes())); let val = bx.from_immediate(b); let align = dest.align.restrict_for_offset(b_offset); bx.store_with_flags(val, llptr, align, flags); @@ -476,7 +475,7 @@ impl<'a, 'tcx, V: CodegenObject> OperandValue<V> { let address = bx.ptrtoint(alloca, bx.type_isize()); let neg_address = bx.neg(address); let offset = bx.and(neg_address, align_minus_1); - let dst = bx.inbounds_gep(bx.type_i8(), alloca, &[offset]); + let dst = bx.inbounds_ptradd(alloca, offset); bx.memcpy(dst, min_align, llptr, min_align, size, MemFlags::empty()); // Store the allocated region and the extra to the indirect place. diff --git a/compiler/rustc_codegen_ssa/src/mir/place.rs b/compiler/rustc_codegen_ssa/src/mir/place.rs index 73c08e2ca61..725d3bf4431 100644 --- a/compiler/rustc_codegen_ssa/src/mir/place.rs +++ b/compiler/rustc_codegen_ssa/src/mir/place.rs @@ -9,7 +9,7 @@ use rustc_middle::mir; use rustc_middle::mir::tcx::PlaceTy; use rustc_middle::ty::layout::{HasTyCtxt, LayoutOf, TyAndLayout}; use rustc_middle::ty::{self, Ty}; -use rustc_target::abi::{Abi, Align, FieldsShape, Int, Pointer, TagEncoding}; +use rustc_target::abi::{Align, FieldsShape, Int, Pointer, TagEncoding}; use rustc_target::abi::{VariantIdx, Variants}; #[derive(Copy, Clone, Debug)] @@ -102,34 +102,14 @@ impl<'a, 'tcx, V: CodegenObject> PlaceRef<'tcx, V> { // `simple` is called when we don't need to adjust the offset to // the dynamic alignment of the field. let mut simple = || { - let llval = match self.layout.abi { - _ if offset.bytes() == 0 => { - // Unions and newtypes only use an offset of 0. - // Also handles the first field of Scalar, ScalarPair, and Vector layouts. - self.llval - } - Abi::ScalarPair(..) => { - // FIXME(nikic): Generate this for all ABIs. - bx.inbounds_gep(bx.type_i8(), self.llval, &[bx.const_usize(offset.bytes())]) - } - Abi::Scalar(_) | Abi::Vector { .. } if field.is_zst() => { - // ZST fields (even some that require alignment) are not included in Scalar, - // ScalarPair, and Vector layouts, so manually offset the pointer. - bx.gep(bx.cx().type_i8(), self.llval, &[bx.const_usize(offset.bytes())]) - } - Abi::Scalar(_) => { - // All fields of Scalar layouts must have been handled by this point. - // Vector layouts have additional fields for each element of the vector, so don't panic in that case. - bug!( - "offset of non-ZST field `{:?}` does not match layout `{:#?}`", - field, - self.layout - ); - } - _ => { - let ty = bx.backend_type(self.layout); - bx.struct_gep(ty, self.llval, bx.cx().backend_field_index(self.layout, ix)) - } + let llval = if offset.bytes() == 0 { + self.llval + } else if field.is_zst() { + // FIXME(erikdesjardins): it should be fine to use inbounds for ZSTs too; + // keeping this logic for now to preserve previous behavior. + bx.ptradd(self.llval, bx.const_usize(offset.bytes())) + } else { + bx.inbounds_ptradd(self.llval, bx.const_usize(offset.bytes())) }; PlaceRef { llval, @@ -188,7 +168,8 @@ impl<'a, 'tcx, V: CodegenObject> PlaceRef<'tcx, V> { debug!("struct_field_ptr: DST field offset: {:?}", offset); // Adjust pointer. - let ptr = bx.gep(bx.cx().type_i8(), self.llval, &[offset]); + // FIXME(erikdesjardins): should be able to use inbounds here too. + let ptr = bx.ptradd(self.llval, offset); PlaceRef { llval: ptr, llextra: self.llextra, layout: field, align: effective_field_align } } diff --git a/compiler/rustc_codegen_ssa/src/traits/builder.rs b/compiler/rustc_codegen_ssa/src/traits/builder.rs index 86d3d1260c3..36f37e3791b 100644 --- a/compiler/rustc_codegen_ssa/src/traits/builder.rs +++ b/compiler/rustc_codegen_ssa/src/traits/builder.rs @@ -190,7 +190,12 @@ pub trait BuilderMethods<'a, 'tcx>: ptr: Self::Value, indices: &[Self::Value], ) -> Self::Value; - fn struct_gep(&mut self, ty: Self::Type, ptr: Self::Value, idx: u64) -> Self::Value; + fn ptradd(&mut self, ptr: Self::Value, offset: Self::Value) -> Self::Value { + self.gep(self.cx().type_i8(), ptr, &[offset]) + } + fn inbounds_ptradd(&mut self, ptr: Self::Value, offset: Self::Value) -> Self::Value { + self.inbounds_gep(self.cx().type_i8(), ptr, &[offset]) + } fn trunc(&mut self, val: Self::Value, dest_ty: Self::Type) -> Self::Value; fn sext(&mut self, val: Self::Value, dest_ty: Self::Type) -> Self::Value; diff --git a/compiler/rustc_codegen_ssa/src/traits/type_.rs b/compiler/rustc_codegen_ssa/src/traits/type_.rs index 505ce5a61ff..72cce43a3fa 100644 --- a/compiler/rustc_codegen_ssa/src/traits/type_.rs +++ b/compiler/rustc_codegen_ssa/src/traits/type_.rs @@ -113,7 +113,6 @@ pub trait LayoutTypeMethods<'tcx>: Backend<'tcx> { fn immediate_backend_type(&self, layout: TyAndLayout<'tcx>) -> Self::Type; fn is_backend_immediate(&self, layout: TyAndLayout<'tcx>) -> bool; fn is_backend_scalar_pair(&self, layout: TyAndLayout<'tcx>) -> bool; - fn backend_field_index(&self, layout: TyAndLayout<'tcx>, index: usize) -> u64; fn scalar_pair_element_backend_type( &self, layout: TyAndLayout<'tcx>, diff --git a/compiler/rustc_data_structures/src/sync/worker_local.rs b/compiler/rustc_data_structures/src/sync/worker_local.rs index 50a614a1b02..07a361ba260 100644 --- a/compiler/rustc_data_structures/src/sync/worker_local.rs +++ b/compiler/rustc_data_structures/src/sync/worker_local.rs @@ -42,7 +42,7 @@ pub struct Registry(Arc<RegistryData>); thread_local! { /// The registry associated with the thread. /// This allows the `WorkerLocal` type to clone the registry in its constructor. - static REGISTRY: OnceCell<Registry> = OnceCell::new(); + static REGISTRY: OnceCell<Registry> = const { OnceCell::new() }; } struct ThreadData { diff --git a/compiler/rustc_errors/src/markdown/term.rs b/compiler/rustc_errors/src/markdown/term.rs index 88c3c8b9ff2..06c1333d93d 100644 --- a/compiler/rustc_errors/src/markdown/term.rs +++ b/compiler/rustc_errors/src/markdown/term.rs @@ -9,9 +9,9 @@ const DEFAULT_COLUMN_WIDTH: usize = 140; thread_local! { /// Track the position of viewable characters in our buffer - static CURSOR: Cell<usize> = Cell::new(0); + static CURSOR: Cell<usize> = const { Cell::new(0) }; /// Width of the terminal - static WIDTH: Cell<usize> = Cell::new(DEFAULT_COLUMN_WIDTH); + static WIDTH: Cell<usize> = const { Cell::new(DEFAULT_COLUMN_WIDTH) }; } /// Print to terminal output to a buffer diff --git a/compiler/rustc_feature/src/builtin_attrs.rs b/compiler/rustc_feature/src/builtin_attrs.rs index 327c70ede28..10867ae230a 100644 --- a/compiler/rustc_feature/src/builtin_attrs.rs +++ b/compiler/rustc_feature/src/builtin_attrs.rs @@ -929,6 +929,10 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ omit_gdb_pretty_printer_section, Normal, template!(Word), WarnFollowing, "the `#[omit_gdb_pretty_printer_section]` attribute is just used for the Rust test suite", ), + rustc_attr!( + TEST, pattern_complexity, CrateLevel, template!(NameValueStr: "N"), + ErrorFollowing, @only_local: true, + ), ]; pub fn deprecated_attributes() -> Vec<&'static BuiltinAttribute> { diff --git a/compiler/rustc_feature/src/unstable.rs b/compiler/rustc_feature/src/unstable.rs index 53254d567cc..17c4d81474e 100644 --- a/compiler/rustc_feature/src/unstable.rs +++ b/compiler/rustc_feature/src/unstable.rs @@ -213,6 +213,8 @@ declare_features! ( (internal, negative_bounds, "1.71.0", None), /// Allows using `#[omit_gdb_pretty_printer_section]`. (internal, omit_gdb_pretty_printer_section, "1.5.0", None), + /// Set the maximum pattern complexity allowed (not limited by default). + (internal, pattern_complexity, "CURRENT_RUSTC_VERSION", None), /// Allows using `#[prelude_import]` on glob `use` items. (internal, prelude_import, "1.2.0", None), /// Used to identify crates that contain the profiler runtime. diff --git a/compiler/rustc_hir_analysis/src/collect/item_bounds.rs b/compiler/rustc_hir_analysis/src/collect/item_bounds.rs index 39ca1bba065..78c390d0924 100644 --- a/compiler/rustc_hir_analysis/src/collect/item_bounds.rs +++ b/compiler/rustc_hir_analysis/src/collect/item_bounds.rs @@ -64,7 +64,7 @@ fn opaque_type_bounds<'tcx>( item_ty: Ty<'tcx>, span: Span, ) -> &'tcx [(ty::Clause<'tcx>, Span)] { - ty::print::with_no_queries!({ + ty::print::with_reduced_queries!({ let icx = ItemCtxt::new(tcx, opaque_def_id); let mut bounds = icx.astconv().compute_bounds(item_ty, ast_bounds, PredicateFilter::All); // Opaque types are implicitly sized unless a `?Sized` bound is found diff --git a/compiler/rustc_lint/src/nonstandard_style.rs b/compiler/rustc_lint/src/nonstandard_style.rs index 4ecd87e37d3..ee863672017 100644 --- a/compiler/rustc_lint/src/nonstandard_style.rs +++ b/compiler/rustc_lint/src/nonstandard_style.rs @@ -10,6 +10,7 @@ use rustc_hir::def::{DefKind, Res}; use rustc_hir::intravisit::FnKind; use rustc_hir::{GenericParamKind, PatKind}; use rustc_middle::ty; +use rustc_session::config::CrateType; use rustc_span::def_id::LocalDefId; use rustc_span::symbol::{sym, Ident}; use rustc_span::{BytePos, Span}; @@ -331,6 +332,10 @@ impl<'tcx> LateLintPass<'tcx> for NonSnakeCase { return; } + if cx.tcx.crate_types().iter().all(|&crate_type| crate_type == CrateType::Executable) { + return; + } + let crate_ident = if let Some(name) = &cx.tcx.sess.opts.crate_name { Some(Ident::from_str(name)) } else { diff --git a/compiler/rustc_log/src/lib.rs b/compiler/rustc_log/src/lib.rs index 1a78f9f0f86..e4b67cde244 100644 --- a/compiler/rustc_log/src/lib.rs +++ b/compiler/rustc_log/src/lib.rs @@ -57,6 +57,7 @@ pub struct LoggerConfig { pub verbose_entry_exit: Result<String, VarError>, pub verbose_thread_ids: Result<String, VarError>, pub backtrace: Result<String, VarError>, + pub wraptree: Result<String, VarError>, } impl LoggerConfig { @@ -67,6 +68,7 @@ impl LoggerConfig { verbose_entry_exit: env::var(format!("{env}_ENTRY_EXIT")), verbose_thread_ids: env::var(format!("{env}_THREAD_IDS")), backtrace: env::var(format!("{env}_BACKTRACE")), + wraptree: env::var(format!("{env}_WRAPTREE")), } } } @@ -99,7 +101,7 @@ pub fn init_logger(cfg: LoggerConfig) -> Result<(), Error> { Err(_) => false, }; - let layer = tracing_tree::HierarchicalLayer::default() + let mut layer = tracing_tree::HierarchicalLayer::default() .with_writer(io::stderr) .with_indent_lines(true) .with_ansi(color_logs) @@ -110,6 +112,16 @@ pub fn init_logger(cfg: LoggerConfig) -> Result<(), Error> { .with_thread_ids(verbose_thread_ids) .with_thread_names(verbose_thread_ids); + match cfg.wraptree { + Ok(v) => match v.parse::<usize>() { + Ok(v) => { + layer = layer.with_wraparound(v); + } + Err(_) => return Err(Error::InvalidWraptree(v)), + }, + Err(_) => {} // no wraptree + } + let subscriber = tracing_subscriber::Registry::default().with(filter).with(layer); match cfg.backtrace { Ok(str) => { @@ -164,6 +176,7 @@ pub fn stderr_isatty() -> bool { pub enum Error { InvalidColorValue(String), NonUnicodeColorValue, + InvalidWraptree(String), } impl std::error::Error for Error {} @@ -179,6 +192,10 @@ impl Display for Error { formatter, "non-Unicode log color value: expected one of always, never, or auto", ), + Error::InvalidWraptree(value) => write!( + formatter, + "invalid log WRAPTREE value '{value}': expected a non-negative integer", + ), } } } diff --git a/compiler/rustc_middle/src/middle/limits.rs b/compiler/rustc_middle/src/middle/limits.rs index 344ea38192e..4d698012749 100644 --- a/compiler/rustc_middle/src/middle/limits.rs +++ b/compiler/rustc_middle/src/middle/limits.rs @@ -40,6 +40,13 @@ pub fn get_recursion_limit(krate_attrs: &[Attribute], sess: &Session) -> Limit { } fn get_limit(krate_attrs: &[Attribute], sess: &Session, name: Symbol, default: usize) -> Limit { + match get_limit_size(krate_attrs, sess, name) { + Some(size) => Limit::new(size), + None => Limit::new(default), + } +} + +pub fn get_limit_size(krate_attrs: &[Attribute], sess: &Session, name: Symbol) -> Option<usize> { for attr in krate_attrs { if !attr.has_name(name) { continue; @@ -47,7 +54,7 @@ fn get_limit(krate_attrs: &[Attribute], sess: &Session, name: Symbol, default: u if let Some(s) = attr.value_str() { match s.as_str().parse() { - Ok(n) => return Limit::new(n), + Ok(n) => return Some(n), Err(e) => { let value_span = attr .meta() @@ -69,5 +76,5 @@ fn get_limit(krate_attrs: &[Attribute], sess: &Session, name: Symbol, default: u } } } - return Limit::new(default); + None } diff --git a/compiler/rustc_middle/src/ty/consts.rs b/compiler/rustc_middle/src/ty/consts.rs index 5e4d899f517..5b62c0bf931 100644 --- a/compiler/rustc_middle/src/ty/consts.rs +++ b/compiler/rustc_middle/src/ty/consts.rs @@ -175,7 +175,20 @@ impl<'tcx> Const<'tcx> { let reported = tcx.dcx().span_delayed_bug(span, msg); Const::new_error(tcx, reported, ty) } +} +impl<'tcx> rustc_type_ir::new::Const<TyCtxt<'tcx>> for Const<'tcx> { + fn new_anon_bound( + tcx: TyCtxt<'tcx>, + debruijn: ty::DebruijnIndex, + var: ty::BoundVar, + ty: Ty<'tcx>, + ) -> Self { + Const::new_bound(tcx, debruijn, var, ty) + } +} + +impl<'tcx> Const<'tcx> { /// Literals and const generic parameters are eagerly converted to a constant, everything else /// becomes `Unevaluated`. #[instrument(skip(tcx), level = "debug")] diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index b2a7f5599b6..96b4797f4fa 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -130,27 +130,6 @@ impl<'tcx> Interner for TyCtxt<'tcx> { fn mk_canonical_var_infos(self, infos: &[ty::CanonicalVarInfo<Self>]) -> Self::CanonicalVars { self.mk_canonical_var_infos(infos) } - - fn mk_bound_ty(self, debruijn: ty::DebruijnIndex, var: ty::BoundVar) -> Self::Ty { - Ty::new_bound(self, debruijn, ty::BoundTy { var, kind: ty::BoundTyKind::Anon }) - } - - fn mk_bound_region(self, debruijn: ty::DebruijnIndex, var: ty::BoundVar) -> Self::Region { - Region::new_bound( - self, - debruijn, - ty::BoundRegion { var, kind: ty::BoundRegionKind::BrAnon }, - ) - } - - fn mk_bound_const( - self, - debruijn: ty::DebruijnIndex, - var: ty::BoundVar, - ty: Self::Ty, - ) -> Self::Const { - Const::new_bound(self, debruijn, var, ty) - } } type InternedSet<'tcx, T> = ShardedHashMap<InternedInSet<'tcx, T>, ()>; diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs index bbe06c09352..540803d9530 100644 --- a/compiler/rustc_middle/src/ty/print/pretty.rs +++ b/compiler/rustc_middle/src/ty/print/pretty.rs @@ -64,7 +64,7 @@ thread_local! { static SHOULD_PREFIX_WITH_CRATE: Cell<bool> = const { Cell::new(false) }; static NO_TRIMMED_PATH: Cell<bool> = const { Cell::new(false) }; static FORCE_TRIMMED_PATH: Cell<bool> = const { Cell::new(false) }; - static NO_QUERIES: Cell<bool> = const { Cell::new(false) }; + static REDUCED_QUERIES: Cell<bool> = const { Cell::new(false) }; static NO_VISIBLE_PATH: Cell<bool> = const { Cell::new(false) }; } @@ -102,14 +102,14 @@ macro_rules! define_helper { } define_helper!( - /// Avoids running any queries during any prints that occur + /// Avoids running select queries during any prints that occur /// during the closure. This may alter the appearance of some /// types (e.g. forcing verbose printing for opaque types). /// This method is used during some queries (e.g. `explicit_item_bounds` /// for opaque types), to ensure that any debug printing that /// occurs during the query computation does not end up recursively /// calling the same query. - fn with_no_queries(NoQueriesGuard, NO_QUERIES); + fn with_reduced_queries(ReducedQueriesGuard, REDUCED_QUERIES); /// Force us to name impls with just the filename/line number. We /// normally try to use types. But at some points, notably while printing /// cycle errors, this can result in extra or suboptimal error output, @@ -127,6 +127,15 @@ define_helper!( fn with_no_visible_paths(NoVisibleGuard, NO_VISIBLE_PATH); ); +/// Avoids running any queries during prints. +pub macro with_no_queries($e:expr) {{ + $crate::ty::print::with_reduced_queries!($crate::ty::print::with_forced_impl_filename_line!( + $crate::ty::print::with_no_trimmed_paths!($crate::ty::print::with_no_visible_paths!( + $crate::ty::print::with_forced_impl_filename_line!($e) + )) + )) +}} + /// The "region highlights" are used to control region printing during /// specific error messages. When a "region highlight" is enabled, it /// gives an alternate way to print specific regions. For now, we @@ -659,7 +668,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write { p!(")") } ty::FnDef(def_id, args) => { - if with_no_queries() { + if with_reduced_queries() { p!(print_def_path(def_id, args)); } else { let sig = self.tcx().fn_sig(def_id).instantiate(self.tcx(), args); @@ -759,7 +768,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write { return Ok(()); } _ => { - if with_no_queries() { + if with_reduced_queries() { p!(print_def_path(def_id, &[])); return Ok(()); } else { @@ -1876,7 +1885,8 @@ impl DerefMut for FmtPrinter<'_, '_> { impl<'a, 'tcx> FmtPrinter<'a, 'tcx> { pub fn new(tcx: TyCtxt<'tcx>, ns: Namespace) -> Self { - let limit = if with_no_queries() { Limit::new(1048576) } else { tcx.type_length_limit() }; + let limit = + if with_reduced_queries() { Limit::new(1048576) } else { tcx.type_length_limit() }; Self::new_with_limit(tcx, ns, limit) } @@ -2962,7 +2972,7 @@ define_print_and_forward_display! { } TraitRefPrintSugared<'tcx> { - if !with_no_queries() + if !with_reduced_queries() && let Some(kind) = cx.tcx().fn_trait_kind_from_def_id(self.0.def_id) && let ty::Tuple(args) = self.0.args.type_at(1).kind() { @@ -3050,7 +3060,7 @@ define_print_and_forward_display! { // If we're printing verbosely, or don't want to invoke queries // (`is_impl_trait_in_trait`), then fall back to printing the def path. // This is likely what you want if you're debugging the compiler anyways. - if !(cx.should_print_verbose() || with_no_queries()) + if !(cx.should_print_verbose() || with_reduced_queries()) && cx.tcx().is_impl_trait_in_trait(self.def_id) { return cx.pretty_print_opaque_impl_type(self.def_id, self.args); diff --git a/compiler/rustc_middle/src/ty/region.rs b/compiler/rustc_middle/src/ty/region.rs index 51a4a9f411c..7abc3cd2838 100644 --- a/compiler/rustc_middle/src/ty/region.rs +++ b/compiler/rustc_middle/src/ty/region.rs @@ -136,6 +136,12 @@ impl<'tcx> Region<'tcx> { } } +impl<'tcx> rustc_type_ir::new::Region<TyCtxt<'tcx>> for Region<'tcx> { + fn new_anon_bound(tcx: TyCtxt<'tcx>, debruijn: ty::DebruijnIndex, var: ty::BoundVar) -> Self { + Region::new_bound(tcx, debruijn, ty::BoundRegion { var, kind: ty::BoundRegionKind::BrAnon }) + } +} + /// Region utilities impl<'tcx> Region<'tcx> { pub fn kind(self) -> RegionKind<'tcx> { diff --git a/compiler/rustc_middle/src/ty/sty.rs b/compiler/rustc_middle/src/ty/sty.rs index 53690cc5811..03c61803572 100644 --- a/compiler/rustc_middle/src/ty/sty.rs +++ b/compiler/rustc_middle/src/ty/sty.rs @@ -1426,7 +1426,8 @@ impl From<BoundVar> for BoundTy { /// Constructors for `Ty` impl<'tcx> Ty<'tcx> { - // Avoid this in favour of more specific `new_*` methods, where possible. + /// Avoid using this in favour of more specific `new_*` methods, where possible. + /// The more specific methods will often optimize their creation. #[allow(rustc::usage_of_ty_tykind)] #[inline] pub fn new(tcx: TyCtxt<'tcx>, st: TyKind<'tcx>) -> Ty<'tcx> { @@ -1813,6 +1814,12 @@ impl<'tcx> Ty<'tcx> { } } +impl<'tcx> rustc_type_ir::new::Ty<TyCtxt<'tcx>> for Ty<'tcx> { + fn new_anon_bound(tcx: TyCtxt<'tcx>, debruijn: ty::DebruijnIndex, var: ty::BoundVar) -> Self { + Ty::new_bound(tcx, debruijn, ty::BoundTy { var, kind: ty::BoundTyKind::Anon }) + } +} + /// Type utilities impl<'tcx> Ty<'tcx> { #[inline(always)] diff --git a/compiler/rustc_mir_build/src/build/expr/into.rs b/compiler/rustc_mir_build/src/build/expr/into.rs index f2cf6fe613c..9a6d4498352 100644 --- a/compiler/rustc_mir_build/src/build/expr/into.rs +++ b/compiler/rustc_mir_build/src/build/expr/into.rs @@ -81,10 +81,10 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { let then_blk = unpack!(this.then_else_break( block, cond, - Some(condition_scope), + Some(condition_scope), // Temp scope condition_scope, source_info, - true, + true, // Declare `let` bindings normally )); this.expr_into_dest(destination, then_blk, then) @@ -146,9 +146,11 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { this.then_else_break( block, lhs, - Some(condition_scope), + Some(condition_scope), // Temp scope condition_scope, source_info, + // This flag controls how inner `let` expressions are lowered, + // but either way there shouldn't be any of those in here. true, ) }); diff --git a/compiler/rustc_mir_build/src/build/matches/mod.rs b/compiler/rustc_mir_build/src/build/matches/mod.rs index a6273b92e5d..29ee07f5d79 100644 --- a/compiler/rustc_mir_build/src/build/matches/mod.rs +++ b/compiler/rustc_mir_build/src/build/matches/mod.rs @@ -30,21 +30,55 @@ mod util; use std::borrow::Borrow; use std::mem; +/// Arguments to [`Builder::then_else_break_inner`] that are usually forwarded +/// to recursive invocations. +#[derive(Clone, Copy)] +struct ThenElseArgs { + /// Used as the temp scope for lowering `expr`. If absent (for match guards), + /// `self.local_scope()` is used. + temp_scope_override: Option<region::Scope>, + /// Scope to pass to [`Builder::break_for_else`]. Must match the scope used + /// by the enclosing call to [`Builder::in_if_then_scope`]. + break_scope: region::Scope, + variable_source_info: SourceInfo, + /// Forwarded to [`Builder::lower_let_expr`] when lowering [`ExprKind::Let`]. + /// When false (for match guards), `let` bindings won't be declared. + declare_let_bindings: bool, +} + impl<'a, 'tcx> Builder<'a, 'tcx> { /// Lowers a condition in a way that ensures that variables bound in any let /// expressions are definitely initialized in the if body. /// - /// If `declare_bindings` is false then variables created in `let` + /// If `declare_let_bindings` is false then variables created in `let` /// expressions will not be declared. This is for if let guards on arms with /// an or pattern, where the guard is lowered multiple times. pub(crate) fn then_else_break( &mut self, - mut block: BasicBlock, + block: BasicBlock, expr_id: ExprId, temp_scope_override: Option<region::Scope>, break_scope: region::Scope, variable_source_info: SourceInfo, - declare_bindings: bool, + declare_let_bindings: bool, + ) -> BlockAnd<()> { + self.then_else_break_inner( + block, + expr_id, + ThenElseArgs { + temp_scope_override, + break_scope, + variable_source_info, + declare_let_bindings, + }, + ) + } + + fn then_else_break_inner( + &mut self, + block: BasicBlock, // Block that the condition and branch will be lowered into + expr_id: ExprId, // Condition expression to lower + args: ThenElseArgs, ) -> BlockAnd<()> { let this = self; let expr = &this.thir[expr_id]; @@ -52,54 +86,36 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { match expr.kind { ExprKind::LogicalOp { op: LogicalOp::And, lhs, rhs } => { - let lhs_then_block = unpack!(this.then_else_break( - block, - lhs, - temp_scope_override, - break_scope, - variable_source_info, - declare_bindings, - )); - - let rhs_then_block = unpack!(this.then_else_break( - lhs_then_block, - rhs, - temp_scope_override, - break_scope, - variable_source_info, - declare_bindings, - )); - + let lhs_then_block = unpack!(this.then_else_break_inner(block, lhs, args)); + let rhs_then_block = unpack!(this.then_else_break_inner(lhs_then_block, rhs, args)); rhs_then_block.unit() } ExprKind::LogicalOp { op: LogicalOp::Or, lhs, rhs } => { let local_scope = this.local_scope(); let (lhs_success_block, failure_block) = this.in_if_then_scope(local_scope, expr_span, |this| { - this.then_else_break( + this.then_else_break_inner( block, lhs, - temp_scope_override, - local_scope, - variable_source_info, - true, + ThenElseArgs { + break_scope: local_scope, + declare_let_bindings: true, + ..args + }, ) }); - let rhs_success_block = unpack!(this.then_else_break( + let rhs_success_block = unpack!(this.then_else_break_inner( failure_block, rhs, - temp_scope_override, - break_scope, - variable_source_info, - true, + ThenElseArgs { declare_let_bindings: true, ..args }, )); // Make the LHS and RHS success arms converge to a common block. // (We can't just make LHS goto RHS, because `rhs_success_block` // might contain statements that we don't want on the LHS path.) let success_block = this.cfg.start_new_block(); - this.cfg.goto(lhs_success_block, variable_source_info, success_block); - this.cfg.goto(rhs_success_block, variable_source_info, success_block); + this.cfg.goto(lhs_success_block, args.variable_source_info, success_block); + this.cfg.goto(rhs_success_block, args.variable_source_info, success_block); success_block.unit() } ExprKind::Unary { op: UnOp::Not, arg } => { @@ -111,50 +127,38 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { if this.tcx.sess.instrument_coverage() { this.cfg.push_coverage_span_marker(block, this.source_info(expr_span)); } - this.then_else_break( + this.then_else_break_inner( block, arg, - temp_scope_override, - local_scope, - variable_source_info, - true, + ThenElseArgs { + break_scope: local_scope, + declare_let_bindings: true, + ..args + }, ) }); - this.break_for_else(success_block, break_scope, variable_source_info); + this.break_for_else(success_block, args.break_scope, args.variable_source_info); failure_block.unit() } ExprKind::Scope { region_scope, lint_level, value } => { let region_scope = (region_scope, this.source_info(expr_span)); this.in_scope(region_scope, lint_level, |this| { - this.then_else_break( - block, - value, - temp_scope_override, - break_scope, - variable_source_info, - declare_bindings, - ) + this.then_else_break_inner(block, value, args) }) } - ExprKind::Use { source } => this.then_else_break( - block, - source, - temp_scope_override, - break_scope, - variable_source_info, - declare_bindings, - ), + ExprKind::Use { source } => this.then_else_break_inner(block, source, args), ExprKind::Let { expr, ref pat } => this.lower_let_expr( block, expr, pat, - break_scope, - Some(variable_source_info.scope), - variable_source_info.span, - declare_bindings, + args.break_scope, + Some(args.variable_source_info.scope), + args.variable_source_info.span, + args.declare_let_bindings, ), _ => { - let temp_scope = temp_scope_override.unwrap_or_else(|| this.local_scope()); + let mut block = block; + let temp_scope = args.temp_scope_override.unwrap_or_else(|| this.local_scope()); let mutability = Mutability::Mut; let place = unpack!(block = this.as_temp(block, Some(temp_scope), expr_id, mutability)); @@ -166,7 +170,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { let source_info = this.source_info(expr_span); this.cfg.terminate(block, source_info, term); - this.break_for_else(else_block, break_scope, source_info); + this.break_for_else(else_block, args.break_scope, source_info); then_block.unit() } @@ -2105,10 +2109,10 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { this.then_else_break( block, guard, - None, + None, // Use `self.local_scope()` as the temp scope match_scope, this.source_info(arm.span), - false, + false, // For guards, `let` bindings are declared separately ) }); diff --git a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs index cf12b4fb912..2685bae4d09 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs @@ -17,6 +17,7 @@ use rustc_hir as hir; use rustc_hir::def::*; use rustc_hir::def_id::LocalDefId; use rustc_hir::HirId; +use rustc_middle::middle::limits::get_limit_size; use rustc_middle::thir::visit::Visitor; use rustc_middle::thir::*; use rustc_middle::ty::print::with_no_trimmed_paths; @@ -26,7 +27,7 @@ use rustc_session::lint::builtin::{ }; use rustc_session::Session; use rustc_span::hygiene::DesugaringKind; -use rustc_span::Span; +use rustc_span::{sym, Span}; pub(crate) fn check_match(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Result<(), ErrorGuaranteed> { let typeck_results = tcx.typeck(def_id); @@ -403,8 +404,11 @@ impl<'p, 'tcx> MatchVisitor<'p, 'tcx> { arms: &[MatchArm<'p, 'tcx>], scrut_ty: Ty<'tcx>, ) -> Result<UsefulnessReport<'p, 'tcx>, ErrorGuaranteed> { + let pattern_complexity_limit = + get_limit_size(cx.tcx.hir().krate_attrs(), cx.tcx.sess, sym::pattern_complexity); let report = - rustc_pattern_analysis::analyze_match(&cx, &arms, scrut_ty).map_err(|err| { + rustc_pattern_analysis::analyze_match(&cx, &arms, scrut_ty, pattern_complexity_limit) + .map_err(|err| { self.error = Err(err); err })?; diff --git a/compiler/rustc_next_trait_solver/src/canonicalizer.rs b/compiler/rustc_next_trait_solver/src/canonicalizer.rs index 7b73e2aebf0..95b30066662 100644 --- a/compiler/rustc_next_trait_solver/src/canonicalizer.rs +++ b/compiler/rustc_next_trait_solver/src/canonicalizer.rs @@ -1,6 +1,7 @@ use std::cmp::Ordering; use rustc_type_ir::fold::{TypeFoldable, TypeFolder, TypeSuperFoldable}; +use rustc_type_ir::new::{Const, Region, Ty}; use rustc_type_ir::visit::TypeVisitableExt; use rustc_type_ir::{ self as ty, Canonical, CanonicalTyVarKind, CanonicalVarInfo, CanonicalVarKind, ConstTy, @@ -293,7 +294,7 @@ impl<Infcx: InferCtxtLike<Interner = I>, I: Interner> TypeFolder<I> var }); - self.interner().mk_bound_region(self.binder_index, var) + Region::new_anon_bound(self.interner(), self.binder_index, var) } fn fold_ty(&mut self, t: I::Ty) -> I::Ty @@ -375,7 +376,7 @@ impl<Infcx: InferCtxtLike<Interner = I>, I: Interner> TypeFolder<I> }), ); - self.interner().mk_bound_ty(self.binder_index, var) + Ty::new_anon_bound(self.interner(), self.binder_index, var) } fn fold_const(&mut self, c: I::Const) -> I::Const @@ -435,6 +436,6 @@ impl<Infcx: InferCtxtLike<Interner = I>, I: Interner> TypeFolder<I> }), ); - self.interner().mk_bound_const(self.binder_index, var, c.ty()) + Const::new_anon_bound(self.interner(), self.binder_index, var, c.ty()) } } diff --git a/compiler/rustc_pattern_analysis/src/lib.rs b/compiler/rustc_pattern_analysis/src/lib.rs index d4b38d260e7..4b0955699fc 100644 --- a/compiler/rustc_pattern_analysis/src/lib.rs +++ b/compiler/rustc_pattern_analysis/src/lib.rs @@ -142,6 +142,9 @@ pub trait TypeCx: Sized + fmt::Debug { _overlaps_with: &[&DeconstructedPat<Self>], ) { } + + /// The maximum pattern complexity limit was reached. + fn complexity_exceeded(&self) -> Result<(), Self::Error>; } /// The arm of a match expression. @@ -167,10 +170,12 @@ pub fn analyze_match<'p, 'tcx>( tycx: &RustcMatchCheckCtxt<'p, 'tcx>, arms: &[rustc::MatchArm<'p, 'tcx>], scrut_ty: Ty<'tcx>, + pattern_complexity_limit: Option<usize>, ) -> Result<rustc::UsefulnessReport<'p, 'tcx>, ErrorGuaranteed> { let scrut_ty = tycx.reveal_opaque_ty(scrut_ty); let scrut_validity = ValidityConstraint::from_bool(tycx.known_valid_scrutinee); - let report = compute_match_usefulness(tycx, arms, scrut_ty, scrut_validity)?; + let report = + compute_match_usefulness(tycx, arms, scrut_ty, scrut_validity, pattern_complexity_limit)?; // Run the non_exhaustive_omitted_patterns lint. Only run on refutable patterns to avoid hitting // `if let`s. Only run if the match is exhaustive otherwise the error is redundant. diff --git a/compiler/rustc_pattern_analysis/src/rustc.rs b/compiler/rustc_pattern_analysis/src/rustc.rs index f8839b0b590..5f5bfa7154a 100644 --- a/compiler/rustc_pattern_analysis/src/rustc.rs +++ b/compiler/rustc_pattern_analysis/src/rustc.rs @@ -895,6 +895,11 @@ impl<'p, 'tcx: 'p> TypeCx for RustcMatchCheckCtxt<'p, 'tcx> { errors::OverlappingRangeEndpoints { overlap: overlaps, range: pat_span }, ); } + + fn complexity_exceeded(&self) -> Result<(), Self::Error> { + let span = self.whole_match_span.unwrap_or(self.scrut_span); + Err(self.tcx.dcx().span_err(span, "reached pattern complexity limit")) + } } /// Recursively expand this pattern into its subpatterns. Only useful for or-patterns. diff --git a/compiler/rustc_pattern_analysis/src/usefulness.rs b/compiler/rustc_pattern_analysis/src/usefulness.rs index bbe02f94c0a..0261768d916 100644 --- a/compiler/rustc_pattern_analysis/src/usefulness.rs +++ b/compiler/rustc_pattern_analysis/src/usefulness.rs @@ -734,6 +734,21 @@ struct UsefulnessCtxt<'a, Cx: TypeCx> { /// Collect the patterns found useful during usefulness checking. This is used to lint /// unreachable (sub)patterns. useful_subpatterns: FxHashSet<PatId>, + complexity_limit: Option<usize>, + complexity_level: usize, +} + +impl<'a, Cx: TypeCx> UsefulnessCtxt<'a, Cx> { + fn increase_complexity_level(&mut self, complexity_add: usize) -> Result<(), Cx::Error> { + self.complexity_level += complexity_add; + if self + .complexity_limit + .is_some_and(|complexity_limit| complexity_limit < self.complexity_level) + { + return self.tycx.complexity_exceeded(); + } + Ok(()) + } } /// Context that provides information local to a place under investigation. @@ -1552,6 +1567,7 @@ fn compute_exhaustiveness_and_usefulness<'a, 'p, Cx: TypeCx>( } let Some(place) = matrix.head_place() else { + mcx.increase_complexity_level(matrix.rows().len())?; // The base case: there are no columns in the matrix. We are morally pattern-matching on (). // A row is useful iff it has no (unguarded) rows above it. let mut useful = true; // Whether the next row is useful. @@ -1690,8 +1706,14 @@ pub fn compute_match_usefulness<'p, Cx: TypeCx>( arms: &[MatchArm<'p, Cx>], scrut_ty: Cx::Ty, scrut_validity: ValidityConstraint, + complexity_limit: Option<usize>, ) -> Result<UsefulnessReport<'p, Cx>, Cx::Error> { - let mut cx = UsefulnessCtxt { tycx, useful_subpatterns: FxHashSet::default() }; + let mut cx = UsefulnessCtxt { + tycx, + useful_subpatterns: FxHashSet::default(), + complexity_limit, + complexity_level: 0, + }; let mut matrix = Matrix::new(arms, scrut_ty, scrut_validity); let non_exhaustiveness_witnesses = compute_exhaustiveness_and_usefulness(&mut cx, &mut matrix)?; diff --git a/compiler/rustc_query_impl/src/plumbing.rs b/compiler/rustc_query_impl/src/plumbing.rs index c7baca86d93..1b546bf9103 100644 --- a/compiler/rustc_query_impl/src/plumbing.rs +++ b/compiler/rustc_query_impl/src/plumbing.rs @@ -18,7 +18,7 @@ use rustc_middle::query::on_disk_cache::AbsoluteBytePos; use rustc_middle::query::on_disk_cache::{CacheDecoder, CacheEncoder, EncodedDepNodeIndex}; use rustc_middle::query::Key; use rustc_middle::ty::tls::{self, ImplicitCtxt}; -use rustc_middle::ty::{self, print::with_no_queries, TyCtxt}; +use rustc_middle::ty::{self, TyCtxt}; use rustc_query_system::dep_graph::{DepNodeParams, HasDepContext}; use rustc_query_system::ich::StableHashingContext; use rustc_query_system::query::{ @@ -305,20 +305,13 @@ pub(crate) fn create_query_frame< name: &'static str, ) -> QueryStackFrame { // Avoid calling queries while formatting the description - let description = ty::print::with_no_queries!( - // Disable visible paths printing for performance reasons. - // Showing visible path instead of any path is not that important in production. - ty::print::with_no_visible_paths!( - // Force filename-line mode to avoid invoking `type_of` query. - ty::print::with_forced_impl_filename_line!(do_describe(tcx, key)) - ) - ); + let description = ty::print::with_no_queries!(do_describe(tcx, key)); let description = if tcx.sess.verbose_internals() { format!("{description} [{name:?}]") } else { description }; - let span = if kind == dep_graph::dep_kinds::def_span || with_no_queries() { + let span = if kind == dep_graph::dep_kinds::def_span { // The `def_span` query is used to calculate `default_span`, // so exit to avoid infinite recursion. None @@ -326,7 +319,7 @@ pub(crate) fn create_query_frame< Some(key.default_span(tcx)) }; let def_id = key.key_as_def_id(); - let def_kind = if kind == dep_graph::dep_kinds::def_kind || with_no_queries() { + let def_kind = if kind == dep_graph::dep_kinds::def_kind { // Try to avoid infinite recursion. None } else { diff --git a/compiler/rustc_resolve/messages.ftl b/compiler/rustc_resolve/messages.ftl index fa98338bbb6..a03bb6acd41 100644 --- a/compiler/rustc_resolve/messages.ftl +++ b/compiler/rustc_resolve/messages.ftl @@ -83,6 +83,10 @@ resolve_consider_declaring_with_pub = resolve_consider_marking_as_pub = consider marking `{$ident}` as `pub` in the imported module +resolve_consider_move_macro_position = + consider moving the definition of `{$ident}` before this call + + resolve_const_not_member_of_trait = const `{$const_}` is not a member of trait `{$trait_}` .label = not a member of trait `{$trait_}` @@ -176,6 +180,9 @@ resolve_lowercase_self = attempt to use a non-constant value in a constant .suggestion = try using `Self` +resolve_macro_defined_later = + a macro with the same name exists, but it appears later at here + resolve_macro_expected_found = expected {$expected}, found {$found} `{$macro_path}` diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index 6b45db7ba83..dc7dfa04d18 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -30,7 +30,10 @@ use rustc_span::{BytePos, Span, SyntaxContext}; use thin_vec::{thin_vec, ThinVec}; use crate::errors::{AddedMacroUse, ChangeImportBinding, ChangeImportBindingSuggestion}; -use crate::errors::{ConsiderAddingADerive, ExplicitUnsafeTraits, MaybeMissingMacroRulesName}; +use crate::errors::{ + ConsiderAddingADerive, ExplicitUnsafeTraits, MacroDefinedLater, MacroSuggMovePosition, + MaybeMissingMacroRulesName, +}; use crate::imports::{Import, ImportKind}; use crate::late::{PatternSource, Rib}; use crate::{errors as errs, BindingKey}; @@ -1456,6 +1459,24 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { return; } + let unused_macro = self.unused_macros.iter().find_map(|(def_id, (_, unused_ident))| { + if unused_ident.name == ident.name { + Some((def_id.clone(), unused_ident.clone())) + } else { + None + } + }); + + if let Some((def_id, unused_ident)) = unused_macro { + let scope = self.local_macro_def_scopes[&def_id]; + let parent_nearest = parent_scope.module.nearest_parent_mod(); + if Some(parent_nearest) == scope.opt_def_id() { + err.subdiagnostic(self.dcx(), MacroDefinedLater { span: unused_ident.span }); + err.subdiagnostic(self.dcx(), MacroSuggMovePosition { span: ident.span, ident }); + return; + } + } + if self.macro_names.contains(&ident.normalize_to_macros_2_0()) { err.subdiagnostic(self.dcx(), AddedMacroUse); return; diff --git a/compiler/rustc_resolve/src/errors.rs b/compiler/rustc_resolve/src/errors.rs index 6f23f531996..a9f5ed9908b 100644 --- a/compiler/rustc_resolve/src/errors.rs +++ b/compiler/rustc_resolve/src/errors.rs @@ -647,6 +647,21 @@ pub(crate) struct ExplicitUnsafeTraits { } #[derive(Subdiagnostic)] +#[note(resolve_macro_defined_later)] +pub(crate) struct MacroDefinedLater { + #[primary_span] + pub(crate) span: Span, +} + +#[derive(Subdiagnostic)] +#[label(resolve_consider_move_macro_position)] +pub(crate) struct MacroSuggMovePosition { + #[primary_span] + pub(crate) span: Span, + pub(crate) ident: Ident, +} + +#[derive(Subdiagnostic)] #[note(resolve_missing_macro_rules_name)] pub(crate) struct MaybeMissingMacroRulesName { #[primary_span] diff --git a/compiler/rustc_resolve/src/late.rs b/compiler/rustc_resolve/src/late.rs index 4057e9b8a0e..85db8ba8618 100644 --- a/compiler/rustc_resolve/src/late.rs +++ b/compiler/rustc_resolve/src/late.rs @@ -4150,34 +4150,36 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> { PathResult::Indeterminate => bug!("indeterminate path result in resolve_qpath"), }; - if path.len() > 1 - && let Some(res) = result.full_res() - && let Some((&last_segment, prev_segs)) = path.split_last() - && prev_segs.iter().all(|seg| !seg.has_generic_args) - && res != Res::Err - && path[0].ident.name != kw::PathRoot - && path[0].ident.name != kw::DollarCrate - { - let unqualified_result = { - match self.resolve_path(&[last_segment], Some(ns), None) { - PathResult::NonModule(path_res) => path_res.expect_full_res(), - PathResult::Module(ModuleOrUniformRoot::Module(module)) => { - module.res().unwrap() - } - _ => return Ok(Some(result)), - } - }; - if res == unqualified_result { - let lint = lint::builtin::UNUSED_QUALIFICATIONS; + if path.iter().all(|seg| !seg.ident.span.from_expansion()) { + let end_pos = + path.iter().position(|seg| seg.has_generic_args).map_or(path.len(), |pos| pos + 1); + let unqualified = + path[..end_pos].iter().enumerate().skip(1).rev().find_map(|(i, seg)| { + // Preserve the current namespace for the final path segment, but use the type + // namespace for all preceding segments + // + // e.g. for `std::env::args` check the `ValueNS` for `args` but the `TypeNS` for + // `std` and `env` + // + // If the final path segment is beyond `end_pos` all the segments to check will + // use the type namespace + let ns = if i + 1 == path.len() { ns } else { TypeNS }; + let res = self.r.partial_res_map.get(&seg.id?)?.full_res()?; + let binding = self.resolve_ident_in_lexical_scope(seg.ident, ns, None, None)?; + + (res == binding.res()).then_some(seg) + }); + + if let Some(unqualified) = unqualified { self.r.lint_buffer.buffer_lint_with_diagnostic( - lint, + lint::builtin::UNUSED_QUALIFICATIONS, finalize.node_id, finalize.path_span, "unnecessary qualification", lint::BuiltinLintDiagnostics::UnusedQualifications { - removal_span: finalize.path_span.until(last_segment.ident.span), + removal_span: finalize.path_span.until(unqualified.ident.span), }, - ) + ); } } diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index ee8d9ae9c53..7e31cfc0662 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -1303,6 +1303,7 @@ symbols! { pat, pat_param, path, + pattern_complexity, pattern_parentheses, phantom_data, pic, diff --git a/compiler/rustc_trait_selection/src/lib.rs b/compiler/rustc_trait_selection/src/lib.rs index 00a2adccf64..7c1bfebef2c 100644 --- a/compiler/rustc_trait_selection/src/lib.rs +++ b/compiler/rustc_trait_selection/src/lib.rs @@ -16,6 +16,7 @@ #![allow(internal_features)] #![allow(rustc::diagnostic_outside_of_impl)] #![allow(rustc::untranslatable_diagnostic)] +#![feature(assert_matches)] #![feature(associated_type_bounds)] #![feature(box_patterns)] #![feature(control_flow_enum)] diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs index 16290c8dbca..de834b8fb64 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs @@ -38,6 +38,7 @@ use rustc_span::def_id::LocalDefId; use rustc_span::symbol::{kw, sym, Ident, Symbol}; use rustc_span::{BytePos, DesugaringKind, ExpnKind, MacroKind, Span, DUMMY_SP}; use rustc_target::spec::abi; +use std::assert_matches::debug_assert_matches; use std::borrow::Cow; use std::iter; @@ -4219,30 +4220,25 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { }; let origin = TypeVariableOrigin { kind: TypeVariableOriginKind::TypeInference, span }; - let trait_def_id = proj.trait_def_id(self.tcx); // Make `Self` be equivalent to the type of the call chain // expression we're looking at now, so that we can tell what // for example `Iterator::Item` is at this point in the chain. - let args = GenericArgs::for_item(self.tcx, trait_def_id, |param, _| { - match param.kind { - ty::GenericParamDefKind::Type { .. } => { - if param.index == 0 { - return prev_ty.into(); - } - } - ty::GenericParamDefKind::Lifetime | ty::GenericParamDefKind::Const { .. } => {} + let args = GenericArgs::for_item(self.tcx, proj.def_id, |param, _| { + if param.index == 0 { + debug_assert_matches!(param.kind, ty::GenericParamDefKind::Type { .. }); + return prev_ty.into(); } self.var_for_def(span, param) }); // This will hold the resolved type of the associated type, if the // current expression implements the trait that associated type is // in. For example, this would be what `Iterator::Item` is here. - let ty_var = self.infcx.next_ty_var(origin); + let ty = self.infcx.next_ty_var(origin); // This corresponds to `<ExprTy as Iterator>::Item = _`. let projection = ty::Binder::dummy(ty::PredicateKind::Clause( ty::ClauseKind::Projection(ty::ProjectionPredicate { projection_ty: ty::AliasTy::new(self.tcx, proj.def_id, args), - term: ty_var.into(), + term: ty.into(), }), )); let body_def_id = self.tcx.hir().enclosing_body_owner(body_id); @@ -4254,14 +4250,15 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { param_env, projection, )); - if ocx.select_where_possible().is_empty() { - // `ty_var` now holds the type that `Item` is for `ExprTy`. - let ty_var = self.resolve_vars_if_possible(ty_var); - assocs_in_this_method.push(Some((span, (proj.def_id, ty_var)))); + if ocx.select_where_possible().is_empty() + && let ty = self.resolve_vars_if_possible(ty) + && !ty.is_ty_var() + { + assocs_in_this_method.push(Some((span, (proj.def_id, ty)))); } else { // `<ExprTy as Iterator>` didn't select, so likely we've // reached the end of the iterator chain, like the originating - // `Vec<_>`. + // `Vec<_>` or the `ty` couldn't be determined. // Keep the space consistent for later zipping. assocs_in_this_method.push(None); } diff --git a/compiler/rustc_type_ir/src/interner.rs b/compiler/rustc_type_ir/src/interner.rs index 7d2c42a6dbe..373540de05e 100644 --- a/compiler/rustc_type_ir/src/interner.rs +++ b/compiler/rustc_type_ir/src/interner.rs @@ -4,8 +4,8 @@ use std::hash::Hash; use crate::visit::{Flags, TypeSuperVisitable, TypeVisitable}; use crate::{ - BoundVar, BoundVars, CanonicalVarInfo, ConstKind, DebruijnIndex, DebugWithInfcx, RegionKind, - TyKind, UniverseIndex, + new, BoundVar, BoundVars, CanonicalVarInfo, ConstKind, DebugWithInfcx, RegionKind, TyKind, + UniverseIndex, }; pub trait Interner: Sized { @@ -34,7 +34,8 @@ pub trait Interner: Sized { + Into<Self::GenericArg> + IntoKind<Kind = TyKind<Self>> + TypeSuperVisitable<Self> - + Flags; + + Flags + + new::Ty<Self>; type Tys: Copy + Debug + Hash + Ord + IntoIterator<Item = Self::Ty>; type AliasTy: Copy + DebugWithInfcx<Self> + Hash + Ord; type ParamTy: Copy + Debug + Hash + Ord; @@ -56,7 +57,8 @@ pub trait Interner: Sized { + IntoKind<Kind = ConstKind<Self>> + ConstTy<Self> + TypeSuperVisitable<Self> - + Flags; + + Flags + + new::Const<Self>; type AliasConst: Copy + DebugWithInfcx<Self> + Hash + Ord; type PlaceholderConst: Copy + Debug + Hash + Ord + PlaceholderLike; type ParamConst: Copy + Debug + Hash + Ord; @@ -71,7 +73,8 @@ pub trait Interner: Sized { + Ord + Into<Self::GenericArg> + IntoKind<Kind = RegionKind<Self>> - + Flags; + + Flags + + new::Region<Self>; type EarlyParamRegion: Copy + Debug + Hash + Ord; type LateParamRegion: Copy + Debug + Hash + Ord; type BoundRegion: Copy + Debug + Hash + Ord; @@ -90,11 +93,6 @@ pub trait Interner: Sized { type ClosureKind: Copy + Debug + Hash + Eq; fn mk_canonical_var_infos(self, infos: &[CanonicalVarInfo<Self>]) -> Self::CanonicalVars; - - // FIXME: We should not have all these constructors on `Interner`, but as functions on some trait. - fn mk_bound_ty(self, debruijn: DebruijnIndex, var: BoundVar) -> Self::Ty; - fn mk_bound_region(self, debruijn: DebruijnIndex, var: BoundVar) -> Self::Region; - fn mk_bound_const(self, debruijn: DebruijnIndex, var: BoundVar, ty: Self::Ty) -> Self::Const; } /// Common capabilities of placeholder kinds diff --git a/compiler/rustc_type_ir/src/lib.rs b/compiler/rustc_type_ir/src/lib.rs index 94ccbcbd8a5..01bf79bce1c 100644 --- a/compiler/rustc_type_ir/src/lib.rs +++ b/compiler/rustc_type_ir/src/lib.rs @@ -24,6 +24,7 @@ use std::sync::Arc as Lrc; #[cfg(feature = "nightly")] pub mod codec; pub mod fold; +pub mod new; pub mod ty_info; pub mod ty_kind; pub mod visit; diff --git a/compiler/rustc_type_ir/src/new.rs b/compiler/rustc_type_ir/src/new.rs new file mode 100644 index 00000000000..e7e695e5908 --- /dev/null +++ b/compiler/rustc_type_ir/src/new.rs @@ -0,0 +1,13 @@ +use crate::{BoundVar, DebruijnIndex, Interner}; + +pub trait Ty<I: Interner<Ty = Self>> { + fn new_anon_bound(interner: I, debruijn: DebruijnIndex, var: BoundVar) -> Self; +} + +pub trait Region<I: Interner<Region = Self>> { + fn new_anon_bound(interner: I, debruijn: DebruijnIndex, var: BoundVar) -> Self; +} + +pub trait Const<I: Interner<Const = Self>> { + fn new_anon_bound(interner: I, debruijn: DebruijnIndex, var: BoundVar, ty: I::Ty) -> Self; +} diff --git a/library/core/src/macros/mod.rs b/library/core/src/macros/mod.rs index d818889f364..643968c35e8 100644 --- a/library/core/src/macros/mod.rs +++ b/library/core/src/macros/mod.rs @@ -112,16 +112,19 @@ macro_rules! assert_ne { }; } -/// Asserts that an expression matches any of the given patterns. +/// Asserts that an expression matches the provided pattern. /// -/// Like in a `match` expression, the pattern can be optionally followed by `if` -/// and a guard expression that has access to names bound by the pattern. +/// This macro is generally preferable to `assert!(matches!(value, pattern))`, because it can print +/// the debug representation of the actual value shape that did not meet expectations. In contrast, +/// using [`assert!`] will only print that expectations were not met, but not why. /// -/// On panic, this macro will print the value of the expression with its -/// debug representation. +/// The pattern syntax is exactly the same as found in a match arm and the `matches!` macro. The +/// optional if guard can be used to add additional checks that must be true for the matched value, +/// otherwise this macro will panic. /// -/// Like [`assert!`], this macro has a second form, where a custom -/// panic message can be provided. +/// On panic, this macro will print the value of the expression with its debug representation. +/// +/// Like [`assert!`], this macro has a second form, where a custom panic message can be provided. /// /// # Examples /// @@ -130,13 +133,20 @@ macro_rules! assert_ne { /// /// use std::assert_matches::assert_matches; /// -/// let a = 1u32.checked_add(2); -/// let b = 1u32.checked_sub(2); +/// let a = Some(345); +/// let b = Some(56); /// assert_matches!(a, Some(_)); -/// assert_matches!(b, None); +/// assert_matches!(b, Some(_)); +/// +/// assert_matches!(a, Some(345)); +/// assert_matches!(a, Some(345) | None); +/// +/// // assert_matches!(a, None); // panics +/// // assert_matches!(b, Some(345)); // panics +/// // assert_matches!(b, Some(345) | None); // panics /// -/// let c = Ok("abc".to_string()); -/// assert_matches!(c, Ok(x) | Err(x) if x.len() < 100); +/// assert_matches!(a, Some(x) if x > 100); +/// // assert_matches!(a, Some(x) if x < 100); // panics /// ``` #[unstable(feature = "assert_matches", issue = "82775")] #[allow_internal_unstable(panic_internals)] @@ -369,21 +379,25 @@ macro_rules! debug_assert_ne { }; } -/// Asserts that an expression matches any of the given patterns. +/// Asserts that an expression matches the provided pattern. /// -/// Like in a `match` expression, the pattern can be optionally followed by `if` -/// and a guard expression that has access to names bound by the pattern. +/// This macro is generally preferable to `debug_assert!(matches!(value, pattern))`, because it can +/// print the debug representation of the actual value shape that did not meet expectations. In +/// contrast, using [`debug_assert!`] will only print that expectations were not met, but not why. /// -/// On panic, this macro will print the value of the expression with its -/// debug representation. +/// The pattern syntax is exactly the same as found in a match arm and the `matches!` macro. The +/// optional if guard can be used to add additional checks that must be true for the matched value, +/// otherwise this macro will panic. /// -/// Unlike [`assert_matches!`], `debug_assert_matches!` statements are only -/// enabled in non optimized builds by default. An optimized build will not -/// execute `debug_assert_matches!` statements unless `-C debug-assertions` is -/// passed to the compiler. This makes `debug_assert_matches!` useful for -/// checks that are too expensive to be present in a release build but may be -/// helpful during development. The result of expanding `debug_assert_matches!` -/// is always type checked. +/// On panic, this macro will print the value of the expression with its debug representation. +/// +/// Like [`assert!`], this macro has a second form, where a custom panic message can be provided. +/// +/// Unlike [`assert_matches!`], `debug_assert_matches!` statements are only enabled in non optimized +/// builds by default. An optimized build will not execute `debug_assert_matches!` statements unless +/// `-C debug-assertions` is passed to the compiler. This makes `debug_assert_matches!` useful for +/// checks that are too expensive to be present in a release build but may be helpful during +/// development. The result of expanding `debug_assert_matches!` is always type checked. /// /// # Examples /// @@ -392,13 +406,20 @@ macro_rules! debug_assert_ne { /// /// use std::assert_matches::debug_assert_matches; /// -/// let a = 1u32.checked_add(2); -/// let b = 1u32.checked_sub(2); +/// let a = Some(345); +/// let b = Some(56); /// debug_assert_matches!(a, Some(_)); -/// debug_assert_matches!(b, None); +/// debug_assert_matches!(b, Some(_)); +/// +/// debug_assert_matches!(a, Some(345)); +/// debug_assert_matches!(a, Some(345) | None); /// -/// let c = Ok("abc".to_string()); -/// debug_assert_matches!(c, Ok(x) | Err(x) if x.len() < 100); +/// // debug_assert_matches!(a, None); // panics +/// // debug_assert_matches!(b, Some(345)); // panics +/// // debug_assert_matches!(b, Some(345) | None); // panics +/// +/// debug_assert_matches!(a, Some(x) if x > 100); +/// // debug_assert_matches!(a, Some(x) if x < 100); // panics /// ``` #[unstable(feature = "assert_matches", issue = "82775")] #[allow_internal_unstable(assert_matches)] @@ -409,10 +430,15 @@ pub macro debug_assert_matches($($arg:tt)*) { } } -/// Returns whether the given expression matches any of the given patterns. +/// Returns whether the given expression matches the provided pattern. +/// +/// The pattern syntax is exactly the same as found in a match arm. The optional if guard can be +/// used to add additional checks that must be true for the matched value, otherwise this macro will +/// return `false`. /// -/// Like in a `match` expression, the pattern can be optionally followed by `if` -/// and a guard expression that has access to names bound by the pattern. +/// When testing that a value matches a pattern, it's generally preferable to use +/// [`assert_matches!`] as it will print the debug representation of the value if the assertion +/// fails. /// /// # Examples /// diff --git a/library/core/src/ptr/mod.rs b/library/core/src/ptr/mod.rs index 018efd4b9b3..389e0d680a0 100644 --- a/library/core/src/ptr/mod.rs +++ b/library/core/src/ptr/mod.rs @@ -574,6 +574,8 @@ pub const fn null_mut<T: ?Sized + Thin>() -> *mut T { /// Creates a pointer with the given address and no provenance. /// +/// This is equivalent to `ptr::null().with_addr(addr)`. +/// /// Without provenance, this pointer is not associated with any actual allocation. Such a /// no-provenance pointer may be used for zero-sized memory accesses (if suitably aligned), but /// non-zero-sized memory accesses with a no-provenance pointer are UB. No-provenance pointers are @@ -616,6 +618,8 @@ pub const fn dangling<T>() -> *const T { /// Creates a pointer with the given address and no provenance. /// +/// This is equivalent to `ptr::null_mut().with_addr(addr)`. +/// /// Without provenance, this pointer is not associated with any actual allocation. Such a /// no-provenance pointer may be used for zero-sized memory accesses (if suitably aligned), but /// non-zero-sized memory accesses with a no-provenance pointer are UB. No-provenance pointers are diff --git a/library/proc_macro/src/bridge/client.rs b/library/proc_macro/src/bridge/client.rs index b54f2db88ff..8a1ba436f72 100644 --- a/library/proc_macro/src/bridge/client.rs +++ b/library/proc_macro/src/bridge/client.rs @@ -209,7 +209,7 @@ impl<'a> scoped_cell::ApplyL<'a> for BridgeStateL { thread_local! { static BRIDGE_STATE: scoped_cell::ScopedCell<BridgeStateL> = - scoped_cell::ScopedCell::new(BridgeState::NotConnected); + const { scoped_cell::ScopedCell::new(BridgeState::NotConnected) }; } impl BridgeState<'_> { diff --git a/library/proc_macro/src/bridge/server.rs b/library/proc_macro/src/bridge/server.rs index 8736d1806fb..0dbd4bac85c 100644 --- a/library/proc_macro/src/bridge/server.rs +++ b/library/proc_macro/src/bridge/server.rs @@ -223,7 +223,7 @@ thread_local! { /// This is required as the thread-local state in the proc_macro client does /// not handle being re-entered, and will invalidate all `Symbol`s when /// entering a nested macro. - static ALREADY_RUNNING_SAME_THREAD: Cell<bool> = Cell::new(false); + static ALREADY_RUNNING_SAME_THREAD: Cell<bool> = const { Cell::new(false) }; } /// Keep `ALREADY_RUNNING_SAME_THREAD` (see also its documentation) diff --git a/library/std/src/sys/pal/wasm/atomics/thread.rs b/library/std/src/sys/pal/wasm/atomics/thread.rs index 49f936f1449..3923ff821d9 100644 --- a/library/std/src/sys/pal/wasm/atomics/thread.rs +++ b/library/std/src/sys/pal/wasm/atomics/thread.rs @@ -1,4 +1,5 @@ use crate::ffi::CStr; +use crate::ffi::CString; use crate::io; use crate::num::NonZero; use crate::sys::unsupported; @@ -17,6 +18,9 @@ impl Thread { pub fn yield_now() {} pub fn set_name(_name: &CStr) {} + pub fn get_name() -> Option<CString> { + None + } pub fn sleep(dur: Duration) { use crate::arch::wasm32; diff --git a/src/ci/docker/host-x86_64/dist-ohos/Dockerfile b/src/ci/docker/host-x86_64/dist-ohos/Dockerfile new file mode 100644 index 00000000000..6dff3095b46 --- /dev/null +++ b/src/ci/docker/host-x86_64/dist-ohos/Dockerfile @@ -0,0 +1,57 @@ +FROM ubuntu:23.04 + +ARG DEBIAN_FRONTEND=noninteractive +RUN apt-get update && apt-get install -y --no-install-recommends \ + g++ \ + make \ + ninja-build \ + file \ + curl \ + ca-certificates \ + python3 \ + git \ + cmake \ + sudo \ + gdb \ + libssl-dev \ + pkg-config \ + xz-utils \ + unzip \ + && rm -rf /var/lib/apt/lists/* + +COPY scripts/ohos-sdk.sh /scripts/ +RUN sh /scripts/ohos-sdk.sh + +COPY scripts/ohos/aarch64-unknown-linux-ohos-clang.sh /usr/local/bin/ +COPY scripts/ohos/aarch64-unknown-linux-ohos-clang++.sh /usr/local/bin/ +COPY scripts/ohos/armv7-unknown-linux-ohos-clang.sh /usr/local/bin/ +COPY scripts/ohos/armv7-unknown-linux-ohos-clang++.sh /usr/local/bin/ +COPY scripts/ohos/x86_64-unknown-linux-ohos-clang.sh /usr/local/bin/ +COPY scripts/ohos/x86_64-unknown-linux-ohos-clang++.sh /usr/local/bin/ + +# env +ENV TARGETS=aarch64-unknown-linux-ohos +ENV TARGETS=$TARGETS,armv7-unknown-linux-ohos +ENV TARGETS=$TARGETS,x86_64-unknown-linux-ohos + +ENV \ + CC_aarch64_unknown_linux_ohos=/usr/local/bin/aarch64-unknown-linux-ohos-clang.sh \ + AR_aarch64_unknown_linux_ohos=/opt/ohos-sdk/native/llvm/bin/llvm-ar \ + CXX_aarch64_unknown_linux_ohos=/usr/local/bin/aarch64-unknown-linux-ohos-clang++.sh +ENV \ + CC_armv7_unknown_linux_ohos=/usr/local/bin/armv7-unknown-linux-ohos-clang.sh \ + AR_armv7_unknown_linux_ohos=/opt/ohos-sdk/native/llvm/bin/llvm-ar \ + CXX_armv7_unknown_linux_ohos=/usr/local/bin/armv7-unknown-linux-ohos-clang++.sh +ENV \ + CC_x86_64_unknown_linux_ohos=/usr/local/bin/x86_64-unknown-linux-ohos-clang.sh \ + AR_x86_64_unknown_linux_ohos=/opt/ohos-sdk/native/llvm/bin/llvm-ar \ + CXX_x86_64_unknown_linux_ohos=/usr/local/bin/x86_64-unknown-linux-ohos-clang++.sh + +ENV RUST_CONFIGURE_ARGS \ + --enable-profiler \ + --disable-docs + +ENV SCRIPT python3 ../x.py dist --host='' --target $TARGETS + +COPY scripts/sccache.sh /scripts/ +RUN sh /scripts/sccache.sh diff --git a/src/ci/docker/scripts/ohos-sdk.sh b/src/ci/docker/scripts/ohos-sdk.sh new file mode 100755 index 00000000000..321be2b8697 --- /dev/null +++ b/src/ci/docker/scripts/ohos-sdk.sh @@ -0,0 +1,9 @@ +#!/bin/sh +set -ex + +URL=https://repo.huaweicloud.com/openharmony/os/4.0-Release/ohos-sdk-windows_linux-public.tar.gz + +curl $URL | tar xz -C /tmp ohos-sdk/linux/native-linux-x64-4.0.10.13-Release.zip +mkdir /opt/ohos-sdk +cd /opt/ohos-sdk +unzip -qq /tmp/ohos-sdk/linux/native-linux-x64-4.0.10.13-Release.zip diff --git a/src/ci/docker/scripts/ohos/aarch64-unknown-linux-ohos-clang++.sh b/src/ci/docker/scripts/ohos/aarch64-unknown-linux-ohos-clang++.sh new file mode 100755 index 00000000000..5dfb4c72ffe --- /dev/null +++ b/src/ci/docker/scripts/ohos/aarch64-unknown-linux-ohos-clang++.sh @@ -0,0 +1,6 @@ +#!/bin/sh +exec /opt/ohos-sdk/native/llvm/bin/clang++ \ + -target aarch64-linux-ohos \ + --sysroot=/opt/ohos-sdk/native/sysroot \ + -D__MUSL__ \ + "$@" diff --git a/src/ci/docker/scripts/ohos/aarch64-unknown-linux-ohos-clang.sh b/src/ci/docker/scripts/ohos/aarch64-unknown-linux-ohos-clang.sh new file mode 100755 index 00000000000..972e564fffb --- /dev/null +++ b/src/ci/docker/scripts/ohos/aarch64-unknown-linux-ohos-clang.sh @@ -0,0 +1,6 @@ +#!/bin/sh +exec /opt/ohos-sdk/native/llvm/bin/clang \ + -target aarch64-linux-ohos \ + --sysroot=/opt/ohos-sdk/native/sysroot \ + -D__MUSL__ \ + "$@" diff --git a/src/ci/docker/scripts/ohos/armv7-unknown-linux-ohos-clang++.sh b/src/ci/docker/scripts/ohos/armv7-unknown-linux-ohos-clang++.sh new file mode 100755 index 00000000000..d8f99b3d0cd --- /dev/null +++ b/src/ci/docker/scripts/ohos/armv7-unknown-linux-ohos-clang++.sh @@ -0,0 +1,10 @@ +#!/bin/sh +exec /opt/ohos-sdk/native/llvm/bin/clang++ \ + -target arm-linux-ohos \ + --sysroot=/opt/ohos-sdk/native/sysroot \ + -D__MUSL__ \ + -march=armv7-a \ + -mfloat-abi=softfp \ + -mtune=generic-armv7-a \ + -mthumb \ + "$@" diff --git a/src/ci/docker/scripts/ohos/armv7-unknown-linux-ohos-clang.sh b/src/ci/docker/scripts/ohos/armv7-unknown-linux-ohos-clang.sh new file mode 100755 index 00000000000..fe92ec41b78 --- /dev/null +++ b/src/ci/docker/scripts/ohos/armv7-unknown-linux-ohos-clang.sh @@ -0,0 +1,10 @@ +#!/bin/sh +exec /opt/ohos-sdk/native/llvm/bin/clang \ + -target arm-linux-ohos \ + --sysroot=/opt/ohos-sdk/native/sysroot \ + -D__MUSL__ \ + -march=armv7-a \ + -mfloat-abi=softfp \ + -mtune=generic-armv7-a \ + -mthumb \ + "$@" diff --git a/src/ci/docker/scripts/ohos/x86_64-unknown-linux-ohos-clang++.sh b/src/ci/docker/scripts/ohos/x86_64-unknown-linux-ohos-clang++.sh new file mode 100755 index 00000000000..a45df15b1bf --- /dev/null +++ b/src/ci/docker/scripts/ohos/x86_64-unknown-linux-ohos-clang++.sh @@ -0,0 +1,6 @@ +#!/bin/sh +exec /opt/ohos-sdk/native/llvm/bin/clang++ \ + -target x86_64-linux-ohos \ + --sysroot=/opt/ohos-sdk/native/sysroot \ + -D__MUSL__ \ + "$@" diff --git a/src/ci/docker/scripts/ohos/x86_64-unknown-linux-ohos-clang.sh b/src/ci/docker/scripts/ohos/x86_64-unknown-linux-ohos-clang.sh new file mode 100755 index 00000000000..3bf4c5777f1 --- /dev/null +++ b/src/ci/docker/scripts/ohos/x86_64-unknown-linux-ohos-clang.sh @@ -0,0 +1,6 @@ +#!/bin/sh +exec /opt/ohos-sdk/native/llvm/bin/clang \ + -target x86_64-linux-ohos \ + --sysroot=/opt/ohos-sdk/native/sysroot \ + -D__MUSL__ \ + "$@" diff --git a/src/ci/github-actions/ci.yml b/src/ci/github-actions/ci.yml index 58d5dec9ba5..2ba5d357a1d 100644 --- a/src/ci/github-actions/ci.yml +++ b/src/ci/github-actions/ci.yml @@ -413,6 +413,9 @@ jobs: - name: dist-loongarch64-linux <<: *job-linux-8c + - name: dist-ohos + <<: *job-linux-8c + - name: dist-powerpc-linux <<: *job-linux-8c diff --git a/src/doc/rustc/src/platform-support.md b/src/doc/rustc/src/platform-support.md index f1e3ad81b85..5500dca9dc2 100644 --- a/src/doc/rustc/src/platform-support.md +++ b/src/doc/rustc/src/platform-support.md @@ -143,6 +143,7 @@ target | std | notes `aarch64-fuchsia` | ✓ | Alias for `aarch64-unknown-fuchsia` [`aarch64-unknown-fuchsia`](platform-support/fuchsia.md) | ✓ | ARM64 Fuchsia [`aarch64-linux-android`](platform-support/android.md) | ✓ | ARM64 Android +[`aarch64-unknown-linux-ohos`](platform-support/openharmony.md) | ✓ | ARM64 OpenHarmony `aarch64-unknown-none-softfloat` | * | Bare ARM64, softfloat `aarch64-unknown-none` | * | Bare ARM64, hardfloat [`aarch64-unknown-uefi`](platform-support/unknown-uefi.md) | * | ARM64 UEFI @@ -157,6 +158,7 @@ target | std | notes `armv7-unknown-linux-gnueabi` | ✓ | ARMv7-A Linux (kernel 4.15, glibc 2.27) `armv7-unknown-linux-musleabi` | ✓ | ARMv7-A Linux with MUSL `armv7-unknown-linux-musleabihf` | ✓ | ARMv7-A Linux with MUSL, hardfloat +[`armv7-unknown-linux-ohos`](platform-support/openharmony.md) | ✓ | ARMv7-A OpenHarmony [`armv7a-none-eabi`](platform-support/arm-none-eabi.md) | * | Bare ARMv7-A [`armv7r-none-eabi`](platform-support/armv7r-none-eabi.md) | * | Bare ARMv7-R [`armv7r-none-eabihf`](platform-support/armv7r-none-eabi.md) | * | Bare ARMv7-R, hardfloat @@ -199,6 +201,7 @@ target | std | notes [`x86_64-linux-android`](platform-support/android.md) | ✓ | 64-bit x86 Android `x86_64-pc-solaris` | ✓ | 64-bit Solaris 11, illumos `x86_64-unknown-linux-gnux32` | ✓ | 64-bit Linux (x32 ABI) (kernel 4.15, glibc 2.27) +[`x86_64-unknown-linux-ohos`](platform-support/openharmony.md) | ✓ | x86_64 OpenHarmony [`x86_64-unknown-none`](platform-support/x86_64-unknown-none.md) | * | Freestanding/bare-metal x86_64, softfloat `x86_64-unknown-redox` | ✓ | Redox OS [`x86_64-unknown-uefi`](platform-support/unknown-uefi.md) | * | 64-bit UEFI @@ -244,7 +247,6 @@ target | std | host | notes [`aarch64-kmc-solid_asp3`](platform-support/kmc-solid.md) | ✓ | | ARM64 SOLID with TOPPERS/ASP3 [`aarch64-nintendo-switch-freestanding`](platform-support/aarch64-nintendo-switch-freestanding.md) | * | | ARM64 Nintendo Switch, Horizon [`aarch64-pc-windows-gnullvm`](platform-support/pc-windows-gnullvm.md) | ✓ | ✓ | -[`aarch64-unknown-linux-ohos`](platform-support/openharmony.md) | ✓ | | ARM64 OpenHarmony | [`aarch64-unknown-teeos`](platform-support/aarch64-unknown-teeos.md) | ? | | ARM64 TEEOS | [`aarch64-unknown-nto-qnx710`](platform-support/nto-qnx.md) | ✓ | | ARM64 QNX Neutrino 7.1 RTOS | `aarch64-unknown-freebsd` | ✓ | ✓ | ARM64 FreeBSD @@ -269,7 +271,6 @@ target | std | host | notes [`armv6-unknown-netbsd-eabihf`](platform-support/netbsd.md) | ✓ | ✓ | ARMv6 NetBSD w/hard-float [`armv6k-nintendo-3ds`](platform-support/armv6k-nintendo-3ds.md) | ? | | ARMv6K Nintendo 3DS, Horizon (Requires devkitARM toolchain) [`armv7-sony-vita-newlibeabihf`](platform-support/armv7-sony-vita-newlibeabihf.md) | ✓ | | ARMv7-A Cortex-A9 Sony PlayStation Vita (requires VITASDK toolchain) -[`armv7-unknown-linux-ohos`](platform-support/openharmony.md) | ✓ | | ARMv7-A OpenHarmony | [`armv7-unknown-linux-uclibceabi`](platform-support/armv7-unknown-linux-uclibceabi.md) | ✓ | ✓ | ARMv7-A Linux with uClibc, softfloat [`armv7-unknown-linux-uclibceabihf`](platform-support/armv7-unknown-linux-uclibceabihf.md) | ✓ | ? | ARMv7-A Linux with uClibc, hardfloat `armv7-unknown-freebsd` | ✓ | ✓ | ARMv7-A FreeBSD @@ -374,7 +375,6 @@ target | std | host | notes `x86_64-unknown-haiku` | ✓ | ✓ | 64-bit Haiku [`x86_64-unknown-hermit`](platform-support/hermit.md) | ✓ | | x86_64 Hermit `x86_64-unknown-l4re-uclibc` | ? | | -[`x86_64-unknown-linux-ohos`](platform-support/openharmony.md) | ✓ | | x86_64 OpenHarmony | [`x86_64-unknown-openbsd`](platform-support/openbsd.md) | ✓ | ✓ | 64-bit OpenBSD `x86_64-uwp-windows-gnu` | ✓ | | `x86_64-uwp-windows-msvc` | ✓ | | diff --git a/src/doc/rustc/src/platform-support/openharmony.md b/src/doc/rustc/src/platform-support/openharmony.md index 05fd407ed71..9f90e741326 100644 --- a/src/doc/rustc/src/platform-support/openharmony.md +++ b/src/doc/rustc/src/platform-support/openharmony.md @@ -1,6 +1,6 @@ # `*-unknown-linux-ohos` -**Tier: 3** +**Tier: 2** Targets for the [OpenHarmony](https://gitee.com/openharmony/docs/) operating system. @@ -8,6 +8,7 @@ system. ## Target maintainers - Amanieu d'Antras ([@Amanieu](https://github.com/Amanieu)) +- Lu Binglun ([@lubinglun](https://github.com/lubinglun)) ## Setup diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs index 808fb0c07ea..f0975fc0823 100644 --- a/src/tools/build-manifest/src/main.rs +++ b/src/tools/build-manifest/src/main.rs @@ -60,6 +60,7 @@ static TARGETS: &[&str] = &[ "aarch64-unknown-hermit", "aarch64-unknown-linux-gnu", "aarch64-unknown-linux-musl", + "aarch64-unknown-linux-ohos", "aarch64-unknown-none", "aarch64-unknown-none-softfloat", "aarch64-unknown-redox", @@ -79,6 +80,7 @@ static TARGETS: &[&str] = &[ "thumbv7neon-unknown-linux-gnueabihf", "armv7-unknown-linux-musleabi", "armv7-unknown-linux-musleabihf", + "armv7-unknown-linux-ohos", "armebv7r-none-eabi", "armebv7r-none-eabihf", "armv7r-none-eabi", @@ -161,6 +163,7 @@ static TARGETS: &[&str] = &[ "x86_64-unknown-linux-gnu", "x86_64-unknown-linux-gnux32", "x86_64-unknown-linux-musl", + "x86_64-unknown-linux-ohos", "x86_64-unknown-netbsd", "x86_64-unknown-none", "x86_64-unknown-redox", diff --git a/src/tools/miri/README.md b/src/tools/miri/README.md index 944d2bbe879..5eb8c0fa7c9 100644 --- a/src/tools/miri/README.md +++ b/src/tools/miri/README.md @@ -412,6 +412,8 @@ to Miri failing to detect cases of undefined behavior in a program. The default is to search for and remove unreachable provenance once every `10000` basic blocks. Setting this to `0` disables the garbage collector, which causes some programs to have explosive memory usage and/or super-linear runtime. +* `-Zmiri-track-alloc-accesses` show not only allocation and free events for tracked allocations, + but also reads and writes. * `-Zmiri-track-alloc-id=<id1>,<id2>,...` shows a backtrace when the given allocations are being allocated or freed. This helps in debugging memory leaks and use after free bugs. Specifying this argument multiple times does not overwrite the previous @@ -588,6 +590,7 @@ Definite bugs found: * [Dropping with unaligned pointers in `vec::IntoIter`](https://github.com/rust-lang/rust/pull/106084) * [Deallocating with the wrong layout in new specializations for in-place `Iterator::collect`](https://github.com/rust-lang/rust/pull/118460) * [Incorrect offset computation for highly-aligned types in `portable-atomic-util`](https://github.com/taiki-e/portable-atomic/pull/138) +* [Occasional memory leak in `std::mpsc` channels](https://github.com/rust-lang/rust/issues/121582) (original code in [crossbeam](https://github.com/crossbeam-rs/crossbeam/pull/1084)) Violations of [Stacked Borrows] found that are likely bugs (but Stacked Borrows is currently just an experiment): diff --git a/src/tools/miri/miri-script/src/commands.rs b/src/tools/miri/miri-script/src/commands.rs index aa43aa15485..88ee62fc18a 100644 --- a/src/tools/miri/miri-script/src/commands.rs +++ b/src/tools/miri/miri-script/src/commands.rs @@ -356,11 +356,17 @@ impl Command { .unwrap_or_else(|_| "0".into()) .parse() .context("failed to parse MIRI_SEED_START")?; - let seed_count: u64 = env::var("MIRI_SEEDS") - .unwrap_or_else(|_| "256".into()) - .parse() - .context("failed to parse MIRI_SEEDS")?; - let seed_end = seed_start + seed_count; + let seed_end: u64 = match (env::var("MIRI_SEEDS"), env::var("MIRI_SEED_END")) { + (Ok(_), Ok(_)) => bail!("Only one of MIRI_SEEDS and MIRI_SEED_END may be set"), + (Ok(seeds), Err(_)) => + seed_start + seeds.parse::<u64>().context("failed to parse MIRI_SEEDS")?, + (Err(_), Ok(seed_end)) => seed_end.parse().context("failed to parse MIRI_SEED_END")?, + (Err(_), Err(_)) => seed_start + 256, + }; + if seed_end <= seed_start { + bail!("the end of the seed range must be larger than the start."); + } + let Some((command_name, trailing_args)) = command.split_first() else { bail!("expected many-seeds command to be non-empty"); }; diff --git a/src/tools/miri/miri-script/src/main.rs b/src/tools/miri/miri-script/src/main.rs index 41b82cfc472..712180be282 100644 --- a/src/tools/miri/miri-script/src/main.rs +++ b/src/tools/miri/miri-script/src/main.rs @@ -113,8 +113,9 @@ sysroot, to prevent conflicts with other toolchains. ./miri many-seeds <command>: Runs <command> over and over again with different seeds for Miri. The MIRIFLAGS variable is set to its original value appended with ` -Zmiri-seed=$SEED` for -many different seeds. The MIRI_SEEDS variable controls how many seeds are being -tried; MIRI_SEED_START controls the first seed to try. +many different seeds. MIRI_SEED_START controls the first seed to try (default: 0). +MIRI_SEEDS controls how many seeds are being tried (default: 256); +alternatively, MIRI_SEED_END controls the end of the (exclusive) seed range to try. ./miri bench <benches>: Runs the benchmarks from bench-cargo-miri in hyperfine. hyperfine needs to be installed. diff --git a/src/tools/miri/miri.bat b/src/tools/miri/miri.bat index 91e8a6e8f3b..959e54d8844 100644 --- a/src/tools/miri/miri.bat +++ b/src/tools/miri/miri.bat @@ -2,7 +2,10 @@ :: Windows will not execute the bash script, and select this. @echo off set MIRI_SCRIPT_TARGET_DIR=%0\..\miri-script\target -cargo build %CARGO_EXTRA_FLAGS% -q --target-dir %MIRI_SCRIPT_TARGET_DIR% --manifest-path %0\..\miri-script\Cargo.toml + +:: If any other steps are added, the "|| exit /b" must be appended to early +:: return from the script. If not, it will continue execution. +cargo build %CARGO_EXTRA_FLAGS% -q --target-dir %MIRI_SCRIPT_TARGET_DIR% --manifest-path %0\..\miri-script\Cargo.toml || exit /b :: Forwards all arguments to this file to the executable. :: We invoke the binary directly to avoid going through rustup, which would set some extra diff --git a/src/tools/miri/rust-version b/src/tools/miri/rust-version index 02ab748c447..75124dc8ff5 100644 --- a/src/tools/miri/rust-version +++ b/src/tools/miri/rust-version @@ -1 +1 @@ -c5f69bdd5173a948e0131f934fa7c4cbf5e0b55f +1a1876c9790f168fb51afa335a7ba3e6fc267d75 diff --git a/src/tools/miri/src/bin/miri.rs b/src/tools/miri/src/bin/miri.rs index 281a32b77c5..2f37a64576e 100644 --- a/src/tools/miri/src/bin/miri.rs +++ b/src/tools/miri/src/bin/miri.rs @@ -534,6 +534,8 @@ fn main() { ), }; miri_config.tracked_alloc_ids.extend(ids); + } else if arg == "-Zmiri-track-alloc-accesses" { + miri_config.track_alloc_accesses = true; } else if let Some(param) = arg.strip_prefix("-Zmiri-compare-exchange-weak-failure-rate=") { let rate = match param.parse::<f64>() { Ok(rate) if rate >= 0.0 && rate <= 1.0 => rate, diff --git a/src/tools/miri/src/borrow_tracker/mod.rs b/src/tools/miri/src/borrow_tracker/mod.rs index 711323b51c2..262f7c449d2 100644 --- a/src/tools/miri/src/borrow_tracker/mod.rs +++ b/src/tools/miri/src/borrow_tracker/mod.rs @@ -122,13 +122,6 @@ impl VisitProvenance for GlobalStateInner { /// We need interior mutable access to the global state. pub type GlobalState = RefCell<GlobalStateInner>; -/// Indicates which kind of access is being performed. -#[derive(Copy, Clone, Hash, PartialEq, Eq, Debug)] -pub enum AccessKind { - Read, - Write, -} - impl fmt::Display for AccessKind { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { @@ -384,7 +377,12 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { if matches!(kind, AllocKind::LiveData) { let alloc_extra = this.get_alloc_extra(*alloc_id)?; // can still fail for `extern static` let alloc_borrow_tracker = &alloc_extra.borrow_tracker.as_ref().unwrap(); - alloc_borrow_tracker.release_protector(&this.machine, borrow_tracker, *tag)?; + alloc_borrow_tracker.release_protector( + &this.machine, + borrow_tracker, + *tag, + *alloc_id, + )?; } } borrow_tracker.borrow_mut().end_call(&frame.extra); @@ -498,10 +496,12 @@ impl AllocState { machine: &MiriMachine<'_, 'tcx>, global: &GlobalState, tag: BorTag, + alloc_id: AllocId, // diagnostics ) -> InterpResult<'tcx> { match self { AllocState::StackedBorrows(_sb) => Ok(()), - AllocState::TreeBorrows(tb) => tb.borrow_mut().release_protector(machine, global, tag), + AllocState::TreeBorrows(tb) => + tb.borrow_mut().release_protector(machine, global, tag, alloc_id), } } } diff --git a/src/tools/miri/src/borrow_tracker/stacked_borrows/diagnostics.rs b/src/tools/miri/src/borrow_tracker/stacked_borrows/diagnostics.rs index b964b1f9ec2..aa99a14b18e 100644 --- a/src/tools/miri/src/borrow_tracker/stacked_borrows/diagnostics.rs +++ b/src/tools/miri/src/borrow_tracker/stacked_borrows/diagnostics.rs @@ -5,7 +5,7 @@ use rustc_data_structures::fx::FxHashSet; use rustc_span::{Span, SpanData}; use rustc_target::abi::Size; -use crate::borrow_tracker::{AccessKind, GlobalStateInner, ProtectorKind}; +use crate::borrow_tracker::{GlobalStateInner, ProtectorKind}; use crate::*; /// Error reporting diff --git a/src/tools/miri/src/borrow_tracker/stacked_borrows/mod.rs b/src/tools/miri/src/borrow_tracker/stacked_borrows/mod.rs index 0fe422180f7..86d22229714 100644 --- a/src/tools/miri/src/borrow_tracker/stacked_borrows/mod.rs +++ b/src/tools/miri/src/borrow_tracker/stacked_borrows/mod.rs @@ -16,7 +16,7 @@ use rustc_target::abi::{Abi, Size}; use crate::borrow_tracker::{ stacked_borrows::diagnostics::{AllocHistory, DiagnosticCx, DiagnosticCxBuilder}, - AccessKind, GlobalStateInner, ProtectorKind, + GlobalStateInner, ProtectorKind, }; use crate::*; diff --git a/src/tools/miri/src/borrow_tracker/tree_borrows/diagnostics.rs b/src/tools/miri/src/borrow_tracker/tree_borrows/diagnostics.rs index 43e6616e34a..4394e3c2c86 100644 --- a/src/tools/miri/src/borrow_tracker/tree_borrows/diagnostics.rs +++ b/src/tools/miri/src/borrow_tracker/tree_borrows/diagnostics.rs @@ -9,7 +9,7 @@ use crate::borrow_tracker::tree_borrows::{ tree::LocationState, unimap::UniIndex, }; -use crate::borrow_tracker::{AccessKind, ProtectorKind}; +use crate::borrow_tracker::ProtectorKind; use crate::*; /// Cause of an access: either a real access or one @@ -278,6 +278,8 @@ impl History { pub(super) struct TbError<'node> { /// What failure occurred. pub error_kind: TransitionError, + /// The allocation in which the error is happening. + pub alloc_id: AllocId, /// The offset (into the allocation) at which the conflict occurred. pub error_offset: u64, /// The tag on which the error was triggered. @@ -300,7 +302,11 @@ impl TbError<'_> { let accessed = self.accessed_info; let conflicting = self.conflicting_info; let accessed_is_conflicting = accessed.tag == conflicting.tag; - let title = format!("{cause} through {accessed} is forbidden"); + let title = format!( + "{cause} through {accessed} at {alloc_id:?}[{offset:#x}] is forbidden", + alloc_id = self.alloc_id, + offset = self.error_offset + ); let (title, details, conflicting_tag_name) = match self.error_kind { ChildAccessForbidden(perm) => { let conflicting_tag_name = diff --git a/src/tools/miri/src/borrow_tracker/tree_borrows/mod.rs b/src/tools/miri/src/borrow_tracker/tree_borrows/mod.rs index cc982865341..4b944ea88f5 100644 --- a/src/tools/miri/src/borrow_tracker/tree_borrows/mod.rs +++ b/src/tools/miri/src/borrow_tracker/tree_borrows/mod.rs @@ -1,6 +1,3 @@ -use rustc_target::abi::{Abi, Size}; - -use crate::borrow_tracker::{AccessKind, GlobalState, GlobalStateInner, ProtectorKind}; use rustc_middle::{ mir::{Mutability, RetagKind}, ty::{ @@ -10,7 +7,9 @@ use rustc_middle::{ }, }; use rustc_span::def_id::DefId; +use rustc_target::abi::{Abi, Size}; +use crate::borrow_tracker::{GlobalState, GlobalStateInner, ProtectorKind}; use crate::*; pub mod diagnostics; @@ -70,6 +69,7 @@ impl<'tcx> Tree { tag, Some(range), global, + alloc_id, span, diagnostics::AccessCause::Explicit(access_kind), ) @@ -78,7 +78,7 @@ impl<'tcx> Tree { /// Check that this pointer has permission to deallocate this range. pub fn before_memory_deallocation( &mut self, - _alloc_id: AllocId, + alloc_id: AllocId, prov: ProvenanceExtra, range: AllocRange, machine: &MiriMachine<'_, 'tcx>, @@ -91,7 +91,7 @@ impl<'tcx> Tree { }; let global = machine.borrow_tracker.as_ref().unwrap(); let span = machine.current_span(); - self.dealloc(tag, range, global, span) + self.dealloc(tag, range, global, alloc_id, span) } pub fn expose_tag(&mut self, _tag: BorTag) { @@ -109,6 +109,7 @@ impl<'tcx> Tree { machine: &MiriMachine<'_, 'tcx>, global: &GlobalState, tag: BorTag, + alloc_id: AllocId, // diagnostics ) -> InterpResult<'tcx> { let span = machine.current_span(); self.perform_access( @@ -116,6 +117,7 @@ impl<'tcx> Tree { tag, None, // no specified range because it occurs on the entire allocation global, + alloc_id, span, diagnostics::AccessCause::FnExit, ) @@ -211,7 +213,7 @@ trait EvalContextPrivExt<'mir: 'ecx, 'tcx: 'mir, 'ecx>: crate::MiriInterpCxExt<' let global = this.machine.borrow_tracker.as_ref().unwrap().borrow(); let ty = place.layout.ty; if global.tracked_pointer_tags.contains(&new_tag) { - let kind_str = format!("{new_perm:?} (pointee type {ty})"); + let kind_str = format!("initial state {} (pointee type {ty})", new_perm.initial_state); this.emit_diagnostic(NonHaltingDiagnostic::CreatedPointerTag( new_tag.inner(), Some(kind_str), @@ -299,6 +301,7 @@ trait EvalContextPrivExt<'mir: 'ecx, 'tcx: 'mir, 'ecx>: crate::MiriInterpCxExt<' orig_tag, Some(range), this.machine.borrow_tracker.as_ref().unwrap(), + alloc_id, this.machine.current_span(), diagnostics::AccessCause::Reborrow, )?; diff --git a/src/tools/miri/src/borrow_tracker/tree_borrows/perms.rs b/src/tools/miri/src/borrow_tracker/tree_borrows/perms.rs index bf72e902993..5c7f5ea46ba 100644 --- a/src/tools/miri/src/borrow_tracker/tree_borrows/perms.rs +++ b/src/tools/miri/src/borrow_tracker/tree_borrows/perms.rs @@ -3,7 +3,7 @@ use std::fmt; use crate::borrow_tracker::tree_borrows::diagnostics::TransitionError; use crate::borrow_tracker::tree_borrows::tree::AccessRelatedness; -use crate::borrow_tracker::AccessKind; +use crate::AccessKind; /// The activation states of a pointer. #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] diff --git a/src/tools/miri/src/borrow_tracker/tree_borrows/tree.rs b/src/tools/miri/src/borrow_tracker/tree_borrows/tree.rs index 4b47cc0cb82..dda1c7cca19 100644 --- a/src/tools/miri/src/borrow_tracker/tree_borrows/tree.rs +++ b/src/tools/miri/src/borrow_tracker/tree_borrows/tree.rs @@ -24,7 +24,7 @@ use crate::borrow_tracker::tree_borrows::{ unimap::{UniEntry, UniIndex, UniKeyMap, UniValMap}, Permission, }; -use crate::borrow_tracker::{AccessKind, GlobalState, ProtectorKind}; +use crate::borrow_tracker::{GlobalState, ProtectorKind}; use crate::*; mod tests; @@ -516,13 +516,15 @@ impl<'tcx> Tree { tag: BorTag, access_range: AllocRange, global: &GlobalState, - span: Span, // diagnostics + alloc_id: AllocId, // diagnostics + span: Span, // diagnostics ) -> InterpResult<'tcx> { self.perform_access( AccessKind::Write, tag, Some(access_range), global, + alloc_id, span, diagnostics::AccessCause::Dealloc, )?; @@ -545,6 +547,7 @@ impl<'tcx> Tree { TbError { conflicting_info, access_cause: diagnostics::AccessCause::Dealloc, + alloc_id, error_offset: perms_range.start, error_kind, accessed_info, @@ -576,6 +579,7 @@ impl<'tcx> Tree { tag: BorTag, access_range: Option<AllocRange>, global: &GlobalState, + alloc_id: AllocId, // diagnostics span: Span, // diagnostics access_cause: diagnostics::AccessCause, // diagnostics ) -> InterpResult<'tcx> { @@ -628,6 +632,7 @@ impl<'tcx> Tree { TbError { conflicting_info, access_cause, + alloc_id, error_offset: perms_range.start, error_kind, accessed_info, diff --git a/src/tools/miri/src/concurrency/data_race.rs b/src/tools/miri/src/concurrency/data_race.rs index a280448ae05..e3044884083 100644 --- a/src/tools/miri/src/concurrency/data_race.rs +++ b/src/tools/miri/src/concurrency/data_race.rs @@ -812,6 +812,7 @@ impl VClockAlloc { | MiriMemoryKind::Miri | MiriMemoryKind::C | MiriMemoryKind::WinHeap + | MiriMemoryKind::WinLocal | MiriMemoryKind::Mmap, ) | MemoryKind::Stack => { @@ -820,7 +821,8 @@ impl VClockAlloc { alloc_timestamp.span = current_span; (alloc_timestamp, alloc_index) } - // Other global memory should trace races but be allocated at the 0 timestamp. + // Other global memory should trace races but be allocated at the 0 timestamp + // (conceptually they are allocated before everything). MemoryKind::Machine( MiriMemoryKind::Global | MiriMemoryKind::Machine @@ -1673,8 +1675,8 @@ impl GlobalState { vector: VectorIdx, ) -> String { let thread = self.vector_info.borrow()[vector]; - let thread_name = thread_mgr.get_thread_name(thread); - format!("thread `{}`", String::from_utf8_lossy(thread_name)) + let thread_name = thread_mgr.get_thread_display_name(thread); + format!("thread `{thread_name}`") } /// Acquire a lock, express that the previous call of diff --git a/src/tools/miri/src/concurrency/thread.rs b/src/tools/miri/src/concurrency/thread.rs index 822ba8bf922..83ca27a467c 100644 --- a/src/tools/miri/src/concurrency/thread.rs +++ b/src/tools/miri/src/concurrency/thread.rs @@ -160,9 +160,18 @@ pub type StackEmptyCallback<'mir, 'tcx> = Box<dyn FnMut(&mut MiriInterpCx<'mir, 'tcx>) -> InterpResult<'tcx, Poll<()>>>; impl<'mir, 'tcx> Thread<'mir, 'tcx> { - /// Get the name of the current thread, or `<unnamed>` if it was not set. - fn thread_name(&self) -> &[u8] { - if let Some(ref thread_name) = self.thread_name { thread_name } else { b"<unnamed>" } + /// Get the name of the current thread if it was set. + fn thread_name(&self) -> Option<&[u8]> { + self.thread_name.as_deref() + } + + /// Get the name of the current thread for display purposes; will include thread ID if not set. + fn thread_display_name(&self, id: ThreadId) -> String { + if let Some(ref thread_name) = self.thread_name { + String::from_utf8_lossy(thread_name).into_owned() + } else { + format!("unnamed-{}", id.index()) + } } /// Return the top user-relevant frame, if there is one. @@ -205,7 +214,7 @@ impl<'mir, 'tcx> std::fmt::Debug for Thread<'mir, 'tcx> { write!( f, "{}({:?}, {:?})", - String::from_utf8_lossy(self.thread_name()), + String::from_utf8_lossy(self.thread_name().unwrap_or(b"<unnamed>")), self.state, self.join_status ) @@ -572,10 +581,14 @@ impl<'mir, 'tcx: 'mir> ThreadManager<'mir, 'tcx> { } /// Get the name of the given thread. - pub fn get_thread_name(&self, thread: ThreadId) -> &[u8] { + pub fn get_thread_name(&self, thread: ThreadId) -> Option<&[u8]> { self.threads[thread].thread_name() } + pub fn get_thread_display_name(&self, thread: ThreadId) -> String { + self.threads[thread].thread_display_name(thread) + } + /// Put the thread into the blocked state. fn block_thread(&mut self, thread: ThreadId) { let state = &mut self.threads[thread].state; @@ -969,18 +982,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { } #[inline] - fn set_thread_name_wide(&mut self, thread: ThreadId, new_thread_name: &[u16]) { - let this = self.eval_context_mut(); - - // The Windows `GetThreadDescription` shim to get the thread name isn't implemented, so being lossy is okay. - // This is only read by diagnostics, which already use `from_utf8_lossy`. - this.machine - .threads - .set_thread_name(thread, String::from_utf16_lossy(new_thread_name).into_bytes()); - } - - #[inline] - fn get_thread_name<'c>(&'c self, thread: ThreadId) -> &'c [u8] + fn get_thread_name<'c>(&'c self, thread: ThreadId) -> Option<&[u8]> where 'mir: 'c, { diff --git a/src/tools/miri/src/diagnostics.rs b/src/tools/miri/src/diagnostics.rs index 0433254aedb..de0ed879b36 100644 --- a/src/tools/miri/src/diagnostics.rs +++ b/src/tools/miri/src/diagnostics.rs @@ -116,6 +116,7 @@ pub enum NonHaltingDiagnostic { CreatedCallId(CallId), CreatedAlloc(AllocId, Size, Align, MemoryKind<MiriMemoryKind>), FreedAlloc(AllocId), + AccessedAlloc(AllocId, AccessKind), RejectedIsolatedOp(String), ProgressReport { block_count: u64, // how many basic blocks have been run so far @@ -477,7 +478,6 @@ pub fn report_msg<'tcx>( // Show note and help messages. let mut extra_span = false; - let notes_len = notes.len(); for (span_data, note) in notes { if let Some(span_data) = span_data { err.span_note(span_data.span(), note); @@ -486,7 +486,6 @@ pub fn report_msg<'tcx>( err.note(note); } } - let helps_len = helps.len(); for (span_data, help) in helps { if let Some(span_data) = span_data { err.span_help(span_data.span(), help); @@ -495,12 +494,20 @@ pub fn report_msg<'tcx>( err.help(help); } } - if notes_len + helps_len > 0 { - // Add visual separator before backtrace. - err.note(if extra_span { "BACKTRACE (of the first span):" } else { "BACKTRACE:" }); - } // Add backtrace + let mut backtrace_title = String::from("BACKTRACE"); + if extra_span { + write!(backtrace_title, " (of the first span)").unwrap(); + } + let thread_name = + machine.threads.get_thread_display_name(machine.threads.get_active_thread_id()); + if thread_name != "main" { + // Only print thread name if it is not `main`. + write!(backtrace_title, " on thread `{thread_name}`").unwrap(); + }; + write!(backtrace_title, ":").unwrap(); + err.note(backtrace_title); for (idx, frame_info) in stacktrace.iter().enumerate() { let is_local = machine.is_local(frame_info); // No span for non-local frames and the first frame (which is the error site). @@ -532,6 +539,7 @@ impl<'mir, 'tcx> MiriMachine<'mir, 'tcx> { | PoppedPointerTag(..) | CreatedCallId(..) | CreatedAlloc(..) + | AccessedAlloc(..) | FreedAlloc(..) | ProgressReport { .. } | WeakMemoryOutdatedLoad => ("tracking was triggered".to_string(), DiagLevel::Note), @@ -553,6 +561,8 @@ impl<'mir, 'tcx> MiriMachine<'mir, 'tcx> { size = size.bytes(), align = align.bytes(), ), + AccessedAlloc(AllocId(id), access_kind) => + format!("{access_kind} to allocation with id {id}"), FreedAlloc(AllocId(id)) => format!("freed allocation with id {id}"), RejectedIsolatedOp(ref op) => format!("{op} was made to return an error due to isolation"), diff --git a/src/tools/miri/src/eval.rs b/src/tools/miri/src/eval.rs index 9bab9488e37..ef50bd43de3 100644 --- a/src/tools/miri/src/eval.rs +++ b/src/tools/miri/src/eval.rs @@ -112,6 +112,8 @@ pub struct MiriConfig { pub tracked_call_ids: FxHashSet<CallId>, /// The allocation ids to report about. pub tracked_alloc_ids: FxHashSet<AllocId>, + /// For the tracked alloc ids, also report read/write accesses. + pub track_alloc_accesses: bool, /// Determine if data race detection should be enabled pub data_race_detector: bool, /// Determine if weak memory emulation should be enabled. Requires data race detection to be enabled @@ -169,6 +171,7 @@ impl Default for MiriConfig { tracked_pointer_tags: FxHashSet::default(), tracked_call_ids: FxHashSet::default(), tracked_alloc_ids: FxHashSet::default(), + track_alloc_accesses: false, data_race_detector: true, weak_memory_emulation: true, track_outdated_loads: false, diff --git a/src/tools/miri/src/helpers.rs b/src/tools/miri/src/helpers.rs index d9b4363d604..65260254ae2 100644 --- a/src/tools/miri/src/helpers.rs +++ b/src/tools/miri/src/helpers.rs @@ -22,6 +22,13 @@ use rand::RngCore; use crate::*; +/// Indicates which kind of access is being performed. +#[derive(Copy, Clone, Hash, PartialEq, Eq, Debug)] +pub enum AccessKind { + Read, + Write, +} + // This mapping should match `decode_error_kind` in // <https://github.com/rust-lang/rust/blob/master/library/std/src/sys/pal/unix/mod.rs>. const UNIX_IO_ERROR_TABLE: &[(&str, std::io::ErrorKind)] = { diff --git a/src/tools/miri/src/lib.rs b/src/tools/miri/src/lib.rs index c567949102f..e1d0bc1c183 100644 --- a/src/tools/miri/src/lib.rs +++ b/src/tools/miri/src/lib.rs @@ -120,7 +120,7 @@ pub use crate::diagnostics::{ pub use crate::eval::{ create_ecx, eval_entry, AlignmentCheck, BacktraceStyle, IsolatedOp, MiriConfig, RejectOpWith, }; -pub use crate::helpers::EvalContextExt as _; +pub use crate::helpers::{AccessKind, EvalContextExt as _}; pub use crate::intptrcast::{EvalContextExt as _, ProvenanceMode}; pub use crate::machine::{ AllocExtra, FrameExtra, MiriInterpCx, MiriInterpCxExt, MiriMachine, MiriMemoryKind, diff --git a/src/tools/miri/src/machine.rs b/src/tools/miri/src/machine.rs index 40d041c8fdb..d40f1c4525f 100644 --- a/src/tools/miri/src/machine.rs +++ b/src/tools/miri/src/machine.rs @@ -113,6 +113,8 @@ pub enum MiriMemoryKind { C, /// Windows `HeapAlloc` memory. WinHeap, + /// Windows "local" memory (to be freed with `LocalFree`) + WinLocal, /// Memory for args, errno, and other parts of the machine-managed environment. /// This memory may leak. Machine, @@ -144,7 +146,7 @@ impl MayLeak for MiriMemoryKind { fn may_leak(self) -> bool { use self::MiriMemoryKind::*; match self { - Rust | Miri | C | WinHeap | Runtime => false, + Rust | Miri | C | WinHeap | WinLocal | Runtime => false, Machine | Global | ExternStatic | Tls | Mmap => true, } } @@ -156,7 +158,7 @@ impl MiriMemoryKind { use self::MiriMemoryKind::*; match self { // Heap allocations are fine since the `Allocation` is created immediately. - Rust | Miri | C | WinHeap | Mmap => true, + Rust | Miri | C | WinHeap | WinLocal | Mmap => true, // Everything else is unclear, let's not show potentially confusing spans. Machine | Global | ExternStatic | Tls | Runtime => false, } @@ -171,6 +173,7 @@ impl fmt::Display for MiriMemoryKind { Miri => write!(f, "Miri bare-metal heap"), C => write!(f, "C heap"), WinHeap => write!(f, "Windows heap"), + WinLocal => write!(f, "Windows local memory"), Machine => write!(f, "machine-managed memory"), Runtime => write!(f, "language runtime memory"), Global => write!(f, "global (static or const)"), @@ -512,6 +515,8 @@ pub struct MiriMachine<'mir, 'tcx> { /// The allocation IDs to report when they are being allocated /// (helps for debugging memory leaks and use after free bugs). tracked_alloc_ids: FxHashSet<AllocId>, + /// For the tracked alloc ids, also report read/write accesses. + track_alloc_accesses: bool, /// Controls whether alignment of memory accesses is being checked. pub(crate) check_alignment: AlignmentCheck, @@ -654,6 +659,7 @@ impl<'mir, 'tcx> MiriMachine<'mir, 'tcx> { extern_statics: FxHashMap::default(), rng: RefCell::new(rng), tracked_alloc_ids: config.tracked_alloc_ids.clone(), + track_alloc_accesses: config.track_alloc_accesses, check_alignment: config.check_alignment, cmpxchg_weak_failure_rate: config.cmpxchg_weak_failure_rate, mute_stdout_stderr: config.mute_stdout_stderr, @@ -793,6 +799,7 @@ impl VisitProvenance for MiriMachine<'_, '_> { local_crates: _, rng: _, tracked_alloc_ids: _, + track_alloc_accesses: _, check_alignment: _, cmpxchg_weak_failure_rate: _, mute_stdout_stderr: _, @@ -1235,6 +1242,10 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for MiriMachine<'mir, 'tcx> { (alloc_id, prov_extra): (AllocId, Self::ProvenanceExtra), range: AllocRange, ) -> InterpResult<'tcx> { + if machine.track_alloc_accesses && machine.tracked_alloc_ids.contains(&alloc_id) { + machine + .emit_diagnostic(NonHaltingDiagnostic::AccessedAlloc(alloc_id, AccessKind::Read)); + } if let Some(data_race) = &alloc_extra.data_race { data_race.read(alloc_id, range, machine)?; } @@ -1255,6 +1266,10 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for MiriMachine<'mir, 'tcx> { (alloc_id, prov_extra): (AllocId, Self::ProvenanceExtra), range: AllocRange, ) -> InterpResult<'tcx> { + if machine.track_alloc_accesses && machine.tracked_alloc_ids.contains(&alloc_id) { + machine + .emit_diagnostic(NonHaltingDiagnostic::AccessedAlloc(alloc_id, AccessKind::Write)); + } if let Some(data_race) = &mut alloc_extra.data_race { data_race.write(alloc_id, range, machine)?; } diff --git a/src/tools/miri/src/shims/tls.rs b/src/tools/miri/src/shims/tls.rs index 84c1feb88e9..7f929d9a91e 100644 --- a/src/tools/miri/src/shims/tls.rs +++ b/src/tools/miri/src/shims/tls.rs @@ -354,7 +354,7 @@ trait EvalContextPrivExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { state.last_key = Some(key); trace!("Running TLS dtor {:?} on {:?} at {:?}", instance, ptr, active_thread); assert!( - !ptr.to_target_usize(this).unwrap() != 0, + ptr.to_target_usize(this).unwrap() != 0, "data can't be NULL when dtor is called!" ); diff --git a/src/tools/miri/src/shims/unix/thread.rs b/src/tools/miri/src/shims/unix/thread.rs index 259689348ad..2a56cd35dcb 100644 --- a/src/tools/miri/src/shims/unix/thread.rs +++ b/src/tools/miri/src/shims/unix/thread.rs @@ -104,7 +104,8 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { let name_out = name_out.to_pointer(this)?; let len = len.to_target_usize(this)?; - let name = this.get_thread_name(thread).to_owned(); + // FIXME: we should use the program name if the thread name is not set + let name = this.get_thread_name(thread).unwrap_or(b"<unnamed>").to_owned(); let (success, _written) = this.write_c_str(&name, name_out, len)?; Ok(if success { Scalar::from_u32(0) } else { this.eval_libc("ERANGE") }) diff --git a/src/tools/miri/src/shims/windows/foreign_items.rs b/src/tools/miri/src/shims/windows/foreign_items.rs index fdd7fc5fad4..734737a86dd 100644 --- a/src/tools/miri/src/shims/windows/foreign_items.rs +++ b/src/tools/miri/src/shims/windows/foreign_items.rs @@ -5,6 +5,7 @@ use rustc_span::Symbol; use rustc_target::abi::Size; use rustc_target::spec::abi::Abi; +use crate::shims::os_str::bytes_to_os_str; use crate::*; use shims::foreign_items::EmulateForeignItemResult; use shims::windows::handle::{EvalContextExt as _, Handle, PseudoHandle}; @@ -12,7 +13,11 @@ use shims::windows::sync::EvalContextExt as _; use shims::windows::thread::EvalContextExt as _; fn is_dyn_sym(name: &str) -> bool { - matches!(name, "SetThreadDescription" | "WaitOnAddress" | "WakeByAddressSingle") + // std does dynamic detection for these symbols + matches!( + name, + "SetThreadDescription" | "GetThreadDescription" | "WaitOnAddress" | "WakeByAddressSingle" + ) } impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriInterpCx<'mir, 'tcx> {} @@ -172,6 +177,12 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { let res = this.realloc(ptr, size, MiriMemoryKind::WinHeap)?; this.write_pointer(res, dest)?; } + "LocalFree" => { + let [ptr] = this.check_shim(abi, Abi::System { unwind: false }, link_name, args)?; + let ptr = this.read_pointer(ptr)?; + this.free(ptr, MiriMemoryKind::WinLocal)?; + this.write_null(dest)?; + } // errno "SetLastError" => { @@ -403,7 +414,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { this.check_shim(abi, Abi::System { unwind: false }, link_name, args)?; let handle = this.read_scalar(handle)?; - let name = this.read_wide_str(this.read_pointer(name)?)?; let thread = match Handle::from_scalar(handle, this)? { @@ -412,7 +422,31 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { _ => this.invalid_handle("SetThreadDescription")?, }; - this.set_thread_name_wide(thread, &name); + // FIXME: use non-lossy conversion + this.set_thread_name(thread, String::from_utf16_lossy(&name).into_bytes()); + + this.write_null(dest)?; + } + "GetThreadDescription" => { + let [handle, name_ptr] = + this.check_shim(abi, Abi::System { unwind: false }, link_name, args)?; + + let handle = this.read_scalar(handle)?; + let name_ptr = this.deref_pointer(name_ptr)?; // the pointer where we should store the ptr to the name + + let thread = match Handle::from_scalar(handle, this)? { + Some(Handle::Thread(thread)) => thread, + Some(Handle::Pseudo(PseudoHandle::CurrentThread)) => this.get_active_thread(), + _ => this.invalid_handle("SetThreadDescription")?, + }; + // Looks like the default thread name is empty. + let name = this.get_thread_name(thread).unwrap_or(b"").to_owned(); + let name = this.alloc_os_str_as_wide_str( + bytes_to_os_str(&name)?, + MiriMemoryKind::WinLocal.into(), + )?; + + this.write_scalar(Scalar::from_maybe_pointer(name, this), &name_ptr)?; this.write_null(dest)?; } @@ -432,7 +466,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { this.check_shim(abi, Abi::System { unwind: false }, link_name, args)?; let ptr = this.read_pointer(ptr)?; let len = this.read_target_usize(len)?; - this.gen_random(ptr, len.into())?; + this.gen_random(ptr, len)?; this.write_scalar(Scalar::from_i32(1), dest)?; } "BCryptGenRandom" => { diff --git a/src/tools/miri/tests/compiletest.rs b/src/tools/miri/tests/compiletest.rs index d8f7cafe3b2..9f467724565 100644 --- a/src/tools/miri/tests/compiletest.rs +++ b/src/tools/miri/tests/compiletest.rs @@ -172,6 +172,8 @@ regexes! { r"\.rs:[0-9]+:[0-9]+(: [0-9]+:[0-9]+)?" => ".rs:LL:CC", // erase alloc ids "alloc[0-9]+" => "ALLOC", + // erase thread ids + r"unnamed-[0-9]+" => "unnamed-ID", // erase borrow tags "<[0-9]+>" => "<TAG>", "<[0-9]+=" => "<TAG=", diff --git a/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_create_too_few_args.stderr b/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_create_too_few_args.stderr index 383b93024bb..ca6a05ac7dd 100644 --- a/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_create_too_few_args.stderr +++ b/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_create_too_few_args.stderr @@ -6,7 +6,7 @@ LL | panic!() | = 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: BACKTRACE on thread `unnamed-ID`: = note: inside `thread_start` at RUSTLIB/core/src/panic.rs:LL:CC = note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_create_too_many_args.stderr b/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_create_too_many_args.stderr index 70a565ee7c7..6ab48a76666 100644 --- a/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_create_too_many_args.stderr +++ b/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_create_too_many_args.stderr @@ -6,7 +6,7 @@ LL | panic!() | = 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: BACKTRACE on thread `unnamed-ID`: = note: inside `thread_start` at RUSTLIB/core/src/panic.rs:LL:CC = note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_join_main.stderr b/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_join_main.stderr index b2edabd7cc9..e27e88dda2d 100644 --- a/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_join_main.stderr +++ b/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_join_main.stderr @@ -6,7 +6,7 @@ LL | assert_eq!(libc::pthread_join(thread_id, ptr::null_mut()), 0); | = 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: BACKTRACE on thread `unnamed-ID`: = note: inside closure at $DIR/libc_pthread_join_main.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_join_multiple.stderr b/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_join_multiple.stderr index 605d6cdf0a4..6a7b237e5b3 100644 --- a/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_join_multiple.stderr +++ b/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_join_multiple.stderr @@ -6,7 +6,7 @@ LL | ... assert_eq!(libc::pthread_join(native_copy, ptr::null_mut()), 0); | = 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: BACKTRACE on thread `unnamed-ID`: = note: inside closure at $DIR/libc_pthread_join_multiple.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_join_self.stderr b/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_join_self.stderr index 9ec749acddd..258c5f26c7a 100644 --- a/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_join_self.stderr +++ b/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_join_self.stderr @@ -6,7 +6,7 @@ LL | assert_eq!(libc::pthread_join(native, ptr::null_mut()), 0); | = 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: BACKTRACE on thread `unnamed-ID`: = note: inside closure at $DIR/libc_pthread_join_self.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail-dep/concurrency/unwind_top_of_stack.stderr b/src/tools/miri/tests/fail-dep/concurrency/unwind_top_of_stack.stderr index 2339bab3e9f..0c755215c00 100644 --- a/src/tools/miri/tests/fail-dep/concurrency/unwind_top_of_stack.stderr +++ b/src/tools/miri/tests/fail-dep/concurrency/unwind_top_of_stack.stderr @@ -14,7 +14,7 @@ LL | | } | = 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: BACKTRACE on thread `unnamed-ID`: = note: inside `thread_start` at $DIR/unwind_top_of_stack.rs:LL:CC error: aborting due to 1 previous error diff --git a/src/tools/miri/tests/fail-dep/concurrency/windows_join_main.stderr b/src/tools/miri/tests/fail-dep/concurrency/windows_join_main.stderr index cb51c7e0bd9..d9137ee7437 100644 --- a/src/tools/miri/tests/fail-dep/concurrency/windows_join_main.stderr +++ b/src/tools/miri/tests/fail-dep/concurrency/windows_join_main.stderr @@ -4,6 +4,7 @@ error: deadlock: the evaluated program deadlocked LL | assert_eq!(WaitForSingleObject(MAIN_THREAD, INFINITE), WAIT_OBJECT_0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program deadlocked | + = note: BACKTRACE on thread `unnamed-ID`: = note: inside closure at RUSTLIB/core/src/macros/mod.rs:LL:CC = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/tools/miri/tests/fail-dep/concurrency/windows_join_self.stderr b/src/tools/miri/tests/fail-dep/concurrency/windows_join_self.stderr index 8b76e124215..74699a0317f 100644 --- a/src/tools/miri/tests/fail-dep/concurrency/windows_join_self.stderr +++ b/src/tools/miri/tests/fail-dep/concurrency/windows_join_self.stderr @@ -4,6 +4,7 @@ error: deadlock: the evaluated program deadlocked LL | assert_eq!(WaitForSingleObject(native, INFINITE), WAIT_OBJECT_0); | ^ the evaluated program deadlocked | + = note: BACKTRACE on thread `unnamed-ID`: = note: inside closure at $DIR/windows_join_self.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail-dep/shims/env-set_var-data-race.stderr b/src/tools/miri/tests/fail-dep/shims/env-set_var-data-race.stderr index b81e8db9e0c..f85234f5627 100644 --- a/src/tools/miri/tests/fail-dep/shims/env-set_var-data-race.stderr +++ b/src/tools/miri/tests/fail-dep/shims/env-set_var-data-race.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `main` and (2) non-atomic read on thread `<unnamed>` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `main` and (2) non-atomic read on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/env-set_var-data-race.rs:LL:CC | LL | libc::getenv(b"TZ/0".as_ptr().cast()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) non-atomic write on thread `main` and (2) non-atomic read on thread `<unnamed>` at ALLOC. (2) just happened here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) non-atomic write on thread `main` and (2) non-atomic read on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/env-set_var-data-race.rs:LL:CC @@ -11,7 +11,7 @@ LL | env::set_var("MY_RUST_VAR", "Ferris"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = 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 (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/env-set_var-data-race.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_mutex_deadlock.stderr b/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_mutex_deadlock.stderr index 272bee38b5a..76b1d26bd33 100644 --- a/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_mutex_deadlock.stderr +++ b/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_mutex_deadlock.stderr @@ -4,6 +4,7 @@ error: deadlock: the evaluated program deadlocked LL | assert_eq!(libc::pthread_mutex_lock(lock_copy.0.get() as *mut _), 0); | ^ the evaluated program deadlocked | + = note: BACKTRACE on thread `unnamed-ID`: = note: inside closure at $DIR/libc_pthread_mutex_deadlock.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_mutex_normal_deadlock.stderr b/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_mutex_normal_deadlock.stderr index 16de503bebf..334c14ebf04 100644 --- a/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_mutex_normal_deadlock.stderr +++ b/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_mutex_normal_deadlock.stderr @@ -4,6 +4,7 @@ error: deadlock: the evaluated program deadlocked LL | libc::pthread_mutex_lock(&mut mutex as *mut _); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program deadlocked | + = note: BACKTRACE: = note: inside `main` at $DIR/libc_pthread_mutex_normal_deadlock.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_mutex_wrong_owner.stderr b/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_mutex_wrong_owner.stderr index a1de36db966..b8ec2d6d018 100644 --- a/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_mutex_wrong_owner.stderr +++ b/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_mutex_wrong_owner.stderr @@ -6,7 +6,7 @@ LL | ...t_eq!(libc::pthread_mutex_unlock(lock_copy.0.get() as *mut _), 0); | = 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: BACKTRACE on thread `unnamed-ID`: = note: inside closure at $DIR/libc_pthread_mutex_wrong_owner.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_read_write_deadlock_single_thread.stderr b/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_read_write_deadlock_single_thread.stderr index 21383825f81..957458a7ba0 100644 --- a/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_read_write_deadlock_single_thread.stderr +++ b/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_read_write_deadlock_single_thread.stderr @@ -4,6 +4,7 @@ error: deadlock: the evaluated program deadlocked LL | libc::pthread_rwlock_wrlock(rw.get()); | ^ the evaluated program deadlocked | + = note: BACKTRACE: = note: inside `main` at $DIR/libc_pthread_rwlock_read_write_deadlock_single_thread.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_read_wrong_owner.stderr b/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_read_wrong_owner.stderr index d1b7d5ca1ad..a964a64284a 100644 --- a/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_read_wrong_owner.stderr +++ b/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_read_wrong_owner.stderr @@ -6,7 +6,7 @@ LL | ... assert_eq!(libc::pthread_rwlock_unlock(lock_copy.0.get() as *mut _), | = 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: BACKTRACE on thread `unnamed-ID`: = note: inside closure at $DIR/libc_pthread_rwlock_read_wrong_owner.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_read_deadlock.stderr b/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_read_deadlock.stderr index 6271d5cb2ff..5501dab81ac 100644 --- a/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_read_deadlock.stderr +++ b/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_read_deadlock.stderr @@ -4,6 +4,7 @@ error: deadlock: the evaluated program deadlocked LL | assert_eq!(libc::pthread_rwlock_wrlock(lock_copy.0.get() as *mut _), 0); | ^ the evaluated program deadlocked | + = note: BACKTRACE on thread `unnamed-ID`: = note: inside closure at $DIR/libc_pthread_rwlock_write_read_deadlock.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_read_deadlock_single_thread.stderr b/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_read_deadlock_single_thread.stderr index 3d09c6dbce7..d6cceaff166 100644 --- a/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_read_deadlock_single_thread.stderr +++ b/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_read_deadlock_single_thread.stderr @@ -4,6 +4,7 @@ error: deadlock: the evaluated program deadlocked LL | libc::pthread_rwlock_rdlock(rw.get()); | ^ the evaluated program deadlocked | + = note: BACKTRACE: = note: inside `main` at $DIR/libc_pthread_rwlock_write_read_deadlock_single_thread.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_write_deadlock.stderr b/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_write_deadlock.stderr index faaf3f5e9a0..815d85af502 100644 --- a/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_write_deadlock.stderr +++ b/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_write_deadlock.stderr @@ -4,6 +4,7 @@ error: deadlock: the evaluated program deadlocked LL | assert_eq!(libc::pthread_rwlock_wrlock(lock_copy.0.get() as *mut _), 0); | ^ the evaluated program deadlocked | + = note: BACKTRACE on thread `unnamed-ID`: = note: inside closure at $DIR/libc_pthread_rwlock_write_write_deadlock.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_write_deadlock_single_thread.stderr b/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_write_deadlock_single_thread.stderr index 3dc99a1fd19..3ba99e3db4a 100644 --- a/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_write_deadlock_single_thread.stderr +++ b/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_write_deadlock_single_thread.stderr @@ -4,6 +4,7 @@ error: deadlock: the evaluated program deadlocked LL | libc::pthread_rwlock_wrlock(rw.get()); | ^ the evaluated program deadlocked | + = note: BACKTRACE: = note: inside `main` at $DIR/libc_pthread_rwlock_write_write_deadlock_single_thread.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_wrong_owner.stderr b/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_wrong_owner.stderr index dea2529b865..c9c22dea655 100644 --- a/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_wrong_owner.stderr +++ b/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_wrong_owner.stderr @@ -6,7 +6,7 @@ LL | ... assert_eq!(libc::pthread_rwlock_unlock(lock_copy.0.get() as *mut _), | = 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: BACKTRACE on thread `unnamed-ID`: = note: inside closure at $DIR/libc_pthread_rwlock_write_wrong_owner.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/both_borrows/alias_through_mutation.tree.stderr b/src/tools/miri/tests/fail/both_borrows/alias_through_mutation.tree.stderr index db36d696e1d..f26e8444a9a 100644 --- a/src/tools/miri/tests/fail/both_borrows/alias_through_mutation.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/alias_through_mutation.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: read access through <TAG> is forbidden +error: Undefined Behavior: read access through <TAG> at ALLOC[0x0] is forbidden --> $DIR/alias_through_mutation.rs:LL:CC | LL | let _val = *target_alias; - | ^^^^^^^^^^^^^ read access through <TAG> is forbidden + | ^^^^^^^^^^^^^ read access through <TAG> 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 <TAG> is a child of the conflicting tag <TAG> diff --git a/src/tools/miri/tests/fail/both_borrows/aliasing_mut1.tree.stderr b/src/tools/miri/tests/fail/both_borrows/aliasing_mut1.tree.stderr index 4ee154eeb99..3aff0a41de2 100644 --- a/src/tools/miri/tests/fail/both_borrows/aliasing_mut1.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/aliasing_mut1.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: write access through <TAG> is forbidden +error: Undefined Behavior: write access through <TAG> at ALLOC[0x0] is forbidden --> $DIR/aliasing_mut1.rs:LL:CC | LL | *x = 1; - | ^^^^^^ write access through <TAG> is forbidden + | ^^^^^^ write access through <TAG> 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 <TAG> has state Reserved (conflicted) which forbids this child write access diff --git a/src/tools/miri/tests/fail/both_borrows/aliasing_mut2.tree.stderr b/src/tools/miri/tests/fail/both_borrows/aliasing_mut2.tree.stderr index 4b15e931654..d8602a54c64 100644 --- a/src/tools/miri/tests/fail/both_borrows/aliasing_mut2.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/aliasing_mut2.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: write access through <TAG> is forbidden +error: Undefined Behavior: write access through <TAG> at ALLOC[0x0] is forbidden --> $DIR/aliasing_mut2.rs:LL:CC | LL | *y = 2; - | ^^^^^^ write access through <TAG> is forbidden + | ^^^^^^ write access through <TAG> 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 <TAG> has state Reserved (conflicted) which forbids this child write access diff --git a/src/tools/miri/tests/fail/both_borrows/aliasing_mut3.tree.stderr b/src/tools/miri/tests/fail/both_borrows/aliasing_mut3.tree.stderr index 7b8082292a1..83191962a3f 100644 --- a/src/tools/miri/tests/fail/both_borrows/aliasing_mut3.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/aliasing_mut3.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: write access through <TAG> is forbidden +error: Undefined Behavior: write access through <TAG> at ALLOC[0x0] is forbidden --> $DIR/aliasing_mut3.rs:LL:CC | LL | *x = 1; - | ^^^^^^ write access through <TAG> is forbidden + | ^^^^^^ write access through <TAG> 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 <TAG> has state Reserved (conflicted) which forbids this child write access diff --git a/src/tools/miri/tests/fail/both_borrows/aliasing_mut4.tree.stderr b/src/tools/miri/tests/fail/both_borrows/aliasing_mut4.tree.stderr index 5dbcd393218..b1f1e231e5a 100644 --- a/src/tools/miri/tests/fail/both_borrows/aliasing_mut4.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/aliasing_mut4.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: write access through <TAG> is forbidden +error: Undefined Behavior: write access through <TAG> at ALLOC[0x0] is forbidden --> RUSTLIB/core/src/mem/mod.rs:LL:CC | LL | ptr::write(dest, src); - | ^^^^^^^^^^^^^^^^^^^^^ write access through <TAG> is forbidden + | ^^^^^^^^^^^^^^^^^^^^^ write access through <TAG> 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 <TAG> is foreign to the protected tag <TAG> (i.e., it is not a child) diff --git a/src/tools/miri/tests/fail/both_borrows/box_exclusive_violation1.tree.stderr b/src/tools/miri/tests/fail/both_borrows/box_exclusive_violation1.tree.stderr index 68ed09409bf..ee5ef0c5ea8 100644 --- a/src/tools/miri/tests/fail/both_borrows/box_exclusive_violation1.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/box_exclusive_violation1.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: write access through <TAG> is forbidden +error: Undefined Behavior: write access through <TAG> at ALLOC[0x0] is forbidden --> $DIR/box_exclusive_violation1.rs:LL:CC | LL | *LEAK = 7; - | ^^^^^^^^^ write access through <TAG> is forbidden + | ^^^^^^^^^ write access through <TAG> 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 <TAG> is a child of the conflicting tag <TAG> diff --git a/src/tools/miri/tests/fail/both_borrows/box_noalias_violation.tree.stderr b/src/tools/miri/tests/fail/both_borrows/box_noalias_violation.tree.stderr index 824a2d36fc4..95cf37c8123 100644 --- a/src/tools/miri/tests/fail/both_borrows/box_noalias_violation.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/box_noalias_violation.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: read access through <TAG> is forbidden +error: Undefined Behavior: read access through <TAG> at ALLOC[0x0] is forbidden --> $DIR/box_noalias_violation.rs:LL:CC | LL | *y - | ^^ read access through <TAG> is forbidden + | ^^ read access through <TAG> 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 <TAG> is foreign to the protected tag <TAG> (i.e., it is not a child) diff --git a/src/tools/miri/tests/fail/both_borrows/buggy_as_mut_slice.tree.stderr b/src/tools/miri/tests/fail/both_borrows/buggy_as_mut_slice.tree.stderr index 4e5a8bbe0e0..5593db89971 100644 --- a/src/tools/miri/tests/fail/both_borrows/buggy_as_mut_slice.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/buggy_as_mut_slice.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: write access through <TAG> is forbidden +error: Undefined Behavior: write access through <TAG> at ALLOC[0x4] is forbidden --> $DIR/buggy_as_mut_slice.rs:LL:CC | LL | v2[1] = 7; - | ^^^^^^^^^ write access through <TAG> is forbidden + | ^^^^^^^^^ write access through <TAG> at ALLOC[0x4] 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 <TAG> is a child of the conflicting tag <TAG> diff --git a/src/tools/miri/tests/fail/both_borrows/buggy_split_at_mut.tree.stderr b/src/tools/miri/tests/fail/both_borrows/buggy_split_at_mut.tree.stderr index 7fc795db097..7d3725d611a 100644 --- a/src/tools/miri/tests/fail/both_borrows/buggy_split_at_mut.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/buggy_split_at_mut.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: write access through <TAG> is forbidden +error: Undefined Behavior: write access through <TAG> at ALLOC[0x4] is forbidden --> $DIR/buggy_split_at_mut.rs:LL:CC | LL | b[1] = 6; - | ^^^^^^^^ write access through <TAG> is forbidden + | ^^^^^^^^ write access through <TAG> at ALLOC[0x4] 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 <TAG> is a child of the conflicting tag <TAG> diff --git a/src/tools/miri/tests/fail/both_borrows/illegal_write1.tree.stderr b/src/tools/miri/tests/fail/both_borrows/illegal_write1.tree.stderr index 5dd51b5f257..6241c9db0d2 100644 --- a/src/tools/miri/tests/fail/both_borrows/illegal_write1.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/illegal_write1.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: write access through <TAG> is forbidden +error: Undefined Behavior: write access through <TAG> at ALLOC[0x0] is forbidden --> $DIR/illegal_write1.rs:LL:CC | LL | unsafe { *x = 42 }; - | ^^^^^^^ write access through <TAG> is forbidden + | ^^^^^^^ write access through <TAG> 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 <TAG> has state Frozen which forbids this child write access diff --git a/src/tools/miri/tests/fail/both_borrows/illegal_write5.tree.stderr b/src/tools/miri/tests/fail/both_borrows/illegal_write5.tree.stderr index 3698937d6fc..1f3d6e387d4 100644 --- a/src/tools/miri/tests/fail/both_borrows/illegal_write5.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/illegal_write5.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: read access through <TAG> is forbidden +error: Undefined Behavior: read access through <TAG> at ALLOC[0x0] is forbidden --> $DIR/illegal_write5.rs:LL:CC | LL | let _val = *xref; - | ^^^^^ read access through <TAG> is forbidden + | ^^^^^ read access through <TAG> 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 <TAG> is a child of the conflicting tag <TAG> diff --git a/src/tools/miri/tests/fail/both_borrows/illegal_write6.tree.stderr b/src/tools/miri/tests/fail/both_borrows/illegal_write6.tree.stderr index 37d5147b5d0..2e161ceea88 100644 --- a/src/tools/miri/tests/fail/both_borrows/illegal_write6.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/illegal_write6.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: write access through <TAG> is forbidden +error: Undefined Behavior: write access through <TAG> at ALLOC[0x0] is forbidden --> $DIR/illegal_write6.rs:LL:CC | LL | unsafe { *y = 2 }; - | ^^^^^^ write access through <TAG> is forbidden + | ^^^^^^ write access through <TAG> 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 <TAG> is foreign to the protected tag <TAG> (i.e., it is not a child) diff --git a/src/tools/miri/tests/fail/both_borrows/invalidate_against_protector2.tree.stderr b/src/tools/miri/tests/fail/both_borrows/invalidate_against_protector2.tree.stderr index 4ba80e13318..9fa52262f7e 100644 --- a/src/tools/miri/tests/fail/both_borrows/invalidate_against_protector2.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/invalidate_against_protector2.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: write access through <TAG> is forbidden +error: Undefined Behavior: write access through <TAG> at ALLOC[0x0] is forbidden --> $DIR/invalidate_against_protector2.rs:LL:CC | LL | unsafe { *x = 0 }; - | ^^^^^^ write access through <TAG> is forbidden + | ^^^^^^ write access through <TAG> 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 <TAG> is foreign to the protected tag <TAG> (i.e., it is not a child) diff --git a/src/tools/miri/tests/fail/both_borrows/invalidate_against_protector3.tree.stderr b/src/tools/miri/tests/fail/both_borrows/invalidate_against_protector3.tree.stderr index 5a8fbe4ce5b..2cf476c837c 100644 --- a/src/tools/miri/tests/fail/both_borrows/invalidate_against_protector3.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/invalidate_against_protector3.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: write access through <TAG> (root of the allocation) is forbidden +error: Undefined Behavior: write access through <TAG> (root of the allocation) at ALLOC[0x0] is forbidden --> $DIR/invalidate_against_protector3.rs:LL:CC | LL | unsafe { *x = 0 }; - | ^^^^^^ write access through <TAG> (root of the allocation) is forbidden + | ^^^^^^ write access through <TAG> (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 accessed tag <TAG> (root of the allocation) is foreign to the protected tag <TAG> (i.e., it is not a child) diff --git a/src/tools/miri/tests/fail/both_borrows/load_invalid_shr.tree.stderr b/src/tools/miri/tests/fail/both_borrows/load_invalid_shr.tree.stderr index 5de9c9c1478..292dc8150f1 100644 --- a/src/tools/miri/tests/fail/both_borrows/load_invalid_shr.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/load_invalid_shr.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: reborrow through <TAG> is forbidden +error: Undefined Behavior: reborrow through <TAG> at ALLOC[0x0] is forbidden --> $DIR/load_invalid_shr.rs:LL:CC | LL | let _val = *xref_in_mem; - | ^^^^^^^^^^^^ reborrow through <TAG> is forbidden + | ^^^^^^^^^^^^ reborrow through <TAG> 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 <TAG> is a child of the conflicting tag <TAG> diff --git a/src/tools/miri/tests/fail/both_borrows/mut_exclusive_violation1.tree.stderr b/src/tools/miri/tests/fail/both_borrows/mut_exclusive_violation1.tree.stderr index 892b1299bbc..a5e62e9ea33 100644 --- a/src/tools/miri/tests/fail/both_borrows/mut_exclusive_violation1.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/mut_exclusive_violation1.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: write access through <TAG> is forbidden +error: Undefined Behavior: write access through <TAG> at ALLOC[0x0] is forbidden --> $DIR/mut_exclusive_violation1.rs:LL:CC | LL | *LEAK = 7; - | ^^^^^^^^^ write access through <TAG> is forbidden + | ^^^^^^^^^ write access through <TAG> 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 <TAG> is a child of the conflicting tag <TAG> diff --git a/src/tools/miri/tests/fail/both_borrows/mut_exclusive_violation2.tree.stderr b/src/tools/miri/tests/fail/both_borrows/mut_exclusive_violation2.tree.stderr index ca5ac5ac88b..6b6eecbe413 100644 --- a/src/tools/miri/tests/fail/both_borrows/mut_exclusive_violation2.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/mut_exclusive_violation2.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: write access through <TAG> is forbidden +error: Undefined Behavior: write access through <TAG> at ALLOC[0x0] is forbidden --> $DIR/mut_exclusive_violation2.rs:LL:CC | LL | *raw1 = 3; - | ^^^^^^^^^ write access through <TAG> is forbidden + | ^^^^^^^^^ write access through <TAG> 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 <TAG> is a child of the conflicting tag <TAG> diff --git a/src/tools/miri/tests/fail/both_borrows/newtype_pair_retagging.tree.stderr b/src/tools/miri/tests/fail/both_borrows/newtype_pair_retagging.tree.stderr index 3900f5b233e..0a54f14bb5e 100644 --- a/src/tools/miri/tests/fail/both_borrows/newtype_pair_retagging.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/newtype_pair_retagging.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: deallocation through <TAG> is forbidden +error: Undefined Behavior: deallocation through <TAG> at ALLOC[0x0] is forbidden --> RUSTLIB/alloc/src/alloc.rs:LL:CC | LL | unsafe { __rust_dealloc(ptr, layout.size(), layout.align()) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ deallocation through <TAG> is forbidden + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ deallocation through <TAG> 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 <TAG> is foreign to the protected tag <TAG> (i.e., it is not a child) diff --git a/src/tools/miri/tests/fail/both_borrows/newtype_retagging.tree.stderr b/src/tools/miri/tests/fail/both_borrows/newtype_retagging.tree.stderr index dd1344a3ce3..05f1d8822c8 100644 --- a/src/tools/miri/tests/fail/both_borrows/newtype_retagging.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/newtype_retagging.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: deallocation through <TAG> is forbidden +error: Undefined Behavior: deallocation through <TAG> at ALLOC[0x0] is forbidden --> RUSTLIB/alloc/src/alloc.rs:LL:CC | LL | unsafe { __rust_dealloc(ptr, layout.size(), layout.align()) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ deallocation through <TAG> is forbidden + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ deallocation through <TAG> 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 <TAG> is foreign to the protected tag <TAG> (i.e., it is not a child) diff --git a/src/tools/miri/tests/fail/both_borrows/outdated_local.tree.stderr b/src/tools/miri/tests/fail/both_borrows/outdated_local.tree.stderr index 4f79c427b91..60de8417c10 100644 --- a/src/tools/miri/tests/fail/both_borrows/outdated_local.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/outdated_local.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: read access through <TAG> is forbidden +error: Undefined Behavior: read access through <TAG> at ALLOC[0x0] is forbidden --> $DIR/outdated_local.rs:LL:CC | LL | assert_eq!(unsafe { *y }, 1); - | ^^ read access through <TAG> is forbidden + | ^^ read access through <TAG> 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 <TAG> has state Disabled which forbids this child read access diff --git a/src/tools/miri/tests/fail/both_borrows/pass_invalid_shr.tree.stderr b/src/tools/miri/tests/fail/both_borrows/pass_invalid_shr.tree.stderr index 8060ea9c4a6..97a6efa9f6a 100644 --- a/src/tools/miri/tests/fail/both_borrows/pass_invalid_shr.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/pass_invalid_shr.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: reborrow through <TAG> is forbidden +error: Undefined Behavior: reborrow through <TAG> at ALLOC[0x0] is forbidden --> $DIR/pass_invalid_shr.rs:LL:CC | LL | foo(xref); - | ^^^^ reborrow through <TAG> is forbidden + | ^^^^ reborrow through <TAG> 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 <TAG> has state Disabled which forbids this reborrow (acting as a child read access) diff --git a/src/tools/miri/tests/fail/both_borrows/pass_invalid_shr_option.tree.stderr b/src/tools/miri/tests/fail/both_borrows/pass_invalid_shr_option.tree.stderr index 6a92fec38ff..f2eaf767a47 100644 --- a/src/tools/miri/tests/fail/both_borrows/pass_invalid_shr_option.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/pass_invalid_shr_option.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: reborrow through <TAG> is forbidden +error: Undefined Behavior: reborrow through <TAG> at ALLOC[0x0] is forbidden --> $DIR/pass_invalid_shr_option.rs:LL:CC | LL | foo(some_xref); - | ^^^^^^^^^ reborrow through <TAG> is forbidden + | ^^^^^^^^^ reborrow through <TAG> 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 <TAG> is a child of the conflicting tag <TAG> diff --git a/src/tools/miri/tests/fail/both_borrows/pass_invalid_shr_tuple.tree.stderr b/src/tools/miri/tests/fail/both_borrows/pass_invalid_shr_tuple.tree.stderr index d391c334faf..9cfd4239c85 100644 --- a/src/tools/miri/tests/fail/both_borrows/pass_invalid_shr_tuple.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/pass_invalid_shr_tuple.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: reborrow through <TAG> is forbidden +error: Undefined Behavior: reborrow through <TAG> at ALLOC[0x0] is forbidden --> $DIR/pass_invalid_shr_tuple.rs:LL:CC | LL | foo(pair_xref); - | ^^^^^^^^^ reborrow through <TAG> is forbidden + | ^^^^^^^^^ reborrow through <TAG> 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 <TAG> is a child of the conflicting tag <TAG> diff --git a/src/tools/miri/tests/fail/both_borrows/retag_data_race_write.rs b/src/tools/miri/tests/fail/both_borrows/retag_data_race_write.rs index 7c67ea45bdf..eb1fe56df07 100644 --- a/src/tools/miri/tests/fail/both_borrows/retag_data_race_write.rs +++ b/src/tools/miri/tests/fail/both_borrows/retag_data_race_write.rs @@ -17,7 +17,7 @@ fn thread_1(p: SendPtr) { fn thread_2(p: SendPtr) { let p = p.0; unsafe { - *p = 5; //~ ERROR: /Data race detected between \(1\) non-atomic (read|write) on thread `<unnamed>` and \(2\) non-atomic write on thread `<unnamed>`/ + *p = 5; //~ ERROR: /Data race detected between \(1\) non-atomic (read|write) on thread `unnamed-[0-9]+` and \(2\) non-atomic write on thread `unnamed-[0-9]+`/ } } diff --git a/src/tools/miri/tests/fail/both_borrows/retag_data_race_write.stack.stderr b/src/tools/miri/tests/fail/both_borrows/retag_data_race_write.stack.stderr index 63eb90b6bc8..c5b65e6f747 100644 --- a/src/tools/miri/tests/fail/both_borrows/retag_data_race_write.stack.stderr +++ b/src/tools/miri/tests/fail/both_borrows/retag_data_race_write.stack.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `<unnamed>` and (2) non-atomic write on thread `<unnamed>` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) non-atomic write on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/retag_data_race_write.rs:LL:CC | LL | *p = 5; - | ^^^^^^ Data race detected between (1) non-atomic write on thread `<unnamed>` and (2) non-atomic write on thread `<unnamed>` at ALLOC. (2) just happened here + | ^^^^^^ Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) non-atomic write on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/retag_data_race_write.rs:LL:CC @@ -11,7 +11,7 @@ LL | let _r = &mut *p; | ^^^^^^^ = 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 (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside `thread_2` at $DIR/retag_data_race_write.rs:LL:CC note: inside closure --> $DIR/retag_data_race_write.rs:LL:CC diff --git a/src/tools/miri/tests/fail/both_borrows/retag_data_race_write.tree.stderr b/src/tools/miri/tests/fail/both_borrows/retag_data_race_write.tree.stderr index f05533a6bb4..62f139f6f08 100644 --- a/src/tools/miri/tests/fail/both_borrows/retag_data_race_write.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/retag_data_race_write.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) non-atomic read on thread `<unnamed>` and (2) non-atomic write on thread `<unnamed>` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) non-atomic read on thread `unnamed-ID` and (2) non-atomic write on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/retag_data_race_write.rs:LL:CC | LL | *p = 5; - | ^^^^^^ Data race detected between (1) non-atomic read on thread `<unnamed>` and (2) non-atomic write on thread `<unnamed>` at ALLOC. (2) just happened here + | ^^^^^^ Data race detected between (1) non-atomic read on thread `unnamed-ID` and (2) non-atomic write on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/retag_data_race_write.rs:LL:CC @@ -11,7 +11,7 @@ LL | let _r = &mut *p; | ^^^^^^^ = 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 (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside `thread_2` at $DIR/retag_data_race_write.rs:LL:CC note: inside closure --> $DIR/retag_data_race_write.rs:LL:CC diff --git a/src/tools/miri/tests/fail/both_borrows/return_invalid_shr.tree.stderr b/src/tools/miri/tests/fail/both_borrows/return_invalid_shr.tree.stderr index 9358520d8ed..0d19681f637 100644 --- a/src/tools/miri/tests/fail/both_borrows/return_invalid_shr.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/return_invalid_shr.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: reborrow through <TAG> is forbidden +error: Undefined Behavior: reborrow through <TAG> at ALLOC[0x4] is forbidden --> $DIR/return_invalid_shr.rs:LL:CC | LL | ret - | ^^^ reborrow through <TAG> is forbidden + | ^^^ reborrow through <TAG> at ALLOC[0x4] 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 <TAG> has state Disabled which forbids this reborrow (acting as a child read access) diff --git a/src/tools/miri/tests/fail/both_borrows/return_invalid_shr_option.tree.stderr b/src/tools/miri/tests/fail/both_borrows/return_invalid_shr_option.tree.stderr index d60df19f945..1169200b57c 100644 --- a/src/tools/miri/tests/fail/both_borrows/return_invalid_shr_option.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/return_invalid_shr_option.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: reborrow through <TAG> is forbidden +error: Undefined Behavior: reborrow through <TAG> at ALLOC[0x4] is forbidden --> $DIR/return_invalid_shr_option.rs:LL:CC | LL | ret - | ^^^ reborrow through <TAG> is forbidden + | ^^^ reborrow through <TAG> at ALLOC[0x4] 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 <TAG> is a child of the conflicting tag <TAG> diff --git a/src/tools/miri/tests/fail/both_borrows/return_invalid_shr_tuple.tree.stderr b/src/tools/miri/tests/fail/both_borrows/return_invalid_shr_tuple.tree.stderr index b252c691c8d..af410534140 100644 --- a/src/tools/miri/tests/fail/both_borrows/return_invalid_shr_tuple.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/return_invalid_shr_tuple.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: reborrow through <TAG> is forbidden +error: Undefined Behavior: reborrow through <TAG> at ALLOC[0x4] is forbidden --> $DIR/return_invalid_shr_tuple.rs:LL:CC | LL | ret - | ^^^ reborrow through <TAG> is forbidden + | ^^^ reborrow through <TAG> at ALLOC[0x4] 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 <TAG> is a child of the conflicting tag <TAG> diff --git a/src/tools/miri/tests/fail/both_borrows/shr_frozen_violation1.tree.stderr b/src/tools/miri/tests/fail/both_borrows/shr_frozen_violation1.tree.stderr index c2025332b9f..97cd64c03be 100644 --- a/src/tools/miri/tests/fail/both_borrows/shr_frozen_violation1.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/shr_frozen_violation1.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: write access through <TAG> is forbidden +error: Undefined Behavior: write access through <TAG> at ALLOC[0x0] is forbidden --> $DIR/shr_frozen_violation1.rs:LL:CC | LL | *(x as *const i32 as *mut i32) = 7; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ write access through <TAG> is forbidden + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ write access through <TAG> 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 <TAG> is a child of the conflicting tag <TAG> diff --git a/src/tools/miri/tests/fail/both_borrows/shr_frozen_violation2.tree.stderr b/src/tools/miri/tests/fail/both_borrows/shr_frozen_violation2.tree.stderr index 40f2d89850e..96c2e39edd2 100644 --- a/src/tools/miri/tests/fail/both_borrows/shr_frozen_violation2.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/shr_frozen_violation2.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: read access through <TAG> is forbidden +error: Undefined Behavior: read access through <TAG> at ALLOC[0x0] is forbidden --> $DIR/shr_frozen_violation2.rs:LL:CC | LL | let _val = *frozen; - | ^^^^^^^ read access through <TAG> is forbidden + | ^^^^^^^ read access through <TAG> 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 <TAG> has state Disabled which forbids this child read access diff --git a/src/tools/miri/tests/fail/breakpoint.stderr b/src/tools/miri/tests/fail/breakpoint.stderr index 1b43c594da4..a5666d52a2f 100644 --- a/src/tools/miri/tests/fail/breakpoint.stderr +++ b/src/tools/miri/tests/fail/breakpoint.stderr @@ -4,6 +4,7 @@ error: abnormal termination: trace/breakpoint trap LL | core::intrinsics::breakpoint() | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trace/breakpoint trap | + = note: BACKTRACE: = note: inside `main` at $DIR/breakpoint.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/alloc_read_race.rs b/src/tools/miri/tests/fail/data_race/alloc_read_race.rs index 786e57666e2..2cf36606907 100644 --- a/src/tools/miri/tests/fail/data_race/alloc_read_race.rs +++ b/src/tools/miri/tests/fail/data_race/alloc_read_race.rs @@ -39,7 +39,7 @@ pub fn main() { let pointer = &*ptr.0; // Note: could also error due to reading uninitialized memory, but the data-race detector triggers first. - *pointer.load(Ordering::Relaxed) //~ ERROR: Data race detected between (1) creating a new allocation on thread `<unnamed>` and (2) non-atomic read on thread `<unnamed>` + *pointer.load(Ordering::Relaxed) //~ ERROR: Data race detected between (1) creating a new allocation on thread `unnamed-1` and (2) non-atomic read on thread `unnamed-2` }); j1.join().unwrap(); diff --git a/src/tools/miri/tests/fail/data_race/alloc_read_race.stderr b/src/tools/miri/tests/fail/data_race/alloc_read_race.stderr index fb0f77d2e6f..59ed5fe9cf2 100644 --- a/src/tools/miri/tests/fail/data_race/alloc_read_race.stderr +++ b/src/tools/miri/tests/fail/data_race/alloc_read_race.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) creating a new allocation on thread `<unnamed>` and (2) non-atomic read on thread `<unnamed>` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) creating a new allocation on thread `unnamed-ID` and (2) non-atomic read on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/alloc_read_race.rs:LL:CC | LL | *pointer.load(Ordering::Relaxed) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) creating a new allocation on thread `<unnamed>` and (2) non-atomic read on thread `<unnamed>` at ALLOC. (2) just happened here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) creating a new allocation on thread `unnamed-ID` and (2) non-atomic read on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/alloc_read_race.rs:LL:CC @@ -11,7 +11,7 @@ LL | pointer.store(Box::into_raw(Box::new_uninit()), Ordering::Relax | ^^^^^^^^^^^^^^^^^ = 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 (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/alloc_read_race.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/alloc_write_race.rs b/src/tools/miri/tests/fail/data_race/alloc_write_race.rs index 8c685dcb760..e95e0e1a841 100644 --- a/src/tools/miri/tests/fail/data_race/alloc_write_race.rs +++ b/src/tools/miri/tests/fail/data_race/alloc_write_race.rs @@ -37,7 +37,7 @@ pub fn main() { let j2 = spawn(move || { let ptr = ptr; // avoid field capturing let pointer = &*ptr.0; - *pointer.load(Ordering::Relaxed) = 2; //~ ERROR: Data race detected between (1) creating a new allocation on thread `<unnamed>` and (2) non-atomic write on thread `<unnamed>` + *pointer.load(Ordering::Relaxed) = 2; //~ ERROR: Data race detected between (1) creating a new allocation on thread `unnamed-1` and (2) non-atomic write on thread `unnamed-2` }); j1.join().unwrap(); diff --git a/src/tools/miri/tests/fail/data_race/alloc_write_race.stderr b/src/tools/miri/tests/fail/data_race/alloc_write_race.stderr index 7e6edc02bc2..9770684fc52 100644 --- a/src/tools/miri/tests/fail/data_race/alloc_write_race.stderr +++ b/src/tools/miri/tests/fail/data_race/alloc_write_race.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) creating a new allocation on thread `<unnamed>` and (2) non-atomic write on thread `<unnamed>` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) creating a new allocation on thread `unnamed-ID` and (2) non-atomic write on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/alloc_write_race.rs:LL:CC | LL | *pointer.load(Ordering::Relaxed) = 2; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) creating a new allocation on thread `<unnamed>` and (2) non-atomic write on thread `<unnamed>` at ALLOC. (2) just happened here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) creating a new allocation on thread `unnamed-ID` and (2) non-atomic write on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/alloc_write_race.rs:LL:CC @@ -11,7 +11,7 @@ LL | .store(Box::into_raw(Box::<usize>::new_uninit()) as *mut us | ^^^^^^^^^^^^^^^^^^^^^^^^^^ = 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 (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/alloc_write_race.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/atomic_read_na_write_race1.rs b/src/tools/miri/tests/fail/data_race/atomic_read_na_write_race1.rs index d7e9561caf3..a256267bcda 100644 --- a/src/tools/miri/tests/fail/data_race/atomic_read_na_write_race1.rs +++ b/src/tools/miri/tests/fail/data_race/atomic_read_na_write_race1.rs @@ -22,7 +22,7 @@ pub fn main() { let j2 = spawn(move || { let c = c; // avoid field capturing - (&*c.0).load(Ordering::SeqCst) //~ ERROR: Data race detected between (1) non-atomic write on thread `<unnamed>` and (2) atomic load on thread `<unnamed>` + (&*c.0).load(Ordering::SeqCst) //~ ERROR: Data race detected between (1) non-atomic write on thread `unnamed-1` and (2) atomic load on thread `unnamed-2` }); j1.join().unwrap(); diff --git a/src/tools/miri/tests/fail/data_race/atomic_read_na_write_race1.stderr b/src/tools/miri/tests/fail/data_race/atomic_read_na_write_race1.stderr index 04186f7ff7b..a1132ed2067 100644 --- a/src/tools/miri/tests/fail/data_race/atomic_read_na_write_race1.stderr +++ b/src/tools/miri/tests/fail/data_race/atomic_read_na_write_race1.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `<unnamed>` and (2) atomic load on thread `<unnamed>` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) atomic load on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/atomic_read_na_write_race1.rs:LL:CC | LL | (&*c.0).load(Ordering::SeqCst) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) non-atomic write on thread `<unnamed>` and (2) atomic load on thread `<unnamed>` at ALLOC. (2) just happened here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) atomic load on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/atomic_read_na_write_race1.rs:LL:CC @@ -11,7 +11,7 @@ LL | *(c.0 as *mut usize) = 32; | ^^^^^^^^^^^^^^^^^^^^^^^^^ = 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 (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/atomic_read_na_write_race1.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/atomic_read_na_write_race2.rs b/src/tools/miri/tests/fail/data_race/atomic_read_na_write_race2.rs index 62bf8b65561..cc6a0742c23 100644 --- a/src/tools/miri/tests/fail/data_race/atomic_read_na_write_race2.rs +++ b/src/tools/miri/tests/fail/data_race/atomic_read_na_write_race2.rs @@ -25,7 +25,7 @@ pub fn main() { let j2 = spawn(move || { let c = c; // avoid field capturing let atomic_ref = &mut *c.0; - *atomic_ref.get_mut() = 32; //~ ERROR: Data race detected between (1) atomic load on thread `<unnamed>` and (2) non-atomic write on thread `<unnamed>` + *atomic_ref.get_mut() = 32; //~ ERROR: Data race detected between (1) atomic load on thread `unnamed-1` and (2) non-atomic write on thread `unnamed-2` }); j1.join().unwrap(); diff --git a/src/tools/miri/tests/fail/data_race/atomic_read_na_write_race2.stderr b/src/tools/miri/tests/fail/data_race/atomic_read_na_write_race2.stderr index 7e76205da9c..865357cb0ef 100644 --- a/src/tools/miri/tests/fail/data_race/atomic_read_na_write_race2.stderr +++ b/src/tools/miri/tests/fail/data_race/atomic_read_na_write_race2.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) atomic load on thread `<unnamed>` and (2) non-atomic write on thread `<unnamed>` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) atomic load on thread `unnamed-ID` and (2) non-atomic write on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/atomic_read_na_write_race2.rs:LL:CC | LL | *atomic_ref.get_mut() = 32; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) atomic load on thread `<unnamed>` and (2) non-atomic write on thread `<unnamed>` at ALLOC. (2) just happened here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) atomic load on thread `unnamed-ID` and (2) non-atomic write on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/atomic_read_na_write_race2.rs:LL:CC @@ -11,7 +11,7 @@ LL | atomic_ref.load(Ordering::SeqCst) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = 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 (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/atomic_read_na_write_race2.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/atomic_write_na_read_race1.rs b/src/tools/miri/tests/fail/data_race/atomic_write_na_read_race1.rs index 9186c562670..7392781e6c6 100644 --- a/src/tools/miri/tests/fail/data_race/atomic_write_na_read_race1.rs +++ b/src/tools/miri/tests/fail/data_race/atomic_write_na_read_race1.rs @@ -25,7 +25,7 @@ pub fn main() { let j2 = spawn(move || { let c = c; // avoid field capturing let atomic_ref = &mut *c.0; - *atomic_ref.get_mut() //~ ERROR: Data race detected between (1) atomic store on thread `<unnamed>` and (2) non-atomic read on thread `<unnamed>` + *atomic_ref.get_mut() //~ ERROR: Data race detected between (1) atomic store on thread `unnamed-1` and (2) non-atomic read on thread `unnamed-2` }); j1.join().unwrap(); diff --git a/src/tools/miri/tests/fail/data_race/atomic_write_na_read_race1.stderr b/src/tools/miri/tests/fail/data_race/atomic_write_na_read_race1.stderr index 69d11a0a83c..355ea48f117 100644 --- a/src/tools/miri/tests/fail/data_race/atomic_write_na_read_race1.stderr +++ b/src/tools/miri/tests/fail/data_race/atomic_write_na_read_race1.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) atomic store on thread `<unnamed>` and (2) non-atomic read on thread `<unnamed>` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) atomic store on thread `unnamed-ID` and (2) non-atomic read on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/atomic_write_na_read_race1.rs:LL:CC | LL | *atomic_ref.get_mut() - | ^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) atomic store on thread `<unnamed>` and (2) non-atomic read on thread `<unnamed>` at ALLOC. (2) just happened here + | ^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) atomic store on thread `unnamed-ID` and (2) non-atomic read on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/atomic_write_na_read_race1.rs:LL:CC @@ -11,7 +11,7 @@ LL | atomic_ref.store(32, Ordering::SeqCst) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = 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 (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/atomic_write_na_read_race1.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/atomic_write_na_read_race2.rs b/src/tools/miri/tests/fail/data_race/atomic_write_na_read_race2.rs index 0fcae906f09..f681ce0c051 100644 --- a/src/tools/miri/tests/fail/data_race/atomic_write_na_read_race2.rs +++ b/src/tools/miri/tests/fail/data_race/atomic_write_na_read_race2.rs @@ -22,7 +22,7 @@ pub fn main() { let j2 = spawn(move || { let c = c; // avoid field capturing - (&*c.0).store(32, Ordering::SeqCst); //~ ERROR: Data race detected between (1) non-atomic read on thread `<unnamed>` and (2) atomic store on thread `<unnamed>` + (&*c.0).store(32, Ordering::SeqCst); //~ ERROR: Data race detected between (1) non-atomic read on thread `unnamed-1` and (2) atomic store on thread `unnamed-2` }); j1.join().unwrap(); diff --git a/src/tools/miri/tests/fail/data_race/atomic_write_na_read_race2.stderr b/src/tools/miri/tests/fail/data_race/atomic_write_na_read_race2.stderr index 4f734ae5465..500cd09a333 100644 --- a/src/tools/miri/tests/fail/data_race/atomic_write_na_read_race2.stderr +++ b/src/tools/miri/tests/fail/data_race/atomic_write_na_read_race2.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) non-atomic read on thread `<unnamed>` and (2) atomic store on thread `<unnamed>` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) non-atomic read on thread `unnamed-ID` and (2) atomic store on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/atomic_write_na_read_race2.rs:LL:CC | LL | (&*c.0).store(32, Ordering::SeqCst); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) non-atomic read on thread `<unnamed>` and (2) atomic store on thread `<unnamed>` at ALLOC. (2) just happened here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) non-atomic read on thread `unnamed-ID` and (2) atomic store on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/atomic_write_na_read_race2.rs:LL:CC @@ -11,7 +11,7 @@ LL | let _val = *(c.0 as *mut usize); | ^^^^^^^^^^^^^^^^^^^^ = 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 (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/atomic_write_na_read_race2.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/atomic_write_na_write_race1.rs b/src/tools/miri/tests/fail/data_race/atomic_write_na_write_race1.rs index 822d86c1c1d..47a3ef5d168 100644 --- a/src/tools/miri/tests/fail/data_race/atomic_write_na_write_race1.rs +++ b/src/tools/miri/tests/fail/data_race/atomic_write_na_write_race1.rs @@ -22,7 +22,7 @@ pub fn main() { let j2 = spawn(move || { let c = c; // avoid field capturing - (&*c.0).store(64, Ordering::SeqCst); //~ ERROR: Data race detected between (1) non-atomic write on thread `<unnamed>` and (2) atomic store on thread `<unnamed>` + (&*c.0).store(64, Ordering::SeqCst); //~ ERROR: Data race detected between (1) non-atomic write on thread `unnamed-1` and (2) atomic store on thread `unnamed-2` }); j1.join().unwrap(); diff --git a/src/tools/miri/tests/fail/data_race/atomic_write_na_write_race1.stderr b/src/tools/miri/tests/fail/data_race/atomic_write_na_write_race1.stderr index 8745048df47..0b870f13bb2 100644 --- a/src/tools/miri/tests/fail/data_race/atomic_write_na_write_race1.stderr +++ b/src/tools/miri/tests/fail/data_race/atomic_write_na_write_race1.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `<unnamed>` and (2) atomic store on thread `<unnamed>` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) atomic store on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/atomic_write_na_write_race1.rs:LL:CC | LL | (&*c.0).store(64, Ordering::SeqCst); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) non-atomic write on thread `<unnamed>` and (2) atomic store on thread `<unnamed>` at ALLOC. (2) just happened here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) atomic store on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/atomic_write_na_write_race1.rs:LL:CC @@ -11,7 +11,7 @@ LL | *(c.0 as *mut usize) = 32; | ^^^^^^^^^^^^^^^^^^^^^^^^^ = 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 (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/atomic_write_na_write_race1.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/atomic_write_na_write_race2.rs b/src/tools/miri/tests/fail/data_race/atomic_write_na_write_race2.rs index d84531646e2..8bba4a88924 100644 --- a/src/tools/miri/tests/fail/data_race/atomic_write_na_write_race2.rs +++ b/src/tools/miri/tests/fail/data_race/atomic_write_na_write_race2.rs @@ -25,7 +25,7 @@ pub fn main() { let j2 = spawn(move || { let c = c; // avoid field capturing let atomic_ref = &mut *c.0; - *atomic_ref.get_mut() = 32; //~ ERROR: Data race detected between (1) atomic store on thread `<unnamed>` and (2) non-atomic write on thread `<unnamed>` + *atomic_ref.get_mut() = 32; //~ ERROR: Data race detected between (1) atomic store on thread `unnamed-1` and (2) non-atomic write on thread `unnamed-2` }); j1.join().unwrap(); diff --git a/src/tools/miri/tests/fail/data_race/atomic_write_na_write_race2.stderr b/src/tools/miri/tests/fail/data_race/atomic_write_na_write_race2.stderr index 7ee50143124..dbbf6bf1ef5 100644 --- a/src/tools/miri/tests/fail/data_race/atomic_write_na_write_race2.stderr +++ b/src/tools/miri/tests/fail/data_race/atomic_write_na_write_race2.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) atomic store on thread `<unnamed>` and (2) non-atomic write on thread `<unnamed>` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) atomic store on thread `unnamed-ID` and (2) non-atomic write on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/atomic_write_na_write_race2.rs:LL:CC | LL | *atomic_ref.get_mut() = 32; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) atomic store on thread `<unnamed>` and (2) non-atomic write on thread `<unnamed>` at ALLOC. (2) just happened here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) atomic store on thread `unnamed-ID` and (2) non-atomic write on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/atomic_write_na_write_race2.rs:LL:CC @@ -11,7 +11,7 @@ LL | atomic_ref.store(64, Ordering::SeqCst); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = 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 (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/atomic_write_na_write_race2.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/dangling_thread_async_race.rs b/src/tools/miri/tests/fail/data_race/dangling_thread_async_race.rs index 0fdb8e631a1..5b9005606e0 100644 --- a/src/tools/miri/tests/fail/data_race/dangling_thread_async_race.rs +++ b/src/tools/miri/tests/fail/data_race/dangling_thread_async_race.rs @@ -36,7 +36,7 @@ fn main() { let join2 = unsafe { spawn(move || { let c = c; // capture `c`, not just its field. - *c.0 = 64; //~ ERROR: Data race detected between (1) non-atomic write on thread `<unnamed>` and (2) non-atomic write on thread `<unnamed>` + *c.0 = 64; //~ ERROR: Data race detected between (1) non-atomic write on thread `unnamed-1` and (2) non-atomic write on thread `unnamed-3` }) }; diff --git a/src/tools/miri/tests/fail/data_race/dangling_thread_async_race.stderr b/src/tools/miri/tests/fail/data_race/dangling_thread_async_race.stderr index deb6029577f..1b02880b998 100644 --- a/src/tools/miri/tests/fail/data_race/dangling_thread_async_race.stderr +++ b/src/tools/miri/tests/fail/data_race/dangling_thread_async_race.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `<unnamed>` and (2) non-atomic write on thread `<unnamed>` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) non-atomic write on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/dangling_thread_async_race.rs:LL:CC | LL | *c.0 = 64; - | ^^^^^^^^^ Data race detected between (1) non-atomic write on thread `<unnamed>` and (2) non-atomic write on thread `<unnamed>` at ALLOC. (2) just happened here + | ^^^^^^^^^ Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) non-atomic write on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/dangling_thread_async_race.rs:LL:CC @@ -11,7 +11,7 @@ LL | *c.0 = 32; | ^^^^^^^^^ = 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 (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/dangling_thread_async_race.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/dangling_thread_race.rs b/src/tools/miri/tests/fail/data_race/dangling_thread_race.rs index fa2176d844f..91c1191e036 100644 --- a/src/tools/miri/tests/fail/data_race/dangling_thread_race.rs +++ b/src/tools/miri/tests/fail/data_race/dangling_thread_race.rs @@ -34,6 +34,6 @@ fn main() { spawn(|| ()).join().unwrap(); unsafe { - *c.0 = 64; //~ ERROR: Data race detected between (1) non-atomic write on thread `<unnamed>` and (2) non-atomic write on thread `main` + *c.0 = 64; //~ ERROR: Data race detected between (1) non-atomic write on thread `unnamed-1` and (2) non-atomic write on thread `main` } } diff --git a/src/tools/miri/tests/fail/data_race/dangling_thread_race.stderr b/src/tools/miri/tests/fail/data_race/dangling_thread_race.stderr index f8ede3ac4c8..7f6ba5ee040 100644 --- a/src/tools/miri/tests/fail/data_race/dangling_thread_race.stderr +++ b/src/tools/miri/tests/fail/data_race/dangling_thread_race.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `<unnamed>` and (2) non-atomic write on thread `main` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) non-atomic write on thread `main` at ALLOC. (2) just happened here --> $DIR/dangling_thread_race.rs:LL:CC | LL | *c.0 = 64; - | ^^^^^^^^^ Data race detected between (1) non-atomic write on thread `<unnamed>` and (2) non-atomic write on thread `main` at ALLOC. (2) just happened here + | ^^^^^^^^^ Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) non-atomic write on thread `main` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/dangling_thread_race.rs:LL:CC diff --git a/src/tools/miri/tests/fail/data_race/dealloc_read_race1.rs b/src/tools/miri/tests/fail/data_race/dealloc_read_race1.rs index 1d914f0a808..5928e471760 100644 --- a/src/tools/miri/tests/fail/data_race/dealloc_read_race1.rs +++ b/src/tools/miri/tests/fail/data_race/dealloc_read_race1.rs @@ -27,7 +27,7 @@ pub fn main() { let j2 = spawn(move || { let ptr = ptr; // avoid field capturing __rust_dealloc( - //~^ ERROR: Data race detected between (1) non-atomic read on thread `<unnamed>` and (2) deallocation on thread `<unnamed>` + //~^ ERROR: Data race detected between (1) non-atomic read on thread `unnamed-1` and (2) deallocation on thread `unnamed-2` ptr.0 as *mut _, std::mem::size_of::<usize>(), std::mem::align_of::<usize>(), diff --git a/src/tools/miri/tests/fail/data_race/dealloc_read_race1.stderr b/src/tools/miri/tests/fail/data_race/dealloc_read_race1.stderr index 55b0b447213..a4a22a8d71e 100644 --- a/src/tools/miri/tests/fail/data_race/dealloc_read_race1.stderr +++ b/src/tools/miri/tests/fail/data_race/dealloc_read_race1.stderr @@ -1,4 +1,4 @@ -error: Undefined Behavior: Data race detected between (1) non-atomic read on thread `<unnamed>` and (2) deallocation on thread `<unnamed>` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) non-atomic read on thread `unnamed-ID` and (2) deallocation on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/dealloc_read_race1.rs:LL:CC | LL | / __rust_dealloc( @@ -7,7 +7,7 @@ LL | | ptr.0 as *mut _, LL | | std::mem::size_of::<usize>(), LL | | std::mem::align_of::<usize>(), LL | | ); - | |_____________^ Data race detected between (1) non-atomic read on thread `<unnamed>` and (2) deallocation on thread `<unnamed>` at ALLOC. (2) just happened here + | |_____________^ Data race detected between (1) non-atomic read on thread `unnamed-ID` and (2) deallocation on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/dealloc_read_race1.rs:LL:CC @@ -16,7 +16,7 @@ LL | let _val = *ptr.0; | ^^^^^^ = 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 (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/dealloc_read_race1.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/dealloc_read_race2.rs b/src/tools/miri/tests/fail/data_race/dealloc_read_race2.rs index 53f1d19fa71..c5f82cc9a74 100644 --- a/src/tools/miri/tests/fail/data_race/dealloc_read_race2.rs +++ b/src/tools/miri/tests/fail/data_race/dealloc_read_race2.rs @@ -30,7 +30,7 @@ pub fn main() { let j2 = spawn(move || { let ptr = ptr; // avoid field capturing - // Also an error of the form: Data race detected between (1) deallocation on thread `<unnamed>` and (2) non-atomic read on thread `<unnamed>` + // Also an error of the form: Data race detected between (1) deallocation on thread `unnamed-ID` and (2) non-atomic read on thread `unnamed-ID` // but the invalid allocation is detected first. *ptr.0 //~ ERROR: has been freed }); diff --git a/src/tools/miri/tests/fail/data_race/dealloc_read_race2.stderr b/src/tools/miri/tests/fail/data_race/dealloc_read_race2.stderr index 8925de139b4..dbf9acd23b6 100644 --- a/src/tools/miri/tests/fail/data_race/dealloc_read_race2.stderr +++ b/src/tools/miri/tests/fail/data_race/dealloc_read_race2.stderr @@ -20,7 +20,7 @@ LL | | std::mem::size_of::<usize>(), LL | | std::mem::align_of::<usize>(), LL | | ) | |_____________^ - = note: BACKTRACE (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/dealloc_read_race2.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/dealloc_read_race_stack.rs b/src/tools/miri/tests/fail/data_race/dealloc_read_race_stack.rs index 728dc64d828..1095f1e4e82 100644 --- a/src/tools/miri/tests/fail/data_race/dealloc_read_race_stack.rs +++ b/src/tools/miri/tests/fail/data_race/dealloc_read_race_stack.rs @@ -36,7 +36,7 @@ pub fn main() { sleep(Duration::from_millis(200)); // Now `stack_var` gets deallocated. - } //~ ERROR: Data race detected between (1) non-atomic read on thread `<unnamed>` and (2) deallocation on thread `<unnamed>` + } //~ ERROR: Data race detected between (1) non-atomic read on thread `unnamed-2` and (2) deallocation on thread `unnamed-1` }); let j2 = spawn(move || { diff --git a/src/tools/miri/tests/fail/data_race/dealloc_read_race_stack.stderr b/src/tools/miri/tests/fail/data_race/dealloc_read_race_stack.stderr index b9aa4bb041b..e36376d0c75 100644 --- a/src/tools/miri/tests/fail/data_race/dealloc_read_race_stack.stderr +++ b/src/tools/miri/tests/fail/data_race/dealloc_read_race_stack.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) non-atomic read on thread `<unnamed>` and (2) deallocation on thread `<unnamed>` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) non-atomic read on thread `unnamed-ID` and (2) deallocation on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/dealloc_read_race_stack.rs:LL:CC | LL | } - | ^ Data race detected between (1) non-atomic read on thread `<unnamed>` and (2) deallocation on thread `<unnamed>` at ALLOC. (2) just happened here + | ^ Data race detected between (1) non-atomic read on thread `unnamed-ID` and (2) deallocation on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/dealloc_read_race_stack.rs:LL:CC @@ -11,7 +11,7 @@ LL | *pointer.load(Ordering::Acquire) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = 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 (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/dealloc_read_race_stack.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/dealloc_write_race1.rs b/src/tools/miri/tests/fail/data_race/dealloc_write_race1.rs index e0d7f983a63..b5911e5111b 100644 --- a/src/tools/miri/tests/fail/data_race/dealloc_write_race1.rs +++ b/src/tools/miri/tests/fail/data_race/dealloc_write_race1.rs @@ -26,7 +26,7 @@ pub fn main() { let j2 = spawn(move || { let ptr = ptr; // avoid field capturing __rust_dealloc( - //~^ ERROR: Data race detected between (1) non-atomic write on thread `<unnamed>` and (2) deallocation on thread `<unnamed>` + //~^ ERROR: Data race detected between (1) non-atomic write on thread `unnamed-1` and (2) deallocation on thread `unnamed-2` ptr.0 as *mut _, std::mem::size_of::<usize>(), std::mem::align_of::<usize>(), diff --git a/src/tools/miri/tests/fail/data_race/dealloc_write_race1.stderr b/src/tools/miri/tests/fail/data_race/dealloc_write_race1.stderr index 0af2911223f..0c6cd9bbd93 100644 --- a/src/tools/miri/tests/fail/data_race/dealloc_write_race1.stderr +++ b/src/tools/miri/tests/fail/data_race/dealloc_write_race1.stderr @@ -1,4 +1,4 @@ -error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `<unnamed>` and (2) deallocation on thread `<unnamed>` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) deallocation on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/dealloc_write_race1.rs:LL:CC | LL | / __rust_dealloc( @@ -7,7 +7,7 @@ LL | | ptr.0 as *mut _, LL | | std::mem::size_of::<usize>(), LL | | std::mem::align_of::<usize>(), LL | | ); - | |_____________^ Data race detected between (1) non-atomic write on thread `<unnamed>` and (2) deallocation on thread `<unnamed>` at ALLOC. (2) just happened here + | |_____________^ Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) deallocation on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/dealloc_write_race1.rs:LL:CC @@ -16,7 +16,7 @@ LL | *ptr.0 = 2; | ^^^^^^^^^^ = 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 (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/dealloc_write_race1.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/dealloc_write_race2.rs b/src/tools/miri/tests/fail/data_race/dealloc_write_race2.rs index 11b9d97527c..7a2c882f7ec 100644 --- a/src/tools/miri/tests/fail/data_race/dealloc_write_race2.rs +++ b/src/tools/miri/tests/fail/data_race/dealloc_write_race2.rs @@ -29,7 +29,7 @@ pub fn main() { let j2 = spawn(move || { let ptr = ptr; // avoid field capturing - // Also an error of the form: Data race detected between (1) deallocation on thread `<unnamed>` and (2) non-atomic write on thread `<unnamed>` + // Also an error of the form: Data race detected between (1) deallocation on thread `unnamed-ID` and (2) non-atomic write on thread `unnamed-ID` // but the invalid allocation is detected first. *ptr.0 = 2; //~ ERROR: has been freed }); diff --git a/src/tools/miri/tests/fail/data_race/dealloc_write_race2.stderr b/src/tools/miri/tests/fail/data_race/dealloc_write_race2.stderr index 6ab77de8afe..30093735313 100644 --- a/src/tools/miri/tests/fail/data_race/dealloc_write_race2.stderr +++ b/src/tools/miri/tests/fail/data_race/dealloc_write_race2.stderr @@ -20,7 +20,7 @@ LL | | std::mem::size_of::<usize>(), LL | | std::mem::align_of::<usize>(), LL | | ); | |_____________^ - = note: BACKTRACE (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/dealloc_write_race2.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/dealloc_write_race_stack.rs b/src/tools/miri/tests/fail/data_race/dealloc_write_race_stack.rs index da3cdc23ad6..5ee4cc04a8f 100644 --- a/src/tools/miri/tests/fail/data_race/dealloc_write_race_stack.rs +++ b/src/tools/miri/tests/fail/data_race/dealloc_write_race_stack.rs @@ -36,7 +36,7 @@ pub fn main() { sleep(Duration::from_millis(200)); // Now `stack_var` gets deallocated. - } //~ ERROR: Data race detected between (1) non-atomic write on thread `<unnamed>` and (2) deallocation on thread `<unnamed>` + } //~ ERROR: Data race detected between (1) non-atomic write on thread `unnamed-2` and (2) deallocation on thread `unnamed-1` }); let j2 = spawn(move || { diff --git a/src/tools/miri/tests/fail/data_race/dealloc_write_race_stack.stderr b/src/tools/miri/tests/fail/data_race/dealloc_write_race_stack.stderr index c1471ae5583..4c16162fa1f 100644 --- a/src/tools/miri/tests/fail/data_race/dealloc_write_race_stack.stderr +++ b/src/tools/miri/tests/fail/data_race/dealloc_write_race_stack.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `<unnamed>` and (2) deallocation on thread `<unnamed>` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) deallocation on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/dealloc_write_race_stack.rs:LL:CC | LL | } - | ^ Data race detected between (1) non-atomic write on thread `<unnamed>` and (2) deallocation on thread `<unnamed>` at ALLOC. (2) just happened here + | ^ Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) deallocation on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/dealloc_write_race_stack.rs:LL:CC @@ -11,7 +11,7 @@ LL | *pointer.load(Ordering::Acquire) = 3; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = 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 (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/dealloc_write_race_stack.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/enable_after_join_to_main.rs b/src/tools/miri/tests/fail/data_race/enable_after_join_to_main.rs index c1407fc5391..f2da45d7275 100644 --- a/src/tools/miri/tests/fail/data_race/enable_after_join_to_main.rs +++ b/src/tools/miri/tests/fail/data_race/enable_after_join_to_main.rs @@ -32,7 +32,7 @@ pub fn main() { let j2 = spawn(move || { let c = c; // avoid field capturing - *c.0 = 64; //~ ERROR: Data race detected between (1) non-atomic write on thread `<unnamed>` and (2) non-atomic write on thread `<unnamed>` + *c.0 = 64; //~ ERROR: Data race detected between (1) non-atomic write on thread `unnamed-5` and (2) non-atomic write on thread `unnamed-6` }); j1.join().unwrap(); diff --git a/src/tools/miri/tests/fail/data_race/enable_after_join_to_main.stderr b/src/tools/miri/tests/fail/data_race/enable_after_join_to_main.stderr index e51119ddb2f..686d9b48e53 100644 --- a/src/tools/miri/tests/fail/data_race/enable_after_join_to_main.stderr +++ b/src/tools/miri/tests/fail/data_race/enable_after_join_to_main.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `<unnamed>` and (2) non-atomic write on thread `<unnamed>` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) non-atomic write on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/enable_after_join_to_main.rs:LL:CC | LL | *c.0 = 64; - | ^^^^^^^^^ Data race detected between (1) non-atomic write on thread `<unnamed>` and (2) non-atomic write on thread `<unnamed>` at ALLOC. (2) just happened here + | ^^^^^^^^^ Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) non-atomic write on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/enable_after_join_to_main.rs:LL:CC @@ -11,7 +11,7 @@ LL | *c.0 = 32; | ^^^^^^^^^ = 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 (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/enable_after_join_to_main.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/fence_after_load.rs b/src/tools/miri/tests/fail/data_race/fence_after_load.rs index 12c74740387..683e3b9c7ac 100644 --- a/src/tools/miri/tests/fail/data_race/fence_after_load.rs +++ b/src/tools/miri/tests/fail/data_race/fence_after_load.rs @@ -20,5 +20,5 @@ fn main() { // The fence is useless, since it did not happen-after the `store` in the other thread. // Hence this is a data race. // Also see https://github.com/rust-lang/miri/issues/2192. - unsafe { V = 2 } //~ERROR: Data race detected between (1) non-atomic write on thread `<unnamed>` and (2) non-atomic write on thread `main` + unsafe { V = 2 } //~ERROR: Data race detected between (1) non-atomic write on thread `unnamed-1` and (2) non-atomic write on thread `main` } diff --git a/src/tools/miri/tests/fail/data_race/fence_after_load.stderr b/src/tools/miri/tests/fail/data_race/fence_after_load.stderr index 0b71a41098a..776cf7c17b9 100644 --- a/src/tools/miri/tests/fail/data_race/fence_after_load.stderr +++ b/src/tools/miri/tests/fail/data_race/fence_after_load.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `<unnamed>` and (2) non-atomic write on thread `main` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) non-atomic write on thread `main` at ALLOC. (2) just happened here --> $DIR/fence_after_load.rs:LL:CC | LL | unsafe { V = 2 } - | ^^^^^ Data race detected between (1) non-atomic write on thread `<unnamed>` and (2) non-atomic write on thread `main` at ALLOC. (2) just happened here + | ^^^^^ Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) non-atomic write on thread `main` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/fence_after_load.rs:LL:CC diff --git a/src/tools/miri/tests/fail/data_race/mixed_size_read.rs b/src/tools/miri/tests/fail/data_race/mixed_size_read.rs index 871d5f9a9db..091a47070ba 100644 --- a/src/tools/miri/tests/fail/data_race/mixed_size_read.rs +++ b/src/tools/miri/tests/fail/data_race/mixed_size_read.rs @@ -19,7 +19,7 @@ fn main() { }); s.spawn(|| { a8[0].load(Ordering::SeqCst); - //~^ ERROR: Race condition detected between (1) 2-byte atomic load on thread `<unnamed>` and (2) 1-byte atomic load on thread `<unnamed>` + //~^ ERROR: Race condition detected between (1) 2-byte atomic load on thread `unnamed-1` and (2) 1-byte atomic load on thread `unnamed-2` }); }); } diff --git a/src/tools/miri/tests/fail/data_race/mixed_size_read.stderr b/src/tools/miri/tests/fail/data_race/mixed_size_read.stderr index acbc2306726..5b25c666f41 100644 --- a/src/tools/miri/tests/fail/data_race/mixed_size_read.stderr +++ b/src/tools/miri/tests/fail/data_race/mixed_size_read.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Race condition detected between (1) 2-byte atomic load on thread `<unnamed>` and (2) 1-byte atomic load on thread `<unnamed>` at ALLOC. (2) just happened here +error: Undefined Behavior: Race condition detected between (1) 2-byte atomic load on thread `unnamed-ID` and (2) 1-byte atomic load on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/mixed_size_read.rs:LL:CC | LL | a8[0].load(Ordering::SeqCst); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Race condition detected between (1) 2-byte atomic load on thread `<unnamed>` and (2) 1-byte atomic load on thread `<unnamed>` at ALLOC. (2) just happened here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Race condition detected between (1) 2-byte atomic load on thread `unnamed-ID` and (2) 1-byte atomic load on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/mixed_size_read.rs:LL:CC @@ -13,7 +13,7 @@ LL | a16.load(Ordering::SeqCst); = help: see https://doc.rust-lang.org/nightly/std/sync/atomic/index.html#memory-model-for-atomic-accesses for more information about the Rust memory model = 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 (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/mixed_size_read.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/mixed_size_write.rs b/src/tools/miri/tests/fail/data_race/mixed_size_write.rs index e52e76e4802..49fb6c1d5c3 100644 --- a/src/tools/miri/tests/fail/data_race/mixed_size_write.rs +++ b/src/tools/miri/tests/fail/data_race/mixed_size_write.rs @@ -19,7 +19,7 @@ fn main() { }); s.spawn(|| { a8[0].store(1, Ordering::SeqCst); - //~^ ERROR: Race condition detected between (1) 2-byte atomic store on thread `<unnamed>` and (2) 1-byte atomic store on thread `<unnamed>` + //~^ ERROR: Race condition detected between (1) 2-byte atomic store on thread `unnamed-1` and (2) 1-byte atomic store on thread `unnamed-2` }); }); } diff --git a/src/tools/miri/tests/fail/data_race/mixed_size_write.stderr b/src/tools/miri/tests/fail/data_race/mixed_size_write.stderr index 761942cbad3..c6157b87b38 100644 --- a/src/tools/miri/tests/fail/data_race/mixed_size_write.stderr +++ b/src/tools/miri/tests/fail/data_race/mixed_size_write.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Race condition detected between (1) 2-byte atomic store on thread `<unnamed>` and (2) 1-byte atomic store on thread `<unnamed>` at ALLOC. (2) just happened here +error: Undefined Behavior: Race condition detected between (1) 2-byte atomic store on thread `unnamed-ID` and (2) 1-byte atomic store on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/mixed_size_write.rs:LL:CC | LL | a8[0].store(1, Ordering::SeqCst); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Race condition detected between (1) 2-byte atomic store on thread `<unnamed>` and (2) 1-byte atomic store on thread `<unnamed>` at ALLOC. (2) just happened here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Race condition detected between (1) 2-byte atomic store on thread `unnamed-ID` and (2) 1-byte atomic store on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/mixed_size_write.rs:LL:CC @@ -13,7 +13,7 @@ LL | a16.store(1, Ordering::SeqCst); = help: see https://doc.rust-lang.org/nightly/std/sync/atomic/index.html#memory-model-for-atomic-accesses for more information about the Rust memory model = 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 (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/mixed_size_write.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/read_read_race1.rs b/src/tools/miri/tests/fail/data_race/read_read_race1.rs index dd800af4af7..f66b5ca3d53 100644 --- a/src/tools/miri/tests/fail/data_race/read_read_race1.rs +++ b/src/tools/miri/tests/fail/data_race/read_read_race1.rs @@ -21,7 +21,7 @@ fn main() { unsafe { ptr.read() }; // Then do the atomic access. a.load(Ordering::SeqCst); - //~^ ERROR: Data race detected between (1) non-atomic read on thread `<unnamed>` and (2) atomic load on thread `<unnamed>` + //~^ ERROR: Data race detected between (1) non-atomic read on thread `unnamed-1` and (2) atomic load on thread `unnamed-2` }); }); } diff --git a/src/tools/miri/tests/fail/data_race/read_read_race1.stderr b/src/tools/miri/tests/fail/data_race/read_read_race1.stderr index d2ba738f0b9..37ef46335d4 100644 --- a/src/tools/miri/tests/fail/data_race/read_read_race1.stderr +++ b/src/tools/miri/tests/fail/data_race/read_read_race1.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) non-atomic read on thread `<unnamed>` and (2) atomic load on thread `<unnamed>` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) non-atomic read on thread `unnamed-ID` and (2) atomic load on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/read_read_race1.rs:LL:CC | LL | a.load(Ordering::SeqCst); - | ^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) non-atomic read on thread `<unnamed>` and (2) atomic load on thread `<unnamed>` at ALLOC. (2) just happened here + | ^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) non-atomic read on thread `unnamed-ID` and (2) atomic load on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/read_read_race1.rs:LL:CC @@ -13,7 +13,7 @@ LL | unsafe { ptr.read() }; = help: see https://doc.rust-lang.org/nightly/std/sync/atomic/index.html#memory-model-for-atomic-accesses for more information about the Rust memory model = 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 (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/read_read_race1.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/read_read_race2.rs b/src/tools/miri/tests/fail/data_race/read_read_race2.rs index 1f35cb639c3..d87b667d912 100644 --- a/src/tools/miri/tests/fail/data_race/read_read_race2.rs +++ b/src/tools/miri/tests/fail/data_race/read_read_race2.rs @@ -21,7 +21,7 @@ fn main() { let ptr = &a as *const AtomicU16 as *mut u16; unsafe { ptr.read() }; - //~^ ERROR: Data race detected between (1) atomic load on thread `<unnamed>` and (2) non-atomic read on thread `<unnamed>` + //~^ ERROR: Data race detected between (1) atomic load on thread `unnamed-1` and (2) non-atomic read on thread `unnamed-2` }); }); } diff --git a/src/tools/miri/tests/fail/data_race/read_read_race2.stderr b/src/tools/miri/tests/fail/data_race/read_read_race2.stderr index 8ac0446fccd..e0cabf62a25 100644 --- a/src/tools/miri/tests/fail/data_race/read_read_race2.stderr +++ b/src/tools/miri/tests/fail/data_race/read_read_race2.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) atomic load on thread `<unnamed>` and (2) non-atomic read on thread `<unnamed>` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) atomic load on thread `unnamed-ID` and (2) non-atomic read on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/read_read_race2.rs:LL:CC | LL | unsafe { ptr.read() }; - | ^^^^^^^^^^ Data race detected between (1) atomic load on thread `<unnamed>` and (2) non-atomic read on thread `<unnamed>` at ALLOC. (2) just happened here + | ^^^^^^^^^^ Data race detected between (1) atomic load on thread `unnamed-ID` and (2) non-atomic read on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/read_read_race2.rs:LL:CC @@ -13,7 +13,7 @@ LL | a.load(Ordering::SeqCst); = help: see https://doc.rust-lang.org/nightly/std/sync/atomic/index.html#memory-model-for-atomic-accesses for more information about the Rust memory model = 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 (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/read_read_race2.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/read_write_race.rs b/src/tools/miri/tests/fail/data_race/read_write_race.rs index 37208549686..70971b59ffe 100644 --- a/src/tools/miri/tests/fail/data_race/read_write_race.rs +++ b/src/tools/miri/tests/fail/data_race/read_write_race.rs @@ -21,7 +21,7 @@ pub fn main() { let j2 = spawn(move || { let c = c; // avoid field capturing - *c.0 = 64; //~ ERROR: Data race detected between (1) non-atomic read on thread `<unnamed>` and (2) non-atomic write on thread `<unnamed>` + *c.0 = 64; //~ ERROR: Data race detected between (1) non-atomic read on thread `unnamed-1` and (2) non-atomic write on thread `unnamed-2` }); j1.join().unwrap(); diff --git a/src/tools/miri/tests/fail/data_race/read_write_race.stderr b/src/tools/miri/tests/fail/data_race/read_write_race.stderr index 0066a11188b..8558db4bfdc 100644 --- a/src/tools/miri/tests/fail/data_race/read_write_race.stderr +++ b/src/tools/miri/tests/fail/data_race/read_write_race.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) non-atomic read on thread `<unnamed>` and (2) non-atomic write on thread `<unnamed>` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) non-atomic read on thread `unnamed-ID` and (2) non-atomic write on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/read_write_race.rs:LL:CC | LL | *c.0 = 64; - | ^^^^^^^^^ Data race detected between (1) non-atomic read on thread `<unnamed>` and (2) non-atomic write on thread `<unnamed>` at ALLOC. (2) just happened here + | ^^^^^^^^^ Data race detected between (1) non-atomic read on thread `unnamed-ID` and (2) non-atomic write on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/read_write_race.rs:LL:CC @@ -11,7 +11,7 @@ LL | let _val = *c.0; | ^^^^ = 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 (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/read_write_race.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/read_write_race_stack.rs b/src/tools/miri/tests/fail/data_race/read_write_race_stack.rs index df000b7942e..9fec3ceee07 100644 --- a/src/tools/miri/tests/fail/data_race/read_write_race_stack.rs +++ b/src/tools/miri/tests/fail/data_race/read_write_race_stack.rs @@ -40,7 +40,7 @@ pub fn main() { sleep(Duration::from_millis(200)); - stack_var //~ ERROR: Data race detected between (1) non-atomic write on thread `<unnamed>` and (2) non-atomic read on thread `<unnamed>` + stack_var //~ ERROR: Data race detected between (1) non-atomic write on thread `unnamed-2` and (2) non-atomic read on thread `unnamed-1` }); let j2 = spawn(move || { diff --git a/src/tools/miri/tests/fail/data_race/read_write_race_stack.stderr b/src/tools/miri/tests/fail/data_race/read_write_race_stack.stderr index 35f63af2dc5..7ca249a917b 100644 --- a/src/tools/miri/tests/fail/data_race/read_write_race_stack.stderr +++ b/src/tools/miri/tests/fail/data_race/read_write_race_stack.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `<unnamed>` and (2) non-atomic read on thread `<unnamed>` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) non-atomic read on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/read_write_race_stack.rs:LL:CC | LL | stack_var - | ^^^^^^^^^ Data race detected between (1) non-atomic write on thread `<unnamed>` and (2) non-atomic read on thread `<unnamed>` at ALLOC. (2) just happened here + | ^^^^^^^^^ Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) non-atomic read on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/read_write_race_stack.rs:LL:CC @@ -11,7 +11,7 @@ LL | *pointer.load(Ordering::Acquire) = 3; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = 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 (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/read_write_race_stack.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/relax_acquire_race.rs b/src/tools/miri/tests/fail/data_race/relax_acquire_race.rs index f20dcec4e28..be4450794ca 100644 --- a/src/tools/miri/tests/fail/data_race/relax_acquire_race.rs +++ b/src/tools/miri/tests/fail/data_race/relax_acquire_race.rs @@ -39,7 +39,7 @@ pub fn main() { let j3 = spawn(move || { let c = c; // avoid field capturing if SYNC.load(Ordering::Acquire) == 2 { - *c.0 //~ ERROR: Data race detected between (1) non-atomic write on thread `<unnamed>` and (2) non-atomic read on thread `<unnamed>` + *c.0 //~ ERROR: Data race detected between (1) non-atomic write on thread `unnamed-1` and (2) non-atomic read on thread `unnamed-3` } else { 0 } diff --git a/src/tools/miri/tests/fail/data_race/relax_acquire_race.stderr b/src/tools/miri/tests/fail/data_race/relax_acquire_race.stderr index 6cd232ac3d4..b5e6895302f 100644 --- a/src/tools/miri/tests/fail/data_race/relax_acquire_race.stderr +++ b/src/tools/miri/tests/fail/data_race/relax_acquire_race.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `<unnamed>` and (2) non-atomic read on thread `<unnamed>` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) non-atomic read on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/relax_acquire_race.rs:LL:CC | LL | *c.0 - | ^^^^ Data race detected between (1) non-atomic write on thread `<unnamed>` and (2) non-atomic read on thread `<unnamed>` at ALLOC. (2) just happened here + | ^^^^ Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) non-atomic read on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/relax_acquire_race.rs:LL:CC @@ -11,7 +11,7 @@ LL | *c.0 = 1; | ^^^^^^^^ = 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 (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/relax_acquire_race.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/release_seq_race.rs b/src/tools/miri/tests/fail/data_race/release_seq_race.rs index 4050895f296..9810832413e 100644 --- a/src/tools/miri/tests/fail/data_race/release_seq_race.rs +++ b/src/tools/miri/tests/fail/data_race/release_seq_race.rs @@ -43,7 +43,7 @@ pub fn main() { let c = c; // avoid field capturing sleep(Duration::from_millis(500)); if SYNC.load(Ordering::Acquire) == 3 { - *c.0 //~ ERROR: Data race detected between (1) non-atomic write on thread `<unnamed>` and (2) non-atomic read on thread `<unnamed>` + *c.0 //~ ERROR: Data race detected between (1) non-atomic write on thread `unnamed-1` and (2) non-atomic read on thread `unnamed-3` } else { 0 } diff --git a/src/tools/miri/tests/fail/data_race/release_seq_race.stderr b/src/tools/miri/tests/fail/data_race/release_seq_race.stderr index 61121bb8347..e031c55ecb1 100644 --- a/src/tools/miri/tests/fail/data_race/release_seq_race.stderr +++ b/src/tools/miri/tests/fail/data_race/release_seq_race.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `<unnamed>` and (2) non-atomic read on thread `<unnamed>` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) non-atomic read on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/release_seq_race.rs:LL:CC | LL | *c.0 - | ^^^^ Data race detected between (1) non-atomic write on thread `<unnamed>` and (2) non-atomic read on thread `<unnamed>` at ALLOC. (2) just happened here + | ^^^^ Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) non-atomic read on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/release_seq_race.rs:LL:CC @@ -11,7 +11,7 @@ LL | *c.0 = 1; | ^^^^^^^^ = 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 (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/release_seq_race.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/release_seq_race_same_thread.rs b/src/tools/miri/tests/fail/data_race/release_seq_race_same_thread.rs index 2cba38a8e1e..93cbc2a57d6 100644 --- a/src/tools/miri/tests/fail/data_race/release_seq_race_same_thread.rs +++ b/src/tools/miri/tests/fail/data_race/release_seq_race_same_thread.rs @@ -39,7 +39,7 @@ pub fn main() { let j2 = spawn(move || { let c = c; // avoid field capturing if SYNC.load(Ordering::Acquire) == 2 { - *c.0 //~ ERROR: Data race detected between (1) non-atomic write on thread `<unnamed>` and (2) non-atomic read on thread `<unnamed>` + *c.0 //~ ERROR: Data race detected between (1) non-atomic write on thread `unnamed-1` and (2) non-atomic read on thread `unnamed-2` } else { 0 } diff --git a/src/tools/miri/tests/fail/data_race/release_seq_race_same_thread.stderr b/src/tools/miri/tests/fail/data_race/release_seq_race_same_thread.stderr index d674b30c770..86183e1e43f 100644 --- a/src/tools/miri/tests/fail/data_race/release_seq_race_same_thread.stderr +++ b/src/tools/miri/tests/fail/data_race/release_seq_race_same_thread.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `<unnamed>` and (2) non-atomic read on thread `<unnamed>` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) non-atomic read on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/release_seq_race_same_thread.rs:LL:CC | LL | *c.0 - | ^^^^ Data race detected between (1) non-atomic write on thread `<unnamed>` and (2) non-atomic read on thread `<unnamed>` at ALLOC. (2) just happened here + | ^^^^ Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) non-atomic read on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/release_seq_race_same_thread.rs:LL:CC @@ -11,7 +11,7 @@ LL | *c.0 = 1; | ^^^^^^^^ = 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 (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/release_seq_race_same_thread.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/rmw_race.rs b/src/tools/miri/tests/fail/data_race/rmw_race.rs index 973ebdf48d3..982e9c1c410 100644 --- a/src/tools/miri/tests/fail/data_race/rmw_race.rs +++ b/src/tools/miri/tests/fail/data_race/rmw_race.rs @@ -40,7 +40,7 @@ pub fn main() { let j3 = spawn(move || { let c = c; // capture `c`, not just its field. if SYNC.load(Ordering::Acquire) == 3 { - *c.0 //~ ERROR: Data race detected between (1) non-atomic write on thread `<unnamed>` and (2) non-atomic read on thread `<unnamed>` + *c.0 //~ ERROR: Data race detected between (1) non-atomic write on thread `unnamed-1` and (2) non-atomic read on thread `unnamed-3` } else { 0 } diff --git a/src/tools/miri/tests/fail/data_race/rmw_race.stderr b/src/tools/miri/tests/fail/data_race/rmw_race.stderr index eeaada1b0f3..2aa27cc8c7f 100644 --- a/src/tools/miri/tests/fail/data_race/rmw_race.stderr +++ b/src/tools/miri/tests/fail/data_race/rmw_race.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `<unnamed>` and (2) non-atomic read on thread `<unnamed>` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) non-atomic read on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/rmw_race.rs:LL:CC | LL | *c.0 - | ^^^^ Data race detected between (1) non-atomic write on thread `<unnamed>` and (2) non-atomic read on thread `<unnamed>` at ALLOC. (2) just happened here + | ^^^^ Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) non-atomic read on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/rmw_race.rs:LL:CC @@ -11,7 +11,7 @@ LL | *c.0 = 1; | ^^^^^^^^ = 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 (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/rmw_race.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/stack_pop_race.rs b/src/tools/miri/tests/fail/data_race/stack_pop_race.rs index 047d3757f14..68d82bc30a5 100644 --- a/src/tools/miri/tests/fail/data_race/stack_pop_race.rs +++ b/src/tools/miri/tests/fail/data_race/stack_pop_race.rs @@ -21,4 +21,4 @@ fn race(local: i32) { // Deallocating the local (when `main` returns) // races with the read in the other thread. // Make sure the error points at this function's end, not just the call site. -} //~ERROR: Data race detected between (1) non-atomic read on thread `<unnamed>` and (2) deallocation on thread `main` +} //~ERROR: Data race detected between (1) non-atomic read on thread `unnamed-1` and (2) deallocation on thread `main` diff --git a/src/tools/miri/tests/fail/data_race/stack_pop_race.stderr b/src/tools/miri/tests/fail/data_race/stack_pop_race.stderr index 2cef51ec94b..683acc1abd2 100644 --- a/src/tools/miri/tests/fail/data_race/stack_pop_race.stderr +++ b/src/tools/miri/tests/fail/data_race/stack_pop_race.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) non-atomic read on thread `<unnamed>` and (2) deallocation on thread `main` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) non-atomic read on thread `unnamed-ID` and (2) deallocation on thread `main` at ALLOC. (2) just happened here --> $DIR/stack_pop_race.rs:LL:CC | LL | } - | ^ Data race detected between (1) non-atomic read on thread `<unnamed>` and (2) deallocation on thread `main` at ALLOC. (2) just happened here + | ^ Data race detected between (1) non-atomic read on thread `unnamed-ID` and (2) deallocation on thread `main` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/stack_pop_race.rs:LL:CC diff --git a/src/tools/miri/tests/fail/data_race/write_write_race.rs b/src/tools/miri/tests/fail/data_race/write_write_race.rs index 05ec8d63c7a..e8924702af8 100644 --- a/src/tools/miri/tests/fail/data_race/write_write_race.rs +++ b/src/tools/miri/tests/fail/data_race/write_write_race.rs @@ -21,7 +21,7 @@ pub fn main() { let j2 = spawn(move || { let c = c; // avoid field capturing - *c.0 = 64; //~ ERROR: Data race detected between (1) non-atomic write on thread `<unnamed>` and (2) non-atomic write on thread `<unnamed>` + *c.0 = 64; //~ ERROR: Data race detected between (1) non-atomic write on thread `unnamed-1` and (2) non-atomic write on thread `unnamed-2` }); j1.join().unwrap(); diff --git a/src/tools/miri/tests/fail/data_race/write_write_race.stderr b/src/tools/miri/tests/fail/data_race/write_write_race.stderr index ca32984be2f..37b758ab2a5 100644 --- a/src/tools/miri/tests/fail/data_race/write_write_race.stderr +++ b/src/tools/miri/tests/fail/data_race/write_write_race.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `<unnamed>` and (2) non-atomic write on thread `<unnamed>` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) non-atomic write on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/write_write_race.rs:LL:CC | LL | *c.0 = 64; - | ^^^^^^^^^ Data race detected between (1) non-atomic write on thread `<unnamed>` and (2) non-atomic write on thread `<unnamed>` at ALLOC. (2) just happened here + | ^^^^^^^^^ Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) non-atomic write on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/write_write_race.rs:LL:CC @@ -11,7 +11,7 @@ LL | *c.0 = 32; | ^^^^^^^^^ = 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 (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/write_write_race.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/write_write_race_stack.rs b/src/tools/miri/tests/fail/data_race/write_write_race_stack.rs index d3ef552eab8..984ae2ee83d 100644 --- a/src/tools/miri/tests/fail/data_race/write_write_race_stack.rs +++ b/src/tools/miri/tests/fail/data_race/write_write_race_stack.rs @@ -40,7 +40,7 @@ pub fn main() { sleep(Duration::from_millis(200)); - stack_var = 1usize; //~ ERROR: Data race detected between (1) non-atomic write on thread `<unnamed>` and (2) non-atomic write on thread `<unnamed>` + stack_var = 1usize; //~ ERROR: Data race detected between (1) non-atomic write on thread `unnamed-2` and (2) non-atomic write on thread `unnamed-1` // read to silence errors stack_var diff --git a/src/tools/miri/tests/fail/data_race/write_write_race_stack.stderr b/src/tools/miri/tests/fail/data_race/write_write_race_stack.stderr index 038e9079c54..2503a4f4ba8 100644 --- a/src/tools/miri/tests/fail/data_race/write_write_race_stack.stderr +++ b/src/tools/miri/tests/fail/data_race/write_write_race_stack.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `<unnamed>` and (2) non-atomic write on thread `<unnamed>` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) non-atomic write on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/write_write_race_stack.rs:LL:CC | LL | stack_var = 1usize; - | ^^^^^^^^^^^^^^^^^^ Data race detected between (1) non-atomic write on thread `<unnamed>` and (2) non-atomic write on thread `<unnamed>` at ALLOC. (2) just happened here + | ^^^^^^^^^^^^^^^^^^ Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) non-atomic write on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/write_write_race_stack.rs:LL:CC @@ -11,7 +11,7 @@ LL | *pointer.load(Ordering::Acquire) = 3; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = 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 (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/write_write_race_stack.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/function_calls/arg_inplace_mutate.tree.stderr b/src/tools/miri/tests/fail/function_calls/arg_inplace_mutate.tree.stderr index 4fe9b7b4728..354631bdcb5 100644 --- a/src/tools/miri/tests/fail/function_calls/arg_inplace_mutate.tree.stderr +++ b/src/tools/miri/tests/fail/function_calls/arg_inplace_mutate.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: write access through <TAG> (root of the allocation) is forbidden +error: Undefined Behavior: write access through <TAG> (root of the allocation) at ALLOC[0x0] is forbidden --> $DIR/arg_inplace_mutate.rs:LL:CC | LL | unsafe { ptr.write(S(0)) }; - | ^^^^^^^^^^^^^^^ write access through <TAG> (root of the allocation) is forbidden + | ^^^^^^^^^^^^^^^ write access through <TAG> (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 accessed tag <TAG> (root of the allocation) is foreign to the protected tag <TAG> (i.e., it is not a child) diff --git a/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_during.tree.stderr b/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_during.tree.stderr index 67906f24bbd..64888cce613 100644 --- a/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_during.tree.stderr +++ b/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_during.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: read access through <TAG> (root of the allocation) is forbidden +error: Undefined Behavior: read access through <TAG> (root of the allocation) at ALLOC[0x0] is forbidden --> $DIR/arg_inplace_observe_during.rs:LL:CC | LL | unsafe { ptr.read() }; - | ^^^^^^^^^^ read access through <TAG> (root of the allocation) is forbidden + | ^^^^^^^^^^ read access through <TAG> (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 accessed tag <TAG> (root of the allocation) is foreign to the protected tag <TAG> (i.e., it is not a child) diff --git a/src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind2.both.stderr b/src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind2.both.stderr index bccd532faca..9774e1e1a79 100644 --- a/src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind2.both.stderr +++ b/src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind2.both.stderr @@ -11,6 +11,7 @@ error: abnormal termination: the program aborted execution LL | ABORT(); | ^ the program aborted execution | + = note: BACKTRACE: = note: inside `std::sys::pal::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC = note: inside `std::panicking::rust_panic_with_hook` at RUSTLIB/std/src/panicking.rs:LL:CC = note: inside closure at RUSTLIB/std/src/panicking.rs:LL:CC diff --git a/src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind2.definition.stderr b/src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind2.definition.stderr index bccd532faca..9774e1e1a79 100644 --- a/src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind2.definition.stderr +++ b/src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind2.definition.stderr @@ -11,6 +11,7 @@ error: abnormal termination: the program aborted execution LL | ABORT(); | ^ the program aborted execution | + = note: BACKTRACE: = note: inside `std::sys::pal::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC = note: inside `std::panicking::rust_panic_with_hook` at RUSTLIB/std/src/panicking.rs:LL:CC = note: inside closure at RUSTLIB/std/src/panicking.rs:LL:CC diff --git a/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing.tree.stderr b/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing.tree.stderr index 6b3f5fbedee..bbedba5a7dd 100644 --- a/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing.tree.stderr +++ b/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: read access through <TAG> (root of the allocation) is forbidden +error: Undefined Behavior: read access through <TAG> (root of the allocation) at ALLOC[0x0] is forbidden --> $DIR/return_pointer_aliasing.rs:LL:CC | LL | unsafe { ptr.read() }; - | ^^^^^^^^^^ read access through <TAG> (root of the allocation) is forbidden + | ^^^^^^^^^^ read access through <TAG> (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 accessed tag <TAG> (root of the allocation) is foreign to the protected tag <TAG> (i.e., it is not a child) diff --git a/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing2.tree.stderr b/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing2.tree.stderr index 37c98eabbec..146bcfc7c47 100644 --- a/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing2.tree.stderr +++ b/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing2.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: write access through <TAG> (root of the allocation) is forbidden +error: Undefined Behavior: write access through <TAG> (root of the allocation) at ALLOC[0x0] is forbidden --> $DIR/return_pointer_aliasing2.rs:LL:CC | LL | unsafe { ptr.write(0) }; - | ^^^^^^^^^^^^ write access through <TAG> (root of the allocation) is forbidden + | ^^^^^^^^^^^^ write access through <TAG> (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 accessed tag <TAG> (root of the allocation) is foreign to the protected tag <TAG> (i.e., it is not a child) diff --git a/src/tools/miri/tests/fail/intrinsics/uninit_uninhabited_type.stderr b/src/tools/miri/tests/fail/intrinsics/uninit_uninhabited_type.stderr index 5d4ea011581..4723eddaa67 100644 --- a/src/tools/miri/tests/fail/intrinsics/uninit_uninhabited_type.stderr +++ b/src/tools/miri/tests/fail/intrinsics/uninit_uninhabited_type.stderr @@ -8,6 +8,7 @@ error: abnormal termination: the program aborted execution LL | ABORT(); | ^ the program aborted execution | + = note: BACKTRACE: = note: inside `std::sys::pal::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC = note: inside `std::panicking::rust_panic_with_hook` at RUSTLIB/std/src/panicking.rs:LL:CC = note: inside closure at RUSTLIB/std/src/panicking.rs:LL:CC diff --git a/src/tools/miri/tests/fail/intrinsics/zero_fn_ptr.stderr b/src/tools/miri/tests/fail/intrinsics/zero_fn_ptr.stderr index 935e79dfd8d..9c6dd10079e 100644 --- a/src/tools/miri/tests/fail/intrinsics/zero_fn_ptr.stderr +++ b/src/tools/miri/tests/fail/intrinsics/zero_fn_ptr.stderr @@ -8,6 +8,7 @@ error: abnormal termination: the program aborted execution LL | ABORT(); | ^ the program aborted execution | + = note: BACKTRACE: = note: inside `std::sys::pal::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC = note: inside `std::panicking::rust_panic_with_hook` at RUSTLIB/std/src/panicking.rs:LL:CC = note: inside closure at RUSTLIB/std/src/panicking.rs:LL:CC diff --git a/src/tools/miri/tests/fail/layout_cycle.stderr b/src/tools/miri/tests/fail/layout_cycle.stderr index 38907a1c50c..cc343d6431f 100644 --- a/src/tools/miri/tests/fail/layout_cycle.stderr +++ b/src/tools/miri/tests/fail/layout_cycle.stderr @@ -10,6 +10,7 @@ error: post-monomorphization error: a cycle occurred during layout computation LL | intrinsics::size_of::<T>() | ^^^^^^^^^^^^^^^^^^^^^^^^^^ a cycle occurred during layout computation | + = note: BACKTRACE: = note: inside `std::mem::size_of::<S<S<()>>>` at RUSTLIB/core/src/mem/mod.rs:LL:CC note: inside `foo::<S<()>>` --> $DIR/layout_cycle.rs:LL:CC diff --git a/src/tools/miri/tests/fail/memleak.stderr b/src/tools/miri/tests/fail/memleak.stderr index 9c885c37f3a..8ba78ef6644 100644 --- a/src/tools/miri/tests/fail/memleak.stderr +++ b/src/tools/miri/tests/fail/memleak.stderr @@ -4,6 +4,7 @@ error: memory leaked: ALLOC (Rust heap, size: 4, align: 4), allocated here: 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 `<std::alloc::Global as std::alloc::Allocator>::allocate` at RUSTLIB/alloc/src/alloc.rs:LL:CC diff --git a/src/tools/miri/tests/fail/memleak_rc.32bit.stderr b/src/tools/miri/tests/fail/memleak_rc.32bit.stderr index 3f8b7a3e819..781e1458db9 100644 --- a/src/tools/miri/tests/fail/memleak_rc.32bit.stderr +++ b/src/tools/miri/tests/fail/memleak_rc.32bit.stderr @@ -4,6 +4,7 @@ error: memory leaked: ALLOC (Rust heap, size: 16, align: 4), allocated here: 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 `<std::alloc::Global as std::alloc::Allocator>::allocate` at RUSTLIB/alloc/src/alloc.rs:LL:CC diff --git a/src/tools/miri/tests/fail/memleak_rc.64bit.stderr b/src/tools/miri/tests/fail/memleak_rc.64bit.stderr index b68991602ea..1c85a0f9d9f 100644 --- a/src/tools/miri/tests/fail/memleak_rc.64bit.stderr +++ b/src/tools/miri/tests/fail/memleak_rc.64bit.stderr @@ -4,6 +4,7 @@ error: memory leaked: ALLOC (Rust heap, size: 32, align: 8), allocated here: 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 `<std::alloc::Global as std::alloc::Allocator>::allocate` at RUSTLIB/alloc/src/alloc.rs:LL:CC diff --git a/src/tools/miri/tests/fail/panic/double_panic.stderr b/src/tools/miri/tests/fail/panic/double_panic.stderr index 2eb9354a4d0..e3cacbd27ba 100644 --- a/src/tools/miri/tests/fail/panic/double_panic.stderr +++ b/src/tools/miri/tests/fail/panic/double_panic.stderr @@ -13,6 +13,7 @@ error: abnormal termination: the program aborted execution LL | ABORT(); | ^ the program aborted execution | + = note: BACKTRACE: = note: inside `std::sys::pal::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC = note: inside `std::panicking::rust_panic_with_hook` at RUSTLIB/std/src/panicking.rs:LL:CC = note: inside closure at RUSTLIB/std/src/panicking.rs:LL:CC diff --git a/src/tools/miri/tests/fail/panic/no_std.stderr b/src/tools/miri/tests/fail/panic/no_std.stderr index 8b48f752967..40f6cf1fc0b 100644 --- a/src/tools/miri/tests/fail/panic/no_std.stderr +++ b/src/tools/miri/tests/fail/panic/no_std.stderr @@ -6,6 +6,7 @@ error: abnormal termination: the program aborted execution LL | core::intrinsics::abort(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ the program aborted execution | + = note: BACKTRACE: = note: inside `panic_handler` at $DIR/no_std.rs:LL:CC note: inside `start` --> $DIR/no_std.rs:LL:CC diff --git a/src/tools/miri/tests/fail/panic/panic_abort1.stderr b/src/tools/miri/tests/fail/panic/panic_abort1.stderr index 690f5bbec13..60455693619 100644 --- a/src/tools/miri/tests/fail/panic/panic_abort1.stderr +++ b/src/tools/miri/tests/fail/panic/panic_abort1.stderr @@ -7,6 +7,7 @@ error: abnormal termination: the program aborted execution LL | ABORT(); | ^ the program aborted execution | + = note: BACKTRACE: = note: inside `panic_abort::__rust_start_panic::abort` at RUSTLIB/panic_abort/src/lib.rs:LL:CC = note: inside `panic_abort::__rust_start_panic` at RUSTLIB/panic_abort/src/lib.rs:LL:CC = note: inside `std::panicking::rust_panic` at RUSTLIB/std/src/panicking.rs:LL:CC diff --git a/src/tools/miri/tests/fail/panic/panic_abort2.stderr b/src/tools/miri/tests/fail/panic/panic_abort2.stderr index e937fa02b0d..7bb27e4baa0 100644 --- a/src/tools/miri/tests/fail/panic/panic_abort2.stderr +++ b/src/tools/miri/tests/fail/panic/panic_abort2.stderr @@ -7,6 +7,7 @@ error: abnormal termination: the program aborted execution LL | ABORT(); | ^ the program aborted execution | + = note: BACKTRACE: = note: inside `panic_abort::__rust_start_panic::abort` at RUSTLIB/panic_abort/src/lib.rs:LL:CC = note: inside `panic_abort::__rust_start_panic` at RUSTLIB/panic_abort/src/lib.rs:LL:CC = note: inside `std::panicking::rust_panic` at RUSTLIB/std/src/panicking.rs:LL:CC diff --git a/src/tools/miri/tests/fail/panic/panic_abort3.stderr b/src/tools/miri/tests/fail/panic/panic_abort3.stderr index 0513ae7e765..b46e8c20795 100644 --- a/src/tools/miri/tests/fail/panic/panic_abort3.stderr +++ b/src/tools/miri/tests/fail/panic/panic_abort3.stderr @@ -7,6 +7,7 @@ error: abnormal termination: the program aborted execution LL | ABORT(); | ^ the program aborted execution | + = note: BACKTRACE: = note: inside `panic_abort::__rust_start_panic::abort` at RUSTLIB/panic_abort/src/lib.rs:LL:CC = note: inside `panic_abort::__rust_start_panic` at RUSTLIB/panic_abort/src/lib.rs:LL:CC = note: inside `std::panicking::rust_panic` at RUSTLIB/std/src/panicking.rs:LL:CC diff --git a/src/tools/miri/tests/fail/panic/panic_abort4.stderr b/src/tools/miri/tests/fail/panic/panic_abort4.stderr index 314e0c30792..b15f720e43f 100644 --- a/src/tools/miri/tests/fail/panic/panic_abort4.stderr +++ b/src/tools/miri/tests/fail/panic/panic_abort4.stderr @@ -7,6 +7,7 @@ error: abnormal termination: the program aborted execution LL | ABORT(); | ^ the program aborted execution | + = note: BACKTRACE: = note: inside `panic_abort::__rust_start_panic::abort` at RUSTLIB/panic_abort/src/lib.rs:LL:CC = note: inside `panic_abort::__rust_start_panic` at RUSTLIB/panic_abort/src/lib.rs:LL:CC = note: inside `std::panicking::rust_panic` at RUSTLIB/std/src/panicking.rs:LL:CC diff --git a/src/tools/miri/tests/fail/rustc-error2.rs b/src/tools/miri/tests/fail/rustc-error2.rs new file mode 100644 index 00000000000..fd2c5393385 --- /dev/null +++ b/src/tools/miri/tests/fail/rustc-error2.rs @@ -0,0 +1,16 @@ +// Regression test for https://github.com/rust-lang/rust/issues/121508. +struct Struct<T>(T); + +impl<T> std::ops::Deref for Struct<T> { + type Target = dyn Fn(T); + fn deref(&self) -> &assert_mem_uninitialized_valid::Target { + //~^ERROR: undeclared crate or module + unimplemented!() + } +} + +fn main() { + let f = Struct(Default::default()); + f(0); + f(0); +} diff --git a/src/tools/miri/tests/fail/rustc-error2.stderr b/src/tools/miri/tests/fail/rustc-error2.stderr new file mode 100644 index 00000000000..de2861a019c --- /dev/null +++ b/src/tools/miri/tests/fail/rustc-error2.stderr @@ -0,0 +1,9 @@ +error[E0433]: failed to resolve: use of undeclared crate or module `assert_mem_uninitialized_valid` + --> $DIR/rustc-error2.rs:LL:CC + | +LL | fn deref(&self) -> &assert_mem_uninitialized_valid::Target { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use of undeclared crate or module `assert_mem_uninitialized_valid` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0433`. diff --git a/src/tools/miri/tests/fail/stacked_borrows/retag_data_race_protected_read.rs b/src/tools/miri/tests/fail/stacked_borrows/retag_data_race_protected_read.rs index 71f1f132bc7..5db89c89b77 100644 --- a/src/tools/miri/tests/fail/stacked_borrows/retag_data_race_protected_read.rs +++ b/src/tools/miri/tests/fail/stacked_borrows/retag_data_race_protected_read.rs @@ -13,7 +13,7 @@ fn main() { let ptr = ptr; // We do a protected mutable retag (but no write!) in this thread. fn retag(_x: &mut i32) {} - retag(unsafe { &mut *ptr.0 }); //~ERROR: Data race detected between (1) non-atomic read on thread `main` and (2) non-atomic write on thread `<unnamed>` + retag(unsafe { &mut *ptr.0 }); //~ERROR: Data race detected between (1) non-atomic read on thread `main` and (2) non-atomic write on thread `unnamed-1` }); // We do a read in the main thread. diff --git a/src/tools/miri/tests/fail/stacked_borrows/retag_data_race_protected_read.stderr b/src/tools/miri/tests/fail/stacked_borrows/retag_data_race_protected_read.stderr index 905776155eb..2ce757013d5 100644 --- a/src/tools/miri/tests/fail/stacked_borrows/retag_data_race_protected_read.stderr +++ b/src/tools/miri/tests/fail/stacked_borrows/retag_data_race_protected_read.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) non-atomic read on thread `main` and (2) non-atomic write on thread `<unnamed>` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) non-atomic read on thread `main` and (2) non-atomic write on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/retag_data_race_protected_read.rs:LL:CC | LL | retag(unsafe { &mut *ptr.0 }); - | ^^^^^^^^^^^ Data race detected between (1) non-atomic read on thread `main` and (2) non-atomic write on thread `<unnamed>` at ALLOC. (2) just happened here + | ^^^^^^^^^^^ Data race detected between (1) non-atomic read on thread `main` and (2) non-atomic write on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/retag_data_race_protected_read.rs:LL:CC @@ -11,7 +11,7 @@ LL | unsafe { ptr.0.read() }; | ^^^^^^^^^^^^ = 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 (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/retag_data_race_protected_read.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/stacked_borrows/retag_data_race_read.rs b/src/tools/miri/tests/fail/stacked_borrows/retag_data_race_read.rs index 46694cd49e3..01a2e9ac474 100644 --- a/src/tools/miri/tests/fail/stacked_borrows/retag_data_race_read.rs +++ b/src/tools/miri/tests/fail/stacked_borrows/retag_data_race_read.rs @@ -15,7 +15,7 @@ fn thread_1(p: SendPtr) { fn thread_2(p: SendPtr) { let p = p.0; unsafe { - *p = 5; //~ ERROR: Data race detected between (1) non-atomic read on thread `<unnamed>` and (2) non-atomic write on thread `<unnamed>` + *p = 5; //~ ERROR: Data race detected between (1) non-atomic read on thread `unnamed-1` and (2) non-atomic write on thread `unnamed-2` } } diff --git a/src/tools/miri/tests/fail/stacked_borrows/retag_data_race_read.stack.stderr b/src/tools/miri/tests/fail/stacked_borrows/retag_data_race_read.stack.stderr index c6828d62d5a..1d7ea18982d 100644 --- a/src/tools/miri/tests/fail/stacked_borrows/retag_data_race_read.stack.stderr +++ b/src/tools/miri/tests/fail/stacked_borrows/retag_data_race_read.stack.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) Read on thread `<unnamed>` and (2) Write on thread `<unnamed>` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) Read on thread `unnamed-ID` and (2) Write on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/retag_data_race_read.rs:LL:CC | LL | *p = 5; - | ^^^^^^ Data race detected between (1) Read on thread `<unnamed>` and (2) Write on thread `<unnamed>` at ALLOC. (2) just happened here + | ^^^^^^ Data race detected between (1) Read on thread `unnamed-ID` and (2) Write on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/retag_data_race_read.rs:LL:CC diff --git a/src/tools/miri/tests/fail/stacked_borrows/retag_data_race_read.stderr b/src/tools/miri/tests/fail/stacked_borrows/retag_data_race_read.stderr index 129b9ffb26e..d3c8d14e2a1 100644 --- a/src/tools/miri/tests/fail/stacked_borrows/retag_data_race_read.stderr +++ b/src/tools/miri/tests/fail/stacked_borrows/retag_data_race_read.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) non-atomic read on thread `<unnamed>` and (2) non-atomic write on thread `<unnamed>` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) non-atomic read on thread `unnamed-ID` and (2) non-atomic write on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/retag_data_race_read.rs:LL:CC | LL | *p = 5; - | ^^^^^^ Data race detected between (1) non-atomic read on thread `<unnamed>` and (2) non-atomic write on thread `<unnamed>` at ALLOC. (2) just happened here + | ^^^^^^ Data race detected between (1) non-atomic read on thread `unnamed-ID` and (2) non-atomic write on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/retag_data_race_read.rs:LL:CC @@ -11,7 +11,7 @@ LL | let _r = &*p; | ^^^ = 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 (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside `thread_2` at $DIR/retag_data_race_read.rs:LL:CC note: inside closure --> $DIR/retag_data_race_read.rs:LL:CC diff --git a/src/tools/miri/tests/fail/terminate-terminator.stderr b/src/tools/miri/tests/fail/terminate-terminator.stderr index 44c04b3ae93..8dbc802bf59 100644 --- a/src/tools/miri/tests/fail/terminate-terminator.stderr +++ b/src/tools/miri/tests/fail/terminate-terminator.stderr @@ -13,6 +13,7 @@ error: abnormal termination: the program aborted execution LL | ABORT(); | ^ the program aborted execution | + = note: BACKTRACE: = note: inside `std::sys::pal::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC = note: inside `std::panicking::rust_panic_with_hook` at RUSTLIB/std/src/panicking.rs:LL:CC = note: inside closure at RUSTLIB/std/src/panicking.rs:LL:CC diff --git a/src/tools/miri/tests/fail/tls_macro_leak.stderr b/src/tools/miri/tests/fail/tls_macro_leak.stderr index be0e846b633..40b21f8625a 100644 --- a/src/tools/miri/tests/fail/tls_macro_leak.stderr +++ b/src/tools/miri/tests/fail/tls_macro_leak.stderr @@ -4,6 +4,7 @@ error: memory leaked: ALLOC (Rust heap, size: 4, align: 4), allocated here: 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 `<std::alloc::Global as std::alloc::Allocator>::allocate` at RUSTLIB/alloc/src/alloc.rs:LL:CC diff --git a/src/tools/miri/tests/fail/tls_static_leak.stderr b/src/tools/miri/tests/fail/tls_static_leak.stderr index 533651f2efd..580b52c1512 100644 --- a/src/tools/miri/tests/fail/tls_static_leak.stderr +++ b/src/tools/miri/tests/fail/tls_static_leak.stderr @@ -4,6 +4,7 @@ error: memory leaked: ALLOC (Rust heap, size: 4, align: 4), allocated here: 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 `<std::alloc::Global as std::alloc::Allocator>::allocate` at RUSTLIB/alloc/src/alloc.rs:LL:CC diff --git a/src/tools/miri/tests/fail/tree_borrows/alternate-read-write.stderr b/src/tools/miri/tests/fail/tree_borrows/alternate-read-write.stderr index 58d22c5641f..98371cbe7a2 100644 --- a/src/tools/miri/tests/fail/tree_borrows/alternate-read-write.stderr +++ b/src/tools/miri/tests/fail/tree_borrows/alternate-read-write.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: write access through <TAG> is forbidden +error: Undefined Behavior: write access through <TAG> at ALLOC[0x0] is forbidden --> $DIR/alternate-read-write.rs:LL:CC | LL | *y += 1; // Failure - | ^^^^^^^ write access through <TAG> is forbidden + | ^^^^^^^ write access through <TAG> 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 <TAG> is a child of the conflicting tag <TAG> diff --git a/src/tools/miri/tests/fail/tree_borrows/children-can-alias.uniq.stderr b/src/tools/miri/tests/fail/tree_borrows/children-can-alias.uniq.stderr index be85e1a1cee..cc1fea30f53 100644 --- a/src/tools/miri/tests/fail/tree_borrows/children-can-alias.uniq.stderr +++ b/src/tools/miri/tests/fail/tree_borrows/children-can-alias.uniq.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: write access through <TAG> is forbidden +error: Undefined Behavior: write access through <TAG> at ALLOC[0x0] is forbidden --> $DIR/children-can-alias.rs:LL:CC | LL | child2.write(2); - | ^^^^^^^^^^^^^^^ write access through <TAG> is forbidden + | ^^^^^^^^^^^^^^^ write access through <TAG> 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 <TAG> is a child of the conflicting tag <TAG> diff --git a/src/tools/miri/tests/fail/tree_borrows/error-range.stderr b/src/tools/miri/tests/fail/tree_borrows/error-range.stderr index a03869f33bb..37f0b9b62b0 100644 --- a/src/tools/miri/tests/fail/tree_borrows/error-range.stderr +++ b/src/tools/miri/tests/fail/tree_borrows/error-range.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: read access through <TAG> is forbidden +error: Undefined Behavior: read access through <TAG> at ALLOC[0x5] is forbidden --> $DIR/error-range.rs:LL:CC | LL | rmut[5] += 1; - | ^^^^^^^^^^^^ read access through <TAG> is forbidden + | ^^^^^^^^^^^^ read access through <TAG> at ALLOC[0x5] 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 <TAG> is a child of the conflicting tag <TAG> diff --git a/src/tools/miri/tests/fail/tree_borrows/fnentry_invalidation.stderr b/src/tools/miri/tests/fail/tree_borrows/fnentry_invalidation.stderr index 7df6cd9d923..dd5d27107fe 100644 --- a/src/tools/miri/tests/fail/tree_borrows/fnentry_invalidation.stderr +++ b/src/tools/miri/tests/fail/tree_borrows/fnentry_invalidation.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: write access through <TAG> is forbidden +error: Undefined Behavior: write access through <TAG> at ALLOC[0x0] is forbidden --> $DIR/fnentry_invalidation.rs:LL:CC | LL | *z = 2; - | ^^^^^^ write access through <TAG> is forbidden + | ^^^^^^ write access through <TAG> 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 <TAG> has state Frozen which forbids this child write access diff --git a/src/tools/miri/tests/fail/tree_borrows/outside-range.stderr b/src/tools/miri/tests/fail/tree_borrows/outside-range.stderr index 5644862d23e..715228028bc 100644 --- a/src/tools/miri/tests/fail/tree_borrows/outside-range.stderr +++ b/src/tools/miri/tests/fail/tree_borrows/outside-range.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: write access through <TAG> is forbidden +error: Undefined Behavior: write access through <TAG> at ALLOC[0x3] is forbidden --> $DIR/outside-range.rs:LL:CC | LL | *y.add(3) = 42; - | ^^^^^^^^^^^^^^ write access through <TAG> is forbidden + | ^^^^^^^^^^^^^^ write access through <TAG> at ALLOC[0x3] 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 <TAG> is foreign to the protected tag <TAG> (i.e., it is not a child) diff --git a/src/tools/miri/tests/fail/tree_borrows/parent_read_freezes_raw_mut.stderr b/src/tools/miri/tests/fail/tree_borrows/parent_read_freezes_raw_mut.stderr index a9d5b0a68c1..87844ff4011 100644 --- a/src/tools/miri/tests/fail/tree_borrows/parent_read_freezes_raw_mut.stderr +++ b/src/tools/miri/tests/fail/tree_borrows/parent_read_freezes_raw_mut.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: write access through <TAG> is forbidden +error: Undefined Behavior: write access through <TAG> at ALLOC[0x0] is forbidden --> $DIR/parent_read_freezes_raw_mut.rs:LL:CC | LL | *ptr = 0; - | ^^^^^^^^ write access through <TAG> is forbidden + | ^^^^^^^^ write access through <TAG> 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 <TAG> has state Frozen which forbids this child write access diff --git a/src/tools/miri/tests/fail/tree_borrows/pass_invalid_mut.stderr b/src/tools/miri/tests/fail/tree_borrows/pass_invalid_mut.stderr index 32cf1c18cde..84fbc91e686 100644 --- a/src/tools/miri/tests/fail/tree_borrows/pass_invalid_mut.stderr +++ b/src/tools/miri/tests/fail/tree_borrows/pass_invalid_mut.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: write access through <TAG> is forbidden +error: Undefined Behavior: write access through <TAG> at ALLOC[0x0] is forbidden --> $DIR/pass_invalid_mut.rs:LL:CC | LL | *nope = 31; - | ^^^^^^^^^^ write access through <TAG> is forbidden + | ^^^^^^^^^^ write access through <TAG> 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 <TAG> is a child of the conflicting tag <TAG> diff --git a/src/tools/miri/tests/fail/tree_borrows/reserved/cell-protected-write.stderr b/src/tools/miri/tests/fail/tree_borrows/reserved/cell-protected-write.stderr index ba6c30cf935..7d000ba55e6 100644 --- a/src/tools/miri/tests/fail/tree_borrows/reserved/cell-protected-write.stderr +++ b/src/tools/miri/tests/fail/tree_borrows/reserved/cell-protected-write.stderr @@ -8,11 +8,11 @@ Warning: this tree is indicative only. Some tags may have been hidden. | RsM | │ └────<TAG=callee:x> Strongly protected | RsM | └────<TAG=y, callee:y, caller:y> ────────────────────────────────────────────────── -error: Undefined Behavior: write access through <TAG> (y, callee:y, caller:y) is forbidden +error: Undefined Behavior: write access through <TAG> (y, callee:y, caller:y) at ALLOC[0x0] is forbidden --> $DIR/cell-protected-write.rs:LL:CC | LL | *y = 1; - | ^^^^^^ write access through <TAG> (y, callee:y, caller:y) is forbidden + | ^^^^^^ write access through <TAG> (y, callee:y, caller:y) 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 <TAG> (y, callee:y, caller:y) is foreign to the protected tag <TAG> (callee:x) (i.e., it is not a child) diff --git a/src/tools/miri/tests/fail/tree_borrows/reserved/int-protected-write.stderr b/src/tools/miri/tests/fail/tree_borrows/reserved/int-protected-write.stderr index 16081871d94..41559587bda 100644 --- a/src/tools/miri/tests/fail/tree_borrows/reserved/int-protected-write.stderr +++ b/src/tools/miri/tests/fail/tree_borrows/reserved/int-protected-write.stderr @@ -8,11 +8,11 @@ Warning: this tree is indicative only. Some tags may have been hidden. | Rs | │ └────<TAG=callee:x> Strongly protected | Rs | └────<TAG=y, callee:y, caller:y> ────────────────────────────────────────────────── -error: Undefined Behavior: write access through <TAG> (y, callee:y, caller:y) is forbidden +error: Undefined Behavior: write access through <TAG> (y, callee:y, caller:y) at ALLOC[0x0] is forbidden --> $DIR/int-protected-write.rs:LL:CC | LL | *y = 0; - | ^^^^^^ write access through <TAG> (y, callee:y, caller:y) is forbidden + | ^^^^^^ write access through <TAG> (y, callee:y, caller:y) 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 <TAG> (y, callee:y, caller:y) is foreign to the protected tag <TAG> (callee:x) (i.e., it is not a child) diff --git a/src/tools/miri/tests/fail/tree_borrows/return_invalid_mut.stderr b/src/tools/miri/tests/fail/tree_borrows/return_invalid_mut.stderr index dff2374ba9f..ca8c45d36f9 100644 --- a/src/tools/miri/tests/fail/tree_borrows/return_invalid_mut.stderr +++ b/src/tools/miri/tests/fail/tree_borrows/return_invalid_mut.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: write access through <TAG> is forbidden +error: Undefined Behavior: write access through <TAG> at ALLOC[0x4] is forbidden --> $DIR/return_invalid_mut.rs:LL:CC | LL | *ret = 3; - | ^^^^^^^^ write access through <TAG> is forbidden + | ^^^^^^^^ write access through <TAG> at ALLOC[0x4] 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 <TAG> is a child of the conflicting tag <TAG> diff --git a/src/tools/miri/tests/fail/tree_borrows/spurious_read.stderr b/src/tools/miri/tests/fail/tree_borrows/spurious_read.stderr index e48145567f5..f3934d4cbe5 100644 --- a/src/tools/miri/tests/fail/tree_borrows/spurious_read.stderr +++ b/src/tools/miri/tests/fail/tree_borrows/spurious_read.stderr @@ -11,11 +11,11 @@ Thread 2 executing: ret x Thread 2 executing: write y Thread 1 executing: write y Thread 1 executing: ret y -error: Undefined Behavior: write access through <TAG> is forbidden +error: Undefined Behavior: write access through <TAG> at ALLOC[0x0] is forbidden --> $DIR/spurious_read.rs:LL:CC | LL | *y = 2; - | ^^^^^^ write access through <TAG> is forbidden + | ^^^^^^ write access through <TAG> 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 <TAG> has state Reserved (conflicted) which forbids this child write access @@ -30,7 +30,7 @@ help: the accessed tag <TAG> later transitioned to Reserved (conflicted) due to LL | } | ^ = help: this transition corresponds to a temporary loss of write permissions until function exit - = note: BACKTRACE (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside `retagx_retagy_retx_writey_rety::{closure#1}::as_mut` at $DIR/spurious_read.rs:LL:CC note: inside closure --> $DIR/spurious_read.rs:LL:CC diff --git a/src/tools/miri/tests/fail/tree_borrows/strongly-protected.stderr b/src/tools/miri/tests/fail/tree_borrows/strongly-protected.stderr index 4793c287045..f0afcc7b3ff 100644 --- a/src/tools/miri/tests/fail/tree_borrows/strongly-protected.stderr +++ b/src/tools/miri/tests/fail/tree_borrows/strongly-protected.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: deallocation through <TAG> is forbidden +error: Undefined Behavior: deallocation through <TAG> at ALLOC[0x0] is forbidden --> RUSTLIB/alloc/src/alloc.rs:LL:CC | LL | unsafe { __rust_dealloc(ptr, layout.size(), layout.align()) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ deallocation through <TAG> is forbidden + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ deallocation through <TAG> 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 <TAG> also contains the strongly protected tag <TAG> diff --git a/src/tools/miri/tests/fail/tree_borrows/unique.default.stderr b/src/tools/miri/tests/fail/tree_borrows/unique.default.stderr index f058c61ec3b..bce8cb011f6 100644 --- a/src/tools/miri/tests/fail/tree_borrows/unique.default.stderr +++ b/src/tools/miri/tests/fail/tree_borrows/unique.default.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: write access through <TAG> is forbidden +error: Undefined Behavior: write access through <TAG> at ALLOC[0x0] is forbidden --> $DIR/unique.rs:LL:CC | LL | *uniq.as_ptr() = 3; - | ^^^^^^^^^^^^^^^^^^ write access through <TAG> is forbidden + | ^^^^^^^^^^^^^^^^^^ write access through <TAG> 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 <TAG> has state Frozen which forbids this child write access diff --git a/src/tools/miri/tests/fail/tree_borrows/unique.uniq.stderr b/src/tools/miri/tests/fail/tree_borrows/unique.uniq.stderr index ba53a87f84a..7323cd1c5ad 100644 --- a/src/tools/miri/tests/fail/tree_borrows/unique.uniq.stderr +++ b/src/tools/miri/tests/fail/tree_borrows/unique.uniq.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: write access through <TAG> is forbidden +error: Undefined Behavior: write access through <TAG> at ALLOC[0x0] is forbidden --> $DIR/unique.rs:LL:CC | LL | *uniq.as_ptr() = 2; - | ^^^^^^^^^^^^^^^^^^ write access through <TAG> is forbidden + | ^^^^^^^^^^^^^^^^^^ write access through <TAG> 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 <TAG> is a child of the conflicting tag <TAG> diff --git a/src/tools/miri/tests/fail/tree_borrows/write-during-2phase.stderr b/src/tools/miri/tests/fail/tree_borrows/write-during-2phase.stderr index 35087b11468..87589299cb1 100644 --- a/src/tools/miri/tests/fail/tree_borrows/write-during-2phase.stderr +++ b/src/tools/miri/tests/fail/tree_borrows/write-during-2phase.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: reborrow through <TAG> is forbidden +error: Undefined Behavior: reborrow through <TAG> at ALLOC[0x0] is forbidden --> $DIR/write-during-2phase.rs:LL:CC | LL | fn add(&mut self, n: u64) -> u64 { - | ^^^^^^^^^ reborrow through <TAG> is forbidden + | ^^^^^^^^^ reborrow through <TAG> 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 <TAG> has state Disabled which forbids this reborrow (acting as a child read access) diff --git a/src/tools/miri/tests/fail/type-too-large.stderr b/src/tools/miri/tests/fail/type-too-large.stderr index cdff049198d..b07bb84e348 100644 --- a/src/tools/miri/tests/fail/type-too-large.stderr +++ b/src/tools/miri/tests/fail/type-too-large.stderr @@ -4,6 +4,7 @@ error: post-monomorphization error: values of the type `[u8; 2305843011361177600 LL | _fat = [0; (1u64 << 61) as usize + (1u64 << 31) as usize]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ values of the type `[u8; 2305843011361177600]` are too big for the current architecture | + = note: BACKTRACE: = note: inside `main` at $DIR/type-too-large.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/unwind-action-terminate.stderr b/src/tools/miri/tests/fail/unwind-action-terminate.stderr index adb2967feaf..1323a397100 100644 --- a/src/tools/miri/tests/fail/unwind-action-terminate.stderr +++ b/src/tools/miri/tests/fail/unwind-action-terminate.stderr @@ -11,6 +11,7 @@ error: abnormal termination: the program aborted execution LL | ABORT(); | ^ the program aborted execution | + = note: BACKTRACE: = note: inside `std::sys::pal::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC = note: inside `std::panicking::rust_panic_with_hook` at RUSTLIB/std/src/panicking.rs:LL:CC = note: inside closure at RUSTLIB/std/src/panicking.rs:LL:CC diff --git a/src/tools/miri/tests/fail/weak_memory/racing_mixed_size.rs b/src/tools/miri/tests/fail/weak_memory/racing_mixed_size.rs index e36d947565a..dfe9397a4c4 100644 --- a/src/tools/miri/tests/fail/weak_memory/racing_mixed_size.rs +++ b/src/tools/miri/tests/fail/weak_memory/racing_mixed_size.rs @@ -31,7 +31,7 @@ pub fn main() { let x_split = split_u32_ptr(x_ptr); unsafe { let hi = ptr::addr_of!((*x_split)[0]); - std::intrinsics::atomic_load_relaxed(hi); //~ ERROR: (1) 4-byte atomic store on thread `<unnamed>` and (2) 2-byte atomic load + std::intrinsics::atomic_load_relaxed(hi); //~ ERROR: (1) 4-byte atomic store on thread `unnamed-1` and (2) 2-byte atomic load } }); diff --git a/src/tools/miri/tests/fail/weak_memory/racing_mixed_size.stderr b/src/tools/miri/tests/fail/weak_memory/racing_mixed_size.stderr index 9f92853d0ec..44430cd25db 100644 --- a/src/tools/miri/tests/fail/weak_memory/racing_mixed_size.stderr +++ b/src/tools/miri/tests/fail/weak_memory/racing_mixed_size.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Race condition detected between (1) 4-byte atomic store on thread `<unnamed>` and (2) 2-byte atomic load on thread `<unnamed>` at ALLOC. (2) just happened here +error: Undefined Behavior: Race condition detected between (1) 4-byte atomic store on thread `unnamed-ID` and (2) 2-byte atomic load on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/racing_mixed_size.rs:LL:CC | LL | std::intrinsics::atomic_load_relaxed(hi); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Race condition detected between (1) 4-byte atomic store on thread `<unnamed>` and (2) 2-byte atomic load on thread `<unnamed>` at ALLOC. (2) just happened here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Race condition detected between (1) 4-byte atomic store on thread `unnamed-ID` and (2) 2-byte atomic load on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/racing_mixed_size.rs:LL:CC @@ -13,7 +13,7 @@ LL | x.store(1, Relaxed); = help: see https://doc.rust-lang.org/nightly/std/sync/atomic/index.html#memory-model-for-atomic-accesses for more information about the Rust memory model = 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 (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/racing_mixed_size.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/weak_memory/racing_mixed_size_read.rs b/src/tools/miri/tests/fail/weak_memory/racing_mixed_size_read.rs index 34917245ea5..b946a75c3ab 100644 --- a/src/tools/miri/tests/fail/weak_memory/racing_mixed_size_read.rs +++ b/src/tools/miri/tests/fail/weak_memory/racing_mixed_size_read.rs @@ -29,7 +29,7 @@ pub fn main() { let x_split = split_u32_ptr(x_ptr); unsafe { let hi = x_split as *const u16 as *const AtomicU16; - (*hi).load(Relaxed); //~ ERROR: (1) 4-byte atomic load on thread `<unnamed>` and (2) 2-byte atomic load + (*hi).load(Relaxed); //~ ERROR: (1) 4-byte atomic load on thread `unnamed-1` and (2) 2-byte atomic load } }); diff --git a/src/tools/miri/tests/fail/weak_memory/racing_mixed_size_read.stderr b/src/tools/miri/tests/fail/weak_memory/racing_mixed_size_read.stderr index a28dec2833f..94b4123d345 100644 --- a/src/tools/miri/tests/fail/weak_memory/racing_mixed_size_read.stderr +++ b/src/tools/miri/tests/fail/weak_memory/racing_mixed_size_read.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Race condition detected between (1) 4-byte atomic load on thread `<unnamed>` and (2) 2-byte atomic load on thread `<unnamed>` at ALLOC. (2) just happened here +error: Undefined Behavior: Race condition detected between (1) 4-byte atomic load on thread `unnamed-ID` and (2) 2-byte atomic load on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/racing_mixed_size_read.rs:LL:CC | LL | (*hi).load(Relaxed); - | ^^^^^^^^^^^^^^^^^^^ Race condition detected between (1) 4-byte atomic load on thread `<unnamed>` and (2) 2-byte atomic load on thread `<unnamed>` at ALLOC. (2) just happened here + | ^^^^^^^^^^^^^^^^^^^ Race condition detected between (1) 4-byte atomic load on thread `unnamed-ID` and (2) 2-byte atomic load on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/racing_mixed_size_read.rs:LL:CC @@ -13,7 +13,7 @@ LL | x.load(Relaxed); = help: see https://doc.rust-lang.org/nightly/std/sync/atomic/index.html#memory-model-for-atomic-accesses for more information about the Rust memory model = 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 (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/racing_mixed_size_read.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/pass/box.stack.stderr b/src/tools/miri/tests/pass/box.stack.stderr index 4c2fb40e110..f6e208cea9a 100644 --- a/src/tools/miri/tests/pass/box.stack.stderr +++ b/src/tools/miri/tests/pass/box.stack.stderr @@ -24,6 +24,7 @@ warning: integer-to-pointer cast LL | let r = ((u.as_ptr() as usize) + 0) as *mut i32; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ integer-to-pointer cast | + = note: BACKTRACE: = note: inside `into_unique` at $DIR/box.rs:LL:CC note: inside `main` --> $DIR/box.rs:LL:CC diff --git a/src/tools/miri/tests/pass/concurrency/simple.rs b/src/tools/miri/tests/pass/concurrency/simple.rs index ec549a998ba..46033eea35d 100644 --- a/src/tools/miri/tests/pass/concurrency/simple.rs +++ b/src/tools/miri/tests/pass/concurrency/simple.rs @@ -45,23 +45,6 @@ fn create_move_out() { assert_eq!(result.len(), 6); } -fn panic() { - let result = thread::spawn(|| panic!("Hello!")).join().unwrap_err(); - let msg = result.downcast_ref::<&'static str>().unwrap(); - assert_eq!(*msg, "Hello!"); -} - -fn panic_named() { - thread::Builder::new() - .name("childthread".to_string()) - .spawn(move || { - panic!("Hello, world!"); - }) - .unwrap() - .join() - .unwrap_err(); -} - // This is not a data race! fn shared_readonly() { use std::sync::Arc; @@ -89,6 +72,4 @@ fn main() { create_move_in(); create_move_out(); shared_readonly(); - panic(); - panic_named(); } diff --git a/src/tools/miri/tests/pass/concurrency/simple.stderr b/src/tools/miri/tests/pass/concurrency/simple.stderr deleted file mode 100644 index 33d6b6841ad..00000000000 --- a/src/tools/miri/tests/pass/concurrency/simple.stderr +++ /dev/null @@ -1,5 +0,0 @@ -thread '<unnamed>' panicked at $DIR/simple.rs:LL:CC: -Hello! -note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace -thread 'childthread' panicked at $DIR/simple.rs:LL:CC: -Hello, world! diff --git a/src/tools/miri/tests/pass/concurrency/thread_name.rs b/src/tools/miri/tests/pass/concurrency/thread_name.rs new file mode 100644 index 00000000000..6dd5f1f5c91 --- /dev/null +++ b/src/tools/miri/tests/pass/concurrency/thread_name.rs @@ -0,0 +1,21 @@ +use std::thread; + +fn main() { + // When we have not set the name... + thread::spawn(|| { + assert!(thread::current().name().is_none()); + }); + + // ... and when we have set it. + thread::Builder::new() + .name("childthread".to_string()) + .spawn(move || { + assert_eq!(thread::current().name().unwrap(), "childthread"); + }) + .unwrap() + .join() + .unwrap(); + + // Also check main thread name. + assert_eq!(thread::current().name().unwrap(), "main"); +} diff --git a/src/tools/miri/tests/pass/panic/thread_panic.rs b/src/tools/miri/tests/pass/panic/thread_panic.rs new file mode 100644 index 00000000000..9a3040b2c56 --- /dev/null +++ b/src/tools/miri/tests/pass/panic/thread_panic.rs @@ -0,0 +1,25 @@ +//! Panicking in other threads. + +use std::thread; + +fn panic() { + let result = thread::spawn(|| panic!("Hello!")).join().unwrap_err(); + let msg = result.downcast_ref::<&'static str>().unwrap(); + assert_eq!(*msg, "Hello!"); +} + +fn panic_named() { + thread::Builder::new() + .name("childthread".to_string()) + .spawn(move || { + panic!("Hello, world!"); + }) + .unwrap() + .join() + .unwrap_err(); +} + +fn main() { + panic(); + panic_named(); +} diff --git a/src/tools/miri/tests/pass/panic/thread_panic.stderr b/src/tools/miri/tests/pass/panic/thread_panic.stderr new file mode 100644 index 00000000000..badd409d13f --- /dev/null +++ b/src/tools/miri/tests/pass/panic/thread_panic.stderr @@ -0,0 +1,5 @@ +thread '<unnamed>' panicked at $DIR/thread_panic.rs:LL:CC: +Hello! +note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace +thread 'childthread' panicked at $DIR/thread_panic.rs:LL:CC: +Hello, world! diff --git a/src/tools/miri/tests/pass/shims/time.rs b/src/tools/miri/tests/pass/shims/time.rs index 23b5ab57efa..226f04ade0f 100644 --- a/src/tools/miri/tests/pass/shims/time.rs +++ b/src/tools/miri/tests/pass/shims/time.rs @@ -5,7 +5,7 @@ use std::time::{Duration, Instant, SystemTime}; fn duration_sanity(diff: Duration) { // On my laptop, I observed times around 15-40ms. Add 10x lee-way both ways. assert!(diff.as_millis() > 1); - assert!(diff.as_millis() < 500); + assert!(diff.as_millis() < 1000); // macOS is very slow sometimes } fn test_sleep() { diff --git a/src/tools/miri/tests/pass/shims/windows-rand.rs b/src/tools/miri/tests/pass/shims/windows-rand.rs index e2bcb7bd7cb..cfbc1d278a9 100644 --- a/src/tools/miri/tests/pass/shims/windows-rand.rs +++ b/src/tools/miri/tests/pass/shims/windows-rand.rs @@ -1,4 +1,4 @@ -//@only-target-windows: this directly tests windows only random functions +//@only-target-windows: this directly tests windows-only functions use core::ffi::c_void; use core::mem::size_of_val; use core::ptr::null_mut; @@ -6,6 +6,7 @@ use core::ptr::null_mut; // Windows API definitions. type NTSTATUS = i32; type BOOLEAN = u8; +type BOOL = i32; // yes, seriously, BOOL and BOOLEAN are very different... const BCRYPT_USE_SYSTEM_PREFERRED_RNG: u32 = 0x00000002; const BCRYPT_RNG_ALG_HANDLE: *mut c_void = 0x81 as *mut c_void; #[link(name = "bcrypt")] @@ -22,6 +23,16 @@ extern "system" { #[link_name = "SystemFunction036"] fn RtlGenRandom(RandomBuffer: *mut u8, RandomBufferLength: u32) -> BOOLEAN; } +#[cfg(target_arch = "x86")] +#[link(name = "bcryptprimitives", kind = "raw-dylib", import_name_type = "undecorated")] +extern "system" { + fn ProcessPrng(pbdata: *mut u8, cbdata: usize) -> BOOL; +} +#[cfg(not(target_arch = "x86"))] +#[link(name = "bcryptprimitives", kind = "raw-dylib")] +extern "system" { + fn ProcessPrng(pbdata: *mut u8, cbdata: usize) -> BOOL; +} fn main() { let mut key = [0u8; 24]; @@ -38,4 +49,10 @@ fn main() { let ret = unsafe { RtlGenRandom(key.as_mut_ptr(), len) }; // RtlGenRandom returns a BOOLEAN where 0 indicates an error assert_ne!(ret, 0); + + let len = key.len(); + let ret = unsafe { ProcessPrng(key.as_mut_ptr(), len) }; + // ProcessPrng is documented as always returning `TRUE`. + // https://learn.microsoft.com/en-us/windows/win32/seccng/processprng#return-value + assert_eq!(ret, 1); } diff --git a/src/tools/miri/tests/pass/shims/windows-threadname.rs b/src/tools/miri/tests/pass/shims/windows-threadname.rs new file mode 100644 index 00000000000..c863ac670b6 --- /dev/null +++ b/src/tools/miri/tests/pass/shims/windows-threadname.rs @@ -0,0 +1,46 @@ +//@only-target-windows: this directly tests windows-only functions + +use std::ffi::OsStr; +use std::os::windows::ffi::OsStrExt; + +use core::ffi::c_void; +type HANDLE = *mut c_void; +type PWSTR = *mut u16; +type PCWSTR = *const u16; +type HRESULT = i32; +type HLOCAL = *mut ::core::ffi::c_void; +extern "system" { + fn GetCurrentThread() -> HANDLE; + fn GetThreadDescription(hthread: HANDLE, lpthreaddescription: *mut PWSTR) -> HRESULT; + fn SetThreadDescription(hthread: HANDLE, lpthreaddescription: PCWSTR) -> HRESULT; + fn LocalFree(hmem: HLOCAL) -> HLOCAL; +} + +fn to_u16s<S: AsRef<OsStr>>(s: S) -> Vec<u16> { + let mut result: Vec<_> = s.as_ref().encode_wide().collect(); + result.push(0); + result +} + +fn main() { + unsafe { + let name = c"mythreadname"; + + let utf16 = to_u16s(name.to_str().unwrap()); + SetThreadDescription(GetCurrentThread(), utf16.as_ptr()); + + let mut ptr = core::ptr::null_mut::<u16>(); + let result = GetThreadDescription(GetCurrentThread(), &mut ptr); + assert!(result >= 0); + let name_gotten = String::from_utf16_lossy({ + let mut len = 0; + while *ptr.add(len) != 0 { + len += 1; + } + core::slice::from_raw_parts(ptr, len) + }); + assert_eq!(name_gotten, name.to_str().unwrap()); + let r = LocalFree(ptr.cast()); + assert!(r.is_null()); + } +} diff --git a/src/tools/miri/tests/pass/tree_borrows/sb_fails.rs b/src/tools/miri/tests/pass/tree_borrows/sb_fails.rs index 5973ef01ead..1bae30bde60 100644 --- a/src/tools/miri/tests/pass/tree_borrows/sb_fails.rs +++ b/src/tools/miri/tests/pass/tree_borrows/sb_fails.rs @@ -1,9 +1,10 @@ //@compile-flags: -Zmiri-tree-borrows // These tests fail Stacked Borrows, but pass Tree Borrows. -// A modified version of each is also available that fails Tree Borrows. -// They all have in common that in SB a mutable reborrow is enough to produce + +// The first four have in common that in SB a mutable reborrow is enough to produce // write access errors, but in TB an actual write is needed. +// A modified version of each is also available that fails Tree Borrows. mod fnentry_invalidation { // Copied directly from fail/stacked_borrows/fnentry_invalidation.rs @@ -73,9 +74,22 @@ mod static_memory_modification { } } +// This one is about direct writes to local variables not being in conflict +// with interior mutable reborrows. +#[allow(unused_assignments)] // spurious warning +fn interior_mut_reborrow() { + use std::cell::UnsafeCell; + + let mut c = UnsafeCell::new(42); + let ptr = c.get(); // first create interior mutable ptr + c = UnsafeCell::new(13); // then write to parent + assert_eq!(unsafe { ptr.read() }, 13); // then read through previous ptr +} + fn main() { fnentry_invalidation::main(); pass_invalid_mut::main(); return_invalid_mut::main(); static_memory_modification::main(); + interior_mut_reborrow(); } diff --git a/src/tools/tidy/src/issues.txt b/src/tools/tidy/src/issues.txt index ea1a967538b..cd3976ea657 100644 --- a/src/tools/tidy/src/issues.txt +++ b/src/tools/tidy/src/issues.txt @@ -98,6 +98,7 @@ "ui/associated-types/issue-25700-1.rs", "ui/associated-types/issue-25700-2.rs", "ui/associated-types/issue-25700.rs", +"ui/associated-types/issue-26262.rs", "ui/associated-types/issue-26681.rs", "ui/associated-types/issue-27675-unchecked-bounds.rs", "ui/associated-types/issue-27901.rs", @@ -182,8 +183,8 @@ "ui/async-await/issue-67651.rs", "ui/async-await/issue-67765-async-diagnostic.rs", "ui/async-await/issue-68112.rs", -"ui/async-await/issue-68523-start.rs", "ui/async-await/issue-68523.rs", +"ui/async-await/issue-68523-start.rs", "ui/async-await/issue-69446-fnmut-capture.rs", "ui/async-await/issue-70594.rs", "ui/async-await/issue-70818.rs", @@ -341,8 +342,8 @@ "ui/borrowck/issue-52967-edition-2018-needs-two-phase-borrows.rs", "ui/borrowck/issue-53432-nested-closure-outlives-borrowed-value.rs", "ui/borrowck/issue-54499-field-mutation-marks-mut-as-used.rs", -"ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.rs", "ui/borrowck/issue-54499-field-mutation-of-moved-out.rs", +"ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.rs", "ui/borrowck/issue-54499-field-mutation-of-never-init.rs", "ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.rs", "ui/borrowck/issue-55492-borrowck-migrate-scans-parents.rs", @@ -359,9 +360,9 @@ "ui/borrowck/issue-71546.rs", "ui/borrowck/issue-7573.rs", "ui/borrowck/issue-80772.rs", -"ui/borrowck/issue-81365-1.rs", "ui/borrowck/issue-81365-10.rs", "ui/borrowck/issue-81365-11.rs", +"ui/borrowck/issue-81365-1.rs", "ui/borrowck/issue-81365-2.rs", "ui/borrowck/issue-81365-3.rs", "ui/borrowck/issue-81365-4.rs", @@ -391,9 +392,6 @@ "ui/borrowck/issue-95079-missing-move-in-nested-closure.rs", "ui/box/issue-82446.rs", "ui/box/issue-95036.rs", -"ui/c-variadic/issue-32201.rs", -"ui/c-variadic/issue-86053-1.rs", -"ui/c-variadic/issue-86053-2.rs", "ui/cast/issue-106883-is-empty.rs", "ui/cast/issue-10991.rs", "ui/cast/issue-17444.rs", @@ -401,19 +399,19 @@ "ui/cast/issue-85586.rs", "ui/cast/issue-88621.rs", "ui/cast/issue-89497.rs", -"ui/closure-expected-type/issue-24421.rs", "ui/closure_context/issue-26046-fn-mut.rs", "ui/closure_context/issue-26046-fn-once.rs", "ui/closure_context/issue-42065.rs", +"ui/closure-expected-type/issue-24421.rs", "ui/closures/2229_closure_analysis/issue-118144.rs", "ui/closures/2229_closure_analysis/issue-87378.rs", "ui/closures/2229_closure_analysis/issue-87987.rs", "ui/closures/2229_closure_analysis/issue-88118-2.rs", +"ui/closures/2229_closure_analysis/issue_88118.rs", "ui/closures/2229_closure_analysis/issue-88476.rs", "ui/closures/2229_closure_analysis/issue-89606.rs", "ui/closures/2229_closure_analysis/issue-90465.rs", "ui/closures/2229_closure_analysis/issue-92724-needsdrop-query-cycle.rs", -"ui/closures/2229_closure_analysis/issue_88118.rs", "ui/closures/2229_closure_analysis/match/issue-87097.rs", "ui/closures/2229_closure_analysis/match/issue-87426.rs", "ui/closures/2229_closure_analysis/match/issue-87988.rs", @@ -466,6 +464,7 @@ "ui/codegen/issue-16602-1.rs", "ui/codegen/issue-16602-2.rs", "ui/codegen/issue-16602-3.rs", +"ui/codegen/issue-27859.rs", "ui/codegen/issue-28950.rs", "ui/codegen/issue-55976.rs", "ui/codegen/issue-63787.rs", @@ -645,8 +644,8 @@ "ui/const-generics/issues/issue-99641.rs", "ui/const-generics/parser-error-recovery/issue-89013-no-assoc.rs", "ui/const-generics/parser-error-recovery/issue-89013-no-kw.rs", -"ui/const-generics/parser-error-recovery/issue-89013-type.rs", "ui/const-generics/parser-error-recovery/issue-89013.rs", +"ui/const-generics/parser-error-recovery/issue-89013-type.rs", "ui/const-generics/type-dependent/issue-61936.rs", "ui/const-generics/type-dependent/issue-63695.rs", "ui/const-generics/type-dependent/issue-67144-1.rs", @@ -690,13 +689,13 @@ "ui/consts/const-eval/issue-91827-extern-types-field-offset.rs", "ui/consts/const-extern-fn/issue-68062-const-extern-fns-dont-need-fn-specifier-2.rs", "ui/consts/const-extern-fn/issue-68062-const-extern-fns-dont-need-fn-specifier.rs", -"ui/consts/const-mut-refs/issue-76510.rs", "ui/consts/const_in_pattern/issue-34784-match-on-non-int-raw-ptr.rs", "ui/consts/const_in_pattern/issue-44333.rs", "ui/consts/const_in_pattern/issue-53708.rs", "ui/consts/const_in_pattern/issue-62614.rs", "ui/consts/const_in_pattern/issue-65466.rs", "ui/consts/const_in_pattern/issue-73431.rs", +"ui/consts/const-mut-refs/issue-76510.rs", "ui/consts/control-flow/issue-46843.rs", "ui/consts/control-flow/issue-50577.rs", "ui/consts/extra-const-ub/issue-100771.rs", @@ -715,9 +714,9 @@ "ui/consts/issue-17074.rs", "ui/consts/issue-17458.rs", "ui/consts/issue-17718-borrow-interior.rs", +"ui/consts/issue-17718-constants-not-static.rs", "ui/consts/issue-17718-const-bad-values.rs", "ui/consts/issue-17718-const-borrow.rs", -"ui/consts/issue-17718-constants-not-static.rs", "ui/consts/issue-17718-references.rs", "ui/consts/issue-17718.rs", "ui/consts/issue-17756.rs", @@ -842,6 +841,9 @@ "ui/coroutine/issue-91477.rs", "ui/coroutine/issue-93161.rs", "ui/cross-crate/issue-64872/issue-64872.rs", +"ui/c-variadic/issue-32201.rs", +"ui/c-variadic/issue-86053-1.rs", +"ui/c-variadic/issue-86053-2.rs", "ui/cycle-trait/issue-12511.rs", "ui/debuginfo/issue-105386-debuginfo-ub.rs", "ui/deprecation/issue-66340-deprecated-attr-non-meta-grammar.rs", @@ -857,6 +859,7 @@ "ui/deriving/issue-103157.rs", "ui/deriving/issue-15689-1.rs", "ui/deriving/issue-15689-2.rs", +"ui/deriving/issue-18738.rs", "ui/deriving/issue-19358.rs", "ui/deriving/issue-3935.rs", "ui/deriving/issue-58319.rs", @@ -899,6 +902,15 @@ "ui/did_you_mean/issue-56028-there-is-an-enum-variant.rs", "ui/did_you_mean/issue-87830-try-brackets-for-arrays.rs", "ui/drop/auxiliary/issue-10028.rs", +"ui/dropck/issue-24805-dropck-itemless.rs", +"ui/dropck/issue-28498-ugeh-with-lifetime-param.rs", +"ui/dropck/issue-28498-ugeh-with-passed-to-fn.rs", +"ui/dropck/issue-28498-ugeh-with-trait-bound.rs", +"ui/dropck/issue-29844.rs", +"ui/dropck/issue-34053.rs", +"ui/dropck/issue-38868.rs", +"ui/dropck/issue-54943-1.rs", +"ui/dropck/issue-54943-2.rs", "ui/drop/issue-100276.rs", "ui/drop/issue-10028.rs", "ui/drop/issue-103107.rs", @@ -906,6 +918,7 @@ "ui/drop/issue-17718-const-destructors.rs", "ui/drop/issue-21486.rs", "ui/drop/issue-23338-ensure-param-drop-order.rs", +"ui/drop/issue-23611-enum-swap-in-drop.rs", "ui/drop/issue-2734.rs", "ui/drop/issue-2735-2.rs", "ui/drop/issue-2735-3.rs", @@ -916,21 +929,13 @@ "ui/drop/issue-90752-raw-ptr-shenanigans.rs", "ui/drop/issue-90752.rs", "ui/drop/issue-979.rs", -"ui/dropck/issue-24805-dropck-itemless.rs", -"ui/dropck/issue-28498-ugeh-with-lifetime-param.rs", -"ui/dropck/issue-28498-ugeh-with-passed-to-fn.rs", -"ui/dropck/issue-28498-ugeh-with-trait-bound.rs", -"ui/dropck/issue-29844.rs", -"ui/dropck/issue-34053.rs", -"ui/dropck/issue-38868.rs", -"ui/dropck/issue-54943-1.rs", -"ui/dropck/issue-54943-2.rs", "ui/dst/issue-113447.rs", "ui/dst/issue-90528-unsizing-not-suggestion-110063.rs", "ui/dst/issue-90528-unsizing-suggestion-1.rs", "ui/dst/issue-90528-unsizing-suggestion-2.rs", "ui/dst/issue-90528-unsizing-suggestion-3.rs", "ui/dst/issue-90528-unsizing-suggestion-4.rs", +"ui/dyn-keyword/issue-5153.rs", "ui/dyn-keyword/issue-56327-dyn-trait-in-macro-is-okay.rs", "ui/dyn-star/issue-102430.rs", "ui/empty/issue-37026.rs", @@ -1009,14 +1014,14 @@ "ui/fn/issue-3904.rs", "ui/fn/issue-39259.rs", "ui/fn/issue-80179.rs", +"ui/foreign/issue-74120-lowering-of-ffi-block-bodies.rs", +"ui/foreign/issue-91370-foreign-fn-block-impl.rs", +"ui/foreign/issue-99276-same-type-lifetimes.rs", +"ui/for/issue-20605.rs", "ui/for-loop-while/issue-1257.rs", "ui/for-loop-while/issue-2216.rs", "ui/for-loop-while/issue-51345.rs", "ui/for-loop-while/issue-69841.rs", -"ui/for/issue-20605.rs", -"ui/foreign/issue-74120-lowering-of-ffi-block-bodies.rs", -"ui/foreign/issue-91370-foreign-fn-block-impl.rs", -"ui/foreign/issue-99276-same-type-lifetimes.rs", "ui/function-pointer/issue-102289.rs", "ui/functions-closures/closure-expected-type/issue-38714.rs", "ui/generic-associated-types/bugs/issue-100013.rs", @@ -1079,8 +1084,8 @@ "ui/generic-associated-types/issue-87258_b.rs", "ui/generic-associated-types/issue-87429-2.rs", "ui/generic-associated-types/issue-87429-associated-type-default.rs", -"ui/generic-associated-types/issue-87429-specialization.rs", "ui/generic-associated-types/issue-87429.rs", +"ui/generic-associated-types/issue-87429-specialization.rs", "ui/generic-associated-types/issue-87748.rs", "ui/generic-associated-types/issue-87750.rs", "ui/generic-associated-types/issue-88287.rs", @@ -1090,9 +1095,9 @@ "ui/generic-associated-types/issue-88595.rs", "ui/generic-associated-types/issue-89008.rs", "ui/generic-associated-types/issue-89352.rs", -"ui/generic-associated-types/issue-90014-tait.rs", -"ui/generic-associated-types/issue-90014-tait2.rs", "ui/generic-associated-types/issue-90014.rs", +"ui/generic-associated-types/issue-90014-tait2.rs", +"ui/generic-associated-types/issue-90014-tait.rs", "ui/generic-associated-types/issue-90729.rs", "ui/generic-associated-types/issue-91139.rs", "ui/generic-associated-types/issue-91883.rs", @@ -1114,8 +1119,8 @@ "ui/generics/issue-333.rs", "ui/generics/issue-59508-1.rs", "ui/generics/issue-59508.rs", -"ui/generics/issue-61631-default-type-param-can-reference-self-in-trait.rs", "ui/generics/issue-61631-default-type-param-cannot-reference-self.rs", +"ui/generics/issue-61631-default-type-param-can-reference-self-in-trait.rs", "ui/generics/issue-65285-incorrect-explicit-lifetime-name-needed.rs", "ui/generics/issue-79605.rs", "ui/generics/issue-80512-param-reordering-with-defaults.rs", @@ -1174,6 +1179,9 @@ "ui/hygiene/issue-47312.rs", "ui/hygiene/issue-61574-const-parameters.rs", "ui/hygiene/issue-77523-def-site-async-await.rs", +"ui/implied-bounds/issue-100690.rs", +"ui/implied-bounds/issue-101951.rs", +"ui/implied-bounds/issue-110161.rs", "ui/impl-trait/explicit-generic-args-with-impl-trait/issue-87718.rs", "ui/impl-trait/in-trait/issue-102140.rs", "ui/impl-trait/in-trait/issue-102301.rs", @@ -1253,9 +1261,6 @@ "ui/impl-trait/issues/issue-92305.rs", "ui/impl-trait/issues/issue-93788.rs", "ui/impl-trait/issues/issue-99348-impl-compatibility.rs", -"ui/implied-bounds/issue-100690.rs", -"ui/implied-bounds/issue-101951.rs", -"ui/implied-bounds/issue-110161.rs", "ui/imports/auxiliary/issue-114682-2-extern.rs", "ui/imports/auxiliary/issue-114682-3-extern.rs", "ui/imports/auxiliary/issue-114682-4-extern.rs", @@ -1344,6 +1349,7 @@ "ui/inference/issue-12028.rs", "ui/inference/issue-28935.rs", "ui/inference/issue-36053.rs", +"ui/inference/issue-3743.rs", "ui/inference/issue-70082.rs", "ui/inference/issue-70703.rs", "ui/inference/issue-71309.rs", @@ -1362,8 +1368,8 @@ "ui/inference/need_type_info/issue-107745-avoid-expr-from-macro-expansion.rs", "ui/inference/need_type_info/issue-109905.rs", "ui/inference/need_type_info/issue-113264-incorrect-impl-trait-in-path-suggestion.rs", -"ui/infinite/issue-41731-infinite-macro-print.rs", "ui/infinite/issue-41731-infinite-macro-println.rs", +"ui/infinite/issue-41731-infinite-macro-print.rs", "ui/intrinsics/issue-28575.rs", "ui/intrinsics/issue-84297-reifying-copy.rs", "ui/invalid/issue-114435-layout-type-err.rs", @@ -1380,8 +1386,8 @@ "ui/issues/auxiliary/issue-11508.rs", "ui/issues/auxiliary/issue-11529.rs", "ui/issues/auxiliary/issue-11680.rs", -"ui/issues/auxiliary/issue-12133-dylib.rs", "ui/issues/auxiliary/issue-12133-dylib2.rs", +"ui/issues/auxiliary/issue-12133-dylib.rs", "ui/issues/auxiliary/issue-12133-rlib.rs", "ui/issues/auxiliary/issue-12612-1.rs", "ui/issues/auxiliary/issue-12612-2.rs", @@ -1548,8 +1554,8 @@ "ui/issues/issue-13497-2.rs", "ui/issues/issue-13497.rs", "ui/issues/issue-13507-2.rs", -"ui/issues/issue-1362.rs", "ui/issues/issue-13620.rs", +"ui/issues/issue-1362.rs", "ui/issues/issue-13665.rs", "ui/issues/issue-13703.rs", "ui/issues/issue-13763.rs", @@ -1595,7 +1601,6 @@ "ui/issues/issue-15094.rs", "ui/issues/issue-15104.rs", "ui/issues/issue-15129-rpass.rs", -"ui/issues/issue-15155.rs", "ui/issues/issue-15167.rs", "ui/issues/issue-15189.rs", "ui/issues/issue-15207.rs", @@ -1644,8 +1649,8 @@ "ui/issues/issue-16819.rs", "ui/issues/issue-16922-rpass.rs", "ui/issues/issue-16939.rs", -"ui/issues/issue-1696.rs", "ui/issues/issue-16966.rs", +"ui/issues/issue-1696.rs", "ui/issues/issue-16994.rs", "ui/issues/issue-17001.rs", "ui/issues/issue-17033.rs", @@ -1713,7 +1718,6 @@ "ui/issues/issue-18611.rs", "ui/issues/issue-18685.rs", "ui/issues/issue-18711.rs", -"ui/issues/issue-18738.rs", "ui/issues/issue-18767.rs", "ui/issues/issue-18783.rs", "ui/issues/issue-18809.rs", @@ -1725,8 +1729,8 @@ "ui/issues/issue-18952.rs", "ui/issues/issue-18959.rs", "ui/issues/issue-18988.rs", -"ui/issues/issue-1900.rs", "ui/issues/issue-19001.rs", +"ui/issues/issue-1900.rs", "ui/issues/issue-19037.rs", "ui/issues/issue-19086.rs", "ui/issues/issue-19097.rs", @@ -1752,7 +1756,6 @@ "ui/issues/issue-19479.rs", "ui/issues/issue-19482.rs", "ui/issues/issue-19499.rs", -"ui/issues/issue-19521.rs", "ui/issues/issue-19601.rs", "ui/issues/issue-1962.rs", "ui/issues/issue-19631.rs", @@ -1823,10 +1826,9 @@ "ui/issues/issue-21622.rs", "ui/issues/issue-21634.rs", "ui/issues/issue-21655.rs", -"ui/issues/issue-2170-exe.rs", "ui/issues/issue-21701.rs", +"ui/issues/issue-2170-exe.rs", "ui/issues/issue-21763.rs", -"ui/issues/issue-21837.rs", "ui/issues/issue-21891.rs", "ui/issues/issue-2190-1.rs", "ui/issues/issue-21909.rs", @@ -1861,15 +1863,15 @@ "ui/issues/issue-22777.rs", "ui/issues/issue-22781.rs", "ui/issues/issue-22789.rs", -"ui/issues/issue-2281-part1.rs", "ui/issues/issue-22814.rs", +"ui/issues/issue-2281-part1.rs", "ui/issues/issue-2284.rs", "ui/issues/issue-22864-1.rs", "ui/issues/issue-22864-2.rs", "ui/issues/issue-22872.rs", "ui/issues/issue-22874.rs", -"ui/issues/issue-2288.rs", "ui/issues/issue-22886.rs", +"ui/issues/issue-2288.rs", "ui/issues/issue-22894.rs", "ui/issues/issue-22933-1.rs", "ui/issues/issue-22933-2.rs", @@ -1882,9 +1884,9 @@ "ui/issues/issue-23073.rs", "ui/issues/issue-2311-2.rs", "ui/issues/issue-2311.rs", -"ui/issues/issue-2312.rs", "ui/issues/issue-23122-1.rs", "ui/issues/issue-23122-2.rs", +"ui/issues/issue-2312.rs", "ui/issues/issue-2316-c.rs", "ui/issues/issue-23173.rs", "ui/issues/issue-23189.rs", @@ -1911,13 +1913,12 @@ "ui/issues/issue-23544.rs", "ui/issues/issue-23550.rs", "ui/issues/issue-23589.rs", -"ui/issues/issue-23611-enum-swap-in-drop.rs", "ui/issues/issue-23649-1.rs", "ui/issues/issue-23649-2.rs", "ui/issues/issue-23649-3.rs", "ui/issues/issue-23699.rs", -"ui/issues/issue-2380-b.rs", "ui/issues/issue-23808.rs", +"ui/issues/issue-2380-b.rs", "ui/issues/issue-2383.rs", "ui/issues/issue-23891.rs", "ui/issues/issue-23898.rs", @@ -1941,7 +1942,6 @@ "ui/issues/issue-24389.rs", "ui/issues/issue-24424.rs", "ui/issues/issue-24434.rs", -"ui/issues/issue-24446.rs", "ui/issues/issue-2445-b.rs", "ui/issues/issue-2445.rs", "ui/issues/issue-24533.rs", @@ -1981,8 +1981,8 @@ "ui/issues/issue-25746-bool-transmute.rs", "ui/issues/issue-25757.rs", "ui/issues/issue-25810.rs", -"ui/issues/issue-2590.rs", "ui/issues/issue-25901.rs", +"ui/issues/issue-2590.rs", "ui/issues/issue-26056.rs", "ui/issues/issue-26093.rs", "ui/issues/issue-26095.rs", @@ -1992,7 +1992,6 @@ "ui/issues/issue-26205.rs", "ui/issues/issue-26217.rs", "ui/issues/issue-26237.rs", -"ui/issues/issue-26262.rs", "ui/issues/issue-2631-b.rs", "ui/issues/issue-2642.rs", "ui/issues/issue-26468.rs", @@ -2029,7 +2028,6 @@ "ui/issues/issue-27697.rs", "ui/issues/issue-27815.rs", "ui/issues/issue-27842.rs", -"ui/issues/issue-27859.rs", "ui/issues/issue-27889.rs", "ui/issues/issue-27942.rs", "ui/issues/issue-27949.rs", @@ -2043,10 +2041,10 @@ "ui/issues/issue-28433.rs", "ui/issues/issue-28472.rs", "ui/issues/issue-2848.rs", -"ui/issues/issue-2849.rs", "ui/issues/issue-28498-must-work-ex1.rs", "ui/issues/issue-28498-must-work-ex2.rs", "ui/issues/issue-28498-ugeh-ex1.rs", +"ui/issues/issue-2849.rs", "ui/issues/issue-28550.rs", "ui/issues/issue-28561.rs", "ui/issues/issue-28568.rs", @@ -2064,8 +2062,8 @@ "ui/issues/issue-28999.rs", "ui/issues/issue-29030.rs", "ui/issues/issue-29037.rs", -"ui/issues/issue-2904.rs", "ui/issues/issue-29048.rs", +"ui/issues/issue-2904.rs", "ui/issues/issue-29053.rs", "ui/issues/issue-29071-2.rs", "ui/issues/issue-29071.rs", @@ -2077,8 +2075,8 @@ "ui/issues/issue-2935.rs", "ui/issues/issue-29466.rs", "ui/issues/issue-29485.rs", -"ui/issues/issue-2951.rs", "ui/issues/issue-29516.rs", +"ui/issues/issue-2951.rs", "ui/issues/issue-29522.rs", "ui/issues/issue-29540.rs", "ui/issues/issue-29663.rs", @@ -2093,7 +2091,6 @@ "ui/issues/issue-2989.rs", "ui/issues/issue-29948.rs", "ui/issues/issue-2995.rs", -"ui/issues/issue-30007.rs", "ui/issues/issue-30018-panic.rs", "ui/issues/issue-30081.rs", "ui/issues/issue-3012-2.rs", @@ -2104,11 +2101,10 @@ "ui/issues/issue-30255.rs", "ui/issues/issue-3026.rs", "ui/issues/issue-3029.rs", -"ui/issues/issue-3037.rs", "ui/issues/issue-30371.rs", -"ui/issues/issue-3038.rs", +"ui/issues/issue-3037.rs", "ui/issues/issue-30380.rs", -"ui/issues/issue-30490.rs", +"ui/issues/issue-3038.rs", "ui/issues/issue-3052.rs", "ui/issues/issue-30530.rs", "ui/issues/issue-30589.rs", @@ -2152,7 +2148,6 @@ "ui/issues/issue-32950.rs", "ui/issues/issue-32995-2.rs", "ui/issues/issue-32995.rs", -"ui/issues/issue-33187.rs", "ui/issues/issue-33202.rs", "ui/issues/issue-33241.rs", "ui/issues/issue-33287.rs", @@ -2197,7 +2192,6 @@ "ui/issues/issue-35570.rs", "ui/issues/issue-3559.rs", "ui/issues/issue-35600.rs", -"ui/issues/issue-3563-3.rs", "ui/issues/issue-3574.rs", "ui/issues/issue-35815.rs", "ui/issues/issue-35976.rs", @@ -2212,7 +2206,6 @@ "ui/issues/issue-36299.rs", "ui/issues/issue-36379.rs", "ui/issues/issue-36400.rs", -"ui/issues/issue-36401.rs", "ui/issues/issue-36474.rs", "ui/issues/issue-3656.rs", "ui/issues/issue-3668-non-constant-value-in-constant/issue-3668-2.rs", @@ -2232,12 +2225,10 @@ "ui/issues/issue-37109.rs", "ui/issues/issue-37131.rs", "ui/issues/issue-37311-type-length-limit/issue-37311.rs", -"ui/issues/issue-3743.rs", "ui/issues/issue-37510.rs", -"ui/issues/issue-3753.rs", "ui/issues/issue-37534.rs", +"ui/issues/issue-3753.rs", "ui/issues/issue-37576.rs", -"ui/issues/issue-37598.rs", "ui/issues/issue-3763.rs", "ui/issues/issue-37665.rs", "ui/issues/issue-37686.rs", @@ -2263,8 +2254,8 @@ "ui/issues/issue-3888-2.rs", "ui/issues/issue-38919.rs", "ui/issues/issue-38942.rs", -"ui/issues/issue-3895.rs", "ui/issues/issue-38954.rs", +"ui/issues/issue-3895.rs", "ui/issues/issue-38987.rs", "ui/issues/issue-39089.rs", "ui/issues/issue-39175.rs", @@ -2274,9 +2265,8 @@ "ui/issues/issue-39687.rs", "ui/issues/issue-39709.rs", "ui/issues/issue-3979-2.rs", -"ui/issues/issue-3979-generics.rs", -"ui/issues/issue-3979-xcrate.rs", "ui/issues/issue-3979.rs", +"ui/issues/issue-3979-xcrate.rs", "ui/issues/issue-39808.rs", "ui/issues/issue-39827.rs", "ui/issues/issue-39848.rs", @@ -2347,14 +2337,13 @@ "ui/issues/issue-42880.rs", "ui/issues/issue-42956.rs", "ui/issues/issue-43057.rs", -"ui/issues/issue-43162.rs", "ui/issues/issue-43205.rs", "ui/issues/issue-43250.rs", "ui/issues/issue-43291.rs", "ui/issues/issue-4333.rs", -"ui/issues/issue-4335.rs", "ui/issues/issue-43355.rs", "ui/issues/issue-43357.rs", +"ui/issues/issue-4335.rs", "ui/issues/issue-43420-no-over-suggest.rs", "ui/issues/issue-43424.rs", "ui/issues/issue-43431.rs", @@ -2383,8 +2372,8 @@ "ui/issues/issue-44851.rs", "ui/issues/issue-4517.rs", "ui/issues/issue-4541.rs", -"ui/issues/issue-4542.rs", "ui/issues/issue-45425.rs", +"ui/issues/issue-4542.rs", "ui/issues/issue-4545.rs", "ui/issues/issue-45510.rs", "ui/issues/issue-45562.rs", @@ -2413,8 +2402,8 @@ "ui/issues/issue-47309.rs", "ui/issues/issue-4734.rs", "ui/issues/issue-4735.rs", -"ui/issues/issue-4736.rs", "ui/issues/issue-47364.rs", +"ui/issues/issue-4736.rs", "ui/issues/issue-47377.rs", "ui/issues/issue-47380.rs", "ui/issues/issue-47486.rs", @@ -2423,8 +2412,8 @@ "ui/issues/issue-47638.rs", "ui/issues/issue-47673.rs", "ui/issues/issue-47703-1.rs", -"ui/issues/issue-47703-tuple.rs", "ui/issues/issue-47703.rs", +"ui/issues/issue-47703-tuple.rs", "ui/issues/issue-47715.rs", "ui/issues/issue-47722.rs", "ui/issues/issue-48006.rs", @@ -2480,7 +2469,6 @@ "ui/issues/issue-51116.rs", "ui/issues/issue-51154.rs", "ui/issues/issue-51515.rs", -"ui/issues/issue-5153.rs", "ui/issues/issue-51632-try-desugar-incompatible-types.rs", "ui/issues/issue-51655.rs", "ui/issues/issue-51714.rs", @@ -2573,8 +2561,8 @@ "ui/issues/issue-59756.rs", "ui/issues/issue-5988.rs", "ui/issues/issue-5997-outer-generic-parameter/issue-5997-enum.rs", -"ui/issues/issue-5997-outer-generic-parameter/issue-5997-struct.rs", "ui/issues/issue-5997-outer-generic-parameter/issue-5997.rs", +"ui/issues/issue-5997-outer-generic-parameter/issue-5997-struct.rs", "ui/issues/issue-60218.rs", "ui/issues/issue-60622.rs", "ui/issues/issue-60989.rs", @@ -2599,7 +2587,6 @@ "ui/issues/issue-65230.rs", "ui/issues/issue-65462.rs", "ui/issues/issue-6557.rs", -"ui/issues/issue-6596-2.rs", "ui/issues/issue-66308.rs", "ui/issues/issue-66353.rs", "ui/issues/issue-66667-function-cmp-cycle.rs", @@ -2673,7 +2660,6 @@ "ui/issues/issue-78957.rs", "ui/issues/issue-7899.rs", "ui/issues/issue-7911.rs", -"ui/issues/issue-7950.rs", "ui/issues/issue-7970a.rs", "ui/issues/issue-8044.rs", "ui/issues/issue-80607.rs", @@ -2851,8 +2837,8 @@ "ui/lint/unused/issue-103320-must-use-ops.rs", "ui/lint/unused/issue-104397.rs", "ui/lint/unused/issue-105061-array-lint.rs", -"ui/lint/unused/issue-105061-should-lint.rs", "ui/lint/unused/issue-105061.rs", +"ui/lint/unused/issue-105061-should-lint.rs", "ui/lint/unused/issue-117142-invalid-remove-parens.rs", "ui/lint/unused/issue-117284-arg-in-macro.rs", "ui/lint/unused/issue-119383-if-let-guard.rs", @@ -2874,9 +2860,10 @@ "ui/lint/unused/issue-92751.rs", "ui/lint/unused/issue-96606.rs", "ui/lint/use-redundant/issue-92904.rs", +"ui/loops/issue-43162.rs", "ui/loops/issue-50576.rs", -"ui/loops/issue-69225-SCEVAddExpr-wrap-flag.rs", "ui/loops/issue-69225-layout-repeated-checked-add.rs", +"ui/loops/issue-69225-SCEVAddExpr-wrap-flag.rs", "ui/loops/issue-82916.rs", "ui/lowering/issue-121108.rs", "ui/lowering/issue-96847.rs", @@ -2911,6 +2898,7 @@ "ui/macros/issue-2804-2.rs", "ui/macros/issue-2804.rs", "ui/macros/issue-29084.rs", +"ui/macros/issue-30007.rs", "ui/macros/issue-30143.rs", "ui/macros/issue-33185.rs", "ui/macros/issue-34171.rs", @@ -2942,6 +2930,7 @@ "ui/macros/issue-61053-unbound.rs", "ui/macros/issue-63102.rs", "ui/macros/issue-6596-1.rs", +"ui/macros/issue-6596-2.rs", "ui/macros/issue-68058.rs", "ui/macros/issue-68060.rs", "ui/macros/issue-69396-const-no-type-in-macro.rs", @@ -2990,6 +2979,8 @@ "ui/match/issue-26996.rs", "ui/match/issue-27021.rs", "ui/match/issue-33498.rs", +"ui/match/issue-36401.rs", +"ui/match/issue-37598.rs", "ui/match/issue-42679.rs", "ui/match/issue-46920-byte-array-patterns.rs", "ui/match/issue-5530.rs", @@ -3003,7 +2994,9 @@ "ui/match/issue-84434.rs", "ui/match/issue-91058.rs", "ui/match/issue-92100.rs", +"ui/methods/issue-19521.rs", "ui/methods/issue-3707.rs", +"ui/methods/issue-7950.rs", "ui/methods/issues/issue-105732.rs", "ui/methods/issues/issue-61525.rs", "ui/methods/issues/issue-84495.rs", @@ -3023,6 +3016,7 @@ "ui/mir/issue-29227.rs", "ui/mir/issue-46845.rs", "ui/mir/issue-60390.rs", +"ui/mir/issue66339.rs", "ui/mir/issue-66851.rs", "ui/mir/issue-66930.rs", "ui/mir/issue-67639-normalization-ice.rs", @@ -3049,7 +3043,6 @@ "ui/mir/issue-92893.rs", "ui/mir/issue-99852.rs", "ui/mir/issue-99866.rs", -"ui/mir/issue66339.rs", "ui/mir/validate/issue-95978-validator-lifetime-comparison.rs", "ui/mismatched_types/issue-106182.rs", "ui/mismatched_types/issue-112036.rs", @@ -3060,10 +3053,10 @@ "ui/mismatched_types/issue-26480.rs", "ui/mismatched_types/issue-35030.rs", "ui/mismatched_types/issue-36053-2.rs", -"ui/mismatched_types/issue-38371-unfixable.rs", "ui/mismatched_types/issue-38371.rs", -"ui/mismatched_types/issue-47706-trait.rs", +"ui/mismatched_types/issue-38371-unfixable.rs", "ui/mismatched_types/issue-47706.rs", +"ui/mismatched_types/issue-47706-trait.rs", "ui/mismatched_types/issue-74918-missing-lifetime.rs", "ui/mismatched_types/issue-75361-mismatched-impl.rs", "ui/mismatched_types/issue-84976.rs", @@ -3421,8 +3414,8 @@ "ui/parser/issues/issue-73568-lifetime-after-mut.rs", "ui/parser/issues/issue-75599.rs", "ui/parser/issues/issue-76437-async.rs", -"ui/parser/issues/issue-76437-const-async-unsafe.rs", "ui/parser/issues/issue-76437-const-async.rs", +"ui/parser/issues/issue-76437-const-async-unsafe.rs", "ui/parser/issues/issue-76437-const.rs", "ui/parser/issues/issue-76437-pub-crate-unsafe.rs", "ui/parser/issues/issue-76437-unsafe.rs", @@ -3568,10 +3561,16 @@ "ui/privacy/issue-57264-2.rs", "ui/privacy/issue-75062-fieldless-tuple-struct.rs", "ui/privacy/issue-75906.rs", -"ui/privacy/issue-75907.rs", "ui/privacy/issue-75907_b.rs", +"ui/privacy/issue-75907.rs", "ui/privacy/issue-79593.rs", "ui/privacy/issue-92755.rs", +"ui/process/issue-13304.rs", +"ui/process/issue-14456.rs", +"ui/process/issue-14940.rs", +"ui/process/issue-16272.rs", +"ui/process/issue-20091.rs", +"ui/process/issue-30490.rs", "ui/proc-macro/auxiliary/issue-104884.rs", "ui/proc-macro/auxiliary/issue-107113.rs", "ui/proc-macro/auxiliary/issue-118809.rs", @@ -3620,13 +3619,8 @@ "ui/proc-macro/issue-86781-bad-inner-doc.rs", "ui/proc-macro/issue-89566-suggest-fix-invalid-top-level-macro-attr.rs", "ui/proc-macro/issue-91800.rs", -"ui/process/issue-13304.rs", -"ui/process/issue-14456.rs", -"ui/process/issue-14940.rs", -"ui/process/issue-16272.rs", -"ui/process/issue-20091.rs", -"ui/ptr_ops/issue-80309-safe.rs", "ui/ptr_ops/issue-80309.rs", +"ui/ptr_ops/issue-80309-safe.rs", "ui/pub/issue-33174-restricted-type-in-public-interface.rs", "ui/query-system/issue-83479.rs", "ui/range/issue-54505-no-literals.rs", @@ -3704,8 +3698,8 @@ "ui/resolve/issue-21221-3.rs", "ui/resolve/issue-21221-4.rs", "ui/resolve/issue-22692.rs", -"ui/resolve/issue-2330.rs", "ui/resolve/issue-23305.rs", +"ui/resolve/issue-2330.rs", "ui/resolve/issue-2356.rs", "ui/resolve/issue-23716.rs", "ui/resolve/issue-24968.rs", @@ -3826,6 +3820,10 @@ "ui/span/issue-25199.rs", "ui/span/issue-26656.rs", "ui/span/issue-27522.rs", +"ui/span/issue28498-reject-ex1.rs", +"ui/span/issue28498-reject-lifetime-param.rs", +"ui/span/issue28498-reject-passed-to-fn.rs", +"ui/span/issue28498-reject-trait-bound.rs", "ui/span/issue-29106.rs", "ui/span/issue-29595.rs", "ui/span/issue-33884.rs", @@ -3840,10 +3838,6 @@ "ui/span/issue-43927-non-ADT-derive.rs", "ui/span/issue-71363.rs", "ui/span/issue-81800.rs", -"ui/span/issue28498-reject-ex1.rs", -"ui/span/issue28498-reject-lifetime-param.rs", -"ui/span/issue28498-reject-passed-to-fn.rs", -"ui/span/issue28498-reject-trait-bound.rs", "ui/specialization/issue-111232.rs", "ui/specialization/issue-33017.rs", "ui/specialization/issue-35376.rs", @@ -3873,6 +3867,7 @@ "ui/static/auxiliary/issue_24843.rs", "ui/static/issue-18118-2.rs", "ui/static/issue-18118.rs", +"ui/static/issue-24446.rs", "ui/static/issue-24843.rs", "ui/static/issue-34194.rs", "ui/static/issue-5216.rs", @@ -3885,6 +3880,7 @@ "ui/statics/issue-44373.rs", "ui/statics/issue-91050-1.rs", "ui/statics/issue-91050-2.rs", +"ui/std/issue-3563-3.rs", "ui/std/issue-81357-unsound-file-methods.rs", "ui/stdlib-unit-tests/issue-21058.rs", "ui/structs-enums/enum-rec/issue-17431-6.rs", @@ -4042,9 +4038,11 @@ "ui/traits/issue-105231.rs", "ui/traits/issue-106072.rs", "ui/traits/issue-117794.rs", +"ui/traits/issue-15155.rs", "ui/traits/issue-18400.rs", "ui/traits/issue-18412.rs", "ui/traits/issue-20692.rs", +"ui/traits/issue-21837.rs", "ui/traits/issue-22019.rs", "ui/traits/issue-22110.rs", "ui/traits/issue-22384.rs", @@ -4059,12 +4057,14 @@ "ui/traits/issue-33096.rs", "ui/traits/issue-33140-hack-boundaries.rs", "ui/traits/issue-33140.rs", +"ui/traits/issue-33187.rs", "ui/traits/issue-35869.rs", "ui/traits/issue-3683.rs", "ui/traits/issue-38033.rs", "ui/traits/issue-38404.rs", "ui/traits/issue-38604.rs", "ui/traits/issue-3973.rs", +"ui/traits/issue-3979-generics.rs", "ui/traits/issue-40085.rs", "ui/traits/issue-4107.rs", "ui/traits/issue-43132.rs", @@ -4124,8 +4124,8 @@ "ui/traits/object/issue-44454-3.rs", "ui/traits/suggest-dereferences/issue-39029.rs", "ui/traits/suggest-dereferences/issue-62530.rs", -"ui/traits/trait-upcasting/issue-11515-upcast-fn_mut-fn.rs", "ui/traits/trait-upcasting/issue-11515.rs", +"ui/traits/trait-upcasting/issue-11515-upcast-fn_mut-fn.rs", "ui/traits/vtable/issue-91807.rs", "ui/traits/vtable/issue-97381.rs", "ui/transmutability/arrays/issue-103783-array-length.rs", @@ -4163,8 +4163,8 @@ "ui/type-alias-impl-trait/issue-58951.rs", "ui/type-alias-impl-trait/issue-60371.rs", "ui/type-alias-impl-trait/issue-60407.rs", -"ui/type-alias-impl-trait/issue-60564-working.rs", "ui/type-alias-impl-trait/issue-60564.rs", +"ui/type-alias-impl-trait/issue-60564-working.rs", "ui/type-alias-impl-trait/issue-60662.rs", "ui/type-alias-impl-trait/issue-62000-associate-impl-trait-lifetimes.rs", "ui/type-alias-impl-trait/issue-63263-closure-return.rs", @@ -4208,26 +4208,10 @@ "ui/type-alias/issue-62263-self-in-atb.rs", "ui/type-alias/issue-62305-self-assoc-ty.rs", "ui/type-alias/issue-62364-self-ty-arg.rs", -"ui/type-inference/issue-113283-alllocator-trait-eq.rs", -"ui/type-inference/issue-30225.rs", "ui/type/ascription/issue-34255-1.rs", "ui/type/ascription/issue-47666.rs", "ui/type/ascription/issue-54516.rs", "ui/type/ascription/issue-60933.rs", -"ui/type/issue-100584.rs", -"ui/type/issue-101866.rs", -"ui/type/issue-102598.rs", -"ui/type/issue-103271.rs", -"ui/type/issue-58355.rs", -"ui/type/issue-67690-type-alias-bound-diagnostic-crash.rs", -"ui/type/issue-91268.rs", -"ui/type/issue-94187-verbose-type-name.rs", -"ui/type/type-check/issue-116967-cannot-coerce-returned-result.rs", -"ui/type/type-check/issue-22897.rs", -"ui/type/type-check/issue-40294.rs", -"ui/type/type-check/issue-41314.rs", -"ui/type/type-check/issue-67273-assignment-match-prior-arm-bool-expected-unit.rs", -"ui/type/type-check/issue-88577-check-fn-with-more-than-65535-arguments.rs", "ui/typeck/auxiliary/issue-29181.rs", "ui/typeck/auxiliary/issue-36708.rs", "ui/typeck/auxiliary/issue-81943-lib.rs", @@ -4332,9 +4316,25 @@ "ui/typeck/issue-96738.rs", "ui/typeck/issue-98260.rs", "ui/typeck/issue-98982.rs", +"ui/type-inference/issue-113283-alllocator-trait-eq.rs", +"ui/type-inference/issue-30225.rs", +"ui/type/issue-100584.rs", +"ui/type/issue-101866.rs", +"ui/type/issue-102598.rs", +"ui/type/issue-103271.rs", +"ui/type/issue-58355.rs", +"ui/type/issue-67690-type-alias-bound-diagnostic-crash.rs", +"ui/type/issue-91268.rs", +"ui/type/issue-94187-verbose-type-name.rs", "ui/typeof/issue-100183.rs", "ui/typeof/issue-29184.rs", "ui/typeof/issue-42060.rs", +"ui/type/type-check/issue-116967-cannot-coerce-returned-result.rs", +"ui/type/type-check/issue-22897.rs", +"ui/type/type-check/issue-40294.rs", +"ui/type/type-check/issue-41314.rs", +"ui/type/type-check/issue-67273-assignment-match-prior-arm-bool-expected-unit.rs", +"ui/type/type-check/issue-88577-check-fn-with-more-than-65535-arguments.rs", "ui/unboxed-closures/issue-18652.rs", "ui/unboxed-closures/issue-18661.rs", "ui/unboxed-closures/issue-30906.rs", @@ -4355,11 +4355,6 @@ "ui/unsafe/issue-47412.rs", "ui/unsafe/issue-85435-unsafe-op-in-let-under-unsafe-under-closure.rs", "ui/unsafe/issue-87414-query-cycle.rs", -"ui/unsized-locals/issue-30276-feature-flagged.rs", -"ui/unsized-locals/issue-30276.rs", -"ui/unsized-locals/issue-50940-with-feature.rs", -"ui/unsized-locals/issue-50940.rs", -"ui/unsized-locals/issue-67981.rs", "ui/unsized/issue-115203.rs", "ui/unsized/issue-115809.rs", "ui/unsized/issue-30355.rs", @@ -4372,6 +4367,11 @@ "ui/unsized/issue-91801.rs", "ui/unsized/issue-91803.rs", "ui/unsized/issue-97732.rs", +"ui/unsized-locals/issue-30276-feature-flagged.rs", +"ui/unsized-locals/issue-30276.rs", +"ui/unsized-locals/issue-50940.rs", +"ui/unsized-locals/issue-50940-with-feature.rs", +"ui/unsized-locals/issue-67981.rs", "ui/use/issue-18986.rs", "ui/use/issue-60976-extern-use-primitive-type.rs", "ui/wf/issue-103573.rs", diff --git a/src/tools/tidy/src/ui_tests.rs b/src/tools/tidy/src/ui_tests.rs index e35f3f05d66..a9c5be913ba 100644 --- a/src/tools/tidy/src/ui_tests.rs +++ b/src/tools/tidy/src/ui_tests.rs @@ -17,7 +17,7 @@ use std::path::{Path, PathBuf}; const ENTRY_LIMIT: usize = 900; // FIXME: The following limits should be reduced eventually. -const ISSUES_ENTRY_LIMIT: usize = 1781; +const ISSUES_ENTRY_LIMIT: usize = 1750; const ROOT_ENTRY_LIMIT: usize = 872; const EXPECTED_TEST_FILE_EXTENSIONS: &[&str] = &[ diff --git a/tests/codegen/align-struct.rs b/tests/codegen/align-struct.rs index 34475a3852b..31859152830 100644 --- a/tests/codegen/align-struct.rs +++ b/tests/codegen/align-struct.rs @@ -26,7 +26,6 @@ pub enum Enum64 { B(i32), } // CHECK: %Enum64 = type { i32, [31 x i32] } -// CHECK: %"Enum64::A" = type { [8 x i64], %Align64 } // CHECK-LABEL: @align64 #[no_mangle] diff --git a/tests/codegen/i128-x86-align.rs b/tests/codegen/i128-x86-align.rs index 9cc5c3d3ed7..b2e0c294c39 100644 --- a/tests/codegen/i128-x86-align.rs +++ b/tests/codegen/i128-x86-align.rs @@ -94,9 +94,9 @@ pub fn store_struct(x: &mut Struct) { // CHECK-SAME: align 16 dereferenceable(32) %x // CHECK: [[TMP:%.*]] = alloca %Struct, align 16 // CHECK: store i32 1, ptr [[TMP]], align 16 - // CHECK-NEXT: [[GEP1:%.*]] = getelementptr inbounds %Struct, ptr [[TMP]], i32 0, i32 1 + // CHECK-NEXT: [[GEP1:%.*]] = getelementptr inbounds i8, ptr [[TMP]], i64 4 // CHECK-NEXT: store i32 2, ptr [[GEP1]], align 4 - // CHECK-NEXT: [[GEP2:%.*]] = getelementptr inbounds %Struct, ptr [[TMP]], i32 0, i32 3 + // CHECK-NEXT: [[GEP2:%.*]] = getelementptr inbounds i8, ptr [[TMP]], i64 16 // CHECK-NEXT: store i128 3, ptr [[GEP2]], align 16 // CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 16 %x, ptr align 16 [[TMP]], i64 32, i1 false) *x = Struct { a: 1, b: 2, c: 3 }; diff --git a/tests/codegen/issues/issue-105386-ub-in-debuginfo.rs b/tests/codegen/issues/issue-105386-ub-in-debuginfo.rs index 476db7c1358..0bd43dc50b2 100644 --- a/tests/codegen/issues/issue-105386-ub-in-debuginfo.rs +++ b/tests/codegen/issues/issue-105386-ub-in-debuginfo.rs @@ -16,8 +16,8 @@ pub fn outer_function(x: S, y: S) -> usize { // when generating debuginfo. // CHECK-LABEL: @outer_function // CHECK: [[spill:%.*]] = alloca %"{closure@{{.*.rs}}:9:23: 9:25}" -// CHECK-NOT: [[ptr_tmp:%.*]] = getelementptr inbounds %"{closure@{{.*.rs}}:9:23: 9:25}", ptr [[spill]] +// CHECK-NOT: [[ptr_tmp:%.*]] = getelementptr inbounds i8, ptr [[spill]] // CHECK-NOT: [[load:%.*]] = load ptr, ptr // CHECK: call void @llvm.lifetime.start{{.*}}({{.*}}, ptr [[spill]]) -// CHECK: [[inner:%.*]] = getelementptr inbounds %"{{.*}}", ptr [[spill]] +// CHECK: [[inner:%.*]] = getelementptr inbounds i8, ptr [[spill]] // CHECK: call void @llvm.memcpy{{.*}}(ptr {{align .*}} [[inner]], ptr {{align .*}} %x diff --git a/tests/codegen/issues/issue-121719-common-field-offset.rs b/tests/codegen/issues/issue-121719-common-field-offset.rs new file mode 100644 index 00000000000..11a8aa8dcd1 --- /dev/null +++ b/tests/codegen/issues/issue-121719-common-field-offset.rs @@ -0,0 +1,44 @@ +//! This test checks that match branches which all access a field +//! at the same offset are merged together. +//! +//@ compile-flags: -O +#![crate_type = "lib"] + +#[repr(C)] +pub struct A { + x: f64, + y: u64, +} +#[repr(C)] +pub struct B { + x: f64, + y: u32, +} +#[repr(C)] +pub struct C { + x: f64, + y: u16, +} +#[repr(C)] +pub struct D { + x: f64, + y: u8, +} + +pub enum E { + A(A), + B(B), + C(C), + D(D), +} + +// CHECK-LABEL: @match_on_e +#[no_mangle] +pub fn match_on_e(e: &E) -> &f64 { + // CHECK: start: + // CHECK-NEXT: getelementptr + // CHECK-NEXT: ret + match e { + E::A(A { x, .. }) | E::B(B { x, .. }) | E::C(C { x, .. }) | E::D(D { x, .. }) => x, + } +} diff --git a/tests/codegen/zst-offset.rs b/tests/codegen/zst-offset.rs index ad996d8ae1b..65d9cf39c4c 100644 --- a/tests/codegen/zst-offset.rs +++ b/tests/codegen/zst-offset.rs @@ -22,7 +22,7 @@ pub fn scalar_layout(s: &(u64, ())) { // CHECK-LABEL: @scalarpair_layout #[no_mangle] pub fn scalarpair_layout(s: &(u64, u32, ())) { -// CHECK: getelementptr inbounds i8, {{.+}}, [[USIZE]] 12 +// CHECK: getelementptr i8, {{.+}}, [[USIZE]] 12 let x = &s.2; witness(&x); // keep variable in an alloca } diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_cxx_global_asm.checks b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_cxx_global_asm.checks index d4a3d447901..1d8fc96ad50 100644 --- a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_cxx_global_asm.checks +++ b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_cxx_global_asm.checks @@ -1,2 +1,7 @@ CHECK: cmake_plus_one_cxx_global_asm -CHECK: lfence +CHECK-NEXT: movl +CHECK-NEXT: lfence +CHECK-NEXT: incl +CHECK-NEXT: shlq $0x0, (%rsp) +CHECK-NEXT: lfence +CHECK-NEXT: retq diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/print.with_frame_pointers.checks b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/print.with_frame_pointers.checks new file mode 100644 index 00000000000..485e20e3111 --- /dev/null +++ b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/print.with_frame_pointers.checks @@ -0,0 +1,7 @@ +CHECK: print +CHECK: lfence +CHECK: popq +CHECK: popq +CHECK-NEXT: popq [[REGISTER:%[a-z]+]] +CHECK-NEXT: lfence +CHECK-NEXT: jmpq *[[REGISTER]] diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/print.checks b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/print.without_frame_pointers.checks index e02fe094889..e02fe094889 100644 --- a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/print.checks +++ b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/print.without_frame_pointers.checks diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/script.sh b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/script.sh index 04a34724518..a36ad916beb 100644 --- a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/script.sh +++ b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/script.sh @@ -34,8 +34,9 @@ function check { ${enclave} > ${asm} ${filecheck} --input-file ${asm} ${checks} - if [ "${func_re}" != "rust_plus_one_global_asm" && - "${func_re}" != "cmake_plus_one_c_global_asm" ]; then + if [ "${func_re}" != "rust_plus_one_global_asm" ] && + [ "${func_re}" != "cmake_plus_one_c_global_asm" ] && + [ "${func_re}" != "cmake_plus_one_cxx_global_asm" ]; then # The assembler cannot avoid explicit `ret` instructions. Sequences # of `shlq $0x0, (%rsp); lfence; retq` are used instead. # https://www.intel.com/content/www/us/en/developer/articles/technical/ @@ -48,7 +49,8 @@ build check "unw_getcontext" unw_getcontext.checks check "__libunwind_Registers_x86_64_jumpto" jumpto.checks -check 'std::io::stdio::_print::[[:alnum:]]+' print.checks +check 'std::io::stdio::_print::[[:alnum:]]+' print.with_frame_pointers.checks || + check 'std::io::stdio::_print::[[:alnum:]]+' print.without_frame_pointers.checks check rust_plus_one_global_asm rust_plus_one_global_asm.checks check cc_plus_one_c cc_plus_one_c.checks diff --git a/tests/ui-fulldeps/hash-stable-is-unstable.rs b/tests/ui-fulldeps/hash-stable-is-unstable.rs index 3f280ec0a60..e5d158a2661 100644 --- a/tests/ui-fulldeps/hash-stable-is-unstable.rs +++ b/tests/ui-fulldeps/hash-stable-is-unstable.rs @@ -1,4 +1,3 @@ -//@ ignore-stage1 //@ compile-flags: -Zdeduplicate-diagnostics=yes extern crate rustc_data_structures; //~^ use of unstable library feature 'rustc_private' diff --git a/tests/ui-fulldeps/hash-stable-is-unstable.stderr b/tests/ui-fulldeps/hash-stable-is-unstable.stderr index 818bdaedcca..c9aac624cbb 100644 --- a/tests/ui-fulldeps/hash-stable-is-unstable.stderr +++ b/tests/ui-fulldeps/hash-stable-is-unstable.stderr @@ -1,5 +1,5 @@ error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? - --> $DIR/hash-stable-is-unstable.rs:3:1 + --> $DIR/hash-stable-is-unstable.rs:2:1 | LL | extern crate rustc_data_structures; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -9,7 +9,7 @@ LL | extern crate rustc_data_structures; = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? - --> $DIR/hash-stable-is-unstable.rs:7:1 + --> $DIR/hash-stable-is-unstable.rs:6:1 | LL | extern crate rustc_macros; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -19,7 +19,7 @@ LL | extern crate rustc_macros; = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? - --> $DIR/hash-stable-is-unstable.rs:11:1 + --> $DIR/hash-stable-is-unstable.rs:10:1 | LL | extern crate rustc_query_system; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -29,7 +29,7 @@ LL | extern crate rustc_query_system; = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? - --> $DIR/hash-stable-is-unstable.rs:16:5 + --> $DIR/hash-stable-is-unstable.rs:15:5 | LL | use rustc_macros::HashStable; | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -39,7 +39,7 @@ LL | use rustc_macros::HashStable; = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? - --> $DIR/hash-stable-is-unstable.rs:21:10 + --> $DIR/hash-stable-is-unstable.rs:20:10 | LL | #[derive(HashStable)] | ^^^^^^^^^^ diff --git a/tests/ui-fulldeps/pathless-extern-unstable.rs b/tests/ui-fulldeps/pathless-extern-unstable.rs index 8ef8761d5a2..2da1a7f0ddc 100644 --- a/tests/ui-fulldeps/pathless-extern-unstable.rs +++ b/tests/ui-fulldeps/pathless-extern-unstable.rs @@ -1,5 +1,4 @@ //@ edition:2018 -//@ ignore-stage1 //@ compile-flags:--extern rustc_middle // Test that `--extern rustc_middle` fails with `rustc_private`. diff --git a/tests/ui-fulldeps/pathless-extern-unstable.stderr b/tests/ui-fulldeps/pathless-extern-unstable.stderr index d13a0079213..36e56adfdbd 100644 --- a/tests/ui-fulldeps/pathless-extern-unstable.stderr +++ b/tests/ui-fulldeps/pathless-extern-unstable.stderr @@ -1,5 +1,5 @@ error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? - --> $DIR/pathless-extern-unstable.rs:7:9 + --> $DIR/pathless-extern-unstable.rs:6:9 | LL | pub use rustc_middle; | ^^^^^^^^^^^^ diff --git a/tests/ui/issues/issue-26262.rs b/tests/ui/associated-types/issue-26262.rs index 41135db9104..41135db9104 100644 --- a/tests/ui/issues/issue-26262.rs +++ b/tests/ui/associated-types/issue-26262.rs diff --git a/tests/ui/issues/issue-26262.stderr b/tests/ui/associated-types/issue-26262.stderr index 90e2d0d9301..90e2d0d9301 100644 --- a/tests/ui/issues/issue-26262.stderr +++ b/tests/ui/associated-types/issue-26262.stderr diff --git a/tests/ui/attributes/arg-error-issue-121425.rs b/tests/ui/attributes/arg-error-issue-121425.rs new file mode 100644 index 00000000000..c15b276ad4e --- /dev/null +++ b/tests/ui/attributes/arg-error-issue-121425.rs @@ -0,0 +1,32 @@ +//@ compile-flags: -Zdeduplicate-diagnostics=yes + +const N: usize = 8; +#[repr(align(N))] +//~^ ERROR: incorrect `repr(align)` attribute format +struct T; + +#[repr(align('a'))] +//~^ ERROR: invalid `repr(align)` attribute: not an unsuffixed integer [E0589] +struct H; + +#[repr(align("str"))] +//~^ ERROR: invalid `repr(align)` attribute: not an unsuffixed integer [E0589] +struct L; + +#[repr(align())] +//~^ ERROR: attribute format: `align` takes exactly one argument in parentheses +struct X; + +const P: usize = 8; +#[repr(packed(P))] +//~^ ERROR: attribute format: `packed` expects a literal integer as argument +struct A; + +#[repr(packed())] +//~^ ERROR: attribute format: `packed` takes exactly one parenthesized argument, or no parentheses at all +struct B; + +#[repr(packed)] +struct C; + +fn main() {} diff --git a/tests/ui/attributes/arg-error-issue-121425.stderr b/tests/ui/attributes/arg-error-issue-121425.stderr new file mode 100644 index 00000000000..1beb99b1703 --- /dev/null +++ b/tests/ui/attributes/arg-error-issue-121425.stderr @@ -0,0 +1,40 @@ +error[E0693]: incorrect `repr(align)` attribute format: `align` expects a literal integer as argument + --> $DIR/arg-error-issue-121425.rs:4:14 + | +LL | #[repr(align(N))] + | ^ + +error[E0589]: invalid `repr(align)` attribute: not an unsuffixed integer + --> $DIR/arg-error-issue-121425.rs:8:14 + | +LL | #[repr(align('a'))] + | ^^^ + +error[E0589]: invalid `repr(align)` attribute: not an unsuffixed integer + --> $DIR/arg-error-issue-121425.rs:12:14 + | +LL | #[repr(align("str"))] + | ^^^^^ + +error[E0693]: incorrect `repr(align)` attribute format: `align` takes exactly one argument in parentheses + --> $DIR/arg-error-issue-121425.rs:16:8 + | +LL | #[repr(align())] + | ^^^^^^^ + +error[E0552]: incorrect `repr(packed)` attribute format: `packed` expects a literal integer as argument + --> $DIR/arg-error-issue-121425.rs:21:15 + | +LL | #[repr(packed(P))] + | ^ + +error[E0552]: incorrect `repr(packed)` attribute format: `packed` takes exactly one parenthesized argument, or no parentheses at all + --> $DIR/arg-error-issue-121425.rs:25:8 + | +LL | #[repr(packed())] + | ^^^^^^^^ + +error: aborting due to 6 previous errors + +Some errors have detailed explanations: E0552, E0589, E0693. +For more information about an error, try `rustc --explain E0552`. diff --git a/tests/ui/attributes/nonterminal-expansion.rs b/tests/ui/attributes/nonterminal-expansion.rs index 97bf225f0cc..6db7aea0745 100644 --- a/tests/ui/attributes/nonterminal-expansion.rs +++ b/tests/ui/attributes/nonterminal-expansion.rs @@ -1,10 +1,11 @@ +//@ compile-flags: -Zdeduplicate-diagnostics=yes + // Macros were previously expanded in `Expr` nonterminal tokens, now they are not. macro_rules! pass_nonterminal { ($n:expr) => { #[repr(align($n))] //~^ ERROR expected unsuffixed literal or identifier, found `n!()` - //~| ERROR incorrect `repr(align)` attribute format struct S; }; } @@ -14,5 +15,6 @@ macro_rules! n { } pass_nonterminal!(n!()); +//~^ ERROR incorrect `repr(align)` attribute format: `align` expects a literal integer as argument [E0693] fn main() {} diff --git a/tests/ui/attributes/nonterminal-expansion.stderr b/tests/ui/attributes/nonterminal-expansion.stderr index 52376ac1911..78541495b32 100644 --- a/tests/ui/attributes/nonterminal-expansion.stderr +++ b/tests/ui/attributes/nonterminal-expansion.stderr @@ -1,5 +1,5 @@ error: expected unsuffixed literal or identifier, found `n!()` - --> $DIR/nonterminal-expansion.rs:5:22 + --> $DIR/nonterminal-expansion.rs:7:22 | LL | #[repr(align($n))] | ^^ @@ -9,16 +9,11 @@ LL | pass_nonterminal!(n!()); | = note: this error originates in the macro `pass_nonterminal` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0693]: incorrect `repr(align)` attribute format: `align` takes exactly one argument in parentheses - --> $DIR/nonterminal-expansion.rs:5:16 +error[E0693]: incorrect `repr(align)` attribute format: `align` expects a literal integer as argument + --> $DIR/nonterminal-expansion.rs:17:19 | -LL | #[repr(align($n))] - | ^^^^^^^^^ -... LL | pass_nonterminal!(n!()); - | ----------------------- in this macro invocation - | - = note: this error originates in the macro `pass_nonterminal` (in Nightly builds, run with -Z macro-backtrace for more info) + | ^ error: aborting due to 2 previous errors diff --git a/tests/ui/issues/issue-27859.rs b/tests/ui/codegen/issue-27859.rs index 4b4d2d28575..4b4d2d28575 100644 --- a/tests/ui/issues/issue-27859.rs +++ b/tests/ui/codegen/issue-27859.rs diff --git a/tests/ui/issues/issue-18738.rs b/tests/ui/deriving/issue-18738.rs index d3e0965e545..d3e0965e545 100644 --- a/tests/ui/issues/issue-18738.rs +++ b/tests/ui/deriving/issue-18738.rs diff --git a/tests/ui/issues/issue-23611-enum-swap-in-drop.rs b/tests/ui/drop/issue-23611-enum-swap-in-drop.rs index 1afaff0f735..1afaff0f735 100644 --- a/tests/ui/issues/issue-23611-enum-swap-in-drop.rs +++ b/tests/ui/drop/issue-23611-enum-swap-in-drop.rs diff --git a/tests/ui/issues/issue-23611-enum-swap-in-drop.stderr b/tests/ui/drop/issue-23611-enum-swap-in-drop.stderr index bdf46abea8a..bdf46abea8a 100644 --- a/tests/ui/issues/issue-23611-enum-swap-in-drop.stderr +++ b/tests/ui/drop/issue-23611-enum-swap-in-drop.stderr diff --git a/tests/ui/issues/issue-5153.rs b/tests/ui/dyn-keyword/issue-5153.rs index 5bf0579030a..5bf0579030a 100644 --- a/tests/ui/issues/issue-5153.rs +++ b/tests/ui/dyn-keyword/issue-5153.rs diff --git a/tests/ui/issues/issue-5153.stderr b/tests/ui/dyn-keyword/issue-5153.stderr index 53c140b5b6d..53c140b5b6d 100644 --- a/tests/ui/issues/issue-5153.stderr +++ b/tests/ui/dyn-keyword/issue-5153.stderr diff --git a/tests/ui/feature-gates/feature-gate-pattern-complexity.rs b/tests/ui/feature-gates/feature-gate-pattern-complexity.rs new file mode 100644 index 00000000000..43e9a00c9a7 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-pattern-complexity.rs @@ -0,0 +1,6 @@ +// check that `pattern_complexity` is feature-gated + +#![pattern_complexity = "42"] +//~^ ERROR: the `#[pattern_complexity]` attribute is just used for rustc unit tests + +fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-pattern-complexity.stderr b/tests/ui/feature-gates/feature-gate-pattern-complexity.stderr new file mode 100644 index 00000000000..c05e6abb017 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-pattern-complexity.stderr @@ -0,0 +1,12 @@ +error[E0658]: the `#[pattern_complexity]` attribute is just used for rustc unit tests and will never be stable + --> $DIR/feature-gate-pattern-complexity.rs:3:1 + | +LL | #![pattern_complexity = "42"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add `#![feature(rustc_attrs)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/issues/issue-3743.rs b/tests/ui/inference/issue-3743.rs index 575445661af..575445661af 100644 --- a/tests/ui/issues/issue-3743.rs +++ b/tests/ui/inference/issue-3743.rs diff --git a/tests/ui/lint/lint-non-snake-case-crate-2.stderr b/tests/ui/lint/lint-non-snake-case-crate-2.stderr deleted file mode 100644 index f3207226cd9..00000000000 --- a/tests/ui/lint/lint-non-snake-case-crate-2.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error: crate `NonSnakeCase` should have a snake case name - | - = help: convert the identifier to snake case: `non_snake_case` -note: the lint level is defined here - --> $DIR/lint-non-snake-case-crate-2.rs:4:9 - | -LL | #![deny(non_snake_case)] - | ^^^^^^^^^^^^^^ - -error: aborting due to 1 previous error - diff --git a/tests/ui/lint/lint-non-snake-case-crate-bin.rs b/tests/ui/lint/lint-non-snake-case-crate-bin.rs new file mode 100644 index 00000000000..f8aad88ecee --- /dev/null +++ b/tests/ui/lint/lint-non-snake-case-crate-bin.rs @@ -0,0 +1,7 @@ +//@ only-x86_64-unknown-linux-gnu +//@ check-pass +#![crate_name = "NonSnakeCase"] + +#![deny(non_snake_case)] + +fn main() {} diff --git a/tests/ui/lint/lint-non-snake-case-crate-2.rs b/tests/ui/lint/lint-non-snake-case-crate-bin2.rs index b4b816a5a57..c077d81e9e5 100644 --- a/tests/ui/lint/lint-non-snake-case-crate-2.rs +++ b/tests/ui/lint/lint-non-snake-case-crate-bin2.rs @@ -1,5 +1,6 @@ +//@ only-x86_64-unknown-linux-gnu //@ compile-flags: --crate-name NonSnakeCase -//@ error-pattern: crate `NonSnakeCase` should have a snake case name +//@ check-pass #![deny(non_snake_case)] diff --git a/tests/ui/lint/lint-non-snake-case-crate-bin3.rs b/tests/ui/lint/lint-non-snake-case-crate-bin3.rs new file mode 100644 index 00000000000..278f7cfd3ee --- /dev/null +++ b/tests/ui/lint/lint-non-snake-case-crate-bin3.rs @@ -0,0 +1,8 @@ +//@ only-x86_64-unknown-linux-gnu +//@ check-pass +#![crate_type = "bin"] +#![crate_name = "NonSnakeCase"] + +#![deny(non_snake_case)] + +fn main() {} diff --git a/tests/ui/lint/lint-non-snake-case-crate-cdylib.rs b/tests/ui/lint/lint-non-snake-case-crate-cdylib.rs new file mode 100644 index 00000000000..781c6794fc2 --- /dev/null +++ b/tests/ui/lint/lint-non-snake-case-crate-cdylib.rs @@ -0,0 +1,7 @@ +//@ only-x86_64-unknown-linux-gnu +#![crate_type = "cdylib"] +#![crate_name = "NonSnakeCase"] +//~^ ERROR crate `NonSnakeCase` should have a snake case name +#![deny(non_snake_case)] + +fn main() {} diff --git a/tests/ui/lint/lint-non-snake-case-crate-cdylib.stderr b/tests/ui/lint/lint-non-snake-case-crate-cdylib.stderr new file mode 100644 index 00000000000..f9167aa8df3 --- /dev/null +++ b/tests/ui/lint/lint-non-snake-case-crate-cdylib.stderr @@ -0,0 +1,14 @@ +error: crate `NonSnakeCase` should have a snake case name + --> $DIR/lint-non-snake-case-crate-cdylib.rs:3:18 + | +LL | #![crate_name = "NonSnakeCase"] + | ^^^^^^^^^^^^ help: convert the identifier to snake case: `non_snake_case` + | +note: the lint level is defined here + --> $DIR/lint-non-snake-case-crate-cdylib.rs:5:9 + | +LL | #![deny(non_snake_case)] + | ^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/lint/lint-non-snake-case-crate-dylib.rs b/tests/ui/lint/lint-non-snake-case-crate-dylib.rs new file mode 100644 index 00000000000..3f65295f068 --- /dev/null +++ b/tests/ui/lint/lint-non-snake-case-crate-dylib.rs @@ -0,0 +1,7 @@ +//@ only-x86_64-unknown-linux-gnu +#![crate_type = "dylib"] +#![crate_name = "NonSnakeCase"] +//~^ ERROR crate `NonSnakeCase` should have a snake case name +#![deny(non_snake_case)] + +fn main() {} diff --git a/tests/ui/lint/lint-non-snake-case-crate-dylib.stderr b/tests/ui/lint/lint-non-snake-case-crate-dylib.stderr new file mode 100644 index 00000000000..4ee1a9cb3dd --- /dev/null +++ b/tests/ui/lint/lint-non-snake-case-crate-dylib.stderr @@ -0,0 +1,14 @@ +error: crate `NonSnakeCase` should have a snake case name + --> $DIR/lint-non-snake-case-crate-dylib.rs:3:18 + | +LL | #![crate_name = "NonSnakeCase"] + | ^^^^^^^^^^^^ help: convert the identifier to snake case: `non_snake_case` + | +note: the lint level is defined here + --> $DIR/lint-non-snake-case-crate-dylib.rs:5:9 + | +LL | #![deny(non_snake_case)] + | ^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/lint/lint-non-snake-case-crate.rs b/tests/ui/lint/lint-non-snake-case-crate-lib.rs index e4e84261a4e..20c58e66aa6 100644 --- a/tests/ui/lint/lint-non-snake-case-crate.rs +++ b/tests/ui/lint/lint-non-snake-case-crate-lib.rs @@ -1,3 +1,5 @@ +//@ only-x86_64-unknown-linux-gnu +#![crate_type = "lib"] #![crate_name = "NonSnakeCase"] //~^ ERROR crate `NonSnakeCase` should have a snake case name #![deny(non_snake_case)] diff --git a/tests/ui/lint/lint-non-snake-case-crate.stderr b/tests/ui/lint/lint-non-snake-case-crate-lib.stderr index 1136b707d59..a68c0e832b8 100644 --- a/tests/ui/lint/lint-non-snake-case-crate.stderr +++ b/tests/ui/lint/lint-non-snake-case-crate-lib.stderr @@ -1,11 +1,11 @@ error: crate `NonSnakeCase` should have a snake case name - --> $DIR/lint-non-snake-case-crate.rs:1:18 + --> $DIR/lint-non-snake-case-crate-lib.rs:3:18 | LL | #![crate_name = "NonSnakeCase"] | ^^^^^^^^^^^^ help: convert the identifier to snake case: `non_snake_case` | note: the lint level is defined here - --> $DIR/lint-non-snake-case-crate.rs:3:9 + --> $DIR/lint-non-snake-case-crate-lib.rs:5:9 | LL | #![deny(non_snake_case)] | ^^^^^^^^^^^^^^ diff --git a/tests/ui/lint/lint-non-snake-case-crate-proc-macro.rs b/tests/ui/lint/lint-non-snake-case-crate-proc-macro.rs new file mode 100644 index 00000000000..f0f2fa4393e --- /dev/null +++ b/tests/ui/lint/lint-non-snake-case-crate-proc-macro.rs @@ -0,0 +1,7 @@ +//@ only-x86_64-unknown-linux-gnu +#![crate_type = "proc-macro"] +#![crate_name = "NonSnakeCase"] +//~^ ERROR crate `NonSnakeCase` should have a snake case name +#![deny(non_snake_case)] + +fn main() {} diff --git a/tests/ui/lint/lint-non-snake-case-crate-proc-macro.stderr b/tests/ui/lint/lint-non-snake-case-crate-proc-macro.stderr new file mode 100644 index 00000000000..e0091057bc9 --- /dev/null +++ b/tests/ui/lint/lint-non-snake-case-crate-proc-macro.stderr @@ -0,0 +1,14 @@ +error: crate `NonSnakeCase` should have a snake case name + --> $DIR/lint-non-snake-case-crate-proc-macro.rs:3:18 + | +LL | #![crate_name = "NonSnakeCase"] + | ^^^^^^^^^^^^ help: convert the identifier to snake case: `non_snake_case` + | +note: the lint level is defined here + --> $DIR/lint-non-snake-case-crate-proc-macro.rs:5:9 + | +LL | #![deny(non_snake_case)] + | ^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/lint/lint-non-snake-case-crate-rlib.rs b/tests/ui/lint/lint-non-snake-case-crate-rlib.rs new file mode 100644 index 00000000000..1a558def3d0 --- /dev/null +++ b/tests/ui/lint/lint-non-snake-case-crate-rlib.rs @@ -0,0 +1,7 @@ +//@ only-x86_64-unknown-linux-gnu +#![crate_type = "rlib"] +#![crate_name = "NonSnakeCase"] +//~^ ERROR crate `NonSnakeCase` should have a snake case name +#![deny(non_snake_case)] + +fn main() {} diff --git a/tests/ui/lint/lint-non-snake-case-crate-rlib.stderr b/tests/ui/lint/lint-non-snake-case-crate-rlib.stderr new file mode 100644 index 00000000000..6e9d54bd5bc --- /dev/null +++ b/tests/ui/lint/lint-non-snake-case-crate-rlib.stderr @@ -0,0 +1,14 @@ +error: crate `NonSnakeCase` should have a snake case name + --> $DIR/lint-non-snake-case-crate-rlib.rs:3:18 + | +LL | #![crate_name = "NonSnakeCase"] + | ^^^^^^^^^^^^ help: convert the identifier to snake case: `non_snake_case` + | +note: the lint level is defined here + --> $DIR/lint-non-snake-case-crate-rlib.rs:5:9 + | +LL | #![deny(non_snake_case)] + | ^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/lint/lint-non-snake-case-crate-staticlib.rs b/tests/ui/lint/lint-non-snake-case-crate-staticlib.rs new file mode 100644 index 00000000000..2ec53c15eb8 --- /dev/null +++ b/tests/ui/lint/lint-non-snake-case-crate-staticlib.rs @@ -0,0 +1,7 @@ +//@ only-x86_64-unknown-linux-gnu +#![crate_type = "staticlib"] +#![crate_name = "NonSnakeCase"] +//~^ ERROR crate `NonSnakeCase` should have a snake case name +#![deny(non_snake_case)] + +fn main() {} diff --git a/tests/ui/lint/lint-non-snake-case-crate-staticlib.stderr b/tests/ui/lint/lint-non-snake-case-crate-staticlib.stderr new file mode 100644 index 00000000000..4ee6d5bd4d4 --- /dev/null +++ b/tests/ui/lint/lint-non-snake-case-crate-staticlib.stderr @@ -0,0 +1,14 @@ +error: crate `NonSnakeCase` should have a snake case name + --> $DIR/lint-non-snake-case-crate-staticlib.rs:3:18 + | +LL | #![crate_name = "NonSnakeCase"] + | ^^^^^^^^^^^^ help: convert the identifier to snake case: `non_snake_case` + | +note: the lint level is defined here + --> $DIR/lint-non-snake-case-crate-staticlib.rs:5:9 + | +LL | #![deny(non_snake_case)] + | ^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/lint/lint-qualification.fixed b/tests/ui/lint/lint-qualification.fixed index 18d69ef1b53..ab450f8b734 100644 --- a/tests/ui/lint/lint-qualification.fixed +++ b/tests/ui/lint/lint-qualification.fixed @@ -1,6 +1,6 @@ //@ run-rustfix #![deny(unused_qualifications)] -#![allow(deprecated)] +#![allow(deprecated, dead_code)] mod foo { pub fn bar() {} @@ -9,13 +9,37 @@ mod foo { fn main() { use foo::bar; bar(); //~ ERROR: unnecessary qualification + bar(); //~ ERROR: unnecessary qualification bar(); let _ = || -> Result<(), ()> { try!(Ok(())); Ok(()) }; // issue #37345 - macro_rules! m { () => { + let _ = String::new(); //~ ERROR: unnecessary qualification + let _ = std::env::current_dir(); //~ ERROR: unnecessary qualification + + let _: Vec<String> = Vec::<String>::new(); + //~^ ERROR: unnecessary qualification + //~| ERROR: unnecessary qualification + + use std::fmt; + let _: fmt::Result = Ok(()); //~ ERROR: unnecessary qualification + + macro_rules! m { ($a:ident, $b:ident) => { $crate::foo::bar(); // issue #37357 ::foo::bar(); // issue #38682 + foo::bar(); + foo::$b(); // issue #96698 + $a::bar(); } } - m!(); + m!(foo, bar); +} + +mod conflicting_names { + mod std {} + mod cell {} + + fn f() { + let _ = ::std::env::current_dir(); + let _ = core::cell::Cell::new(1); + } } diff --git a/tests/ui/lint/lint-qualification.rs b/tests/ui/lint/lint-qualification.rs index 8cf3425db2f..84a36f509eb 100644 --- a/tests/ui/lint/lint-qualification.rs +++ b/tests/ui/lint/lint-qualification.rs @@ -1,6 +1,6 @@ //@ run-rustfix #![deny(unused_qualifications)] -#![allow(deprecated)] +#![allow(deprecated, dead_code)] mod foo { pub fn bar() {} @@ -9,13 +9,37 @@ mod foo { fn main() { use foo::bar; foo::bar(); //~ ERROR: unnecessary qualification + crate::foo::bar(); //~ ERROR: unnecessary qualification bar(); let _ = || -> Result<(), ()> { try!(Ok(())); Ok(()) }; // issue #37345 - macro_rules! m { () => { + let _ = std::string::String::new(); //~ ERROR: unnecessary qualification + let _ = ::std::env::current_dir(); //~ ERROR: unnecessary qualification + + let _: std::vec::Vec<String> = std::vec::Vec::<String>::new(); + //~^ ERROR: unnecessary qualification + //~| ERROR: unnecessary qualification + + use std::fmt; + let _: std::fmt::Result = Ok(()); //~ ERROR: unnecessary qualification + + macro_rules! m { ($a:ident, $b:ident) => { $crate::foo::bar(); // issue #37357 ::foo::bar(); // issue #38682 + foo::bar(); + foo::$b(); // issue #96698 + $a::bar(); } } - m!(); + m!(foo, bar); +} + +mod conflicting_names { + mod std {} + mod cell {} + + fn f() { + let _ = ::std::env::current_dir(); + let _ = core::cell::Cell::new(1); + } } diff --git a/tests/ui/lint/lint-qualification.stderr b/tests/ui/lint/lint-qualification.stderr index 2448a64f11d..45e1525f4bf 100644 --- a/tests/ui/lint/lint-qualification.stderr +++ b/tests/ui/lint/lint-qualification.stderr @@ -15,5 +15,77 @@ LL - foo::bar(); LL + bar(); | -error: aborting due to 1 previous error +error: unnecessary qualification + --> $DIR/lint-qualification.rs:12:5 + | +LL | crate::foo::bar(); + | ^^^^^^^^^^^^^^^ + | +help: remove the unnecessary path segments + | +LL - crate::foo::bar(); +LL + bar(); + | + +error: unnecessary qualification + --> $DIR/lint-qualification.rs:17:13 + | +LL | let _ = std::string::String::new(); + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: remove the unnecessary path segments + | +LL - let _ = std::string::String::new(); +LL + let _ = String::new(); + | + +error: unnecessary qualification + --> $DIR/lint-qualification.rs:18:13 + | +LL | let _ = ::std::env::current_dir(); + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: remove the unnecessary path segments + | +LL - let _ = ::std::env::current_dir(); +LL + let _ = std::env::current_dir(); + | + +error: unnecessary qualification + --> $DIR/lint-qualification.rs:20:12 + | +LL | let _: std::vec::Vec<String> = std::vec::Vec::<String>::new(); + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: remove the unnecessary path segments + | +LL - let _: std::vec::Vec<String> = std::vec::Vec::<String>::new(); +LL + let _: Vec<String> = std::vec::Vec::<String>::new(); + | + +error: unnecessary qualification + --> $DIR/lint-qualification.rs:20:36 + | +LL | let _: std::vec::Vec<String> = std::vec::Vec::<String>::new(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: remove the unnecessary path segments + | +LL - let _: std::vec::Vec<String> = std::vec::Vec::<String>::new(); +LL + let _: std::vec::Vec<String> = Vec::<String>::new(); + | + +error: unnecessary qualification + --> $DIR/lint-qualification.rs:25:12 + | +LL | let _: std::fmt::Result = Ok(()); + | ^^^^^^^^^^^^^^^^ + | +help: remove the unnecessary path segments + | +LL - let _: std::fmt::Result = Ok(()); +LL + let _: fmt::Result = Ok(()); + | + +error: aborting due to 7 previous errors diff --git a/tests/ui/issues/issue-43162.rs b/tests/ui/loops/issue-43162.rs index 782eb42293a..782eb42293a 100644 --- a/tests/ui/issues/issue-43162.rs +++ b/tests/ui/loops/issue-43162.rs diff --git a/tests/ui/issues/issue-43162.stderr b/tests/ui/loops/issue-43162.stderr index 40d9200058e..40d9200058e 100644 --- a/tests/ui/issues/issue-43162.stderr +++ b/tests/ui/loops/issue-43162.stderr diff --git a/tests/ui/macros/defined-later-issue-121061-2.rs b/tests/ui/macros/defined-later-issue-121061-2.rs new file mode 100644 index 00000000000..3db76c281ec --- /dev/null +++ b/tests/ui/macros/defined-later-issue-121061-2.rs @@ -0,0 +1,13 @@ +mod demo { + fn hello() { + something_later!(); //~ ERROR cannot find macro `something_later` in this scope + } + + macro_rules! something_later { + () => { + println!("successfully expanded!"); + }; + } +} + +fn main() {} diff --git a/tests/ui/macros/defined-later-issue-121061-2.stderr b/tests/ui/macros/defined-later-issue-121061-2.stderr new file mode 100644 index 00000000000..aa6ef338531 --- /dev/null +++ b/tests/ui/macros/defined-later-issue-121061-2.stderr @@ -0,0 +1,14 @@ +error: cannot find macro `something_later` in this scope + --> $DIR/defined-later-issue-121061-2.rs:3:9 + | +LL | something_later!(); + | ^^^^^^^^^^^^^^^ consider moving the definition of `something_later` before this call + | +note: a macro with the same name exists, but it appears later at here + --> $DIR/defined-later-issue-121061-2.rs:6:18 + | +LL | macro_rules! something_later { + | ^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/macros/defined-later-issue-121061.rs b/tests/ui/macros/defined-later-issue-121061.rs new file mode 100644 index 00000000000..07c6d406f03 --- /dev/null +++ b/tests/ui/macros/defined-later-issue-121061.rs @@ -0,0 +1,9 @@ +fn main() { + something_later!(); //~ ERROR cannot find macro `something_later` in this scope +} + +macro_rules! something_later { + () => { + println!("successfully expanded!"); + }; +} diff --git a/tests/ui/macros/defined-later-issue-121061.stderr b/tests/ui/macros/defined-later-issue-121061.stderr new file mode 100644 index 00000000000..65cb53432a9 --- /dev/null +++ b/tests/ui/macros/defined-later-issue-121061.stderr @@ -0,0 +1,14 @@ +error: cannot find macro `something_later` in this scope + --> $DIR/defined-later-issue-121061.rs:2:5 + | +LL | something_later!(); + | ^^^^^^^^^^^^^^^ consider moving the definition of `something_later` before this call + | +note: a macro with the same name exists, but it appears later at here + --> $DIR/defined-later-issue-121061.rs:5:14 + | +LL | macro_rules! something_later { + | ^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/issues/issue-30007.rs b/tests/ui/macros/issue-30007.rs index 918a821bae9..918a821bae9 100644 --- a/tests/ui/issues/issue-30007.rs +++ b/tests/ui/macros/issue-30007.rs diff --git a/tests/ui/issues/issue-30007.stderr b/tests/ui/macros/issue-30007.stderr index f303221cf8a..f303221cf8a 100644 --- a/tests/ui/issues/issue-30007.stderr +++ b/tests/ui/macros/issue-30007.stderr diff --git a/tests/ui/issues/issue-6596-2.rs b/tests/ui/macros/issue-6596-2.rs index 8401c4a9d6c..8401c4a9d6c 100644 --- a/tests/ui/issues/issue-6596-2.rs +++ b/tests/ui/macros/issue-6596-2.rs diff --git a/tests/ui/issues/issue-6596-2.stderr b/tests/ui/macros/issue-6596-2.stderr index e6281eb5427..e6281eb5427 100644 --- a/tests/ui/issues/issue-6596-2.stderr +++ b/tests/ui/macros/issue-6596-2.stderr diff --git a/tests/ui/issues/issue-36401.rs b/tests/ui/match/issue-36401.rs index d5aa24e7149..d5aa24e7149 100644 --- a/tests/ui/issues/issue-36401.rs +++ b/tests/ui/match/issue-36401.rs diff --git a/tests/ui/issues/issue-37598.rs b/tests/ui/match/issue-37598.rs index a3832c2e588..a3832c2e588 100644 --- a/tests/ui/issues/issue-37598.rs +++ b/tests/ui/match/issue-37598.rs diff --git a/tests/ui/issues/issue-19521.rs b/tests/ui/methods/issue-19521.rs index a2a32a21a22..a2a32a21a22 100644 --- a/tests/ui/issues/issue-19521.rs +++ b/tests/ui/methods/issue-19521.rs diff --git a/tests/ui/issues/issue-19521.stderr b/tests/ui/methods/issue-19521.stderr index f451dc36d45..f451dc36d45 100644 --- a/tests/ui/issues/issue-19521.stderr +++ b/tests/ui/methods/issue-19521.stderr diff --git a/tests/ui/issues/issue-7950.rs b/tests/ui/methods/issue-7950.rs index d3dcb3380bb..d3dcb3380bb 100644 --- a/tests/ui/issues/issue-7950.rs +++ b/tests/ui/methods/issue-7950.rs diff --git a/tests/ui/issues/issue-7950.stderr b/tests/ui/methods/issue-7950.stderr index 80504c070a3..80504c070a3 100644 --- a/tests/ui/issues/issue-7950.stderr +++ b/tests/ui/methods/issue-7950.stderr diff --git a/tests/ui/pattern/complexity_limit.rs b/tests/ui/pattern/complexity_limit.rs new file mode 100644 index 00000000000..c9a3f99bccd --- /dev/null +++ b/tests/ui/pattern/complexity_limit.rs @@ -0,0 +1,106 @@ +#![feature(rustc_attrs)] +#![pattern_complexity = "10000"] + +#[derive(Default)] +struct BaseCommand { + field01: bool, + field02: bool, + field03: bool, + field04: bool, + field05: bool, + field06: bool, + field07: bool, + field08: bool, + field09: bool, + field10: bool, + field11: bool, + field12: bool, + field13: bool, + field14: bool, + field15: bool, + field16: bool, + field17: bool, + field18: bool, + field19: bool, + field20: bool, + field21: bool, + field22: bool, + field23: bool, + field24: bool, + field25: bool, + field26: bool, + field27: bool, + field28: bool, + field29: bool, + field30: bool, +} + +fn request_key(command: BaseCommand) { + match command { //~ ERROR: reached pattern complexity limit + BaseCommand { field01: true, .. } => {} + BaseCommand { field02: true, .. } => {} + BaseCommand { field03: true, .. } => {} + BaseCommand { field04: true, .. } => {} + BaseCommand { field05: true, .. } => {} + BaseCommand { field06: true, .. } => {} + BaseCommand { field07: true, .. } => {} + BaseCommand { field08: true, .. } => {} + BaseCommand { field09: true, .. } => {} + BaseCommand { field10: true, .. } => {} + BaseCommand { field11: true, .. } => {} + BaseCommand { field12: true, .. } => {} + BaseCommand { field13: true, .. } => {} + BaseCommand { field14: true, .. } => {} + BaseCommand { field15: true, .. } => {} + BaseCommand { field16: true, .. } => {} + BaseCommand { field17: true, .. } => {} + BaseCommand { field18: true, .. } => {} + BaseCommand { field19: true, .. } => {} + BaseCommand { field20: true, .. } => {} + BaseCommand { field21: true, .. } => {} + BaseCommand { field22: true, .. } => {} + BaseCommand { field23: true, .. } => {} + BaseCommand { field24: true, .. } => {} + BaseCommand { field25: true, .. } => {} + BaseCommand { field26: true, .. } => {} + BaseCommand { field27: true, .. } => {} + BaseCommand { field28: true, .. } => {} + BaseCommand { field29: true, .. } => {} + BaseCommand { field30: true, .. } => {} + + BaseCommand { field01: false, .. } => {} + BaseCommand { field02: false, .. } => {} + BaseCommand { field03: false, .. } => {} + BaseCommand { field04: false, .. } => {} + BaseCommand { field05: false, .. } => {} + BaseCommand { field06: false, .. } => {} + BaseCommand { field07: false, .. } => {} + BaseCommand { field08: false, .. } => {} + BaseCommand { field09: false, .. } => {} + BaseCommand { field10: false, .. } => {} + BaseCommand { field11: false, .. } => {} + BaseCommand { field12: false, .. } => {} + BaseCommand { field13: false, .. } => {} + BaseCommand { field14: false, .. } => {} + BaseCommand { field15: false, .. } => {} + BaseCommand { field16: false, .. } => {} + BaseCommand { field17: false, .. } => {} + BaseCommand { field18: false, .. } => {} + BaseCommand { field19: false, .. } => {} + BaseCommand { field20: false, .. } => {} + BaseCommand { field21: false, .. } => {} + BaseCommand { field22: false, .. } => {} + BaseCommand { field23: false, .. } => {} + BaseCommand { field24: false, .. } => {} + BaseCommand { field25: false, .. } => {} + BaseCommand { field26: false, .. } => {} + BaseCommand { field27: false, .. } => {} + BaseCommand { field28: false, .. } => {} + BaseCommand { field29: false, .. } => {} + BaseCommand { field30: false, .. } => {} + } +} + +fn main() { + request_key(BaseCommand::default()); +} diff --git a/tests/ui/pattern/complexity_limit.stderr b/tests/ui/pattern/complexity_limit.stderr new file mode 100644 index 00000000000..08d9d40fe46 --- /dev/null +++ b/tests/ui/pattern/complexity_limit.stderr @@ -0,0 +1,14 @@ +error: reached pattern complexity limit + --> $DIR/complexity_limit.rs:39:5 + | +LL | / match command { +LL | | BaseCommand { field01: true, .. } => {} +LL | | BaseCommand { field02: true, .. } => {} +LL | | BaseCommand { field03: true, .. } => {} +... | +LL | | BaseCommand { field30: false, .. } => {} +LL | | } + | |_____^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/pattern/usefulness/issue-118437-exponential-time-on-diagonal-match.rs b/tests/ui/pattern/usefulness/issue-118437-exponential-time-on-diagonal-match.rs index 984feef5f47..783512d5cca 100644 --- a/tests/ui/pattern/usefulness/issue-118437-exponential-time-on-diagonal-match.rs +++ b/tests/ui/pattern/usefulness/issue-118437-exponential-time-on-diagonal-match.rs @@ -1,3 +1,6 @@ +#![feature(rustc_attrs)] +#![pattern_complexity = "61"] + //@ check-pass struct BaseCommand { field01: bool, diff --git a/tests/ui/issues/issue-30490.rs b/tests/ui/process/issue-30490.rs index 0d918bc3dd5..0d918bc3dd5 100644 --- a/tests/ui/issues/issue-30490.rs +++ b/tests/ui/process/issue-30490.rs diff --git a/tests/ui/repr/repr-align.stderr b/tests/ui/repr/repr-align.stderr index 84d33a08a6f..bb0e17ba395 100644 --- a/tests/ui/repr/repr-align.stderr +++ b/tests/ui/repr/repr-align.stderr @@ -1,84 +1,84 @@ error[E0589]: invalid `repr(align)` attribute: not an unsuffixed integer - --> $DIR/repr-align.rs:3:8 + --> $DIR/repr-align.rs:3:14 | LL | #[repr(align(16.0))] - | ^^^^^^^^^^^ + | ^^^^ error[E0589]: invalid `repr(align)` attribute: not a power of two - --> $DIR/repr-align.rs:7:8 + --> $DIR/repr-align.rs:7:14 | LL | #[repr(align(15))] - | ^^^^^^^^^ + | ^^ error[E0589]: invalid `repr(align)` attribute: larger than 2^29 - --> $DIR/repr-align.rs:11:8 + --> $DIR/repr-align.rs:11:14 | LL | #[repr(align(4294967296))] - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^ error[E0589]: invalid `repr(align)` attribute: not an unsuffixed integer - --> $DIR/repr-align.rs:18:8 + --> $DIR/repr-align.rs:18:14 | LL | #[repr(align(16.0))] - | ^^^^^^^^^^^ + | ^^^^ error[E0589]: invalid `repr(align)` attribute: not a power of two - --> $DIR/repr-align.rs:22:8 + --> $DIR/repr-align.rs:22:14 | LL | #[repr(align(15))] - | ^^^^^^^^^ + | ^^ error[E0589]: invalid `repr(align)` attribute: larger than 2^29 - --> $DIR/repr-align.rs:26:8 + --> $DIR/repr-align.rs:26:14 | LL | #[repr(align(4294967296))] - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^ error[E0589]: invalid `repr(align)` attribute: not an unsuffixed integer - --> $DIR/repr-align.rs:3:8 + --> $DIR/repr-align.rs:3:14 | LL | #[repr(align(16.0))] - | ^^^^^^^^^^^ + | ^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0589]: invalid `repr(align)` attribute: not a power of two - --> $DIR/repr-align.rs:7:8 + --> $DIR/repr-align.rs:7:14 | LL | #[repr(align(15))] - | ^^^^^^^^^ + | ^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0589]: invalid `repr(align)` attribute: larger than 2^29 - --> $DIR/repr-align.rs:11:8 + --> $DIR/repr-align.rs:11:14 | LL | #[repr(align(4294967296))] - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0589]: invalid `repr(align)` attribute: not an unsuffixed integer - --> $DIR/repr-align.rs:18:8 + --> $DIR/repr-align.rs:18:14 | LL | #[repr(align(16.0))] - | ^^^^^^^^^^^ + | ^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0589]: invalid `repr(align)` attribute: not a power of two - --> $DIR/repr-align.rs:22:8 + --> $DIR/repr-align.rs:22:14 | LL | #[repr(align(15))] - | ^^^^^^^^^ + | ^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0589]: invalid `repr(align)` attribute: larger than 2^29 - --> $DIR/repr-align.rs:26:8 + --> $DIR/repr-align.rs:26:14 | LL | #[repr(align(4294967296))] - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` diff --git a/tests/ui/issues/issue-24446.rs b/tests/ui/static/issue-24446.rs index 6cf8846506d..6cf8846506d 100644 --- a/tests/ui/issues/issue-24446.rs +++ b/tests/ui/static/issue-24446.rs diff --git a/tests/ui/issues/issue-24446.stderr b/tests/ui/static/issue-24446.stderr index 9c206e5ef3c..9c206e5ef3c 100644 --- a/tests/ui/issues/issue-24446.stderr +++ b/tests/ui/static/issue-24446.stderr diff --git a/tests/ui/issues/issue-3563-3.rs b/tests/ui/std/issue-3563-3.rs index a28198e7dbf..a28198e7dbf 100644 --- a/tests/ui/issues/issue-3563-3.rs +++ b/tests/ui/std/issue-3563-3.rs diff --git a/tests/ui/issues/issue-3563-3.stderr b/tests/ui/std/issue-3563-3.stderr index bd65c1e3fd5..bd65c1e3fd5 100644 --- a/tests/ui/issues/issue-3563-3.stderr +++ b/tests/ui/std/issue-3563-3.stderr diff --git a/tests/ui/issues/issue-15155.rs b/tests/ui/traits/issue-15155.rs index 3bc612be279..3bc612be279 100644 --- a/tests/ui/issues/issue-15155.rs +++ b/tests/ui/traits/issue-15155.rs diff --git a/tests/ui/issues/issue-21837.rs b/tests/ui/traits/issue-21837.rs index 213119bd21c..213119bd21c 100644 --- a/tests/ui/issues/issue-21837.rs +++ b/tests/ui/traits/issue-21837.rs diff --git a/tests/ui/issues/issue-21837.stderr b/tests/ui/traits/issue-21837.stderr index f1989392688..f1989392688 100644 --- a/tests/ui/issues/issue-21837.stderr +++ b/tests/ui/traits/issue-21837.stderr diff --git a/tests/ui/issues/issue-33187.rs b/tests/ui/traits/issue-33187.rs index 6a039527b3b..6a039527b3b 100644 --- a/tests/ui/issues/issue-33187.rs +++ b/tests/ui/traits/issue-33187.rs diff --git a/tests/ui/issues/issue-3979-generics.rs b/tests/ui/traits/issue-3979-generics.rs index 12f6137dd2a..12f6137dd2a 100644 --- a/tests/ui/issues/issue-3979-generics.rs +++ b/tests/ui/traits/issue-3979-generics.rs diff --git a/tests/ui/typeck/method-chain-gats.rs b/tests/ui/typeck/method-chain-gats.rs new file mode 100644 index 00000000000..c7081c9a3b1 --- /dev/null +++ b/tests/ui/typeck/method-chain-gats.rs @@ -0,0 +1,22 @@ +// Regression test for issue #121898. + +trait Base { + type Base<B>; +} + +trait Functor<A>: Base { + fn fmap<B>(self, f: impl Fn(A) -> B) -> Self::Base<B> + where + Self::Base<B>: Functor<B>; +} + +fn fmap2<T, A, B, C>(input: T, f1: impl Fn(A) -> B, f2: impl Fn(B) -> C) -> T::Base<C> +where + T: Functor<A>, + T::Base<B>: Functor<B, Base<C> = T::Base<C>>, +{ + input.fmap(f1).fmap(f2) + //~^ ERROR the trait bound `<T as Base>::Base<C>: Functor<C>` is not satisfied +} + +fn main() {} diff --git a/tests/ui/typeck/method-chain-gats.stderr b/tests/ui/typeck/method-chain-gats.stderr new file mode 100644 index 00000000000..63383792214 --- /dev/null +++ b/tests/ui/typeck/method-chain-gats.stderr @@ -0,0 +1,27 @@ +error[E0277]: the trait bound `<T as Base>::Base<C>: Functor<C>` is not satisfied + --> $DIR/method-chain-gats.rs:18:20 + | +LL | input.fmap(f1).fmap(f2) + | ^^^^ the trait `Functor<C>` is not implemented for `<T as Base>::Base<C>` + | +note: the method call chain might not have had the expected associated types + --> $DIR/method-chain-gats.rs:13:29 + | +LL | fn fmap2<T, A, B, C>(input: T, f1: impl Fn(A) -> B, f2: impl Fn(B) -> C) -> T::Base<C> + | ^ `Base::Base` is `<T as Base>::Base<_>` here +note: required by a bound in `Functor::fmap` + --> $DIR/method-chain-gats.rs:10:24 + | +LL | fn fmap<B>(self, f: impl Fn(A) -> B) -> Self::Base<B> + | ---- required by a bound in this associated function +LL | where +LL | Self::Base<B>: Functor<B>; + | ^^^^^^^^^^ required by this bound in `Functor::fmap` +help: consider further restricting the associated type + | +LL | T::Base<B>: Functor<B, Base<C> = T::Base<C>>, <T as Base>::Base<C>: Functor<C> + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. |
