Skip to content

Commit 7782a2b

Browse files
committed
Remove now-redundant file/line info from const backtraces
1 parent 10b75cb commit 7782a2b

File tree

388 files changed

+911
-923
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

388 files changed

+911
-923
lines changed

compiler/rustc_const_eval/src/interpret/eval_context.rs

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use rustc_middle::ty::{
1717
};
1818
use rustc_mir_dataflow::storage::always_storage_live_locals;
1919
use rustc_session::Limit;
20-
use rustc_span::{Pos, Span};
20+
use rustc_span::Span;
2121
use rustc_target::abi::{call::FnAbi, Align, HasDataLayout, Size, TargetDataLayout};
2222

2323
use super::{
@@ -256,25 +256,13 @@ impl<'tcx> fmt::Display for FrameInfo<'tcx> {
256256
if tcx.def_key(self.instance.def_id()).disambiguated_data.data
257257
== DefPathData::ClosureExpr
258258
{
259-
write!(f, "inside closure")?;
259+
write!(f, "inside closure")
260260
} else {
261261
// Note: this triggers a `good_path_bug` state, which means that if we ever get here
262262
// we must emit a diagnostic. We should never display a `FrameInfo` unless we
263263
// actually want to emit a warning or error to the user.
264-
write!(f, "inside `{}`", self.instance)?;
264+
write!(f, "inside `{}`", self.instance)
265265
}
266-
if !self.span.is_dummy() {
267-
let sm = tcx.sess.source_map();
268-
let lo = sm.lookup_char_pos(self.span.lo());
269-
write!(
270-
f,
271-
" at {}:{}:{}",
272-
sm.filename_for_diagnostics(&lo.file.name),
273-
lo.line,
274-
lo.col.to_usize() + 1
275-
)?;
276-
}
277-
Ok(())
278266
})
279267
}
280268
}

src/test/ui/borrowck/issue-81899.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ error[E0080]: evaluation of constant value failed
22
--> $DIR/issue-81899.rs:11:5
33
|
44
LL | const _CONST: &[u8] = &f(&[], |_| {});
5-
| -------------- inside `_CONST` at $DIR/issue-81899.rs:4:24
5+
| -------------- inside `_CONST`
66
...
77
LL | panic!()
88
| ^^^^^^^^
99
| |
1010
| the evaluated program panicked at 'explicit panic', $DIR/issue-81899.rs:11:5
11-
| inside `f::<[closure@$DIR/issue-81899.rs:4:31: 4:34]>` at $SRC_DIR/std/src/panic.rs:LL:COL
11+
| inside `f::<[closure@$DIR/issue-81899.rs:4:31: 4:34]>`
1212
|
1313
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
1414

src/test/ui/borrowck/issue-88434-minimal-example.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ error[E0080]: evaluation of constant value failed
22
--> $DIR/issue-88434-minimal-example.rs:10:5
33
|
44
LL | const _CONST: &() = &f(&|_| {});
5-
| ---------- inside `_CONST` at $DIR/issue-88434-minimal-example.rs:3:22
5+
| ---------- inside `_CONST`
66
...
77
LL | panic!()
88
| ^^^^^^^^
99
| |
1010
| the evaluated program panicked at 'explicit panic', $DIR/issue-88434-minimal-example.rs:10:5
11-
| inside `f::<[closure@$DIR/issue-88434-minimal-example.rs:3:25: 3:28]>` at $SRC_DIR/std/src/panic.rs:LL:COL
11+
| inside `f::<[closure@$DIR/issue-88434-minimal-example.rs:3:25: 3:28]>`
1212
|
1313
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
1414

src/test/ui/borrowck/issue-88434-removal-index-should-be-less.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ error[E0080]: evaluation of constant value failed
22
--> $DIR/issue-88434-removal-index-should-be-less.rs:10:5
33
|
44
LL | const _CONST: &[u8] = &f(&[], |_| {});
5-
| -------------- inside `_CONST` at $DIR/issue-88434-removal-index-should-be-less.rs:3:24
5+
| -------------- inside `_CONST`
66
...
77
LL | panic!()
88
| ^^^^^^^^
99
| |
1010
| the evaluated program panicked at 'explicit panic', $DIR/issue-88434-removal-index-should-be-less.rs:10:5
11-
| inside `f::<[closure@$DIR/issue-88434-removal-index-should-be-less.rs:3:31: 3:34]>` at $SRC_DIR/std/src/panic.rs:LL:COL
11+
| inside `f::<[closure@$DIR/issue-88434-removal-index-should-be-less.rs:3:31: 3:34]>`
1212
|
1313
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
1414

src/test/ui/const-generics/generic_const_exprs/issue-80742.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ LL | intrinsics::size_of::<T>()
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
66
| |
77
| size_of called on unsized type `dyn Debug`
8-
| inside `std::mem::size_of::<dyn Debug>` at $SRC_DIR/core/src/mem/mod.rs:LL:COL
8+
| inside `std::mem::size_of::<dyn Debug>`
99
|
1010
::: $DIR/issue-80742.rs:22:10
1111
|
1212
LL | [u8; size_of::<T>() + 1]: ,
13-
| -------------- inside `Inline::<dyn Debug>::{constant#0}` at $DIR/issue-80742.rs:22:10
13+
| -------------- inside `Inline::<dyn Debug>::{constant#0}`
1414

1515
error[E0599]: the function or associated item `new` exists for struct `Inline<dyn Debug>`, but its trait bounds were not satisfied
1616
--> $DIR/issue-80742.rs:30:36
@@ -36,12 +36,12 @@ LL | intrinsics::size_of::<T>()
3636
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
3737
| |
3838
| size_of called on unsized type `dyn Debug`
39-
| inside `std::mem::size_of::<dyn Debug>` at $SRC_DIR/core/src/mem/mod.rs:LL:COL
39+
| inside `std::mem::size_of::<dyn Debug>`
4040
|
4141
::: $DIR/issue-80742.rs:14:10
4242
|
4343
LL | [u8; size_of::<T>() + 1]: ,
44-
| -------------- inside `Inline::<dyn Debug>::{constant#0}` at $DIR/issue-80742.rs:14:10
44+
| -------------- inside `Inline::<dyn Debug>::{constant#0}`
4545

4646
error[E0277]: the size for values of type `dyn Debug` cannot be known at compilation time
4747
--> $DIR/issue-80742.rs:30:15

src/test/ui/const-generics/issues/issue-100313.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ LL | *(B as *const bool as *mut bool) = false;
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
| |
77
| writing to alloc7 which is read-only
8-
| inside `T::<&true>::set_false` at $DIR/issue-100313.rs:10:13
8+
| inside `T::<&true>::set_false`
99
...
1010
LL | x.set_false();
11-
| ------------- inside `_` at $DIR/issue-100313.rs:18:5
11+
| ------------- inside `_`
1212

1313
error: aborting due to previous error
1414

src/test/ui/const-ptr/forbidden_slices.32bit.stderr

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ LL | &*ptr::slice_from_raw_parts(data, len)
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
| |
77
| dereferencing pointer failed: null pointer is a dangling pointer (it has no provenance)
8-
| inside `std::slice::from_raw_parts::<'_, u32>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL
8+
| inside `std::slice::from_raw_parts::<'_, u32>`
99
|
1010
::: $DIR/forbidden_slices.rs:18:34
1111
|
1212
LL | pub static S0: &[u32] = unsafe { from_raw_parts(ptr::null(), 0) };
13-
| ------------------------------ inside `S0` at $DIR/forbidden_slices.rs:18:34
13+
| ------------------------------ inside `S0`
1414

1515
error[E0080]: could not evaluate static initializer
1616
--> $SRC_DIR/core/src/slice/raw.rs:LL:COL
@@ -19,12 +19,12 @@ LL | &*ptr::slice_from_raw_parts(data, len)
1919
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2020
| |
2121
| dereferencing pointer failed: null pointer is a dangling pointer (it has no provenance)
22-
| inside `std::slice::from_raw_parts::<'_, ()>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL
22+
| inside `std::slice::from_raw_parts::<'_, ()>`
2323
|
2424
::: $DIR/forbidden_slices.rs:19:33
2525
|
2626
LL | pub static S1: &[()] = unsafe { from_raw_parts(ptr::null(), 0) };
27-
| ------------------------------ inside `S1` at $DIR/forbidden_slices.rs:19:33
27+
| ------------------------------ inside `S1`
2828

