Skip to content

ice: effects: parent also has host effect param? #113378

Closed
@matthiaskrgr

Description

@matthiaskrgr

Code

#![feature(const_trait_impl)]
#![feature(effects)]

trait Value {}

impl<T> const Value for T {
    const fn value() -> u32 {
        0
    }
}

Meta

rustc --version --verbose:

rustc 1.72.0-nightly (e4cd16100 2023-07-05)
binary: rustc
commit-hash: e4cd1610067501fa4d347eba7b18f77137dbbf48
commit-date: 2023-07-05
host: x86_64-unknown-linux-gnu
release: 1.72.0-nightly
LLVM version: 16.0.5

Error output

error[E0379]: functions in traits cannot be declared const
 --> treereduce.out:7:5
  |
7 |     const  fn value() -> u32 {
  |     ^^^^^ functions in traits cannot be const

error[E0407]: method `value` is not a member of trait `Value`
 --> treereduce.out:7:5
  |
7 | /     const  fn value() -> u32 {
8 | |         0
9 | |     }
  | |_____^ not a member of trait `Value`

error[E0601]: `main` function not found in crate `treereduce`
  --> treereduce.out:10:2
   |
10 | }
   |  ^ consider adding a `main` function to `treereduce.out`

error: const `impl` for trait `Value` which is not marked with `#[const_trait]`
 --> treereduce.out:6:15
  |
4 | trait Value {}
  | - help: mark `Value` as const: `#[const_trait]`
