Closed
Description
use std::sync::mpsc::channel;
use std::thread::spawn;
use std::marker::PhantomData;
struct Foo<T> {foo: PhantomData<T>}
fn main() {
let (tx, rx) = channel();
spawn(move || {
tx.send(Foo{ foo: PhantomData });
});
}
fails to compile with the following error (on playpen nightly 2014-05-13):
<anon>:10:5: 10:10 error: internal compiler error: coherence failed to report ambiguity: cannot locate the impl of the trait `core::marker::Send` for the type `[closure <anon>:10:16: 12:6]`
<anon>:10 spawn(move || {
^~~~~
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: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'Box<Any>', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libsyntax/diagnostic.rs:170
Here's the backtrace:
stack backtrace:
1: 0x7fd0dba28b49 - sys::backtrace::write::h412fd048026f70e7uhs
2: 0x7fd0dba30ac9 - panicking::on_panic::h29d81987ed54208bxXw
3: 0x7fd0db9f0862 - rt::unwind::begin_unwind_inner::hb43cf3548917ef54HCw
4: 0x7fd0d8dd3c4d - rt::unwind::begin_unwind::h5201448110574075268
5: 0x7fd0d8dd3be2 - diagnostic::SpanHandler::span_bug::hb39065b9fe8fb3f2D2B
6: 0x7fd0d9b43a49 - middle::traits::error_reporting::report_fulfillment_error::h2459ff2fb01b4302zTN
7: 0x7fd0d99f4d41 - middle::traits::error_reporting::report_fulfillment_errors::hf108381206cc195cPSN
8: 0x7fd0db198414 - check::vtable::select_all_fcx_obligations_or_error::ha187a7a966441c6df9b
9: 0x7fd0db219262 - check::check_bare_fn::hde32c6ea2fd561e5FMn
10: 0x7fd0db217142 - check::CheckItemBodiesVisitor<'a, 'tcx>.Visitor<'tcx>::visit_item::h1fe392053eb35855IJn
11: 0x7fd0db2d1aca - check_crate::closure.38576
12: 0x7fd0db2cb630 - check_crate::hdfe4c6ceaab6493fuCC
13: 0x7fd0dbf890a8 - driver::phase_3_run_analysis_passes::h3c7402bc8b274a4ctGa
14: 0x7fd0dbf69eac - driver::compile_input::h34062f722e30b378Qba
15: 0x7fd0dc025e31 - run_compiler::h58bdb62ca09f7a7275b
16: 0x7fd0dc023682 - boxed::F.FnBox<A>::call_box::h2254708566657730251
17: 0x7fd0dc022c49 - rt::unwind::try::try_fn::h5284975654559288511
18: 0x7fd0dbab3f98 - rust_try_inner
19: 0x7fd0dbab3f85 - rust_try
20: 0x7fd0dc022ee4 - boxed::F.FnBox<A>::call_box::h4931667208008540516
21: 0x7fd0dba2f861 - sys::thread::Thread::new::thread_start::hb8b1207e6c09cbe43Iv
22: 0x7fd0d64732c3 - <unknown>
23: 0x7fd0db6872dc - clone
24: 0x0 - <unknown>
This is probably related to #24424, but doesn't include any lifetimes.