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

Crash on Implementing !Trait, Not Trait: thread 'rustc' panicked at 'called Option::unwrap() on a None value', src\libcore\option.rs:345:21 #58960

Closed
Jon-Davis opened this issue Mar 6, 2019 · 1 comment
Labels
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

@Jon-Davis
Copy link

So this probably isn't valid Rust code but it did crash the compiler rather then sending me a warning so I thought I'd at least file a bug. I have a struct Wrapper<T> and a trait Releasable, I wanted to implement Releasable on Wrapper in the cases where T implemented Releasable, and in the case where T did not implement !Releasable. Im not sure if this is even valid rust code although I did notice things like RefCell not implementing !Sync so I thought I'd give it a try.

pub struct Wrapper<T>(T);

pub trait Releasable {
    fn release(&mut self);
}

impl<T: Releasable> Releasable for Wrapper<T> {
    fn release(&mut self) {
        self.0.release();
    }
}

impl<T : !Releasable> Releasable for Wrapper<T>{
    fn release(&mut self){}
}

impl<T> Drop for Wrapper<T>{
    fn drop(&mut self) {
        self.release();
    }
}

Meta

thread 'rustc' panicked at 'called Option::unwrap() on a None value', src\libcore\option.rs:345:21
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/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.35.0-nightly (87a4363 2019-03-03) running on x86_64-pc-windows-msvc

note: compiler flags: -C debuginfo=2 -C incremental --crate-type lib

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

stack backtrace:
   0: std::sys_common::alloc::realloc_fallback
   1: std::panicking::take_hook
   2: std::panicking::take_hook
   3: std::panicking::rust_panic_with_hook
   4: std::panicking::begin_panic_fmt
   5: rust_begin_unwind
   6: core::panicking::panic_fmt
   7: core::panicking::panic
   8: syntax::parse::parser::Parser::parse_block
   9: syntax::parse::parser::Parser::parse_block
  10: syntax::parse::parser::Parser::parse_block
  11: syntax::parse::parser::Parser::default_submod_path
  12: syntax::parse::parser::Parser::default_submod_path
  13: syntax::parse::parser::Parser::parse_item
  14: syntax::parse::parser::Parser::parse_visibility
  15: syntax::parse::parser::Parser::default_submod_path
  16: syntax::parse::parser::Parser::default_submod_path
  17: syntax::parse::parser::Parser::parse_item
  18: syntax::parse::parser::Parser::parse_visibility
  19: syntax::parse::parser::Parser::parse_crate_mod
  20: syntax::parse::parse_crate_from_file
  21: <env_logger::fmt::WriteStyle as core::default::Default>::default
  22: <env_logger::fmt::WriteStyle as core::default::Default>::default
  23: rustc_driver::driver::phase_1_parse_input
  24: rustc_driver::driver::compile_input
  25: rustc_driver::run_compiler
  26: <env_logger::Logger as log::Log>::flush
  27: rustc_driver::run_compiler
  28: <env_logger::Logger as log::Log>::flush
  29: <env_logger::fmt::WriteStyle as core::default::Default>::default
  30: _rust_maybe_catch_panic
  31: <env_logger::fmt::WriteStyle as core::default::Default>::default
  32: std::sys::windows::thread::Thread::new
  33: BaseThreadInitThunk
  34: RtlUserThreadStart
@estebank
Copy link
Contributor

estebank commented Mar 6, 2019

Will be fixed by #58861. Duplicate of #58857.

@estebank estebank closed this as completed Mar 6, 2019
@estebank estebank 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. labels Mar 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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

No branches or pull requests

2 participants