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: const_trait_impl: async functions cannot be const fn #117629

Open
matthiaskrgr opened this issue Nov 6, 2023 · 1 comment
Open

ice: const_trait_impl: async functions cannot be const fn #117629

matthiaskrgr opened this issue Nov 6, 2023 · 1 comment
Labels
C-bug Category: This is a bug. F-const_trait_impl `#![feature(const_trait_impl)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

Code

rustc --edition=2021

#![feature(const_trait_impl)]

#[const_trait]
trait Tr {
    async fn ft1() {}
}

fn main() {}

Meta

rustc --version --verbose:

rustc 1.75.0-nightly (c1ccc29cd 2023-11-05)
binary: rustc
commit-hash: c1ccc29cd6eeb79f24511d75e9db553385a5d73f
commit-date: 2023-11-05
host: x86_64-unknown-linux-gnu
release: 1.75.0-nightly
LLVM version: 17.0.4

Error output

<output>
Backtrace

error: internal compiler error: no errors encountered even though `delay_span_bug` issued

error: internal compiler error: `async` functions cannot be `const fn`
 --> crash.rs:5:5
  |
5 |     async fn ft1() {}
  |     ^^^^^^^^^^^^^^^^^
  |
note: delayed at compiler/rustc_const_eval/src/transform/check_consts/check.rs:251:22
         0: <rustc_errors::HandlerInner>::emit_diagnostic
         1: <rustc_session::session::Session>::delay_span_bug::<rustc_span::span_encoding::Span, &str>
         2: rustc_mir_transform::mir_const_qualif
         3: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::mir_const_qualif::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 5]>>
         4: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::DefId, rustc_middle::query::erase::Erased<[u8; 5]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
         5: rustc_query_impl::query_impl::mir_const_qualif::get_query_non_incr::__rust_end_short_backtrace
         6: rustc_mir_transform::mir_promoted
         7: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::mir_promoted::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 16]>>
         8: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 16]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
         9: rustc_query_impl::query_impl::mir_promoted::get_query_non_incr::__rust_end_short_backtrace
        10: rustc_borrowck::mir_borrowck
        11: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
        12: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        13: rustc_query_impl::query_impl::mir_borrowck::get_query_non_incr::__rust_end_short_backtrace
        14: rustc_hir_analysis::collect::type_of::type_of_opaque
        15: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::type_of_opaque::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
        16: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::DefId, rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        17: rustc_query_impl::query_impl::type_of_opaque::get_query_non_incr::__rust_end_short_backtrace
        18: rustc_middle::query::plumbing::query_get_at::<rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::DefId, rustc_middle::query::erase::Erased<[u8; 8]>>>
        19: rustc_hir_analysis::collect::type_of::type_of
        20: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::type_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
        21: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::DefId, rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        22: rustc_query_impl::query_impl::type_of::get_query_non_incr::__rust_end_short_backtrace
        23: rustc_middle::query::plumbing::query_get_at::<rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::DefId, rustc_middle::query::erase::Erased<[u8; 8]>>>
        24: rustc_hir_analysis::check::check::check_mod_item_types
        25: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::check_mod_item_types::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 0]>>
        26: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::LocalModDefId, rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        27: rustc_query_impl::query_impl::check_mod_item_types::get_query_non_incr::__rust_end_short_backtrace
        28: rustc_hir_analysis::check_crate
        29: rustc_interface::passes::analysis
        30: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
        31: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        32: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
        33: rustc_interface::interface::run_compiler::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}
        34: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
        35: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
        36: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/c1ccc29cd6eeb79f24511d75e9db553385a5d73f/library/alloc/src/boxed.rs:2007:9
        37: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/c1ccc29cd6eeb79f24511d75e9db553385a5d73f/library/alloc/src/boxed.rs:2007:9
        38: std::sys::unix::thread::Thread::new::thread_start
                   at /rustc/c1ccc29cd6eeb79f24511d75e9db553385a5d73f/library/std/src/sys/unix/thread.rs:108:17
        39: <unknown>
        40: <unknown>
 --> crash.rs:5:5
  |
5 |     async fn ft1() {}
  |     ^^^^^^^^^^^^^^^^^

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: please attach the file at `/tmp/icemaker/rustc-ice-2023-11-06T10_23_53-2751136.txt` to your bug report

query stack during panic:
end of query stack
error: aborting due to 2 previous errors

@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 Nov 6, 2023
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Nov 6, 2023
@matthiaskrgr
Copy link
Member Author

nightly-2023-10-15
Regression in 481d45a

if I add async_fn_in_trait, this bisects to

Regression in nightly-2023-03-15

commit[0] 2023-03-13: Auto merge of #109094 - Nilstrieb:no-thin-lto-on-windows, r=jyn514
commit[1] 2023-03-14: Auto merge of #109097 - matthiaskrgr:rollup-6ydc4ri, r=matthiaskrgr
commit[2] 2023-03-14: Auto merge of #108992 - petrochenkov:qcstore2, r=cjgillot
commit[3] 2023-03-14: Auto merge of #109057 - compiler-errors:rpitit-info-again, r=spastorino
commit[4] 2023-03-14: Auto merge of #104833 - Swatinem:async-identity-future, r=compiler-errors
commit[5] 2023-03-14: Auto merge of #106505 - Nilstrieb:format-args-string-literal-episode-2, r=petrochenkov
commit[6] 2023-03-14: Auto merge of #109130 - matthiaskrgr:rollup-dm3jza6, r=matthiaskrgr

@saethlin saethlin added F-const_trait_impl `#![feature(const_trait_impl)]` and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Nov 9, 2023
@matthiaskrgr matthiaskrgr added the S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. label Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. F-const_trait_impl `#![feature(const_trait_impl)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. 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