Closed
Description
When running cargo clippy
on https://github.com/Marwes/combine commit: d102591
Clippy fails with an error: "error: internal compiler error: unexpected panic"
rustc 1.34.0-nightly (4b1e39b 2019-02-05)
cargo 1.34.0-nightly (245818076 2019-01-27)
clippy 0.0.212 (3bda548 2019-02-03)
RUST_BACKTRACE=full cargo clippy --verbose
thread 'rustc' panicked at 'begin <= end (599 <= 288) when slicing `pub)
$(#[$derive])*
struct $type_name;
type PartialState = (());
$(#[$attr])*
fn $name [$($type_params)*]($($arg : $arg_type),*)($input_type) -> $output_type
where [$($where_clause`[...]', src/libcore/str/mod.rs:2030:5
stack backtrace:
0: 0x112160ab3 - std::sys::unix::backtrace::tracing::imp::unwind_backtrace::ha1ab82cbb4d6f11c
1: 0x1121598a2 - std::sys_common::backtrace::_print::h47aa5266c1122f38
2: 0x11215d0a6 - std::panicking::default_hook::{{closure}}::h6025bf67340fffb6
3: 0x11215cdb1 - std::panicking::default_hook::hd2ffbd67b944c8bd
4: 0x1107950f1 - rustc::util::common::panic_hook::hd849485fe2261c61
5: 0x11215d8f6 - std::panicking::rust_panic_with_hook::h7a5caae104289559
6: 0x11215d34c - std::panicking::continue_panic_fmt::hc28906cb7d739d65
7: 0x11215d238 - rust_begin_unwind
8: 0x112185581 - core::panicking::panic_fmt::h602d6010de239117
9: 0x112187a80 - core::str::slice_error_fail::h0a6327d8f0dedf0c
10: 0x10df08b63 - core::str::traits::<impl core::slice::SliceIndex<str> for core::ops::range::RangeFrom<usize>>::index::{{closure}}::h117fd6feb2ac7996
11: 0x10df190a8 - <clippy_lints::functions::Functions as rustc::lint::LateLintPass<'a, 'tcx>>::check_fn::h34c461502c97d641
12: 0x11044ca1d - <rustc::lint::context::LateContext<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_fn::hab73580c424b9152
13: 0x11079fe4a - rustc::hir::intravisit::walk_item::h90f74b5c6bc09e29
14: 0x11044b8c0 - <rustc::lint::context::LateContext<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_item::h03734fcaf896086f
15: 0x11044de6e - <rustc::lint::context::LateContext<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_mod::hf8703dff7658a9c7
16: 0x11079fb6b - rustc::hir::intravisit::walk_item::h90f74b5c6bc09e29
17: 0x11044b8c0 - <rustc::lint::context::LateContext<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_item::h03734fcaf896086f
18: 0x11044de6e - <rustc::lint::context::LateContext<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_mod::hf8703dff7658a9c7
19: 0x11079fb6b - rustc::hir::intravisit::walk_item::h90f74b5c6bc09e29
20: 0x11044b8c0 - <rustc::lint::context::LateContext<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_item::h03734fcaf896086f
21: 0x11044de6e - <rustc::lint::context::LateContext<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_mod::hf8703dff7658a9c7
22: 0x11079a730 - rustc::hir::intravisit::walk_crate::h57b0d5e573659763
23: 0x110450646 - rustc::lint::context::check_crate::h442ccfb7bca93304
24: 0x10e411c26 - rustc::util::common::time::h668ff82752432600
25: 0x10e3fc533 - <std::thread::local::LocalKey<T>>::with::h3871b7c8edad0c47
26: 0x10e3a2cae - rustc::ty::context::TyCtxt::create_and_enter::h1e37fb2793e7410a
27: 0x10e46e243 - rustc_driver::driver::compile_input::h7031c7b83d4fdee0
28: 0x10e41af36 - rustc_driver::run_compiler_with_pool::h3638dc7dc27c0a19
29: 0x10e3b639e - <scoped_tls::ScopedKey<T>>::set::h78384758c2378251
30: 0x10e419ea8 - rustc_driver::run_compiler::h09bc4bbb4983c6f9
31: 0x10dd8eb9b - <scoped_tls::ScopedKey<T>>::set::h4f9f78ea9739d6be
32: 0x10dd80f6d - std::sys_common::backtrace::__rust_begin_short_backtrace::he6028cd38f2f7ad6
33: 0x11216d33e - __rust_maybe_catch_panic
34: 0x10dd8259d - <F as alloc::boxed::FnBox<A>>::call_box::h49377575077b31ed
35: 0x11216c2ab - std::sys::unix::thread::Thread::new::thread_start::hda92a3e89ce02644
36: 0x7fff65034304 - _pthread_body
37: 0x7fff6503726e - _pthread_start
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.34.0-nightly (4b1e39b7b 2019-02-05) running on x86_64-apple-darwin
note: compiler flags: -C debuginfo=2 -C incremental --crate-type lib
note: some of the compiler flags provided by cargo are hidden
error: Could not compile `combine`.
Test case
macro_rules! prepend_2 {
(
( $($pub_: tt)* )
$(#[$derive:meta])*
struct $type_name: ident;
$(#[$attr:meta])*
fn $name: ident ()
$parser: block
) => {
$(#[$attr])*
#[inline(always)]
$($pub_)* fn $name() {
println!("Prepended 2");
$parser
}
};
}
macro_rules! prepend_1 {
(
$(#[$derive:meta])*
pub struct $type_name: ident;
$(#[$attr:meta])*
pub fn $name: ident ()
$parser: block
) => {
prepend_2! {
(pub)
$(#[$derive])*
struct $type_name;
fn $name () {
println!("Prepended 1");
$parser
}
}
};
}
prepend_1! {
#[derive(Copy, Clone)]
pub struct StructOne;
/// Prints "Hello World!".
pub fn say_hello() {
println!("Hello World!");
}
}
fn main() {
say_hello();
}
cargo run
Prepended 2
Prepended 1
Hello World!
RUST_BACKTRACE=full cargo clippy --verbose
thread 'rustc' panicked at 'begin <= end (36 <= 0) when slicing `}
};
}
macro_rules! prepend_1 {
(
$(#[$derive:meta])*
pub struct $type_name: ident;
$(#[$attr:meta])*
pub fn $name: ident ()
$parser: block
) => {
prepend_2! {
(pub`', src/libcore/str/mod.rs:2030:5
stack backtrace:
0: 0x10fafdab3 - std::sys::unix::backtrace::tracing::imp::unwind_backtrace::ha1ab82cbb4d6f11c
1: 0x10faf68a2 - std::sys_common::backtrace::_print::h47aa5266c1122f38
2: 0x10fafa0a6 - std::panicking::default_hook::{{closure}}::h6025bf67340fffb6
3: 0x10faf9db1 - std::panicking::default_hook::hd2ffbd67b944c8bd
4: 0x10e1260f1 - rustc::util::common::panic_hook::hd849485fe2261c61
5: 0x10fafa8f6 - std::panicking::rust_panic_with_hook::h7a5caae104289559
6: 0x10fafa34c - std::panicking::continue_panic_fmt::hc28906cb7d739d65
7: 0x10fafa238 - rust_begin_unwind
8: 0x10fb22581 - core::panicking::panic_fmt::h602d6010de239117
9: 0x10fb24a80 - core::str::slice_error_fail::h0a6327d8f0dedf0c
10: 0x10b89cb63 - core::str::traits::<impl core::slice::SliceIndex<str> for core::ops::range::RangeFrom<usize>>::index::{{closure}}::h117fd6feb2ac7996
11: 0x10b8ad0a8 - <clippy_lints::functions::Functions as rustc::lint::LateLintPass<'a, 'tcx>>::check_fn::h34c461502c97d641
12: 0x10dddda1d - <rustc::lint::context::LateContext<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_fn::hab73580c424b9152
13: 0x10e130e4a - rustc::hir::intravisit::walk_item::h90f74b5c6bc09e29
14: 0x10dddc8c0 - <rustc::lint::context::LateContext<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_item::h03734fcaf896086f
15: 0x10dddee6e - <rustc::lint::context::LateContext<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_mod::hf8703dff7658a9c7
16: 0x10e12b730 - rustc::hir::intravisit::walk_crate::h57b0d5e573659763
17: 0x10dde1646 - rustc::lint::context::check_crate::h442ccfb7bca93304
18: 0x10bda7c26 - rustc::util::common::time::h668ff82752432600
19: 0x10bd92533 - <std::thread::local::LocalKey<T>>::with::h3871b7c8edad0c47
20: 0x10bd38cae - rustc::ty::context::TyCtxt::create_and_enter::h1e37fb2793e7410a
21: 0x10be04243 - rustc_driver::driver::compile_input::h7031c7b83d4fdee0
22: 0x10bdb0f36 - rustc_driver::run_compiler_with_pool::h3638dc7dc27c0a19
23: 0x10bd4c39e - <scoped_tls::ScopedKey<T>>::set::h78384758c2378251
24: 0x10bdafea8 - rustc_driver::run_compiler::h09bc4bbb4983c6f9
25: 0x10b722b9b - <scoped_tls::ScopedKey<T>>::set::h4f9f78ea9739d6be
26: 0x10b714f6d - std::sys_common::backtrace::__rust_begin_short_backtrace::he6028cd38f2f7ad6
27: 0x10fb0a33e - __rust_maybe_catch_panic
28: 0x10b71659d - <F as alloc::boxed::FnBox<A>>::call_box::h49377575077b31ed
29: 0x10fb092ab - std::sys::unix::thread::Thread::new::thread_start::hda92a3e89ce02644
30: 0x7fff65034304 - _pthread_body
31: 0x7fff6503726e - _pthread_start
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.34.0-nightly (4b1e39b7b 2019-02-05) running on x86_64-apple-darwin
note: compiler flags: -C debuginfo=2 -C incremental --crate-type bin
note: some of the compiler flags provided by cargo are hidden