Skip to content

ICE when passing a argument bounded by ~const Drop by a value of type that implements !Drop #92114

Closed
@lilasta

Description

@lilasta

There may be a cause somewhere in between 6bda5b3 (2021-12-12) and 8f117a7 (2021-12-13).

Code

Playground

#![feature(const_trait_impl)]
#![feature(const_fn_trait_bound)]
#![feature(inline_const)]
#![feature(negative_impls)]

const fn const_drop<T: ~const Drop>(_x: T) {}

struct NonDrop;

impl !Drop for NonDrop {}

fn main() {
    const { const_drop(NonDrop) };
}

Meta

rustc --version --verbose:

rustc 1.59.0-nightly (e95e084a1 2021-12-19)
binary: rustc
commit-hash: e95e084a14870a718c712936ab5a8f8cd0159485
commit-date: 2021-12-19
host: x86_64-unknown-linux-gnu
release: 1.59.0-nightly
LLVM version: 13.0.0

Error output

error: internal compiler error: broken MIR in DefId(0:9 ~ tes[cd70]::main::{constant#0}) (NoSolution): could not prove Binder(~const TraitPredicate(<NonDrop as std::ops::Drop>, polarity:Positive), [])
  |
  = note: delayed at compiler/rustc_borrowck/src/type_check/mod.rs:319:27

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', compiler/rustc_errors/src/lib.rs:1188:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic
Backtrace

stack backtrace:
   0: rust_begin_unwind
             at /rustc/e95e084a14870a718c712936ab5a8f8cd0159485/library/std/src/panicking.rs:498:5
   1: core::panicking::panic_fmt
             at /rustc/e95e084a14870a718c712936ab5a8f8cd0159485/library/core/src/panicking.rs:107:14
   2: core::panicking::panic_display::<&str>
   3: <rustc_errors::HandlerInner>::flush_delayed
   4: <rustc_errors::HandlerInner as core::ops::drop::Drop>::drop
   5: core::ptr::drop_in_place::<rustc_session::parse::ParseSess>
   6: <alloc::rc::Rc<rustc_session::session::Session> as core::ops::drop::Drop>::drop
   7: core::ptr::drop_in_place::<rustc_interface::interface::Compiler>
   8: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorReported>, rustc_interface::interface::create_compiler_and_run<core::result::Result<(), rustc_errors::ErrorReported>, rustc_driver::run_compiler::{closure#1}>::{closure#1}>
   9: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::util::setup_callbacks_and_run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorReported>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been 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.glacierICE tracked in rust-lang/glacier.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions