Skip to content

ICE: associated_type_for_effects: Defid .. should be Trait or Impl but is TraitAlias #127139

Closed
@matthiaskrgr

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

#![feature(effects)]
 ;

trait io =  const  io     + ;

original:

const  io


trait dyn =  const  io  + ;

trait io =  const  io     + ;

Version information

rustc 1.81.0-nightly (ba1d7f4a0 2024-06-29)
binary: rustc
commit-hash: ba1d7f4a083e6402679105115ded645512a7aea8
commit-date: 2024-06-29
host: x86_64-unknown-linux-gnu
release: 1.81.0-nightly
LLVM version: 18.1.7

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zcrate-attr=feature(effects)

Program output

error: expected item, found `;`
 --> /tmp/icemaker_global_tempdir.JOmnMv0w5JxT/rustc_testrunner_tmpdir_reporting.SAR9KIabk7aZ/mvce.rs:1:2
  |
1 |  ;
  |  ^ help: remove this semicolon

error[E0658]: const trait impls are experimental
 --> /tmp/icemaker_global_tempdir.JOmnMv0w5JxT/rustc_testrunner_tmpdir_reporting.SAR9KIabk7aZ/mvce.rs:3:13
  |
3 | trait io =  const  io     + ;
  |             ^^^^^
  |
  = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
  = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
  = note: this compiler was built on 2024-06-29; consider upgrading it if it is out of date

error[E0658]: trait aliases are experimental
 --> /tmp/icemaker_global_tempdir.JOmnMv0w5JxT/rustc_testrunner_tmpdir_reporting.SAR9KIabk7aZ/mvce.rs:3:1
  |
3 | trait io =  const  io     + ;
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #41517 <https://github.com/rust-lang/rust/issues/41517> for more information
  = help: add `#![feature(trait_alias)]` to the crate attributes to enable
  = note: this compiler was built on 2024-06-29; consider upgrading it if it is out of date

warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
 --> <crate attribute>:1:9
  |
1 | feature(effects)
  |         ^^^^^^^
  |
  = note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
  = note: `#[warn(incomplete_features)]` on by default

warning: trait alias `io` should have an upper camel case name
 --> /tmp/icemaker_global_tempdir.JOmnMv0w5JxT/rustc_testrunner_tmpdir_reporting.SAR9KIabk7aZ/mvce.rs:3:7
  |
3 | trait io =  const  io     + ;
  |       ^^ help: convert the identifier to upper camel case (notice the capitalization): `Io`
  |
  = note: `#[warn(non_camel_case_types)]` on by default

error[E0601]: `main` function not found in crate `mvce`
 --> /tmp/icemaker_global_tempdir.JOmnMv0w5JxT/rustc_testrunner_tmpdir_reporting.SAR9KIabk7aZ/mvce.rs:3:30
  |
3 | trait io =  const  io     + ;
  |                              ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.JOmnMv0w5JxT/rustc_testrunner_tmpdir_reporting.SAR9KIabk7aZ/mvce.rs`

error: `const` can only be applied to `#[const_trait]` traits
 --> /tmp/icemaker_global_tempdir.JOmnMv0w5JxT/rustc_testrunner_tmpdir_reporting.SAR9KIabk7aZ/mvce.rs:3:20
  |
3 | trait io =  const  io     + ;
  |                    ^^

error: internal compiler error: compiler/rustc_ty_utils/src/assoc.rs:267:21: associated_type_for_effects: DefId(0:3 ~ mvce[9951]::io) should be Trait or Impl but is TraitAlias

thread 'rustc' panicked at compiler/rustc_ty_utils/src/assoc.rs:267:21:
Box<dyn Any>
stack backtrace:
   0:     0x7edeb8e832b5 - std::backtrace_rs::backtrace::libunwind::trace::h9fec972da723f824
                               at /rustc/ba1d7f4a083e6402679105115ded645512a7aea8/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
   1:     0x7edeb8e832b5 - std::backtrace_rs::backtrace::trace_unsynchronized::h6750dc8e20aabcad
                               at /rustc/ba1d7f4a083e6402679105115ded645512a7aea8/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7edeb8e832b5 - std::sys::backtrace::_print_fmt::h112c52e5e2edb557
                               at /rustc/ba1d7f4a083e6402679105115ded645512a7aea8/library/std/src/sys/backtrace.rs:68:5
   3:     0x7edeb8e832b5 - <std::sys::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h4713d06d34163f46
                               at /rustc/ba1d7f4a083e6402679105115ded645512a7aea8/library/std/src/sys/backtrace.rs:44:22
   4:     0x7edeb8ed2d9b - core::fmt::rt::Argument::fmt::h919dfde74ebabb2a
                               at /rustc/ba1d7f4a083e6402679105115ded645512a7aea8/library/core/src/fmt/rt.rs:173:76
   5:     0x7edeb8ed2d9b - core::fmt::write::h63ad278710fcf618
                               at /rustc/ba1d7f4a083e6402679105115ded645512a7aea8/library/core/src/fmt/mod.rs:1174:21
   6:     0x7edeb8e77e9f - std::io::Write::write_fmt::h48f75cc65a268f9a
                               at /rustc/ba1d7f4a083e6402679105115ded645512a7aea8/library/std/src/io/mod.rs:1835:15
   7:     0x7edeb8e8308e - std::sys::backtrace::_print::ha47bd77a3336440c
                               at /rustc/ba1d7f4a083e6402679105115ded645512a7aea8/library/std/src/sys/backtrace.rs:47:5
   8:     0x7edeb8e8308e - std::sys::backtrace::print::hd71c23c2433456bf
                               at /rustc/ba1d7f4a083e6402679105115ded645512a7aea8/library/std/src/sys/backtrace.rs:34:9
   9:     0x7edeb8e859d9 - std::panicking::default_hook::{{closure}}::ha7861419c6fed626
  10:     0x7edeb8e8577c - std::panicking::default_hook::hdb522e40b65d9458
                               at /rustc/ba1d7f4a083e6402679105115ded645512a7aea8/library/std/src/panicking.rs:292:9
  11:     0x7edeb55b18a0 - std[ee1287dda0decb26]::panicking::update_hook::<alloc[ebf157a0a0183114]::boxed::Box<rustc_driver_impl[b3016c550210facb]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7edeb8e862af - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h8a54893ded3fcd8c
                               at /rustc/ba1d7f4a083e6402679105115ded645512a7aea8/library/alloc/src/boxed.rs:2078:9
  13:     0x7edeb8e862af - std::panicking::rust_panic_with_hook::h79c7320e6dd14ff0
                               at /rustc/ba1d7f4a083e6402679105115ded645512a7aea8/library/std/src/panicking.rs:804:13
  14:     0x7edeb55eb971 - std[ee1287dda0decb26]::panicking::begin_panic::<rustc_errors[d3621d86cd33ef55]::ExplicitBug>::{closure#0}
  15:     0x7edeb55ded56 - std[ee1287dda0decb26]::sys::backtrace::__rust_end_short_backtrace::<std[ee1287dda0decb26]::panicking::begin_panic<rustc_errors[d3621d86cd33ef55]::ExplicitBug>::{closure#0}, !>
  16:     0x7edeb55ded06 - std[ee1287dda0decb26]::panicking::begin_panic::<rustc_errors[d3621d86cd33ef55]::ExplicitBug>
  17:     0x7edeb55f4761 - <rustc_errors[d3621d86cd33ef55]::diagnostic::BugAbort as rustc_errors[d3621d86cd33ef55]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  18:     0x7edeb5be82bc - rustc_middle[375bbde5f17fb8ea]::util::bug::opt_span_bug_fmt::<rustc_span[a32535cd2922901f]::span_encoding::Span>::{closure#0}
  19:     0x7edeb5bcea8a - rustc_middle[375bbde5f17fb8ea]::ty::context::tls::with_opt::<rustc_middle[375bbde5f17fb8ea]::util::bug::opt_span_bug_fmt<rustc_span[a32535cd2922901f]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  20:     0x7edeb5bce92b - rustc_middle[375bbde5f17fb8ea]::ty::context::tls::with_context_opt::<rustc_middle[375bbde5f17fb8ea]::ty::context::tls::with_opt<rustc_middle[375bbde5f17fb8ea]::util::bug::opt_span_bug_fmt<rustc_span[a32535cd2922901f]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  21:     0x7edeb3a11960 - rustc_middle[375bbde5f17fb8ea]::util::bug::bug_fmt
  22:     0x7edeb6c5459d - rustc_ty_utils[233de4e6a9d65809]::assoc::associated_type_for_effects
  23:     0x7edeb6c5070f - rustc_query_impl[e193fcc3be99e64a]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[e193fcc3be99e64a]::query_impl::associated_type_for_effects::dynamic_query::{closure#2}::{closure#0}, rustc_middle[375bbde5f17fb8ea]::query::erase::Erased<[u8; 8usize]>>
  24:     0x7edeb6b20ce0 - rustc_query_system[ab5481f6c869ba71]::query::plumbing::try_execute_query::<rustc_query_impl[e193fcc3be99e64a]::DynamicConfig<rustc_query_system[ab5481f6c869ba71]::query::caches::DefIdCache<rustc_middle[375bbde5f17fb8ea]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[e193fcc3be99e64a]::plumbing::QueryCtxt, false>
  25:     0x7edeb6b1bb46 - rustc_query_impl[e193fcc3be99e64a]::query_impl::associated_type_for_effects::get_query_non_incr::__rust_end_short_backtrace
  26:     0x7edeb700f440 - rustc_middle[375bbde5f17fb8ea]::query::plumbing::query_get_at::<rustc_query_system[ab5481f6c869ba71]::query::caches::DefIdCache<rustc_middle[375bbde5f17fb8ea]::query::erase::Erased<[u8; 8usize]>>>
  27:     0x7edeb6ecda9c - <dyn rustc_hir_analysis[190a10ac9c7209da]::hir_ty_lowering::HirTyLowerer>::lower_poly_trait_ref
  28:     0x7edeb7199515 - <dyn rustc_hir_analysis[190a10ac9c7209da]::hir_ty_lowering::HirTyLowerer>::lower_mono_bounds
  29:     0x7edeb7198dfc - rustc_hir_analysis[190a10ac9c7209da]::collect::predicates_of::implied_predicates_with_filter
  30:     0x7edeb71c6046 - rustc_hir_analysis[190a10ac9c7209da]::collect::predicates_of::explicit_implied_predicates_of
  31:     0x7edeb7631331 - rustc_query_impl[e193fcc3be99e64a]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[e193fcc3be99e64a]::query_impl::explicit_implied_predicates_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[375bbde5f17fb8ea]::query::erase::Erased<[u8; 32usize]>>
  32:     0x7edeb76312e5 - <rustc_query_impl[e193fcc3be99e64a]::query_impl::explicit_implied_predicates_of::dynamic_query::{closure#2} as core[a458eee17fffdec1]::ops::function::FnOnce<(rustc_middle[375bbde5f17fb8ea]::ty::context::TyCtxt, rustc_span[a32535cd2922901f]::def_id::DefId)>>::call_once
  33:     0x7edeb6ebf383 - rustc_query_system[ab5481f6c869ba71]::query::plumbing::try_execute_query::<rustc_query_impl[e193fcc3be99e64a]::DynamicConfig<rustc_query_system[ab5481f6c869ba71]::query::caches::DefIdCache<rustc_middle[375bbde5f17fb8ea]::query::erase::Erased<[u8; 32usize]>>, false, false, false>, rustc_query_impl[e193fcc3be99e64a]::plumbing::QueryCtxt, false>
  34:     0x7edeb6ebc779 - rustc_query_impl[e193fcc3be99e64a]::query_impl::explicit_implied_predicates_of::get_query_non_incr::__rust_end_short_backtrace
  35:     0x7edeb74924f8 - rustc_middle[375bbde5f17fb8ea]::query::plumbing::query_get_at::<rustc_query_system[ab5481f6c869ba71]::query::caches::DefIdCache<rustc_middle[375bbde5f17fb8ea]::query::erase::Erased<[u8; 32usize]>>>
  36:     0x7edeb6eaf1d6 - <rustc_hir_analysis[190a10ac9c7209da]::collect::CollectItemTypesVisitor as rustc_hir[9cb815a008d04811]::intravisit::Visitor>::visit_item
  37:     0x7edeb44360ed - rustc_hir_analysis[190a10ac9c7209da]::check::wfcheck::check_well_formed
  38:     0x7edeb7039c69 - rustc_query_impl[e193fcc3be99e64a]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[e193fcc3be99e64a]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[375bbde5f17fb8ea]::query::erase::Erased<[u8; 1usize]>>
  39:     0x7edeb7039ef5 - rustc_query_system[ab5481f6c869ba71]::query::plumbing::try_execute_query::<rustc_query_impl[e193fcc3be99e64a]::DynamicConfig<rustc_query_system[ab5481f6c869ba71]::query::caches::VecCache<rustc_hir[9cb815a008d04811]::hir_id::OwnerId, rustc_middle[375bbde5f17fb8ea]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[e193fcc3be99e64a]::plumbing::QueryCtxt, false>
  40:     0x7edeb7039c46 - rustc_query_impl[e193fcc3be99e64a]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
  41:     0x7edeb703a90c - rustc_hir_analysis[190a10ac9c7209da]::check::wfcheck::check_mod_type_wf
  42:     0x7edeb703a759 - rustc_query_impl[e193fcc3be99e64a]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[e193fcc3be99e64a]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[375bbde5f17fb8ea]::query::erase::Erased<[u8; 1usize]>>
  43:     0x7edeb7826778 - rustc_query_system[ab5481f6c869ba71]::query::plumbing::try_execute_query::<rustc_query_impl[e193fcc3be99e64a]::DynamicConfig<rustc_query_system[ab5481f6c869ba71]::query::caches::DefaultCache<rustc_span[a32535cd2922901f]::def_id::LocalModDefId, rustc_middle[375bbde5f17fb8ea]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[e193fcc3be99e64a]::plumbing::QueryCtxt, false>
  44:     0x7edeb7826527 - rustc_query_impl[e193fcc3be99e64a]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
  45:     0x7edeb6c42523 - rustc_hir_analysis[190a10ac9c7209da]::check_crate
  46:     0x7edeb7145455 - rustc_interface[ab25a569cec44e98]::passes::analysis
  47:     0x7edeb7145015 - rustc_query_impl[e193fcc3be99e64a]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[e193fcc3be99e64a]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[375bbde5f17fb8ea]::query::erase::Erased<[u8; 1usize]>>
  48:     0x7edeb781c2e5 - rustc_query_system[ab5481f6c869ba71]::query::plumbing::try_execute_query::<rustc_query_impl[e193fcc3be99e64a]::DynamicConfig<rustc_query_system[ab5481f6c869ba71]::query::caches::SingleCache<rustc_middle[375bbde5f17fb8ea]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[e193fcc3be99e64a]::plumbing::QueryCtxt, false>
  49:     0x7edeb781c04f - rustc_query_impl[e193fcc3be99e64a]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  50:     0x7edeb775037f - rustc_interface[ab25a569cec44e98]::interface::run_compiler::<core[a458eee17fffdec1]::result::Result<(), rustc_span[a32535cd2922901f]::ErrorGuaranteed>, rustc_driver_impl[b3016c550210facb]::run_compiler::{closure#0}>::{closure#1}
  51:     0x7edeb76dc649 - std[ee1287dda0decb26]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[ab25a569cec44e98]::util::run_in_thread_with_globals<rustc_interface[ab25a569cec44e98]::util::run_in_thread_pool_with_globals<rustc_interface[ab25a569cec44e98]::interface::run_compiler<core[a458eee17fffdec1]::result::Result<(), rustc_span[a32535cd2922901f]::ErrorGuaranteed>, rustc_driver_impl[b3016c550210facb]::run_compiler::{closure#0}>::{closure#1}, core[a458eee17fffdec1]::result::Result<(), rustc_span[a32535cd2922901f]::ErrorGuaranteed>>::{closure#0}, core[a458eee17fffdec1]::result::Result<(), rustc_span[a32535cd2922901f]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[a458eee17fffdec1]::result::Result<(), rustc_span[a32535cd2922901f]::ErrorGuaranteed>>
  52:     0x7edeb76dc3fa - <<std[ee1287dda0decb26]::thread::Builder>::spawn_unchecked_<rustc_interface[ab25a569cec44e98]::util::run_in_thread_with_globals<rustc_interface[ab25a569cec44e98]::util::run_in_thread_pool_with_globals<rustc_interface[ab25a569cec44e98]::interface::run_compiler<core[a458eee17fffdec1]::result::Result<(), rustc_span[a32535cd2922901f]::ErrorGuaranteed>, rustc_driver_impl[b3016c550210facb]::run_compiler::{closure#0}>::{closure#1}, core[a458eee17fffdec1]::result::Result<(), rustc_span[a32535cd2922901f]::ErrorGuaranteed>>::{closure#0}, core[a458eee17fffdec1]::result::Result<(), rustc_span[a32535cd2922901f]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[a458eee17fffdec1]::result::Result<(), rustc_span[a32535cd2922901f]::ErrorGuaranteed>>::{closure#2} as core[a458eee17fffdec1]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  53:     0x7edeb8e9010b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hc6d49d49179bb535
                               at /rustc/ba1d7f4a083e6402679105115ded645512a7aea8/library/alloc/src/boxed.rs:2064:9
  54:     0x7edeb8e9010b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h7270f16d3abba4aa
                               at /rustc/ba1d7f4a083e6402679105115ded645512a7aea8/library/alloc/src/boxed.rs:2064:9
  55:     0x7edeb8e9010b - std::sys::pal::unix::thread::Thread::new::thread_start::h3929f25d671aa35f
                               at /rustc/ba1d7f4a083e6402679105115ded645512a7aea8/library/std/src/sys/pal/unix/thread.rs:108:17
  56:     0x7edeb20a6ded - <unknown>
  57:     0x7edeb212a0dc - <unknown>
  58:                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: please make sure that you have updated to the latest nightly

note: rustc 1.81.0-nightly (ba1d7f4a0 2024-06-29) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z crate-attr=feature(effects) -Z dump-mir-dir=dir

query stack during panic:
#0 [associated_type_for_effects] creating associated items for effects in `io`
#1 [explicit_implied_predicates_of] computing the implied predicates of `io`
end of query stack
error: aborting due to 6 previous errors; 2 warnings emitted

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

@rustbot label +F-effects

Metadata

Metadata

Assignees

No one assigned

    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.T-typesRelevant to the types team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions