Skip to content

ICE in rustc 1.59.0-beta.2 #93131

Closed
Closed
@coriolinus

Description

@coriolinus

Code

src/lib.rs

#[derive(Debug, PartialEq, Eq)]
pub enum Classification {
    Abundant,
    Perfect,
    Deficient,
}


pub fn classify(num: u64) -> Option<Classification> {
    unimplemented!("classify {}", num);
}

tests/perfect-numbers.rs

use perfect_numbers::{classify, Classification};


macro_rules! tests {
    ($property_test_func:ident {
        $( $(#[$attr:meta])* $test_name:ident( $( $param:expr ),* ); )+
    }) => {
        $(
            $(#[$attr])*
            #[test]
            fn $test_name() {
                $property_test_func($( $param ),* )
            }
        )+
    }
}


fn test_classification(num: u64, result: Classification) {
    assert_eq!(classify(num), Some(result));
}


#[test]
fn basic() {
    assert_eq!(classify(0), None);
}


tests! {
    test_classification {
        #[ignore] test_1(1, Classification::Deficient);
        #[ignore] test_2(2, Classification::Deficient);
        #[ignore] test_4(4, Classification::Deficient);
        #[ignore] test_6(6, Classification::Perfect);
        #[ignore] test_12(12, Classification::Abundant);
        #[ignore] test_28(28, Classification::Perfect);
        #[ignore] test_30(30, Classification::Abundant);
        #[ignore] test_32(32, Classification::Deficient);
        #[ignore] test_33550335(33_550_335, Classification::Abundant);
        #[ignore] test_33550336(33_550_336, Classification::Perfect);
        #[ignore] test_33550337(33_550_337, Classification::Deficient);
    }
}

Meta

  • Occurs with beta-x86_64-unknown-linux-gnu - rustc 1.59.0-beta.2 (98a701b42 2022-01-19)
  • Command: cargo test --quiet --no-run here
  • Executed in CI environment; log here.
  • Not encountered with rustc 1.58.0 (02072b482 2022-01-11)

Error output

thread 'rustc' panicked at 'index out of bounds: the len is 11 but the index is 14', compiler/rustc_query_impl/src/on_disk_cache.rs:726:18
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

note: 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.59.0-beta.2 (98a701b42 2022-01-19) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [eval_to_allocation_raw] const-evaluating + checking `basic::promoted[0]`
#1 [optimized_mir] optimizing MIR for `basic`
end of query stack
error: could not compile `perfect_numbers`
error: build failed

No backtrace as yet because I don't have the beta version installed locally.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.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.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions