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 error triggered by adding feature "effects" to code #115842

Closed
iamanonymouscs opened this issue Sep 14, 2023 · 2 comments · Fixed by #115859
Closed

ICE error triggered by adding feature "effects" to code #115842

iamanonymouscs opened this issue Sep 14, 2023 · 2 comments · Fixed by #115859
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

@iamanonymouscs
Copy link

Adding the feature "effects" to the provided code triggers an internal compiler error (ICE) in rustc. The ICE occurs when attempting to match a variable and assign either a constant function (fn1) or a regular function (fnc1) to another variable.

Code

#![feature(effects)]
const fn fn1() {}

fn fnc1() {}

fn main() {
 let y=3;
 let x = match y {
  2 => fn1,
  _ => fnc1
 };
}

Meta

rustc --version --verbose:

rustc 1.74.0-nightly (8142a319e 2023-09-13)
binary: rustc
commit-hash: 8142a319ed5c1d1f96e5a1881a6546e463b77c8f
commit-date: 2023-09-13
host: x86_64-unknown-linux-gnu
release: 1.74.0-nightly
LLVM version: 17.0.0

Error output


error[E0282]: type annotations needed
 --> bug_9_14.rs:9:8
  |
9 |   2 => fn1,
  |        ^^^ cannot infer the value of the const parameter `host` declared on the function `fn1`
  |
help: consider specifying the generic argument
  |
9 |   2 => fn1::<_>,
  |           +++++

Backtrace

thread 'rustc' panicked at /rustc/8142a319ed5c1d1f96e5a1881a6546e463b77c8f/compiler/rustc_infer/src/infer/mod.rs:1422:9:
`Ok(FnDef(DefId(0:3 ~ bug_9_14[d365]::fn1), [Const { ty: bool, kind: ?0e }]))` is not fully resolved
stack backtrace:
   0:     0x7fa8e5eecefc - std::backtrace_rs::backtrace::libunwind::trace::h7d696a3fe83931ea
                               at /rustc/8142a319ed5c1d1f96e5a1881a6546e463b77c8f/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7fa8e5eecefc - std::backtrace_rs::backtrace::trace_unsynchronized::h32ed3b706756d880
                               at /rustc/8142a319ed5c1d1f96e5a1881a6546e463b77c8f/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fa8e5eecefc - std::sys_common::backtrace::_print_fmt::h234b1d6e2050b1c7
                               at /rustc/8142a319ed5c1d1f96e5a1881a6546e463b77c8f/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7fa8e5eecefc - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hdba83e95158d24b7
                               at /rustc/8142a319ed5c1d1f96e5a1881a6546e463b77c8f/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7fa8e5f5315c - core::fmt::rt::Argument::fmt::h56eddd6c4c48048d
                               at /rustc/8142a319ed5c1d1f96e5a1881a6546e463b77c8f/library/core/src/fmt/rt.rs:138:9
   5:     0x7fa8e5f5315c - core::fmt::write::heb62e4111c27e516
                               at /rustc/8142a319ed5c1d1f96e5a1881a6546e463b77c8f/library/core/src/fmt/mod.rs:1094:21
   6:     0x7fa8e5edfb1e - std::io::Write::write_fmt::he7699d16423b5914
                               at /rustc/8142a319ed5c1d1f96e5a1881a6546e463b77c8f/library/std/src/io/mod.rs:1714:15
   7:     0x7fa8e5eecce4 - std::sys_common::backtrace::_print::h17c88990d1e7ffc8
                               at /rustc/8142a319ed5c1d1f96e5a1881a6546e463b77c8f/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7fa8e5eecce4 - std::sys_common::backtrace::print::h18bfa712e4237a54
                               at /rustc/8142a319ed5c1d1f96e5a1881a6546e463b77c8f/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7fa8e5eefdda - std::panicking::panic_hook_with_disk_dump::{{closure}}::h29435e023d2fef53
                               at /rustc/8142a319ed5c1d1f96e5a1881a6546e463b77c8f/library/std/src/panicking.rs:280:22
  10:     0x7fa8e5eefa98 - std::panicking::panic_hook_with_disk_dump::h747314e0eb3083d0
                               at /rustc/8142a319ed5c1d1f96e5a1881a6546e463b77c8f/library/std/src/panicking.rs:307:9
  11:     0x7fa8e4cc4229 - <rustc_driver_impl[6872457824a876c8]::install_ice_hook::{closure#0} as core[468698755226bf15]::ops::function::FnOnce<(&core[468698755226bf15]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  12:     0x7fa8e5ef0693 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h28a1f6f4d204892e
                               at /rustc/8142a319ed5c1d1f96e5a1881a6546e463b77c8f/library/alloc/src/boxed.rs:2021:9
  13:     0x7fa8e5ef0693 - std::panicking::rust_panic_with_hook::hcbc867ec0eddd0c3
                               at /rustc/8142a319ed5c1d1f96e5a1881a6546e463b77c8f/library/std/src/panicking.rs:757:13
  14:     0x7fa8e5ef0411 - std::panicking::begin_panic_handler::{{closure}}::h3c9eb8c1fbf3ea52
                               at /rustc/8142a319ed5c1d1f96e5a1881a6546e463b77c8f/library/std/src/panicking.rs:631:13
  15:     0x7fa8e5eed426 - std::sys_common::backtrace::__rust_end_short_backtrace::hd2324a4c2985e4f3
                               at /rustc/8142a319ed5c1d1f96e5a1881a6546e463b77c8f/library/std/src/sys_common/backtrace.rs:170:18
  16:     0x7fa8e5ef0152 - rust_begin_unwind
                               at /rustc/8142a319ed5c1d1f96e5a1881a6546e463b77c8f/library/std/src/panicking.rs:619:5
  17:     0x7fa8e5f4f505 - core::panicking::panic_fmt::h583d94a3776bd1d2
                               at /rustc/8142a319ed5c1d1f96e5a1881a6546e463b77c8f/library/core/src/panicking.rs:72:14
  18:     0x7fa8e317f798 - <rustc_hir_typeck[ee6c5a539d897b28]::writeback::WritebackCx as rustc_hir[3c4396802e23c779]::intravisit::Visitor>::visit_expr
  19:     0x7fa8e317dd7b - <rustc_hir_typeck[ee6c5a539d897b28]::writeback::WritebackCx as rustc_hir[3c4396802e23c779]::intravisit::Visitor>::visit_expr
  20:     0x7fa8e3186fc9 - <rustc_hir_typeck[ee6c5a539d897b28]::writeback::WritebackCx as rustc_hir[3c4396802e23c779]::intravisit::Visitor>::visit_local
  21:     0x7fa8e31851c5 - <rustc_hir_typeck[ee6c5a539d897b28]::writeback::WritebackCx as rustc_hir[3c4396802e23c779]::intravisit::Visitor>::visit_block
  22:     0x7fa8e317d82c - <rustc_hir_typeck[ee6c5a539d897b28]::writeback::WritebackCx as rustc_hir[3c4396802e23c779]::intravisit::Visitor>::visit_expr
  23:     0x7fa8e3d63714 - <rustc_hir_typeck[ee6c5a539d897b28]::fn_ctxt::FnCtxt>::resolve_type_vars_in_body
  24:     0x7fa8e3d527f3 - rustc_hir_typeck[ee6c5a539d897b28]::typeck
  25:     0x7fa8e2dcad2e - rustc_query_impl[faff4f3901442888]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[faff4f3901442888]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[a5aa27c2964d564a]::query::erase::Erased<[u8; 8usize]>>
  26:     0x7fa8e2dcacfe - <rustc_query_impl[faff4f3901442888]::query_impl::typeck::dynamic_query::{closure#2} as core[468698755226bf15]::ops::function::FnOnce<(rustc_middle[a5aa27c2964d564a]::ty::context::TyCtxt, rustc_span[3e6de59a27d5529]::def_id::LocalDefId)>>::call_once
  27:     0x7fa8e2ea6618 - rustc_query_system[ed0180b2c936d7a1]::query::plumbing::try_execute_query::<rustc_query_impl[faff4f3901442888]::DynamicConfig<rustc_query_system[ed0180b2c936d7a1]::query::caches::VecCache<rustc_span[3e6de59a27d5529]::def_id::LocalDefId, rustc_middle[a5aa27c2964d564a]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[faff4f3901442888]::plumbing::QueryCtxt, false>
  28:     0x7fa8e4652451 - rustc_query_impl[faff4f3901442888]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
  29:     0x7fa8e4051c6f - rustc_data_structures[b8028d6e438e0bab]::sync::parallel::disabled::par_for_each_in::<&[rustc_span[3e6de59a27d5529]::def_id::LocalDefId], <rustc_middle[a5aa27c2964d564a]::hir::map::Map>::par_body_owners<rustc_hir_analysis[93ddd5062bb3fb28]::check_crate::{closure#7}>::{closure#0}>
  30:     0x7fa8e4050f13 - rustc_hir_analysis[93ddd5062bb3fb28]::check_crate
  31:     0x7fa8e404a062 - rustc_interface[89ffa3a3953ed9b2]::passes::analysis
  32:     0x7fa8e410ecfa - rustc_query_impl[faff4f3901442888]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[faff4f3901442888]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[a5aa27c2964d564a]::query::erase::Erased<[u8; 1usize]>>
  33:     0x7fa8e410ece9 - <rustc_query_impl[faff4f3901442888]::query_impl::analysis::dynamic_query::{closure#2} as core[468698755226bf15]::ops::function::FnOnce<(rustc_middle[a5aa27c2964d564a]::ty::context::TyCtxt, ())>>::call_once
  34:     0x7fa8e441d1d4 - rustc_query_system[ed0180b2c936d7a1]::query::plumbing::try_execute_query::<rustc_query_impl[faff4f3901442888]::DynamicConfig<rustc_query_system[ed0180b2c936d7a1]::query::caches::SingleCache<rustc_middle[a5aa27c2964d564a]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[faff4f3901442888]::plumbing::QueryCtxt, false>
  35:     0x7fa8e441cf49 - rustc_query_impl[faff4f3901442888]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  36:     0x7fa8e41f9e63 - <rustc_middle[a5aa27c2964d564a]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[6872457824a876c8]::run_compiler::{closure#1}::{closure#2}::{closure#6}, core[468698755226bf15]::result::Result<(), rustc_span[3e6de59a27d5529]::ErrorGuaranteed>>
  37:     0x7fa8e41f8f58 - <rustc_interface[89ffa3a3953ed9b2]::interface::Compiler>::enter::<rustc_driver_impl[6872457824a876c8]::run_compiler::{closure#1}::{closure#2}, core[468698755226bf15]::result::Result<core[468698755226bf15]::option::Option<rustc_interface[89ffa3a3953ed9b2]::queries::Linker>, rustc_span[3e6de59a27d5529]::ErrorGuaranteed>>
  38:     0x7fa8e41f21a4 - std[1d99e526d3fccd95]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[89ffa3a3953ed9b2]::util::run_in_thread_with_globals<rustc_interface[89ffa3a3953ed9b2]::interface::run_compiler<core[468698755226bf15]::result::Result<(), rustc_span[3e6de59a27d5529]::ErrorGuaranteed>, rustc_driver_impl[6872457824a876c8]::run_compiler::{closure#1}>::{closure#0}, core[468698755226bf15]::result::Result<(), rustc_span[3e6de59a27d5529]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[468698755226bf15]::result::Result<(), rustc_span[3e6de59a27d5529]::ErrorGuaranteed>>
  39:     0x7fa8e41f18fe - <<std[1d99e526d3fccd95]::thread::Builder>::spawn_unchecked_<rustc_interface[89ffa3a3953ed9b2]::util::run_in_thread_with_globals<rustc_interface[89ffa3a3953ed9b2]::interface::run_compiler<core[468698755226bf15]::result::Result<(), rustc_span[3e6de59a27d5529]::ErrorGuaranteed>, rustc_driver_impl[6872457824a876c8]::run_compiler::{closure#1}>::{closure#0}, core[468698755226bf15]::result::Result<(), rustc_span[3e6de59a27d5529]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[468698755226bf15]::result::Result<(), rustc_span[3e6de59a27d5529]::ErrorGuaranteed>>::{closure#1} as core[468698755226bf15]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  40:     0x7fa8e5efb075 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::ha4104662ef3c5bbd
                               at /rustc/8142a319ed5c1d1f96e5a1881a6546e463b77c8f/library/alloc/src/boxed.rs:2007:9
  41:     0x7fa8e5efb075 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hb8d3ac4a3d377b23
                               at /rustc/8142a319ed5c1d1f96e5a1881a6546e463b77c8f/library/alloc/src/boxed.rs:2007:9
  42:     0x7fa8e5efb075 - std::sys::unix::thread::Thread::new::thread_start::h1cee3a3217d3e553
                               at /rustc/8142a319ed5c1d1f96e5a1881a6546e463b77c8f/library/std/src/sys/unix/thread.rs:108:17
  43:     0x7fa8e155c6db - start_thread
                               at /build/glibc-CVJwZb/glibc-2.27/nptl/pthread_create.c:463
  44:     0x7fa8e128561f - clone
                               at /build/glibc-CVJwZb/glibc-2.27/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95
  45:                0x0 - <unknown>


rustc version: 1.74.0-nightly (8142a319e 2023-09-13)
platform: x86_64-unknown-linux-gnu

query stack during panic:
#0 [typeck] type-checking `main`
#1 [analysis] running analysis passes on this crate
end of query stack

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

Probably duplicate of #115791

@compiler-errors
Copy link
Member

Yeah, this is a dupe!

@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Sep 14, 2023
bors added a commit to rust-lang-ci/rust that referenced this issue Sep 15, 2023
…ee1-dead

Fallback effects even if types also fallback

`||` is short circuiting, so if we do ty/int var fallback, we *don't* do effect fallback 😸

r? `@fee1-dead` or `@oli-obk`

Fixes rust-lang#115791
Fixes rust-lang#115842
@bors bors closed this as completed in ae9465f Sep 15, 2023
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. 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.

5 participants