Skip to content

ICE: broken mir: Cannot compare unequal types fn(&str) and for<'r> fn(&'r str) with -Zvalidate-mir #95978

Closed

Description

@matthiaskrgr

Code

code from glacier / fixed/91636.rs

fn foo(_a: &str) {}

fn main() {
    let x = foo as fn(&'static str);

    let _ = x == foo;
}

Meta

rustc --version --verbose:

rustc 1.62.0-nightly (2a83fbc42 2022-04-12)
binary: rustc
commit-hash: 2a83fbc42a9bb6bfdb8d3fb4ecce83fb410d7642
commit-date: 2022-04-12
host: x86_64-unknown-linux-gnu
release: 1.62.0-nightly
LLVM version: 14.0.0

rustc ./91636.rs -Zvalidate-mir

Backtrace

error: internal compiler error: no errors encountered even though `delay_span_bug` issued

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:4 ~ 91636[c00a]::main), const_param_did: None }) (start of phase transition from Built) at bb0[12]:
                                Cannot compare unequal types fn(&str) and for<'r> fn(&'r str)
 --> ./91636.rs:6:13
  |
6 |     let _ = x == foo;
  |             ^^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:126:36

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:4 ~ 91636[c00a]::main), const_param_did: None }) (after pass CheckPackedRef) at bb0[12]:
                                Cannot compare unequal types fn(&str) and for<'r> fn(&'r str)
 --> ./91636.rs:6:13
  |
6 |     let _ = x == foo;
  |             ^^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:126:36

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:4 ~ 91636[c00a]::main), const_param_did: None }) (after pass CheckConstItemMutation) at bb0[12]:
                                Cannot compare unequal types fn(&str) and for<'r> fn(&'r str)
 --> ./91636.rs:6:13
  |
6 |     let _ = x == foo;
  |             ^^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:126:36

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:4 ~ 91636[c00a]::main), const_param_did: None }) (after pass FunctionItemReferences) at bb0[12]:
                                Cannot compare unequal types fn(&str) and for<'r> fn(&'r str)
 --> ./91636.rs:6:13
  |
6 |     let _ = x == foo;
  |             ^^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:126:36

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:4 ~ 91636[c00a]::main), const_param_did: None }) (after pass SimplifyCfg-initial) at bb0[12]:
                                Cannot compare unequal types fn(&str) and for<'r> fn(&'r str)
 --> ./91636.rs:6:13
  |
6 |     let _ = x == foo;
  |             ^^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:126:36

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:4 ~ 91636[c00a]::main), const_param_did: None }) (after pass SanityCheck) at bb0[12]:
                                Cannot compare unequal types fn(&str) and for<'r> fn(&'r str)
 --> ./91636.rs:6:13
  |
6 |     let _ = x == foo;
  |             ^^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:126:36

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:4 ~ 91636[c00a]::main), const_param_did: None }) (after pass PhaseChange-Const) at bb0[12]:
                                Cannot compare unequal types fn(&str) and for<'r> fn(&'r str)
 --> ./91636.rs:6:13
  |
6 |     let _ = x == foo;
  |             ^^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:126:36

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:4 ~ 91636[c00a]::main), const_param_did: None }) (end of phase transition to Const) at bb0[12]:
                                Cannot compare unequal types fn(&str) and for<'r> fn(&'r str)
 --> ./91636.rs:6:13
  |
6 |     let _ = x == foo;
  |             ^^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:126:36

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:4 ~ 91636[c00a]::main), const_param_did: None }) (start of phase transition from Const) at bb0[12]:
                                Cannot compare unequal types fn(&str) and for<'r> fn(&'r str)
 --> ./91636.rs:6:13
  |
6 |     let _ = x == foo;
  |             ^^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:126:36

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:4 ~ 91636[c00a]::main), const_param_did: None }) (after pass PromoteTemps) at bb0[12]:
                                Cannot compare unequal types fn(&str) and for<'r> fn(&'r str)
 --> ./91636.rs:6:13
  |
6 |     let _ = x == foo;
  |             ^^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:126:36

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:4 ~ 91636[c00a]::main), const_param_did: None }) (after pass SimplifyCfg-promote-consts) at bb0[12]:
                                Cannot compare unequal types fn(&str) and for<'r> fn(&'r str)
 --> ./91636.rs:6:13
  |
6 |     let _ = x == foo;
  |             ^^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:126:36

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:4 ~ 91636[c00a]::main), const_param_did: None }) (end of phase transition to ConstsPromoted) at bb0[12]:
                                Cannot compare unequal types fn(&str) and for<'r> fn(&'r str)
 --> ./91636.rs:6:13
  |
6 |     let _ = x == foo;
  |             ^^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:126:36

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:4 ~ 91636[c00a]::main), const_param_did: None }) (start of phase transition from ConstsPromoted) at bb0[12]:
                                Cannot compare unequal types fn(&str) and for<'r> fn(&'r str)
 --> ./91636.rs:6:13
  |
6 |     let _ = x == foo;
  |             ^^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:126:36

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:4 ~ 91636[c00a]::main), const_param_did: None }) (after pass RemoveFalseEdges) at bb0[12]:
                                Cannot compare unequal types fn(&str) and for<'r> fn(&'r str)
 --> ./91636.rs:6:13
  |
6 |     let _ = x == foo;
  |             ^^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:126:36

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:4 ~ 91636[c00a]::main), const_param_did: None }) (after pass SimplifyConstCondition-initial) at bb0[12]:
                                Cannot compare unequal types fn(&str) and for<'r> fn(&'r str)
 --> ./91636.rs:6:13
  |
6 |     let _ = x == foo;
  |             ^^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:126:36

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:4 ~ 91636[c00a]::main), const_param_did: None }) (after pass RemoveNoopLandingPads) at bb0[12]:
                                Cannot compare unequal types fn(&str) and for<'r> fn(&'r str)
 --> ./91636.rs:6:13
  |
6 |     let _ = x == foo;
  |             ^^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:126:36

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:4 ~ 91636[c00a]::main), const_param_did: None }) (after pass CleanupNonCodegenStatements) at bb0[12]:
                                Cannot compare unequal types fn(&str) and for<'r> fn(&'r str)
 --> ./91636.rs:6:13
  |
6 |     let _ = x == foo;
  |             ^^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:126:36

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:4 ~ 91636[c00a]::main), const_param_did: None }) (after pass SimplifyCfg-early-opt) at bb0[10]:
                                Cannot compare unequal types fn(&str) and for<'r> fn(&'r str)
 --> ./91636.rs:6:13
  |
6 |     let _ = x == foo;
  |             ^^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:126:36

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:4 ~ 91636[c00a]::main), const_param_did: None }) (after pass AddCallGuards) at bb0[10]:
                                Cannot compare unequal types fn(&str) and for<'r> fn(&'r str)
 --> ./91636.rs:6:13
  |
6 |     let _ = x == foo;
  |             ^^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:126:36

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:4 ~ 91636[c00a]::main), const_param_did: None }) (after pass ElaborateDrops) at bb0[10]:
                                Cannot compare unequal types fn(&str) and for<'r> fn(&'r str)
 --> ./91636.rs:6:13
  |
6 |     let _ = x == foo;
  |             ^^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:126:36

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:4 ~ 91636[c00a]::main), const_param_did: None }) (after pass AbortUnwindingCalls) at bb0[10]:
                                Cannot compare unequal types fn(&str) and for<'r> fn(&'r str)
 --> ./91636.rs:6:13
  |
6 |     let _ = x == foo;
  |             ^^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:126:36

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:4 ~ 91636[c00a]::main), const_param_did: None }) (after pass AddMovesForPackedDrops) at bb0[10]:
                                Cannot compare unequal types fn(&str) and for<'r> fn(&'r str)
 --> ./91636.rs:6:13
  |
6 |     let _ = x == foo;
  |             ^^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:126:36

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:4 ~ 91636[c00a]::main), const_param_did: None }) (after pass LowerIntrinsics) at bb0[10]:
                                Cannot compare unequal types fn(&str) and for<'r> fn(&'r str)
 --> ./91636.rs:6:13
  |
6 |     let _ = x == foo;
  |             ^^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:126:36

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:4 ~ 91636[c00a]::main), const_param_did: None }) (after pass SimplifyCfg-elaborate-drops) at bb0[10]:
                                Cannot compare unequal types fn(&str) and for<'r> fn(&'r str)
 --> ./91636.rs:6:13
  |
6 |     let _ = x == foo;
  |             ^^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:126:36

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:4 ~ 91636[c00a]::main), const_param_did: None }) (after pass Deaggregator) at bb0[10]:
                                Cannot compare unequal types fn(&str) and for<'r> fn(&'r str)
 --> ./91636.rs:6:13
  |
6 |     let _ = x == foo;
  |             ^^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:126:36

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:4 ~ 91636[c00a]::main), const_param_did: None }) (after pass Derefer) at bb0[10]:
                                Cannot compare unequal types fn(&str) and for<'r> fn(&'r str)
 --> ./91636.rs:6:13
  |
6 |     let _ = x == foo;
  |             ^^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:126:36

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:4 ~ 91636[c00a]::main), const_param_did: None }) (after pass ConstProp) at bb0[10]:
                                Cannot compare unequal types fn(&str) and for<'r> fn(&'r str)
 --> ./91636.rs:6:13
  |
6 |     let _ = x == foo;
  |             ^^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:126:36

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:4 ~ 91636[c00a]::main), const_param_did: None }) (end of phase transition to Deaggregated) at bb0[10]:
                                Cannot compare unequal types fn(&str) and for<'r> fn(&'r str)
 --> ./91636.rs:6:13
  |
6 |     let _ = x == foo;
  |             ^^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:126:36

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:4 ~ 91636[c00a]::main), const_param_did: None }) (start of phase transition from Deaggregated) at bb0[10]:
                                Cannot compare unequal types fn(&str) and for<'r> fn(&'r str)
 --> ./91636.rs:6:13
  |
6 |     let _ = x == foo;
  |             ^^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:126:36

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:4 ~ 91636[c00a]::main), const_param_did: None }) (after pass LowerSliceLenCalls) at bb0[10]:
                                Cannot compare unequal types fn(&str) and for<'r> fn(&'r str)
 --> ./91636.rs:6:13
  |
6 |     let _ = x == foo;
  |             ^^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:126:36

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:4 ~ 91636[c00a]::main), const_param_did: None }) (after pass UninhabitedEnumBranching) at bb0[10]:
                                Cannot compare unequal types fn(&str) and for<'r> fn(&'r str)
 --> ./91636.rs:6:13
  |
6 |     let _ = x == foo;
  |             ^^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:126:36

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:4 ~ 91636[c00a]::main), const_param_did: None }) (after pass SimplifyCfg-after-uninhabited-enum-branching) at bb0[10]:
                                Cannot compare unequal types fn(&str) and for<'r> fn(&'r str)
 --> ./91636.rs:6:13
  |
6 |     let _ = x == foo;
  |             ^^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:126:36

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:4 ~ 91636[c00a]::main), const_param_did: None }) (after pass StateTransform) at bb0[10]:
                                Cannot compare unequal types fn(&str) and for<'r> fn(&'r str)
 --> ./91636.rs:6:13
  |
6 |     let _ = x == foo;
  |             ^^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:126:36

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:4 ~ 91636[c00a]::main), const_param_did: None }) (end of phase transition to GeneratorsLowered) at bb0[10]:
                                Cannot compare unequal types fn(&str) and for<'r> fn(&'r str)
 --> ./91636.rs:6:13
  |
6 |     let _ = x == foo;
  |             ^^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:126:36

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:4 ~ 91636[c00a]::main), const_param_did: None }) (start of phase transition from GeneratorsLowered) at bb0[10]:
                                Cannot compare unequal types fn(&str) and for<'r> fn(&'r str)
 --> ./91636.rs:6:13
  |
6 |     let _ = x == foo;
  |             ^^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:126:36

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:4 ~ 91636[c00a]::main), const_param_did: None }) (after pass RemoveStorageMarkers) at bb0[4]:
                                Cannot compare unequal types fn(&str) and for<'r> fn(&'r str)
 --> ./91636.rs:6:13
  |
6 |     let _ = x == foo;
  |             ^^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:126:36

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:4 ~ 91636[c00a]::main), const_param_did: None }) (after pass RemoveZsts) at bb0[4]:
                                Cannot compare unequal types fn(&str) and for<'r> fn(&'r str)
 --> ./91636.rs:6:13
  |
6 |     let _ = x == foo;
  |             ^^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:126:36

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:4 ~ 91636[c00a]::main), const_param_did: None }) (after pass RemoveUnneededDrops) at bb0[4]:
                                Cannot compare unequal types fn(&str) and for<'r> fn(&'r str)
 --> ./91636.rs:6:13
  |
6 |     let _ = x == foo;
  |             ^^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:126:36

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:4 ~ 91636[c00a]::main), const_param_did: None }) (after pass InstCombine) at bb0[4]:
                                Cannot compare unequal types fn(&str) and for<'r> fn(&'r str)
 --> ./91636.rs:6:13
  |
6 |     let _ = x == foo;
  |             ^^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:126:36

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:4 ~ 91636[c00a]::main), const_param_did: None }) (after pass ConstProp) at bb0[4]:
                                Cannot compare unequal types fn(&str) and for<'r> fn(&'r str)
 --> ./91636.rs:6:13
  |
6 |     let _ = x == foo;
  |             ^^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:126:36

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:4 ~ 91636[c00a]::main), const_param_did: None }) (after pass SimplifyConstCondition-after-const-prop) at bb0[4]:
                                Cannot compare unequal types fn(&str) and for<'r> fn(&'r str)
 --> ./91636.rs:6:13
  |
6 |     let _ = x == foo;
  |             ^^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:126:36

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:4 ~ 91636[c00a]::main), const_param_did: None }) (after pass SimplifyComparisonIntegral) at bb0[4]:
                                Cannot compare unequal types fn(&str) and for<'r> fn(&'r str)
 --> ./91636.rs:6:13
  |
6 |     let _ = x == foo;
  |             ^^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:126:36

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:4 ~ 91636[c00a]::main), const_param_did: None }) (after pass SimplifyArmIdentity) at bb0[4]:
                                Cannot compare unequal types fn(&str) and for<'r> fn(&'r str)
 --> ./91636.rs:6:13
  |
6 |     let _ = x == foo;
  |             ^^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:126:36

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:4 ~ 91636[c00a]::main), const_param_did: None }) (after pass SimplifyBranchSame) at bb0[4]:
                                Cannot compare unequal types fn(&str) and for<'r> fn(&'r str)
 --> ./91636.rs:6:13
  |
6 |     let _ = x == foo;
  |             ^^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:126:36

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:4 ~ 91636[c00a]::main), const_param_did: None }) (after pass SimplifyConstCondition-final) at bb0[4]:
                                Cannot compare unequal types fn(&str) and for<'r> fn(&'r str)
 --> ./91636.rs:6:13
  |
6 |     let _ = x == foo;
  |             ^^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:126:36

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:4 ~ 91636[c00a]::main), const_param_did: None }) (after pass RemoveNoopLandingPads) at bb0[4]:
                                Cannot compare unequal types fn(&str) and for<'r> fn(&'r str)
 --> ./91636.rs:6:13
  |
6 |     let _ = x == foo;
  |             ^^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:126:36

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:4 ~ 91636[c00a]::main), const_param_did: None }) (after pass SimplifyCfg-final) at bb0[4]:
                                Cannot compare unequal types fn(&str) and for<'r> fn(&'r str)
 --> ./91636.rs:6:13
  |
6 |     let _ = x == foo;
  |             ^^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:126:36

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:4 ~ 91636[c00a]::main), const_param_did: None }) (after pass RenameReturnPlace) at bb0[4]:
                                Cannot compare unequal types fn(&str) and for<'r> fn(&'r str)
 --> ./91636.rs:6:13
  |
6 |     let _ = x == foo;
  |             ^^^^^^^^
  |
  = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:126:36

thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1383:13
stack backtrace:
   0:     0x7fdc2329e51d - std::backtrace_rs::backtrace::libunwind::trace::ha83d3c29ca45171c
                               at /rustc/2a83fbc42a9bb6bfdb8d3fb4ecce83fb410d7642/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7fdc2329e51d - std::backtrace_rs::backtrace::trace_unsynchronized::h26b9ccedbf051c48
                               at /rustc/2a83fbc42a9bb6bfdb8d3fb4ecce83fb410d7642/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fdc2329e51d - std::sys_common::backtrace::_print_fmt::h5e457999760b88f5
                               at /rustc/2a83fbc42a9bb6bfdb8d3fb4ecce83fb410d7642/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7fdc2329e51d - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hbe8346f709709d41
                               at /rustc/2a83fbc42a9bb6bfdb8d3fb4ecce83fb410d7642/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7fdc232f8ccc - core::fmt::write::hd118a99f3ff6458d
                               at /rustc/2a83fbc42a9bb6bfdb8d3fb4ecce83fb410d7642/library/core/src/fmt/mod.rs:1194:17
   5:     0x7fdc2328fcf1 - std::io::Write::write_fmt::h1319ce9d06dc33b9
                               at /rustc/2a83fbc42a9bb6bfdb8d3fb4ecce83fb410d7642/library/std/src/io/mod.rs:1655:15
   6:     0x7fdc232a1235 - std::sys_common::backtrace::_print::h6d19793f62f802da
                               at /rustc/2a83fbc42a9bb6bfdb8d3fb4ecce83fb410d7642/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7fdc232a1235 - std::sys_common::backtrace::print::h11f51cb1e8e1849d
                               at /rustc/2a83fbc42a9bb6bfdb8d3fb4ecce83fb410d7642/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7fdc232a1235 - std::panicking::default_hook::{{closure}}::h03447e80aba783b4
                               at /rustc/2a83fbc42a9bb6bfdb8d3fb4ecce83fb410d7642/library/std/src/panicking.rs:295:22
   9:     0x7fdc232a0ea9 - std::panicking::default_hook::h1c76be3b96c985fb
                               at /rustc/2a83fbc42a9bb6bfdb8d3fb4ecce83fb410d7642/library/std/src/panicking.rs:314:9
  10:     0x7fdc23acfc21 - rustc_driver[71f879f59330bb6b]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7fdc232a1a06 - std::panicking::rust_panic_with_hook::hb9bd69f80399060c
                               at /rustc/2a83fbc42a9bb6bfdb8d3fb4ecce83fb410d7642/library/std/src/panicking.rs:702:17
  12:     0x7fdc24c17d91 - std[58cab7405c17b2df]::panicking::begin_panic::<rustc_errors[5914e37740eaeab3]::ExplicitBug>::{closure#0}
  13:     0x7fdc24c17816 - std[58cab7405c17b2df]::sys_common::backtrace::__rust_end_short_backtrace::<std[58cab7405c17b2df]::panicking::begin_panic<rustc_errors[5914e37740eaeab3]::ExplicitBug>::{closure#0}, !>
  14:     0x7fdc24c1dc1f - std[58cab7405c17b2df]::panicking::begin_panic::<rustc_errors[5914e37740eaeab3]::ExplicitBug>
  15:     0x7fdc24c1b006 - std[58cab7405c17b2df]::panic::panic_any::<rustc_errors[5914e37740eaeab3]::ExplicitBug>
  16:     0x7fdc263c1a57 - <rustc_errors[5914e37740eaeab3]::HandlerInner as core[679d8fb27ead3507]::ops::drop::Drop>::drop
  17:     0x7fdc25adc258 - core[679d8fb27ead3507]::ptr::drop_in_place::<rustc_session[85ecf831e9c88e1e]::parse::ParseSess>
  18:     0x7fdc25adefd3 - <alloc[159f59a03ffd3b7b]::rc::Rc<rustc_session[85ecf831e9c88e1e]::session::Session> as core[679d8fb27ead3507]::ops::drop::Drop>::drop
  19:     0x7fdc25b091ad - core[679d8fb27ead3507]::ptr::drop_in_place::<rustc_interface[ebfb7a8f3d97ff2]::interface::Compiler>
  20:     0x7fdc25b08944 - rustc_span[714eccce3bad819e]::with_source_map::<core[679d8fb27ead3507]::result::Result<(), rustc_errors[5914e37740eaeab3]::ErrorGuaranteed>, rustc_interface[ebfb7a8f3d97ff2]::interface::create_compiler_and_run<core[679d8fb27ead3507]::result::Result<(), rustc_errors[5914e37740eaeab3]::ErrorGuaranteed>, rustc_driver[71f879f59330bb6b]::run_compiler::{closure#1}>::{closure#1}>
  21:     0x7fdc25ae03e7 - <scoped_tls[f03ae5544dd9ca96]::ScopedKey<rustc_span[714eccce3bad819e]::SessionGlobals>>::set::<rustc_interface[ebfb7a8f3d97ff2]::interface::run_compiler<core[679d8fb27ead3507]::result::Result<(), rustc_errors[5914e37740eaeab3]::ErrorGuaranteed>, rustc_driver[71f879f59330bb6b]::run_compiler::{closure#1}>::{closure#0}, core[679d8fb27ead3507]::result::Result<(), rustc_errors[5914e37740eaeab3]::ErrorGuaranteed>>
  22:     0x7fdc25af57ff - std[58cab7405c17b2df]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[ebfb7a8f3d97ff2]::util::run_in_thread_pool_with_globals<rustc_interface[ebfb7a8f3d97ff2]::interface::run_compiler<core[679d8fb27ead3507]::result::Result<(), rustc_errors[5914e37740eaeab3]::ErrorGuaranteed>, rustc_driver[71f879f59330bb6b]::run_compiler::{closure#1}>::{closure#0}, core[679d8fb27ead3507]::result::Result<(), rustc_errors[5914e37740eaeab3]::ErrorGuaranteed>>::{closure#0}, core[679d8fb27ead3507]::result::Result<(), rustc_errors[5914e37740eaeab3]::ErrorGuaranteed>>
  23:     0x7fdc25af5939 - <<std[58cab7405c17b2df]::thread::Builder>::spawn_unchecked_<rustc_interface[ebfb7a8f3d97ff2]::util::run_in_thread_pool_with_globals<rustc_interface[ebfb7a8f3d97ff2]::interface::run_compiler<core[679d8fb27ead3507]::result::Result<(), rustc_errors[5914e37740eaeab3]::ErrorGuaranteed>, rustc_driver[71f879f59330bb6b]::run_compiler::{closure#1}>::{closure#0}, core[679d8fb27ead3507]::result::Result<(), rustc_errors[5914e37740eaeab3]::ErrorGuaranteed>>::{closure#0}, core[679d8fb27ead3507]::result::Result<(), rustc_errors[5914e37740eaeab3]::ErrorGuaranteed>>::{closure#1} as core[679d8fb27ead3507]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  24:     0x7fdc232abbe3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hbff38f4d7cc5f33b
                               at /rustc/2a83fbc42a9bb6bfdb8d3fb4ecce83fb410d7642/library/alloc/src/boxed.rs:1858:9
  25:     0x7fdc232abbe3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hef44c24dd7faac8d
                               at /rustc/2a83fbc42a9bb6bfdb8d3fb4ecce83fb410d7642/library/alloc/src/boxed.rs:1858:9
  26:     0x7fdc232abbe3 - std::sys::unix::thread::Thread::new::thread_start::hded193f89a16724c
                               at /rustc/2a83fbc42a9bb6bfdb8d3fb4ecce83fb410d7642/library/std/src/sys/unix/thread.rs:108:17
  27:     0x7fdc230835c2 - start_thread
  28:     0x7fdc23108584 - __clone
  29:                0x0 - <unknown>

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.62.0-nightly (2a83fbc42 2022-04-12) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z validate-mir

query stack during panic:
end of query stack

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 Apr 12, 2022
  2. matthiaskrgr commented on Apr 13, 2022

    @matthiaskrgr
    MemberAuthor

    another case
    src/tools/miri/tests/run-pass/issue-91636.rs

    type BuiltIn = for<'a> fn(&str);
    
    struct Function {
        inner: BuiltIn,
    }
    
    impl Function {
        fn new(subr: BuiltIn) -> Self {
            Self { inner: subr }
        }
    }
    
    fn dummy(_: &str) {}
    
    fn main() {
        let func1 = Function::new(dummy);
        let func2 = Function::new(dummy);
        let inner: fn(&'static _) -> _ = func1.inner;
        assert!(inner == func2.inner);
    }
    error: internal compiler error: no errors encountered even though `delay_span_bug` issued
    
    error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:10 ~ issue_91636[2737]::main), const_param_did: None }) (end of phase transition to Optimized) at bb2[3]:
                                    Cannot compare unequal types fn(&str) and for<'r> fn(&'r str)
      --> src/tools/miri/tests/run-pass/issue-91636.rs:19:13
       |
    19 |     assert!(inner == func2.inner);
       |             ^^^^^^^^^^^^^^^^^^^^
       |
       = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:126:36
    
  3. matthiaskrgr commented on Apr 13, 2022

    @matthiaskrgr
    MemberAuthor

    Probably caused by #95320 cc @JakobDegen

  4. JakobDegen commented on Apr 13, 2022

    @JakobDegen
    Contributor

    Oops. That's my b, I'll have a PR up in 10 minutes

  5. added 5 commits that reference this issue on Apr 14, 2022
    5f5f995
    89dd3bf
    f5c97bb
    a30dbc2
    fd7a1f1
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.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