Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE: downgrade_to_delayed_bug: cannot downgrade Warning(None) to DelayedBug: not an error #119633

Closed
matthiaskrgr opened this issue Jan 5, 2024 · 3 comments · Fixed by #119752
Assignees
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

auto-reduced (treereduce-rust):

fn call_this<F>(f: F) : Fn(&str) + call_that {}

original:

// Any copyright is dedicated to the Public Domain.
// http://creativecommons.org/publicdomain/zero/1.0/

// pp-exact

fn call_it(f: Box<FnMut(f: Box<FnMut(String) -> String>) -> String>) {}

fn call_this<F>(f: F) : Fn(&str) + call_that {}

fn call_that<F>(f: F) where F: for<'a> Fn(&'a isize, &'a isize) -> isize {}

fn call_extern(f: fn() -> isize) {}

fn call_abid_extern(call_it: extern "C" fn() -> isize) {}

pub fn main(&str) {}

Version information

rustc 1.77.0-nightly (11035f9f5 2024-01-05)
binary: rustc
commit-hash: 11035f9f52c65739d9613f5b9ecd332e9e640e71
commit-date: 2024-01-05
host: x86_64-unknown-linux-gnu
release: 1.77.0-nightly
LLVM version: 17.0.6

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

error: return types are denoted using `->`
 --> /tmp/icemaker_global_tempdir.ZcuHjInOmhfr/rustc_testrunner_tmpdir_reporting.BaGXrEBoFcyz/mvce.rs:8:23
  |
8 | fn call_this<F>(f: F) : Fn(&str) + call_that {}
  |                       ^ help: use `->` instead

error[E0405]: cannot find trait `call_that` in this scope
 --> /tmp/icemaker_global_tempdir.ZcuHjInOmhfr/rustc_testrunner_tmpdir_reporting.BaGXrEBoFcyz/mvce.rs:8:36
  |
8 | fn call_this<F>(f: F) : Fn(&str) + call_that {}
  |                                    ^^^^^^^^^ not found in this scope

error[E0601]: `main` function not found in crate `mvce`
 --> /tmp/icemaker_global_tempdir.ZcuHjInOmhfr/rustc_testrunner_tmpdir_reporting.BaGXrEBoFcyz/mvce.rs:8:48
  |
