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: parent item: DefId(0:5 ~ a[9a36]::{impl#1}) not marked as default #127142

Open
matthiaskrgr opened this issue Jun 30, 2024 · 6 comments
Open
Labels
C-bug Category: This is a bug. F-const_trait_impl `#![feature(const_trait_impl)]` F-effects `#![feature(effects)]` F-min_specialization `#![feature(min_specialization)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-low Low priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

auto-reduced (treereduce-rust):

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

#[const_trait]
trait Foo {}

impl const Foo for i32 {}

impl<T> const Foo for T {}

fn main() {}

original:

#![allow(incomplete_features)]
#![feature(const_trait_impl, effects)]

#[const_trait]
trait Foo {}

impl const Foo for i32 {}

impl<T> const Foo for T where T: std::ops::Add {}
//~^ ERROR conflicting implementations of trait `Foo` for type `i32`

fn main() {}

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(min_specialization)

Program output

warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
 --> /tmp/icemaker_global_tempdir.c0RYNwyTFenY/rustc_testrunner_tmpdir_reporting.7X6MiHL6JNkS/mvce.rs:1:30
  |
1 | #![feature(const_trait_impl, effects)]
  |                              ^^^^^^^
  |
  = note: see issue #102090 <https:/rust-lang/rust/issues/102090> for more information
  = note: `#[warn(incomplete_features)]` on by default

warning: trait `Foo` is never used
 --> /tmp/icemaker_global_tempdir.c0RYNwyTFenY/rustc_testrunner_tmpdir_reporting.7X6MiHL6JNkS/mvce.rs:4:7
  |
4 | trait Foo {}
  |       ^^^
  |
  = note: `#[warn(dead_code)]` on by default

warning: 2 warnings emitted

note: no errors encountered even though delayed bugs were created

note: those delayed bugs will now be shown as internal compiler errors

error: internal compiler error: parent item: DefId(0:5 ~ mvce[9951]::{impl#1}) not marked as default
  |
  = note: delayed at compiler/rustc_hir_analysis/src/check/check.rs:886:23 - disabled backtrace

note: we would appreciate a bug report: https:/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(min_specialization) -Z dump-mir-dir=dir

query stack during panic:
end of query stack

@rustbot label +F-const_trait_impl +F-effects +F-min_specialization

@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 Jun 30, 2024
@rustbot rustbot added needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. F-const_trait_impl `#![feature(const_trait_impl)]` F-effects `#![feature(effects)]` F-min_specialization `#![feature(min_specialization)]` labels Jun 30, 2024
@matthiaskrgr
Copy link
Member Author

stack:

note: no errors encountered even though delayed bugs were created

note: those delayed bugs will now be shown as internal compiler errors

error: internal compiler error: parent item: DefId(0:5 ~ k[c8a8]::{impl#1}) not marked as default
  |
  = note: delayed at compiler/rustc_hir_analysis/src/check/check.rs:886:23
             0: <rustc_errors::DiagCtxtInner>::emit_diagnostic
             1: <rustc_errors::DiagCtxtHandle>::emit_diagnostic
             2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
             3: rustc_hir_analysis::check::check::check_item_type
             4: rustc_hir_analysis::check::wfcheck::check_well_formed
             5: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
             6: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::VecCache<rustc_hir::hir_id::OwnerId, rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
             7: rustc_query_impl::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
             8: rustc_hir_analysis::check::wfcheck::check_mod_type_wf
             9: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
            10: 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; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
            11: rustc_query_impl::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
            12: rustc_hir_analysis::check_crate
            13: rustc_interface::passes::analysis
            14: 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]>>
            15: 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>
            16: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
            17: rustc_interface::interface::run_compiler::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
            18: std::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
            19: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#2} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
            20: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/ba1d7f4a083e6402679105115ded645512a7aea8/library/alloc/src/boxed.rs:2064:9
            21: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/ba1d7f4a083e6402679105115ded645512a7aea8/library/alloc/src/boxed.rs:2064:9
            22: std::sys::pal::unix::thread::Thread::new::thread_start
                       at /rustc/ba1d7f4a083e6402679105115ded645512a7aea8/library/std/src/sys/pal/unix/thread.rs:108:17
            23: <unknown>
            24: <unknown>


note: we would appreciate a bug report: https:/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: please attach the file at `/tmp/im/rustc-ice-2024-06-30T01_41_04-3002116.txt` to your bug report

query stack during panic:
end of query stack

@matthiaskrgr
Copy link
Member Author

another one which compiled before:

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

#[const_trait]
#[rustc_specialization_trait]
trait Specialize {}

#[const_trait]
trait Foo {
    fn foo();
}

impl<T> const Foo for T {
    default fn foo() {}
}

impl<T> const Foo for T
where
    T: ~const Specialize,
{
    fn foo() {}
}


fn main() {}

@oli-obk oli-obk added P-low Low priority and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jun 30, 2024
@fee1-dead
Copy link
Member

could we keep this issue but not add this to tests/crashes? Right now it creates a lot more work when I do a large refactor that fixes some of these (but it could go back to being a crash at any time when it wasn't an intentional fix). I'll go over these one by one based on the label one day

Same for all the effects ices from fuzzing

@GrigorenkoPV
Copy link
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)

@matthiaskrgr
Copy link
Member Author

@fee1-dead not sure how much that helps, but if its a problem while "working on a pr", I would rm crashes/* as first commit on my work branch, then do the coding, once everything is done, interactive-rebase the commit away again and then fix the tests just at the end once before I file the merge request.

@cushionbadak
Copy link

cushionbadak commented Jul 5, 2024

EDIT: my mistake. the original one requires rustc -Znext-solver -Zcrate-attr="feature(min_specialization)" to ICE.

I found that the original one does not ICE with rustc -Znext-solver command, but auto-reduced one still ICEs.

Version:

rustc 1.81.0-nightly (cc8da78a0 2024-07-04)
binary: rustc
commit-hash: cc8da78a036dc3c15c35a97651b02af9a6d30c1e
commit-date: 2024-07-04
host: x86_64-apple-darwin
release: 1.81.0-nightly
LLVM version: 18.1.7

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)]` F-effects `#![feature(effects)]` F-min_specialization `#![feature(min_specialization)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-low Low priority 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

6 participants