Skip to content

ICE: assertion failed Alias(Projection, .. != FreshTy(0) #127138

Closed

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

#![feature(effects)]
#[const_trait]
trait Trait {}

fn main() {
    let _: &dyn ~const Trait;
}

original:

#![feature(const_trait_impl)]
// FIXME(effects) add effects
//@ edition: 2021

#[const_trait]
trait Trait {}

fn main() {
    let _: &dyn const Trait; //~ ERROR const trait bounds are not allowed in trait object types
    let _: &dyn ~const Trait; //~ ERROR `~const` is not allowed here
}

// Regression test for issue #119525.
trait NonConst {}
const fn handle(_: &dyn const NonConst) {}
//~^ ERROR const trait bounds are not allowed in trait object types
const fn take(_: &dyn ~const NonConst) {}
//~^ ERROR `~const` is not allowed here

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) --edition=2018

Program output

error: `~const` is not allowed here
 --> /tmp/icemaker_global_tempdir.U9NvpFL4hBFS/rustc_testrunner_tmpdir_reporting.rtzJvTxisvQ5/mvce.rs:5:17
  |
5 |     let _: &dyn ~const Trait;
  |                 ^^^^^^
  |
  = note: trait objects cannot have `~const` trait bounds

error[E0658]: const trait impls are experimental
 --> /tmp/icemaker_global_tempdir.U9NvpFL4hBFS/rustc_testrunner_tmpdir_reporting.rtzJvTxisvQ5/mvce.rs:5:17
  |
5 |     let _: &dyn ~const Trait;
  |                 ^^^^^^
  |
  = 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]: `const_trait` is a temporary placeholder for marking a trait that is suitable for `const` `impls` and all default bodies as `const`, which may be removed or renamed in the future.
 --> /tmp/icemaker_global_tempdir.U9NvpFL4hBFS/rustc_testrunner_tmpdir_reporting.rtzJvTxisvQ5/mvce.rs:1:1
  |
1 | #[const_trait]
  | ^^^^^^^^^^^^^^
  |
  = 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

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

error[E0225]: only auto traits can be used as additional traits in a trait object
 --> /tmp/icemaker_global_tempdir.U9NvpFL4hBFS/rustc_testrunner_tmpdir_reporting.rtzJvTxisvQ5/mvce.rs:5:17
  |
5 |     let _: &dyn ~const Trait;
  |                 ^^^^^^^^^^^^
  |                 |
  |                 additional non-auto trait
  |                 first non-auto trait
  |
  = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Compat + Trait {}`
  = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>

thread 'rustc' panicked at compiler/rustc_hir_analysis/src/hir_ty_lowering/object_safety.rs:220:17:
assertion `left == right` failed
  left: Alias(Projection, AliasTy { args: [FreshTy(0)], def_id: DefId(0:5 ~ mvce[9951]::Trait::{synthetic#0}) })
 right: FreshTy(0)
stack backtrace:
   0:     0x7b4542dd22b5 - std::backtrace_rs::backtrace::libunwind::trace::h9fec972da723f824
                               at /rustc/ba1d7f4a083e6402679105115ded645512a7aea8/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
   1:     0x7b4542dd22b5 - std::backtrace_rs::backtrace::trace_unsynchronized::h6750dc8e20aabcad
                               at /rustc/ba1d7f4a083e6402679105115ded645512a7aea8/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7b4542dd22b5 - std::sys::backtrace::_print_fmt::h112c52e5e2edb557
                               at /rustc/ba1d7f4a083e6402679105115ded645512a7aea8/library/std/src/sys/backtrace.rs:68:5
   3:     0x7b4542dd22b5 - <std::sys::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h4713d06d34163f46
                               at /rustc/ba1d7f4a083e6402679105115ded645512a7aea8/library/std/src/sys/backtrace.rs:44:22
   4:     0x7b4542e21d9b - core::fmt::rt::Argument::fmt::h919dfde74ebabb2a
                               at /rustc/ba1d7f4a083e6402679105115ded645512a7aea8/library/core/src/fmt/rt.rs:173:76
   5:     0x7b4542e21d9b - core::fmt::write::h63ad278710fcf618
                               at /rustc/ba1d7f4a083e6402679105115ded645512a7aea8/library/core/src/fmt/mod.rs:1174:21
   6:     0x7b4542dc6e9f - std::io::Write::write_fmt::h48f75cc65a268f9a
                               at /rustc/ba1d7f4a083e6402679105115ded645512a7aea8/library/std/src/io/mod.rs:1835:15
   7:     0x7b4542dd208e - std::sys::backtrace::_print::ha47bd77a3336440c
                               at /rustc/ba1d7f4a083e6402679105115ded645512a7aea8/library/std/src/sys/backtrace.rs:47:5
   8:     0x7b4542dd208e - std::sys::backtrace::print::hd71c23c2433456bf
                               at /rustc/ba1d7f4a083e6402679105115ded645512a7aea8/library/std/src/sys/backtrace.rs:34:9
   9:     0x7b4542dd49d9 - std::panicking::default_hook::{{closure}}::ha7861419c6fed626
  10:     0x7b4542dd477c - std::panicking::default_hook::hdb522e40b65d9458
                               at /rustc/ba1d7f4a083e6402679105115ded645512a7aea8/library/std/src/panicking.rs:292:9
  11:     0x7b453f5b18a0 - std[ee1287dda0decb26]::panicking::update_hook::<alloc[ebf157a0a0183114]::boxed::Box<rustc_driver_impl[b3016c550210facb]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7b4542dd52af - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h8a54893ded3fcd8c
                               at /rustc/ba1d7f4a083e6402679105115ded645512a7aea8/library/alloc/src/boxed.rs:2078:9
  13:     0x7b4542dd52af - std::panicking::rust_panic_with_hook::h79c7320e6dd14ff0
                               at /rustc/ba1d7f4a083e6402679105115ded645512a7aea8/library/std/src/panicking.rs:804:13
  14:     0x7b4542dd4ed7 - std::panicking::begin_panic_handler::{{closure}}::h6bf6d623eeb925ff
                               at /rustc/ba1d7f4a083e6402679105115ded645512a7aea8/library/std/src/panicking.rs:670:13
  15:     0x7b4542dd2779 - std::sys::backtrace::__rust_end_short_backtrace::hae9fda2e5a3f99dc
                               at /rustc/ba1d7f4a083e6402679105115ded645512a7aea8/library/std/src/sys/backtrace.rs:171:18
  16:     0x7b4542dd4bb4 - rust_begin_unwind
                               at /rustc/ba1d7f4a083e6402679105115ded645512a7aea8/library/std/src/panicking.rs:661:5
  17:     0x7b4542e1e353 - core::panicking::panic_fmt::h1a6b0ab626f31f34
                               at /rustc/ba1d7f4a083e6402679105115ded645512a7aea8/library/core/src/panicking.rs:74:14
  18:     0x7b4542e1e85e - core::panicking::assert_failed_inner::h966c5e9d880e17e0
                               at /rustc/ba1d7f4a083e6402679105115ded645512a7aea8/library/core/src/panicking.rs:410:17
  19:     0x7b453f69c573 - core[a458eee17fffdec1]::panicking::assert_failed::<rustc_middle[375bbde5f17fb8ea]::ty::Ty, rustc_middle[375bbde5f17fb8ea]::ty::Ty>
  20:     0x7b454164f142 - <core[a458eee17fffdec1]::iter::adapters::chain::Chain<core[a458eee17fffdec1]::iter::adapters::chain::Chain<core[a458eee17fffdec1]::iter::adapters::map::Map<core[a458eee17fffdec1]::iter::adapters::map::Map<core[a458eee17fffdec1]::slice::iter::Iter<rustc_trait_selection[19ae2f0c85cb8e17]::traits::util::TraitAliasExpansionInfo>, <dyn rustc_hir_analysis[190a10ac9c7209da]::hir_ty_lowering::HirTyLowerer>::lower_trait_object_ty::{closure#0}::{closure#9}>, <dyn rustc_hir_analysis[190a10ac9c7209da]::hir_ty_lowering::HirTyLowerer>::lower_trait_object_ty::{closure#0}::{closure#11}>, core[a458eee17fffdec1]::iter::adapters::map::Map<core[a458eee17fffdec1]::iter::adapters::map::Map<core[a458eee17fffdec1]::slice::iter::Iter<(rustc_type_ir[170e3520cb44ff2d]::binder::Binder<rustc_middle[375bbde5f17fb8ea]::ty::context::TyCtxt, rustc_type_ir[170e3520cb44ff2d]::predicate::ProjectionPredicate<rustc_middle[375bbde5f17fb8ea]::ty::context::TyCtxt>>, rustc_span[a32535cd2922901f]::span_encoding::Span)>, <dyn rustc_hir_analysis[190a10ac9c7209da]::hir_ty_lowering::HirTyLowerer>::lower_trait_object_ty::{closure#0}::{closure#10}>, <dyn rustc_hir_analysis[190a10ac9c7209da]::hir_ty_lowering::HirTyLowerer>::lower_trait_object_ty::{closure#0}::{closure#13}>>, core[a458eee17fffdec1]::iter::adapters::map::Map<alloc[ebf157a0a0183114]::vec::into_iter::IntoIter<rustc_trait_selection[19ae2f0c85cb8e17]::traits::util::TraitAliasExpansionInfo>, <dyn rustc_hir_analysis[190a10ac9c7209da]::hir_ty_lowering::HirTyLowerer>::lower_trait_object_ty::{closure#0}::{closure#12}>> as core[a458eee17fffdec1]::iter::traits::iterator::Iterator>::next
  21:     0x7b454164b599 - <dyn rustc_hir_analysis[190a10ac9c7209da]::hir_ty_lowering::HirTyLowerer>::lower_trait_object_ty::{closure#0}
  22:     0x7b454118c4ed - <dyn rustc_hir_analysis[190a10ac9c7209da]::hir_ty_lowering::HirTyLowerer>::lower_ty_common::{closure#0}
  23:     0x7b454118bb81 - <dyn rustc_hir_analysis[190a10ac9c7209da]::hir_ty_lowering::HirTyLowerer>::lower_ty_common::{closure#0}
  24:     0x7b454144fee8 - <rustc_hir_typeck[2dc35516be686cd]::gather_locals::GatherLocalsVisitor>::declare
  25:     0x7b453d82fb52 - <rustc_hir_typeck[2dc35516be686cd]::gather_locals::GatherLocalsVisitor as rustc_hir[9cb815a008d04811]::intravisit::Visitor>::visit_expr
  26:     0x7b4540cfc32d - rustc_hir_typeck[2dc35516be686cd]::check::check_fn
  27:     0x7b4540cf1f5a - rustc_hir_typeck[2dc35516be686cd]::typeck
  28:     0x7b4540cf1909 - rustc_query_impl[e193fcc3be99e64a]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[e193fcc3be99e64a]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[375bbde5f17fb8ea]::query::erase::Erased<[u8; 8usize]>>
  29:     0x7b4540c45773 - rustc_query_system[ab5481f6c869ba71]::query::plumbing::try_execute_query::<rustc_query_impl[e193fcc3be99e64a]::DynamicConfig<rustc_query_system[ab5481f6c869ba71]::query::caches::VecCache<rustc_span[a32535cd2922901f]::def_id::LocalDefId, rustc_middle[375bbde5f17fb8ea]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[e193fcc3be99e64a]::plumbing::QueryCtxt, false>
  30:     0x7b4540c4494d - rustc_query_impl[e193fcc3be99e64a]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
  31:     0x7b4540c44548 - <rustc_middle[375bbde5f17fb8ea]::hir::map::Map>::par_body_owners::<rustc_hir_analysis[190a10ac9c7209da]::check_crate::{closure#4}>::{closure#0}
  32:     0x7b4540c428c5 - rustc_hir_analysis[190a10ac9c7209da]::check_crate
  33:     0x7b4541145455 - rustc_interface[ab25a569cec44e98]::passes::analysis
  34:     0x7b4541145015 - 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]>>
  35:     0x7b454181c2e5 - 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>
  36:     0x7b454181c04f - rustc_query_impl[e193fcc3be99e64a]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  37:     0x7b454175037f - rustc_interface[ab25a569cec44e98]::interface::run_compiler::<core[a458eee17fffdec1]::result::Result<(), rustc_span[a32535cd2922901f]::ErrorGuaranteed>, rustc_driver_impl[b3016c550210facb]::run_compiler::{closure#0}>::{closure#1}
  38:     0x7b45416dc649 - 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>>
  39:     0x7b45416dc3fa - <<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}
  40:     0x7b4542ddf10b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hc6d49d49179bb535
                               at /rustc/ba1d7f4a083e6402679105115ded645512a7aea8/library/alloc/src/boxed.rs:2064:9
  41:     0x7b4542ddf10b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h7270f16d3abba4aa
                               at /rustc/ba1d7f4a083e6402679105115ded645512a7aea8/library/alloc/src/boxed.rs:2064:9
  42:     0x7b4542ddf10b - std::sys::pal::unix::thread::Thread::new::thread_start::h3929f25d671aa35f
                               at /rustc/ba1d7f4a083e6402679105115ded645512a7aea8/library/std/src/sys/pal/unix/thread.rs:108:17
  43:     0x7b453c0a6ded - <unknown>
  44:     0x7b453c12a0dc - <unknown>
  45:                0x0 - <unknown>

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: 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 [typeck] type-checking `main`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 4 previous errors; 1 warning emitted

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

@rustbot label +F-const_trait_impl +F-effects

Activity

  1. added
    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.
    C-bugCategory: This is a bug.
    on Jun 29, 2024
  2. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    F-effects`#![feature(effects)]`
    on Jun 29, 2024
  3. matthiaskrgr commented on Jun 30, 2024

    @matthiaskrgr
    MemberAuthor

    auto-reduced (treereduce-rust):

    #![feature(effects)]
    #[const_trait]
    pub trait Bug<Rhs: ?Sized = Bug> {}

    original:

    #![const_trait] //~ WARN the feature `effects` is incomplete
    
    #[const_trait]
    pub trait Bug<Rhs: ?Sized = Bug> {
        /* stuff */
    }
    
    impl const Foo for () {}
    
    fn main() {}

    Version information

    rustc 1.81.0-nightly (716752ebe 2024-06-30)
    binary: rustc
    commit-hash: 716752ebe6974b5c6ab9b34b894e075f3e4a4b1e
    commit-date: 2024-06-30
    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[E0658]: `const_trait` is a temporary placeholder for marking a trait that is suitable for `const` `impls` and all default bodies as `const`, which may be removed or renamed in the future.
     --> /tmp/icemaker_global_tempdir.kwnljRUG7Div/rustc_testrunner_tmpdir_reporting.tTndfZGdtSum/mvce.rs:1:1
      |
    1 | #[const_trait]
      | ^^^^^^^^^^^^^^
      |
      = 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-30; 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
    
    error[E0601]: `main` function not found in crate `mvce`
     --> /tmp/icemaker_global_tempdir.kwnljRUG7Div/rustc_testrunner_tmpdir_reporting.tTndfZGdtSum/mvce.rs:2:36
      |
    2 | pub trait Bug<Rhs: ?Sized = Bug> {}
      |                                    ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.kwnljRUG7Div/rustc_testrunner_tmpdir_reporting.tTndfZGdtSum/mvce.rs`
    
    warning: trait objects without an explicit `dyn` are deprecated
     --> /tmp/icemaker_global_tempdir.kwnljRUG7Div/rustc_testrunner_tmpdir_reporting.tTndfZGdtSum/mvce.rs:2:29
      |
    2 | pub trait Bug<Rhs: ?Sized = Bug> {}
      |                             ^^^
      |
      = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
      = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
      = note: `#[warn(bare_trait_objects)]` on by default
    help: if this is an object-safe trait, use `dyn`
      |
    2 | pub trait Bug<Rhs: ?Sized = dyn Bug> {}
      |                             +++
    
    error[E0391]: cycle detected when computing type of `Bug::Rhs`
     --> /tmp/icemaker_global_tempdir.kwnljRUG7Div/rustc_testrunner_tmpdir_reporting.tTndfZGdtSum/mvce.rs:2:29
      |
    2 | pub trait Bug<Rhs: ?Sized = Bug> {}
      |                             ^^^
      |
      = note: ...which immediately requires computing type of `Bug::Rhs` again
    note: cycle used when checking that `Bug` is well-formed
     --> /tmp/icemaker_global_tempdir.kwnljRUG7Div/rustc_testrunner_tmpdir_reporting.tTndfZGdtSum/mvce.rs:2:1
      |
    2 | pub trait Bug<Rhs: ?Sized = Bug> {}
      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
    
    error[E0391]: cycle detected when computing type of `Bug::Rhs`
     --> /tmp/icemaker_global_tempdir.kwnljRUG7Div/rustc_testrunner_tmpdir_reporting.tTndfZGdtSum/mvce.rs:2:15
      |
    2 | pub trait Bug<Rhs: ?Sized = Bug> {}
      |               ^^^^^^^^^^^^^^^^^
      |
      = note: ...which immediately requires computing type of `Bug::Rhs` again
    note: cycle used when checking that `Bug` is well-formed
     --> /tmp/icemaker_global_tempdir.kwnljRUG7Div/rustc_testrunner_tmpdir_reporting.tTndfZGdtSum/mvce.rs:2:1
      |
    2 | pub trait Bug<Rhs: ?Sized = Bug> {}
      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
    
    error[E0225]: only auto traits can be used as additional traits in a trait object
     --> /tmp/icemaker_global_tempdir.kwnljRUG7Div/rustc_testrunner_tmpdir_reporting.tTndfZGdtSum/mvce.rs:2:29
      |
    2 | pub trait Bug<Rhs: ?Sized = Bug> {}
      |                             ^^^
      |                             |
      |                             additional non-auto trait
      |                             first non-auto trait
      |
      = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Compat + Bug {}`
      = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
    
    thread 'rustc' panicked at compiler/rustc_hir_analysis/src/hir_ty_lowering/object_safety.rs:220:17:
    assertion `left == right` failed
      left: Alias(Projection, AliasTy { args: [FreshTy(0), {type error}], def_id: DefId(0:5 ~ mvce[51e5]::Bug::{synthetic#0}) })
     right: FreshTy(0)
    stack backtrace:
       0:     0x7ba3e7d8b2b5 - std::backtrace_rs::backtrace::libunwind::trace::h347e7900b1db9112
                                   at /rustc/716752ebe6974b5c6ab9b34b894e075f3e4a4b1e/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
       1:     0x7ba3e7d8b2b5 - std::backtrace_rs::backtrace::trace_unsynchronized::h4612d6234fca9e9f
                                   at /rustc/716752ebe6974b5c6ab9b34b894e075f3e4a4b1e/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
       2:     0x7ba3e7d8b2b5 - std::sys::backtrace::_print_fmt::h11aace9ecb56968f
                                   at /rustc/716752ebe6974b5c6ab9b34b894e075f3e4a4b1e/library/std/src/sys/backtrace.rs:68:5
       3:     0x7ba3e7d8b2b5 - <std::sys::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h4bd8edef0dcb7e55
                                   at /rustc/716752ebe6974b5c6ab9b34b894e075f3e4a4b1e/library/std/src/sys/backtrace.rs:44:22
       4:     0x7ba3e7ddad9b - core::fmt::rt::Argument::fmt::h125ac59c6fcbe08e
                                   at /rustc/716752ebe6974b5c6ab9b34b894e075f3e4a4b1e/library/core/src/fmt/rt.rs:173:76
       5:     0x7ba3e7ddad9b - core::fmt::write::hfe727d5e53010d72
                                   at /rustc/716752ebe6974b5c6ab9b34b894e075f3e4a4b1e/library/core/src/fmt/mod.rs:1174:21
       6:     0x7ba3e7d7ff4f - std::io::Write::write_fmt::h958a4f3d71ed397c
                                   at /rustc/716752ebe6974b5c6ab9b34b894e075f3e4a4b1e/library/std/src/io/mod.rs:1835:15
       7:     0x7ba3e7d8b08e - std::sys::backtrace::_print::h898b3df07e056684
                                   at /rustc/716752ebe6974b5c6ab9b34b894e075f3e4a4b1e/library/std/src/sys/backtrace.rs:47:5
       8:     0x7ba3e7d8b08e - std::sys::backtrace::print::h1e6ea40402f4f2bd
                                   at /rustc/716752ebe6974b5c6ab9b34b894e075f3e4a4b1e/library/std/src/sys/backtrace.rs:34:9
       9:     0x7ba3e7d8d9d9 - std::panicking::default_hook::{{closure}}::h148f64741554c691
      10:     0x7ba3e7d8d77c - std::panicking::default_hook::h55d8d7782fe9c816
                                   at /rustc/716752ebe6974b5c6ab9b34b894e075f3e4a4b1e/library/std/src/panicking.rs:292:9
      11:     0x7ba3e45ab6df - std[d726f4bcf19eb704]::panicking::update_hook::<alloc[f39aac91e2a1d3d3]::boxed::Box<rustc_driver_impl[92342241f854daeb]::install_ice_hook::{closure#0}>>::{closure#0}
      12:     0x7ba3e7d8e2af - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::heb8923cc0eb6af70
                                   at /rustc/716752ebe6974b5c6ab9b34b894e075f3e4a4b1e/library/alloc/src/boxed.rs:2078:9
      13:     0x7ba3e7d8e2af - std::panicking::rust_panic_with_hook::h4a1de497ef550334
                                   at /rustc/716752ebe6974b5c6ab9b34b894e075f3e4a4b1e/library/std/src/panicking.rs:804:13
      14:     0x7ba3e7d8ded7 - std::panicking::begin_panic_handler::{{closure}}::h008d2d9aea65bf45
                                   at /rustc/716752ebe6974b5c6ab9b34b894e075f3e4a4b1e/library/std/src/panicking.rs:670:13
      15:     0x7ba3e7d8b779 - std::sys::backtrace::__rust_end_short_backtrace::h17453c950c85536f
                                   at /rustc/716752ebe6974b5c6ab9b34b894e075f3e4a4b1e/library/std/src/sys/backtrace.rs:171:18
      16:     0x7ba3e7d8dbb4 - rust_begin_unwind
                                   at /rustc/716752ebe6974b5c6ab9b34b894e075f3e4a4b1e/library/std/src/panicking.rs:661:5
      17:     0x7ba3e7dd7353 - core::panicking::panic_fmt::h08fce5e3677b9ade
                                   at /rustc/716752ebe6974b5c6ab9b34b894e075f3e4a4b1e/library/core/src/panicking.rs:74:14
      18:     0x7ba3e7dd785e - core::panicking::assert_failed_inner::h71c3dfc932fc45e7
                                   at /rustc/716752ebe6974b5c6ab9b34b894e075f3e4a4b1e/library/core/src/panicking.rs:410:17
      19:     0x7ba3e4696593 - core[f1f2976b77ef0beb]::panicking::assert_failed::<rustc_middle[24e4f0ecc3e223af]::ty::Ty, rustc_middle[24e4f0ecc3e223af]::ty::Ty>
      20:     0x7ba3e669d4c0 - <core[f1f2976b77ef0beb]::iter::adapters::chain::Chain<core[f1f2976b77ef0beb]::iter::adapters::chain::Chain<core[f1f2976b77ef0beb]::iter::adapters::map::Map<core[f1f2976b77ef0beb]::iter::adapters::map::Map<core[f1f2976b77ef0beb]::slice::iter::Iter<rustc_trait_selection[81a4056fa01852bc]::traits::util::TraitAliasExpansionInfo>, <dyn rustc_hir_analysis[823c7a3bea7233e2]::hir_ty_lowering::HirTyLowerer>::lower_trait_object_ty::{closure#0}::{closure#9}>, <dyn rustc_hir_analysis[823c7a3bea7233e2]::hir_ty_lowering::HirTyLowerer>::lower_trait_object_ty::{closure#0}::{closure#11}>, core[f1f2976b77ef0beb]::iter::adapters::map::Map<core[f1f2976b77ef0beb]::iter::adapters::map::Map<core[f1f2976b77ef0beb]::slice::iter::Iter<(rustc_type_ir[633a336b5942b6d7]::binder::Binder<rustc_middle[24e4f0ecc3e223af]::ty::context::TyCtxt, rustc_type_ir[633a336b5942b6d7]::predicate::ProjectionPredicate<rustc_middle[24e4f0ecc3e223af]::ty::context::TyCtxt>>, rustc_span[ac4c59fe15bf41a1]::span_encoding::Span)>, <dyn rustc_hir_analysis[823c7a3bea7233e2]::hir_ty_lowering::HirTyLowerer>::lower_trait_object_ty::{closure#0}::{closure#10}>, <dyn rustc_hir_analysis[823c7a3bea7233e2]::hir_ty_lowering::HirTyLowerer>::lower_trait_object_ty::{closure#0}::{closure#13}>>, core[f1f2976b77ef0beb]::iter::adapters::map::Map<alloc[f39aac91e2a1d3d3]::vec::into_iter::IntoIter<rustc_trait_selection[81a4056fa01852bc]::traits::util::TraitAliasExpansionInfo>, <dyn rustc_hir_analysis[823c7a3bea7233e2]::hir_ty_lowering::HirTyLowerer>::lower_trait_object_ty::{closure#0}::{closure#12}>> as core[f1f2976b77ef0beb]::iter::traits::iterator::Iterator>::next
      21:     0x7ba3e6699978 - <dyn rustc_hir_analysis[823c7a3bea7233e2]::hir_ty_lowering::HirTyLowerer>::lower_trait_object_ty::{closure#0}
      22:     0x7ba3e61959ed - <dyn rustc_hir_analysis[823c7a3bea7233e2]::hir_ty_lowering::HirTyLowerer>::lower_ty_common::{closure#0}
      23:     0x7ba3e33ee8f4 - rustc_hir_analysis[823c7a3bea7233e2]::collect::type_of::type_of
      24:     0x7ba3e5b19b2a - rustc_query_impl[d0b15df9a1793773]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d0b15df9a1793773]::query_impl::type_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[24e4f0ecc3e223af]::query::erase::Erased<[u8; 8usize]>>
      25:     0x7ba3e5b18860 - rustc_query_system[54cc3ae8094072e8]::query::plumbing::try_execute_query::<rustc_query_impl[d0b15df9a1793773]::DynamicConfig<rustc_query_system[54cc3ae8094072e8]::query::caches::DefIdCache<rustc_middle[24e4f0ecc3e223af]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[d0b15df9a1793773]::plumbing::QueryCtxt, false>
      26:     0x7ba3e5b18427 - rustc_query_impl[d0b15df9a1793773]::query_impl::type_of::get_query_non_incr::__rust_end_short_backtrace
      27:     0x7ba3e6be7ac6 - <rustc_hir_analysis[823c7a3bea7233e2]::collect::CollectItemTypesVisitor as rustc_hir[b6f4158d75146d33]::intravisit::Visitor>::visit_generics.warm
      28:     0x7ba3e5e884f0 - <rustc_hir_analysis[823c7a3bea7233e2]::collect::CollectItemTypesVisitor as rustc_hir[b6f4158d75146d33]::intravisit::Visitor>::visit_item
      29:     0x7ba3e340c2bd - rustc_hir_analysis[823c7a3bea7233e2]::check::wfcheck::check_well_formed
      30:     0x7ba3e5ecf33d - rustc_query_impl[d0b15df9a1793773]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d0b15df9a1793773]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[24e4f0ecc3e223af]::query::erase::Erased<[u8; 1usize]>>
      31:     0x7ba3e5ecf5b5 - rustc_query_system[54cc3ae8094072e8]::query::plumbing::try_execute_query::<rustc_query_impl[d0b15df9a1793773]::DynamicConfig<rustc_query_system[54cc3ae8094072e8]::query::caches::VecCache<rustc_hir[b6f4158d75146d33]::hir_id::OwnerId, rustc_middle[24e4f0ecc3e223af]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[d0b15df9a1793773]::plumbing::QueryCtxt, false>
      32:     0x7ba3e5ecf31a - rustc_query_impl[d0b15df9a1793773]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
      33:     0x7ba3e5ecffcc - rustc_hir_analysis[823c7a3bea7233e2]::check::wfcheck::check_mod_type_wf
      34:     0x7ba3e5ecfe19 - rustc_query_impl[d0b15df9a1793773]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d0b15df9a1793773]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[24e4f0ecc3e223af]::query::erase::Erased<[u8; 1usize]>>
      35:     0x7ba3e6598538 - rustc_query_system[54cc3ae8094072e8]::query::plumbing::try_execute_query::<rustc_query_impl[d0b15df9a1793773]::DynamicConfig<rustc_query_system[54cc3ae8094072e8]::query::caches::DefaultCache<rustc_span[ac4c59fe15bf41a1]::def_id::LocalModDefId, rustc_middle[24e4f0ecc3e223af]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[d0b15df9a1793773]::plumbing::QueryCtxt, false>
      36:     0x7ba3e65982e7 - rustc_query_impl[d0b15df9a1793773]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
      37:     0x7ba3e5c75b63 - rustc_hir_analysis[823c7a3bea7233e2]::check_crate
      38:     0x7ba3e65bfb55 - rustc_interface[bbac93287492f1c2]::passes::analysis
      39:     0x7ba3e65bf715 - rustc_query_impl[d0b15df9a1793773]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d0b15df9a1793773]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[24e4f0ecc3e223af]::query::erase::Erased<[u8; 1usize]>>
      40:     0x7ba3e6814d65 - rustc_query_system[54cc3ae8094072e8]::query::plumbing::try_execute_query::<rustc_query_impl[d0b15df9a1793773]::DynamicConfig<rustc_query_system[54cc3ae8094072e8]::query::caches::SingleCache<rustc_middle[24e4f0ecc3e223af]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[d0b15df9a1793773]::plumbing::QueryCtxt, false>
      41:     0x7ba3e6814acf - rustc_query_impl[d0b15df9a1793773]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
      42:     0x7ba3e673897f - rustc_interface[bbac93287492f1c2]::interface::run_compiler::<core[f1f2976b77ef0beb]::result::Result<(), rustc_span[ac4c59fe15bf41a1]::ErrorGuaranteed>, rustc_driver_impl[92342241f854daeb]::run_compiler::{closure#0}>::{closure#1}
      43:     0x7ba3e6670909 - std[d726f4bcf19eb704]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[bbac93287492f1c2]::util::run_in_thread_with_globals<rustc_interface[bbac93287492f1c2]::util::run_in_thread_pool_with_globals<rustc_interface[bbac93287492f1c2]::interface::run_compiler<core[f1f2976b77ef0beb]::result::Result<(), rustc_span[ac4c59fe15bf41a1]::ErrorGuaranteed>, rustc_driver_impl[92342241f854daeb]::run_compiler::{closure#0}>::{closure#1}, core[f1f2976b77ef0beb]::result::Result<(), rustc_span[ac4c59fe15bf41a1]::ErrorGuaranteed>>::{closure#0}, core[f1f2976b77ef0beb]::result::Result<(), rustc_span[ac4c59fe15bf41a1]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[f1f2976b77ef0beb]::result::Result<(), rustc_span[ac4c59fe15bf41a1]::ErrorGuaranteed>>
      44:     0x7ba3e66706ba - <<std[d726f4bcf19eb704]::thread::Builder>::spawn_unchecked_<rustc_interface[bbac93287492f1c2]::util::run_in_thread_with_globals<rustc_interface[bbac93287492f1c2]::util::run_in_thread_pool_with_globals<rustc_interface[bbac93287492f1c2]::interface::run_compiler<core[f1f2976b77ef0beb]::result::Result<(), rustc_span[ac4c59fe15bf41a1]::ErrorGuaranteed>, rustc_driver_impl[92342241f854daeb]::run_compiler::{closure#0}>::{closure#1}, core[f1f2976b77ef0beb]::result::Result<(), rustc_span[ac4c59fe15bf41a1]::ErrorGuaranteed>>::{closure#0}, core[f1f2976b77ef0beb]::result::Result<(), rustc_span[ac4c59fe15bf41a1]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[f1f2976b77ef0beb]::result::Result<(), rustc_span[ac4c59fe15bf41a1]::ErrorGuaranteed>>::{closure#2} as core[f1f2976b77ef0beb]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
      45:     0x7ba3e7d9810b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h6f5928636b5d7956
                                   at /rustc/716752ebe6974b5c6ab9b34b894e075f3e4a4b1e/library/alloc/src/boxed.rs:2064:9
      46:     0x7ba3e7d9810b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::ha5a0fdb6eb13fb59
                                   at /rustc/716752ebe6974b5c6ab9b34b894e075f3e4a4b1e/library/alloc/src/boxed.rs:2064:9
      47:     0x7ba3e7d9810b - std::sys::pal::unix::thread::Thread::new::thread_start::h1839e19d463cbba0
                                   at /rustc/716752ebe6974b5c6ab9b34b894e075f3e4a4b1e/library/std/src/sys/pal/unix/thread.rs:108:17
      48:     0x7ba3e10a6ded - <unknown>
      49:     0x7ba3e112a0dc - <unknown>
      50:                0x0 - <unknown>
    
    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: please make sure that you have updated to the latest nightly
    
    note: rustc 1.81.0-nightly (716752ebe 2024-06-30) 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 [type_of] computing type of `Bug::Rhs`
    #1 [check_well_formed] checking that `Bug` is well-formed
    end of query stack
    error: aborting due to 5 previous errors; 2 warnings emitted
    
    Some errors have detailed explanations: E0225, E0391, E0601, E0658.
    For more information about an error, try `rustc --explain E0225`.
    
    

    @rustbot label +F-effects

  4. added
    P-lowLow priority
    and removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Jun 30, 2024
  5. fmease commented on Jun 30, 2024

    @fmease
    Member

    (FreshTy(0) is trait_object_dummy_self in this context)

  6. GrigorenkoPV commented on Jun 30, 2024

    @GrigorenkoPV
    Contributor

    searched nightlies: from nightly-2023-04-15 to nightly-2024-06-30
    regressed nightly: nightly-2024-06-30
    searched commit range: e9e6e2e...ba1d7f4
    regressed commit: ba1d7f4 (#120639)

  7. fmease commented on Feb 12, 2025

    @fmease
    Member

    Effects is no more and the implementation of const_trait_impl has changed dramatically. This is obviously fixed. I don't think it's worth adding a regression test. If you disagree, feel free to open a PR and ping [@]rust-lang/project-const-traits for a "majority vote".

  8. GrigorenkoPV commented on Feb 12, 2025

    @GrigorenkoPV
    Contributor

    Effects is no more

    Is https://github.com/rust-lang/keyword-generics-initiative disbanded or is it just the current implementation that ceased to exist?

  9. fmease commented on Feb 12, 2025

    @fmease
    Member

    Neither. Just the subfeature effects was removed since it's been fully integrated back into const_trait_impl.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-const_trait_impl`#![feature(const_trait_impl)]`F-effects`#![feature(effects)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-lowLow priorityT-compilerRelevant to the compiler 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