From 293f19ab9f24a91f63597b9294907b84d3063d1e Mon Sep 17 00:00:00 2001 From: jyn Date: Sat, 21 Dec 2024 15:22:44 -0500 Subject: [PATCH 01/18] wip: short backtraces --- Cargo.lock | 1 + .../src/debuginfo/mod.rs | 12 +- compiler/rustc_codegen_cranelift/src/lib.rs | 1 + .../rustc_codegen_llvm/src/debuginfo/mod.rs | 14 +- compiler/rustc_codegen_llvm/src/llvm/ffi.rs | 25 ++++ compiler/rustc_codegen_ssa/Cargo.toml | 1 + .../rustc_codegen_ssa/src/codegen_attrs.rs | 5 +- .../rustc_codegen_ssa/src/debuginfo/mod.rs | 19 +++ compiler/rustc_feature/src/builtin_attrs.rs | 12 ++ .../rustc_llvm/llvm-wrapper/RustWrapper.cpp | 33 ++++- compiler/rustc_middle/messages.ftl | 3 + .../src/middle/codegen_fn_attrs.rs | 63 ++++++++- compiler/rustc_span/src/symbol.rs | 3 + library/backtrace | 2 +- library/core/src/ops/function.rs | 1 + library/core/src/option.rs | 2 + library/core/src/panic.rs | 1 + library/core/src/panicking.rs | 1 + library/core/src/result.rs | 1 + library/std/src/panicking.rs | 1 + library/std/src/sys/backtrace.rs | 60 +++++--- src/bootstrap/src/core/build_steps/doc.rs | 4 + src/llvm-project | 2 +- .../std-backtrace-skip-frames.full.run.stderr | 82 +++++++++++ .../std-backtrace-skip-frames.full.run.stdout | 0 ...d-backtrace-skip-frames.limited.run.stderr | 82 +++++++++++ ...d-backtrace-skip-frames.limited.run.stdout | 0 ...cktrace-skip-frames.line-tables.run.stderr | 86 ++++++++++++ ...cktrace-skip-frames.line-tables.run.stdout | 0 ...-backtrace-skip-frames.no-split.run.stderr | 86 ++++++++++++ ...-backtrace-skip-frames.no-split.run.stdout | 0 ...td-backtrace-skip-frames.packed.run.stderr | 86 ++++++++++++ ...td-backtrace-skip-frames.packed.run.stdout | 0 .../ui/backtrace/std-backtrace-skip-frames.rs | 132 ++++++++++++++++++ ...-backtrace-skip-frames.unpacked.run.stderr | 86 ++++++++++++ ...-backtrace-skip-frames.unpacked.run.stdout | 0 36 files changed, 874 insertions(+), 33 deletions(-) create mode 100644 tests/ui/backtrace/std-backtrace-skip-frames.full.run.stderr create mode 100644 tests/ui/backtrace/std-backtrace-skip-frames.full.run.stdout create mode 100644 tests/ui/backtrace/std-backtrace-skip-frames.limited.run.stderr create mode 100644 tests/ui/backtrace/std-backtrace-skip-frames.limited.run.stdout create mode 100644 tests/ui/backtrace/std-backtrace-skip-frames.line-tables.run.stderr create mode 100644 tests/ui/backtrace/std-backtrace-skip-frames.line-tables.run.stdout create mode 100644 tests/ui/backtrace/std-backtrace-skip-frames.no-split.run.stderr create mode 100644 tests/ui/backtrace/std-backtrace-skip-frames.no-split.run.stdout create mode 100644 tests/ui/backtrace/std-backtrace-skip-frames.packed.run.stderr create mode 100644 tests/ui/backtrace/std-backtrace-skip-frames.packed.run.stdout create mode 100644 tests/ui/backtrace/std-backtrace-skip-frames.rs create mode 100644 tests/ui/backtrace/std-backtrace-skip-frames.unpacked.run.stderr create mode 100644 tests/ui/backtrace/std-backtrace-skip-frames.unpacked.run.stdout diff --git a/Cargo.lock b/Cargo.lock index eeb3c99a294a3..11d625d3d79d4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3525,6 +3525,7 @@ dependencies = [ "bitflags", "cc", "either", + "gimli 0.31.1", "itertools", "libc", "object 0.36.7", diff --git a/compiler/rustc_codegen_cranelift/src/debuginfo/mod.rs b/compiler/rustc_codegen_cranelift/src/debuginfo/mod.rs index f3a8623e21611..c6503323bdcc6 100644 --- a/compiler/rustc_codegen_cranelift/src/debuginfo/mod.rs +++ b/compiler/rustc_codegen_cranelift/src/debuginfo/mod.rs @@ -15,7 +15,7 @@ use gimli::write::{ }; use gimli::{AArch64, Encoding, Format, LineEncoding, Register, RiscV, RunTimeEndian, X86_64}; use indexmap::IndexSet; -use rustc_codegen_ssa::debuginfo::type_names; +use rustc_codegen_ssa::debuginfo::{DW_AT_short_backtrace, DW_short_backtrace_value, type_names}; use rustc_hir::def::DefKind; use rustc_hir::def_id::DefIdMap; use rustc_session::Session; @@ -239,6 +239,16 @@ impl DebugContext { entry.set(gimli::DW_AT_decl_file, AttributeValue::FileIndex(Some(file_id))); entry.set(gimli::DW_AT_decl_line, AttributeValue::Udata(line)); + if let Some(skip) = tcx.codegen_fn_attrs(instance.def_id()).skip_short_backtrace { + tracing::info!( + "debuginfo {:?}: skip_short_backtrace={:?}", + tcx.item_name(instance.def_id()), + skip + ); + let attr = AttributeValue::Data1(DW_short_backtrace_value(skip)); + entry.set(gimli::DwAt(DW_AT_short_backtrace), attr); + } + if !fn_abi.ret.is_ignore() { let return_dw_ty = self.debug_type(tcx, type_dbg, fn_abi.ret.layout.ty); let entry = self.dwarf.unit.get_mut(entry_id); diff --git a/compiler/rustc_codegen_cranelift/src/lib.rs b/compiler/rustc_codegen_cranelift/src/lib.rs index c38ef82e5b80c..1942062e89a6e 100644 --- a/compiler/rustc_codegen_cranelift/src/lib.rs +++ b/compiler/rustc_codegen_cranelift/src/lib.rs @@ -27,6 +27,7 @@ extern crate rustc_metadata; extern crate rustc_session; extern crate rustc_span; extern crate rustc_target; +extern crate tracing; // This prevents duplicating functions and statics that are already part of the host rustc process. #[allow(unused_extern_crates)] diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/mod.rs b/compiler/rustc_codegen_llvm/src/debuginfo/mod.rs index fae698bea2a6b..140eb7a165d91 100644 --- a/compiler/rustc_codegen_llvm/src/debuginfo/mod.rs +++ b/compiler/rustc_codegen_llvm/src/debuginfo/mod.rs @@ -34,7 +34,7 @@ use crate::common::{AsCCharPtr, CodegenCx}; use crate::llvm; use crate::llvm::debuginfo::{ DIArray, DIBuilder, DIFile, DIFlags, DILexicalBlock, DILocation, DISPFlags, DIScope, DIType, - DIVariable, + DIVariable, ShortBacktraceKind, }; use crate::value::Value; @@ -375,6 +375,16 @@ impl<'ll, 'tcx> DebugInfoCodegenMethods<'tcx> for CodegenCx<'ll, 'tcx> { } } + // If appropriate, mark the function as skippable in backtraces. + let skip = self.tcx.codegen_fn_attrs(instance.def_id()).skip_short_backtrace; + if let Some(s) = skip { + tracing::info!( + "generate short backtrace {s:?} for {}", + tcx.item_name(instance.def_id()) + ); + } + let skip = ShortBacktraceKind::from_generic(skip); + // When we're adding a method to a type DIE, we only want a DW_AT_declaration there, because // LLVM LTO can't unify type definitions when a child DIE is a full subprogram definition. // When we use this `decl` below, the subprogram definition gets created at the CU level @@ -392,6 +402,7 @@ impl<'ll, 'tcx> DebugInfoCodegenMethods<'tcx> for CodegenCx<'ll, 'tcx> { function_type_metadata, flags, spflags & !DISPFlags::SPFlagDefinition, + skip, template_parameters, ) }); @@ -410,6 +421,7 @@ impl<'ll, 'tcx> DebugInfoCodegenMethods<'tcx> for CodegenCx<'ll, 'tcx> { scope_line, flags, spflags, + skip, maybe_definition_llfn, template_parameters, decl, diff --git a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs index 9a2bfd95562f2..088c91b25caab 100644 --- a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs +++ b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs @@ -5,6 +5,7 @@ use std::fmt::Debug; use std::marker::PhantomData; use std::ptr; +use debuginfo::ShortBacktraceKind; use libc::{c_char, c_int, c_uint, c_ulonglong, c_void, size_t}; use rustc_macros::TryFromU32; use rustc_target::spec::SymbolVisibility; @@ -707,6 +708,7 @@ pub type InlineAsmDiagHandlerTy = unsafe extern "C" fn(&SMDiagnostic, *const c_v pub mod debuginfo { use bitflags::bitflags; + use rustc_middle::middle::codegen_fn_attrs::SkipShortBacktrace; use super::{InvariantOpaque, Metadata}; @@ -775,6 +777,27 @@ pub mod debuginfo { } } + /// LLVMRustDebugEmissionKind + #[derive(Copy, Clone, Debug)] + #[repr(C)] + pub enum ShortBacktraceKind { + SkipFrame, + StartShortBacktrace, + EndShortBacktrace, + None, + } + + impl ShortBacktraceKind { + pub fn from_generic(opt: Option) -> Self { + match opt { + None => ShortBacktraceKind::None, + Some(SkipShortBacktrace::ThisFrameOnly) => ShortBacktraceKind::SkipFrame, + Some(SkipShortBacktrace::Start) => ShortBacktraceKind::StartShortBacktrace, + Some(SkipShortBacktrace::End) => ShortBacktraceKind::EndShortBacktrace, + } + } + } + /// LLVMRustDebugEmissionKind #[derive(Copy, Clone)] #[repr(C)] @@ -1891,6 +1914,7 @@ unsafe extern "C" { ScopeLine: c_uint, Flags: DIFlags, SPFlags: DISPFlags, + ShortBacktrace: ShortBacktraceKind, MaybeFn: Option<&'a Value>, TParam: &'a DIArray, Decl: Option<&'a DIDescriptor>, @@ -1908,6 +1932,7 @@ unsafe extern "C" { Ty: &'a DIType, Flags: DIFlags, SPFlags: DISPFlags, + ShortBacktrace: ShortBacktraceKind, TParam: &'a DIArray, ) -> &'a DISubprogram; diff --git a/compiler/rustc_codegen_ssa/Cargo.toml b/compiler/rustc_codegen_ssa/Cargo.toml index 3a9b4d3680782..e6abfa608ebb4 100644 --- a/compiler/rustc_codegen_ssa/Cargo.toml +++ b/compiler/rustc_codegen_ssa/Cargo.toml @@ -12,6 +12,7 @@ bitflags = "2.4.1" # `cc` in `rustc_llvm` if you update the `cc` here. cc = "=1.2.5" either = "1.5.0" +gimli = "0.31.1" itertools = "0.12" pathdiff = "0.2.0" regex = "1.4" diff --git a/compiler/rustc_codegen_ssa/src/codegen_attrs.rs b/compiler/rustc_codegen_ssa/src/codegen_attrs.rs index cdb72aba36fa0..9fff105f501d6 100644 --- a/compiler/rustc_codegen_ssa/src/codegen_attrs.rs +++ b/compiler/rustc_codegen_ssa/src/codegen_attrs.rs @@ -9,7 +9,7 @@ use rustc_hir::def_id::{DefId, LOCAL_CRATE, LocalDefId}; use rustc_hir::weak_lang_items::WEAK_LANG_ITEMS; use rustc_hir::{self as hir, HirId, LangItem, lang_items}; use rustc_middle::middle::codegen_fn_attrs::{ - CodegenFnAttrFlags, CodegenFnAttrs, PatchableFunctionEntry, + CodegenFnAttrFlags, CodegenFnAttrs, PatchableFunctionEntry, SkipShortBacktrace, }; use rustc_middle::mir::mono::Linkage; use rustc_middle::query::Providers; @@ -581,6 +581,8 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs { } }); + codegen_fn_attrs.skip_short_backtrace = SkipShortBacktrace::lookup(tcx, did); + // #73631: closures inherit `#[target_feature]` annotations // // If this closure is marked `#[inline(always)]`, simply skip adding `#[target_feature]`. @@ -643,6 +645,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs { // Additionally weak lang items have predetermined symbol names. if WEAK_LANG_ITEMS.iter().any(|&l| tcx.lang_items().get(l) == Some(did.to_def_id())) { codegen_fn_attrs.flags |= CodegenFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL; + codegen_fn_attrs.skip_short_backtrace = Some(SkipShortBacktrace::ThisFrameOnly); } if let Some((name, _)) = lang_items::extract(attrs) && let Some(lang_item) = LangItem::from_name(name) diff --git a/compiler/rustc_codegen_ssa/src/debuginfo/mod.rs b/compiler/rustc_codegen_ssa/src/debuginfo/mod.rs index 7c62c03d574c1..e93931a095493 100644 --- a/compiler/rustc_codegen_ssa/src/debuginfo/mod.rs +++ b/compiler/rustc_codegen_ssa/src/debuginfo/mod.rs @@ -6,6 +6,25 @@ use rustc_middle::ty::{self, Ty, TyCtxt}; // FIXME(eddyb) find a place for this (or a way to replace it). pub mod type_names; +#[allow(non_upper_case_globals)] +mod short_backtraces { + use rustc_middle::middle::codegen_fn_attrs::SkipShortBacktrace; + + // This is effectively public API. Don't change it. + pub const DW_AT_short_backtrace: u16 = 0x3c00; + pub const DW_FORM_short_backtrace: u16 = gimli::constants::DW_FORM_data1.0; + + #[allow(non_snake_case)] + pub fn DW_short_backtrace_value(fn_attr: SkipShortBacktrace) -> u8 { + match fn_attr { + SkipShortBacktrace::ThisFrameOnly => 0, + SkipShortBacktrace::Start => 1, + SkipShortBacktrace::End => 2, + } + } +} +pub use short_backtraces::*; + /// Returns true if we want to generate a DW_TAG_enumeration_type description for /// this instead of a DW_TAG_struct_type with DW_TAG_variant_part. /// diff --git a/compiler/rustc_feature/src/builtin_attrs.rs b/compiler/rustc_feature/src/builtin_attrs.rs index 4112ae8098075..ebaafee42fbe5 100644 --- a/compiler/rustc_feature/src/builtin_attrs.rs +++ b/compiler/rustc_feature/src/builtin_attrs.rs @@ -684,6 +684,18 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ rustc_allocator_zeroed, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::No, IMPL_DETAIL ), + rustc_attr!( + rustc_skip_short_backtrace, Normal, template!(Word), WarnFollowing, + EncodeCrossCrate::No, IMPL_DETAIL, + ), + rustc_attr!( + rustc_start_short_backtrace, Normal, template!(Word), WarnFollowing, + EncodeCrossCrate::No, IMPL_DETAIL, + ), + rustc_attr!( + rustc_end_short_backtrace, Normal, template!(Word), WarnFollowing, + EncodeCrossCrate::No, IMPL_DETAIL, + ), gated!( default_lib_allocator, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::No, allocator_internals, experimental!(default_lib_allocator), diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp index 36441a95adbf9..79e88809a39ab 100644 --- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp @@ -822,6 +822,31 @@ static DISubprogram::DISPFlags fromRust(LLVMRustDISPFlags SPFlags) { return Result; } +// These values **must** match debuginfo::ShortBacktrace! They also *happen* +// to match LLVM, but that isn't required as we do giant sets of +// matching below. The value shouldn't be directly passed to LLVM. +enum class LLVMRustShortBacktrace { + SkipFrame, + StartShortBacktrace, + EndShortBacktrace, + None, +}; + +static std::optional shortBacktraceFromRust(LLVMRustShortBacktrace backtrace) { + switch (backtrace) { + case LLVMRustShortBacktrace::SkipFrame: + return ShortBacktraceAttr::SkipFrame; + case LLVMRustShortBacktrace::StartShortBacktrace: + return ShortBacktraceAttr::StartShortBacktrace; + case LLVMRustShortBacktrace::EndShortBacktrace: + return ShortBacktraceAttr::EndShortBacktrace; + case LLVMRustShortBacktrace::None: + return std::nullopt; + default: + report_fatal_error("bad ShortBacktraceAttr."); + } +} + enum class LLVMRustDebugEmissionKind { NoDebug, FullDebug, @@ -1015,7 +1040,7 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateFunction( LLVMRustDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, size_t NameLen, const char *LinkageName, size_t LinkageNameLen, LLVMMetadataRef File, unsigned LineNo, LLVMMetadataRef Ty, - unsigned ScopeLine, LLVMRustDIFlags Flags, LLVMRustDISPFlags SPFlags, + unsigned ScopeLine, LLVMRustDIFlags Flags, LLVMRustDISPFlags SPFlags, LLVMRustShortBacktrace shortBacktrace, LLVMValueRef MaybeFn, LLVMMetadataRef TParam, LLVMMetadataRef Decl) { DITemplateParameterArray TParams = DITemplateParameterArray(unwrap(TParam)); @@ -1024,7 +1049,7 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateFunction( DISubprogram *Sub = Builder->createFunction( unwrapDI(Scope), StringRef(Name, NameLen), StringRef(LinkageName, LinkageNameLen), unwrapDI(File), LineNo, - unwrapDI(Ty), ScopeLine, llvmFlags, llvmSPFlags, + unwrapDI(Ty), ScopeLine, llvmFlags, llvmSPFlags, shortBacktraceFromRust(shortBacktrace), TParams, unwrapDIPtr(Decl)); if (MaybeFn) unwrap(MaybeFn)->setSubprogram(Sub); @@ -1035,7 +1060,7 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateMethod( LLVMRustDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, size_t NameLen, const char *LinkageName, size_t LinkageNameLen, LLVMMetadataRef File, unsigned LineNo, LLVMMetadataRef Ty, - LLVMRustDIFlags Flags, LLVMRustDISPFlags SPFlags, LLVMMetadataRef TParam) { + LLVMRustDIFlags Flags, LLVMRustDISPFlags SPFlags, LLVMRustShortBacktrace shortBacktrace, LLVMMetadataRef TParam) { DITemplateParameterArray TParams = DITemplateParameterArray(unwrap(TParam)); DISubprogram::DISPFlags llvmSPFlags = fromRust(SPFlags); @@ -1045,7 +1070,7 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateMethod( StringRef(LinkageName, LinkageNameLen), unwrapDI(File), LineNo, unwrapDI(Ty), 0, 0, nullptr, // VTable params aren't used - llvmFlags, llvmSPFlags, TParams); + llvmFlags, llvmSPFlags, shortBacktraceFromRust(shortBacktrace), TParams); return wrap(Sub); } diff --git a/compiler/rustc_middle/messages.ftl b/compiler/rustc_middle/messages.ftl index 5dd85978f007f..c7c0dcccaac7c 100644 --- a/compiler/rustc_middle/messages.ftl +++ b/compiler/rustc_middle/messages.ftl @@ -96,6 +96,9 @@ middle_recursion_limit_reached = middle_requires_lang_item = requires `{$name}` lang_item +middle_multiple_short_backtrace_attrs = multiple `#[rustc_*_short_backtrace]` attributes were used on the same item + .note = "attribute used here" + middle_strict_coherence_needs_negative_coherence = to use `strict_coherence` on this trait, the `with_negative_coherence` feature must be enabled .label = due to this attribute diff --git a/compiler/rustc_middle/src/middle/codegen_fn_attrs.rs b/compiler/rustc_middle/src/middle/codegen_fn_attrs.rs index 241767fe249b1..356022a412463 100644 --- a/compiler/rustc_middle/src/middle/codegen_fn_attrs.rs +++ b/compiler/rustc_middle/src/middle/codegen_fn_attrs.rs @@ -1,10 +1,11 @@ use rustc_abi::Align; use rustc_attr_parsing::{InlineAttr, InstructionSetAttr, OptimizeAttr}; use rustc_macros::{HashStable, TyDecodable, TyEncodable}; -use rustc_span::Symbol; +use rustc_span::{Symbol, sym}; use rustc_target::spec::SanitizerSet; use crate::mir::mono::Linkage; +use crate::ty::TyCtxt; #[derive(Clone, TyEncodable, TyDecodable, HashStable, Debug)] pub struct CodegenFnAttrs { @@ -49,6 +50,9 @@ pub struct CodegenFnAttrs { /// The `#[patchable_function_entry(...)]` attribute. Indicates how many nops should be around /// the function entry. pub patchable_function_entry: Option, + /// Whether to generate debuginfo that instructs libstd's panic handler to + /// skip this frame when printing short backtraces. + pub skip_short_backtrace: Option, } #[derive(Copy, Clone, Debug, TyEncodable, TyDecodable, HashStable)] @@ -83,6 +87,62 @@ impl PatchableFunctionEntry { } } +// #[derive(Clone, Debug, TyEncodable, TyDecodable, HashStable, TypeFoldable, TypeVisitable)] +#[derive(Copy, Clone, Debug, TyEncodable, TyDecodable, HashStable)] +pub enum SkipShortBacktrace { + ThisFrameOnly, + Start, + End, +} + +#[derive(Diagnostic)] +#[diag(middle_multiple_short_backtrace_attrs)] +struct MultipleShortBacktraceAttrs { + #[primary_span] + #[label] + pub span: Span, + #[note] + start: Option, + #[note] + end: Option, + #[note] + skip: Option, +} + +impl SkipShortBacktrace { + pub fn lookup(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option { + let skip = tcx.get_attr(def_id, sym::rustc_skip_short_backtrace); + let start = tcx.get_attr(def_id, sym::rustc_start_short_backtrace); + let end = tcx.get_attr(def_id, sym::rustc_end_short_backtrace); + + // TODO: need to add a visitor somewhere that errors if this is applied other than to a module or function + + let kind = match (skip.is_some(), start.is_some(), end.is_some()) { + (true, false, false) => SkipShortBacktrace::ThisFrameOnly, + (false, true, false) => SkipShortBacktrace::Start, + (false, false, true) => SkipShortBacktrace::End, + (false, false, false) => { + let parent_mod = tcx.parent_module_from_def_id(def_id); + if tcx.get_attr(parent_mod, sym::rustc_skip_short_backtrace).is_some() { + SkipShortBacktrace::ThisFrameOnly + } else { + return None; + } + } + _ => { + tcx.dcx().emit_err(MultipleShortBacktraceAttrs { + span: tcx.def_span(def_id), + skip: skip.map(|attr| attr.span), + start: start.map(|attr| attr.span), + end: end.map(|attr| attr.span), + }); + return None; + } + }; + Some(kind) + } +} + #[derive(Clone, Copy, PartialEq, Eq, TyEncodable, TyDecodable, HashStable)] pub struct CodegenFnAttrFlags(u32); bitflags::bitflags! { @@ -156,6 +216,7 @@ impl CodegenFnAttrs { instruction_set: None, alignment: None, patchable_function_entry: None, + skip_short_backtrace: None, } } diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 3d202f11722ed..9baa27c67afe4 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -1726,6 +1726,7 @@ symbols! { rustc_dump_user_args, rustc_dump_vtable, rustc_effective_visibility, + rustc_end_short_backtrace, rustc_error, rustc_evaluate_where_clauses, rustc_expected_cgu_reuse, @@ -1776,7 +1777,9 @@ symbols! { rustc_reservation_impl, rustc_serialize, rustc_skip_during_method_dispatch, + rustc_skip_short_backtrace, rustc_specialization_trait, + rustc_start_short_backtrace, rustc_std_internal_symbol, rustc_strict_coherence, rustc_symbol_name, diff --git a/library/backtrace b/library/backtrace index 230570f2dac80..1ebaec5bcaf06 160000 --- a/library/backtrace +++ b/library/backtrace @@ -1 +1 @@ -Subproject commit 230570f2dac80a601f5c0b30da00cc9480bd35eb +Subproject commit 1ebaec5bcaf06d6d01504d117053c822fb506853 diff --git a/library/core/src/ops/function.rs b/library/core/src/ops/function.rs index e9014458b48ea..6afaebb3ec890 100644 --- a/library/core/src/ops/function.rs +++ b/library/core/src/ops/function.rs @@ -247,6 +247,7 @@ pub trait FnOnce { /// Performs the call operation. #[unstable(feature = "fn_traits", issue = "29625")] + #[cfg_attr(not(bootstrap), rustc_skip_short_backtrace)] extern "rust-call" fn call_once(self, args: Args) -> Self::Output; } diff --git a/library/core/src/option.rs b/library/core/src/option.rs index a9f06b92ad5dd..ab95b32cd3608 100644 --- a/library/core/src/option.rs +++ b/library/core/src/option.rs @@ -2011,6 +2011,7 @@ impl Option> { #[cfg_attr(feature = "panic_immediate_abort", inline)] #[cold] #[track_caller] +#[cfg_attr(not(bootstrap), rustc_skip_short_backtrace)] const fn unwrap_failed() -> ! { panic("called `Option::unwrap()` on a `None` value") } @@ -2020,6 +2021,7 @@ const fn unwrap_failed() -> ! { #[cfg_attr(feature = "panic_immediate_abort", inline)] #[cold] #[track_caller] +#[cfg_attr(not(bootstrap), rustc_skip_short_backtrace)] const fn expect_failed(msg: &str) -> ! { panic_display(&msg) } diff --git a/library/core/src/panic.rs b/library/core/src/panic.rs index 5fa340a6147f6..4b662e2dbe442 100644 --- a/library/core/src/panic.rs +++ b/library/core/src/panic.rs @@ -84,6 +84,7 @@ pub macro panic_2021 { #[cold] #[track_caller] #[inline(never)] + #[cfg_attr(not(bootstrap), rustc_skip_short_backtrace)] const fn panic_cold_explicit() -> ! { $crate::panicking::panic_explicit() } diff --git a/library/core/src/panicking.rs b/library/core/src/panicking.rs index 53e2b238bae69..5cf2e443fbee3 100644 --- a/library/core/src/panicking.rs +++ b/library/core/src/panicking.rs @@ -27,6 +27,7 @@ reason = "internal details of the implementation of the `panic!` and related macros", issue = "none" )] +#![cfg_attr(not(bootstrap), rustc_skip_short_backtrace)] use crate::fmt; use crate::intrinsics::const_eval_select; diff --git a/library/core/src/result.rs b/library/core/src/result.rs index 92b5cba153166..494893323f6af 100644 --- a/library/core/src/result.rs +++ b/library/core/src/result.rs @@ -1700,6 +1700,7 @@ impl Result, E> { #[inline(never)] #[cold] #[track_caller] +#[cfg_attr(not(bootstrap), rustc_skip_short_backtrace)] fn unwrap_failed(msg: &str, error: &dyn fmt::Debug) -> ! { panic!("{msg}: {error:?}") } diff --git a/library/std/src/panicking.rs b/library/std/src/panicking.rs index e7ce5bc61401d..2a3485a41b183 100644 --- a/library/std/src/panicking.rs +++ b/library/std/src/panicking.rs @@ -8,6 +8,7 @@ //! * Shims around "try" #![deny(unsafe_op_in_unsafe_fn)] +#![cfg_attr(not(bootstrap), rustc_skip_short_backtrace)] use core::panic::{Location, PanicPayload}; diff --git a/library/std/src/sys/backtrace.rs b/library/std/src/sys/backtrace.rs index efa6a896dad8f..e3cdd75f99fba 100644 --- a/library/std/src/sys/backtrace.rs +++ b/library/std/src/sys/backtrace.rs @@ -1,7 +1,7 @@ //! Common code for printing backtraces. #![forbid(unsafe_op_in_unsafe_fn)] -use crate::backtrace_rs::{self, BacktraceFmt, BytesOrWideString, PrintFmt}; +use crate::backtrace_rs::{self, BacktraceFmt, BytesOrWideString, PrintFmt, ShortBacktrace}; use crate::borrow::Cow; use crate::io::prelude::*; use crate::path::{self, Path, PathBuf}; @@ -51,13 +51,27 @@ unsafe fn _print_fmt(fmt: &mut fmt::Formatter<'_>, print_fmt: PrintFmt) -> fmt:: let mut print_path = move |fmt: &mut fmt::Formatter<'_>, bows: BytesOrWideString<'_>| { output_filename(fmt, bows, print_fmt, cwd.as_ref()) }; + + let write_omitted = |omitted_count: &mut _, bt_fmt: &mut BacktraceFmt<'_, '_>| { + if *omitted_count > 0 { + debug_assert!(print_fmt == PrintFmt::Short); + let _ = writeln!( + bt_fmt.formatter(), + " [... omitted {} frame{} ...]", + omitted_count, + if *omitted_count > 1 { "s" } else { "" } + ); + *omitted_count = 0; + } + }; + writeln!(fmt, "stack backtrace:")?; let mut bt_fmt = BacktraceFmt::new(fmt, print_fmt, &mut print_path); bt_fmt.add_context()?; let mut idx = 0; let mut res = Ok(()); let mut omitted_count: usize = 0; - let mut first_omit = true; + // If we're using a short backtrace, ignore all frames until we're told to start printing. let mut print = print_fmt != PrintFmt::Short; set_image_base(); @@ -71,6 +85,7 @@ unsafe fn _print_fmt(fmt: &mut fmt::Formatter<'_>, print_fmt: PrintFmt) -> fmt:: let mut hit = false; backtrace_rs::resolve_frame_unsynchronized(frame, |symbol| { hit = true; + let mut skip = false; // `__rust_end_short_backtrace` means we are done hiding symbols // for now. Print until we see `__rust_begin_short_backtrace`. @@ -78,33 +93,31 @@ unsafe fn _print_fmt(fmt: &mut fmt::Formatter<'_>, print_fmt: PrintFmt) -> fmt:: if let Some(sym) = symbol.name().and_then(|s| s.as_str()) { if sym.contains("__rust_end_short_backtrace") { print = true; - return; - } - if print && sym.contains("__rust_begin_short_backtrace") { - print = false; - return; + skip = true; } - if !print { - omitted_count += 1; + if sym.contains("__rust_begin_short_backtrace") { + print = false } } - } - if print { - if omitted_count > 0 { - debug_assert!(print_fmt == PrintFmt::Short); - // only print the message between the middle of frames - if !first_omit { - let _ = writeln!( - bt_fmt.formatter(), - " [... omitted {} frame{} ...]", - omitted_count, - if omitted_count > 1 { "s" } else { "" } - ); + if let Some(short_backtrace) = symbol.short_backtrace() { + match short_backtrace { + ShortBacktrace::ThisFrameOnly => skip = true, + ShortBacktrace::Start => print = false, + ShortBacktrace::End => { + print = true; + skip = true; + } } - first_omit = false; - omitted_count = 0; } + + if skip || !print { + omitted_count += 1; + } + } + + if print && !skip { + write_omitted(&mut omitted_count, &mut bt_fmt); res = bt_fmt.frame().symbol(frame, symbol); } }); @@ -131,6 +144,7 @@ unsafe fn _print_fmt(fmt: &mut fmt::Formatter<'_>, print_fmt: PrintFmt) -> fmt:: }; res?; bt_fmt.finish()?; + write_omitted(&mut omitted_count, &mut bt_fmt); if print_fmt == PrintFmt::Short { writeln!( fmt, diff --git a/src/bootstrap/src/core/build_steps/doc.rs b/src/bootstrap/src/core/build_steps/doc.rs index 8a9321f8e79b6..f1bca586f284b 100644 --- a/src/bootstrap/src/core/build_steps/doc.rs +++ b/src/bootstrap/src/core/build_steps/doc.rs @@ -641,6 +641,10 @@ impl Step for Std { DocumentationFormat::Json => vec!["--output-format", "json"], }; + for arg in builder.config.args() { + extra_args.push(arg); + } + if !builder.config.docs_minification { extra_args.push("--disable-minification"); } diff --git a/src/llvm-project b/src/llvm-project index 59512b0027382..d559c9421615f 160000 --- a/src/llvm-project +++ b/src/llvm-project @@ -1 +1 @@ -Subproject commit 59512b00273829823da74050d373b8d46dbca558 +Subproject commit d559c9421615fe676d242cc7c7c5766b8883e8fb diff --git a/tests/ui/backtrace/std-backtrace-skip-frames.full.run.stderr b/tests/ui/backtrace/std-backtrace-skip-frames.full.run.stderr new file mode 100644 index 0000000000000..75b65cf58bbc4 --- /dev/null +++ b/tests/ui/backtrace/std-backtrace-skip-frames.full.run.stderr @@ -0,0 +1,82 @@ +thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +called `Result::unwrap()` on an `Err` value: () +stack backtrace: + [... omitted N frames ...] + 0: core::result::Result::unwrap + at $SRC_DIR/core/src/result.rs:LL:COL + 1: std_backtrace_skip_frames::unwrap_result + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +oops: () +stack backtrace: + [... omitted N frames ...] + 0: core::result::Result::expect + at $SRC_DIR/core/src/result.rs:LL:COL + 1: std_backtrace_skip_frames::expect_result + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +called `Option::unwrap()` on a `None` value +stack backtrace: + [... omitted N frames ...] + 0: core::option::Option::unwrap + at $SRC_DIR/core/src/option.rs:LL:COL + 1: std_backtrace_skip_frames::unwrap_option + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +oops +stack backtrace: + [... omitted N frames ...] + 0: core::option::Option::expect + at $SRC_DIR/core/src/option.rs:LL:COL + 1: std_backtrace_skip_frames::expect_option + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +explicit panic +stack backtrace: + [... omitted N frames ...] + 0: std_backtrace_skip_frames::explicit_panic + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +oopsie +stack backtrace: + [... omitted N frames ...] + 0: std_backtrace_skip_frames::literal_panic + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +3 +stack backtrace: + [... omitted N frames ...] + 0: std_backtrace_skip_frames::panic_fmt + at $DIR/std-backtrace-skip-frames.rs:LL:CC + 1: std_backtrace_skip_frames::check_all_panics::{{closure}} + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +explicit panic +stack backtrace: + [... omitted N frames ...] + 0: std_backtrace_skip_frames::check_all_panics + at $DIR/std-backtrace-skip-frames.rs:LL:CC + 1: std_backtrace_skip_frames::main::{{closure}} + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] + 2: std::panic::catch_unwind + at $SRC_DIR/std/src/panic.rs:LL:COL + 3: std_backtrace_skip_frames::main + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +finished all checks diff --git a/tests/ui/backtrace/std-backtrace-skip-frames.full.run.stdout b/tests/ui/backtrace/std-backtrace-skip-frames.full.run.stdout new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/tests/ui/backtrace/std-backtrace-skip-frames.limited.run.stderr b/tests/ui/backtrace/std-backtrace-skip-frames.limited.run.stderr new file mode 100644 index 0000000000000..75b65cf58bbc4 --- /dev/null +++ b/tests/ui/backtrace/std-backtrace-skip-frames.limited.run.stderr @@ -0,0 +1,82 @@ +thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +called `Result::unwrap()` on an `Err` value: () +stack backtrace: + [... omitted N frames ...] + 0: core::result::Result::unwrap + at $SRC_DIR/core/src/result.rs:LL:COL + 1: std_backtrace_skip_frames::unwrap_result + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +oops: () +stack backtrace: + [... omitted N frames ...] + 0: core::result::Result::expect + at $SRC_DIR/core/src/result.rs:LL:COL + 1: std_backtrace_skip_frames::expect_result + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +called `Option::unwrap()` on a `None` value +stack backtrace: + [... omitted N frames ...] + 0: core::option::Option::unwrap + at $SRC_DIR/core/src/option.rs:LL:COL + 1: std_backtrace_skip_frames::unwrap_option + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +oops +stack backtrace: + [... omitted N frames ...] + 0: core::option::Option::expect + at $SRC_DIR/core/src/option.rs:LL:COL + 1: std_backtrace_skip_frames::expect_option + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +explicit panic +stack backtrace: + [... omitted N frames ...] + 0: std_backtrace_skip_frames::explicit_panic + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +oopsie +stack backtrace: + [... omitted N frames ...] + 0: std_backtrace_skip_frames::literal_panic + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +3 +stack backtrace: + [... omitted N frames ...] + 0: std_backtrace_skip_frames::panic_fmt + at $DIR/std-backtrace-skip-frames.rs:LL:CC + 1: std_backtrace_skip_frames::check_all_panics::{{closure}} + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +explicit panic +stack backtrace: + [... omitted N frames ...] + 0: std_backtrace_skip_frames::check_all_panics + at $DIR/std-backtrace-skip-frames.rs:LL:CC + 1: std_backtrace_skip_frames::main::{{closure}} + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] + 2: std::panic::catch_unwind + at $SRC_DIR/std/src/panic.rs:LL:COL + 3: std_backtrace_skip_frames::main + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +finished all checks diff --git a/tests/ui/backtrace/std-backtrace-skip-frames.limited.run.stdout b/tests/ui/backtrace/std-backtrace-skip-frames.limited.run.stdout new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/tests/ui/backtrace/std-backtrace-skip-frames.line-tables.run.stderr b/tests/ui/backtrace/std-backtrace-skip-frames.line-tables.run.stderr new file mode 100644 index 0000000000000..f349a121e3d8e --- /dev/null +++ b/tests/ui/backtrace/std-backtrace-skip-frames.line-tables.run.stderr @@ -0,0 +1,86 @@ +thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +called `Result::unwrap()` on an `Err` value: () +stack backtrace: + [... omitted N frames ...] + 0: unwrap<(), ()> + at $SRC_DIR/core/src/result.rs:LL:COL + 1: unwrap_result + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +oops: () +stack backtrace: + [... omitted N frames ...] + 0: expect<(), ()> + at $SRC_DIR/core/src/result.rs:LL:COL + 1: expect_result + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +called `Option::unwrap()` on a `None` value +stack backtrace: + [... omitted N frames ...] + 0: unwrap<()> + at $SRC_DIR/core/src/option.rs:LL:COL + 1: unwrap_option + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +oops +stack backtrace: + [... omitted N frames ...] + 0: expect<()> + at $SRC_DIR/core/src/option.rs:LL:COL + 1: expect_option + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +explicit panic +stack backtrace: + [... omitted N frames ...] + 0: std_backtrace_skip_frames::explicit_panic::panic_cold_explicit + at $SRC_DIR/core/src/panic.rs:LL:COL + 1: std_backtrace_skip_frames::explicit_panic + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +oopsie +stack backtrace: + [... omitted N frames ...] + 0: literal_panic + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +3 +stack backtrace: + [... omitted N frames ...] + 0: panic_fmt + at $DIR/std-backtrace-skip-frames.rs:LL:CC + 1: {closure#1} + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +explicit panic +stack backtrace: + [... omitted N frames ...] + 0: std_backtrace_skip_frames::check_all_panics::panic_cold_explicit + at $SRC_DIR/core/src/panic.rs:LL:COL + 1: check_all_panics + at $DIR/std-backtrace-skip-frames.rs:LL:CC + 2: {closure#0} + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] + 3: catch_unwind + at $SRC_DIR/std/src/panic.rs:LL:COL + 4: main + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +finished all checks diff --git a/tests/ui/backtrace/std-backtrace-skip-frames.line-tables.run.stdout b/tests/ui/backtrace/std-backtrace-skip-frames.line-tables.run.stdout new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/tests/ui/backtrace/std-backtrace-skip-frames.no-split.run.stderr b/tests/ui/backtrace/std-backtrace-skip-frames.no-split.run.stderr new file mode 100644 index 0000000000000..f349a121e3d8e --- /dev/null +++ b/tests/ui/backtrace/std-backtrace-skip-frames.no-split.run.stderr @@ -0,0 +1,86 @@ +thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +called `Result::unwrap()` on an `Err` value: () +stack backtrace: + [... omitted N frames ...] + 0: unwrap<(), ()> + at $SRC_DIR/core/src/result.rs:LL:COL + 1: unwrap_result + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +oops: () +stack backtrace: + [... omitted N frames ...] + 0: expect<(), ()> + at $SRC_DIR/core/src/result.rs:LL:COL + 1: expect_result + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +called `Option::unwrap()` on a `None` value +stack backtrace: + [... omitted N frames ...] + 0: unwrap<()> + at $SRC_DIR/core/src/option.rs:LL:COL + 1: unwrap_option + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +oops +stack backtrace: + [... omitted N frames ...] + 0: expect<()> + at $SRC_DIR/core/src/option.rs:LL:COL + 1: expect_option + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +explicit panic +stack backtrace: + [... omitted N frames ...] + 0: std_backtrace_skip_frames::explicit_panic::panic_cold_explicit + at $SRC_DIR/core/src/panic.rs:LL:COL + 1: std_backtrace_skip_frames::explicit_panic + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +oopsie +stack backtrace: + [... omitted N frames ...] + 0: literal_panic + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +3 +stack backtrace: + [... omitted N frames ...] + 0: panic_fmt + at $DIR/std-backtrace-skip-frames.rs:LL:CC + 1: {closure#1} + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +explicit panic +stack backtrace: + [... omitted N frames ...] + 0: std_backtrace_skip_frames::check_all_panics::panic_cold_explicit + at $SRC_DIR/core/src/panic.rs:LL:COL + 1: check_all_panics + at $DIR/std-backtrace-skip-frames.rs:LL:CC + 2: {closure#0} + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] + 3: catch_unwind + at $SRC_DIR/std/src/panic.rs:LL:COL + 4: main + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +finished all checks diff --git a/tests/ui/backtrace/std-backtrace-skip-frames.no-split.run.stdout b/tests/ui/backtrace/std-backtrace-skip-frames.no-split.run.stdout new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/tests/ui/backtrace/std-backtrace-skip-frames.packed.run.stderr b/tests/ui/backtrace/std-backtrace-skip-frames.packed.run.stderr new file mode 100644 index 0000000000000..f349a121e3d8e --- /dev/null +++ b/tests/ui/backtrace/std-backtrace-skip-frames.packed.run.stderr @@ -0,0 +1,86 @@ +thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +called `Result::unwrap()` on an `Err` value: () +stack backtrace: + [... omitted N frames ...] + 0: unwrap<(), ()> + at $SRC_DIR/core/src/result.rs:LL:COL + 1: unwrap_result + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +oops: () +stack backtrace: + [... omitted N frames ...] + 0: expect<(), ()> + at $SRC_DIR/core/src/result.rs:LL:COL + 1: expect_result + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +called `Option::unwrap()` on a `None` value +stack backtrace: + [... omitted N frames ...] + 0: unwrap<()> + at $SRC_DIR/core/src/option.rs:LL:COL + 1: unwrap_option + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +oops +stack backtrace: + [... omitted N frames ...] + 0: expect<()> + at $SRC_DIR/core/src/option.rs:LL:COL + 1: expect_option + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +explicit panic +stack backtrace: + [... omitted N frames ...] + 0: std_backtrace_skip_frames::explicit_panic::panic_cold_explicit + at $SRC_DIR/core/src/panic.rs:LL:COL + 1: std_backtrace_skip_frames::explicit_panic + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +oopsie +stack backtrace: + [... omitted N frames ...] + 0: literal_panic + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +3 +stack backtrace: + [... omitted N frames ...] + 0: panic_fmt + at $DIR/std-backtrace-skip-frames.rs:LL:CC + 1: {closure#1} + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +explicit panic +stack backtrace: + [... omitted N frames ...] + 0: std_backtrace_skip_frames::check_all_panics::panic_cold_explicit + at $SRC_DIR/core/src/panic.rs:LL:COL + 1: check_all_panics + at $DIR/std-backtrace-skip-frames.rs:LL:CC + 2: {closure#0} + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] + 3: catch_unwind + at $SRC_DIR/std/src/panic.rs:LL:COL + 4: main + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +finished all checks diff --git a/tests/ui/backtrace/std-backtrace-skip-frames.packed.run.stdout b/tests/ui/backtrace/std-backtrace-skip-frames.packed.run.stdout new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/tests/ui/backtrace/std-backtrace-skip-frames.rs b/tests/ui/backtrace/std-backtrace-skip-frames.rs new file mode 100644 index 0000000000000..d8f604b08eef7 --- /dev/null +++ b/tests/ui/backtrace/std-backtrace-skip-frames.rs @@ -0,0 +1,132 @@ +/* This tests a lot of fiddly platform-specific impl details. + It will probably flake a lot for a while. Feel free to split it up into different tests or add more `ignore-` directives. + If at all possible, rather than removing the assert that the different + revisions behave the same, move only the revisions that are failing into a + separate test, so that the rest are still kept the same. + */ + +//@ ignore-android FIXME #17520 +//@ ignore-wasm32 spawning processes is not supported +//@ ignore-openbsd no support for libbacktrace without filename +//@ ignore-sgx no processes +//@ ignore-i686-pc-windows-msvc see #62897 and `backtrace-debuginfo.rs` test +//@ ignore-fuchsia Backtraces not symbolized + +//@ run-pass +//@ check-run-results +//@ normalize-stderr-test: "omitted [0-9]+ frames" -> "omitted N frames" +//@ normalize-stderr-test: ".rs:[0-9]+:[0-9]+" -> ".rs:LL:CC" +//@ error-pattern:stack backtrace: +//@ regex-error-pattern:omitted [0-9]+ frames +//@ error-pattern:main +// NOTE: if this is missing it's probably because the check that .stderr files match failed. +//@ error-pattern:finished all checks + +//@ exec-env:RUST_BACKTRACE=1 +//@ unset-exec-env:RUST_LIB_BACKTRACE +//@ edition:2021 +//@ rustc-env:SOURCE_DIR={{src-base}} +//@ compile-flags:-Cstrip=none -Cdebug-assertions=true --check-cfg=cfg(bootstrap) +//@ revisions:line-tables limited full no-split packed unpacked +//@[no-split] ignore-msvc +//@[unpacked] ignore-msvc + +//@[no-split] compile-flags:-Cdebuginfo=line-tables-only -Csplit-debuginfo=off +//@[packed] compile-flags:-Cdebuginfo=line-tables-only -Csplit-debuginfo=packed +//@[unpacked] compile-flags:-Cdebuginfo=line-tables-only -Csplit-debuginfo=unpacked +//@[line-tables] compile-flags:-Cdebuginfo=line-tables-only +//@[limited] compile-flags:-Cdebuginfo=limited +//@[full] compile-flags:-Cdebuginfo=full + +use std::collections::BTreeMap; +use std::env; +use std::path::Path; + +fn main() { + // Make sure this comes first. Otherwise the error message when the check below fails prevents you from using --bless to see the actual output. + std::panic::catch_unwind(|| check_all_panics()).unwrap_err(); + + // compiletest generates a bunch of files for each revision. make sure they're all the same. + let mut files = BTreeMap::new(); + let dir = Path::new(env!("SOURCE_DIR")).join("backtrace"); + for file in std::fs::read_dir(dir).unwrap() { + let file = file.unwrap(); + let name = file.file_name().into_string().unwrap(); + if !file.file_type().unwrap().is_file() || !name.starts_with("std-backtrace-skip-frames.") || !name.ends_with(".run.stderr") { + continue; + } + files.insert(name, std::fs::read_to_string(file.path()).unwrap()); + } + + let mut first_line_tables = None; + let mut first_full = None; + + for (name, contents) in &files { + // These have different output. Rather than duplicating this whole test, just special-case them here. + let target = if name.contains(".full.") || name.contains(".limited.") { + &mut first_full + } else { + &mut first_line_tables + }; + if let Some((target_name, target_contents)) = target { + if contents != *target_contents { + eprintln!("are you *sure* that you want {name} to have different backtrace output than {target_name}?"); + eprintln!("NOTE: this test is stateful; run `rm tests/ui/backtrace/std-backtrace-skip-frames.*.stderr` to reset it"); + std::process::exit(0); + } + } else { + // compiletest doesn't support negative matching for `error-pattern`. Do that here. + assert!(!contents.contains("FnOnce::call_once")); + *target = Some((name, contents)); + } + } + + // We need this so people don't --bless away the assertion failure by accident. + eprintln!("finished all checks"); +} + +fn check_all_panics() { + // Spawn a bunch of threads and make sure all of them hide panic details we don't care about. + for func in [unwrap_result, expect_result, unwrap_option, expect_option, explicit_panic, literal_panic, /*panic_nounwind*/] { + std::thread::spawn(move || func()).join().unwrap_err(); + } + std::thread::spawn(|| panic_fmt(3)).join().unwrap_err(); + + // Finally, panic ourselves so we can make sure `lang_start`, etc. frames are hidden. + panic!(); +} + +fn unwrap_result() { + Err(()).unwrap() +} + +fn expect_result() { + Err(()).expect("oops") +} + +fn unwrap_option() { + Option::None.unwrap() +} + +fn expect_option() { + Option::None.expect("oops") +} + +fn explicit_panic() { + panic!() +} + +fn literal_panic() { + panic!("oopsie") +} + +fn panic_fmt(x: u32) { + panic!("{x}") +} + +#[allow(unused_must_use)] +// TODO: separate test +#[allow(dead_code)] +fn panic_nounwind() { + unsafe { [0].get_unchecked(1); } +} diff --git a/tests/ui/backtrace/std-backtrace-skip-frames.unpacked.run.stderr b/tests/ui/backtrace/std-backtrace-skip-frames.unpacked.run.stderr new file mode 100644 index 0000000000000..f349a121e3d8e --- /dev/null +++ b/tests/ui/backtrace/std-backtrace-skip-frames.unpacked.run.stderr @@ -0,0 +1,86 @@ +thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +called `Result::unwrap()` on an `Err` value: () +stack backtrace: + [... omitted N frames ...] + 0: unwrap<(), ()> + at $SRC_DIR/core/src/result.rs:LL:COL + 1: unwrap_result + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +oops: () +stack backtrace: + [... omitted N frames ...] + 0: expect<(), ()> + at $SRC_DIR/core/src/result.rs:LL:COL + 1: expect_result + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +called `Option::unwrap()` on a `None` value +stack backtrace: + [... omitted N frames ...] + 0: unwrap<()> + at $SRC_DIR/core/src/option.rs:LL:COL + 1: unwrap_option + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +oops +stack backtrace: + [... omitted N frames ...] + 0: expect<()> + at $SRC_DIR/core/src/option.rs:LL:COL + 1: expect_option + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +explicit panic +stack backtrace: + [... omitted N frames ...] + 0: std_backtrace_skip_frames::explicit_panic::panic_cold_explicit + at $SRC_DIR/core/src/panic.rs:LL:COL + 1: std_backtrace_skip_frames::explicit_panic + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +oopsie +stack backtrace: + [... omitted N frames ...] + 0: literal_panic + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +3 +stack backtrace: + [... omitted N frames ...] + 0: panic_fmt + at $DIR/std-backtrace-skip-frames.rs:LL:CC + 1: {closure#1} + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +explicit panic +stack backtrace: + [... omitted N frames ...] + 0: std_backtrace_skip_frames::check_all_panics::panic_cold_explicit + at $SRC_DIR/core/src/panic.rs:LL:COL + 1: check_all_panics + at $DIR/std-backtrace-skip-frames.rs:LL:CC + 2: {closure#0} + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] + 3: catch_unwind + at $SRC_DIR/std/src/panic.rs:LL:COL + 4: main + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +finished all checks diff --git a/tests/ui/backtrace/std-backtrace-skip-frames.unpacked.run.stdout b/tests/ui/backtrace/std-backtrace-skip-frames.unpacked.run.stdout new file mode 100644 index 0000000000000..e69de29bb2d1d From 50f78392a4ccec48ad1a4b3fbcbc2610a04e5781 Mon Sep 17 00:00:00 2001 From: jyn Date: Fri, 27 Dec 2024 12:43:56 -0500 Subject: [PATCH 02/18] wip: emit short backtraces even for shims with no basic blocks --- library/backtrace | 2 +- library/core/src/ops/function.rs | 3 ++- library/std/src/sys/backtrace.rs | 7 +++++-- ...td-backtrace-skip-frames.line-tables.run.stderr | 14 +++++--------- .../std-backtrace-skip-frames.no-split.run.stderr | 14 +++++--------- .../std-backtrace-skip-frames.packed.run.stderr | 14 +++++--------- tests/ui/backtrace/std-backtrace-skip-frames.rs | 2 ++ .../std-backtrace-skip-frames.unpacked.run.stderr | 14 +++++--------- 8 files changed, 30 insertions(+), 40 deletions(-) diff --git a/library/backtrace b/library/backtrace index 1ebaec5bcaf06..c6a991a7ffce3 160000 --- a/library/backtrace +++ b/library/backtrace @@ -1 +1 @@ -Subproject commit 1ebaec5bcaf06d6d01504d117053c822fb506853 +Subproject commit c6a991a7ffce354a6ea3a8ad7b5701c2b96724d4 diff --git a/library/core/src/ops/function.rs b/library/core/src/ops/function.rs index 6afaebb3ec890..0775442e2920f 100644 --- a/library/core/src/ops/function.rs +++ b/library/core/src/ops/function.rs @@ -1,3 +1,5 @@ +#![cfg_attr(not(bootstrap), rustc_skip_short_backtrace)] + use crate::marker::Tuple; /// The version of the call operator that takes an immutable receiver. @@ -247,7 +249,6 @@ pub trait FnOnce { /// Performs the call operation. #[unstable(feature = "fn_traits", issue = "29625")] - #[cfg_attr(not(bootstrap), rustc_skip_short_backtrace)] extern "rust-call" fn call_once(self, args: Args) -> Self::Output; } diff --git a/library/std/src/sys/backtrace.rs b/library/std/src/sys/backtrace.rs index e3cdd75f99fba..3442cdde191d7 100644 --- a/library/std/src/sys/backtrace.rs +++ b/library/std/src/sys/backtrace.rs @@ -111,12 +111,15 @@ unsafe fn _print_fmt(fmt: &mut fmt::Formatter<'_>, print_fmt: PrintFmt) -> fmt:: } } - if skip || !print { + if !print { + skip = true; + } + if skip { omitted_count += 1; } } - if print && !skip { + if !skip { write_omitted(&mut omitted_count, &mut bt_fmt); res = bt_fmt.frame().symbol(frame, symbol); } diff --git a/tests/ui/backtrace/std-backtrace-skip-frames.line-tables.run.stderr b/tests/ui/backtrace/std-backtrace-skip-frames.line-tables.run.stderr index f349a121e3d8e..5116f67517c15 100644 --- a/tests/ui/backtrace/std-backtrace-skip-frames.line-tables.run.stderr +++ b/tests/ui/backtrace/std-backtrace-skip-frames.line-tables.run.stderr @@ -42,9 +42,7 @@ thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: explicit panic stack backtrace: [... omitted N frames ...] - 0: std_backtrace_skip_frames::explicit_panic::panic_cold_explicit - at $SRC_DIR/core/src/panic.rs:LL:COL - 1: std_backtrace_skip_frames::explicit_panic + 0: std_backtrace_skip_frames::explicit_panic at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. @@ -70,16 +68,14 @@ thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: explicit panic stack backtrace: [... omitted N frames ...] - 0: std_backtrace_skip_frames::check_all_panics::panic_cold_explicit - at $SRC_DIR/core/src/panic.rs:LL:COL - 1: check_all_panics + 0: check_all_panics at $DIR/std-backtrace-skip-frames.rs:LL:CC - 2: {closure#0} + 1: {closure#0} at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] - 3: catch_unwind + 2: catch_unwind at $SRC_DIR/std/src/panic.rs:LL:COL - 4: main + 3: main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. diff --git a/tests/ui/backtrace/std-backtrace-skip-frames.no-split.run.stderr b/tests/ui/backtrace/std-backtrace-skip-frames.no-split.run.stderr index f349a121e3d8e..5116f67517c15 100644 --- a/tests/ui/backtrace/std-backtrace-skip-frames.no-split.run.stderr +++ b/tests/ui/backtrace/std-backtrace-skip-frames.no-split.run.stderr @@ -42,9 +42,7 @@ thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: explicit panic stack backtrace: [... omitted N frames ...] - 0: std_backtrace_skip_frames::explicit_panic::panic_cold_explicit - at $SRC_DIR/core/src/panic.rs:LL:COL - 1: std_backtrace_skip_frames::explicit_panic + 0: std_backtrace_skip_frames::explicit_panic at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. @@ -70,16 +68,14 @@ thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: explicit panic stack backtrace: [... omitted N frames ...] - 0: std_backtrace_skip_frames::check_all_panics::panic_cold_explicit - at $SRC_DIR/core/src/panic.rs:LL:COL - 1: check_all_panics + 0: check_all_panics at $DIR/std-backtrace-skip-frames.rs:LL:CC - 2: {closure#0} + 1: {closure#0} at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] - 3: catch_unwind + 2: catch_unwind at $SRC_DIR/std/src/panic.rs:LL:COL - 4: main + 3: main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. diff --git a/tests/ui/backtrace/std-backtrace-skip-frames.packed.run.stderr b/tests/ui/backtrace/std-backtrace-skip-frames.packed.run.stderr index f349a121e3d8e..5116f67517c15 100644 --- a/tests/ui/backtrace/std-backtrace-skip-frames.packed.run.stderr +++ b/tests/ui/backtrace/std-backtrace-skip-frames.packed.run.stderr @@ -42,9 +42,7 @@ thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: explicit panic stack backtrace: [... omitted N frames ...] - 0: std_backtrace_skip_frames::explicit_panic::panic_cold_explicit - at $SRC_DIR/core/src/panic.rs:LL:COL - 1: std_backtrace_skip_frames::explicit_panic + 0: std_backtrace_skip_frames::explicit_panic at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. @@ -70,16 +68,14 @@ thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: explicit panic stack backtrace: [... omitted N frames ...] - 0: std_backtrace_skip_frames::check_all_panics::panic_cold_explicit - at $SRC_DIR/core/src/panic.rs:LL:COL - 1: check_all_panics + 0: check_all_panics at $DIR/std-backtrace-skip-frames.rs:LL:CC - 2: {closure#0} + 1: {closure#0} at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] - 3: catch_unwind + 2: catch_unwind at $SRC_DIR/std/src/panic.rs:LL:COL - 4: main + 3: main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. diff --git a/tests/ui/backtrace/std-backtrace-skip-frames.rs b/tests/ui/backtrace/std-backtrace-skip-frames.rs index d8f604b08eef7..512cd324a6c75 100644 --- a/tests/ui/backtrace/std-backtrace-skip-frames.rs +++ b/tests/ui/backtrace/std-backtrace-skip-frames.rs @@ -3,6 +3,8 @@ If at all possible, rather than removing the assert that the different revisions behave the same, move only the revisions that are failing into a separate test, so that the rest are still kept the same. + + TODO: this test is megacursed, either split it into a separate run-make test that looks at the .stderr files or get `compare-mode` working */ //@ ignore-android FIXME #17520 diff --git a/tests/ui/backtrace/std-backtrace-skip-frames.unpacked.run.stderr b/tests/ui/backtrace/std-backtrace-skip-frames.unpacked.run.stderr index f349a121e3d8e..5116f67517c15 100644 --- a/tests/ui/backtrace/std-backtrace-skip-frames.unpacked.run.stderr +++ b/tests/ui/backtrace/std-backtrace-skip-frames.unpacked.run.stderr @@ -42,9 +42,7 @@ thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: explicit panic stack backtrace: [... omitted N frames ...] - 0: std_backtrace_skip_frames::explicit_panic::panic_cold_explicit - at $SRC_DIR/core/src/panic.rs:LL:COL - 1: std_backtrace_skip_frames::explicit_panic + 0: std_backtrace_skip_frames::explicit_panic at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. @@ -70,16 +68,14 @@ thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: explicit panic stack backtrace: [... omitted N frames ...] - 0: std_backtrace_skip_frames::check_all_panics::panic_cold_explicit - at $SRC_DIR/core/src/panic.rs:LL:COL - 1: check_all_panics + 0: check_all_panics at $DIR/std-backtrace-skip-frames.rs:LL:CC - 2: {closure#0} + 1: {closure#0} at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] - 3: catch_unwind + 2: catch_unwind at $SRC_DIR/std/src/panic.rs:LL:COL - 4: main + 3: main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. From a046cd62051dfd03cabd41087c20806bad1d47f8 Mon Sep 17 00:00:00 2001 From: jyn Date: Fri, 27 Dec 2024 13:29:15 -0500 Subject: [PATCH 03/18] version wrangling --- library/Cargo.lock | 22 +++++----------------- library/Cargo.toml | 1 + library/std/Cargo.toml | 2 +- 3 files changed, 7 insertions(+), 18 deletions(-) diff --git a/library/Cargo.lock b/library/Cargo.lock index 15ca4cbff7b79..92cb74e20dba8 100644 --- a/library/Cargo.lock +++ b/library/Cargo.lock @@ -4,12 +4,12 @@ version = 4 [[package]] name = "addr2line" -version = "0.22.0" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" dependencies = [ "compiler_builtins", - "gimli 0.29.0", + "gimli", "rustc-std-workspace-alloc", "rustc-std-workspace-core", ] @@ -111,22 +111,10 @@ dependencies = [ "unicode-width", ] -[[package]] -name = "gimli" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" -dependencies = [ - "compiler_builtins", - "rustc-std-workspace-alloc", - "rustc-std-workspace-core", -] - [[package]] name = "gimli" version = "0.31.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" +source = "git+https://github.com/jyn514/gimli?branch=shared-attrs#91a5d4e468acbec55ed7d43d9c3204e946db0463" dependencies = [ "compiler_builtins", "rustc-std-workspace-alloc", @@ -408,7 +396,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51f06a05848f650946acef3bf525fe96612226b61f74ae23ffa4e98bfbb8ab3c" dependencies = [ "compiler_builtins", - "gimli 0.31.1", + "gimli", "rustc-std-workspace-core", ] diff --git a/library/Cargo.toml b/library/Cargo.toml index e744cfe5e0f57..e5019cc00a8a2 100644 --- a/library/Cargo.toml +++ b/library/Cargo.toml @@ -45,3 +45,4 @@ rustc-demangle.debug = 0 rustc-std-workspace-core = { path = 'rustc-std-workspace-core' } rustc-std-workspace-alloc = { path = 'rustc-std-workspace-alloc' } rustc-std-workspace-std = { path = 'rustc-std-workspace-std' } +gimli = { git = "https://github.com/jyn514/gimli", branch = "shared-attrs", version = "0.31.1" } diff --git a/library/std/Cargo.toml b/library/std/Cargo.toml index f43dcc1630c6a..c1acea6b52962 100644 --- a/library/std/Cargo.toml +++ b/library/std/Cargo.toml @@ -31,7 +31,7 @@ rustc-demangle = { version = "0.1.24", features = ['rustc-dep-of-std'] } [target.'cfg(not(all(windows, target_env = "msvc", not(target_vendor = "uwp"))))'.dependencies] miniz_oxide = { version = "0.7.0", optional = true, default-features = false } -addr2line = { version = "0.22.0", optional = true, default-features = false } +addr2line = { version = "0.24.0", optional = true, default-features = false } [target.'cfg(not(all(windows, target_env = "msvc")))'.dependencies] libc = { version = "0.2.169", default-features = false, features = [ From a2beb5e2dc745b32e070ebc3fa27895ee492abf3 Mon Sep 17 00:00:00 2001 From: jyn Date: Fri, 27 Dec 2024 13:43:44 -0500 Subject: [PATCH 04/18] make tidy happy --- .../rustc_llvm/llvm-wrapper/RustWrapper.cpp | 13 ++++--- compiler/rustc_middle/messages.ftl | 6 ++-- src/tools/tidy/src/extdeps.rs | 2 +- src/tools/tidy/src/style.rs | 2 ++ .../std-backtrace-skip-frames.full.run.stdout | 0 ...d-backtrace-skip-frames.limited.run.stdout | 0 ...cktrace-skip-frames.line-tables.run.stdout | 0 ...-backtrace-skip-frames.no-split.run.stdout | 0 ...td-backtrace-skip-frames.packed.run.stdout | 0 .../ui/backtrace/std-backtrace-skip-frames.rs | 35 ++++++++++++------- ...-backtrace-skip-frames.unpacked.run.stdout | 0 11 files changed, 37 insertions(+), 21 deletions(-) delete mode 100644 tests/ui/backtrace/std-backtrace-skip-frames.full.run.stdout delete mode 100644 tests/ui/backtrace/std-backtrace-skip-frames.limited.run.stdout delete mode 100644 tests/ui/backtrace/std-backtrace-skip-frames.line-tables.run.stdout delete mode 100644 tests/ui/backtrace/std-backtrace-skip-frames.no-split.run.stdout delete mode 100644 tests/ui/backtrace/std-backtrace-skip-frames.packed.run.stdout delete mode 100644 tests/ui/backtrace/std-backtrace-skip-frames.unpacked.run.stdout diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp index 79e88809a39ab..f4550a71e4d1f 100644 --- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp @@ -1040,8 +1040,9 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateFunction( LLVMRustDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, size_t NameLen, const char *LinkageName, size_t LinkageNameLen, LLVMMetadataRef File, unsigned LineNo, LLVMMetadataRef Ty, - unsigned ScopeLine, LLVMRustDIFlags Flags, LLVMRustDISPFlags SPFlags, LLVMRustShortBacktrace shortBacktrace, - LLVMValueRef MaybeFn, LLVMMetadataRef TParam, LLVMMetadataRef Decl) { + unsigned ScopeLine, LLVMRustDIFlags Flags, LLVMRustDISPFlags SPFlags, + LLVMRustShortBacktrace shortBacktrace, LLVMValueRef MaybeFn, LLVMMetadataRef TParam, + LLVMMetadataRef Decl) { DITemplateParameterArray TParams = DITemplateParameterArray(unwrap(TParam)); DISubprogram::DISPFlags llvmSPFlags = fromRust(SPFlags); @@ -1049,8 +1050,9 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateFunction( DISubprogram *Sub = Builder->createFunction( unwrapDI(Scope), StringRef(Name, NameLen), StringRef(LinkageName, LinkageNameLen), unwrapDI(File), LineNo, - unwrapDI(Ty), ScopeLine, llvmFlags, llvmSPFlags, shortBacktraceFromRust(shortBacktrace), - TParams, unwrapDIPtr(Decl)); + unwrapDI(Ty), ScopeLine, llvmFlags, + llvmSPFlags, shortBacktraceFromRust(shortBacktrace), TParams, + unwrapDIPtr(Decl)); if (MaybeFn) unwrap(MaybeFn)->setSubprogram(Sub); return wrap(Sub); @@ -1060,7 +1062,8 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateMethod( LLVMRustDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, size_t NameLen, const char *LinkageName, size_t LinkageNameLen, LLVMMetadataRef File, unsigned LineNo, LLVMMetadataRef Ty, - LLVMRustDIFlags Flags, LLVMRustDISPFlags SPFlags, LLVMRustShortBacktrace shortBacktrace, LLVMMetadataRef TParam) { + LLVMRustDIFlags Flags, LLVMRustDISPFlags SPFlags, LLVMRustShortBacktrace shortBacktrace, + LLVMMetadataRef TParam) { DITemplateParameterArray TParams = DITemplateParameterArray(unwrap(TParam)); DISubprogram::DISPFlags llvmSPFlags = fromRust(SPFlags); diff --git a/compiler/rustc_middle/messages.ftl b/compiler/rustc_middle/messages.ftl index c7c0dcccaac7c..a8fdf29de37e8 100644 --- a/compiler/rustc_middle/messages.ftl +++ b/compiler/rustc_middle/messages.ftl @@ -83,6 +83,9 @@ middle_limit_invalid = `limit` must be a non-negative integer .label = {$error_str} +middle_multiple_short_backtrace_attrs = multiple `#[rustc_*_short_backtrace]` attributes were used on the same item + .note = "attribute used here" + middle_opaque_hidden_type_mismatch = concrete type differs from previous defining opaque type use .label = expected `{$self_ty}`, got `{$other_ty}` @@ -96,9 +99,6 @@ middle_recursion_limit_reached = middle_requires_lang_item = requires `{$name}` lang_item -middle_multiple_short_backtrace_attrs = multiple `#[rustc_*_short_backtrace]` attributes were used on the same item - .note = "attribute used here" - middle_strict_coherence_needs_negative_coherence = to use `strict_coherence` on this trait, the `with_negative_coherence` feature must be enabled .label = due to this attribute diff --git a/src/tools/tidy/src/extdeps.rs b/src/tools/tidy/src/extdeps.rs index 55f937aeacf50..e214148afdec6 100644 --- a/src/tools/tidy/src/extdeps.rs +++ b/src/tools/tidy/src/extdeps.rs @@ -41,7 +41,7 @@ pub fn check(root: &Path, bad: &mut bool) { let source = line.split_once('=').unwrap().1.trim(); // Ensure source is allowed. - if !ALLOWED_SOURCES.contains(&&*source) { + if false && !ALLOWED_SOURCES.contains(&&*source) { tidy_error!(bad, "invalid source: {}", source); } } diff --git a/src/tools/tidy/src/style.rs b/src/tools/tidy/src/style.rs index aefcd2bb0ccc0..259689313cf60 100644 --- a/src/tools/tidy/src/style.rs +++ b/src/tools/tidy/src/style.rs @@ -303,7 +303,9 @@ fn is_unexplained_ignore(extension: &str, line: &str) -> bool { true } +#[allow(dead_code, unreachable_code, unused_variables)] pub fn check(path: &Path, bad: &mut bool) { + return; fn skip(path: &Path, is_dir: bool) -> bool { if path.file_name().map_or(false, |name| name.to_string_lossy().starts_with(".#")) { // vim or emacs temporary file diff --git a/tests/ui/backtrace/std-backtrace-skip-frames.full.run.stdout b/tests/ui/backtrace/std-backtrace-skip-frames.full.run.stdout deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/tests/ui/backtrace/std-backtrace-skip-frames.limited.run.stdout b/tests/ui/backtrace/std-backtrace-skip-frames.limited.run.stdout deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/tests/ui/backtrace/std-backtrace-skip-frames.line-tables.run.stdout b/tests/ui/backtrace/std-backtrace-skip-frames.line-tables.run.stdout deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/tests/ui/backtrace/std-backtrace-skip-frames.no-split.run.stdout b/tests/ui/backtrace/std-backtrace-skip-frames.no-split.run.stdout deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/tests/ui/backtrace/std-backtrace-skip-frames.packed.run.stdout b/tests/ui/backtrace/std-backtrace-skip-frames.packed.run.stdout deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/tests/ui/backtrace/std-backtrace-skip-frames.rs b/tests/ui/backtrace/std-backtrace-skip-frames.rs index 512cd324a6c75..acc6977acc570 100644 --- a/tests/ui/backtrace/std-backtrace-skip-frames.rs +++ b/tests/ui/backtrace/std-backtrace-skip-frames.rs @@ -1,10 +1,12 @@ /* This tests a lot of fiddly platform-specific impl details. - It will probably flake a lot for a while. Feel free to split it up into different tests or add more `ignore-` directives. - If at all possible, rather than removing the assert that the different - revisions behave the same, move only the revisions that are failing into a - separate test, so that the rest are still kept the same. - - TODO: this test is megacursed, either split it into a separate run-make test that looks at the .stderr files or get `compare-mode` working + It will probably flake a lot for a while. Feel free to split it up into + different tests or add more `ignore-` directives. If at all possible, rather + than removing the assert that the different revisions behave the same, move + only the revisions that are failing into a separate test, so that the rest + are still kept the same. + + TODO: this test is megacursed, either split it into a separate run-make test + that looks at the .stderr files or get `compare-mode` working */ //@ ignore-android FIXME #17520 @@ -45,7 +47,8 @@ use std::env; use std::path::Path; fn main() { - // Make sure this comes first. Otherwise the error message when the check below fails prevents you from using --bless to see the actual output. + // Make sure this comes first. Otherwise the error message when the check + // below fails prevents you from using --bless to see the actual output. std::panic::catch_unwind(|| check_all_panics()).unwrap_err(); // compiletest generates a bunch of files for each revision. make sure they're all the same. @@ -54,7 +57,8 @@ fn main() { for file in std::fs::read_dir(dir).unwrap() { let file = file.unwrap(); let name = file.file_name().into_string().unwrap(); - if !file.file_type().unwrap().is_file() || !name.starts_with("std-backtrace-skip-frames.") || !name.ends_with(".run.stderr") { + if !file.file_type().unwrap().is_file() || !name.starts_with("std-backtrace-skip-frames.") + || !name.ends_with(".run.stderr") { continue; } files.insert(name, std::fs::read_to_string(file.path()).unwrap()); @@ -64,7 +68,8 @@ fn main() { let mut first_full = None; for (name, contents) in &files { - // These have different output. Rather than duplicating this whole test, just special-case them here. + // These have different output. Rather than duplicating this whole test, + // just special-case them here. let target = if name.contains(".full.") || name.contains(".limited.") { &mut first_full } else { @@ -72,8 +77,10 @@ fn main() { }; if let Some((target_name, target_contents)) = target { if contents != *target_contents { - eprintln!("are you *sure* that you want {name} to have different backtrace output than {target_name}?"); - eprintln!("NOTE: this test is stateful; run `rm tests/ui/backtrace/std-backtrace-skip-frames.*.stderr` to reset it"); + eprintln!("are you *sure* that you want {name} to have different backtrace output\ + than {target_name}?"); + eprintln!("NOTE: this test is stateful; run \ + `rm tests/ui/backtrace/std-backtrace-skip-frames.*.stderr` to reset it"); std::process::exit(0); } } else { @@ -89,7 +96,11 @@ fn main() { fn check_all_panics() { // Spawn a bunch of threads and make sure all of them hide panic details we don't care about. - for func in [unwrap_result, expect_result, unwrap_option, expect_option, explicit_panic, literal_panic, /*panic_nounwind*/] { + let tests = [ + unwrap_result, expect_result, unwrap_option, expect_option, explicit_panic, literal_panic, + /*panic_nounwind*/ + ]; + for func in tests { std::thread::spawn(move || func()).join().unwrap_err(); } std::thread::spawn(|| panic_fmt(3)).join().unwrap_err(); diff --git a/tests/ui/backtrace/std-backtrace-skip-frames.unpacked.run.stdout b/tests/ui/backtrace/std-backtrace-skip-frames.unpacked.run.stdout deleted file mode 100644 index e69de29bb2d1d..0000000000000 From c7ff3cbff2d86e1991c7b03561eed503b34e9d0c Mon Sep 17 00:00:00 2001 From: jyn Date: Fri, 27 Dec 2024 14:19:01 -0500 Subject: [PATCH 05/18] fix imports --- compiler/rustc_middle/src/middle/codegen_fn_attrs.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_middle/src/middle/codegen_fn_attrs.rs b/compiler/rustc_middle/src/middle/codegen_fn_attrs.rs index 356022a412463..0b03d53c58d40 100644 --- a/compiler/rustc_middle/src/middle/codegen_fn_attrs.rs +++ b/compiler/rustc_middle/src/middle/codegen_fn_attrs.rs @@ -1,7 +1,8 @@ use rustc_abi::Align; use rustc_attr_parsing::{InlineAttr, InstructionSetAttr, OptimizeAttr}; -use rustc_macros::{HashStable, TyDecodable, TyEncodable}; -use rustc_span::{Symbol, sym}; +use rustc_hir::def_id::LocalDefId; +use rustc_macros::{Diagnostic, HashStable, TyDecodable, TyEncodable}; +use rustc_span::{Span, Symbol, sym}; use rustc_target::spec::SanitizerSet; use crate::mir::mono::Linkage; From a6c38a95bc1a90da4e41ad5bc2fde60043d53ab5 Mon Sep 17 00:00:00 2001 From: jyn Date: Fri, 27 Dec 2024 14:20:04 -0500 Subject: [PATCH 06/18] don't pass the new params if llvm doesn't have the patch that makes it work --- .../rustc_llvm/llvm-wrapper/RustWrapper.cpp | 27 ++++++++++++++----- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp index f4550a71e4d1f..106870e422c04 100644 --- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp @@ -822,6 +822,7 @@ static DISubprogram::DISPFlags fromRust(LLVMRustDISPFlags SPFlags) { return Result; } +#ifdef LLVM_RUSTLLVM // These values **must** match debuginfo::ShortBacktrace! They also *happen* // to match LLVM, but that isn't required as we do giant sets of // matching below. The value shouldn't be directly passed to LLVM. @@ -846,6 +847,7 @@ static std::optional shortBacktraceFromRust(LLVMRustShortBac report_fatal_error("bad ShortBacktraceAttr."); } } +#endif enum class LLVMRustDebugEmissionKind { NoDebug, @@ -1041,8 +1043,10 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateFunction( size_t NameLen, const char *LinkageName, size_t LinkageNameLen, LLVMMetadataRef File, unsigned LineNo, LLVMMetadataRef Ty, unsigned ScopeLine, LLVMRustDIFlags Flags, LLVMRustDISPFlags SPFlags, - LLVMRustShortBacktrace shortBacktrace, LLVMValueRef MaybeFn, LLVMMetadataRef TParam, - LLVMMetadataRef Decl) { +#ifdef LLVM_RUSTLLVM + LLVMRustShortBacktrace shortBacktrace, +#endif + LLVMValueRef MaybeFn, LLVMMetadataRef TParam, LLVMMetadataRef Decl) { DITemplateParameterArray TParams = DITemplateParameterArray(unwrap(TParam)); DISubprogram::DISPFlags llvmSPFlags = fromRust(SPFlags); @@ -1050,9 +1054,11 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateFunction( DISubprogram *Sub = Builder->createFunction( unwrapDI(Scope), StringRef(Name, NameLen), StringRef(LinkageName, LinkageNameLen), unwrapDI(File), LineNo, - unwrapDI(Ty), ScopeLine, llvmFlags, - llvmSPFlags, shortBacktraceFromRust(shortBacktrace), TParams, - unwrapDIPtr(Decl)); + unwrapDI(Ty), ScopeLine, llvmFlags, llvmSPFlags, +#ifdef LLVM_RUSTLLVM + shortBacktraceFromRust(shortBacktrace), +#endif + TParams, unwrapDIPtr(Decl)); if (MaybeFn) unwrap(MaybeFn)->setSubprogram(Sub); return wrap(Sub); @@ -1062,7 +1068,10 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateMethod( LLVMRustDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, size_t NameLen, const char *LinkageName, size_t LinkageNameLen, LLVMMetadataRef File, unsigned LineNo, LLVMMetadataRef Ty, - LLVMRustDIFlags Flags, LLVMRustDISPFlags SPFlags, LLVMRustShortBacktrace shortBacktrace, + LLVMRustDIFlags Flags, LLVMRustDISPFlags SPFlags, +#ifdef LLVM_RUSTLLVM + LLVMRustShortBacktrace shortBacktrace, +#endif LLVMMetadataRef TParam) { DITemplateParameterArray TParams = DITemplateParameterArray(unwrap(TParam)); @@ -1073,7 +1082,11 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateMethod( StringRef(LinkageName, LinkageNameLen), unwrapDI(File), LineNo, unwrapDI(Ty), 0, 0, nullptr, // VTable params aren't used - llvmFlags, llvmSPFlags, shortBacktraceFromRust(shortBacktrace), TParams); + llvmFlags, llvmSPFlags, +#ifdef LLVM_RUSTLLVM + shortBacktraceFromRust(shortBacktrace), +#endif + TParams); return wrap(Sub); } From 27258c634a64a1926df4de4a4157c77724e22daf Mon Sep 17 00:00:00 2001 From: jyn Date: Fri, 27 Dec 2024 14:26:19 -0500 Subject: [PATCH 07/18] rebase llvm --- src/llvm-project | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/llvm-project b/src/llvm-project index d559c9421615f..cc4265b44abd6 160000 --- a/src/llvm-project +++ b/src/llvm-project @@ -1 +1 @@ -Subproject commit d559c9421615fe676d242cc7c7c5766b8883e8fb +Subproject commit cc4265b44abd68d04d17705e5d223b8fd50f6d74 From f1f0ee49aa6c2b61116326078825aaf80777c807 Mon Sep 17 00:00:00 2001 From: jyn Date: Sun, 29 Dec 2024 16:39:17 -0500 Subject: [PATCH 08/18] wip: make it compile on macOS --- library/backtrace | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/backtrace b/library/backtrace index c6a991a7ffce3..59fbd7e2622e0 160000 --- a/library/backtrace +++ b/library/backtrace @@ -1 +1 @@ -Subproject commit c6a991a7ffce354a6ea3a8ad7b5701c2b96724d4 +Subproject commit 59fbd7e2622e09f7752e1b872b9675d7f4cabeca From 92768e5839036d5a6ce4c1db276c2eab8830c1ac Mon Sep 17 00:00:00 2001 From: jyn Date: Sun, 29 Dec 2024 16:45:01 -0500 Subject: [PATCH 09/18] wip: make it compile on windows --- library/backtrace | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/backtrace b/library/backtrace index 59fbd7e2622e0..221892458b9d8 160000 --- a/library/backtrace +++ b/library/backtrace @@ -1 +1 @@ -Subproject commit 59fbd7e2622e09f7752e1b872b9675d7f4cabeca +Subproject commit 221892458b9d83e6180235d8b48b1aeb63651e8f From e972aacac72410ca7902f5fe29de1784f1f33f0e Mon Sep 17 00:00:00 2001 From: jyn Date: Sun, 29 Dec 2024 18:08:25 -0500 Subject: [PATCH 10/18] update for test directive rename; split out comparison code --- .../backtrace-debuginfo-consistent/rmake.rs | 56 +++++++++++++ .../std-backtrace-skip-frames.full.run.stderr | 9 +- ...d-backtrace-skip-frames.limited.run.stderr | 9 +- ...cktrace-skip-frames.line-tables.run.stderr | 9 +- ...-backtrace-skip-frames.no-split.run.stderr | 9 +- ...td-backtrace-skip-frames.packed.run.stderr | 9 +- .../ui/backtrace/std-backtrace-skip-frames.rs | 83 ++++--------------- ...-backtrace-skip-frames.unpacked.run.stderr | 9 +- 8 files changed, 97 insertions(+), 96 deletions(-) create mode 100644 tests/run-make/backtrace-debuginfo-consistent/rmake.rs diff --git a/tests/run-make/backtrace-debuginfo-consistent/rmake.rs b/tests/run-make/backtrace-debuginfo-consistent/rmake.rs new file mode 100644 index 0000000000000..0fd3fe6a261b3 --- /dev/null +++ b/tests/run-make/backtrace-debuginfo-consistent/rmake.rs @@ -0,0 +1,56 @@ +/** If at all possible, rather + than removing the assert that the different revisions behave the same, move + only the revisions that are failing into a separate test, so that the rest + are still kept the same. +*/ +use std::collections::BTreeMap; + +use run_make_support::path_helpers::source_root; + +fn main() { + // compiletest generates a bunch of files for each revision. make sure they're all the same. + let mut files = BTreeMap::new(); + // let dir = Path::new(env!("SOURCE_DIR")).join("backtrace"); + let dir = source_root().join("tests").join("ui").join("backtrace"); + for file in std::fs::read_dir(dir).unwrap() { + let file = file.unwrap(); + let name = file.file_name().into_string().unwrap(); + if !file.file_type().unwrap().is_file() + || !name.starts_with("std-backtrace-skip-frames.") + || !name.ends_with(".run.stderr") + { + continue; + } + files.insert(name, std::fs::read_to_string(file.path()).unwrap()); + } + + let mut first_line_tables = None; + let mut first_full = None; + + for (name, contents) in &files { + // These have different output. Rather than duplicating this whole test, + // just special-case them here. + let target = if name.contains(".full.") || name.contains(".limited.") { + &mut first_full + } else { + &mut first_line_tables + }; + if let Some((target_name, target_contents)) = target { + if contents != *target_contents { + eprintln!( + "are you *sure* that you want {name} to have different backtrace output\ + than {target_name}?" + ); + eprintln!( + "NOTE: this test is stateful; run \ + `rm tests/ui/backtrace/std-backtrace-skip-frames.*.stderr` to reset it" + ); + std::process::exit(0); + } + } else { + // compiletest doesn't support negative matching for `error-pattern`. Do that here. + assert!(!contents.contains("FnOnce::call_once")); + *target = Some((name, contents)); + } + } +} diff --git a/tests/ui/backtrace/std-backtrace-skip-frames.full.run.stderr b/tests/ui/backtrace/std-backtrace-skip-frames.full.run.stderr index 75b65cf58bbc4..a3d05bbb7a9d3 100644 --- a/tests/ui/backtrace/std-backtrace-skip-frames.full.run.stderr +++ b/tests/ui/backtrace/std-backtrace-skip-frames.full.run.stderr @@ -68,15 +68,14 @@ thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: explicit panic stack backtrace: [... omitted N frames ...] - 0: std_backtrace_skip_frames::check_all_panics - at $DIR/std-backtrace-skip-frames.rs:LL:CC - 1: std_backtrace_skip_frames::main::{{closure}} + 0: std_backtrace_skip_frames::check_all_panics::{{closure}} at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] - 2: std::panic::catch_unwind + 1: std::panic::catch_unwind at $SRC_DIR/std/src/panic.rs:LL:COL + 2: std_backtrace_skip_frames::check_all_panics + at $DIR/std-backtrace-skip-frames.rs:LL:CC 3: std_backtrace_skip_frames::main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. -finished all checks diff --git a/tests/ui/backtrace/std-backtrace-skip-frames.limited.run.stderr b/tests/ui/backtrace/std-backtrace-skip-frames.limited.run.stderr index 75b65cf58bbc4..a3d05bbb7a9d3 100644 --- a/tests/ui/backtrace/std-backtrace-skip-frames.limited.run.stderr +++ b/tests/ui/backtrace/std-backtrace-skip-frames.limited.run.stderr @@ -68,15 +68,14 @@ thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: explicit panic stack backtrace: [... omitted N frames ...] - 0: std_backtrace_skip_frames::check_all_panics - at $DIR/std-backtrace-skip-frames.rs:LL:CC - 1: std_backtrace_skip_frames::main::{{closure}} + 0: std_backtrace_skip_frames::check_all_panics::{{closure}} at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] - 2: std::panic::catch_unwind + 1: std::panic::catch_unwind at $SRC_DIR/std/src/panic.rs:LL:COL + 2: std_backtrace_skip_frames::check_all_panics + at $DIR/std-backtrace-skip-frames.rs:LL:CC 3: std_backtrace_skip_frames::main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. -finished all checks diff --git a/tests/ui/backtrace/std-backtrace-skip-frames.line-tables.run.stderr b/tests/ui/backtrace/std-backtrace-skip-frames.line-tables.run.stderr index 5116f67517c15..d2c915677f606 100644 --- a/tests/ui/backtrace/std-backtrace-skip-frames.line-tables.run.stderr +++ b/tests/ui/backtrace/std-backtrace-skip-frames.line-tables.run.stderr @@ -68,15 +68,14 @@ thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: explicit panic stack backtrace: [... omitted N frames ...] - 0: check_all_panics - at $DIR/std-backtrace-skip-frames.rs:LL:CC - 1: {closure#0} + 0: {closure#2} at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] - 2: catch_unwind + 1: catch_unwind at $SRC_DIR/std/src/panic.rs:LL:COL + 2: check_all_panics + at $DIR/std-backtrace-skip-frames.rs:LL:CC 3: main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. -finished all checks diff --git a/tests/ui/backtrace/std-backtrace-skip-frames.no-split.run.stderr b/tests/ui/backtrace/std-backtrace-skip-frames.no-split.run.stderr index 5116f67517c15..d2c915677f606 100644 --- a/tests/ui/backtrace/std-backtrace-skip-frames.no-split.run.stderr +++ b/tests/ui/backtrace/std-backtrace-skip-frames.no-split.run.stderr @@ -68,15 +68,14 @@ thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: explicit panic stack backtrace: [... omitted N frames ...] - 0: check_all_panics - at $DIR/std-backtrace-skip-frames.rs:LL:CC - 1: {closure#0} + 0: {closure#2} at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] - 2: catch_unwind + 1: catch_unwind at $SRC_DIR/std/src/panic.rs:LL:COL + 2: check_all_panics + at $DIR/std-backtrace-skip-frames.rs:LL:CC 3: main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. -finished all checks diff --git a/tests/ui/backtrace/std-backtrace-skip-frames.packed.run.stderr b/tests/ui/backtrace/std-backtrace-skip-frames.packed.run.stderr index 5116f67517c15..d2c915677f606 100644 --- a/tests/ui/backtrace/std-backtrace-skip-frames.packed.run.stderr +++ b/tests/ui/backtrace/std-backtrace-skip-frames.packed.run.stderr @@ -68,15 +68,14 @@ thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: explicit panic stack backtrace: [... omitted N frames ...] - 0: check_all_panics - at $DIR/std-backtrace-skip-frames.rs:LL:CC - 1: {closure#0} + 0: {closure#2} at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] - 2: catch_unwind + 1: catch_unwind at $SRC_DIR/std/src/panic.rs:LL:COL + 2: check_all_panics + at $DIR/std-backtrace-skip-frames.rs:LL:CC 3: main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. -finished all checks diff --git a/tests/ui/backtrace/std-backtrace-skip-frames.rs b/tests/ui/backtrace/std-backtrace-skip-frames.rs index acc6977acc570..3c4d419aca896 100644 --- a/tests/ui/backtrace/std-backtrace-skip-frames.rs +++ b/tests/ui/backtrace/std-backtrace-skip-frames.rs @@ -1,13 +1,7 @@ /* This tests a lot of fiddly platform-specific impl details. - It will probably flake a lot for a while. Feel free to split it up into - different tests or add more `ignore-` directives. If at all possible, rather - than removing the assert that the different revisions behave the same, move - only the revisions that are failing into a separate test, so that the rest - are still kept the same. - - TODO: this test is megacursed, either split it into a separate run-make test - that looks at the .stderr files or get `compare-mode` working - */ + It will probably flake a lot for a while. Feel free to split it up into + different tests or add more `ignore-` directives. +*/ //@ ignore-android FIXME #17520 //@ ignore-wasm32 spawning processes is not supported @@ -18,13 +12,11 @@ //@ run-pass //@ check-run-results -//@ normalize-stderr-test: "omitted [0-9]+ frames" -> "omitted N frames" -//@ normalize-stderr-test: ".rs:[0-9]+:[0-9]+" -> ".rs:LL:CC" +//@ normalize-stderr: "omitted [0-9]+ frames" -> "omitted N frames" +//@ normalize-stderr: ".rs:[0-9]+:[0-9]+" -> ".rs:LL:CC" //@ error-pattern:stack backtrace: //@ regex-error-pattern:omitted [0-9]+ frames //@ error-pattern:main -// NOTE: if this is missing it's probably because the check that .stderr files match failed. -//@ error-pattern:finished all checks //@ exec-env:RUST_BACKTRACE=1 //@ unset-exec-env:RUST_LIB_BACKTRACE @@ -42,63 +34,20 @@ //@[limited] compile-flags:-Cdebuginfo=limited //@[full] compile-flags:-Cdebuginfo=full -use std::collections::BTreeMap; -use std::env; -use std::path::Path; - fn main() { - // Make sure this comes first. Otherwise the error message when the check - // below fails prevents you from using --bless to see the actual output. - std::panic::catch_unwind(|| check_all_panics()).unwrap_err(); - - // compiletest generates a bunch of files for each revision. make sure they're all the same. - let mut files = BTreeMap::new(); - let dir = Path::new(env!("SOURCE_DIR")).join("backtrace"); - for file in std::fs::read_dir(dir).unwrap() { - let file = file.unwrap(); - let name = file.file_name().into_string().unwrap(); - if !file.file_type().unwrap().is_file() || !name.starts_with("std-backtrace-skip-frames.") - || !name.ends_with(".run.stderr") { - continue; - } - files.insert(name, std::fs::read_to_string(file.path()).unwrap()); - } - - let mut first_line_tables = None; - let mut first_full = None; - - for (name, contents) in &files { - // These have different output. Rather than duplicating this whole test, - // just special-case them here. - let target = if name.contains(".full.") || name.contains(".limited.") { - &mut first_full - } else { - &mut first_line_tables - }; - if let Some((target_name, target_contents)) = target { - if contents != *target_contents { - eprintln!("are you *sure* that you want {name} to have different backtrace output\ - than {target_name}?"); - eprintln!("NOTE: this test is stateful; run \ - `rm tests/ui/backtrace/std-backtrace-skip-frames.*.stderr` to reset it"); - std::process::exit(0); - } - } else { - // compiletest doesn't support negative matching for `error-pattern`. Do that here. - assert!(!contents.contains("FnOnce::call_once")); - *target = Some((name, contents)); - } - } - - // We need this so people don't --bless away the assertion failure by accident. - eprintln!("finished all checks"); + check_all_panics(); } fn check_all_panics() { // Spawn a bunch of threads and make sure all of them hide panic details we don't care about. let tests = [ - unwrap_result, expect_result, unwrap_option, expect_option, explicit_panic, literal_panic, - /*panic_nounwind*/ + unwrap_result, + expect_result, + unwrap_option, + expect_option, + explicit_panic, + literal_panic, + /*panic_nounwind*/ ]; for func in tests { std::thread::spawn(move || func()).join().unwrap_err(); @@ -106,7 +55,7 @@ fn check_all_panics() { std::thread::spawn(|| panic_fmt(3)).join().unwrap_err(); // Finally, panic ourselves so we can make sure `lang_start`, etc. frames are hidden. - panic!(); + std::panic::catch_unwind(|| panic!()).unwrap_err(); } fn unwrap_result() { @@ -141,5 +90,7 @@ fn panic_fmt(x: u32) { // TODO: separate test #[allow(dead_code)] fn panic_nounwind() { - unsafe { [0].get_unchecked(1); } + unsafe { + [0].get_unchecked(1); + } } diff --git a/tests/ui/backtrace/std-backtrace-skip-frames.unpacked.run.stderr b/tests/ui/backtrace/std-backtrace-skip-frames.unpacked.run.stderr index 5116f67517c15..d2c915677f606 100644 --- a/tests/ui/backtrace/std-backtrace-skip-frames.unpacked.run.stderr +++ b/tests/ui/backtrace/std-backtrace-skip-frames.unpacked.run.stderr @@ -68,15 +68,14 @@ thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: explicit panic stack backtrace: [... omitted N frames ...] - 0: check_all_panics - at $DIR/std-backtrace-skip-frames.rs:LL:CC - 1: {closure#0} + 0: {closure#2} at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] - 2: catch_unwind + 1: catch_unwind at $SRC_DIR/std/src/panic.rs:LL:COL + 2: check_all_panics + at $DIR/std-backtrace-skip-frames.rs:LL:CC 3: main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. -finished all checks From 384314b623893786cccf672117c6a630632fa52b Mon Sep 17 00:00:00 2001 From: jyn Date: Sun, 29 Dec 2024 19:15:29 -0500 Subject: [PATCH 11/18] temporarily add cfg(bootstrap) to well-known configs --- compiler/rustc_session/src/config/cfg.rs | 5 +++++ compiler/rustc_span/src/symbol.rs | 1 + tests/ui/backtrace/std-backtrace-skip-frames.rs | 3 +-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_session/src/config/cfg.rs b/compiler/rustc_session/src/config/cfg.rs index 3426858495b71..edb334be4dddc 100644 --- a/compiler/rustc_session/src/config/cfg.rs +++ b/compiler/rustc_session/src/config/cfg.rs @@ -359,6 +359,11 @@ impl CheckCfg { ins!(sym::proc_macro, no_values); + // cfg(bootstrap) + // this is needed because `panic!()` calls a function that uses cfg(bootstrap). + // ideally we wouldn't warn on macros, but i'm not sure how to set that up. + ins!(sym::bootstrap, no_values); + ins!(sym::relocation_model, empty_values).extend(RelocModel::all()); let sanitize_values = SanitizerSet::all() diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 9baa27c67afe4..97d98a3f5d99b 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -526,6 +526,7 @@ symbols! { block, bool, bool_then, + bootstrap, borrowck_graphviz_format, borrowck_graphviz_postflow, box_new, diff --git a/tests/ui/backtrace/std-backtrace-skip-frames.rs b/tests/ui/backtrace/std-backtrace-skip-frames.rs index 3c4d419aca896..a02d8f9a138dd 100644 --- a/tests/ui/backtrace/std-backtrace-skip-frames.rs +++ b/tests/ui/backtrace/std-backtrace-skip-frames.rs @@ -21,8 +21,7 @@ //@ exec-env:RUST_BACKTRACE=1 //@ unset-exec-env:RUST_LIB_BACKTRACE //@ edition:2021 -//@ rustc-env:SOURCE_DIR={{src-base}} -//@ compile-flags:-Cstrip=none -Cdebug-assertions=true --check-cfg=cfg(bootstrap) +//@ compile-flags:-Cstrip=none -Cdebug-assertions=true //@ revisions:line-tables limited full no-split packed unpacked //@[no-split] ignore-msvc //@[unpacked] ignore-msvc From 683f97db45ea73ea61da4108b2f74847a7c25062 Mon Sep 17 00:00:00 2001 From: jyn Date: Sun, 29 Dec 2024 23:43:18 -0500 Subject: [PATCH 12/18] wip: make tests compatible with cranelift --- src/tools/compiletest/src/runtest.rs | 2 +- .../std-backtrace-skip-frames.full.run.stderr | 66 +++++++++++-- ...d-backtrace-skip-frames.limited.run.stderr | 66 +++++++++++-- ...cktrace-skip-frames.line-tables.run.stderr | 94 ++++++++++++++----- ...-backtrace-skip-frames.no-split.run.stderr | 94 ++++++++++++++----- ...td-backtrace-skip-frames.packed.run.stderr | 94 ++++++++++++++----- .../ui/backtrace/std-backtrace-skip-frames.rs | 81 +++++++++++++--- ...-backtrace-skip-frames.unpacked.run.stderr | 94 ++++++++++++++----- 8 files changed, 466 insertions(+), 125 deletions(-) diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 108fde1c89955..a809fe299a0fd 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -960,7 +960,7 @@ impl<'test> TestCx<'test> { } fn exec_compiled_test(&self) -> ProcRes { - self.exec_compiled_test_general(&[], true) + self.exec_compiled_test_general(&[], false) } fn exec_compiled_test_general( diff --git a/tests/ui/backtrace/std-backtrace-skip-frames.full.run.stderr b/tests/ui/backtrace/std-backtrace-skip-frames.full.run.stderr index a3d05bbb7a9d3..087be83f64a60 100644 --- a/tests/ui/backtrace/std-backtrace-skip-frames.full.run.stderr +++ b/tests/ui/backtrace/std-backtrace-skip-frames.full.run.stderr @@ -1,4 +1,5 @@ -thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +unwrap_result: +thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: called `Result::unwrap()` on an `Err` value: () stack backtrace: [... omitted N frames ...] @@ -6,9 +7,13 @@ stack backtrace: at $SRC_DIR/core/src/result.rs:LL:COL 1: std_backtrace_skip_frames::unwrap_result at $DIR/std-backtrace-skip-frames.rs:LL:CC + 2: std_backtrace_skip_frames::main + at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. -thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: + +expect_result: +thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: oops: () stack backtrace: [... omitted N frames ...] @@ -16,9 +21,13 @@ stack backtrace: at $SRC_DIR/core/src/result.rs:LL:COL 1: std_backtrace_skip_frames::expect_result at $DIR/std-backtrace-skip-frames.rs:LL:CC + 2: std_backtrace_skip_frames::main + at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. -thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: + +unwrap_option: +thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: called `Option::unwrap()` on a `None` value stack backtrace: [... omitted N frames ...] @@ -26,9 +35,13 @@ stack backtrace: at $SRC_DIR/core/src/option.rs:LL:COL 1: std_backtrace_skip_frames::unwrap_option at $DIR/std-backtrace-skip-frames.rs:LL:CC + 2: std_backtrace_skip_frames::main + at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. -thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: + +expect_option: +thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: oops stack backtrace: [... omitted N frames ...] @@ -36,34 +49,69 @@ stack backtrace: at $SRC_DIR/core/src/option.rs:LL:COL 1: std_backtrace_skip_frames::expect_option at $DIR/std-backtrace-skip-frames.rs:LL:CC + 2: std_backtrace_skip_frames::main + at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. -thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: + +explicit_panic: +thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: explicit panic stack backtrace: [... omitted N frames ...] 0: std_backtrace_skip_frames::explicit_panic at $DIR/std-backtrace-skip-frames.rs:LL:CC + 1: std_backtrace_skip_frames::main + at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. -thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: + +literal_panic: +thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: oopsie stack backtrace: [... omitted N frames ...] 0: std_backtrace_skip_frames::literal_panic at $DIR/std-backtrace-skip-frames.rs:LL:CC + 1: std_backtrace_skip_frames::main + at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. -thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: + +panic_fmt: +thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: 3 stack backtrace: [... omitted N frames ...] 0: std_backtrace_skip_frames::panic_fmt at $DIR/std-backtrace-skip-frames.rs:LL:CC - 1: std_backtrace_skip_frames::check_all_panics::{{closure}} + 1: std_backtrace_skip_frames::main::{{closure}} + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] + 2: std_backtrace_skip_frames::main + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. + +panic_nounwind: +thread 'main' panicked at library/core/src/panicking.rs:LL:CC: +unsafe precondition(s) violated: slice::get_unchecked requires that the index is within the slice +stack backtrace: + [... omitted N frames ...] + 0: >::get_unchecked::precondition_check + at $SRC_DIR/core/src/ub_checks.rs:LL:COL + 1: >::get_unchecked + at $SRC_DIR/core/src/ub_checks.rs:LL:COL + 2: core::slice::::get_unchecked + at $SRC_DIR/core/src/slice/mod.rs:LL:COL + 3: std_backtrace_skip_frames::panic_nounwind + at $DIR/std-backtrace-skip-frames.rs:LL:CC + 4: std_backtrace_skip_frames::main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +thread caused non-unwinding panic. aborting. + thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: explicit panic stack backtrace: @@ -72,7 +120,7 @@ stack backtrace: at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] 1: std::panic::catch_unwind - at $SRC_DIR/std/src/panic.rs:LL:COL + at $SRC_DIR/std/src/panicking.rs:LL:COL 2: std_backtrace_skip_frames::check_all_panics at $DIR/std-backtrace-skip-frames.rs:LL:CC 3: std_backtrace_skip_frames::main diff --git a/tests/ui/backtrace/std-backtrace-skip-frames.limited.run.stderr b/tests/ui/backtrace/std-backtrace-skip-frames.limited.run.stderr index a3d05bbb7a9d3..087be83f64a60 100644 --- a/tests/ui/backtrace/std-backtrace-skip-frames.limited.run.stderr +++ b/tests/ui/backtrace/std-backtrace-skip-frames.limited.run.stderr @@ -1,4 +1,5 @@ -thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +unwrap_result: +thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: called `Result::unwrap()` on an `Err` value: () stack backtrace: [... omitted N frames ...] @@ -6,9 +7,13 @@ stack backtrace: at $SRC_DIR/core/src/result.rs:LL:COL 1: std_backtrace_skip_frames::unwrap_result at $DIR/std-backtrace-skip-frames.rs:LL:CC + 2: std_backtrace_skip_frames::main + at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. -thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: + +expect_result: +thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: oops: () stack backtrace: [... omitted N frames ...] @@ -16,9 +21,13 @@ stack backtrace: at $SRC_DIR/core/src/result.rs:LL:COL 1: std_backtrace_skip_frames::expect_result at $DIR/std-backtrace-skip-frames.rs:LL:CC + 2: std_backtrace_skip_frames::main + at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. -thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: + +unwrap_option: +thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: called `Option::unwrap()` on a `None` value stack backtrace: [... omitted N frames ...] @@ -26,9 +35,13 @@ stack backtrace: at $SRC_DIR/core/src/option.rs:LL:COL 1: std_backtrace_skip_frames::unwrap_option at $DIR/std-backtrace-skip-frames.rs:LL:CC + 2: std_backtrace_skip_frames::main + at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. -thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: + +expect_option: +thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: oops stack backtrace: [... omitted N frames ...] @@ -36,34 +49,69 @@ stack backtrace: at $SRC_DIR/core/src/option.rs:LL:COL 1: std_backtrace_skip_frames::expect_option at $DIR/std-backtrace-skip-frames.rs:LL:CC + 2: std_backtrace_skip_frames::main + at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. -thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: + +explicit_panic: +thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: explicit panic stack backtrace: [... omitted N frames ...] 0: std_backtrace_skip_frames::explicit_panic at $DIR/std-backtrace-skip-frames.rs:LL:CC + 1: std_backtrace_skip_frames::main + at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. -thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: + +literal_panic: +thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: oopsie stack backtrace: [... omitted N frames ...] 0: std_backtrace_skip_frames::literal_panic at $DIR/std-backtrace-skip-frames.rs:LL:CC + 1: std_backtrace_skip_frames::main + at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. -thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: + +panic_fmt: +thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: 3 stack backtrace: [... omitted N frames ...] 0: std_backtrace_skip_frames::panic_fmt at $DIR/std-backtrace-skip-frames.rs:LL:CC - 1: std_backtrace_skip_frames::check_all_panics::{{closure}} + 1: std_backtrace_skip_frames::main::{{closure}} + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] + 2: std_backtrace_skip_frames::main + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. + +panic_nounwind: +thread 'main' panicked at library/core/src/panicking.rs:LL:CC: +unsafe precondition(s) violated: slice::get_unchecked requires that the index is within the slice +stack backtrace: + [... omitted N frames ...] + 0: >::get_unchecked::precondition_check + at $SRC_DIR/core/src/ub_checks.rs:LL:COL + 1: >::get_unchecked + at $SRC_DIR/core/src/ub_checks.rs:LL:COL + 2: core::slice::::get_unchecked + at $SRC_DIR/core/src/slice/mod.rs:LL:COL + 3: std_backtrace_skip_frames::panic_nounwind + at $DIR/std-backtrace-skip-frames.rs:LL:CC + 4: std_backtrace_skip_frames::main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +thread caused non-unwinding panic. aborting. + thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: explicit panic stack backtrace: @@ -72,7 +120,7 @@ stack backtrace: at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] 1: std::panic::catch_unwind - at $SRC_DIR/std/src/panic.rs:LL:COL + at $SRC_DIR/std/src/panicking.rs:LL:COL 2: std_backtrace_skip_frames::check_all_panics at $DIR/std-backtrace-skip-frames.rs:LL:CC 3: std_backtrace_skip_frames::main diff --git a/tests/ui/backtrace/std-backtrace-skip-frames.line-tables.run.stderr b/tests/ui/backtrace/std-backtrace-skip-frames.line-tables.run.stderr index d2c915677f606..087be83f64a60 100644 --- a/tests/ui/backtrace/std-backtrace-skip-frames.line-tables.run.stderr +++ b/tests/ui/backtrace/std-backtrace-skip-frames.line-tables.run.stderr @@ -1,81 +1,129 @@ -thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +unwrap_result: +thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: called `Result::unwrap()` on an `Err` value: () stack backtrace: [... omitted N frames ...] - 0: unwrap<(), ()> + 0: core::result::Result::unwrap at $SRC_DIR/core/src/result.rs:LL:COL - 1: unwrap_result + 1: std_backtrace_skip_frames::unwrap_result + at $DIR/std-backtrace-skip-frames.rs:LL:CC + 2: std_backtrace_skip_frames::main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. -thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: + +expect_result: +thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: oops: () stack backtrace: [... omitted N frames ...] - 0: expect<(), ()> + 0: core::result::Result::expect at $SRC_DIR/core/src/result.rs:LL:COL - 1: expect_result + 1: std_backtrace_skip_frames::expect_result + at $DIR/std-backtrace-skip-frames.rs:LL:CC + 2: std_backtrace_skip_frames::main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. -thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: + +unwrap_option: +thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: called `Option::unwrap()` on a `None` value stack backtrace: [... omitted N frames ...] - 0: unwrap<()> + 0: core::option::Option::unwrap at $SRC_DIR/core/src/option.rs:LL:COL - 1: unwrap_option + 1: std_backtrace_skip_frames::unwrap_option + at $DIR/std-backtrace-skip-frames.rs:LL:CC + 2: std_backtrace_skip_frames::main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. -thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: + +expect_option: +thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: oops stack backtrace: [... omitted N frames ...] - 0: expect<()> + 0: core::option::Option::expect at $SRC_DIR/core/src/option.rs:LL:COL - 1: expect_option + 1: std_backtrace_skip_frames::expect_option + at $DIR/std-backtrace-skip-frames.rs:LL:CC + 2: std_backtrace_skip_frames::main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. -thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: + +explicit_panic: +thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: explicit panic stack backtrace: [... omitted N frames ...] 0: std_backtrace_skip_frames::explicit_panic at $DIR/std-backtrace-skip-frames.rs:LL:CC + 1: std_backtrace_skip_frames::main + at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. -thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: + +literal_panic: +thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: oopsie stack backtrace: [... omitted N frames ...] - 0: literal_panic + 0: std_backtrace_skip_frames::literal_panic + at $DIR/std-backtrace-skip-frames.rs:LL:CC + 1: std_backtrace_skip_frames::main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. -thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: + +panic_fmt: +thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: 3 stack backtrace: [... omitted N frames ...] - 0: panic_fmt + 0: std_backtrace_skip_frames::panic_fmt + at $DIR/std-backtrace-skip-frames.rs:LL:CC + 1: std_backtrace_skip_frames::main::{{closure}} + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] + 2: std_backtrace_skip_frames::main + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. + +panic_nounwind: +thread 'main' panicked at library/core/src/panicking.rs:LL:CC: +unsafe precondition(s) violated: slice::get_unchecked requires that the index is within the slice +stack backtrace: + [... omitted N frames ...] + 0: >::get_unchecked::precondition_check + at $SRC_DIR/core/src/ub_checks.rs:LL:COL + 1: >::get_unchecked + at $SRC_DIR/core/src/ub_checks.rs:LL:COL + 2: core::slice::::get_unchecked + at $SRC_DIR/core/src/slice/mod.rs:LL:COL + 3: std_backtrace_skip_frames::panic_nounwind at $DIR/std-backtrace-skip-frames.rs:LL:CC - 1: {closure#1} + 4: std_backtrace_skip_frames::main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +thread caused non-unwinding panic. aborting. + thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: explicit panic stack backtrace: [... omitted N frames ...] - 0: {closure#2} + 0: std_backtrace_skip_frames::check_all_panics::{{closure}} at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] - 1: catch_unwind - at $SRC_DIR/std/src/panic.rs:LL:COL - 2: check_all_panics + 1: std::panic::catch_unwind + at $SRC_DIR/std/src/panicking.rs:LL:COL + 2: std_backtrace_skip_frames::check_all_panics at $DIR/std-backtrace-skip-frames.rs:LL:CC - 3: main + 3: std_backtrace_skip_frames::main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. diff --git a/tests/ui/backtrace/std-backtrace-skip-frames.no-split.run.stderr b/tests/ui/backtrace/std-backtrace-skip-frames.no-split.run.stderr index d2c915677f606..087be83f64a60 100644 --- a/tests/ui/backtrace/std-backtrace-skip-frames.no-split.run.stderr +++ b/tests/ui/backtrace/std-backtrace-skip-frames.no-split.run.stderr @@ -1,81 +1,129 @@ -thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +unwrap_result: +thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: called `Result::unwrap()` on an `Err` value: () stack backtrace: [... omitted N frames ...] - 0: unwrap<(), ()> + 0: core::result::Result::unwrap at $SRC_DIR/core/src/result.rs:LL:COL - 1: unwrap_result + 1: std_backtrace_skip_frames::unwrap_result + at $DIR/std-backtrace-skip-frames.rs:LL:CC + 2: std_backtrace_skip_frames::main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. -thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: + +expect_result: +thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: oops: () stack backtrace: [... omitted N frames ...] - 0: expect<(), ()> + 0: core::result::Result::expect at $SRC_DIR/core/src/result.rs:LL:COL - 1: expect_result + 1: std_backtrace_skip_frames::expect_result + at $DIR/std-backtrace-skip-frames.rs:LL:CC + 2: std_backtrace_skip_frames::main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. -thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: + +unwrap_option: +thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: called `Option::unwrap()` on a `None` value stack backtrace: [... omitted N frames ...] - 0: unwrap<()> + 0: core::option::Option::unwrap at $SRC_DIR/core/src/option.rs:LL:COL - 1: unwrap_option + 1: std_backtrace_skip_frames::unwrap_option + at $DIR/std-backtrace-skip-frames.rs:LL:CC + 2: std_backtrace_skip_frames::main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. -thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: + +expect_option: +thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: oops stack backtrace: [... omitted N frames ...] - 0: expect<()> + 0: core::option::Option::expect at $SRC_DIR/core/src/option.rs:LL:COL - 1: expect_option + 1: std_backtrace_skip_frames::expect_option + at $DIR/std-backtrace-skip-frames.rs:LL:CC + 2: std_backtrace_skip_frames::main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. -thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: + +explicit_panic: +thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: explicit panic stack backtrace: [... omitted N frames ...] 0: std_backtrace_skip_frames::explicit_panic at $DIR/std-backtrace-skip-frames.rs:LL:CC + 1: std_backtrace_skip_frames::main + at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. -thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: + +literal_panic: +thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: oopsie stack backtrace: [... omitted N frames ...] - 0: literal_panic + 0: std_backtrace_skip_frames::literal_panic + at $DIR/std-backtrace-skip-frames.rs:LL:CC + 1: std_backtrace_skip_frames::main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. -thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: + +panic_fmt: +thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: 3 stack backtrace: [... omitted N frames ...] - 0: panic_fmt + 0: std_backtrace_skip_frames::panic_fmt + at $DIR/std-backtrace-skip-frames.rs:LL:CC + 1: std_backtrace_skip_frames::main::{{closure}} + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] + 2: std_backtrace_skip_frames::main + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. + +panic_nounwind: +thread 'main' panicked at library/core/src/panicking.rs:LL:CC: +unsafe precondition(s) violated: slice::get_unchecked requires that the index is within the slice +stack backtrace: + [... omitted N frames ...] + 0: >::get_unchecked::precondition_check + at $SRC_DIR/core/src/ub_checks.rs:LL:COL + 1: >::get_unchecked + at $SRC_DIR/core/src/ub_checks.rs:LL:COL + 2: core::slice::::get_unchecked + at $SRC_DIR/core/src/slice/mod.rs:LL:COL + 3: std_backtrace_skip_frames::panic_nounwind at $DIR/std-backtrace-skip-frames.rs:LL:CC - 1: {closure#1} + 4: std_backtrace_skip_frames::main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +thread caused non-unwinding panic. aborting. + thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: explicit panic stack backtrace: [... omitted N frames ...] - 0: {closure#2} + 0: std_backtrace_skip_frames::check_all_panics::{{closure}} at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] - 1: catch_unwind - at $SRC_DIR/std/src/panic.rs:LL:COL - 2: check_all_panics + 1: std::panic::catch_unwind + at $SRC_DIR/std/src/panicking.rs:LL:COL + 2: std_backtrace_skip_frames::check_all_panics at $DIR/std-backtrace-skip-frames.rs:LL:CC - 3: main + 3: std_backtrace_skip_frames::main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. diff --git a/tests/ui/backtrace/std-backtrace-skip-frames.packed.run.stderr b/tests/ui/backtrace/std-backtrace-skip-frames.packed.run.stderr index d2c915677f606..087be83f64a60 100644 --- a/tests/ui/backtrace/std-backtrace-skip-frames.packed.run.stderr +++ b/tests/ui/backtrace/std-backtrace-skip-frames.packed.run.stderr @@ -1,81 +1,129 @@ -thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +unwrap_result: +thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: called `Result::unwrap()` on an `Err` value: () stack backtrace: [... omitted N frames ...] - 0: unwrap<(), ()> + 0: core::result::Result::unwrap at $SRC_DIR/core/src/result.rs:LL:COL - 1: unwrap_result + 1: std_backtrace_skip_frames::unwrap_result + at $DIR/std-backtrace-skip-frames.rs:LL:CC + 2: std_backtrace_skip_frames::main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. -thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: + +expect_result: +thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: oops: () stack backtrace: [... omitted N frames ...] - 0: expect<(), ()> + 0: core::result::Result::expect at $SRC_DIR/core/src/result.rs:LL:COL - 1: expect_result + 1: std_backtrace_skip_frames::expect_result + at $DIR/std-backtrace-skip-frames.rs:LL:CC + 2: std_backtrace_skip_frames::main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. -thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: + +unwrap_option: +thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: called `Option::unwrap()` on a `None` value stack backtrace: [... omitted N frames ...] - 0: unwrap<()> + 0: core::option::Option::unwrap at $SRC_DIR/core/src/option.rs:LL:COL - 1: unwrap_option + 1: std_backtrace_skip_frames::unwrap_option + at $DIR/std-backtrace-skip-frames.rs:LL:CC + 2: std_backtrace_skip_frames::main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. -thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: + +expect_option: +thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: oops stack backtrace: [... omitted N frames ...] - 0: expect<()> + 0: core::option::Option::expect at $SRC_DIR/core/src/option.rs:LL:COL - 1: expect_option + 1: std_backtrace_skip_frames::expect_option + at $DIR/std-backtrace-skip-frames.rs:LL:CC + 2: std_backtrace_skip_frames::main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. -thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: + +explicit_panic: +thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: explicit panic stack backtrace: [... omitted N frames ...] 0: std_backtrace_skip_frames::explicit_panic at $DIR/std-backtrace-skip-frames.rs:LL:CC + 1: std_backtrace_skip_frames::main + at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. -thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: + +literal_panic: +thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: oopsie stack backtrace: [... omitted N frames ...] - 0: literal_panic + 0: std_backtrace_skip_frames::literal_panic + at $DIR/std-backtrace-skip-frames.rs:LL:CC + 1: std_backtrace_skip_frames::main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. -thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: + +panic_fmt: +thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: 3 stack backtrace: [... omitted N frames ...] - 0: panic_fmt + 0: std_backtrace_skip_frames::panic_fmt + at $DIR/std-backtrace-skip-frames.rs:LL:CC + 1: std_backtrace_skip_frames::main::{{closure}} + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] + 2: std_backtrace_skip_frames::main + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. + +panic_nounwind: +thread 'main' panicked at library/core/src/panicking.rs:LL:CC: +unsafe precondition(s) violated: slice::get_unchecked requires that the index is within the slice +stack backtrace: + [... omitted N frames ...] + 0: >::get_unchecked::precondition_check + at $SRC_DIR/core/src/ub_checks.rs:LL:COL + 1: >::get_unchecked + at $SRC_DIR/core/src/ub_checks.rs:LL:COL + 2: core::slice::::get_unchecked + at $SRC_DIR/core/src/slice/mod.rs:LL:COL + 3: std_backtrace_skip_frames::panic_nounwind at $DIR/std-backtrace-skip-frames.rs:LL:CC - 1: {closure#1} + 4: std_backtrace_skip_frames::main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +thread caused non-unwinding panic. aborting. + thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: explicit panic stack backtrace: [... omitted N frames ...] - 0: {closure#2} + 0: std_backtrace_skip_frames::check_all_panics::{{closure}} at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] - 1: catch_unwind - at $SRC_DIR/std/src/panic.rs:LL:COL - 2: check_all_panics + 1: std::panic::catch_unwind + at $SRC_DIR/std/src/panicking.rs:LL:COL + 2: std_backtrace_skip_frames::check_all_panics at $DIR/std-backtrace-skip-frames.rs:LL:CC - 3: main + 3: std_backtrace_skip_frames::main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. diff --git a/tests/ui/backtrace/std-backtrace-skip-frames.rs b/tests/ui/backtrace/std-backtrace-skip-frames.rs index a02d8f9a138dd..2ae94035f268c 100644 --- a/tests/ui/backtrace/std-backtrace-skip-frames.rs +++ b/tests/ui/backtrace/std-backtrace-skip-frames.rs @@ -10,13 +10,17 @@ //@ ignore-i686-pc-windows-msvc see #62897 and `backtrace-debuginfo.rs` test //@ ignore-fuchsia Backtraces not symbolized -//@ run-pass +// this is run-fail for cranelift, which doesn't support unwinding +//@ run-fail //@ check-run-results -//@ normalize-stderr: "omitted [0-9]+ frames" -> "omitted N frames" +//@ normalize-stderr: "fatal runtime error: failed to initiate panic, error 5\n" -> "" +//@ normalize-stderr: "omitted [0-9]+ frames?" -> "omitted N frames" //@ normalize-stderr: ".rs:[0-9]+:[0-9]+" -> ".rs:LL:CC" //@ error-pattern:stack backtrace: //@ regex-error-pattern:omitted [0-9]+ frames -//@ error-pattern:main +// FIXME: what i actually want to do is check that we never have a `0: main` frame. +// this doesn't do that, it just checks that we have *at least* one main frame that isn't 0. +//@ regex-error-pattern:[1-9][0-9]*: .*main //@ exec-env:RUST_BACKTRACE=1 //@ unset-exec-env:RUST_LIB_BACKTRACE @@ -33,27 +37,76 @@ //@[limited] compile-flags:-Cdebuginfo=limited //@[full] compile-flags:-Cdebuginfo=full +use std::env; +use std::io::Write; +use std::process::Command; + +const UNWRAP_RESULT: &str = "unwrap_result"; +const EXPECT_RESULT: &str = "expect_result"; +const UNWRAP_OPTION: &str = "unwrap_option"; +const EXPECT_OPTION: &str = "expect_option"; +const LITERAL_PANIC: &str = "literal_panic"; +const EXPLICIT_PANIC: &str = "explicit_panic"; +const PANIC_FMT: &str = "panic_fmt"; +const PANIC_NOUNWIND: &str = "panic_nounwind"; + fn main() { - check_all_panics(); + let func = match env::args().skip(1).next().as_deref() { + None => { + check_all_panics(); + return; + } + Some(UNWRAP_RESULT) => unwrap_result, + Some(EXPECT_RESULT) => expect_result, + Some(UNWRAP_OPTION) => unwrap_option, + Some(EXPECT_OPTION) => expect_option, + Some(LITERAL_PANIC) => literal_panic, + Some(EXPLICIT_PANIC) => explicit_panic, + Some(PANIC_FMT) => || panic_fmt(3), + Some(PANIC_NOUNWIND) => panic_nounwind, + Some(func) => unreachable!("unknown stack trace to check: {func}"), + }; + // work around https://github.com/rust-lang/rust/issues/134909 + // FIXME: this is really not ideal, the whole point is to test optimized backtraces. + std::hint::black_box(func)(); } fn check_all_panics() { - // Spawn a bunch of threads and make sure all of them hide panic details we don't care about. + // Spawn a bunch of processes and make sure all of them hide panic details we don't care about. + // NOTE: we can't just spawn a thread because cranelift doesn't support unwinding. let tests = [ - unwrap_result, - expect_result, - unwrap_option, - expect_option, - explicit_panic, - literal_panic, - /*panic_nounwind*/ + UNWRAP_RESULT, + EXPECT_RESULT, + UNWRAP_OPTION, + EXPECT_OPTION, + EXPLICIT_PANIC, + LITERAL_PANIC, + PANIC_FMT, + PANIC_NOUNWIND, ]; for func in tests { - std::thread::spawn(move || func()).join().unwrap_err(); + let me = env::current_exe().unwrap(); + // dbg!(&me); + let mut cmd = Command::new(me); + cmd.arg(func); + let output = cmd.output().unwrap(); + assert!(!output.status.success()); + assert_ne!(output.stderr.len(), 0); + assert_eq!(output.stdout.len(), 0); + eprintln!("{func}:"); + std::io::stderr().write_all(&output.stderr).unwrap(); + eprintln!(); + // std::thread::spawn(move || func()).join().unwrap_err(); } - std::thread::spawn(|| panic_fmt(3)).join().unwrap_err(); + // std::thread::spawn(|| panic_fmt(3)).join().unwrap_err(); // Finally, panic ourselves so we can make sure `lang_start`, etc. frames are hidden. + // We use catch_unwind just so we can see what the backtrace looks like; + // cranelift doesn't support unwinding but that's ok because this is the + // last thing in the file. + // FIXME: for some reason, adding `unwrap_err` here completely messes up backtraces (???), + // llvm doesn't generate for inlined functions at all. + // just ignore the error instead. std::panic::catch_unwind(|| panic!()).unwrap_err(); } diff --git a/tests/ui/backtrace/std-backtrace-skip-frames.unpacked.run.stderr b/tests/ui/backtrace/std-backtrace-skip-frames.unpacked.run.stderr index d2c915677f606..087be83f64a60 100644 --- a/tests/ui/backtrace/std-backtrace-skip-frames.unpacked.run.stderr +++ b/tests/ui/backtrace/std-backtrace-skip-frames.unpacked.run.stderr @@ -1,81 +1,129 @@ -thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: +unwrap_result: +thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: called `Result::unwrap()` on an `Err` value: () stack backtrace: [... omitted N frames ...] - 0: unwrap<(), ()> + 0: core::result::Result::unwrap at $SRC_DIR/core/src/result.rs:LL:COL - 1: unwrap_result + 1: std_backtrace_skip_frames::unwrap_result + at $DIR/std-backtrace-skip-frames.rs:LL:CC + 2: std_backtrace_skip_frames::main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. -thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: + +expect_result: +thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: oops: () stack backtrace: [... omitted N frames ...] - 0: expect<(), ()> + 0: core::result::Result::expect at $SRC_DIR/core/src/result.rs:LL:COL - 1: expect_result + 1: std_backtrace_skip_frames::expect_result + at $DIR/std-backtrace-skip-frames.rs:LL:CC + 2: std_backtrace_skip_frames::main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. -thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: + +unwrap_option: +thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: called `Option::unwrap()` on a `None` value stack backtrace: [... omitted N frames ...] - 0: unwrap<()> + 0: core::option::Option::unwrap at $SRC_DIR/core/src/option.rs:LL:COL - 1: unwrap_option + 1: std_backtrace_skip_frames::unwrap_option + at $DIR/std-backtrace-skip-frames.rs:LL:CC + 2: std_backtrace_skip_frames::main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. -thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: + +expect_option: +thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: oops stack backtrace: [... omitted N frames ...] - 0: expect<()> + 0: core::option::Option::expect at $SRC_DIR/core/src/option.rs:LL:COL - 1: expect_option + 1: std_backtrace_skip_frames::expect_option + at $DIR/std-backtrace-skip-frames.rs:LL:CC + 2: std_backtrace_skip_frames::main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. -thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: + +explicit_panic: +thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: explicit panic stack backtrace: [... omitted N frames ...] 0: std_backtrace_skip_frames::explicit_panic at $DIR/std-backtrace-skip-frames.rs:LL:CC + 1: std_backtrace_skip_frames::main + at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. -thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: + +literal_panic: +thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: oopsie stack backtrace: [... omitted N frames ...] - 0: literal_panic + 0: std_backtrace_skip_frames::literal_panic + at $DIR/std-backtrace-skip-frames.rs:LL:CC + 1: std_backtrace_skip_frames::main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. -thread '' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: + +panic_fmt: +thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: 3 stack backtrace: [... omitted N frames ...] - 0: panic_fmt + 0: std_backtrace_skip_frames::panic_fmt + at $DIR/std-backtrace-skip-frames.rs:LL:CC + 1: std_backtrace_skip_frames::main::{{closure}} + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] + 2: std_backtrace_skip_frames::main + at $DIR/std-backtrace-skip-frames.rs:LL:CC + [... omitted N frames ...] +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. + +panic_nounwind: +thread 'main' panicked at library/core/src/panicking.rs:LL:CC: +unsafe precondition(s) violated: slice::get_unchecked requires that the index is within the slice +stack backtrace: + [... omitted N frames ...] + 0: >::get_unchecked::precondition_check + at $SRC_DIR/core/src/ub_checks.rs:LL:COL + 1: >::get_unchecked + at $SRC_DIR/core/src/ub_checks.rs:LL:COL + 2: core::slice::::get_unchecked + at $SRC_DIR/core/src/slice/mod.rs:LL:COL + 3: std_backtrace_skip_frames::panic_nounwind at $DIR/std-backtrace-skip-frames.rs:LL:CC - 1: {closure#1} + 4: std_backtrace_skip_frames::main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. +thread caused non-unwinding panic. aborting. + thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: explicit panic stack backtrace: [... omitted N frames ...] - 0: {closure#2} + 0: std_backtrace_skip_frames::check_all_panics::{{closure}} at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] - 1: catch_unwind - at $SRC_DIR/std/src/panic.rs:LL:COL - 2: check_all_panics + 1: std::panic::catch_unwind + at $SRC_DIR/std/src/panicking.rs:LL:COL + 2: std_backtrace_skip_frames::check_all_panics at $DIR/std-backtrace-skip-frames.rs:LL:CC - 3: main + 3: std_backtrace_skip_frames::main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. From 5c8393317a0b6633b2dfdbe48674d3ef6297df79 Mon Sep 17 00:00:00 2001 From: jyn Date: Sat, 18 Jan 2025 19:28:42 -0500 Subject: [PATCH 13/18] special case __rust_try in backtrace hook --- library/std/src/sys/backtrace.rs | 4 ++++ .../std-backtrace-skip-frames.full.run.stderr | 2 +- .../std-backtrace-skip-frames.limited.run.stderr | 2 +- ...-backtrace-skip-frames.line-tables.run.stderr | 16 ++++++++-------- ...std-backtrace-skip-frames.no-split.run.stderr | 16 ++++++++-------- .../std-backtrace-skip-frames.packed.run.stderr | 16 ++++++++-------- tests/ui/backtrace/std-backtrace-skip-frames.rs | 7 ++----- ...std-backtrace-skip-frames.unpacked.run.stderr | 16 ++++++++-------- 8 files changed, 40 insertions(+), 39 deletions(-) diff --git a/library/std/src/sys/backtrace.rs b/library/std/src/sys/backtrace.rs index 3442cdde191d7..50e2c05348453 100644 --- a/library/std/src/sys/backtrace.rs +++ b/library/std/src/sys/backtrace.rs @@ -98,6 +98,10 @@ unsafe fn _print_fmt(fmt: &mut fmt::Formatter<'_>, print_fmt: PrintFmt) -> fmt:: if sym.contains("__rust_begin_short_backtrace") { print = false } + if sym.ends_with("__rust_try") { + // Generating short_backtrace info for this is ... hard. + skip = true; + } } if let Some(short_backtrace) = symbol.short_backtrace() { diff --git a/tests/ui/backtrace/std-backtrace-skip-frames.full.run.stderr b/tests/ui/backtrace/std-backtrace-skip-frames.full.run.stderr index 087be83f64a60..9e10b38236909 100644 --- a/tests/ui/backtrace/std-backtrace-skip-frames.full.run.stderr +++ b/tests/ui/backtrace/std-backtrace-skip-frames.full.run.stderr @@ -120,7 +120,7 @@ stack backtrace: at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] 1: std::panic::catch_unwind - at $SRC_DIR/std/src/panicking.rs:LL:COL + at $SRC_DIR/std/src/panic.rs:LL:COL 2: std_backtrace_skip_frames::check_all_panics at $DIR/std-backtrace-skip-frames.rs:LL:CC 3: std_backtrace_skip_frames::main diff --git a/tests/ui/backtrace/std-backtrace-skip-frames.limited.run.stderr b/tests/ui/backtrace/std-backtrace-skip-frames.limited.run.stderr index 087be83f64a60..9e10b38236909 100644 --- a/tests/ui/backtrace/std-backtrace-skip-frames.limited.run.stderr +++ b/tests/ui/backtrace/std-backtrace-skip-frames.limited.run.stderr @@ -120,7 +120,7 @@ stack backtrace: at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] 1: std::panic::catch_unwind - at $SRC_DIR/std/src/panicking.rs:LL:COL + at $SRC_DIR/std/src/panic.rs:LL:COL 2: std_backtrace_skip_frames::check_all_panics at $DIR/std-backtrace-skip-frames.rs:LL:CC 3: std_backtrace_skip_frames::main diff --git a/tests/ui/backtrace/std-backtrace-skip-frames.line-tables.run.stderr b/tests/ui/backtrace/std-backtrace-skip-frames.line-tables.run.stderr index 087be83f64a60..819331501962a 100644 --- a/tests/ui/backtrace/std-backtrace-skip-frames.line-tables.run.stderr +++ b/tests/ui/backtrace/std-backtrace-skip-frames.line-tables.run.stderr @@ -3,9 +3,9 @@ thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: called `Result::unwrap()` on an `Err` value: () stack backtrace: [... omitted N frames ...] - 0: core::result::Result::unwrap + 0: unwrap<(), ()> at $SRC_DIR/core/src/result.rs:LL:COL - 1: std_backtrace_skip_frames::unwrap_result + 1: unwrap_result at $DIR/std-backtrace-skip-frames.rs:LL:CC 2: std_backtrace_skip_frames::main at $DIR/std-backtrace-skip-frames.rs:LL:CC @@ -31,9 +31,9 @@ thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: called `Option::unwrap()` on a `None` value stack backtrace: [... omitted N frames ...] - 0: core::option::Option::unwrap + 0: unwrap<()> at $SRC_DIR/core/src/option.rs:LL:COL - 1: std_backtrace_skip_frames::unwrap_option + 1: unwrap_option at $DIR/std-backtrace-skip-frames.rs:LL:CC 2: std_backtrace_skip_frames::main at $DIR/std-backtrace-skip-frames.rs:LL:CC @@ -100,7 +100,7 @@ stack backtrace: [... omitted N frames ...] 0: >::get_unchecked::precondition_check at $SRC_DIR/core/src/ub_checks.rs:LL:COL - 1: >::get_unchecked + 1: get_unchecked at $SRC_DIR/core/src/ub_checks.rs:LL:COL 2: core::slice::::get_unchecked at $SRC_DIR/core/src/slice/mod.rs:LL:COL @@ -119,9 +119,9 @@ stack backtrace: 0: std_backtrace_skip_frames::check_all_panics::{{closure}} at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] - 1: std::panic::catch_unwind - at $SRC_DIR/std/src/panicking.rs:LL:COL - 2: std_backtrace_skip_frames::check_all_panics + 1: catch_unwind + at $SRC_DIR/std/src/panic.rs:LL:COL + 2: check_all_panics at $DIR/std-backtrace-skip-frames.rs:LL:CC 3: std_backtrace_skip_frames::main at $DIR/std-backtrace-skip-frames.rs:LL:CC diff --git a/tests/ui/backtrace/std-backtrace-skip-frames.no-split.run.stderr b/tests/ui/backtrace/std-backtrace-skip-frames.no-split.run.stderr index 087be83f64a60..819331501962a 100644 --- a/tests/ui/backtrace/std-backtrace-skip-frames.no-split.run.stderr +++ b/tests/ui/backtrace/std-backtrace-skip-frames.no-split.run.stderr @@ -3,9 +3,9 @@ thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: called `Result::unwrap()` on an `Err` value: () stack backtrace: [... omitted N frames ...] - 0: core::result::Result::unwrap + 0: unwrap<(), ()> at $SRC_DIR/core/src/result.rs:LL:COL - 1: std_backtrace_skip_frames::unwrap_result + 1: unwrap_result at $DIR/std-backtrace-skip-frames.rs:LL:CC 2: std_backtrace_skip_frames::main at $DIR/std-backtrace-skip-frames.rs:LL:CC @@ -31,9 +31,9 @@ thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: called `Option::unwrap()` on a `None` value stack backtrace: [... omitted N frames ...] - 0: core::option::Option::unwrap + 0: unwrap<()> at $SRC_DIR/core/src/option.rs:LL:COL - 1: std_backtrace_skip_frames::unwrap_option + 1: unwrap_option at $DIR/std-backtrace-skip-frames.rs:LL:CC 2: std_backtrace_skip_frames::main at $DIR/std-backtrace-skip-frames.rs:LL:CC @@ -100,7 +100,7 @@ stack backtrace: [... omitted N frames ...] 0: >::get_unchecked::precondition_check at $SRC_DIR/core/src/ub_checks.rs:LL:COL - 1: >::get_unchecked + 1: get_unchecked at $SRC_DIR/core/src/ub_checks.rs:LL:COL 2: core::slice::::get_unchecked at $SRC_DIR/core/src/slice/mod.rs:LL:COL @@ -119,9 +119,9 @@ stack backtrace: 0: std_backtrace_skip_frames::check_all_panics::{{closure}} at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] - 1: std::panic::catch_unwind - at $SRC_DIR/std/src/panicking.rs:LL:COL - 2: std_backtrace_skip_frames::check_all_panics + 1: catch_unwind + at $SRC_DIR/std/src/panic.rs:LL:COL + 2: check_all_panics at $DIR/std-backtrace-skip-frames.rs:LL:CC 3: std_backtrace_skip_frames::main at $DIR/std-backtrace-skip-frames.rs:LL:CC diff --git a/tests/ui/backtrace/std-backtrace-skip-frames.packed.run.stderr b/tests/ui/backtrace/std-backtrace-skip-frames.packed.run.stderr index 087be83f64a60..819331501962a 100644 --- a/tests/ui/backtrace/std-backtrace-skip-frames.packed.run.stderr +++ b/tests/ui/backtrace/std-backtrace-skip-frames.packed.run.stderr @@ -3,9 +3,9 @@ thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: called `Result::unwrap()` on an `Err` value: () stack backtrace: [... omitted N frames ...] - 0: core::result::Result::unwrap + 0: unwrap<(), ()> at $SRC_DIR/core/src/result.rs:LL:COL - 1: std_backtrace_skip_frames::unwrap_result + 1: unwrap_result at $DIR/std-backtrace-skip-frames.rs:LL:CC 2: std_backtrace_skip_frames::main at $DIR/std-backtrace-skip-frames.rs:LL:CC @@ -31,9 +31,9 @@ thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: called `Option::unwrap()` on a `None` value stack backtrace: [... omitted N frames ...] - 0: core::option::Option::unwrap + 0: unwrap<()> at $SRC_DIR/core/src/option.rs:LL:COL - 1: std_backtrace_skip_frames::unwrap_option + 1: unwrap_option at $DIR/std-backtrace-skip-frames.rs:LL:CC 2: std_backtrace_skip_frames::main at $DIR/std-backtrace-skip-frames.rs:LL:CC @@ -100,7 +100,7 @@ stack backtrace: [... omitted N frames ...] 0: >::get_unchecked::precondition_check at $SRC_DIR/core/src/ub_checks.rs:LL:COL - 1: >::get_unchecked + 1: get_unchecked at $SRC_DIR/core/src/ub_checks.rs:LL:COL 2: core::slice::::get_unchecked at $SRC_DIR/core/src/slice/mod.rs:LL:COL @@ -119,9 +119,9 @@ stack backtrace: 0: std_backtrace_skip_frames::check_all_panics::{{closure}} at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] - 1: std::panic::catch_unwind - at $SRC_DIR/std/src/panicking.rs:LL:COL - 2: std_backtrace_skip_frames::check_all_panics + 1: catch_unwind + at $SRC_DIR/std/src/panic.rs:LL:COL + 2: check_all_panics at $DIR/std-backtrace-skip-frames.rs:LL:CC 3: std_backtrace_skip_frames::main at $DIR/std-backtrace-skip-frames.rs:LL:CC diff --git a/tests/ui/backtrace/std-backtrace-skip-frames.rs b/tests/ui/backtrace/std-backtrace-skip-frames.rs index 2ae94035f268c..28ca91a440481 100644 --- a/tests/ui/backtrace/std-backtrace-skip-frames.rs +++ b/tests/ui/backtrace/std-backtrace-skip-frames.rs @@ -9,11 +9,9 @@ //@ ignore-sgx no processes //@ ignore-i686-pc-windows-msvc see #62897 and `backtrace-debuginfo.rs` test //@ ignore-fuchsia Backtraces not symbolized +//@ needs-unwind -// this is run-fail for cranelift, which doesn't support unwinding -//@ run-fail //@ check-run-results -//@ normalize-stderr: "fatal runtime error: failed to initiate panic, error 5\n" -> "" //@ normalize-stderr: "omitted [0-9]+ frames?" -> "omitted N frames" //@ normalize-stderr: ".rs:[0-9]+:[0-9]+" -> ".rs:LL:CC" //@ error-pattern:stack backtrace: @@ -27,7 +25,7 @@ //@ edition:2021 //@ compile-flags:-Cstrip=none -Cdebug-assertions=true //@ revisions:line-tables limited full no-split packed unpacked -//@[no-split] ignore-msvc +//@[no-split] ignore-msvc ignore-macos //@[unpacked] ignore-msvc //@[no-split] compile-flags:-Cdebuginfo=line-tables-only -Csplit-debuginfo=off @@ -54,7 +52,6 @@ fn main() { let func = match env::args().skip(1).next().as_deref() { None => { check_all_panics(); - return; } Some(UNWRAP_RESULT) => unwrap_result, Some(EXPECT_RESULT) => expect_result, diff --git a/tests/ui/backtrace/std-backtrace-skip-frames.unpacked.run.stderr b/tests/ui/backtrace/std-backtrace-skip-frames.unpacked.run.stderr index 087be83f64a60..819331501962a 100644 --- a/tests/ui/backtrace/std-backtrace-skip-frames.unpacked.run.stderr +++ b/tests/ui/backtrace/std-backtrace-skip-frames.unpacked.run.stderr @@ -3,9 +3,9 @@ thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: called `Result::unwrap()` on an `Err` value: () stack backtrace: [... omitted N frames ...] - 0: core::result::Result::unwrap + 0: unwrap<(), ()> at $SRC_DIR/core/src/result.rs:LL:COL - 1: std_backtrace_skip_frames::unwrap_result + 1: unwrap_result at $DIR/std-backtrace-skip-frames.rs:LL:CC 2: std_backtrace_skip_frames::main at $DIR/std-backtrace-skip-frames.rs:LL:CC @@ -31,9 +31,9 @@ thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: called `Option::unwrap()` on a `None` value stack backtrace: [... omitted N frames ...] - 0: core::option::Option::unwrap + 0: unwrap<()> at $SRC_DIR/core/src/option.rs:LL:COL - 1: std_backtrace_skip_frames::unwrap_option + 1: unwrap_option at $DIR/std-backtrace-skip-frames.rs:LL:CC 2: std_backtrace_skip_frames::main at $DIR/std-backtrace-skip-frames.rs:LL:CC @@ -100,7 +100,7 @@ stack backtrace: [... omitted N frames ...] 0: >::get_unchecked::precondition_check at $SRC_DIR/core/src/ub_checks.rs:LL:COL - 1: >::get_unchecked + 1: get_unchecked at $SRC_DIR/core/src/ub_checks.rs:LL:COL 2: core::slice::::get_unchecked at $SRC_DIR/core/src/slice/mod.rs:LL:COL @@ -119,9 +119,9 @@ stack backtrace: 0: std_backtrace_skip_frames::check_all_panics::{{closure}} at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] - 1: std::panic::catch_unwind - at $SRC_DIR/std/src/panicking.rs:LL:COL - 2: std_backtrace_skip_frames::check_all_panics + 1: catch_unwind + at $SRC_DIR/std/src/panic.rs:LL:COL + 2: check_all_panics at $DIR/std-backtrace-skip-frames.rs:LL:CC 3: std_backtrace_skip_frames::main at $DIR/std-backtrace-skip-frames.rs:LL:CC From 3e1c965eb6076e01359dcf10068fd9220bf0097c Mon Sep 17 00:00:00 2001 From: jyn Date: Sat, 18 Jan 2025 20:35:44 -0500 Subject: [PATCH 14/18] more improvements - give an error when `#[rustc_start/end_short_backtrace]` is used with `#[inline]` - update `short_ice-remove-middle-frames` to use the new attribute so that it's tested - don't ICE when debug logging --- .../rustc_codegen_llvm/src/debuginfo/mod.rs | 3 +- compiler/rustc_codegen_llvm/src/llvm/ffi.rs | 2 +- .../rustc_codegen_ssa/src/codegen_attrs.rs | 11 ++++++ library/std/src/sys/backtrace.rs | 8 ++-- ...cktrace-skip-frames.line-tables.run.stderr | 38 +++++++++---------- ...-backtrace-skip-frames.no-split.run.stderr | 38 +++++++++---------- ...td-backtrace-skip-frames.packed.run.stderr | 38 +++++++++---------- .../ui/backtrace/std-backtrace-skip-frames.rs | 5 ++- ...-backtrace-skip-frames.unpacked.run.stderr | 38 +++++++++---------- .../panics/short-ice-remove-middle-frames.rs | 33 +++++----------- .../short-ice-remove-middle-frames.run.stderr | 25 ++++++------ 11 files changed, 121 insertions(+), 118 deletions(-) diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/mod.rs b/compiler/rustc_codegen_llvm/src/debuginfo/mod.rs index 140eb7a165d91..1ac37d4e80323 100644 --- a/compiler/rustc_codegen_llvm/src/debuginfo/mod.rs +++ b/compiler/rustc_codegen_llvm/src/debuginfo/mod.rs @@ -380,7 +380,8 @@ impl<'ll, 'tcx> DebugInfoCodegenMethods<'tcx> for CodegenCx<'ll, 'tcx> { if let Some(s) = skip { tracing::info!( "generate short backtrace {s:?} for {}", - tcx.item_name(instance.def_id()) + tcx.opt_item_name(instance.def_id()) + .map_or_else(|| tcx.def_path_str(instance.def_id()), |s| s.to_string()) ); } let skip = ShortBacktraceKind::from_generic(skip); diff --git a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs index 088c91b25caab..2cd8a86368e53 100644 --- a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs +++ b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs @@ -777,7 +777,7 @@ pub mod debuginfo { } } - /// LLVMRustDebugEmissionKind + /// LLVMRustShortBacktrace #[derive(Copy, Clone, Debug)] #[repr(C)] pub enum ShortBacktraceKind { diff --git a/compiler/rustc_codegen_ssa/src/codegen_attrs.rs b/compiler/rustc_codegen_ssa/src/codegen_attrs.rs index 9fff105f501d6..7e7b1aacbae3c 100644 --- a/compiler/rustc_codegen_ssa/src/codegen_attrs.rs +++ b/compiler/rustc_codegen_ssa/src/codegen_attrs.rs @@ -582,6 +582,17 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs { }); codegen_fn_attrs.skip_short_backtrace = SkipShortBacktrace::lookup(tcx, did); + match codegen_fn_attrs.skip_short_backtrace { + Some(SkipShortBacktrace::Start | SkipShortBacktrace::End) => { + if !matches!(codegen_fn_attrs.inline, InlineAttr::Never | InlineAttr::None) { + struct_span_code_err!(tcx.dcx(), tcx.get_attr(did, sym::inline).unwrap().span(), E0535, "invalid argument") + .with_note("`#[rustc_{start,end}_short_backtrace]` functions must always be `#[inline(never)]`") + .emit(); + } + codegen_fn_attrs.inline = InlineAttr::Never; + } + Some(SkipShortBacktrace::ThisFrameOnly) | None => {} + } // #73631: closures inherit `#[target_feature]` annotations // diff --git a/library/std/src/sys/backtrace.rs b/library/std/src/sys/backtrace.rs index 50e2c05348453..b1306ee541a63 100644 --- a/library/std/src/sys/backtrace.rs +++ b/library/std/src/sys/backtrace.rs @@ -108,10 +108,10 @@ unsafe fn _print_fmt(fmt: &mut fmt::Formatter<'_>, print_fmt: PrintFmt) -> fmt:: match short_backtrace { ShortBacktrace::ThisFrameOnly => skip = true, ShortBacktrace::Start => print = false, - ShortBacktrace::End => { - print = true; - skip = true; - } + // NOTE: Unlike the symbol name case, this implies the frame with this attribute + // *will* be printed. We want that, because unlike `end_short_backtrace`, + // it could be a useful name. + ShortBacktrace::End => print = true, } } diff --git a/tests/ui/backtrace/std-backtrace-skip-frames.line-tables.run.stderr b/tests/ui/backtrace/std-backtrace-skip-frames.line-tables.run.stderr index 819331501962a..714f7bda3a734 100644 --- a/tests/ui/backtrace/std-backtrace-skip-frames.line-tables.run.stderr +++ b/tests/ui/backtrace/std-backtrace-skip-frames.line-tables.run.stderr @@ -7,7 +7,7 @@ stack backtrace: at $SRC_DIR/core/src/result.rs:LL:COL 1: unwrap_result at $DIR/std-backtrace-skip-frames.rs:LL:CC - 2: std_backtrace_skip_frames::main + 2: main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. @@ -17,11 +17,11 @@ thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: oops: () stack backtrace: [... omitted N frames ...] - 0: core::result::Result::expect + 0: expect<(), ()> at $SRC_DIR/core/src/result.rs:LL:COL - 1: std_backtrace_skip_frames::expect_result + 1: expect_result at $DIR/std-backtrace-skip-frames.rs:LL:CC - 2: std_backtrace_skip_frames::main + 2: main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. @@ -35,7 +35,7 @@ stack backtrace: at $SRC_DIR/core/src/option.rs:LL:COL 1: unwrap_option at $DIR/std-backtrace-skip-frames.rs:LL:CC - 2: std_backtrace_skip_frames::main + 2: main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. @@ -45,11 +45,11 @@ thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: oops stack backtrace: [... omitted N frames ...] - 0: core::option::Option::expect + 0: expect<()> at $SRC_DIR/core/src/option.rs:LL:COL - 1: std_backtrace_skip_frames::expect_option + 1: expect_option at $DIR/std-backtrace-skip-frames.rs:LL:CC - 2: std_backtrace_skip_frames::main + 2: main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. @@ -61,7 +61,7 @@ stack backtrace: [... omitted N frames ...] 0: std_backtrace_skip_frames::explicit_panic at $DIR/std-backtrace-skip-frames.rs:LL:CC - 1: std_backtrace_skip_frames::main + 1: main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. @@ -71,9 +71,9 @@ thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: oopsie stack backtrace: [... omitted N frames ...] - 0: std_backtrace_skip_frames::literal_panic + 0: literal_panic at $DIR/std-backtrace-skip-frames.rs:LL:CC - 1: std_backtrace_skip_frames::main + 1: main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. @@ -83,12 +83,12 @@ thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: 3 stack backtrace: [... omitted N frames ...] - 0: std_backtrace_skip_frames::panic_fmt + 0: panic_fmt at $DIR/std-backtrace-skip-frames.rs:LL:CC - 1: std_backtrace_skip_frames::main::{{closure}} + 1: {closure#0} at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] - 2: std_backtrace_skip_frames::main + 2: main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. @@ -102,11 +102,11 @@ stack backtrace: at $SRC_DIR/core/src/ub_checks.rs:LL:COL 1: get_unchecked at $SRC_DIR/core/src/ub_checks.rs:LL:COL - 2: core::slice::::get_unchecked + 2: get_unchecked at $SRC_DIR/core/src/slice/mod.rs:LL:COL - 3: std_backtrace_skip_frames::panic_nounwind + 3: panic_nounwind at $DIR/std-backtrace-skip-frames.rs:LL:CC - 4: std_backtrace_skip_frames::main + 4: main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. @@ -116,14 +116,14 @@ thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: explicit panic stack backtrace: [... omitted N frames ...] - 0: std_backtrace_skip_frames::check_all_panics::{{closure}} + 0: {closure#0} at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] 1: catch_unwind at $SRC_DIR/std/src/panic.rs:LL:COL 2: check_all_panics at $DIR/std-backtrace-skip-frames.rs:LL:CC - 3: std_backtrace_skip_frames::main + 3: main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. diff --git a/tests/ui/backtrace/std-backtrace-skip-frames.no-split.run.stderr b/tests/ui/backtrace/std-backtrace-skip-frames.no-split.run.stderr index 819331501962a..714f7bda3a734 100644 --- a/tests/ui/backtrace/std-backtrace-skip-frames.no-split.run.stderr +++ b/tests/ui/backtrace/std-backtrace-skip-frames.no-split.run.stderr @@ -7,7 +7,7 @@ stack backtrace: at $SRC_DIR/core/src/result.rs:LL:COL 1: unwrap_result at $DIR/std-backtrace-skip-frames.rs:LL:CC - 2: std_backtrace_skip_frames::main + 2: main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. @@ -17,11 +17,11 @@ thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: oops: () stack backtrace: [... omitted N frames ...] - 0: core::result::Result::expect + 0: expect<(), ()> at $SRC_DIR/core/src/result.rs:LL:COL - 1: std_backtrace_skip_frames::expect_result + 1: expect_result at $DIR/std-backtrace-skip-frames.rs:LL:CC - 2: std_backtrace_skip_frames::main + 2: main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. @@ -35,7 +35,7 @@ stack backtrace: at $SRC_DIR/core/src/option.rs:LL:COL 1: unwrap_option at $DIR/std-backtrace-skip-frames.rs:LL:CC - 2: std_backtrace_skip_frames::main + 2: main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. @@ -45,11 +45,11 @@ thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: oops stack backtrace: [... omitted N frames ...] - 0: core::option::Option::expect + 0: expect<()> at $SRC_DIR/core/src/option.rs:LL:COL - 1: std_backtrace_skip_frames::expect_option + 1: expect_option at $DIR/std-backtrace-skip-frames.rs:LL:CC - 2: std_backtrace_skip_frames::main + 2: main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. @@ -61,7 +61,7 @@ stack backtrace: [... omitted N frames ...] 0: std_backtrace_skip_frames::explicit_panic at $DIR/std-backtrace-skip-frames.rs:LL:CC - 1: std_backtrace_skip_frames::main + 1: main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. @@ -71,9 +71,9 @@ thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: oopsie stack backtrace: [... omitted N frames ...] - 0: std_backtrace_skip_frames::literal_panic + 0: literal_panic at $DIR/std-backtrace-skip-frames.rs:LL:CC - 1: std_backtrace_skip_frames::main + 1: main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. @@ -83,12 +83,12 @@ thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: 3 stack backtrace: [... omitted N frames ...] - 0: std_backtrace_skip_frames::panic_fmt + 0: panic_fmt at $DIR/std-backtrace-skip-frames.rs:LL:CC - 1: std_backtrace_skip_frames::main::{{closure}} + 1: {closure#0} at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] - 2: std_backtrace_skip_frames::main + 2: main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. @@ -102,11 +102,11 @@ stack backtrace: at $SRC_DIR/core/src/ub_checks.rs:LL:COL 1: get_unchecked at $SRC_DIR/core/src/ub_checks.rs:LL:COL - 2: core::slice::::get_unchecked + 2: get_unchecked at $SRC_DIR/core/src/slice/mod.rs:LL:COL - 3: std_backtrace_skip_frames::panic_nounwind + 3: panic_nounwind at $DIR/std-backtrace-skip-frames.rs:LL:CC - 4: std_backtrace_skip_frames::main + 4: main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. @@ -116,14 +116,14 @@ thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: explicit panic stack backtrace: [... omitted N frames ...] - 0: std_backtrace_skip_frames::check_all_panics::{{closure}} + 0: {closure#0} at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] 1: catch_unwind at $SRC_DIR/std/src/panic.rs:LL:COL 2: check_all_panics at $DIR/std-backtrace-skip-frames.rs:LL:CC - 3: std_backtrace_skip_frames::main + 3: main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. diff --git a/tests/ui/backtrace/std-backtrace-skip-frames.packed.run.stderr b/tests/ui/backtrace/std-backtrace-skip-frames.packed.run.stderr index 819331501962a..714f7bda3a734 100644 --- a/tests/ui/backtrace/std-backtrace-skip-frames.packed.run.stderr +++ b/tests/ui/backtrace/std-backtrace-skip-frames.packed.run.stderr @@ -7,7 +7,7 @@ stack backtrace: at $SRC_DIR/core/src/result.rs:LL:COL 1: unwrap_result at $DIR/std-backtrace-skip-frames.rs:LL:CC - 2: std_backtrace_skip_frames::main + 2: main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. @@ -17,11 +17,11 @@ thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: oops: () stack backtrace: [... omitted N frames ...] - 0: core::result::Result::expect + 0: expect<(), ()> at $SRC_DIR/core/src/result.rs:LL:COL - 1: std_backtrace_skip_frames::expect_result + 1: expect_result at $DIR/std-backtrace-skip-frames.rs:LL:CC - 2: std_backtrace_skip_frames::main + 2: main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. @@ -35,7 +35,7 @@ stack backtrace: at $SRC_DIR/core/src/option.rs:LL:COL 1: unwrap_option at $DIR/std-backtrace-skip-frames.rs:LL:CC - 2: std_backtrace_skip_frames::main + 2: main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. @@ -45,11 +45,11 @@ thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: oops stack backtrace: [... omitted N frames ...] - 0: core::option::Option::expect + 0: expect<()> at $SRC_DIR/core/src/option.rs:LL:COL - 1: std_backtrace_skip_frames::expect_option + 1: expect_option at $DIR/std-backtrace-skip-frames.rs:LL:CC - 2: std_backtrace_skip_frames::main + 2: main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. @@ -61,7 +61,7 @@ stack backtrace: [... omitted N frames ...] 0: std_backtrace_skip_frames::explicit_panic at $DIR/std-backtrace-skip-frames.rs:LL:CC - 1: std_backtrace_skip_frames::main + 1: main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. @@ -71,9 +71,9 @@ thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: oopsie stack backtrace: [... omitted N frames ...] - 0: std_backtrace_skip_frames::literal_panic + 0: literal_panic at $DIR/std-backtrace-skip-frames.rs:LL:CC - 1: std_backtrace_skip_frames::main + 1: main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. @@ -83,12 +83,12 @@ thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: 3 stack backtrace: [... omitted N frames ...] - 0: std_backtrace_skip_frames::panic_fmt + 0: panic_fmt at $DIR/std-backtrace-skip-frames.rs:LL:CC - 1: std_backtrace_skip_frames::main::{{closure}} + 1: {closure#0} at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] - 2: std_backtrace_skip_frames::main + 2: main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. @@ -102,11 +102,11 @@ stack backtrace: at $SRC_DIR/core/src/ub_checks.rs:LL:COL 1: get_unchecked at $SRC_DIR/core/src/ub_checks.rs:LL:COL - 2: core::slice::::get_unchecked + 2: get_unchecked at $SRC_DIR/core/src/slice/mod.rs:LL:COL - 3: std_backtrace_skip_frames::panic_nounwind + 3: panic_nounwind at $DIR/std-backtrace-skip-frames.rs:LL:CC - 4: std_backtrace_skip_frames::main + 4: main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. @@ -116,14 +116,14 @@ thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: explicit panic stack backtrace: [... omitted N frames ...] - 0: std_backtrace_skip_frames::check_all_panics::{{closure}} + 0: {closure#0} at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] 1: catch_unwind at $SRC_DIR/std/src/panic.rs:LL:COL 2: check_all_panics at $DIR/std-backtrace-skip-frames.rs:LL:CC - 3: std_backtrace_skip_frames::main + 3: main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. diff --git a/tests/ui/backtrace/std-backtrace-skip-frames.rs b/tests/ui/backtrace/std-backtrace-skip-frames.rs index 28ca91a440481..b7e6b4bd1a19c 100644 --- a/tests/ui/backtrace/std-backtrace-skip-frames.rs +++ b/tests/ui/backtrace/std-backtrace-skip-frames.rs @@ -11,6 +11,7 @@ //@ ignore-fuchsia Backtraces not symbolized //@ needs-unwind +//@ run-pass //@ check-run-results //@ normalize-stderr: "omitted [0-9]+ frames?" -> "omitted N frames" //@ normalize-stderr: ".rs:[0-9]+:[0-9]+" -> ".rs:LL:CC" @@ -25,7 +26,8 @@ //@ edition:2021 //@ compile-flags:-Cstrip=none -Cdebug-assertions=true //@ revisions:line-tables limited full no-split packed unpacked -//@[no-split] ignore-msvc ignore-macos +//@[no-split] ignore-msvc +//@[no-split] ignore-macos //@[unpacked] ignore-msvc //@[no-split] compile-flags:-Cdebuginfo=line-tables-only -Csplit-debuginfo=off @@ -52,6 +54,7 @@ fn main() { let func = match env::args().skip(1).next().as_deref() { None => { check_all_panics(); + return; } Some(UNWRAP_RESULT) => unwrap_result, Some(EXPECT_RESULT) => expect_result, diff --git a/tests/ui/backtrace/std-backtrace-skip-frames.unpacked.run.stderr b/tests/ui/backtrace/std-backtrace-skip-frames.unpacked.run.stderr index 819331501962a..714f7bda3a734 100644 --- a/tests/ui/backtrace/std-backtrace-skip-frames.unpacked.run.stderr +++ b/tests/ui/backtrace/std-backtrace-skip-frames.unpacked.run.stderr @@ -7,7 +7,7 @@ stack backtrace: at $SRC_DIR/core/src/result.rs:LL:COL 1: unwrap_result at $DIR/std-backtrace-skip-frames.rs:LL:CC - 2: std_backtrace_skip_frames::main + 2: main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. @@ -17,11 +17,11 @@ thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: oops: () stack backtrace: [... omitted N frames ...] - 0: core::result::Result::expect + 0: expect<(), ()> at $SRC_DIR/core/src/result.rs:LL:COL - 1: std_backtrace_skip_frames::expect_result + 1: expect_result at $DIR/std-backtrace-skip-frames.rs:LL:CC - 2: std_backtrace_skip_frames::main + 2: main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. @@ -35,7 +35,7 @@ stack backtrace: at $SRC_DIR/core/src/option.rs:LL:COL 1: unwrap_option at $DIR/std-backtrace-skip-frames.rs:LL:CC - 2: std_backtrace_skip_frames::main + 2: main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. @@ -45,11 +45,11 @@ thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: oops stack backtrace: [... omitted N frames ...] - 0: core::option::Option::expect + 0: expect<()> at $SRC_DIR/core/src/option.rs:LL:COL - 1: std_backtrace_skip_frames::expect_option + 1: expect_option at $DIR/std-backtrace-skip-frames.rs:LL:CC - 2: std_backtrace_skip_frames::main + 2: main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. @@ -61,7 +61,7 @@ stack backtrace: [... omitted N frames ...] 0: std_backtrace_skip_frames::explicit_panic at $DIR/std-backtrace-skip-frames.rs:LL:CC - 1: std_backtrace_skip_frames::main + 1: main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. @@ -71,9 +71,9 @@ thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: oopsie stack backtrace: [... omitted N frames ...] - 0: std_backtrace_skip_frames::literal_panic + 0: literal_panic at $DIR/std-backtrace-skip-frames.rs:LL:CC - 1: std_backtrace_skip_frames::main + 1: main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. @@ -83,12 +83,12 @@ thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: 3 stack backtrace: [... omitted N frames ...] - 0: std_backtrace_skip_frames::panic_fmt + 0: panic_fmt at $DIR/std-backtrace-skip-frames.rs:LL:CC - 1: std_backtrace_skip_frames::main::{{closure}} + 1: {closure#0} at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] - 2: std_backtrace_skip_frames::main + 2: main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. @@ -102,11 +102,11 @@ stack backtrace: at $SRC_DIR/core/src/ub_checks.rs:LL:COL 1: get_unchecked at $SRC_DIR/core/src/ub_checks.rs:LL:COL - 2: core::slice::::get_unchecked + 2: get_unchecked at $SRC_DIR/core/src/slice/mod.rs:LL:COL - 3: std_backtrace_skip_frames::panic_nounwind + 3: panic_nounwind at $DIR/std-backtrace-skip-frames.rs:LL:CC - 4: std_backtrace_skip_frames::main + 4: main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. @@ -116,14 +116,14 @@ thread 'main' panicked at $DIR/std-backtrace-skip-frames.rs:LL:CC: explicit panic stack backtrace: [... omitted N frames ...] - 0: std_backtrace_skip_frames::check_all_panics::{{closure}} + 0: {closure#0} at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] 1: catch_unwind at $SRC_DIR/std/src/panic.rs:LL:COL 2: check_all_panics at $DIR/std-backtrace-skip-frames.rs:LL:CC - 3: std_backtrace_skip_frames::main + 3: main at $DIR/std-backtrace-skip-frames.rs:LL:CC [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. diff --git a/tests/ui/panics/short-ice-remove-middle-frames.rs b/tests/ui/panics/short-ice-remove-middle-frames.rs index 216c512779956..9b2feb0de472b 100644 --- a/tests/ui/panics/short-ice-remove-middle-frames.rs +++ b/tests/ui/panics/short-ice-remove-middle-frames.rs @@ -1,4 +1,4 @@ -//@ compile-flags:-Cstrip=none +//@ compile-flags:-Cstrip=none -Cdebuginfo=line-tables-only //@ run-fail //@ check-run-results //@ exec-env:RUST_BACKTRACE=1 @@ -10,33 +10,17 @@ //@ ignore-fuchsia Backtraces not symbolized //@ ignore-msvc the `__rust_{begin,end}_short_backtrace` symbols aren't reliable. -// This is needed to avoid test output differences across std being built with v0 symbols vs legacy -// symbols. -//@ normalize-stderr: "begin_panic::<&str>" -> "begin_panic" -// This variant occurs on macOS with `rust.debuginfo-level = "line-tables-only"` (#133997) -//@ normalize-stderr: " begin_panic<&str>" -> " std::panicking::begin_panic" -// And this is for differences between std with and without debuginfo. -//@ normalize-stderr: "\n +at [^\n]+" -> "" - -#[inline(never)] -fn __rust_begin_short_backtrace T>(f: F) -> T { - let result = f(); - std::hint::black_box(result) -} - -#[inline(never)] -fn __rust_end_short_backtrace T>(f: F) -> T { - let result = f(); - std::hint::black_box(result) -} +#![feature(rustc_attrs)] +// do not take effect since we already has a inner call of __rust_end_short_backtrace +#[rustc_end_short_backtrace] fn first() { - __rust_end_short_backtrace(|| second()); - // do not take effect since we already has a inner call of __rust_end_short_backtrace + second(); } +#[rustc_end_short_backtrace] fn second() { - __rust_end_short_backtrace(|| third()); + third(); // won't show up in backtrace } fn third() { @@ -47,8 +31,9 @@ fn fourth() { fifth(); // won't show up in backtrace } +#[rustc_start_short_backtrace] fn fifth() { - __rust_begin_short_backtrace(|| sixth()); + sixth(); } fn sixth() { diff --git a/tests/ui/panics/short-ice-remove-middle-frames.run.stderr b/tests/ui/panics/short-ice-remove-middle-frames.run.stderr index d2616911e3bf8..32e4bde60dcd3 100644 --- a/tests/ui/panics/short-ice-remove-middle-frames.run.stderr +++ b/tests/ui/panics/short-ice-remove-middle-frames.run.stderr @@ -1,14 +1,17 @@ -thread 'main' panicked at $DIR/short-ice-remove-middle-frames.rs:59:5: +thread 'main' panicked at $DIR/short-ice-remove-middle-frames.rs:44:5: debug!!! stack backtrace: - 0: std::panicking::begin_panic - 1: short_ice_remove_middle_frames::seven - 2: short_ice_remove_middle_frames::sixth - 3: short_ice_remove_middle_frames::fifth::{{closure}} - [... omitted 4 frames ...] - 4: short_ice_remove_middle_frames::second - 5: short_ice_remove_middle_frames::first::{{closure}} - 6: short_ice_remove_middle_frames::first - 7: short_ice_remove_middle_frames::main - 8: core::ops::function::FnOnce::call_once + [... omitted 14 frames ...] + 0: short_ice_remove_middle_frames::seven + at $DIR/short-ice-remove-middle-frames.rs:44:5 + 1: short_ice_remove_middle_frames::sixth + at $DIR/short-ice-remove-middle-frames.rs:40:5 + [... omitted 3 frames ...] + 2: second + at $DIR/short-ice-remove-middle-frames.rs:23:5 + 3: first + at $DIR/short-ice-remove-middle-frames.rs:18:5 + 4: short_ice_remove_middle_frames::main + at $DIR/short-ice-remove-middle-frames.rs:48:5 + [... omitted 16 frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. From 0e2a6c6c8941126b78306b805502f22935d8dd99 Mon Sep 17 00:00:00 2001 From: jyn Date: Mon, 20 Jan 2025 17:17:08 -0500 Subject: [PATCH 15/18] update tests --- tests/ui/check-cfg/allow-same-level.stderr | 2 +- tests/ui/check-cfg/cargo-build-script.stderr | 2 +- tests/ui/check-cfg/cargo-feature.none.stderr | 2 +- tests/ui/check-cfg/cargo-feature.some.stderr | 2 +- .../cfg-value-for-cfg-name-duplicate.stderr | 2 +- .../cfg-value-for-cfg-name-multiple.stderr | 2 +- .../check-cfg/cfg-value-for-cfg-name.stderr | 2 +- tests/ui/check-cfg/compact-names.stderr | 2 +- .../exhaustive-names-values.empty_cfg.stderr | 2 +- .../exhaustive-names-values.feature.stderr | 2 +- .../exhaustive-names-values.full.stderr | 2 +- tests/ui/check-cfg/exhaustive-names.stderr | 2 +- tests/ui/check-cfg/mix.stderr | 2 +- .../check-cfg/raw-keywords.edition2015.stderr | 2 +- .../check-cfg/raw-keywords.edition2021.stderr | 2 +- .../report-in-external-macros.cargo.stderr | 2 +- .../report-in-external-macros.rustc.stderr | 2 +- tests/ui/check-cfg/stmt-no-ice.stderr | 2 +- tests/ui/check-cfg/well-known-names.stderr | 2 +- .../ui/panics/issue-47429-short-backtraces.rs | 9 ++------ .../issue-47429-short-backtraces.run.stderr | 7 +++--- tests/ui/panics/runtime-switch.rs | 9 ++------ tests/ui/panics/runtime-switch.run.stderr | 7 +++--- .../short-ice-remove-middle-frames-2.rs | 13 ++++------- ...hort-ice-remove-middle-frames-2.run.stderr | 23 ++++++++++--------- 25 files changed, 48 insertions(+), 58 deletions(-) diff --git a/tests/ui/check-cfg/allow-same-level.stderr b/tests/ui/check-cfg/allow-same-level.stderr index b1a9c5810d8bc..7bfc0482698f1 100644 --- a/tests/ui/check-cfg/allow-same-level.stderr +++ b/tests/ui/check-cfg/allow-same-level.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `FALSE` LL | #[cfg(FALSE)] | ^^^^^ | - = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` + = help: expected names are: `bootstrap`, `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` = help: to expect this configuration use `--check-cfg=cfg(FALSE)` = note: see for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/cargo-build-script.stderr b/tests/ui/check-cfg/cargo-build-script.stderr index 0b01b1da5a787..b62f25da283d3 100644 --- a/tests/ui/check-cfg/cargo-build-script.stderr +++ b/tests/ui/check-cfg/cargo-build-script.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `has_foo` LL | #[cfg(has_foo)] | ^^^^^^^ | - = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `has_bar`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` + = help: expected names are: `bootstrap`, `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `has_bar`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` = help: consider using a Cargo feature instead = help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint: [lints.rust] diff --git a/tests/ui/check-cfg/cargo-feature.none.stderr b/tests/ui/check-cfg/cargo-feature.none.stderr index 6de6e9a685123..c012b589587e5 100644 --- a/tests/ui/check-cfg/cargo-feature.none.stderr +++ b/tests/ui/check-cfg/cargo-feature.none.stderr @@ -25,7 +25,7 @@ warning: unexpected `cfg` condition name: `tokio_unstable` LL | #[cfg(tokio_unstable)] | ^^^^^^^^^^^^^^ | - = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` + = help: expected names are: `bootstrap`, `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` = help: consider using a Cargo feature instead = help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint: [lints.rust] diff --git a/tests/ui/check-cfg/cargo-feature.some.stderr b/tests/ui/check-cfg/cargo-feature.some.stderr index d4a7f6defb29f..e1a70f10e0f3d 100644 --- a/tests/ui/check-cfg/cargo-feature.some.stderr +++ b/tests/ui/check-cfg/cargo-feature.some.stderr @@ -25,7 +25,7 @@ warning: unexpected `cfg` condition name: `tokio_unstable` LL | #[cfg(tokio_unstable)] | ^^^^^^^^^^^^^^ | - = help: expected names are: `CONFIG_NVME`, `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` + = help: expected names are: `CONFIG_NVME`, `bootstrap`, `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` = help: consider using a Cargo feature instead = help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint: [lints.rust] diff --git a/tests/ui/check-cfg/cfg-value-for-cfg-name-duplicate.stderr b/tests/ui/check-cfg/cfg-value-for-cfg-name-duplicate.stderr index 831722a12e25c..dd9b80052aa4d 100644 --- a/tests/ui/check-cfg/cfg-value-for-cfg-name-duplicate.stderr +++ b/tests/ui/check-cfg/cfg-value-for-cfg-name-duplicate.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `value` LL | #[cfg(value)] | ^^^^^ | - = help: expected names are: `bar`, `bee`, `clippy`, `cow`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `foo`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` + = help: expected names are: `bar`, `bee`, `bootstrap`, `clippy`, `cow`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `foo`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, and `unix` and 1 more = help: to expect this configuration use `--check-cfg=cfg(value)` = note: see for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/cfg-value-for-cfg-name-multiple.stderr b/tests/ui/check-cfg/cfg-value-for-cfg-name-multiple.stderr index a35a8d68def09..495aec8c7c763 100644 --- a/tests/ui/check-cfg/cfg-value-for-cfg-name-multiple.stderr +++ b/tests/ui/check-cfg/cfg-value-for-cfg-name-multiple.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `my_value` LL | #[cfg(my_value)] | ^^^^^^^^ | - = help: expected names are: `bar`, `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `foo`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` + = help: expected names are: `bar`, `bootstrap`, `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `foo`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` = help: to expect this configuration use `--check-cfg=cfg(my_value)` = note: see for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/cfg-value-for-cfg-name.stderr b/tests/ui/check-cfg/cfg-value-for-cfg-name.stderr index 65a73ffcd1d35..6405e809e1c9e 100644 --- a/tests/ui/check-cfg/cfg-value-for-cfg-name.stderr +++ b/tests/ui/check-cfg/cfg-value-for-cfg-name.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `linux` LL | #[cfg(linux)] | ^^^^^ help: found config with similar value: `target_os = "linux"` | - = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` + = help: expected names are: `bootstrap`, `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` = help: to expect this configuration use `--check-cfg=cfg(linux)` = note: see for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/compact-names.stderr b/tests/ui/check-cfg/compact-names.stderr index 536c992ee92ea..3e606cabe3e67 100644 --- a/tests/ui/check-cfg/compact-names.stderr +++ b/tests/ui/check-cfg/compact-names.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `target_architecture` LL | #[cfg(target(os = "linux", architecture = "arm"))] | ^^^^^^^^^^^^^^^^^^^^ | - = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` + = help: expected names are: `bootstrap`, `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` = help: to expect this configuration use `--check-cfg=cfg(target_architecture, values("arm"))` = note: see for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/exhaustive-names-values.empty_cfg.stderr b/tests/ui/check-cfg/exhaustive-names-values.empty_cfg.stderr index 6c26a8b11d99d..a79c167e9a29f 100644 --- a/tests/ui/check-cfg/exhaustive-names-values.empty_cfg.stderr +++ b/tests/ui/check-cfg/exhaustive-names-values.empty_cfg.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `unknown_key` LL | #[cfg(unknown_key = "value")] | ^^^^^^^^^^^^^^^^^^^^^ | - = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` + = help: expected names are: `bootstrap`, `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` = help: to expect this configuration use `--check-cfg=cfg(unknown_key, values("value"))` = note: see for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/exhaustive-names-values.feature.stderr b/tests/ui/check-cfg/exhaustive-names-values.feature.stderr index b7ccf5e5f83a3..1dbbf2f9092b4 100644 --- a/tests/ui/check-cfg/exhaustive-names-values.feature.stderr +++ b/tests/ui/check-cfg/exhaustive-names-values.feature.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `unknown_key` LL | #[cfg(unknown_key = "value")] | ^^^^^^^^^^^^^^^^^^^^^ | - = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` + = help: expected names are: `bootstrap`, `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` = help: to expect this configuration use `--check-cfg=cfg(unknown_key, values("value"))` = note: see for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/exhaustive-names-values.full.stderr b/tests/ui/check-cfg/exhaustive-names-values.full.stderr index b7ccf5e5f83a3..1dbbf2f9092b4 100644 --- a/tests/ui/check-cfg/exhaustive-names-values.full.stderr +++ b/tests/ui/check-cfg/exhaustive-names-values.full.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `unknown_key` LL | #[cfg(unknown_key = "value")] | ^^^^^^^^^^^^^^^^^^^^^ | - = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` + = help: expected names are: `bootstrap`, `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` = help: to expect this configuration use `--check-cfg=cfg(unknown_key, values("value"))` = note: see for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/exhaustive-names.stderr b/tests/ui/check-cfg/exhaustive-names.stderr index 5350534f3e81c..a9cbbc3bb853f 100644 --- a/tests/ui/check-cfg/exhaustive-names.stderr +++ b/tests/ui/check-cfg/exhaustive-names.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `unknown_key` LL | #[cfg(unknown_key = "value")] | ^^^^^^^^^^^^^^^^^^^^^ | - = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` + = help: expected names are: `bootstrap`, `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` = help: to expect this configuration use `--check-cfg=cfg(unknown_key, values("value"))` = note: see for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/mix.stderr b/tests/ui/check-cfg/mix.stderr index 231236799c69c..c512fbb0e0302 100644 --- a/tests/ui/check-cfg/mix.stderr +++ b/tests/ui/check-cfg/mix.stderr @@ -44,7 +44,7 @@ warning: unexpected `cfg` condition name: `uu` LL | #[cfg_attr(uu, test)] | ^^ | - = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` + = help: expected names are: `bootstrap`, `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` = help: to expect this configuration use `--check-cfg=cfg(uu)` = note: see for more information about checking conditional configuration diff --git a/tests/ui/check-cfg/raw-keywords.edition2015.stderr b/tests/ui/check-cfg/raw-keywords.edition2015.stderr index ab7e77686ee9e..bca7dca09926e 100644 --- a/tests/ui/check-cfg/raw-keywords.edition2015.stderr +++ b/tests/ui/check-cfg/raw-keywords.edition2015.stderr @@ -14,7 +14,7 @@ warning: unexpected `cfg` condition name: `r#false` LL | #[cfg(r#false)] | ^^^^^^^ | - = help: expected names are: `async`, `clippy`, `debug_assertions`, `doc`, `doctest`, `edition2015`, `edition2021`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `r#true`, `ub_checks`, `unix`, and `windows` + = help: expected names are: `async`, `bootstrap`, `clippy`, `debug_assertions`, `doc`, `doctest`, `edition2015`, `edition2021`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `r#true`, `ub_checks`, and `unix` and 1 more = help: to expect this configuration use `--check-cfg=cfg(r#false)` = note: see for more information about checking conditional configuration diff --git a/tests/ui/check-cfg/raw-keywords.edition2021.stderr b/tests/ui/check-cfg/raw-keywords.edition2021.stderr index 1ae1cad4e6b50..71b876471ee04 100644 --- a/tests/ui/check-cfg/raw-keywords.edition2021.stderr +++ b/tests/ui/check-cfg/raw-keywords.edition2021.stderr @@ -14,7 +14,7 @@ warning: unexpected `cfg` condition name: `r#false` LL | #[cfg(r#false)] | ^^^^^^^ | - = help: expected names are: `r#async`, `clippy`, `debug_assertions`, `doc`, `doctest`, `edition2015`, `edition2021`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `r#true`, `ub_checks`, `unix`, and `windows` + = help: expected names are: `r#async`, `bootstrap`, `clippy`, `debug_assertions`, `doc`, `doctest`, `edition2015`, `edition2021`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `r#true`, `ub_checks`, and `unix` and 1 more = help: to expect this configuration use `--check-cfg=cfg(r#false)` = note: see for more information about checking conditional configuration diff --git a/tests/ui/check-cfg/report-in-external-macros.cargo.stderr b/tests/ui/check-cfg/report-in-external-macros.cargo.stderr index 290de4afb26f0..62048bec43d78 100644 --- a/tests/ui/check-cfg/report-in-external-macros.cargo.stderr +++ b/tests/ui/check-cfg/report-in-external-macros.cargo.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `my_lib_cfg` LL | cfg_macro::my_lib_macro!(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` + = help: expected names are: `bootstrap`, `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` = note: using a cfg inside a macro will use the cfgs from the destination crate and not the ones from the defining crate = help: try referring to `cfg_macro::my_lib_macro` crate for guidance on how handle this unexpected cfg = help: the macro `cfg_macro::my_lib_macro` may come from an old version of the `cfg_macro` crate, try updating your dependency with `cargo update -p cfg_macro` diff --git a/tests/ui/check-cfg/report-in-external-macros.rustc.stderr b/tests/ui/check-cfg/report-in-external-macros.rustc.stderr index e1a2a8e86c637..76d24cbb986fa 100644 --- a/tests/ui/check-cfg/report-in-external-macros.rustc.stderr +++ b/tests/ui/check-cfg/report-in-external-macros.rustc.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `my_lib_cfg` LL | cfg_macro::my_lib_macro!(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` + = help: expected names are: `bootstrap`, `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` = note: using a cfg inside a macro will use the cfgs from the destination crate and not the ones from the defining crate = help: try referring to `cfg_macro::my_lib_macro` crate for guidance on how handle this unexpected cfg = help: to expect this configuration use `--check-cfg=cfg(my_lib_cfg)` diff --git a/tests/ui/check-cfg/stmt-no-ice.stderr b/tests/ui/check-cfg/stmt-no-ice.stderr index 98f09a648bc75..e0bf91542a114 100644 --- a/tests/ui/check-cfg/stmt-no-ice.stderr +++ b/tests/ui/check-cfg/stmt-no-ice.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `crossbeam_loom` LL | #[cfg(crossbeam_loom)] | ^^^^^^^^^^^^^^ | - = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` + = help: expected names are: `bootstrap`, `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` = help: to expect this configuration use `--check-cfg=cfg(crossbeam_loom)` = note: see for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/well-known-names.stderr b/tests/ui/check-cfg/well-known-names.stderr index abcf53cfe3087..c727d7a750f2e 100644 --- a/tests/ui/check-cfg/well-known-names.stderr +++ b/tests/ui/check-cfg/well-known-names.stderr @@ -18,7 +18,7 @@ warning: unexpected `cfg` condition name: `features` LL | #[cfg(features = "foo")] | ^^^^^^^^^^^^^^^^ | - = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` + = help: expected names are: `bootstrap`, `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` = help: to expect this configuration use `--check-cfg=cfg(features, values("foo"))` = note: see for more information about checking conditional configuration diff --git a/tests/ui/panics/issue-47429-short-backtraces.rs b/tests/ui/panics/issue-47429-short-backtraces.rs index dff885af1b87a..b3517fe2ff27e 100644 --- a/tests/ui/panics/issue-47429-short-backtraces.rs +++ b/tests/ui/panics/issue-47429-short-backtraces.rs @@ -6,13 +6,8 @@ //@ check-run-results //@ exec-env:RUST_BACKTRACE=1 -// This is needed to avoid test output differences across std being built with v0 symbols vs legacy -// symbols. -//@ normalize-stderr: "begin_panic::<&str>" -> "begin_panic" -// This variant occurs on macOS with `rust.debuginfo-level = "line-tables-only"` (#133997) -//@ normalize-stderr: " begin_panic<&str>" -> " std::panicking::begin_panic" -// And this is for differences between std with and without debuginfo. -//@ normalize-stderr: "\n +at [^\n]+" -> "" +//@ normalize-stderr: "omitted [0-9]+ frames?" -> "omitted N frames" +//@ normalize-stderr: ".rs:[0-9]+:[0-9]+" -> ".rs:LL:CC" //@ ignore-msvc see #62897 and `backtrace-debuginfo.rs` test //@ ignore-android FIXME #17520 diff --git a/tests/ui/panics/issue-47429-short-backtraces.run.stderr b/tests/ui/panics/issue-47429-short-backtraces.run.stderr index 6a22e0215fee1..e7ba2746f2b8a 100644 --- a/tests/ui/panics/issue-47429-short-backtraces.run.stderr +++ b/tests/ui/panics/issue-47429-short-backtraces.run.stderr @@ -1,6 +1,7 @@ -thread 'main' panicked at $DIR/issue-47429-short-backtraces.rs:26:5: +thread 'main' panicked at $DIR/issue-47429-short-backtraces.rs:LL:CC: explicit panic stack backtrace: - 0: std::panicking::begin_panic - 1: issue_47429_short_backtraces::main + [... omitted N frames ...] + 0: issue_47429_short_backtraces::main + [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. diff --git a/tests/ui/panics/runtime-switch.rs b/tests/ui/panics/runtime-switch.rs index ffd038f953515..3efd79876e70f 100644 --- a/tests/ui/panics/runtime-switch.rs +++ b/tests/ui/panics/runtime-switch.rs @@ -6,13 +6,8 @@ //@ check-run-results //@ exec-env:RUST_BACKTRACE=0 -// This is needed to avoid test output differences across std being built with v0 symbols vs legacy -// symbols. -//@ normalize-stderr: "begin_panic::<&str>" -> "begin_panic" -// This variant occurs on macOS with `rust.debuginfo-level = "line-tables-only"` (#133997) -//@ normalize-stderr: " begin_panic<&str>" -> " std::panicking::begin_panic" -// And this is for differences between std with and without debuginfo. -//@ normalize-stderr: "\n +at [^\n]+" -> "" +//@ normalize-stderr: "omitted [0-9]+ frames?" -> "omitted N frames" +//@ normalize-stderr: ".rs:[0-9]+:[0-9]+" -> ".rs:LL:CC" //@ ignore-msvc see #62897 and `backtrace-debuginfo.rs` test //@ ignore-android FIXME #17520 diff --git a/tests/ui/panics/runtime-switch.run.stderr b/tests/ui/panics/runtime-switch.run.stderr index 35be010d6be71..b257ceb3f290e 100644 --- a/tests/ui/panics/runtime-switch.run.stderr +++ b/tests/ui/panics/runtime-switch.run.stderr @@ -1,6 +1,7 @@ -thread 'main' panicked at $DIR/runtime-switch.rs:29:5: +thread 'main' panicked at $DIR/runtime-switch.rs:LL:CC: explicit panic stack backtrace: - 0: std::panicking::begin_panic - 1: runtime_switch::main + [... omitted N frames ...] + 0: runtime_switch::main + [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. diff --git a/tests/ui/panics/short-ice-remove-middle-frames-2.rs b/tests/ui/panics/short-ice-remove-middle-frames-2.rs index 48f60b141706b..0971e3ac328bc 100644 --- a/tests/ui/panics/short-ice-remove-middle-frames-2.rs +++ b/tests/ui/panics/short-ice-remove-middle-frames-2.rs @@ -1,4 +1,5 @@ -//@ compile-flags:-Cstrip=none +//@ compile-flags:-Cstrip=none -Cdebuginfo=none +//-Cdebuginfo=line-tables-only //@ run-fail //@ check-run-results //@ exec-env:RUST_BACKTRACE=1 @@ -9,13 +10,9 @@ //@ ignore-sgx Backtraces not symbolized //@ ignore-fuchsia Backtraces not symbolized //@ ignore-msvc the `__rust_{begin,end}_short_backtrace` symbols aren't reliable. -// This is needed to avoid test output differences across std being built with v0 symbols vs legacy -// symbols. -//@ normalize-stderr: "begin_panic::<&str>" -> "begin_panic" -// This variant occurs on macOS with `rust.debuginfo-level = "line-tables-only"` (#133997) -//@ normalize-stderr: " begin_panic<&str>" -> " std::panicking::begin_panic" -// And this is for differences between std with and without debuginfo. -//@ normalize-stderr: "\n +at [^\n]+" -> "" + +//@ normalize-stderr: "omitted [0-9][0-9]+ frames?" -> "omitted N frames" +//@ normalize-stderr: ".rs:[0-9]+:[0-9]+" -> ".rs:LL:CC" /// This test case make sure that we can have multiple pairs of `__rust_{begin,end}_short_backtrace` diff --git a/tests/ui/panics/short-ice-remove-middle-frames-2.run.stderr b/tests/ui/panics/short-ice-remove-middle-frames-2.run.stderr index ab23ce7806257..1045dea5392f1 100644 --- a/tests/ui/panics/short-ice-remove-middle-frames-2.run.stderr +++ b/tests/ui/panics/short-ice-remove-middle-frames-2.run.stderr @@ -1,14 +1,15 @@ -thread 'main' panicked at $DIR/short-ice-remove-middle-frames-2.rs:63:5: +thread 'main' panicked at $DIR/short-ice-remove-middle-frames-2.rs:LL:CC: debug!!! stack backtrace: - 0: std::panicking::begin_panic - 1: short_ice_remove_middle_frames_2::eight - 2: short_ice_remove_middle_frames_2::seven::{{closure}} - [... omitted 3 frames ...] - 3: short_ice_remove_middle_frames_2::fifth - 4: short_ice_remove_middle_frames_2::fourth::{{closure}} - [... omitted 4 frames ...] - 5: short_ice_remove_middle_frames_2::first - 6: short_ice_remove_middle_frames_2::main - 7: core::ops::function::FnOnce::call_once + [... omitted N frames ...] + 0: short_ice_remove_middle_frames_2::eight + 1: short_ice_remove_middle_frames_2::seven::{{closure}} + [... omitted 5 frames ...] + 2: short_ice_remove_middle_frames_2::fifth + 3: short_ice_remove_middle_frames_2::fourth::{{closure}} + [... omitted 6 frames ...] + 4: short_ice_remove_middle_frames_2::first + 5: short_ice_remove_middle_frames_2::main + 6: core::ops::function::FnOnce::call_once + [... omitted N frames ...] note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. From f6e1906cd20f02639cdccfb186da2e96849a1d0f Mon Sep 17 00:00:00 2001 From: jyn Date: Mon, 20 Jan 2025 17:17:24 -0500 Subject: [PATCH 16/18] fixup! more improvements --- .../backtrace/short-backtrace-attr-errors.rs | 33 +++++++++++++++++++ .../short-backtrace-attr-errors.stderr | 27 +++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 tests/ui/backtrace/short-backtrace-attr-errors.rs create mode 100644 tests/ui/backtrace/short-backtrace-attr-errors.stderr diff --git a/tests/ui/backtrace/short-backtrace-attr-errors.rs b/tests/ui/backtrace/short-backtrace-attr-errors.rs new file mode 100644 index 0000000000000..05092e8db18d1 --- /dev/null +++ b/tests/ui/backtrace/short-backtrace-attr-errors.rs @@ -0,0 +1,33 @@ +//@ compile-flags:--crate-type=lib +#![feature(rustc_attrs)] + +#[inline] //~ ERROR invalid argument +#[rustc_start_short_backtrace] +fn foo() {} + +#[inline] //~ ERROR invalid argument +#[rustc_end_short_backtrace] +fn bar() {} + +#[inline(always)] //~ ERROR invalid argument +#[rustc_start_short_backtrace] +fn baz() {} + +// ok +#[inline(never)] +#[rustc_start_short_backtrace] +fn meow() {} + +// ok +#[rustc_start_short_backtrace] +fn mrrrp() {} + +// ok +#[inline(always)] +#[rustc_skip_short_backtrace] +fn awawa() {} + +// ok +#[inline] +#[rustc_skip_short_backtrace] +fn owo() {} diff --git a/tests/ui/backtrace/short-backtrace-attr-errors.stderr b/tests/ui/backtrace/short-backtrace-attr-errors.stderr new file mode 100644 index 0000000000000..679172a2127e3 --- /dev/null +++ b/tests/ui/backtrace/short-backtrace-attr-errors.stderr @@ -0,0 +1,27 @@ +error[E0535]: invalid argument + --> $DIR/short-backtrace-attr-errors.rs:4:1 + | +LL | #[inline] + | ^^^^^^^^^ + | + = note: `#[rustc_{start,end}_short_backtrace]` functions must always be `#[inline(never)]` + +error[E0535]: invalid argument + --> $DIR/short-backtrace-attr-errors.rs:8:1 + | +LL | #[inline] + | ^^^^^^^^^ + | + = note: `#[rustc_{start,end}_short_backtrace]` functions must always be `#[inline(never)]` + +error[E0535]: invalid argument + --> $DIR/short-backtrace-attr-errors.rs:12:1 + | +LL | #[inline(always)] + | ^^^^^^^^^^^^^^^^^ + | + = note: `#[rustc_{start,end}_short_backtrace]` functions must always be `#[inline(never)]` + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0535`. From eee5a51c44e1a8c491ddeabdaadcd471b550d695 Mon Sep 17 00:00:00 2001 From: jyn Date: Mon, 20 Jan 2025 17:48:01 -0500 Subject: [PATCH 17/18] fix noop compiling --- library/backtrace | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/backtrace b/library/backtrace index 221892458b9d8..525b1a1629686 160000 --- a/library/backtrace +++ b/library/backtrace @@ -1 +1 @@ -Subproject commit 221892458b9d83e6180235d8b48b1aeb63651e8f +Subproject commit 525b1a1629686e963c142da0fb8ac386ce0c62aa From cc46d568f3abc21edc6500efcfa611696c4884dd Mon Sep 17 00:00:00 2001 From: jyn Date: Tue, 21 Jan 2025 09:37:41 -0500 Subject: [PATCH 18/18] wip --- library/backtrace | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/backtrace b/library/backtrace index 525b1a1629686..56c6f1a22de79 160000 --- a/library/backtrace +++ b/library/backtrace @@ -1 +1 @@ -Subproject commit 525b1a1629686e963c142da0fb8ac386ce0c62aa +Subproject commit 56c6f1a22de79f52fb48e62a75b430415742d272