Closed
Description
The following code:
trait Foo {
#[derive(Clone)]
type Bar;
}
produces the following compilation output:
$ RUST_BACKTRACE=1 cargo build
Compiling bug v0.1.0 (file:///home/virgile/bug)
error: internal compiler error: #[derive(Clone)] on trait item or impl item
--> src/main.rs:2:14
|
2 | #[derive(Clone)]
| ^^^^^
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.22.1 (05e2e1c41 2017-11-22) running on x86_64-unknown-linux-gnu
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'Box<Any>', /checkout/src/librustc_errors/lib.rs:439:8
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
1: std::sys_common::backtrace::_print
at /checkout/src/libstd/sys_common/backtrace.rs:69
2: std::panicking::default_hook::{{closure}}
at /checkout/src/libstd/sys_common/backtrace.rs:58
at /checkout/src/libstd/panicking.rs:381
3: std::panicking::default_hook
at /checkout/src/libstd/panicking.rs:391
4: std::panicking::rust_panic_with_hook
at /checkout/src/libstd/panicking.rs:577
5: std::panicking::begin_panic
6: rustc_errors::Handler::span_bug
7: syntax::ext::base::ExtCtxt::span_bug
8: syntax_ext::deriving::clone::expand_deriving_clone
9: syntax::ext::expand::MacroExpander::expand_invoc
10: syntax::ext::expand::MacroExpander::expand
11: syntax::ext::expand::MacroExpander::expand_crate
12: rustc_driver::driver::phase_2_configure_and_expand::{{closure}}
13: rustc_driver::driver::phase_2_configure_and_expand
14: rustc_driver::driver::compile_input
15: rustc_driver::run_compiler
error: Could not compile `bug`.
To learn more, run the command again with --verbose.
Rust version:
$ rustc --version --verbose
rustc 1.22.1 (05e2e1c41 2017-11-22)
binary: rustc
commit-hash: 05e2e1c41414e8fc73d0f267ea8dab1a3eeeaa99
commit-date: 2017-11-22
host: x86_64-unknown-linux-gnu
release: 1.22.1
LLVM version: 4.0