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 when trying to use &impl in a binding #54840

Open
smarnach opened this issue Oct 5, 2018 · 3 comments

Comments

@smarnach
Copy link

commented Oct 5, 2018

This code results in an ICE on the playground:

#![feature(impl_trait_in_bindings)]

use std::ops::Add;

fn main() {
    let i: i32 = 0;
    let j: &impl Add = &i;
}

This may be a duplicate of #54600, but I can't really tell. Error message:

   Compiling playground v0.0.1 (/playground)
warning: unused variable: `j`
 --> src/main.rs:7:9
  |
7 |     let j: &impl Add = &i;
  |         ^ help: consider using `_j` instead
  |
  = note: #[warn(unused_variables)] on by default

error: internal compiler error: broken MIR in DefId(0/0:4 ~ playground[bf48]::main[0]) (_2 = &(*_3)): bad assignment (&impl std::ops::Add = &i32): NoSolution
 --> src/main.rs:7:24
  |
7 |     let j: &impl Add = &i;
  |                        ^^

thread 'main' panicked at 'no errors encountered even though `delay_span_bug` issued', librustc_errors/lib.rs:334:17
note: Run with `RUST_BACKTRACE=1` for 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.31.0-nightly (8c4ad4e9e 2018-10-04) running on x86_64-unknown-linux-gnu

note: compiler flags: -C codegen-units=1 -C debuginfo=2 --crate-type bin

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

error: Could not compile `playground`.

To learn more, run the command again with --verbose.

@estebank estebank added the I-ICE label Oct 5, 2018

@estebank

This comment has been minimized.

Copy link
Contributor

commented Oct 5, 2018

error: internal compiler error: broken MIR in DefId(0/0:4 ~ playground[bf48]::main[0]) (_2 = &(*_3)): bad assignment (&impl std::ops::Add = &i32): NoSolution
 --> src/main.rs:7:24
  |
7 |     let j: &impl Add = &i;
  |                        ^^

thread 'main' panicked at 'no errors encountered even though `delay_span_bug` issued', librustc_errors/lib.rs:334:17
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::print
             at libstd/sys_common/backtrace.rs:71
             at libstd/sys_common/backtrace.rs:59
   2: std::panicking::default_hook::{{closure}}
             at libstd/panicking.rs:211
   3: std::panicking::default_hook
             at libstd/panicking.rs:227
   4: rustc::util::common::panic_hook
   5: std::panicking::rust_panic_with_hook
             at libstd/panicking.rs:480
   6: std::panicking::begin_panic
   7: <rustc_errors::Handler as core::ops::drop::Drop>::drop
   8: core::ptr::drop_in_place
   9: core::ptr::drop_in_place
  10: core::ptr::drop_in_place
  11: syntax::with_globals
  12: __rust_maybe_catch_panic
             at libpanic_unwind/lib.rs:102
  13: rustc_driver::run
  14: rustc_driver::main
  15: std::rt::lang_start::{{closure}}
  16: std::panicking::try::do_call
             at libstd/rt.rs:59
             at libstd/panicking.rs:310
  17: __rust_maybe_catch_panic
             at libpanic_unwind/lib.rs:102
  18: std::rt::lang_start_internal
             at libstd/panicking.rs:289
             at libstd/panic.rs:392
             at libstd/rt.rs:58
  19: main
  20: __libc_start_main
  21: <unknown>
query stack during panic:
end of query stack

error: internal compiler error: unexpected panic
@varkor

This comment has been minimized.

Copy link
Member

commented Feb 6, 2019

@alexreg

This comment has been minimized.

Copy link
Contributor

commented Feb 6, 2019

Yeah, impl Trait in bindings is horribly broken, sorry. It’s just not implemented right, internally. I’ll be sure to add this as a test case when I get back to work on it next week or so. Thanks for the report though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.