Skip to content

Commit 64c470f

Browse files
committed
Auto merge of rust-lang#129642 - workingjubilee:bump-backtrace-fc37b22, r=<try>
Bump backtrace to rust-lang/backtrace-rs@fc37b22 It should be 0.3.74~ish. This should help with backtraces on Android, QNX NTO 7.0, and Windows. try-job: arm-android
2 parents 600edc9 + 8919cb4 commit 64c470f

8 files changed

+25
-6
lines changed

compiler/rustc_codegen_ssa/src/mir/block.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -790,13 +790,15 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
790790
let (fn_abi, llfn, instance) =
791791
common::build_langcall(bx, Some(source_info.span), LangItem::PanicNounwind);
792792

793+
let location = self.get_caller_location(bx, source_info).immediate();
794+
793795
// Codegen the actual panic invoke/call.
794796
helper.do_call(
795797
self,
796798
bx,
797799
fn_abi,
798800
llfn,
799-
&[msg.0, msg.1],
801+
&[msg.0, msg.1, location],
800802
target.as_ref().map(|bb| (ReturnDest::Nothing, *bb)),
801803
unwind,
802804
&[],

compiler/rustc_codegen_ssa/src/size_of_val.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,20 @@ pub fn size_and_align_of_dst<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
7272
// (But we are in good company, this code is duplicated plenty of times.)
7373
let fn_ty = bx.fn_decl_backend_type(fn_abi);
7474

75+
let const_loc = bx.tcx().span_as_caller_location(rustc_span::DUMMY_SP);
76+
let location = crate::mir::operand::OperandRef::from_const(
77+
bx,
78+
const_loc,
79+
bx.tcx().caller_location_ty(),
80+
)
81+
.immediate();
82+
7583
bx.call(
7684
fn_ty,
7785
/* fn_attrs */ None,
7886
Some(fn_abi),
7987
llfn,
80-
&[msg.0, msg.1],
88+
&[msg.0, msg.1, location],
8189
None,
8290
None,
8391
);

library/core/src/panicking.rs

+2
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ panic_const! {
212212

213213
/// Like `panic`, but without unwinding and track_caller to reduce the impact on codesize on the caller.
214214
/// If you want `#[track_caller]` for nicer errors, call `panic_nounwind_fmt` directly.
215+
#[track_caller]
215216
#[cfg_attr(not(feature = "panic_immediate_abort"), inline(never), cold)]
216217
#[cfg_attr(feature = "panic_immediate_abort", inline)]
217218
#[lang = "panic_nounwind"] // needed by codegen for non-unwinding panics
@@ -222,6 +223,7 @@ pub const fn panic_nounwind(expr: &'static str) -> ! {
222223
}
223224

224225
/// Like `panic_nounwind`, but also inhibits showing a backtrace.
226+
#[track_caller]
225227
#[cfg_attr(not(feature = "panic_immediate_abort"), inline(never), cold)]
226228
#[cfg_attr(feature = "panic_immediate_abort", inline)]
227229
#[rustc_nounwind]

library/core/src/ub_checks.rs

+7
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ macro_rules! assert_unsafe_precondition {
6565
#[inline]
6666
#[rustc_nounwind]
6767
#[rustc_const_unstable(feature = "const_ub_checks", issue = "none")]
68+
#[track_caller]
6869
const fn precondition_check($($name:$ty),*) {
6970
if !$e {
7071
::core::panicking::panic_nounwind(
@@ -92,8 +93,10 @@ pub use intrinsics::ub_checks as check_library_ub;
9293
/// language UB checks which generally produce better errors.
9394
#[rustc_const_unstable(feature = "const_ub_checks", issue = "none")]
9495
#[inline]
96+
#[track_caller]
9597
pub(crate) const fn check_language_ub() -> bool {
9698
#[inline]
99+
#[track_caller]
97100
fn runtime() -> bool {
98101
// Disable UB checks in Miri.
99102
!cfg!(miri)
@@ -116,11 +119,13 @@ pub(crate) const fn check_language_ub() -> bool {
116119
/// for `assert_unsafe_precondition!` with `check_language_ub`, in which case the
117120
/// check is anyway not executed in `const`.
118121
#[inline]
122+
#[track_caller]
119123
pub(crate) const fn is_aligned_and_not_null(ptr: *const (), align: usize) -> bool {
120124
!ptr.is_null() && ptr.is_aligned_to(align)
121125
}
122126

123127
#[inline]
128+
#[track_caller]
124129
pub(crate) const fn is_valid_allocation_size(size: usize, len: usize) -> bool {
125130
let max_len = if size == 0 { usize::MAX } else { isize::MAX as usize / size };
126131
len <= max_len
@@ -132,13 +137,15 @@ pub(crate) const fn is_valid_allocation_size(size: usize, len: usize) -> bool {
132137
/// Note that in const-eval this function just returns `true` and therefore must
133138
/// only be used with `assert_unsafe_precondition!`, similar to `is_aligned_and_not_null`.
134139
#[inline]
140+
#[track_caller]
135141
pub(crate) const fn is_nonoverlapping(
136142
src: *const (),
137143
dst: *const (),
138144
size: usize,
139145
count: usize,
140146
) -> bool {
141147
#[inline]
148+
#[track_caller]
142149
fn runtime(src: *const (), dst: *const (), size: usize, count: usize) -> bool {
143150
let src_usize = src.addr();
144151
let dst_usize = dst.addr();
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
thread 'main' panicked at core/src/panicking.rs:$LINE:$COL:
1+
thread 'main' panicked at $DIR/extern-types-field-offset.rs:1:1:
22
attempted to compute the size or alignment of extern type `Opaque`
33
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
44
thread caused non-unwinding panic. aborting.
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
thread 'main' panicked at core/src/panicking.rs:$LINE:$COL:
1+
thread 'main' panicked at $DIR/extern-types-size_of_val.rs:1:1:
22
attempted to compute the size or alignment of extern type `A`
33
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
44
thread caused non-unwinding panic. aborting.
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
thread 'main' panicked at core/src/panicking.rs:$LINE:$COL:
1+
thread 'main' panicked at $DIR/extern-types-size_of_val.rs:1:1:
22
attempted to compute the size or alignment of extern type `A`
33
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
44
thread caused non-unwinding panic. aborting.

0 commit comments

Comments
 (0)