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

Closed
smarnach opened this issue Oct 5, 2018 · 3 comments · Fixed by #87383
Closed

ICE when trying to use &impl in a binding #54840

smarnach opened this issue Oct 5, 2018 · 3 comments · Fixed by #87383
Labels
A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. C-bug Category: This is a bug. F-impl_trait_in_bindings `#![feature(impl_trait_in_bindings)]` glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@smarnach
Copy link
Contributor

smarnach 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 Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Oct 5, 2018
@estebank
Copy link
Contributor

estebank 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
Copy link
Member

varkor commented Feb 6, 2019

cc @alexreg

@alexreg
Copy link
Contributor

alexreg 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.

@jonas-schievink jonas-schievink added A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. C-bug Category: This is a bug. F-impl_trait_in_bindings `#![feature(impl_trait_in_bindings)]` T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. requires-nightly This issue requires a nightly compiler in some way. labels Aug 6, 2019
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Oct 15, 2019
JohnTitor added a commit to JohnTitor/rust that referenced this issue Jul 23, 2021
…sts, r=oli-obk

Add regression tests for the impl_trait_in_bindings ICEs

Closes rust-lang#54600, closes rust-lang#54840, closes rust-lang#58504, closes rust-lang#58956, closes rust-lang#70971, closes rust-lang#79099, closes rust-lang#84919, closes rust-lang#86201, closes rust-lang#86642, closes rust-lang#87295

r? `@oli-obk`
@bors bors closed this as completed in 7c0c329 Jul 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. C-bug Category: This is a bug. F-impl_trait_in_bindings `#![feature(impl_trait_in_bindings)]` glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants