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 `Wrap`ped #58956

Open
Centril opened this Issue Mar 5, 2019 · 5 comments

Comments

Projects
None yet
3 participants
@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.

@alexreg

This comment has been minimized.

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

This comment has been minimized.

Copy link
Contributor Author

Centril commented Mar 6, 2019

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

@alexreg

This comment has been minimized.

Copy link
Contributor

alexreg commented Mar 6, 2019

@Centril Haha, fair!

@varkor

This comment has been minimized.

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

This comment has been minimized.

Copy link
Contributor

alexreg commented Mar 7, 2019

@varkor Thanks, didn't know about that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.