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

broken MIR: bad assignment (&impl Trait = &S): NoSolution #77696

Closed
oldoldman opened this issue Oct 8, 2020 · 4 comments
Closed

broken MIR: bad assignment (&impl Trait = &S): NoSolution #77696

oldoldman opened this issue Oct 8, 2020 · 4 comments
Labels
A-impl-trait Area: impl Trait. Universally / existentially quantified anonymous types with static dispatch. A-mir Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html 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

@oldoldman
Copy link

oldoldman commented Oct 8, 2020

I am not sure if this is a issue in nightly build

error: internal compiler error: broken MIR in DefId(0:12 ~ main[317d]::main[0]) (_6 = &(*_7)): bad assignment (&impl Trait = &S): NoSolution
  --> main.rs:28:26
   |
28 |   let b : & impl Trait = &S;
   |                          ^^
   |
   = note: delayed at src\librustc_mir\borrow_check\type_check\mod.rs:258:27

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', src\librustc_errors\lib.rs:369:17
stack backtrace:
   0:     0x7ff807889f69 - ::fmt::h821f4dd582550bfb
   1:     0x7ff8078b6f7b - core::fmt::write::h312876c93103ed54
   2:     0x7ff80787bae4 - ::fmt::hfb43901216eaeee2
   3:     0x7ff80788f5cb - std::panicking::take_hook::h52d1f68705bfe58e
   4:     0x7ff80788f209 - std::panicking::take_hook::h52d1f68705bfe58e
   5:     0x7ff807d7f8da - rustc_driver::report_ice::h73e31dd3f37a0050
   6:     0x7ff80788ff60 - std::panicking::rust_panic_with_hook::heea127619d634446
   7:     0x7ff80c2ab7a4 - rustc_errors::diagnostic_builder::DiagnosticBuilder::code::h009cd739cbd841b8
   8:     0x7ff80c2aad9f - rustc_errors::diagnostic_builder::DiagnosticBuilder::code::h009cd739cbd841b8
   9:     0x7ff80c2a838d - rustc_errors::annotate_snippet_emitter_writer::AnnotateSnippetEmitterWriter::ui_testing::heda1073e138862a3
  10:     0x7ff80c2727ff - ::drop::h1ca4616953ccd707
  11:     0x7ff807da3297 - ::deref::h3fbcde42f915cc45
  12:     0x7ff807dc447a - ::deref::h3fbcde42f915cc45
  13:     0x7ff807d47b1c - ::generic_arg_data::h9aab78c62ac3ba96
  14:     0x7ff807d34ed1 - ::fmt::h4d767eacfb9c0d6b
  15:     0x7ff807da082b - ::deref::h3fbcde42f915cc45
  16:     0x7ff807d8d280 - ::deref::h3fbcde42f915cc45
  17:     0x7ff807d93e3f - ::deref::h3fbcde42f915cc45
  18:     0x7ff807d2d0f3 - ::fmt::h56077a367631f1cb
  19:     0x7ff80789fcca - std::sys::windows::thread::Thread::new::ha9abef9832621dc4
  20:     0x7ff886c14c5e - BaseThreadInitThunk
  21:     0x7ff8877cf43b - RtlUserThreadStart

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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.47.0-beta.1 (0f91f5c28 2020-08-25) running on x86_64-pc-windows-msvc

query stack during panic:
end of query stack
@oldoldman oldoldman added C-bug Category: This is a bug. 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 Oct 8, 2020
@Stupremee
Copy link
Member

Stupremee commented Oct 8, 2020

Can you share your code and probably update the issue title to be more precise?

@oldoldman
Copy link
Author

oldoldman commented Oct 8, 2020

can reproduce with following code

#![feature(impl_trait_in_bindings)]

struct S;
trait Trait {
  fn demo(&self) {}
}
impl Trait for S {}
fn main() {
  let a : &impl Trait = &S;
}

@Stupremee Stupremee added the requires-nightly This issue requires a nightly compiler in some way. label Oct 8, 2020
@matthewjasper matthewjasper added A-impl-trait Area: impl Trait. Universally / existentially quantified anonymous types with static dispatch. F-impl_trait_in_bindings `#![feature(impl_trait_in_bindings)]` labels Oct 8, 2020
@jonas-schievink jonas-schievink added the A-mir Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html label Oct 8, 2020
@jyn514 jyn514 changed the title Internal Compiler Error broken MIR: bad assignment (&impl Trait = &S): NoSolution Oct 8, 2020
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier label Oct 14, 2020
@henryboisdequin
Copy link
Contributor

henryboisdequin commented Feb 14, 2021

Link to playground

@Alexendoo
Copy link
Member

Alexendoo commented Jul 22, 2021

Duplicate of #54840

@Alexendoo Alexendoo marked this as a duplicate of #54840 Jul 22, 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. A-mir Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html 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

No branches or pull requests

7 participants