mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-17 01:13:11 +00:00
const backtrace: do not skip first frame
This commit is contained in:
parent
ad74480cb2
commit
96deb950ac
@ -167,10 +167,11 @@ impl<'tcx> ConstEvalErr<'tcx> {
|
||||
if let Some(span_msg) = span_msg {
|
||||
err.span_label(self.span, span_msg);
|
||||
}
|
||||
// Add spans for the stacktrace.
|
||||
// Skip the first, which is the place of the error.
|
||||
for frame_info in self.stacktrace.iter().skip(1) {
|
||||
err.span_label(frame_info.span, frame_info.to_string());
|
||||
// Add spans for the stacktrace. Don't print a single-line backtrace though.
|
||||
if self.stacktrace.len() > 1 {
|
||||
for frame_info in &self.stacktrace {
|
||||
err.span_label(frame_info.span, frame_info.to_string());
|
||||
}
|
||||
}
|
||||
// Let the caller finish the job.
|
||||
emit(err)
|
||||
|
@ -5,6 +5,7 @@ LL | unsafe { std::mem::transmute(()) }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| |
|
||||
| transmuting to uninhabited type
|
||||
| inside `foo` at $DIR/validate_uninhabited_zsts.rs:5:14
|
||||
| inside `FOO` at $DIR/validate_uninhabited_zsts.rs:14:26
|
||||
...
|
||||
LL | const FOO: [Empty; 3] = [foo(); 3];
|
||||
|
@ -17,6 +17,7 @@ LL | my_fn();
|
||||
| ^^^^^^^
|
||||
| |
|
||||
| calling a function with ABI C using caller ABI Rust
|
||||
| inside `call_rust_fn` at $DIR/abi-mismatch.rs:9:5
|
||||
| inside `VAL` at $DIR/abi-mismatch.rs:13:17
|
||||
...
|
||||
LL | const VAL: () = call_rust_fn(unsafe { std::mem::transmute(c_fn as extern "C" fn()) });
|
||||
|
@ -12,7 +12,10 @@ LL | | // Code here does not matter - this is replaced by the
|
||||
LL | | // real drop glue by the compiler.
|
||||
LL | | drop_in_place(to_drop)
|
||||
LL | | }
|
||||
| |_^ calling non-const function `<std::vec::Vec<i32> as std::ops::Drop>::drop`
|
||||
| | ^
|
||||
| | |
|
||||
| |_calling non-const function `<std::vec::Vec<i32> as std::ops::Drop>::drop`
|
||||
| inside `std::intrinsics::drop_in_place::<std::vec::Vec<i32>> - shim(Some(std::vec::Vec<i32>))` at $SRC_DIR/libcore/ptr/mod.rs:LL:COL
|
||||
|
|
||||
::: $DIR/drop.rs:23:1
|
||||
|
|
||||
|
@ -5,6 +5,7 @@ LL | intrinsics::ptr_offset_from(self, origin)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| |
|
||||
| ptr_offset_from cannot compute offset of pointers into different allocations.
|
||||
| inside `std::ptr::const_ptr::<impl *const Struct>::offset_from` at $SRC_DIR/libcore/ptr/const_ptr.rs:LL:COL
|
||||
| inside `DIFFERENT_ALLOC` at $DIR/offset_from_ub.rs:22:27
|
||||
|
|
||||
::: $DIR/offset_from_ub.rs:16:1
|
||||
@ -27,6 +28,7 @@ LL | intrinsics::ptr_offset_from(self, origin)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| |
|
||||
| unable to turn bytes into a pointer
|
||||
| inside `std::ptr::const_ptr::<impl *const u8>::offset_from` at $SRC_DIR/libcore/ptr/const_ptr.rs:LL:COL
|
||||
| inside `NOT_PTR` at $DIR/offset_from_ub.rs:28:14
|
||||
|
|
||||
::: $DIR/offset_from_ub.rs:26:1
|
||||
@ -44,6 +46,7 @@ LL | intrinsics::ptr_offset_from(self, origin)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| |
|
||||
| exact_div: 1isize cannot be divided by 2isize without remainder
|
||||
| inside `std::ptr::const_ptr::<impl *const u16>::offset_from` at $SRC_DIR/libcore/ptr/const_ptr.rs:LL:COL
|
||||
| inside `NOT_MULTIPLE_OF_SIZE` at $DIR/offset_from_ub.rs:36:14
|
||||
|
|
||||
::: $DIR/offset_from_ub.rs:31:1
|
||||
@ -64,6 +67,7 @@ LL | intrinsics::ptr_offset_from(self, origin)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| |
|
||||
| invalid use of NULL pointer
|
||||
| inside `std::ptr::const_ptr::<impl *const u8>::offset_from` at $SRC_DIR/libcore/ptr/const_ptr.rs:LL:COL
|
||||
| inside `OFFSET_FROM_NULL` at $DIR/offset_from_ub.rs:42:14
|
||||
|
|
||||
::: $DIR/offset_from_ub.rs:39:1
|
||||
@ -82,6 +86,7 @@ LL | intrinsics::ptr_offset_from(self, origin)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| |
|
||||
| unable to turn bytes into a pointer
|
||||
| inside `std::ptr::const_ptr::<impl *const u8>::offset_from` at $SRC_DIR/libcore/ptr/const_ptr.rs:LL:COL
|
||||
| inside `DIFFERENT_INT` at $DIR/offset_from_ub.rs:49:14
|
||||
|
|
||||
::: $DIR/offset_from_ub.rs:45:1
|
||||
|
@ -67,6 +67,7 @@ LL | hint_unreachable()
|
||||
| inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
|
||||
| inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
|
||||
| inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
|
||||
| inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
|
||||
| inside `fake_type::<i32>` at $DIR/uninhabited-const-issue-61744.rs:4:5
|
||||
...
|
||||
LL | fake_type()
|
||||
|
Loading…
Reference in New Issue
Block a user