Skip to content

Compiler panic in 1.72.0 #115205

New issue

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

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

Already on GitHub? # to your account

Closed
evenorog opened this issue Aug 25, 2023 · 1 comment
Closed

Compiler panic in 1.72.0 #115205

evenorog opened this issue Aug 25, 2023 · 1 comment
Labels
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

@evenorog
Copy link

evenorog commented Aug 25, 2023

Code

[package]
name = "untitled"
version = "0.1.0"
edition = "2021"

[dependencies]
tokio = { version = "1.15.0", features = ["full"] }
actix-web = "4"

[dependencies.sqlx]
version = "0.7.1"
default-features = false
features = ["postgres", "macros", "runtime-tokio", "chrono"]
use std::{env, io};
use std::net::Ipv4Addr;
use actix_web::{App, HttpResponse, HttpServer, post, Responder};
use actix_web::web::{Data};
use sqlx::{PgPool};

#[post("/upload")]
async fn upload(pool: Data<PgPool>) -> impl Responder {
    pub async fn find_country(dependencies: impl IntoIterator<Item = i32>, ex: &PgPool) {
        for id in dependencies {
            sqlx::query!("select * from countries where id = $1", id)
                .fetch_one(ex)
                .await
                .unwrap();
        }
    }

    let pool = pool.get_ref();
    let a = vec![0];
    let vec = a.iter().map(|x| *x);
    find_country(vec, pool).await;

    HttpResponse::Ok()
}

#[tokio::main]
async fn main() -> io::Result<()>{
    let uri = env::var("DATABASE_URL").expect("DATABASE_URL must be set");
    let pool = PgPool::connect(&uri)
        .await
        .expect("failed to create pg pool");
    let pool = Data::new(pool);
    HttpServer::new(move || {
        App::new().app_data(Data::clone(&pool)).service(upload)
    }).bind((Ipv4Addr::UNSPECIFIED, 8080))?.run().await
}

Changing IntoIterator to Iterator compiles. Removing the map call compiles. Seems to work if it is not a actix-web route. Using the query function instead of the macro also fails.

Meta

rustc --version --verbose:

rustc 1.72.0 (5680fa18f 2023-08-23)
binary: rustc
commit-hash: 5680fa18feaa87f3ff04063800aec256c3d4b4be
commit-date: 2023-08-23
host: x86_64-unknown-linux-gnu
release: 1.72.0
LLVM version: 16.0.5

Bug also exists in beta and nightly.

Error output

thread 'rustc' panicked at 'assertion failed: `(left == right)`
  left: `*mut [async fn body@src/main.rs:8:55: 24:2]`,
 right: `*mut [async fn body@src/main.rs:8:55: 24:2]`: unexpected initial operand type', /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/compiler/rustc_codegen_ssa/src/mir/locals.rs:46:21
stack backtrace:
   <Moved below>

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.72.0 (5680fa18f 2023-08-23) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: could not compile `untitled` (bin "untitled")
Backtrace

0:     0x7ffaa2fd7b61 - std::backtrace_rs::backtrace::libunwind::trace::he648b5c8dd376705
                               at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7ffaa2fd7b61 - std::backtrace_rs::backtrace::trace_unsynchronized::h5da3e203eef39e9f
                               at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7ffaa2fd7b61 - std::sys_common::backtrace::_print_fmt::h8d28d3f20588ae4c
                               at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7ffaa2fd7b61 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hd9a5b0c9c6b058c0
                               at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7ffaa303e77f - core::fmt::rt::Argument::fmt::h0afc04119f252b53
                               at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/fmt/rt.rs:138:9
   5:     0x7ffaa303e77f - core::fmt::write::h50b1b3e73851a6fe
                               at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/fmt/mod.rs:1094:21
   6:     0x7ffaa2fca4a7 - std::io::Write::write_fmt::h184eaf275e4484f0
                               at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/io/mod.rs:1714:15
   7:     0x7ffaa2fd7975 - std::sys_common::backtrace::_print::hf58c3a5a25090e71
                               at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7ffaa2fd7975 - std::sys_common::backtrace::print::hb9cf0a7c7f077819
                               at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7ffaa2fda753 - std::panicking::default_hook::{{closure}}::h066adb2e3f3e2c07
                               at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panicking.rs:269:22
  10:     0x7ffaa2fda4e4 - std::panicking::default_hook::h277fa2776900ff14
                               at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panicking.rs:288:9
  11:     0x7ffaa1e6756b - <rustc_driver_impl[10725d833993dc31]::install_ice_hook::{closure#0} as core[f12ae36cc2e1ecf0]::ops::function::FnOnce<(&core[f12ae36cc2e1ecf0]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  12:     0x7ffaa2fdaf7e - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h09cad52ea08435f2
                               at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/alloc/src/boxed.rs:2007:9
  13:     0x7ffaa2fdaf7e - std::panicking::rust_panic_with_hook::hceaf38da6d9db792
                               at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panicking.rs:709:13
  14:     0x7ffaa2fdad07 - std::panicking::begin_panic_handler::{{closure}}::h2bce3ed2516af7df
                               at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panicking.rs:597:13
  15:     0x7ffaa2fd7fc6 - std::sys_common::backtrace::__rust_end_short_backtrace::h090f3faf8f98a395
                               at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/sys_common/backtrace.rs:151:18
  16:     0x7ffaa2fdaa52 - rust_begin_unwind
                               at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panicking.rs:593:5
  17:     0x7ffaa303a9f3 - core::panicking::panic_fmt::h4ec8274704d163a3
                               at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/panicking.rs:67:14
  18:     0x7ffaa303af81 - core::panicking::assert_failed_inner::hdcf25e9f37bb1a8f
  19:     0x7ffaa1cc291c - core[f12ae36cc2e1ecf0]::panicking::assert_failed::<rustc_middle[4cadb439cfabc8cf]::ty::Ty, rustc_middle[4cadb439cfabc8cf]::ty::Ty>
  20:     0x7ffaa069bdc6 - rustc_codegen_ssa[d2afe12f28670a23]::mir::codegen_mir::<rustc_codegen_llvm[7c6130158ac5f383]::builder::Builder>
  21:     0x7ffaa146a5ba - rustc_codegen_llvm[7c6130158ac5f383]::base::compile_codegen_unit::module_codegen
  22:     0x7ffaa14694d5 - <rustc_middle[4cadb439cfabc8cf]::dep_graph::dep_node::DepKind as rustc_query_system[5a9d202ec1d2890c]::dep_graph::DepKind>::with_deps::<<rustc_query_system[5a9d202ec1d2890c]::dep_graph::graph::DepGraphData<rustc_middle[4cadb439cfabc8cf]::dep_graph::dep_node::DepKind>>::with_task<rustc_middle[4cadb439cfabc8cf]::ty::context::TyCtxt, rustc_span[14af2d27fb997609]::symbol::Symbol, rustc_codegen_ssa[d2afe12f28670a23]::ModuleCodegen<rustc_codegen_llvm[7c6130158ac5f383]::ModuleLlvm>>::{closure#0}::{closure#0}, rustc_codegen_ssa[d2afe12f28670a23]::ModuleCodegen<rustc_codegen_llvm[7c6130158ac5f383]::ModuleLlvm>>
  23:     0x7ffaa1468cc5 - rustc_codegen_llvm[7c6130158ac5f383]::base::compile_codegen_unit
  24:     0x7ffaa146550e - rustc_codegen_ssa[d2afe12f28670a23]::base::codegen_crate::<rustc_codegen_llvm[7c6130158ac5f383]::LlvmCodegenBackend>
  25:     0x7ffaa1464e26 - <rustc_codegen_llvm[7c6130158ac5f383]::LlvmCodegenBackend as rustc_codegen_ssa[d2afe12f28670a23]::traits::backend::CodegenBackend>::codegen_crate
  26:     0x7ffaa1333f92 - <rustc_session[c98e5f13e8087e38]::session::Session>::time::<alloc[adbc6fffff8d40a5]::boxed::Box<dyn core[f12ae36cc2e1ecf0]::any::Any>, rustc_interface[7e6a9899d53a1fe5]::passes::start_codegen::{closure#0}>
  27:     0x7ffaa1333adb - rustc_interface[7e6a9899d53a1fe5]::passes::start_codegen
  28:     0x7ffaa132d6aa - <rustc_middle[4cadb439cfabc8cf]::ty::context::GlobalCtxt>::enter::<<rustc_interface[7e6a9899d53a1fe5]::queries::Queries>::ongoing_codegen::{closure#0}, core[f12ae36cc2e1ecf0]::result::Result<alloc[adbc6fffff8d40a5]::boxed::Box<dyn core[f12ae36cc2e1ecf0]::any::Any>, rustc_span[14af2d27fb997609]::ErrorGuaranteed>>
  29:     0x7ffaa132caf8 - <rustc_interface[7e6a9899d53a1fe5]::interface::Compiler>::enter::<rustc_driver_impl[10725d833993dc31]::run_compiler::{closure#1}::{closure#2}, core[f12ae36cc2e1ecf0]::result::Result<core[f12ae36cc2e1ecf0]::option::Option<rustc_interface[7e6a9899d53a1fe5]::queries::Linker>, rustc_span[14af2d27fb997609]::ErrorGuaranteed>>
  30:     0x7ffaa1329cc5 - rustc_span[14af2d27fb997609]::set_source_map::<core[f12ae36cc2e1ecf0]::result::Result<(), rustc_span[14af2d27fb997609]::ErrorGuaranteed>, rustc_interface[7e6a9899d53a1fe5]::interface::run_compiler<core[f12ae36cc2e1ecf0]::result::Result<(), rustc_span[14af2d27fb997609]::ErrorGuaranteed>, rustc_driver_impl[10725d833993dc31]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  31:     0x7ffaa1329736 - <scoped_tls[a7f541bbfecfca9d]::ScopedKey<rustc_span[14af2d27fb997609]::SessionGlobals>>::set::<rustc_interface[7e6a9899d53a1fe5]::interface::run_compiler<core[f12ae36cc2e1ecf0]::result::Result<(), rustc_span[14af2d27fb997609]::ErrorGuaranteed>, rustc_driver_impl[10725d833993dc31]::run_compiler::{closure#1}>::{closure#0}, core[f12ae36cc2e1ecf0]::result::Result<(), rustc_span[14af2d27fb997609]::ErrorGuaranteed>>
  32:     0x7ffaa1328cfc - std[7c7acd4e376d60d3]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[7e6a9899d53a1fe5]::util::run_in_thread_pool_with_globals<rustc_interface[7e6a9899d53a1fe5]::interface::run_compiler<core[f12ae36cc2e1ecf0]::result::Result<(), rustc_span[14af2d27fb997609]::ErrorGuaranteed>, rustc_driver_impl[10725d833993dc31]::run_compiler::{closure#1}>::{closure#0}, core[f12ae36cc2e1ecf0]::result::Result<(), rustc_span[14af2d27fb997609]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[f12ae36cc2e1ecf0]::result::Result<(), rustc_span[14af2d27fb997609]::ErrorGuaranteed>>
  33:     0x7ffaa16a1305 - <<std[7c7acd4e376d60d3]::thread::Builder>::spawn_unchecked_<rustc_interface[7e6a9899d53a1fe5]::util::run_in_thread_pool_with_globals<rustc_interface[7e6a9899d53a1fe5]::interface::run_compiler<core[f12ae36cc2e1ecf0]::result::Result<(), rustc_span[14af2d27fb997609]::ErrorGuaranteed>, rustc_driver_impl[10725d833993dc31]::run_compiler::{closure#1}>::{closure#0}, core[f12ae36cc2e1ecf0]::result::Result<(), rustc_span[14af2d27fb997609]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[f12ae36cc2e1ecf0]::result::Result<(), rustc_span[14af2d27fb997609]::ErrorGuaranteed>>::{closure#1} as core[f12ae36cc2e1ecf0]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  34:     0x7ffaa2fe5435 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hc0b1022758ecac73
                               at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/alloc/src/boxed.rs:1993:9
  35:     0x7ffaa2fe5435 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h0c9654ebe7ad657e
                               at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/alloc/src/boxed.rs:1993:9
  36:     0x7ffaa2fe5435 - std::sys::unix::thread::Thread::new::thread_start::h04c8e9c7d83d3bd5
                               at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/sys/unix/thread.rs:108:17
  37:     0x7ffa9e88ffa4 - start_thread
  38:     0x7ffa9e9187fc - clone3
  39:                0x0 - <unknown>

@evenorog evenorog added 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. labels Aug 25, 2023
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Aug 25, 2023
@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Aug 25, 2023
@saethlin
Copy link
Member

I think this is a duplicate of #114858

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
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

No branches or pull requests

3 participants