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: auto traits: unexpected builtin trait with associated type #117829

Closed
matthiaskrgr opened this issue Nov 12, 2023 · 4 comments · Fixed by #128160
Closed

ice: auto traits: unexpected builtin trait with associated type #117829

matthiaskrgr opened this issue Nov 12, 2023 · 4 comments · Fixed by #128160
Labels
A-auto-traits Area: auto traits (e.g., `auto trait Send {}`) C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. 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):

auto trait Z<'a, T: ?Sized>
where
    T: Z<'a, u16>,

    for<'b> <T as Z<'b, u16>>::W: Clone,
{
    type W: ?Sized;
}

original:

// check-pass

#[cfg(x2, y2, const { [3u32, 0, 1, 2] })]
auto trait Z<'a, T: ?Sized>
where
    T: Z<'a, u16>,
    //~^ the trait bound `str: Clone` is not satisfied
    //~| the trait bound `str: Clone` is not satisfied
    for<'b> <T as Z<'b, u16>>::W: Clone,
{
    type W: ?Sized;
    fn h(&self, x: &T::W) {
        <T::W>::clone(x);
    }
}
// Values for testing *size
//~| WARN unstable syntax can change at any point in the future, causing a hard error!

fn main(x: <T as Try>::Output) {}

Version information

rustc 1.76.0-nightly (a04d56b36 2023-11-12)
binary: rustc
commit-hash: a04d56b36d8f634abd7bdd64dd859a30655f1818
commit-date: 2023-11-12
host: x86_64-unknown-linux-gnu
release: 1.76.0-nightly
LLVM version: 17.0.4

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

error[E0567]: auto traits cannot have generic parameters
 --> /tmp/icemaker_global_tempdir.mZwoYuuERxJE/rustc_testrunner_tmpdir_reporting.QEWekm25QZ3t/mvce.rs:1:13
  |
1 | auto trait Z<'a, T: ?Sized>
  |            -^^^^^^^^^^^^^^^ help: remove the parameters
  |            |
  |            auto trait cannot have generic parameters

error[E0568]: auto traits cannot have super traits or lifetime bounds
 --> /tmp/icemaker_global_tempdir.mZwoYuuERxJE/rustc_testrunner_tmpdir_reporting.QEWekm25QZ3t/mvce.rs:2:1
  |
1 |   auto trait Z<'a, T: ?Sized>
  |              - auto traits cannot have super traits or lifetime bounds
2 | / where
3 | |     T: Z<'a, u16>,
4 | |
5 | |     for<'b> <T as Z<'b, u16>>::W: Clone,
  | |________________________________________^ help: remove the super traits or lifetime bounds

error[E0380]: auto traits cannot have associated items
 --> /tmp/icemaker_global_tempdir.mZwoYuuERxJE/rustc_testrunner_tmpdir_reporting.QEWekm25QZ3t/mvce.rs:7:10
  |
1 | auto trait Z<'a, T: ?Sized>
  |            - auto traits cannot have associated items
...
7 |     type W: ?Sized;
  |     -----^--------- help: remove these associated items

error[E0658]: auto traits are experimental and possibly buggy
 --> /tmp/icemaker_global_tempdir.mZwoYuuERxJE/rustc_testrunner_tmpdir_reporting.QEWekm25QZ3t/mvce.rs:1:1
  |
1 | / auto trait Z<'a, T: ?Sized>
2 | | where
3 | |     T: Z<'a, u16>,
4 | |
... |
7 | |     type W: ?Sized;
8 | | }
  | |_^
  |
  = note: see issue #13231 <https://github.com/rust-lang/rust/issues/13231> for more information
  = help: add `#![feature(auto_traits)]` to the crate attributes to enable

error[E0601]: `main` function not found in crate `mvce`
 --> /tmp/icemaker_global_tempdir.mZwoYuuERxJE/rustc_testrunner_tmpdir_reporting.QEWekm25QZ3t/mvce.rs:8:2
  |
8 | }
  |  ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.mZwoYuuERxJE/rustc_testrunner_tmpdir_reporting.QEWekm25QZ3t/mvce.rs`

error: internal compiler error: compiler/rustc_trait_selection/src/traits/project.rs:1912:21: unexpected builtin trait with associated type: <u16 as Z<'b, u16>>

thread 'rustc' panicked at /rustc/a04d56b36d8f634abd7bdd64dd859a30655f1818/compiler/rustc_errors/src/lib.rs:1661:9:
Box<dyn Any>
stack backtrace:
   0:     0x7fad9758561c - std::backtrace_rs::backtrace::libunwind::trace::ha7d8e18371214dc5
                               at /rustc/a04d56b36d8f634abd7bdd64dd859a30655f1818/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7fad9758561c - std::backtrace_rs::backtrace::trace_unsynchronized::h4ab7ef5b35b18e6e
                               at /rustc/a04d56b36d8f634abd7bdd64dd859a30655f1818/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fad9758561c - std::sys_common::backtrace::_print_fmt::ha4aed865ff21cdc6
                               at /rustc/a04d56b36d8f634abd7bdd64dd859a30655f1818/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7fad9758561c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h89cdffe584387f6a
                               at /rustc/a04d56b36d8f634abd7bdd64dd859a30655f1818/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7fad975d8620 - core::fmt::rt::Argument::fmt::he4d350492cf5a41f
                               at /rustc/a04d56b36d8f634abd7bdd64dd859a30655f1818/library/core/src/fmt/rt.rs:142:9
   5:     0x7fad975d8620 - core::fmt::write::ha0b883466b3eea5c
                               at /rustc/a04d56b36d8f634abd7bdd64dd859a30655f1818/library/core/src/fmt/mod.rs:1120:17
   6:     0x7fad9757953f - std::io::Write::write_fmt::hbeb259dcdb178e61
                               at /rustc/a04d56b36d8f634abd7bdd64dd859a30655f1818/library/std/src/io/mod.rs:1762:15
   7:     0x7fad97585404 - std::sys_common::backtrace::_print::hfd400ec6542a93b9
                               at /rustc/a04d56b36d8f634abd7bdd64dd859a30655f1818/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7fad97585404 - std::sys_common::backtrace::print::hf891cc8f835583e3
                               at /rustc/a04d56b36d8f634abd7bdd64dd859a30655f1818/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7fad97588097 - std::panicking::default_hook::{{closure}}::hd1b01d54ca05bedb
  10:     0x7fad97587dff - std::panicking::default_hook::he9fe70984bc0a99b
                               at /rustc/a04d56b36d8f634abd7bdd64dd859a30655f1818/library/std/src/panicking.rs:292:9
  11:     0x7fad942ec420 - std[abb76f1550ab564c]::panicking::update_hook::<alloc[c5d6ca6f2be9df74]::boxed::Box<rustc_driver_impl[be7a3904fcdd9e27]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7fad975887d8 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hd181986705e402fb
                               at /rustc/a04d56b36d8f634abd7bdd64dd859a30655f1818/library/alloc/src/boxed.rs:2021:9
  13:     0x7fad975887d8 - std::panicking::rust_panic_with_hook::hab5502e98b8d3256
                               at /rustc/a04d56b36d8f634abd7bdd64dd859a30655f1818/library/std/src/panicking.rs:783:13
  14:     0x7fad9473a744 - std[abb76f1550ab564c]::panicking::begin_panic::<rustc_errors[635868a7a4dff52f]::ExplicitBug>::{closure#0}
  15:     0x7fad94733c96 - std[abb76f1550ab564c]::sys_common::backtrace::__rust_end_short_backtrace::<std[abb76f1550ab564c]::panicking::begin_panic<rustc_errors[635868a7a4dff52f]::ExplicitBug>::{closure#0}, !>
  16:     0x7fad9472e2d6 - std[abb76f1550ab564c]::panicking::begin_panic::<rustc_errors[635868a7a4dff52f]::ExplicitBug>
  17:     0x7fad94713cd4 - <rustc_errors[635868a7a4dff52f]::HandlerInner>::bug::<alloc[c5d6ca6f2be9df74]::string::String>
  18:     0x7fad947139da - <rustc_errors[635868a7a4dff52f]::Handler>::bug::<alloc[c5d6ca6f2be9df74]::string::String>
  19:     0x7fad947b5bdd - rustc_middle[c8990ecd71a144c7]::util::bug::opt_span_bug_fmt::<rustc_span[4a6542c0fe2e5cc4]::span_encoding::Span>::{closure#0}
  20:     0x7fad9479d13a - rustc_middle[c8990ecd71a144c7]::ty::context::tls::with_opt::<rustc_middle[c8990ecd71a144c7]::util::bug::opt_span_bug_fmt<rustc_span[4a6542c0fe2e5cc4]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7fad9479cfd8 - rustc_middle[c8990ecd71a144c7]::ty::context::tls::with_context_opt::<rustc_middle[c8990ecd71a144c7]::ty::context::tls::with_opt<rustc_middle[c8990ecd71a144c7]::util::bug::opt_span_bug_fmt<rustc_span[4a6542c0fe2e5cc4]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7fad927152b0 - rustc_middle[c8990ecd71a144c7]::util::bug::bug_fmt
  23:     0x7fad95874c11 - rustc_trait_selection[d994e538aea3acdf]::traits::project::opt_normalize_projection_type
  24:     0x7fad9586753e - <rustc_trait_selection[d994e538aea3acdf]::traits::project::AssocTypeNormalizer as rustc_type_ir[14c467366cccebac]::fold::TypeFolder<rustc_middle[c8990ecd71a144c7]::ty::context::TyCtxt>>::fold_ty
  25:     0x7fad958657aa - <rustc_trait_selection[d994e538aea3acdf]::traits::project::AssocTypeNormalizer as rustc_type_ir[14c467366cccebac]::fold::TypeFolder<rustc_middle[c8990ecd71a144c7]::ty::context::TyCtxt>>::fold_predicate
  26:     0x7fad95b9cd02 - <rustc_trait_selection[d994e538aea3acdf]::traits::select::SelectionContext>::vtable_auto_impl::{closure#0}
  27:     0x7fad9270354f - <rustc_trait_selection[d994e538aea3acdf]::traits::select::SelectionContext>::poly_select
  28:     0x7fad95868cc6 - rustc_trait_selection[d994e538aea3acdf]::traits::project::opt_normalize_projection_type
  29:     0x7fad9586753e - <rustc_trait_selection[d994e538aea3acdf]::traits::project::AssocTypeNormalizer as rustc_type_ir[14c467366cccebac]::fold::TypeFolder<rustc_middle[c8990ecd71a144c7]::ty::context::TyCtxt>>::fold_ty
  30:     0x7fad958657aa - <rustc_trait_selection[d994e538aea3acdf]::traits::project::AssocTypeNormalizer as rustc_type_ir[14c467366cccebac]::fold::TypeFolder<rustc_middle[c8990ecd71a144c7]::ty::context::TyCtxt>>::fold_predicate
  31:     0x7fad95b9cd02 - <rustc_trait_selection[d994e538aea3acdf]::traits::select::SelectionContext>::vtable_auto_impl::{closure#0}
  32:     0x7fad9270354f - <rustc_trait_selection[d994e538aea3acdf]::traits::select::SelectionContext>::poly_select
  33:     0x7fad95868cc6 - rustc_trait_selection[d994e538aea3acdf]::traits::project::opt_normalize_projection_type
  34:     0x7fad9586753e - <rustc_trait_selection[d994e538aea3acdf]::traits::project::AssocTypeNormalizer as rustc_type_ir[14c467366cccebac]::fold::TypeFolder<rustc_middle[c8990ecd71a144c7]::ty::context::TyCtxt>>::fold_ty
  35:     0x7fad958657aa - <rustc_trait_selection[d994e538aea3acdf]::traits::project::AssocTypeNormalizer as rustc_type_ir[14c467366cccebac]::fold::TypeFolder<rustc_middle[c8990ecd71a144c7]::ty::context::TyCtxt>>::fold_predicate
  36:     0x7fad95b9cd02 - <rustc_trait_selection[d994e538aea3acdf]::traits::select::SelectionContext>::vtable_auto_impl::{closure#0}
  37:     0x7fad9270354f - <rustc_trait_selection[d994e538aea3acdf]::traits::select::SelectionContext>::poly_select
  38:     0x7fad95868cc6 - rustc_trait_selection[d994e538aea3acdf]::traits::project::opt_normalize_projection_type
  39:     0x7fad9586753e - <rustc_trait_selection[d994e538aea3acdf]::traits::project::AssocTypeNormalizer as rustc_type_ir[14c467366cccebac]::fold::TypeFolder<rustc_middle[c8990ecd71a144c7]::ty::context::TyCtxt>>::fold_ty
  40:     0x7fad958657aa - <rustc_trait_selection[d994e538aea3acdf]::traits::project::AssocTypeNormalizer as rustc_type_ir[14c467366cccebac]::fold::TypeFolder<rustc_middle[c8990ecd71a144c7]::ty::context::TyCtxt>>::fold_predicate
  41:     0x7fad95b9cd02 - <rustc_trait_selection[d994e538aea3acdf]::traits::select::SelectionContext>::vtable_auto_impl::{closure#0}
  42:     0x7fad9270354f - <rustc_trait_selection[d994e538aea3acdf]::traits::select::SelectionContext>::poly_select
  43:     0x7fad95868cc6 - rustc_trait_selection[d994e538aea3acdf]::traits::project::opt_normalize_projection_type
  44:     0x7fad9586753e - <rustc_trait_selection[d994e538aea3acdf]::traits::project::AssocTypeNormalizer as rustc_type_ir[14c467366cccebac]::fold::TypeFolder<rustc_middle[c8990ecd71a144c7]::ty::context::TyCtxt>>::fold_ty
  45:     0x7fad958657aa - <rustc_trait_selection[d994e538aea3acdf]::traits::project::AssocTypeNormalizer as rustc_type_ir[14c467366cccebac]::fold::TypeFolder<rustc_middle[c8990ecd71a144c7]::ty::context::TyCtxt>>::fold_predicate
  46:     0x7fad95b9cd02 - <rustc_trait_selection[d994e538aea3acdf]::traits::select::SelectionContext>::vtable_auto_impl::{closure#0}
  47:     0x7fad9270354f - <rustc_trait_selection[d994e538aea3acdf]::traits::select::SelectionContext>::poly_select
  48:     0x7fad95868cc6 - rustc_trait_selection[d994e538aea3acdf]::traits::project::opt_normalize_projection_type
<snip>

 656:     0x7fad95b9cd02 - <rustc_trait_selection[d994e538aea3acdf]::traits::select::SelectionContext>::vtable_auto_impl::{closure#0}
 657:     0x7fad9270354f - <rustc_trait_selection[d994e538aea3acdf]::traits::select::SelectionContext>::poly_select
 658:     0x7fad95868cc6 - rustc_trait_selection[d994e538aea3acdf]::traits::project::opt_normalize_projection_type
 659:     0x7fad9586753e - <rustc_trait_selection[d994e538aea3acdf]::traits::project::AssocTypeNormalizer as rustc_type_ir[14c467366cccebac]::fold::TypeFolder<rustc_middle[c8990ecd71a144c7]::ty::context::TyCtxt>>::fold_ty
 660:     0x7fad958657aa - <rustc_trait_selection[d994e538aea3acdf]::traits::project::AssocTypeNormalizer as rustc_type_ir[14c467366cccebac]::fold::TypeFolder<rustc_middle[c8990ecd71a144c7]::ty::context::TyCtxt>>::fold_predicate
 661:     0x7fad95b9cd02 - <rustc_trait_selection[d994e538aea3acdf]::traits::select::SelectionContext>::vtable_auto_impl::{closure#0}
 662:     0x7fad9270354f - <rustc_trait_selection[d994e538aea3acdf]::traits::select::SelectionContext>::poly_select
 663:     0x7fad95868cc6 - rustc_trait_selection[d994e538aea3acdf]::traits::project::opt_normalize_projection_type
 664:     0x7fad9586753e - <rustc_trait_selection[d994e538aea3acdf]::traits::project::AssocTypeNormalizer as rustc_type_ir[14c467366cccebac]::fold::TypeFolder<rustc_middle[c8990ecd71a144c7]::ty::context::TyCtxt>>::fold_ty
 665:     0x7fad958657aa - <rustc_trait_selection[d994e538aea3acdf]::traits::project::AssocTypeNormalizer as rustc_type_ir[14c467366cccebac]::fold::TypeFolder<rustc_middle[c8990ecd71a144c7]::ty::context::TyCtxt>>::fold_predicate
 666:     0x7fad95838eca - rustc_trait_selection[d994e538aea3acdf]::traits::wf::clause_obligations
 667:     0x7fad95d0827a - rustc_hir_analysis[d3ef41151e11064]::check::wfcheck::check_where_clauses
 668:     0x7fad960723e9 - rustc_hir_analysis[d3ef41151e11064]::check::wfcheck::check_trait
 669:     0x7fad95e0719d - rustc_hir_analysis[d3ef41151e11064]::check::wfcheck::check_well_formed
 670:     0x7fad95e06187 - rustc_query_impl[1dbe5d39a1f7335]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[1dbe5d39a1f7335]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c8990ecd71a144c7]::query::erase::Erased<[u8; 1usize]>>
 671:     0x7fad95e058b7 - rustc_query_system[de6aa3eb6381c13]::query::plumbing::try_execute_query::<rustc_query_impl[1dbe5d39a1f7335]::DynamicConfig<rustc_query_system[de6aa3eb6381c13]::query::caches::VecCache<rustc_hir[9844e3a9044970e3]::hir_id::OwnerId, rustc_middle[c8990ecd71a144c7]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[1dbe5d39a1f7335]::plumbing::QueryCtxt, false>
 672:     0x7fad95e05643 - rustc_query_impl[1dbe5d39a1f7335]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
 673:     0x7fad95e04a06 - rustc_hir_analysis[d3ef41151e11064]::check::wfcheck::check_mod_type_wf
 674:     0x7fad95e0493b - rustc_query_impl[1dbe5d39a1f7335]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[1dbe5d39a1f7335]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c8990ecd71a144c7]::query::erase::Erased<[u8; 1usize]>>
 675:     0x7fad95e03b3b - rustc_query_system[de6aa3eb6381c13]::query::plumbing::try_execute_query::<rustc_query_impl[1dbe5d39a1f7335]::DynamicConfig<rustc_query_system[de6aa3eb6381c13]::query::caches::DefaultCache<rustc_span[4a6542c0fe2e5cc4]::def_id::LocalModDefId, rustc_middle[c8990ecd71a144c7]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[1dbe5d39a1f7335]::plumbing::QueryCtxt, false>
 676:     0x7fad95e038cd - rustc_query_impl[1dbe5d39a1f7335]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
 677:     0x7fad95bc4c9a - <rustc_middle[c8990ecd71a144c7]::hir::map::Map>::try_par_for_each_module::<rustc_hir_analysis[d3ef41151e11064]::check_crate::{closure#4}::{closure#0}>::{closure#0}
 678:     0x7fad95bc5495 - rustc_hir_analysis[d3ef41151e11064]::check_crate
 679:     0x7fad95983317 - rustc_interface[2eb8f42114fb09b1]::passes::analysis
 680:     0x7fad95982f77 - rustc_query_impl[1dbe5d39a1f7335]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[1dbe5d39a1f7335]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c8990ecd71a144c7]::query::erase::Erased<[u8; 1usize]>>
 681:     0x7fad965962a4 - rustc_query_system[de6aa3eb6381c13]::query::plumbing::try_execute_query::<rustc_query_impl[1dbe5d39a1f7335]::DynamicConfig<rustc_query_system[de6aa3eb6381c13]::query::caches::SingleCache<rustc_middle[c8990ecd71a144c7]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[1dbe5d39a1f7335]::plumbing::QueryCtxt, false>
 682:     0x7fad96596095 - rustc_query_impl[1dbe5d39a1f7335]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
 683:     0x7fad9659ecbf - rustc_interface[2eb8f42114fb09b1]::interface::run_compiler::<core[3c289e99ef9ba493]::result::Result<(), rustc_span[4a6542c0fe2e5cc4]::ErrorGuaranteed>, rustc_driver_impl[be7a3904fcdd9e27]::run_compiler::{closure#1}>::{closure#0}
 684:     0x7fad965a5fda - std[abb76f1550ab564c]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[2eb8f42114fb09b1]::util::run_in_thread_with_globals<rustc_interface[2eb8f42114fb09b1]::util::run_in_thread_pool_with_globals<rustc_interface[2eb8f42114fb09b1]::interface::run_compiler<core[3c289e99ef9ba493]::result::Result<(), rustc_span[4a6542c0fe2e5cc4]::ErrorGuaranteed>, rustc_driver_impl[be7a3904fcdd9e27]::run_compiler::{closure#1}>::{closure#0}, core[3c289e99ef9ba493]::result::Result<(), rustc_span[4a6542c0fe2e5cc4]::ErrorGuaranteed>>::{closure#0}, core[3c289e99ef9ba493]::result::Result<(), rustc_span[4a6542c0fe2e5cc4]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[3c289e99ef9ba493]::result::Result<(), rustc_span[4a6542c0fe2e5cc4]::ErrorGuaranteed>>
 685:     0x7fad965a5e03 - <<std[abb76f1550ab564c]::thread::Builder>::spawn_unchecked_<rustc_interface[2eb8f42114fb09b1]::util::run_in_thread_with_globals<rustc_interface[2eb8f42114fb09b1]::util::run_in_thread_pool_with_globals<rustc_interface[2eb8f42114fb09b1]::interface::run_compiler<core[3c289e99ef9ba493]::result::Result<(), rustc_span[4a6542c0fe2e5cc4]::ErrorGuaranteed>, rustc_driver_impl[be7a3904fcdd9e27]::run_compiler::{closure#1}>::{closure#0}, core[3c289e99ef9ba493]::result::Result<(), rustc_span[4a6542c0fe2e5cc4]::ErrorGuaranteed>>::{closure#0}, core[3c289e99ef9ba493]::result::Result<(), rustc_span[4a6542c0fe2e5cc4]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[3c289e99ef9ba493]::result::Result<(), rustc_span[4a6542c0fe2e5cc4]::ErrorGuaranteed>>::{closure#1} as core[3c289e99ef9ba493]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
 686:     0x7fad97592695 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h4543cbb2476eec39
                               at /rustc/a04d56b36d8f634abd7bdd64dd859a30655f1818/library/alloc/src/boxed.rs:2007:9
 687:     0x7fad97592695 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h33bb6ebf49fc4745
                               at /rustc/a04d56b36d8f634abd7bdd64dd859a30655f1818/library/alloc/src/boxed.rs:2007:9
 688:     0x7fad97592695 - std::sys::unix::thread::Thread::new::thread_start::h9f68884c308aa5fe
                               at /rustc/a04d56b36d8f634abd7bdd64dd859a30655f1818/library/std/src/sys/unix/thread.rs:108:17
 689:     0x7fad914759eb - <unknown>
 690:     0x7fad914f97cc - <unknown>
 691:                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.76.0-nightly (a04d56b36 2023-11-12) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [check_well_formed] checking that `Z` is well-formed
#1 [check_mod_type_wf] checking that types are well-formed in top-level module
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 6 previous errors

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

@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. A-auto-traits Area: auto traits (e.g., `auto trait Send {}`) labels Nov 12, 2023
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Nov 12, 2023
@matthiaskrgr
Copy link
Member Author

Regression in nightly-2023-06-18
Regression in f90d57d / #112687 ping @compiler-errors

@jruderman
Copy link
Contributor

The depth of the stack at the ICE depends on the recursion limit. Add #![recursion_limit="8"] and it still ICEs, but with only 8 repeated stack portions.

@jruderman
Copy link
Contributor

Simplified to use only locally defined traits, not use a lifetime parameter, and hit fewer errors:

#![feature(auto_traits)]

trait B {}

auto trait Z<T>
where
    T: Z<u16>,
    <T as Z<u16>>::W: B,
{
    type W;
}

fn main() {}

Oddly enough, this variant hits the same ICE but without such a deep stack.

@asquared31415
Copy link
Contributor

You can replace the bound : B with a lifetime bound to reproduce too, such as <T as Z<u16>>::W: 'static.

@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Nov 13, 2023
@matthiaskrgr matthiaskrgr added the S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. label Apr 15, 2024
@bors bors closed this as completed in 1fda084 Jul 25, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Jul 25, 2024
Rollup merge of rust-lang#128160 - compiler-errors:auto, r=jackh726

Don't ICE when auto trait has assoc ty in old solver

Kinda a pointless change to make, but it's observable w/o the feature gate, so let's just fix it. I reintroduced this ICE when I removed the "auto impl" kind from `ImplSource` in rust-lang#112687.

Fixes rust-lang#117829
Fixes rust-lang#127746
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-auto-traits Area: auto traits (e.g., `auto trait Send {}`) C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. 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