2929
error[E0080]: could not evaluate static initializer
3030
--> $SRC_DIR/core/src/slice/raw.rs:LL:COL
@@ -33,12 +33,12 @@ LL | &*ptr::slice_from_raw_parts(data, len)
3333
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3434
| |
3535
| dereferencing pointer failed: ALLOC_ID has size 4, so pointer to 8 bytes starting at offset 0 is out-of-bounds
36-
| inside `std::slice::from_raw_parts::<'_, u32>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL
36+
| inside `std::slice::from_raw_parts::<'_, u32>`
3737
|
3838
::: $DIR/forbidden_slices.rs:22:34
3939
|
4040
LL | pub static S2: &[u32] = unsafe { from_raw_parts(&D0, 2) };
41-
| ---------------------- inside `S2` at $DIR/forbidden_slices.rs:22:34
41+
| ---------------------- inside `S2`
4242

4343
error[E0080]: it is undefined behavior to use this value
4444
--> $DIR/forbidden_slices.rs:25:1
@@ -92,12 +92,12 @@ LL | &*ptr::slice_from_raw_parts(data, len)
9292
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
9393
| |
9494
| dereferencing pointer failed: ALLOC_ID has size 8, so pointer to 8 bytes starting at offset 1 is out-of-bounds
95-
| inside `std::slice::from_raw_parts::<'_, u64>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL
95+
| inside `std::slice::from_raw_parts::<'_, u64>`
9696
|
9797
::: $DIR/forbidden_slices.rs:43:5
9898
|
9999
LL | from_raw_parts(ptr, 1)
100-
| ---------------------- inside `S8` at $DIR/forbidden_slices.rs:43:5
100+
| ---------------------- inside `S8`
101101

102102
error[E0080]: could not evaluate static initializer
103103
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
@@ -106,17 +106,17 @@ LL | unsafe { intrinsics::ptr_offset_from_unsigned(self, origin) }
106106
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
107107
| |
108108
| out-of-bounds offset_from: null pointer is a dangling pointer (it has no provenance)
109-
| inside `ptr::const_ptr::<impl *const u32>::sub_ptr` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
109+
| inside `ptr::const_ptr::<impl *const u32>::sub_ptr`
110110
|
111111
::: $SRC_DIR/core/src/slice/raw.rs:LL:COL
112112
|
113113
LL | unsafe { from_raw_parts(range.start, range.end.sub_ptr(range.start)) }
114-
| ------------------------------ inside `from_ptr_range::<'_, u32>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL
114+
| ------------------------------ inside `from_ptr_range::<'_, u32>`
115115
|
116116
::: $DIR/forbidden_slices.rs:46:34
117117
|
118118
LL | pub static R0: &[u32] = unsafe { from_ptr_range(ptr::null()..ptr::null()) };
119-
| ---------------------------------------- inside `R0` at $DIR/forbidden_slices.rs:46:34
119+
| ---------------------------------------- inside `R0`
120120

121121
error[E0080]: could not evaluate static initializer
122122
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
@@ -125,17 +125,17 @@ LL | assert!(0 < pointee_size && pointee_size <= isize::MAX as usize);
125125
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
126126
| |
127127
| the evaluated program panicked at 'assertion failed: 0 < pointee_size && pointee_size <= isize::MAX as usize', $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
128-
| inside `ptr::const_ptr::<impl *const ()>::sub_ptr` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
128+
| inside `ptr::const_ptr::<impl *const ()>::sub_ptr`
129129
|
130130
::: $SRC_DIR/core/src/slice/raw.rs:LL:COL
131131
|
132132
LL | unsafe { from_raw_parts(range.start, range.end.sub_ptr(range.start)) }
133-
| ------------------------------ inside `from_ptr_range::<'_, ()>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL
133+
| ------------------------------ inside `from_ptr_range::<'_, ()>`
134134
|
135135
::: $DIR/forbidden_slices.rs:47:33
136136
|
137137
LL | pub static R1: &[()] = unsafe { from_ptr_range(ptr::null()..ptr::null()) };
138-
| ---------------------------------------- inside `R1` at $DIR/forbidden_slices.rs:47:33
138+
| ---------------------------------------- inside `R1`
139139
|
140140
= note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
141141

@@ -146,15 +146,15 @@ LL | unsafe { intrinsics::offset(self, count) }
146146
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
147147
| |
148148
| out-of-bounds pointer arithmetic: ALLOC_ID has size 4, so pointer to 8 bytes starting at offset 0 is out-of-bounds
149-
| inside `ptr::const_ptr::<impl *const u32>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
149+
| inside `ptr::const_ptr::<impl *const u32>::offset`
150150
...
151151
LL | unsafe { self.offset(count as isize) }
152-
| --------------------------- inside `ptr::const_ptr::<impl *const u32>::add` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
152+
| --------------------------- inside `ptr::const_ptr::<impl *const u32>::add`
153153
|
154154
::: $DIR/forbidden_slices.rs:50:25
155155
|
156156
LL | from_ptr_range(ptr..ptr.add(2))
157-
| ---------- inside `R2` at $DIR/forbidden_slices.rs:50:25
157+
| ---------- inside `R2`
158158

159159
error[E0080]: it is undefined behavior to use this value
160160
--> $DIR/forbidden_slices.rs:52:1
@@ -208,15 +208,15 @@ LL | unsafe { intrinsics::offset(self, count) }
208208
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
209209
| |
210210
| out-of-bounds pointer arithmetic: ALLOC_ID has size 8, so pointer to 8 bytes starting at offset 1 is out-of-bounds
211-
| inside `ptr::const_ptr::<impl *const u64>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
211+
| inside `ptr::const_ptr::<impl *const u64>::offset`
212212
...
213213
LL | unsafe { self.offset(count as isize) }
214-
| --------------------------- inside `ptr::const_ptr::<impl *const u64>::add` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
214+
| --------------------------- inside `ptr::const_ptr::<impl *const u64>::add`
215215
|
216216
::: $DIR/forbidden_slices.rs:74:25
217217
|
218218
LL | from_ptr_range(ptr..ptr.add(1))
219-
| ---------- inside `R8` at $DIR/forbidden_slices.rs:74:25
219+
| ---------- inside `R8`
220220

221221
error[E0080]: could not evaluate static initializer
222222
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
@@ -225,17 +225,17 @@ LL | unsafe { intrinsics::ptr_offset_from_unsigned(self, origin) }
225225
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
226226
| |
227227
| `ptr_offset_from_unsigned` called on pointers into different allocations
228-
| inside `ptr::const_ptr::<impl *const u32>::sub_ptr` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
228+
| inside `ptr::const_ptr::<impl *const u32>::sub_ptr`
229229
|
230230
::: $SRC_DIR/core/src/slice/raw.rs:LL:COL
231231
|
232232
LL | unsafe { from_raw_parts(range.start, range.end.sub_ptr(range.start)) }
233-
| ------------------------------ inside `from_ptr_range::<'_, u32>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL
233+
| ------------------------------ inside `from_ptr_range::<'_, u32>`
234234
|
235235
::: $DIR/forbidden_slices.rs:79:34
236236
|
237237
LL | pub static R9: &[u32] = unsafe { from_ptr_range(&D0..(&D0 as *const u32).add(1)) };
238-
| ----------------------------------------------- inside `R9` at $DIR/forbidden_slices.rs:79:34
238+
| ----------------------------------------------- inside `R9`
239239

240240
error[E0080]: could not evaluate static initializer
241241
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
@@ -244,17 +244,17 @@ LL | unsafe { intrinsics::ptr_offset_from_unsigned(self, origin) }
244244
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
245245
| |
246246
| `ptr_offset_from_unsigned` called on pointers into different allocations
247-
| inside `ptr::const_ptr::<impl *const u32>::sub_ptr` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
247+
| inside `ptr::const_ptr::<impl *const u32>::sub_ptr`
248248
|
249249
::: $SRC_DIR/core/src/slice/raw.rs:LL:COL
250250
|
251251
LL | unsafe { from_raw_parts(range.start, range.end.sub_ptr(range.start)) }
252-
| ------------------------------ inside `from_ptr_range::<'_, u32>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL
252+
| ------------------------------ inside `from_ptr_range::<'_, u32>`
253253
|
254254
::: $DIR/forbidden_slices.rs:80:35
255255
|
256256
LL | pub static R10: &[u32] = unsafe { from_ptr_range(&D0..&D0) };
257-
| ------------------------ inside `R10` at $DIR/forbidden_slices.rs:80:35
257+
| ------------------------ inside `R10`
258258

259259
error: aborting due to 18 previous errors
260260

0 commit comments

Comments
 (0)