8 | fn call_this<F>(f: F) : Fn(&str) + call_that {}
  |                                                ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.ZcuHjInOmhfr/rustc_testrunner_tmpdir_reporting.BaGXrEBoFcyz/mvce.rs`

thread 'rustc' panicked at compiler/rustc_hir_analysis/src/astconv/lint.rs:127:22:
downgrade_to_delayed_bug: cannot downgrade Warning(None) to DelayedBug: not an error
stack backtrace:
   0:     0x7f302d38b806 - std::backtrace_rs::backtrace::libunwind::trace::h72ed163bf54ed335
                               at /rustc/11035f9f52c65739d9613f5b9ecd332e9e640e71/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7f302d38b806 - std::backtrace_rs::backtrace::trace_unsynchronized::ha9eeffcac0159741
                               at /rustc/11035f9f52c65739d9613f5b9ecd332e9e640e71/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f302d38b806 - std::sys_common::backtrace::_print_fmt::hd878d288400665ec
                               at /rustc/11035f9f52c65739d9613f5b9ecd332e9e640e71/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7f302d38b806 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hee1d8c1810fab8e4
                               at /rustc/11035f9f52c65739d9613f5b9ecd332e9e640e71/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f302d3ddf00 - core::fmt::rt::Argument::fmt::he899d11a584078ee
                               at /rustc/11035f9f52c65739d9613f5b9ecd332e9e640e71/library/core/src/fmt/rt.rs:142:9
   5:     0x7f302d3ddf00 - core::fmt::write::h9fb58a907feb62f5
                               at /rustc/11035f9f52c65739d9613f5b9ecd332e9e640e71/library/core/src/fmt/mod.rs:1120:17
   6:     0x7f302d37f15f - std::io::Write::write_fmt::h7e0c3492389aed93
                               at /rustc/11035f9f52c65739d9613f5b9ecd332e9e640e71/library/std/src/io/mod.rs:1810:15
   7:     0x7f302d38b5e4 - std::sys_common::backtrace::_print::hb4e839736d952adb
                               at /rustc/11035f9f52c65739d9613f5b9ecd332e9e640e71/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f302d38b5e4 - std::sys_common::backtrace::print::ha846f6638d2e1501
                               at /rustc/11035f9f52c65739d9613f5b9ecd332e9e640e71/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f302d38e377 - std::panicking::default_hook::{{closure}}::hcd8a486cb84a6ace
  10:     0x7f302d38e0d9 - std::panicking::default_hook::hfa2ffdc3f2a8ce4a
                               at /rustc/11035f9f52c65739d9613f5b9ecd332e9e640e71/library/std/src/panicking.rs:292:9
  11:     0x7f3030160cac - std[735fb5c0265dddc8]::panicking::update_hook::<alloc[2bd63a676ca9eb5]::boxed::Box<rustc_driver_impl[d85864648598caad]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7f302d38eac6 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hc9ef68fbc75324a4
                               at /rustc/11035f9f52c65739d9613f5b9ecd332e9e640e71/library/alloc/src/boxed.rs:2030:9
  13:     0x7f302d38eac6 - std::panicking::rust_panic_with_hook::h869d110b23694b5d
                               at /rustc/11035f9f52c65739d9613f5b9ecd332e9e640e71/library/std/src/panicking.rs:783:13
  14:     0x7f302d38e812 - std::panicking::begin_panic_handler::{{closure}}::hd3a60d30fcbcee10
                               at /rustc/11035f9f52c65739d9613f5b9ecd332e9e640e71/library/std/src/panicking.rs:657:13
  15:     0x7f302d38bd06 - std::sys_common::backtrace::__rust_end_short_backtrace::hcea5d524563d6535
                               at /rustc/11035f9f52c65739d9613f5b9ecd332e9e640e71/library/std/src/sys_common/backtrace.rs:171:18
  16:     0x7f302d38e570 - rust_begin_unwind
                               at /rustc/11035f9f52c65739d9613f5b9ecd332e9e640e71/library/std/src/panicking.rs:645:5
  17:     0x7f302d3da605 - core::panicking::panic_fmt::hc641175b49629a2b
                               at /rustc/11035f9f52c65739d9613f5b9ecd332e9e640e71/library/core/src/panicking.rs:72:14
  18:     0x7f302f7c4858 - <rustc_errors[5a03629f0326f870]::diagnostic::Diagnostic>::downgrade_to_delayed_bug
  19:     0x7f303028382f - <dyn rustc_hir_analysis[4501648514be1474]::astconv::AstConv>::maybe_lint_impl_trait
  20:     0x7f303023d6ec - <<dyn rustc_hir_analysis[4501648514be1474]::astconv::AstConv>::maybe_lint_bare_trait::{closure#1} as core[d0d16022f048c5c1]::ops::function::FnOnce<(&mut rustc_errors[5a03629f0326f870]::diagnostic_builder::DiagnosticBuilder<()>,)>>::call_once::{shim:vtable#0}
  21:     0x7f3030258722 - <alloc[2bd63a676ca9eb5]::boxed::Box<dyn for<'a, 'b> core[d0d16022f048c5c1]::ops::function::FnOnce<(&'a mut rustc_errors[5a03629f0326f870]::diagnostic_builder::DiagnosticBuilder<'b, ()>,), Output = ()>> as core[d0d16022f048c5c1]::ops::function::FnOnce<(&mut rustc_errors[5a03629f0326f870]::diagnostic_builder::DiagnosticBuilder<()>,)>>::call_once
  22:     0x7f303221a7e4 - rustc_middle[8ef003f1e476f553]::lint::struct_lint_level::struct_lint_level_impl::<&str>
  23:     0x7f3031601b8c - <dyn rustc_hir_analysis[4501648514be1474]::astconv::AstConv>::ast_ty_to_ty_inner
  24:     0x7f30315fed76 - <dyn rustc_hir_analysis[4501648514be1474]::astconv::AstConv>::ty_of_fn
  25:     0x7f30315fde2e - rustc_hir_analysis[4501648514be1474]::collect::infer_return_ty_for_fn_sig
  26:     0x7f30315fd0bc - rustc_hir_analysis[4501648514be1474]::collect::fn_sig
  27:     0x7f30315f6585 - rustc_query_impl[c94a6fda47c12dc7]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c94a6fda47c12dc7]::query_impl::fn_sig::dynamic_query::{closure#2}::{closure#0}, rustc_middle[8ef003f1e476f553]::query::erase::Erased<[u8; 24usize]>>
  28:     0x7f30315f6555 - <rustc_query_impl[c94a6fda47c12dc7]::query_impl::fn_sig::dynamic_query::{closure#2} as core[d0d16022f048c5c1]::ops::function::FnOnce<(rustc_middle[8ef003f1e476f553]::ty::context::TyCtxt, rustc_span[fb1dd2d991832768]::def_id::DefId)>>::call_once
  29:     0x7f30315f5b93 - rustc_query_system[aa09d2e731c481a9]::query::plumbing::try_execute_query::<rustc_query_impl[c94a6fda47c12dc7]::DynamicConfig<rustc_query_system[aa09d2e731c481a9]::query::caches::DefaultCache<rustc_span[fb1dd2d991832768]::def_id::DefId, rustc_middle[8ef003f1e476f553]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[c94a6fda47c12dc7]::plumbing::QueryCtxt, false>
  30:     0x7f30315f55af - rustc_query_impl[c94a6fda47c12dc7]::query_impl::fn_sig::get_query_non_incr::__rust_end_short_backtrace
  31:     0x7f30318cca04 - <rustc_hir_analysis[4501648514be1474]::collect::CollectItemTypesVisitor as rustc_hir[200e79af71247e2]::intravisit::Visitor>::visit_item
  32:     0x7f30318caa3d - rustc_hir_analysis[4501648514be1474]::collect::collect_mod_item_types
  33:     0x7f30318ca9d1 - rustc_query_impl[c94a6fda47c12dc7]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c94a6fda47c12dc7]::query_impl::collect_mod_item_types::dynamic_query::{closure#2}::{closure#0}, rustc_middle[8ef003f1e476f553]::query::erase::Erased<[u8; 0usize]>>
  34:     0x7f3031db3b0f - rustc_query_system[aa09d2e731c481a9]::query::plumbing::try_execute_query::<rustc_query_impl[c94a6fda47c12dc7]::DynamicConfig<rustc_query_system[aa09d2e731c481a9]::query::caches::DefaultCache<rustc_span[fb1dd2d991832768]::def_id::LocalModDefId, rustc_middle[8ef003f1e476f553]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[c94a6fda47c12dc7]::plumbing::QueryCtxt, false>
  35:     0x7f3031db3643 - rustc_query_impl[c94a6fda47c12dc7]::query_impl::collect_mod_item_types::get_query_non_incr::__rust_end_short_backtrace
  36:     0x7f303160359f - rustc_hir_analysis[4501648514be1474]::check_crate
  37:     0x7f3032035ed9 - rustc_interface[82ea3601d258e7e1]::passes::analysis
  38:     0x7f3032035b1f - rustc_query_impl[c94a6fda47c12dc7]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c94a6fda47c12dc7]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[8ef003f1e476f553]::query::erase::Erased<[u8; 1usize]>>
  39:     0x7f30323a55a4 - rustc_query_system[aa09d2e731c481a9]::query::plumbing::try_execute_query::<rustc_query_impl[c94a6fda47c12dc7]::DynamicConfig<rustc_query_system[aa09d2e731c481a9]::query::caches::SingleCache<rustc_middle[8ef003f1e476f553]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[c94a6fda47c12dc7]::plumbing::QueryCtxt, false>
  40:     0x7f30323a5395 - rustc_query_impl[c94a6fda47c12dc7]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  41:     0x7f3032066f35 - rustc_interface[82ea3601d258e7e1]::interface::run_compiler::<core[d0d16022f048c5c1]::result::Result<(), rustc_span[fb1dd2d991832768]::ErrorGuaranteed>, rustc_driver_impl[d85864648598caad]::run_compiler::{closure#0}>::{closure#0}
  42:     0x7f30323db78a - std[735fb5c0265dddc8]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[82ea3601d258e7e1]::util::run_in_thread_with_globals<rustc_interface[82ea3601d258e7e1]::util::run_in_thread_pool_with_globals<rustc_interface[82ea3601d258e7e1]::interface::run_compiler<core[d0d16022f048c5c1]::result::Result<(), rustc_span[fb1dd2d991832768]::ErrorGuaranteed>, rustc_driver_impl[d85864648598caad]::run_compiler::{closure#0}>::{closure#0}, core[d0d16022f048c5c1]::result::Result<(), rustc_span[fb1dd2d991832768]::ErrorGuaranteed>>::{closure#0}, core[d0d16022f048c5c1]::result::Result<(), rustc_span[fb1dd2d991832768]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[d0d16022f048c5c1]::result::Result<(), rustc_span[fb1dd2d991832768]::ErrorGuaranteed>>
  43:     0x7f30323db5b9 - <<std[735fb5c0265dddc8]::thread::Builder>::spawn_unchecked_<rustc_interface[82ea3601d258e7e1]::util::run_in_thread_with_globals<rustc_interface[82ea3601d258e7e1]::util::run_in_thread_pool_with_globals<rustc_interface[82ea3601d258e7e1]::interface::run_compiler<core[d0d16022f048c5c1]::result::Result<(), rustc_span[fb1dd2d991832768]::ErrorGuaranteed>, rustc_driver_impl[d85864648598caad]::run_compiler::{closure#0}>::{closure#0}, core[d0d16022f048c5c1]::result::Result<(), rustc_span[fb1dd2d991832768]::ErrorGuaranteed>>::{closure#0}, core[d0d16022f048c5c1]::result::Result<(), rustc_span[fb1dd2d991832768]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[d0d16022f048c5c1]::result::Result<(), rustc_span[fb1dd2d991832768]::ErrorGuaranteed>>::{closure#1} as core[d0d16022f048c5c1]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  44:     0x7f302d3989f5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h29d894b5e99070ca
                               at /rustc/11035f9f52c65739d9613f5b9ecd332e9e640e71/library/alloc/src/boxed.rs:2016:9
  45:     0x7f302d3989f5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hee2cef6a97c8434b
                               at /rustc/11035f9f52c65739d9613f5b9ecd332e9e640e71/library/alloc/src/boxed.rs:2016:9
  46:     0x7f302d3989f5 - std::sys::unix::thread::Thread::new::thread_start::h2bd633f8986b3333
                               at /rustc/11035f9f52c65739d9613f5b9ecd332e9e640e71/library/std/src/sys/unix/thread.rs:108:17
  47:     0x7f302d1849eb - <unknown>
  48:     0x7f302d2087cc - <unknown>
  49:                0x0 - <unknown>

error: 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.77.0-nightly (11035f9f5 2024-01-05) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [fn_sig] computing function signature of `call_this`
#1 [collect_mod_item_types] collecting item types in top-level module
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 3 previous errors

Some errors have detailed explanations: E0405, E0601.
For more information about an error, try `rustc --explain E0405`.

@matthiaskrgr matthiaskrgr added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. labels Jan 5, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jan 5, 2024
@matthiaskrgr
Copy link
Member Author

@nnethercote I suspect this is caused by one of your prs that were merged in #119621

@matthiaskrgr
Copy link
Member Author

Oh nevermind, sorry, the was line added by #119148 cc @estebank :D
I couldn't bisect yet because we didn't have the per-pr artifacts available yet.

@matthiaskrgr
Copy link
Member Author

code snippet that triggers the other downgarde_to_delayed_bug that was added:

fn id<F>(f: Copy) -> usize {
    f()
}

@estebank estebank self-assigned this Jan 5, 2024
@saethlin saethlin added A-diagnostics Area: Messages for errors, warnings, and lints and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jan 7, 2024
estebank added a commit to estebank/rust that referenced this issue Jan 8, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jan 20, 2024
Avoid ICEs in trait names without `dyn`

Check diagnostic is error before downgrading. Fix rust-lang#119633.

 Account for traits using self-trait by name without `dyn`. Fix rust-lang#119652.
@bors bors closed this as completed in b1688b4 Jan 20, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Jan 20, 2024
Rollup merge of rust-lang#119752 - estebank:ice-ice, r=fmease

Avoid ICEs in trait names without `dyn`

Check diagnostic is error before downgrading. Fix rust-lang#119633.

 Account for traits using self-trait by name without `dyn`. Fix rust-lang#119652.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants