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: assertion failed 1 == 2 #117789

Closed
matthiaskrgr opened this issue Nov 10, 2023 · 4 comments · Fixed by #117811
Closed

ice: auto traits: assertion failed 1 == 2 #117789

matthiaskrgr opened this issue Nov 10, 2023 · 4 comments · Fixed by #117811
Labels
A-auto-traits Area: auto traits (`auto trait Send`) C-bug Category: This is a bug. 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.

Comments

@matthiaskrgr
Copy link
Member

auto-reduced (treereduce-rust):

auto trait Trait<P> {


}

impl<P> Trait<P> for () {
     ;
}



auto trait Bound : Copy {}

auto trait LifetimeBound : 'static {}

auto trait MyTrait {  }


original code

original:

#![feature(auto_traits)]

// run-rustfix

auto trait Trait<P> {
    const A: ();
    const B<const K: u64, const Q: u64>: u64;
    const C<T>: T;
    const D<const N: usize>: usize;

    const E: usize;
    const F<T: PartialEq>: ();
}

impl<P> Trait<P> for () {
    const A<T>: () = ();
    //~^ ERROR const `A` has 1 type parameter but its trait declaration has 0 type parameters
    const B<const K: u64>: u64 = 0;
    //~^ ERROR const `B` has 1 const parameter but its trait declaration has 2 const parameters
    const C<'a>: &'a str = "";
    //~^ ERROR const `C` has 0 type parameters but its trait declaration has 1 type parameter
    const D<const N: u16>: u16 = N;
    //~^ ERROR const `D` has an incompatible generic parameter for trait `Trait`

    const E: usize = 0x11111111
    where
        P: Copy; //~ ERROR impl has stricter requirements than trait
    const F<T: Eq>: () = (); //~ ERROR impl has stricter requirements than trait
}

fn main() {}
//~^ auto traits cannot have generic parameters [E0567]
auto trait Bound : Copy {}
//~^ auto traits cannot have super traits or lifetime bounds [E0568]
auto trait LifetimeBound : 'static {}
//~^ auto traits cannot have super traits or lifetime bounds [E0568]
auto trait MyTrait { fn foo() {} }
//~^ auto traits cannot have associated items [E0380]
fn main() {}

Version information

rustc 1.75.0-nightly (17d0a45f5 2023-11-10)
binary: rustc
commit-hash: 17d0a45f5df31f218b84c3275bb05c3227348b5b
commit-date: 2023-11-10
host: x86_64-unknown-linux-gnu
release: 1.75.0-nightly
LLVM version: 17.0.4

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

Program output

error: non-item in item list
  --> /tmp/icemaker_global_tempdir.lcHIbosRSaxE/rustc_testrunner_tmpdir_reporting.aKyC4RFSO5Er/mvce.rs:11:6
   |
10 | impl<P> Trait<P> for () {
   |                         - item list starts here
11 |      ;
   |      ^ non-item starts here
12 | }
   | - item list ends here

error[E0567]: auto traits cannot have generic parameters
 --> /tmp/icemaker_global_tempdir.lcHIbosRSaxE/rustc_testrunner_tmpdir_reporting.aKyC4RFSO5Er/mvce.rs:5:17
  |
5 | auto trait Trait<P> {
  |            -----^^^ 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.lcHIbosRSaxE/rustc_testrunner_tmpdir_reporting.aKyC4RFSO5Er/mvce.rs:16:17
   |
16 | auto trait Bound : Copy {}
   |            -----^^^^^^^ help: remove the super traits or lifetime bounds
   |            |
   |            auto traits cannot have super traits or lifetime bounds

error[E0568]: auto traits cannot have super traits or lifetime bounds
  --> /tmp/icemaker_global_tempdir.lcHIbosRSaxE/rustc_testrunner_tmpdir_reporting.aKyC4RFSO5Er/mvce.rs:18:25
   |
18 | auto trait LifetimeBound : 'static {}
   |            -------------^^^^^^^^^^ help: remove the super traits or lifetime bounds
   |            |
   |            auto traits cannot have super traits or lifetime bounds

error[E0658]: auto traits are experimental and possibly buggy
 --> /tmp/icemaker_global_tempdir.lcHIbosRSaxE/rustc_testrunner_tmpdir_reporting.aKyC4RFSO5Er/mvce.rs:5:1
  |
5 | / auto trait Trait<P> {
6 | |
7 | |
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[E0658]: auto traits are experimental and possibly buggy
  --> /tmp/icemaker_global_tempdir.lcHIbosRSaxE/rustc_testrunner_tmpdir_reporting.aKyC4RFSO5Er/mvce.rs:16:1
   |
16 | auto trait Bound : Copy {}
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = 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[E0658]: auto traits are experimental and possibly buggy
  --> /tmp/icemaker_global_tempdir.lcHIbosRSaxE/rustc_testrunner_tmpdir_reporting.aKyC4RFSO5Er/mvce.rs:18:1
   |
18 | auto trait LifetimeBound : 'static {}
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = 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[E0658]: auto traits are experimental and possibly buggy
  --> /tmp/icemaker_global_tempdir.lcHIbosRSaxE/rustc_testrunner_tmpdir_reporting.aKyC4RFSO5Er/mvce.rs:20:1
   |
20 | auto trait MyTrait {  }
   | ^^^^^^^^^^^^^^^^^^^^^^^
   |
   = 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.lcHIbosRSaxE/rustc_testrunner_tmpdir_reporting.aKyC4RFSO5Er/mvce.rs:20:24
   |
20 | auto trait MyTrait {  }
   |                        ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.lcHIbosRSaxE/rustc_testrunner_tmpdir_reporting.aKyC4RFSO5Er/mvce.rs`

thread 'rustc' panicked at compiler/rustc_hir_analysis/src/coherence/orphan.rs:455:5:
assertion `left == right` failed
  left: 2
 right: 1
stack backtrace:
   0:     0x7fb17d38b62c - std::backtrace_rs::backtrace::libunwind::trace::h46374b84341786bc
                               at /rustc/17d0a45f5df31f218b84c3275bb05c3227348b5b/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7fb17d38b62c - std::backtrace_rs::backtrace::trace_unsynchronized::he7815f30c698ee16
                               at /rustc/17d0a45f5df31f218b84c3275bb05c3227348b5b/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fb17d38b62c - std::sys_common::backtrace::_print_fmt::hf3ac027a6e20df81
                               at /rustc/17d0a45f5df31f218b84c3275bb05c3227348b5b/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7fb17d38b62c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h6350b6493143b1fc
                               at /rustc/17d0a45f5df31f218b84c3275bb05c3227348b5b/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7fb17d3de630 - core::fmt::rt::Argument::fmt::haac38874886df8e7
                               at /rustc/17d0a45f5df31f218b84c3275bb05c3227348b5b/library/core/src/fmt/rt.rs:142:9
   5:     0x7fb17d3de630 - core::fmt::write::hf0e822b6d8ad56b2
                               at /rustc/17d0a45f5df31f218b84c3275bb05c3227348b5b/library/core/src/fmt/mod.rs:1120:17
   6:     0x7fb17d37f54f - std::io::Write::write_fmt::h1a44df357aa13b6e
                               at /rustc/17d0a45f5df31f218b84c3275bb05c3227348b5b/library/std/src/io/mod.rs:1762:15
   7:     0x7fb17d38b414 - std::sys_common::backtrace::_print::h95329df2b370286a
                               at /rustc/17d0a45f5df31f218b84c3275bb05c3227348b5b/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7fb17d38b414 - std::sys_common::backtrace::print::hd1549e5974c3fa44
                               at /rustc/17d0a45f5df31f218b84c3275bb05c3227348b5b/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7fb17d38e0a7 - std::panicking::default_hook::{{closure}}::hfc23d70499246b08
  10:     0x7fb17d38de0f - std::panicking::default_hook::h0d66df0a095a3bd0
                               at /rustc/17d0a45f5df31f218b84c3275bb05c3227348b5b/library/std/src/panicking.rs:292:9
  11:     0x7fb1800ee150 - std[4df474cf7c0204ae]::panicking::update_hook::<alloc[ca626be192fcf572]::boxed::Box<rustc_driver_impl[ec4025a53c2103e9]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7fb17d38e7e8 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h44f7f870300bcc1d
                               at /rustc/17d0a45f5df31f218b84c3275bb05c3227348b5b/library/alloc/src/boxed.rs:2021:9
  13:     0x7fb17d38e7e8 - std::panicking::rust_panic_with_hook::h652875067b2fe609
                               at /rustc/17d0a45f5df31f218b84c3275bb05c3227348b5b/library/std/src/panicking.rs:783:13
  14:     0x7fb17d38e53e - std::panicking::begin_panic_handler::{{closure}}::h441bd00acf2d3372
                               at /rustc/17d0a45f5df31f218b84c3275bb05c3227348b5b/library/std/src/panicking.rs:657:13
  15:     0x7fb17d38baf6 - std::sys_common::backtrace::__rust_end_short_backtrace::h302c26748ffe0429
                               at /rustc/17d0a45f5df31f218b84c3275bb05c3227348b5b/library/std/src/sys_common/backtrace.rs:170:18
  16:     0x7fb17d38e2a2 - rust_begin_unwind
                               at /rustc/17d0a45f5df31f218b84c3275bb05c3227348b5b/library/std/src/panicking.rs:645:5
  17:     0x7fb17d3dad15 - core::panicking::panic_fmt::heeeb5ab19bc3d1b2
                               at /rustc/17d0a45f5df31f218b84c3275bb05c3227348b5b/library/core/src/panicking.rs:72:14
  18:     0x7fb17d3db28b - core::panicking::assert_failed_inner::hc77e496884c61372
  19:     0x7fb1801bcf03 - core[f248d18e5721e18e]::panicking::assert_failed::<usize, usize>
  20:     0x7fb18167fb07 - rustc_hir_analysis[3fdc3bc95e806e7]::coherence::orphan::orphan_check_impl
  21:     0x7fb18167e719 - rustc_query_impl[d9d242dab8718f47]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d9d242dab8718f47]::query_impl::orphan_check_impl::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dadee63cb0feb6d5]::query::erase::Erased<[u8; 1usize]>>
  22:     0x7fb181681bba - rustc_query_system[6b6f1c30493de844]::query::plumbing::try_execute_query::<rustc_query_impl[d9d242dab8718f47]::DynamicConfig<rustc_query_system[6b6f1c30493de844]::query::caches::VecCache<rustc_span[9afbaaf51cc05e3]::def_id::LocalDefId, rustc_middle[dadee63cb0feb6d5]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[d9d242dab8718f47]::plumbing::QueryCtxt, false>
  23:     0x7fb1816817c3 - rustc_query_impl[d9d242dab8718f47]::query_impl::orphan_check_impl::get_query_non_incr::__rust_end_short_backtrace
  24:     0x7fb1818b032a - rustc_hir_analysis[3fdc3bc95e806e7]::coherence::coherent_trait
  25:     0x7fb1818afeb9 - rustc_query_impl[d9d242dab8718f47]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d9d242dab8718f47]::query_impl::coherent_trait::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dadee63cb0feb6d5]::query::erase::Erased<[u8; 0usize]>>
  26:     0x7fb181e0dfbd - rustc_query_system[6b6f1c30493de844]::query::plumbing::try_execute_query::<rustc_query_impl[d9d242dab8718f47]::DynamicConfig<rustc_query_system[6b6f1c30493de844]::query::caches::DefaultCache<rustc_span[9afbaaf51cc05e3]::def_id::DefId, rustc_middle[dadee63cb0feb6d5]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[d9d242dab8718f47]::plumbing::QueryCtxt, false>
  27:     0x7fb181e0dd4d - rustc_query_impl[d9d242dab8718f47]::query_impl::coherent_trait::get_query_non_incr::__rust_end_short_backtrace
  28:     0x7fb1819ce469 - rustc_hir_analysis[3fdc3bc95e806e7]::check_crate
  29:     0x7fb1817aa8d7 - rustc_interface[b3bf249fff60da9a]::passes::analysis
  30:     0x7fb1817aa537 - rustc_query_impl[d9d242dab8718f47]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d9d242dab8718f47]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dadee63cb0feb6d5]::query::erase::Erased<[u8; 1usize]>>
  31:     0x7fb182398824 - rustc_query_system[6b6f1c30493de844]::query::plumbing::try_execute_query::<rustc_query_impl[d9d242dab8718f47]::DynamicConfig<rustc_query_system[6b6f1c30493de844]::query::caches::SingleCache<rustc_middle[dadee63cb0feb6d5]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[d9d242dab8718f47]::plumbing::QueryCtxt, false>
  32:     0x7fb182398615 - rustc_query_impl[d9d242dab8718f47]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  33:     0x7fb1823a123f - rustc_interface[b3bf249fff60da9a]::interface::run_compiler::<core[f248d18e5721e18e]::result::Result<(), rustc_span[9afbaaf51cc05e3]::ErrorGuaranteed>, rustc_driver_impl[ec4025a53c2103e9]::run_compiler::{closure#1}>::{closure#0}
  34:     0x7fb1823a855a - std[4df474cf7c0204ae]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[b3bf249fff60da9a]::util::run_in_thread_with_globals<rustc_interface[b3bf249fff60da9a]::util::run_in_thread_pool_with_globals<rustc_interface[b3bf249fff60da9a]::interface::run_compiler<core[f248d18e5721e18e]::result::Result<(), rustc_span[9afbaaf51cc05e3]::ErrorGuaranteed>, rustc_driver_impl[ec4025a53c2103e9]::run_compiler::{closure#1}>::{closure#0}, core[f248d18e5721e18e]::result::Result<(), rustc_span[9afbaaf51cc05e3]::ErrorGuaranteed>>::{closure#0}, core[f248d18e5721e18e]::result::Result<(), rustc_span[9afbaaf51cc05e3]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[f248d18e5721e18e]::result::Result<(), rustc_span[9afbaaf51cc05e3]::ErrorGuaranteed>>
  35:     0x7fb1823a8383 - <<std[4df474cf7c0204ae]::thread::Builder>::spawn_unchecked_<rustc_interface[b3bf249fff60da9a]::util::run_in_thread_with_globals<rustc_interface[b3bf249fff60da9a]::util::run_in_thread_pool_with_globals<rustc_interface[b3bf249fff60da9a]::interface::run_compiler<core[f248d18e5721e18e]::result::Result<(), rustc_span[9afbaaf51cc05e3]::ErrorGuaranteed>, rustc_driver_impl[ec4025a53c2103e9]::run_compiler::{closure#1}>::{closure#0}, core[f248d18e5721e18e]::result::Result<(), rustc_span[9afbaaf51cc05e3]::ErrorGuaranteed>>::{closure#0}, core[f248d18e5721e18e]::result::Result<(), rustc_span[9afbaaf51cc05e3]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[f248d18e5721e18e]::result::Result<(), rustc_span[9afbaaf51cc05e3]::ErrorGuaranteed>>::{closure#1} as core[f248d18e5721e18e]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  36:     0x7fb17d3986a5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h473dfddbf197f5bf
                               at /rustc/17d0a45f5df31f218b84c3275bb05c3227348b5b/library/alloc/src/boxed.rs:2007:9
  37:     0x7fb17d3986a5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h8959fbdf8cbf8098
                               at /rustc/17d0a45f5df31f218b84c3275bb05c3227348b5b/library/alloc/src/boxed.rs:2007:9
  38:     0x7fb17d3986a5 - std::sys::unix::thread::Thread::new::thread_start::hab410919d7ef6e45
                               at /rustc/17d0a45f5df31f218b84c3275bb05c3227348b5b/library/std/src/sys/unix/thread.rs:108:17
  39:     0x7fb17d1899eb - <unknown>
  40:     0x7fb17d20d7cc - <unknown>
  41:                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: rustc 1.75.0-nightly (17d0a45f5 2023-11-10) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [orphan_check_impl] checking whether impl `<impl at /tmp/icemaker_global_tempdir.lcHIbosRSaxE/rustc_testrunner_tmpdir_reporting.aKyC4RFSO5Er/mvce.rs:10:1: 10:24>` follows the orphan rules
#1 [coherent_trait] coherence checking all impls of trait `Trait`
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 9 previous errors

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

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

Regression in nightly-2022-02-02

found 9 bors merge commits in the specified range
commit[0] 2022-01-31: Auto merge of #93348 - spastorino:fix-perf-overlap-mode2, r=nikomatsakis
commit[1] 2022-01-31: Auto merge of #93381 - tmiasko:is-self-recursive, r=ecstatic-morse
commit[2] 2022-02-01: Auto merge of #93386 - WaffleLapkin:rustc_must_implement_one_of_check_target, r=nagisa
commit[3] 2022-02-01: Auto merge of #93259 - eddyb:diagbld-scalar-pair, r=jackh726
commit[4] 2022-02-01: Auto merge of #93534 - ehuss:rollup-9ecozo9, r=ehuss
commit[5] 2022-02-01: Auto merge of #86988 - thomcc:chunky-splitz-says-no-checking, r=the8472
commit[6] 2022-02-01: Auto merge of #93284 - eholk:disable-drop-range-analysis, r=pnkfelix
commit[7] 2022-02-01: Auto merge of #93548 - matthiaskrgr:rollup-f7dkn3p, r=matthiaskrgr
commit[8] 2022-02-01: Auto merge of #93442 - yaahc:Termination-abstraction, r=Mark-Simulacrum
ERROR: no CI builds available between 498eeb7 and 2681f25 within last 167 days

@asquared31415
Copy link
Contributor

Actually reduced

auto trait Trait<P> {}

impl<P> Trait<P> for () {}

@jruderman
Copy link
Contributor

Might have been caused by #93267

@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Nov 10, 2023
@matthiaskrgr
Copy link
Member Author

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 (`auto trait Send`) C-bug Category: This is a bug. 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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants