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 with impl_trait_in_bindings when Wrapped #58956

Closed
Centril opened this issue Mar 5, 2019 · 5 comments · Fixed by #87383
Closed

ICE with impl_trait_in_bindings when Wrapped #58956

Centril opened this issue Mar 5, 2019 · 5 comments · Fixed by #87383
Labels
A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. A-typesystem Area: The type system 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

@Centril
Copy link
Contributor

Centril commented Mar 5, 2019

cc @alexreg @nikomatsakis

While writing test cases:

#![feature(impl_trait_in_bindings)]

trait Lam {}

pub struct B;
impl Lam for B {}
pub struct Wrap<T>(T);

const _A: impl Lam = {
    let x: Wrap<impl Lam> = Wrap(B);
    x.0
};

Produces:

error: internal compiler error: broken MIR in DefId(0/0:7 ~ playground[1ded]::_A[0]) (_1 = Wrap<B>(move _2,)): bad assignment (Wrap<impl Lam> = Wrap<B>): NoSolution
  --> src/lib.rs:12:29
   |
12 |     let x: Wrap<impl Lam> = Wrap(B);
   |                             ^^^^^^^

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', src/librustc_errors/lib.rs:354:17
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39
   1: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:71
   2: std::panicking::default_hook::{{closure}}
             at src/libstd/sys_common/backtrace.rs:59
             at src/libstd/panicking.rs:197
   3: std::panicking::default_hook
             at src/libstd/panicking.rs:211
   4: rustc::util::common::panic_hook
   5: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:478
   6: std::panicking::begin_panic
   7: <rustc_errors::Handler as core::ops::drop::Drop>::drop
   8: core::ptr::real_drop_in_place
   9: core::ptr::real_drop_in_place
  10: core::ptr::real_drop_in_place
  11: syntax::with_globals
  12: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:87
  13: <F as alloc::boxed::FnBox<A>>::call_box
  14: std::sys::unix::thread::Thread::new::thread_start
             at /rustc/a9da8fc9c267c08cfdb8cf5b39da14f154d12939/src/liballoc/boxed.rs:759
             at src/libstd/sys_common/thread.rs:14
             at src/libstd/sys/unix/thread.rs:80
  15: start_thread
  16: __clone
query stack during panic:
end of query stack

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 (a9da8fc9c 2019-03-04) running on x86_64-unknown-linux-gnu

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

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

error: Could not compile `playground`.

Possibly dupe of #54600.

@Centril Centril added A-typesystem Area: The type system 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. A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. labels Mar 5, 2019
@alexreg
Copy link
Contributor

alexreg commented Mar 6, 2019

Ugh, I really wish people would ignore that feature for now. It’s becoming the new generic-associated-types. It will be completely overhauled when I can finally get around to it, maybe in 2 weeks.

@Centril
Copy link
Contributor Author

Centril commented Mar 6, 2019

@alexreg Consider it a test case written for you... ;)

@alexreg
Copy link
Contributor

alexreg commented Mar 6, 2019

@Centril Haha, fair!

@varkor
Copy link
Member

varkor commented Mar 6, 2019

Ugh, I really wish people would ignore that feature for now. It’s becoming the new generic-associated-types.

You should add it to:

let incomplete_features = ["generic_associated_types", "const_generics"];

I'm not sure how much it helps, but it's something.

@alexreg
Copy link
Contributor

alexreg commented Mar 7, 2019

@varkor Thanks, didn't know about that.

@Centril Centril added F-impl_trait_in_bindings `#![feature(impl_trait_in_bindings)]` requires-nightly This issue requires a nightly compiler in some way. labels Jul 28, 2019
@jonas-schievink jonas-schievink added the C-bug Category: This is a bug. label 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. A-typesystem Area: The type system 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.

5 participants