5 |
6 | impl<T> const Value for T {
  |               ^^^^^
  |
  = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
  = note: adding a non-const method body in the future would be a breaking change
Backtrace

error: internal compiler error: compiler/rustc_hir_analysis/src/collect/generics_of.rs:319:21: parent also has host effect param? index: 1, def: DefId(0:6 ~ treereduce[e3bb]::{impl#0}::value)

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/e4cd1610067501fa4d347eba7b18f77137dbbf48/compiler/rustc_errors/src/lib.rs:1651:9
stack backtrace:
   0:     0x7f3658763a81 - std::backtrace_rs::backtrace::libunwind::trace::hd0180fafc3f67189
                               at /rustc/e4cd1610067501fa4d347eba7b18f77137dbbf48/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f3658763a81 - std::backtrace_rs::backtrace::trace_unsynchronized::h5f5f542cfcd3ea93
                               at /rustc/e4cd1610067501fa4d347eba7b18f77137dbbf48/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f3658763a81 - std::sys_common::backtrace::_print_fmt::h58fe9485d729332b
                               at /rustc/e4cd1610067501fa4d347eba7b18f77137dbbf48/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f3658763a81 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h892fa574703406ce
                               at /rustc/e4cd1610067501fa4d347eba7b18f77137dbbf48/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f36587c9d8f - core::fmt::rt::Argument::fmt::h9323d9ac1296ca86
                               at /rustc/e4cd1610067501fa4d347eba7b18f77137dbbf48/library/core/src/fmt/rt.rs:138:9
   5:     0x7f36587c9d8f - core::fmt::write::h7b3311fc7bec7011
                               at /rustc/e4cd1610067501fa4d347eba7b18f77137dbbf48/library/core/src/fmt/mod.rs:1094:21
   6:     0x7f36587564c7 - std::io::Write::write_fmt::hf0bd33b3cf0f8fc8
                               at /rustc/e4cd1610067501fa4d347eba7b18f77137dbbf48/library/std/src/io/mod.rs:1714:15
   7:     0x7f3658763895 - std::sys_common::backtrace::_print::h05e7ce29169ad453
                               at /rustc/e4cd1610067501fa4d347eba7b18f77137dbbf48/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f3658763895 - std::sys_common::backtrace::print::h259bd490e3a5f495
                               at /rustc/e4cd1610067501fa4d347eba7b18f77137dbbf48/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f3658766673 - std::panicking::default_hook::{{closure}}::h60419100c25d1f9e
                               at /rustc/e4cd1610067501fa4d347eba7b18f77137dbbf48/library/std/src/panicking.rs:269:22
  10:     0x7f3658766404 - std::panicking::default_hook::h5458ac0b23f9b258
                               at /rustc/e4cd1610067501fa4d347eba7b18f77137dbbf48/library/std/src/panicking.rs:288:9
  11:     0x7f365ba3634b - rustc_driver_impl[e2bfb106dcd1f64f]::install_ice_hook::{closure#0}
  12:     0x7f3658766e9e - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h4fc06bcacf328e1a
                               at /rustc/e4cd1610067501fa4d347eba7b18f77137dbbf48/library/alloc/src/boxed.rs:2024:9
  13:     0x7f3658766e9e - std::panicking::rust_panic_with_hook::hc4b8011c5070ed88
                               at /rustc/e4cd1610067501fa4d347eba7b18f77137dbbf48/library/std/src/panicking.rs:709:13
  14:     0x7f365bff5291 - std[c4949d010b2b12f5]::panicking::begin_panic::<rustc_errors[6daf178d4ec2233]::ExplicitBug>::{closure#0}
  15:     0x7f365bff36e6 - std[c4949d010b2b12f5]::sys_common::backtrace::__rust_end_short_backtrace::<std[c4949d010b2b12f5]::panicking::begin_panic<rustc_errors[6daf178d4ec2233]::ExplicitBug>::{closure#0}, !>
  16:     0x7f365bff35a6 - std[c4949d010b2b12f5]::panicking::begin_panic::<rustc_errors[6daf178d4ec2233]::ExplicitBug>
  17:     0x7f365bf558b4 - <rustc_errors[6daf178d4ec2233]::HandlerInner>::bug::<alloc[ff37fbd0c789fff0]::string::String>
  18:     0x7f365bf55736 - <rustc_errors[6daf178d4ec2233]::Handler>::bug::<alloc[ff37fbd0c789fff0]::string::String>
  19:     0x7f365bf652fc - rustc_middle[36f410a133de2eee]::util::bug::opt_span_bug_fmt::<rustc_span[ffa356b4eef30eb1]::span_encoding::Span>::{closure#0}
  20:     0x7f365bf64a0a - rustc_middle[36f410a133de2eee]::ty::context::tls::with_opt::<rustc_middle[36f410a133de2eee]::util::bug::opt_span_bug_fmt<rustc_span[ffa356b4eef30eb1]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7f365bf649da - rustc_middle[36f410a133de2eee]::ty::context::tls::with_context_opt::<rustc_middle[36f410a133de2eee]::ty::context::tls::with_opt<rustc_middle[36f410a133de2eee]::util::bug::opt_span_bug_fmt<rustc_span[ffa356b4eef30eb1]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7f365a16610d - rustc_middle[36f410a133de2eee]::util::bug::bug_fmt
  23:     0x7f365a3742a6 - rustc_hir_analysis[efec7ea34622ed25]::collect::generics_of::generics_of
  24:     0x7f365a370c58 - rustc_query_impl[b274d6131f7b1f90]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b274d6131f7b1f90]::query_impl::generics_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[36f410a133de2eee]::query::erase::Erased<[u8; 8usize]>>
  25:     0x7f365a370bf0 - <rustc_query_impl[b274d6131f7b1f90]::query_impl::generics_of::dynamic_query::{closure#2} as core[1877eeee917502d9]::ops::function::FnOnce<(rustc_middle[36f410a133de2eee]::ty::context::TyCtxt, rustc_span[ffa356b4eef30eb1]::def_id::DefId)>>::call_once
  26:     0x7f3659a6ad65 - rustc_query_system[d3399df1ed0f61e2]::query::plumbing::try_execute_query::<rustc_query_impl[b274d6131f7b1f90]::DynamicConfig<rustc_query_system[d3399df1ed0f61e2]::query::caches::DefaultCache<rustc_span[ffa356b4eef30eb1]::def_id::DefId, rustc_middle[36f410a133de2eee]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[b274d6131f7b1f90]::plumbing::QueryCtxt, false>
  27:     0x7f365b3b6ed3 - rustc_query_impl[b274d6131f7b1f90]::query_impl::generics_of::get_query_non_incr::__rust_end_short_backtrace
  28:     0x7f365a0d5e5b - <rustc_hir_analysis[efec7ea34622ed25]::collect::CollectItemTypesVisitor as rustc_hir[7d2fcfc22a87f39c]::intravisit::Visitor>::visit_impl_item
  29:     0x7f365a0d4e0e - <rustc_middle[36f410a133de2eee]::hir::map::Map>::visit_item_likes_in_module::<rustc_hir_analysis[efec7ea34622ed25]::collect::CollectItemTypesVisitor>
  30:     0x7f365a0d4c8c - rustc_hir_analysis[efec7ea34622ed25]::collect::collect_mod_item_types
  31:     0x7f365a69fb4c - rustc_query_impl[b274d6131f7b1f90]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b274d6131f7b1f90]::query_impl::collect_mod_item_types::dynamic_query::{closure#2}::{closure#0}, rustc_middle[36f410a133de2eee]::query::erase::Erased<[u8; 0usize]>>
  32:     0x7f365a69fb2e - <rustc_query_impl[b274d6131f7b1f90]::query_impl::collect_mod_item_types::dynamic_query::{closure#2} as core[1877eeee917502d9]::ops::function::FnOnce<(rustc_middle[36f410a133de2eee]::ty::context::TyCtxt, rustc_span[ffa356b4eef30eb1]::def_id::LocalDefId)>>::call_once
  33:     0x7f365a18a7df - rustc_query_system[d3399df1ed0f61e2]::query::plumbing::try_execute_query::<rustc_query_impl[b274d6131f7b1f90]::DynamicConfig<rustc_query_system[d3399df1ed0f61e2]::query::caches::VecCache<rustc_span[ffa356b4eef30eb1]::def_id::LocalDefId, rustc_middle[36f410a133de2eee]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[b274d6131f7b1f90]::plumbing::QueryCtxt, false>
  34:     0x7f365b37f974 - rustc_query_impl[b274d6131f7b1f90]::query_impl::collect_mod_item_types::get_query_non_incr::__rust_end_short_backtrace
  35:     0x7f365ae79147 - <rustc_middle[36f410a133de2eee]::hir::map::Map>::for_each_module::<rustc_hir_analysis[efec7ea34622ed25]::check_crate::{closure#0}::{closure#0}::{closure#0}>
  36:     0x7f365ae78d82 - <rustc_session[9ee8792a77577862]::session::Session>::track_errors::<rustc_hir_analysis[efec7ea34622ed25]::check_crate::{closure#0}, ()>
  37:     0x7f365ae77561 - rustc_hir_analysis[efec7ea34622ed25]::check_crate
  38:     0x7f365ae6e64a - rustc_interface[b03e5b36acd0a493]::passes::analysis
  39:     0x7f365aef958a - rustc_query_impl[b274d6131f7b1f90]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b274d6131f7b1f90]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[36f410a133de2eee]::query::erase::Erased<[u8; 1usize]>>
  40:     0x7f365aef9579 - <rustc_query_impl[b274d6131f7b1f90]::query_impl::analysis::dynamic_query::{closure#2} as core[1877eeee917502d9]::ops::function::FnOnce<(rustc_middle[36f410a133de2eee]::ty::context::TyCtxt, ())>>::call_once
  41:     0x7f365b092e88 - rustc_query_system[d3399df1ed0f61e2]::query::plumbing::try_execute_query::<rustc_query_impl[b274d6131f7b1f90]::DynamicConfig<rustc_query_system[d3399df1ed0f61e2]::query::caches::SingleCache<rustc_middle[36f410a133de2eee]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[b274d6131f7b1f90]::plumbing::QueryCtxt, false>
  42:     0x7f365b092c59 - rustc_query_impl[b274d6131f7b1f90]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  43:     0x7f365ac62545 - <rustc_middle[36f410a133de2eee]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[e2bfb106dcd1f64f]::run_compiler::{closure#1}::{closure#2}::{closure#4}, core[1877eeee917502d9]::result::Result<(), rustc_span[ffa356b4eef30eb1]::ErrorGuaranteed>>
  44:     0x7f365ac61b72 - <rustc_interface[b03e5b36acd0a493]::interface::Compiler>::enter::<rustc_driver_impl[e2bfb106dcd1f64f]::run_compiler::{closure#1}::{closure#2}, core[1877eeee917502d9]::result::Result<core[1877eeee917502d9]::option::Option<rustc_interface[b03e5b36acd0a493]::queries::Linker>, rustc_span[ffa356b4eef30eb1]::ErrorGuaranteed>>
  45:     0x7f365ac58885 - rustc_span[ffa356b4eef30eb1]::set_source_map::<core[1877eeee917502d9]::result::Result<(), rustc_span[ffa356b4eef30eb1]::ErrorGuaranteed>, rustc_interface[b03e5b36acd0a493]::interface::run_compiler<core[1877eeee917502d9]::result::Result<(), rustc_span[ffa356b4eef30eb1]::ErrorGuaranteed>, rustc_driver_impl[e2bfb106dcd1f64f]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  46:     0x7f365ac582f6 - <scoped_tls[d5e856d8f723ce14]::ScopedKey<rustc_span[ffa356b4eef30eb1]::SessionGlobals>>::set::<rustc_interface[b03e5b36acd0a493]::interface::run_compiler<core[1877eeee917502d9]::result::Result<(), rustc_span[ffa356b4eef30eb1]::ErrorGuaranteed>, rustc_driver_impl[e2bfb106dcd1f64f]::run_compiler::{closure#1}>::{closure#0}, core[1877eeee917502d9]::result::Result<(), rustc_span[ffa356b4eef30eb1]::ErrorGuaranteed>>
  47:     0x7f365ac578bc - std[c4949d010b2b12f5]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[b03e5b36acd0a493]::util::run_in_thread_pool_with_globals<rustc_interface[b03e5b36acd0a493]::interface::run_compiler<core[1877eeee917502d9]::result::Result<(), rustc_span[ffa356b4eef30eb1]::ErrorGuaranteed>, rustc_driver_impl[e2bfb106dcd1f64f]::run_compiler::{closure#1}>::{closure#0}, core[1877eeee917502d9]::result::Result<(), rustc_span[ffa356b4eef30eb1]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[1877eeee917502d9]::result::Result<(), rustc_span[ffa356b4eef30eb1]::ErrorGuaranteed>>
  48:     0x7f365ac57685 - <<std[c4949d010b2b12f5]::thread::Builder>::spawn_unchecked_<rustc_interface[b03e5b36acd0a493]::util::run_in_thread_pool_with_globals<rustc_interface[b03e5b36acd0a493]::interface::run_compiler<core[1877eeee917502d9]::result::Result<(), rustc_span[ffa356b4eef30eb1]::ErrorGuaranteed>, rustc_driver_impl[e2bfb106dcd1f64f]::run_compiler::{closure#1}>::{closure#0}, core[1877eeee917502d9]::result::Result<(), rustc_span[ffa356b4eef30eb1]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[1877eeee917502d9]::result::Result<(), rustc_span[ffa356b4eef30eb1]::ErrorGuaranteed>>::{closure#1} as core[1877eeee917502d9]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  49:     0x7f3658771315 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::ha34cb32f4acd27b7
                               at /rustc/e4cd1610067501fa4d347eba7b18f77137dbbf48/library/alloc/src/boxed.rs:2010:9
  50:     0x7f3658771315 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h309fb4796a356ecf
                               at /rustc/e4cd1610067501fa4d347eba7b18f77137dbbf48/library/alloc/src/boxed.rs:2010:9
  51:     0x7f3658771315 - std::sys::unix::thread::Thread::new::thread_start::h947cced02a86e329
                               at /rustc/e4cd1610067501fa4d347eba7b18f77137dbbf48/library/std/src/sys/unix/thread.rs:108:17
  52:     0x7f365850444b - <unknown>
  53:     0x7f3658587e40 - <unknown>
  54:                0x0 - <unknown>

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-nightly (e4cd16100 2023-07-05) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [generics_of] computing generics of `<impl at treereduce.out:6:1: 6:26>::value`
#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 5 previous errors

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

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.F-effects`#![feature(effects)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.requires-nightlyThis issue requires a nightly compiler in some way.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions