forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#96576 - oli-obk:post_monomorphization_error_b…
…acktrace, r=lqd Also report the call site of PME errors locally. Note this does not produce a full stack all the way to the first call that specifies all monomorphic parameters, it's just shallowly mentioning the last call site. previous work: rust-lang#85633 tracking issue: rust-lang#85155 r? `@lqd` I figured we could get some improvement for traces in local crates without going into the backtrace hell you landed in last time
- Loading branch information
Showing
7 changed files
with
98 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/test/ui/generics/post_monomorphization_error_backtrace.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// build-fail | ||
|
||
fn assert_zst<T>() { | ||
struct F<T>(T); | ||
impl<T> F<T> { | ||
const V: () = assert!(std::mem::size_of::<T>() == 0); | ||
//~^ ERROR: evaluation of `assert_zst::F::<u32>::V` failed [E0080] | ||
//~| NOTE: in this expansion of assert! | ||
//~| NOTE: the evaluated program panicked | ||
//~| ERROR: evaluation of `assert_zst::F::<i32>::V` failed [E0080] | ||
//~| NOTE: in this expansion of assert! | ||
//~| NOTE: the evaluated program panicked | ||
} | ||
let _ = F::<T>::V; | ||
} | ||
|
||
fn foo<U>() { | ||
assert_zst::<U>() | ||
//~^ NOTE: the above error was encountered while instantiating `fn assert_zst::<u32>` | ||
//~| NOTE: the above error was encountered while instantiating `fn assert_zst::<i32>` | ||
} | ||
|
||
|
||
fn bar<V>() { | ||
foo::<V>() | ||
} | ||
|
||
fn main() { | ||
bar::<()>(); | ||
bar::<u32>(); | ||
bar::<u32>(); | ||
bar::<i32>(); | ||
} |
31 changes: 31 additions & 0 deletions
31
src/test/ui/generics/post_monomorphization_error_backtrace.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
error[E0080]: evaluation of `assert_zst::F::<u32>::V` failed | ||
--> $DIR/post_monomorphization_error_backtrace.rs:6:23 | ||
| | ||
LL | const V: () = assert!(std::mem::size_of::<T>() == 0); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'assertion failed: std::mem::size_of::<T>() == 0', $DIR/post_monomorphization_error_backtrace.rs:6:23 | ||
| | ||
= note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
note: the above error was encountered while instantiating `fn assert_zst::<u32>` | ||
--> $DIR/post_monomorphization_error_backtrace.rs:18:5 | ||
| | ||
LL | assert_zst::<U>() | ||
| ^^^^^^^^^^^^^^^^^ | ||
|
||
error[E0080]: evaluation of `assert_zst::F::<i32>::V` failed | ||
--> $DIR/post_monomorphization_error_backtrace.rs:6:23 | ||
| | ||
LL | const V: () = assert!(std::mem::size_of::<T>() == 0); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'assertion failed: std::mem::size_of::<T>() == 0', $DIR/post_monomorphization_error_backtrace.rs:6:23 | ||
| | ||
= note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
note: the above error was encountered while instantiating `fn assert_zst::<i32>` | ||
--> $DIR/post_monomorphization_error_backtrace.rs:18:5 | ||
| | ||
LL | assert_zst::<U>() | ||
| ^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0080`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters