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

crashes in used_underscore_binding_macro.rs with debug assertions enabled #3628

Closed
matthiaskrgr opened this issue Jan 4, 2019 · 10 comments · Fixed by #3635
Closed

crashes in used_underscore_binding_macro.rs with debug assertions enabled #3628

matthiaskrgr opened this issue Jan 4, 2019 · 10 comments · Fixed by #3635
Labels
C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@matthiaskrgr
Copy link
Member

This happened when I tried to update clippy in the rustc repo.

I have not been able to reproduce locally.

rustc PR: rust-lang/rust#57303

backtrace of the crash: https://travis-ci.org/rust-lang/rust/jobs/475319450#L7599

[01:28:24] test [run-pass] run-pass/match_same_arms_const.rs ... ok
[01:28:24] test [run-pass] run-pass/needless_lifetimes_impl_trait.rs ... ok
[01:28:24] test [run-pass] run-pass/mut_mut_macro.rs ... ok
[01:28:24] test [run-pass] run-pass/needless_borrow_fp.rs ... ok
[01:28:25] test [run-pass] run-pass/procedural_macro.rs ... ok
[01:28:25] test [run-pass] run-pass/regressions.rs ... ok
[01:28:25] test [run-pass] run-pass/returns.rs ... ok
[01:28:26] test [run-pass] run-pass/single-match-else.rs ... ok
[01:28:26] test [run-pass] run-pass/whitelist/conf_whitelisted.rs ... ok
[01:28:27] test [run-pass] run-pass/used_underscore_binding_macro.rs ... FAILED
[01:28:27] 
[01:28:27] failures:
[01:28:27] 
[01:28:27] ---- [run-pass] run-pass/used_underscore_binding_macro.rs stdout ----
[01:28:27] 
[01:28:27] error: compilation failed!
[01:28:27] status: exit code: 101
[01:28:27] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools-bin/clippy-driver" "tests/run-pass/used_underscore_binding_macro.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/build/clippy-f6a900eb04107d45/out/test_build_base" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/build/clippy-f6a900eb04107d45/out/test_build_base/used_underscore_binding_macro.stage-id" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "-Dwarnings" "-Zui-testing" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/build/clippy-f6a900eb04107d45/out/test_build_base/used_underscore_binding_macro.stage-id.aux"
[01:28:27] stdout:
[01:28:27] ------------------------------------------
[01:28:27] 
[01:28:27] ------------------------------------------
[01:28:27] stderr:
[01:28:27] ------------------------------------------
[01:28:27] {"message":"src/librustc/ty/context.rs:248: node type MacroAttributesTest (id=43) with HirId::owner DefId(0/0:9 ~ used_underscore_binding_macro[317d]::_IMPL_DESERIALIZE_FOR_MacroAttributesTest[0]::{{impl}}[0]) cannot be placed in TypeckTables with local_id_root DefId(0/0:6 ~ used_underscore_binding_macro[317d]::_IMPL_DESERIALIZE_FOR_MacroAttributesTest[0])","code":null,"level":"error: internal compiler error","spans":[],"children":[],"rendered":"error: internal compiler error: src/librustc/ty/context.rs:248: node type MacroAttributesTest (id=43) with HirId::owner DefId(0/0:9 ~ used_underscore_binding_macro[317d]::_IMPL_DESERIALIZE_FOR_MacroAttributesTest[0]::{{impl}}[0]) cannot be placed in TypeckTables with local_id_root DefId(0/0:6 ~ used_underscore_binding_macro[317d]::_IMPL_DESERIALIZE_FOR_MacroAttributesTest[0])\n\n"}
[01:28:27] thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:590:9
[01:28:27] stack backtrace:
[01:28:27]    0:     0x7fe8334a8d93 - std::sys::unix::backtrace::tracing::imp::unwind_backtrace::hd98426cd3492fad9
[01:28:27]    1:     0x7fe8334a0d28 - std::sys_common::backtrace::_print::h33dc68ee3471107b
[01:28:27]    2:     0x7fe8334a4b91 - std::panicking::default_hook::{{closure}}::h6e8ca1fbae609b31
[01:28:27]    3:     0x7fe8334a4868 - std::panicking::default_hook::h12d08263585ea668
[01:28:27]    4:     0x7fe8355ba8ef - rustc::util::common::panic_hook::h8664254e5d78c027
[01:28:27]    5:     0x7fe8334a54a4 - std::panicking::rust_panic_with_hook::h80ecd07d9fdfd689
[01:28:27]    6:     0x7fe834319e4c - std::panicking::begin_panic::h606da2437d0c9a78
[01:28:27]    7:     0x7fe83434220e - rustc_errors::Handler::bug::h5f18c9aa3002a3e1
[01:28:27]    8:     0x7fe8350964a3 - rustc::util::bug::opt_span_bug_fmt::{{closure}}::ha70b54c46e545966
[01:28:27]    9:     0x7fe835091a59 - rustc::ty::context::tls::with_opt::{{closure}}::h06335bf584d257c5
[01:28:27]   10:     0x7fe835091974 - rustc::ty::context::tls::with_context_opt::hb4bad76e7a1bb6a7
[01:28:27]   11:     0x7fe835091a06 - rustc::ty::context::tls::with_opt::hd45864d4b45a4b65
[01:28:27]   12:     0x7fe835096384 - rustc::util::bug::opt_span_bug_fmt::h1c27e2cc1d1149c3
[01:28:27]   13:     0x7fe8350962f6 - rustc::util::bug::bug_fmt::h8b515233d6f03333
[01:28:27]   14:     0x7fe834e79b45 - rustc::ty::context::validate_hir_id_for_typeck_tables::{{closure}}::h686eb8a406d530f8
[01:28:27]   15:     0x7fe834e8f648 - rustc::ty::context::tls::with::{{closure}}::h6680e41cb9e76345
[01:28:27]   16:     0x7fe834e8ddff - rustc::ty::context::tls::with_context::{{closure}}::h219fd61af3d2405c
[01:28:27]   17:     0x7fe834e8dda8 - rustc::ty::context::tls::with_context_opt::h390957d2f03df239
[01:28:27]   18:     0x7fe834e8ddd5 - rustc::ty::context::tls::with_context::h180ddfa25e2e2cf2
[01:28:27]   19:     0x7fe834e8f635 - rustc::ty::context::tls::with::hf144144bba27d185
[01:28:27]   20:     0x7fe834e7ab8d - rustc::ty::context::TypeckTables::node_id_to_type_opt::h22a50a087c54f413
[01:28:27]   21:     0x55d06adadaa0 - <clippy_lints::random_state::Pass as rustc::lint::LateLintPass<'a, 'tcx>>::check_ty::h0e791f3e8996c729
[01:28:27]   22:     0x7fe83557bcbf - <rustc::lint::context::LateContext<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_ty::h72ebdaa9528dee36
[01:28:27]   23:     0x7fe835501e2f - rustc::hir::intravisit::walk_item::he489cc90a12bea7b
[01:28:27]   24:     0x7fe83557a108 - <rustc::lint::context::LateContext<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_item::h5728335ea922cc15
[01:28:27]   25:     0x7fe83557c64c - <rustc::lint::context::LateContext<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_block::h72db13ed2a88cb28
[01:28:27]   26:     0x7fe83557aa79 - <rustc::lint::context::LateContext<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_expr::hcf6ab50f0c847e80
[01:28:27]   27:     0x7fe835579cdf - <rustc::lint::context::LateContext<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_body::h7e2b7e472ece7e94
[01:28:27]   28:     0x7fe835501c2d - rustc::hir::intravisit::walk_item::he489cc90a12bea7b
[01:28:27]   29:     0x7fe83557a108 - <rustc::lint::context::LateContext<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_item::h5728335ea922cc15
[01:28:27]   30:     0x7fe83557c0c0 - <rustc::lint::context::LateContext<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_mod::hb9a3c90f0f60db70
[01:28:27]   31:     0x7fe8354f08ae - rustc::hir::intravisit::walk_crate::hde124e87f25baddc
[01:28:27]   32:     0x7fe835582755 - rustc::lint::context::check_crate::h6589d55ae41b1c25
[01:28:27]   33:     0x7fe8365d9d9b - rustc::util::common::time::h7e4a33c762ad15e7
[01:28:27]   34:     0x7fe83667b97a - <std::thread::local::LocalKey<T>>::with::h952b72befc3ce74e
[01:28:27]   35:     0x7fe8365f3a66 - rustc::ty::context::TyCtxt::create_and_enter::h5cc63bc0874b4162
[01:28:27]   36:     0x7fe83665f64e - rustc_driver::driver::compile_input::h03868f75b7316f01
[01:28:27]   37:     0x7fe8365c262a - rustc_driver::run_compiler_with_pool::h741dc60e958f63f8
[01:28:27]   38:     0x7fe8365de9b5 - <scoped_tls::ScopedKey<T>>::set::hc89acbedf3eb8704
[01:28:27]   39:     0x7fe8365c158a - rustc_driver::run_compiler::hce605fc8eee3e069
[01:28:27]   40:     0x55d06acd403c - <scoped_tls::ScopedKey<T>>::set::h9bd1cbe659af503f
[01:28:27]   41:     0x55d06acbdaa2 - std::sys_common::backtrace::__rust_begin_short_backtrace::h79264eee389336bd
[01:28:27]   42:     0x7fe8334b85f9 - __rust_maybe_catch_panic
[01:28:27]   43:     0x55d06acb5792 - std::panicking::try::h5193e9903c6aa0c4
[01:28:27]   44:     0x55d06acbeed5 - <F as alloc::boxed::FnBox<A>>::call_box::hf882d8e28a85db34
[01:28:27]   45:     0x7fe8334b723d - std::sys::unix::thread::Thread::new::thread_start::h013506ce4de301ef
[01:28:27]   46:     0x7fe83321d6b9 - start_thread
[01:28:27]   47:     0x7fe832d3d41c - clone
[01:28:27]   48:                0x0 - <unknown>
[01:28:27] query stack during panic:
[01:28:27] end of query stack
[01:28:27] {"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error\n\n"}
[01:28:27] 
[01:28:27] note: the compiler unexpectedly panicked. this is a bug.
[01:28:27] 
[01:28:27] note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
[01:28:27] 
[01:28:27] note: rustc 1.33.0-dev running on x86_64-unknown-linux-gnu
[01:28:27] 
[01:28:27] note: compiler flags: -Z ui-testing -C prefer-dynamic
[01:28:27] 
[01:28:27] 
[01:28:27] ------------------------------------------
[01:28:27] 
[01:28:27] thread '[run-pass] run-pass/used_underscore_binding_macro.rs' panicked at 'explicit panic', /cargo/registry/src/github.com-1ecc6299db9ec823/compiletest_rs-0.3.18/src/runtest.rs:2632:9
[01:28:27] stack backtrace:
[01:28:27]    0:     0x7f961828ed93 - std::sys::unix::backtrace::tracing::imp::unwind_backtrace::hd98426cd3492fad9
[01:28:27]    1:     0x7f9618286d28 - std::sys_common::backtrace::_print::h33dc68ee3471107b
[01:28:27]    2:     0x7f961828ab91 - std::panicking::default_hook::{{closure}}::h6e8ca1fbae609b31
[01:28:27]    3:     0x7f961828a804 - std::panicking::default_hook::h12d08263585ea668
[01:28:27]    4:     0x7f961828b391 - std::panicking::rust_panic_with_hook::h80ecd07d9fdfd689
[01:28:27]    5:     0x5646e2a28914 - std::panicking::begin_panic::hadf60e87c9929027
[01:28:27]    6:     0x5646e2a5f2d3 - compiletest_rs::runtest::ProcRes::fatal::hfa2c6389155fd953
[01:28:27]    7:     0x5646e2a5c3c3 - compiletest_rs::runtest::TestCx::fatal_proc_rec::hdd310e827939ab5e
[01:28:27]    8:     0x5646e2a4fd50 - compiletest_rs::runtest::TestCx::run_rpass_test::h19370d3a9fbf18e4
[01:28:27]    9:     0x5646e2a411c1 - compiletest_rs::runtest::run::h998e69dd7ca49ec9
[01:28:27]   10:     0x5646e2a1691f - <F as alloc::boxed::FnBox<A>>::call_box::h1a16d2f0372957d2
[01:28:27]   11:     0x7f961852bcc2 - <F as alloc::boxed::FnBox<A>>::call_box::hebbf092c2f8269e4
[01:28:27]   12:     0x7f961829e5f9 - __rust_maybe_catch_panic
[01:28:27]   13:     0x7f961854a0bc - test::run_test::run_test_inner::{{closure}}::h65af44dd80c046ef
[01:28:27]   14:     0x7f9618521d04 - std::sys_common::backtrace::__rust_begin_short_backtrace::h3b93232a43700f8d
[01:28:27]   15:     0x7f9618522334 - std::panicking::try::do_call::h0a3810c7bb8e06bb
[01:28:27]   16:     0x7f961829e5f9 - __rust_maybe_catch_panic
[01:28:27]   17:     0x7f961852b9ec - <F as alloc::boxed::FnBox<A>>::call_box::h1c57c7ed07371bcf
[01:28:27]   18:     0x7f961829d23d - std::sys::unix::thread::Thread::new::thread_start::h013506ce4de301ef
[01:28:27]   19:     0x7f96180036b9 - start_thread
[01:28:27]   20:     0x7f9617b2341c - clone
[01:28:27]   21:                0x0 - <unknown>
[01:28:27] 
[01:28:27] 
[01:28:27] failures:
[01:28:27]     [run-pass] run-pass/used_underscore_binding_macro.rs
[01:28:27] 
[01:28:27] test result: FAILED. 29 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out
[01:28:27] 
[01:28:27] test compile_test ... FAILED
[01:28:27] 
[01:28:27] failures:
[01:28:27] 
[01:28:27] ---- compile_test stdout ----
[01:28:27] thread 'compile_test' panicked at 'Some tests failed', /cargo/registry/src/github.com-1ecc6299db9ec823/compiletest_rs-0.3.18/src/lib.rs:90:22
[01:28:27] stack backtrace:
[01:28:27]    0:     0x7f961828ed93 - std::sys::unix::backtrace::tracing::imp::unwind_backtrace::hd98426cd3492fad9
[01:28:27]    1:     0x7f9618286d28 - std::sys_common::backtrace::_print::h33dc68ee3471107b
[01:28:27]    2:     0x7f961828ab91 - std::panicking::default_hook::{{closure}}::h6e8ca1fbae609b31
[01:28:27]    3:     0x7f961828a804 - std::panicking::default_hook::h12d08263585ea668
[01:28:27]    4:     0x7f961828b391 - std::panicking::rust_panic_with_hook::h80ecd07d9fdfd689
[01:28:27]    5:     0x5646e2a28914 - std::panicking::begin_panic::hadf60e87c9929027
[01:28:27]    6:     0x5646e2a17829 - compiletest_rs::run_tests::hf00c144629d2c324
[01:28:27]    7:     0x5646e2a0f492 - core::ops::function::FnOnce::call_once::h37659e959656fa8d
[01:28:27]    8:     0x7f961852b8be - <F as alloc::boxed::FnBox<A>>::call_box::h0134f4ddfc3abdce
[01:28:27]    9:     0x7f961829e5f9 - __rust_maybe_catch_panic
[01:28:27]   10:     0x7f961854a0bc - test::run_test::run_test_inner::{{closure}}::h65af44dd80c046ef
[01:28:27]   11:     0x7f9618521d04 - std::sys_common::backtrace::__rust_begin_short_backtrace::h3b93232a43700f8d
[01:28:27]   12:     0x7f9618522334 - std::panicking::try::do_call::h0a3810c7bb8e06bb
[01:28:27]   13:     0x7f961829e5f9 - __rust_maybe_catch_panic
[01:28:27]   14:     0x7f961852b9ec - <F as alloc::boxed::FnBox<A>>::call_box::h1c57c7ed07371bcf
[01:28:27]   15:     0x7f961829d23d - std::sys::unix::thread::Thread::new::thread_start::h013506ce4de301ef
[01:28:27]   16:     0x7f96180036b9 - start_thread
[01:28:27]   17:     0x7f9617b2341c - clone
[01:28:27]   18:                0x0 - <unknown>
[01:28:27] 
[01:28:27] 
[01:28:27] failures:
[01:28:27]     compile_test
[01:28:27] 
[01:28:27] test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out
[01:28:27] 
[01:28:27] error: test failed, to rerun pass '--test compile-test'
[01:28:27] 
[01:28:27] 
[01:28:27] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "test" "--target" "x86_64-unknown-linux-gnu" "-j" "4" "--release" "--locked" "--color" "always" "--manifest-path" "/checkout/src/tools/clippy/Cargo.toml" "--features" "rustc-workspace-hack/all-static"
[01:28:27] expected success, got: exit code: 101

I'll try to disable the lint for this particular test.

@matthiaskrgr matthiaskrgr added I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️ C-bug Category: Clippy is not doing the correct thing labels Jan 4, 2019
matthiaskrgr added a commit to matthiaskrgr/rust-clippy that referenced this issue Jan 4, 2019
bors added a commit that referenced this issue Jan 4, 2019
tests: used_underscore_binding_macro: disable random_state lint.

Trying to work around a crash (see #3628) in
rust-lang/rust#57303
@mati865
Copy link
Contributor

mati865 commented Jan 4, 2019

To be more specific it happens in the line:

if let Some(tys) = cx.tables.node_id_to_type_opt(ty.hir_id) {

rust-lang/rust#57298 seems to have better backtrace, circumstances remain unknown.

@matthiaskrgr
Copy link
Member Author

I have been able to reproduce locally with debug-assertions = true now!

@matthiaskrgr matthiaskrgr changed the title random state lint crashes in used_underscore_binding_macro.rs under strange circumstances crashes in used_underscore_binding_macro.rs with debug assertions enabled Jan 4, 2019
@matthiaskrgr
Copy link
Member Author

Removing the random_state lint fixes the ICE for me.

Should we revert the the lint for now?

@matthiaskrgr
Copy link
Member Author

cc @xfix

matthiaskrgr added a commit to matthiaskrgr/rust-clippy that referenced this issue Jan 5, 2019
…sch"

This reverts commit 0a6593c, reversing
changes made to 5277a1f.

This hopefully fixes rust-lang#3628
@mati865
Copy link
Contributor

mati865 commented Jan 5, 2019

Have you tried asking somebody from compiler/language team?
IIRC eddyb and petrochenkov not long time ago helped with HIR code in Clippy.

@KamilaBorowska
Copy link
Contributor

Yeah, my code is probably completely wrong, but I didn't realize as it worked for me.

bors added a commit that referenced this issue Jan 5, 2019
Revert the random_state lint.

Remove the random_state lint until it or rustc has been fixed to no longer crash with debug assertions (see #3628)
We can't update clippy in the rustc repo because of this which is blocking nightlies because toolstate is already broken.

fixes #3628
@bors bors closed this as completed in #3635 Jan 5, 2019
@mati865
Copy link
Contributor

mati865 commented Jan 8, 2019

@xftroxgpx said it works with master now.
We can revert revert of state_lint.

@ghost
Copy link

ghost commented Jan 8, 2019

@mati865 but doesn't it work because of its existance?

@mati865
Copy link
Contributor

mati865 commented Jan 8, 2019

Sorry, I misunderstood the context.

@ghost
Copy link

ghost commented Jan 8, 2019

It's all good, no worries 👍 I was actually prepared to maybe re-test with the specified changes.

flip1995 pushed a commit to flip1995/rust-clippy that referenced this issue Jun 28, 2024
add back some tokio features

Turns out I went a bit too fer when I removed features, so `socketpair` was no longer used.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants