rust/compiler
Michael Goulet d798e228ea
Rollup merge of #106317 - compiler-errors:restore-the-backtraces, r=jyn514
Only deduplicate stack traces for good path bugs

Fixes #106267

Restores backtraces for `bug!` and `delay_span_bug` after #106056. Only `delay_good_path_bug` needed its backtraces to be deduplicated, since it spits out the backtrace where it was created when it's being emitted.

Before:

```
error: internal compiler error: /home/ubuntu/rust2/compiler/rustc_middle/src/ty/relate.rs:638:13: var types encountered in super_relate_consts: Const { ty: usize, kind: Infer(Var(_#0c)) } Const { ty: usize, kind: Param(N/#1) }

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.68.0-dev running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [typeck] type-checking `<impl at /home/ubuntu/test.rs:7:1: 7:34>::trigger`
#1 [typeck_item_bodies] type-checking all item bodies
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 2 previous errors
```

Hmm... that's a little bare.

After:

```
error: internal compiler error: /home/ubuntu/rust2/compiler/rustc_middle/src/ty/relate.rs:638:13: var types encountered in super_relate_consts: Const { ty: usize, kind: Infer(Var(_#0c)) } Const { ty: usize, kind: Param(N/#1) }

thread 'rustc' panicked at 'Box<dyn Any>', /home/ubuntu/rust2/compiler/rustc_errors/src/lib.rs:1599:9
stack backtrace:
   0:     0x7ffb5b41bdd1 - std::backtrace_rs::backtrace::libunwind::trace::h26056f81198c6594
                               at /home/ubuntu/rust2/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7ffb5b41bdd1 - std::backtrace_rs::backtrace::trace_unsynchronized::hacfb345a0c6d5bb1
                               at /home/ubuntu/rust2/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7ffb5b41bdd1 - std::sys_common::backtrace::_print_fmt::h18ea6016ac8030f3
                               at /home/ubuntu/rust2/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7ffb5b41bdd1 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::he35dde201d0c2d09
                               at /home/ubuntu/rust2/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7ffb5b4a0308 - core::fmt::write::h094ad263467a053c
                               at /home/ubuntu/rust2/library/core/src/fmt/mod.rs:1208:17
   5:     0x7ffb5b43caf1 - std::io::Write::write_fmt::hd47b4e2324b4d9b7
                               at /home/ubuntu/rust2/library/std/src/io/mod.rs:1682:15
   6:     0x7ffb5b41bbfa - std::sys_common::backtrace::_print::h43044162653a17fc
                               at /home/ubuntu/rust2/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7ffb5b41bbfa - std::sys_common::backtrace::print::hc8605da258fa5aeb
                               at /home/ubuntu/rust2/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7ffb5b3ffb87 - std::panicking::default_hook::{{closure}}::h9e37f23f75122a15
   9:     0x7ffb5b3ff97b - std::panicking::default_hook::h602873a063f84da2
                               at /home/ubuntu/rust2/library/std/src/panicking.rs:286:9
  10:     0x7ffb5be192b2 - <alloc[48d7b30605060536]::boxed::Box<dyn for<'a, 'b> core[672e3947e150d6c6]::ops::function::Fn<(&'a core[672e3947e150d6c6]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[672e3947e150d6c6]::marker::Send + core[672e3947e150d6c6]::marker::Sync> as core[672e3947e150d6c6]::ops::function::Fn<(&core[672e3947e150d6c6]::panic::panic_info::PanicInfo,)>>::call
                               at /home/ubuntu/rust2/library/alloc/src/boxed.rs:2002:9
  11:     0x7ffb5be192b2 - rustc_driver[f5b6d32d8905ecdd]::DEFAULT_HOOK::{closure#0}::{closure#0}
                               at /home/ubuntu/rust2/compiler/rustc_driver/src/lib.rs:1204:17
  12:     0x7ffb5b4000d3 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hfd13333ca953ae8e
                               at /home/ubuntu/rust2/library/alloc/src/boxed.rs:2002:9
  13:     0x7ffb5b4000d3 - std::panicking::rust_panic_with_hook::h45753e10264ebe7e
                               at /home/ubuntu/rust2/library/std/src/panicking.rs:692:13
  14:     0x7ffb5e8b3a63 - std[3330b4673efabfce]::panicking::begin_panic::<rustc_errors[1b15f4e7e49d1fd5]::ExplicitBug>::{closure#0}

[... FRAMES INTENTIONALLY OMITTED BECAUSE GITHUB GOT ANGRY ...]

 186:     0x7ffb5bea5554 - <std[3330b4673efabfce]:🧵:Builder>::spawn_unchecked_::<rustc_interface[947706ead88047d0]::util::run_in_thread_pool_with_globals<rustc_interface[947706ead88047d0]::interface::run_compiler<core[672e3947e150d6c6]::result::Result<(), rustc_errors[1b15f4e7e49d1fd5]::ErrorGuaranteed>, rustc_driver[f5b6d32d8905ecdd]::run_compiler::{closure#1}>::{closure#0}, core[672e3947e150d6c6]::result::Result<(), rustc_errors[1b15f4e7e49d1fd5]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[672e3947e150d6c6]::result::Result<(), rustc_errors[1b15f4e7e49d1fd5]::ErrorGuaranteed>>::{closure#1}
                               at /home/ubuntu/rust2/library/std/src/thread/mod.rs:549:30
 187:     0x7ffb5bea5554 - <<std[3330b4673efabfce]:🧵:Builder>::spawn_unchecked_<rustc_interface[947706ead88047d0]::util::run_in_thread_pool_with_globals<rustc_interface[947706ead88047d0]::interface::run_compiler<core[672e3947e150d6c6]::result::Result<(), rustc_errors[1b15f4e7e49d1fd5]::ErrorGuaranteed>, rustc_driver[f5b6d32d8905ecdd]::run_compiler::{closure#1}>::{closure#0}, core[672e3947e150d6c6]::result::Result<(), rustc_errors[1b15f4e7e49d1fd5]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[672e3947e150d6c6]::result::Result<(), rustc_errors[1b15f4e7e49d1fd5]::ErrorGuaranteed>>::{closure#1} as core[672e3947e150d6c6]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
                               at /home/ubuntu/rust2/library/core/src/ops/function.rs:250:5
 188:     0x7ffb5b433968 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::he8b26fc22c6f51ec
                               at /home/ubuntu/rust2/library/alloc/src/boxed.rs:1988:9
 189:     0x7ffb5b433968 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h5cf9cbe75a8c3ddc
                               at /home/ubuntu/rust2/library/alloc/src/boxed.rs:1988:9
 190:     0x7ffb5b41199c - std::sys::unix:🧵:Thread:🆕:thread_start::h2d6dd4455e97d031
                               at /home/ubuntu/rust2/library/std/src/sys/unix/thread.rs:108:17
 191:     0x7ffb5441b609 - start_thread
 192:     0x7ffb5b282133 - clone
 193:                0x0 - <unknown>

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.68.0-dev running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [typeck] type-checking `<impl at /home/ubuntu/test.rs:7:1: 7:34>::trigger`
#1 [typeck_item_bodies] type-checking all item bodies
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0601`.
```
2022-12-30 21:26:36 -08:00
..
rustc
rustc_abi Auto merge of #105446 - erikdesjardins:vt-size, r=nikic 2022-12-18 22:01:39 +00:00
rustc_apfloat compiler: remove unnecessary imports and qualified paths 2022-12-10 18:45:34 +01:00
rustc_arena compiler: remove unnecessary imports and qualified paths 2022-12-10 18:45:34 +01:00
rustc_ast Rename Rptr to Ref in AST and HIR 2022-12-28 18:52:36 +01:00
rustc_ast_lowering Rollup merge of #106221 - Nilstrieb:rptr-more-like-ref-actually, r=compiler-errors 2022-12-29 13:16:04 +01:00
rustc_ast_passes Allow impl ~const Trait opaque types 2022-12-15 11:26:15 +00:00
rustc_ast_pretty Rename Rptr to Ref in AST and HIR 2022-12-28 18:52:36 +01:00
rustc_attr rustc_attr remove ref patterns 2022-12-06 14:45:58 +00:00
rustc_baked_icu_data
rustc_borrowck Rename Rptr to Ref in AST and HIR 2022-12-28 18:52:36 +01:00
rustc_builtin_macros Rename Rptr to Ref in AST and HIR 2022-12-28 18:52:36 +01:00
rustc_codegen_cranelift Auto merge of #105613 - Nilstrieb:rename-assert_uninit_valid, r=RalfJung 2022-12-21 23:20:04 +00:00
rustc_codegen_gcc Add missing anonymous lifetime 2022-12-20 22:34:42 +01:00
rustc_codegen_llvm Rollup merge of #105955 - Nilstrieb:no-trivial-opt-wrappers-we-have-field-accesses-for-that, r=cjgillot 2022-12-25 22:15:00 +01:00
rustc_codegen_ssa Auto merge of #105605 - inquisitivecrystal:attr-validation, r=cjgillot 2022-12-26 09:06:51 +00:00
rustc_const_eval Auto merge of #105085 - oli-obk:stop_promoting_all_the_things, r=RalfJung 2022-12-24 14:00:37 +00:00
rustc_data_structures fix some typos 2022-12-25 00:43:50 +01:00
rustc_driver Only deduplicate stack traces for good path bugs 2022-12-31 02:14:26 +00:00
rustc_error_codes docs: add long-form error docs for E0514 2022-12-29 14:32:39 +13:00
rustc_error_messages Recover fn keyword as Fn trait in bounds 2022-12-27 06:14:46 +00:00
rustc_errors Only deduplicate stack traces for good path bugs 2022-12-31 02:14:26 +00:00
rustc_expand Rollup merge of #106221 - Nilstrieb:rptr-more-like-ref-actually, r=compiler-errors 2022-12-29 13:16:04 +01:00
rustc_feature Revert "Implement allow-by-default multiple_supertrait_upcastable lint" 2022-12-29 00:47:23 -08:00
rustc_fs_util Remove useless borrows and derefs 2022-12-01 17:34:43 +00:00
rustc_graphviz Indicate anonymous lifetime 2022-12-23 15:59:53 +01:00
rustc_hir Rollup merge of #106221 - Nilstrieb:rptr-more-like-ref-actually, r=compiler-errors 2022-12-29 13:16:04 +01:00
rustc_hir_analysis Rollup merge of #106221 - Nilstrieb:rptr-more-like-ref-actually, r=compiler-errors 2022-12-29 13:16:04 +01:00
rustc_hir_pretty Rename Rptr to Ref in AST and HIR 2022-12-28 18:52:36 +01:00
rustc_hir_typeck Rollup merge of #106221 - Nilstrieb:rptr-more-like-ref-actually, r=compiler-errors 2022-12-29 13:16:04 +01:00
rustc_incremental rustc: Remove needless lifetimes 2022-12-20 22:10:40 +01:00
rustc_index A few small cleanups for newtype_index 2022-12-18 21:47:28 +01:00
rustc_infer Rollup merge of #106221 - Nilstrieb:rptr-more-like-ref-actually, r=compiler-errors 2022-12-29 13:16:04 +01:00
rustc_interface Auto merge of #105812 - ojeda:no-jump-tables, r=nikic 2022-12-21 17:38:38 +00:00
rustc_lexer Recover fn keyword as Fn trait in bounds 2022-12-27 06:14:46 +00:00
rustc_lint Rollup merge of #106248 - dtolnay:revertupcastlint, r=jackh726 2022-12-30 21:26:34 -08:00
rustc_lint_defs fix some typos 2022-12-25 00:43:50 +01:00
rustc_llvm llvm-wrapper: adapt for LLVM API changes 2022-12-11 09:14:50 +00:00
rustc_log
rustc_macros rustc: Remove needless lifetimes 2022-12-20 22:10:40 +01:00
rustc_metadata Auto merge of #106129 - compiler-errors:compare_method-tweaks, r=BoxyUwU 2022-12-28 13:07:30 +00:00
rustc_middle Auto merge of #106129 - compiler-errors:compare_method-tweaks, r=BoxyUwU 2022-12-28 13:07:30 +00:00
rustc_mir_build Rollup merge of #105975 - jeremystucki:rustc-remove-needless-lifetimes, r=eholk 2022-12-24 00:31:41 +01:00
rustc_mir_dataflow rustc: Remove needless lifetimes 2022-12-20 22:10:40 +01:00
rustc_mir_transform Give the correct track-caller location with MIR inlining. 2022-12-25 18:48:13 +00:00
rustc_monomorphize Auto merge of #106143 - matthiaskrgr:rollup-3kpy1dc, r=matthiaskrgr 2022-12-25 23:47:11 +00:00
rustc_parse Auto merge of #106268 - kraktus:patch-2, r=Nilstrieb 2022-12-30 06:59:13 +00:00
rustc_parse_format Add enum for find_width_map_from_snippet 2022-12-28 17:43:35 +01:00
rustc_passes Rename Rptr to Ref in AST and HIR 2022-12-28 18:52:36 +01:00
rustc_plugin_impl
rustc_privacy Prevent the creation of TraitRef without dedicated methods 2022-12-14 15:36:39 +00:00
rustc_query_impl Rollup merge of #105975 - jeremystucki:rustc-remove-needless-lifetimes, r=eholk 2022-12-24 00:31:41 +01:00
rustc_query_system Rollup merge of #105975 - jeremystucki:rustc-remove-needless-lifetimes, r=eholk 2022-12-24 00:31:41 +01:00
rustc_resolve Rollup merge of #106221 - Nilstrieb:rptr-more-like-ref-actually, r=compiler-errors 2022-12-29 13:16:04 +01:00
rustc_save_analysis Rename Rptr to Ref in AST and HIR 2022-12-28 18:52:36 +01:00
rustc_serialize compiler: remove unnecessary imports and qualified paths 2022-12-10 18:45:34 +01:00
rustc_session Rollup merge of #105955 - Nilstrieb:no-trivial-opt-wrappers-we-have-field-accesses-for-that, r=cjgillot 2022-12-25 22:15:00 +01:00
rustc_smir
rustc_span Rollup merge of #106248 - dtolnay:revertupcastlint, r=jackh726 2022-12-30 21:26:34 -08:00
rustc_symbol_mangling CFI: Monomorphize transparent ADTs before typeid 2022-12-29 10:21:07 -08:00
rustc_target fix some typos 2022-12-25 00:43:50 +01:00
rustc_trait_selection Auto merge of #106210 - fee1-dead-contrib:const-closure-trait-method, r=compiler-errors 2022-12-30 01:09:31 +00:00
rustc_traits rustc: Remove needless lifetimes 2022-12-20 22:10:40 +01:00
rustc_transmute Rollup merge of #105864 - matthiaskrgr:compl, r=Nilstrieb 2022-12-19 14:41:35 +05:30
rustc_ty_utils Rename some compare_method functions 2022-12-24 21:36:58 +00:00
rustc_type_ir A few small cleanups for newtype_index 2022-12-18 21:47:28 +01:00