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

Misusing rustc_strict_coherence doesn't need to be an ICE #103753

Closed
jruderman opened this issue Oct 30, 2022 · 0 comments · Fixed by #103772
Closed

Misusing rustc_strict_coherence doesn't need to be an ICE #103753

jruderman opened this issue Oct 30, 2022 · 0 comments · Fixed by #103772
Assignees
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@jruderman
Copy link
Contributor

I would prefer for this to produce a normal error instead of an ICE, because ICEs drastically slow down the fuzzer (at least with the way I'm using libfuzzer and a large corpus).

Code

#![feature(rustc_attrs)]
#[rustc_strict_coherence]
trait Foo {}
fn main() {}

Output

error: internal compiler error: compiler/rustc_middle/src/traits/specialization_graph.rs:69:13: To use strict_coherence you need to set with_negative_coherence feature flag
Full output with backtrace
error: internal compiler error: compiler/rustc_middle/src/traits/specialization_graph.rs:69:13: To use strict_coherence you need to set with_negative_coherence feature flag

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/0da281b6068a7d889ae89a9bd8991284cc9b7535/compiler/rustc_errors/src/lib.rs:1519:9
stack backtrace:
   0:        0x103c578a2 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h98e7719cdb057d8f
   1:        0x103caf74a - core::fmt::write::he324e6f3a7ef7ed0
   2:        0x103c4997c - std::io::Write::write_fmt::h295c914c323e508a
   3:        0x103c5766a - std::sys_common::backtrace::print::hb2f2bd76d0a1d9b2
   4:        0x103c5aa76 - std::panicking::default_hook::{{closure}}::h7f2a23a911934152
   5:        0x103c5a7c7 - std::panicking::default_hook::h576cf5867894044c
   6:        0x10e35b62d - rustc_driver[ba5c792b9438c2b]::DEFAULT_HOOK::{closure#0}::{closure#0}
   7:        0x103c5b271 - std::panicking::rust_panic_with_hook::hf0781b554a936fbf
   8:        0x112a47427 - std[8878bd7dd366d71b]::panicking::begin_panic::<rustc_errors[b0e16a209d58ca7d]::ExplicitBug>::{closure#0}
   9:        0x112a46d09 - std[8878bd7dd366d71b]::sys_common::backtrace::__rust_end_short_backtrace::<std[8878bd7dd366d71b]::panicking::begin_panic<rustc_errors[b0e16a209d58ca7d]::ExplicitBug>::{closure#0}, !>
  10:        0x1130ee929 - std[8878bd7dd366d71b]::panicking::begin_panic::<rustc_errors[b0e16a209d58ca7d]::ExplicitBug>
  11:        0x112a46cf9 - std[8878bd7dd366d71b]::panic::panic_any::<rustc_errors[b0e16a209d58ca7d]::ExplicitBug>
  12:        0x112a44f4c - <rustc_errors[b0e16a209d58ca7d]::HandlerInner>::bug::<&alloc[b73bea5876e24fb]::string::String>
  13:        0x112a446d7 - <rustc_errors[b0e16a209d58ca7d]::Handler>::bug::<&alloc[b73bea5876e24fb]::string::String>
  14:        0x112b84a72 - rustc_middle[298407787cc28eff]::ty::context::tls::with_context_opt::<rustc_middle[298407787cc28eff]::ty::context::tls::with_opt<rustc_middle[298407787cc28eff]::util::bug::opt_span_bug_fmt<rustc_span[73e074df7cba0abf]::span_encoding::Span>::{closure#0}, ()>::{closure#0}, ()>
  15:        0x112b86b71 - rustc_middle[298407787cc28eff]::util::bug::opt_span_bug_fmt::<rustc_span[73e074df7cba0abf]::span_encoding::Span>
  16:        0x1130f023e - rustc_middle[298407787cc28eff]::util::bug::bug_fmt
  17:        0x112bf9016 - <rustc_middle[298407787cc28eff]::traits::specialization_graph::OverlapMode>::get
  18:        0x110de7541 - rustc_hir_analysis[3f5a3f8b91adb05]::coherence::inherent_impls_overlap::crate_inherent_impls_overlap_check
  19:        0x111bda4a9 - rustc_query_system[fd3d689380a50de4]::query::plumbing::try_execute_query::<rustc_query_impl[f77634870212a75e]::plumbing::QueryCtxt, rustc_query_system[fd3d689380a50de4]::query::caches::DefaultCache<(), ()>>
  20:        0x111c44d09 - rustc_query_system[fd3d689380a50de4]::query::plumbing::get_query::<rustc_query_impl[f77634870212a75e]::queries::crate_inherent_impls_overlap_check, rustc_query_impl[f77634870212a75e]::plumbing::QueryCtxt>
  21:        0x110dbf344 - <rustc_session[43d2d941ace548e5]::session::Session>::track_errors::<rustc_hir_analysis[3f5a3f8b91adb05]::check_crate::{closure#3}, ()>
  22:        0x110d6e313 - rustc_hir_analysis[3f5a3f8b91adb05]::check_crate
  23:        0x10e433fda - rustc_interface[a666f6d755ed9279]::passes::analysis
  24:        0x111bcc26c - rustc_query_system[fd3d689380a50de4]::query::plumbing::try_execute_query::<rustc_query_impl[f77634870212a75e]::plumbing::QueryCtxt, rustc_query_system[fd3d689380a50de4]::query::caches::DefaultCache<(), core[13371b8ce97f01bb]::result::Result<(), rustc_errors[b0e16a209d58ca7d]::ErrorGuaranteed>>>
  25:        0x111c463f9 - rustc_query_system[fd3d689380a50de4]::query::plumbing::get_query::<rustc_query_impl[f77634870212a75e]::queries::analysis, rustc_query_impl[f77634870212a75e]::plumbing::QueryCtxt>
  26:        0x10e2ea296 - <rustc_interface[a666f6d755ed9279]::passes::QueryContext>::enter::<rustc_driver[ba5c792b9438c2b]::run_compiler::{closure#1}::{closure#2}::{closure#3}, core[13371b8ce97f01bb]::result::Result<(), rustc_errors[b0e16a209d58ca7d]::ErrorGuaranteed>>
  27:        0x10e32ea4d - rustc_span[73e074df7cba0abf]::with_source_map::<core[13371b8ce97f01bb]::result::Result<(), rustc_errors[b0e16a209d58ca7d]::ErrorGuaranteed>, rustc_interface[a666f6d755ed9279]::interface::run_compiler<core[13371b8ce97f01bb]::result::Result<(), rustc_errors[b0e16a209d58ca7d]::ErrorGuaranteed>, rustc_driver[ba5c792b9438c2b]::run_compiler::{closure#1}>::{closure#0}::{closure#1}>
  28:        0x10e31e34c - <scoped_tls[c17fceff1b2b43d8]::ScopedKey<rustc_span[73e074df7cba0abf]::SessionGlobals>>::set::<rustc_interface[a666f6d755ed9279]::interface::run_compiler<core[13371b8ce97f01bb]::result::Result<(), rustc_errors[b0e16a209d58ca7d]::ErrorGuaranteed>, rustc_driver[ba5c792b9438c2b]::run_compiler::{closure#1}>::{closure#0}, core[13371b8ce97f01bb]::result::Result<(), rustc_errors[b0e16a209d58ca7d]::ErrorGuaranteed>>
  29:        0x10e2ede5a - std[8878bd7dd366d71b]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[a666f6d755ed9279]::util::run_in_thread_pool_with_globals<rustc_interface[a666f6d755ed9279]::interface::run_compiler<core[13371b8ce97f01bb]::result::Result<(), rustc_errors[b0e16a209d58ca7d]::ErrorGuaranteed>, rustc_driver[ba5c792b9438c2b]::run_compiler::{closure#1}>::{closure#0}, core[13371b8ce97f01bb]::result::Result<(), rustc_errors[b0e16a209d58ca7d]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[13371b8ce97f01bb]::result::Result<(), rustc_errors[b0e16a209d58ca7d]::ErrorGuaranteed>>
  30:        0x10e2d3f7b - <<std[8878bd7dd366d71b]::thread::Builder>::spawn_unchecked_<rustc_interface[a666f6d755ed9279]::util::run_in_thread_pool_with_globals<rustc_interface[a666f6d755ed9279]::interface::run_compiler<core[13371b8ce97f01bb]::result::Result<(), rustc_errors[b0e16a209d58ca7d]::ErrorGuaranteed>, rustc_driver[ba5c792b9438c2b]::run_compiler::{closure#1}>::{closure#0}, core[13371b8ce97f01bb]::result::Result<(), rustc_errors[b0e16a209d58ca7d]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[13371b8ce97f01bb]::result::Result<(), rustc_errors[b0e16a209d58ca7d]::ErrorGuaranteed>>::{closure#1} as core[13371b8ce97f01bb]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  31:        0x103c64387 - std::sys::unix::thread::Thread::new::thread_start::hfd54df40dd14130e
  32:     0x7ff814d514e1 - __pthread_start

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.66.0-nightly (0da281b60 2022-10-27) running on x86_64-apple-darwin

query stack during panic:
#0 [crate_inherent_impls_overlap_check] check for overlap between inherent impls defined in this crate
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error

Version

rustc 1.66.0-nightly (0da281b60 2022-10-27)
binary: rustc
commit-hash: 0da281b6068a7d889ae89a9bd8991284cc9b7535
commit-date: 2022-10-27
host: x86_64-apple-darwin
release: 1.66.0-nightly
LLVM version: 15.0.2
@jruderman jruderman added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 30, 2022
@compiler-errors compiler-errors self-assigned this Oct 30, 2022
@bors bors closed this as completed in 5bf9d61 Nov 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants