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

ICE with dyn_star: should be handled by try_coerce #105097

Closed
jruderman opened this issue Nov 30, 2022 · 0 comments · Fixed by #105710
Closed

ICE with dyn_star: should be handled by try_coerce #105097

jruderman opened this issue Nov 30, 2022 · 0 comments · Fixed by #105710
Assignees
Labels
C-bug Category: This is a bug. F-dyn_star `#![feature(dyn_star)]` 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

Found with a modified fuzz-rustc

Code

#![feature(dyn_star)]
#![allow(incomplete_features)]

trait Tr {}
fn f(x: dyn* Tr) -> usize {
    x as usize
}
fn main() {}

Error output

error: internal compiler error: compiler/rustc_hir_typeck/src/cast.rs:871: should be handled by try_coerce

Full output including backtrace
error: internal compiler error: compiler/rustc_hir_typeck/src/cast.rs:871:21: should be handled by `try_coerce`

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/1eb62b1235fd77200e6bd967d70e83c0f2497233/compiler/rustc_errors/src/lib.rs:1575:9
stack backtrace:
   0:        0x10ed412a6 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h1901ec5c10c2d477
   1:        0x10ed9fe2a - core::fmt::write::h453ba3b763f16dfb
   2:        0x10ed3364c - std::io::Write::write_fmt::h35935f9cf41659e0
   3:        0x10ed4108a - std::sys_common::backtrace::print::h48cb2ddd4d16ad05
   4:        0x10ed443d3 - std::panicking::default_hook::{{closure}}::hf85401495f021b7c
   5:        0x10ed44128 - std::panicking::default_hook::hcc698ed67aaec0db
   6:        0x11ea5b5fd - rustc_driver[c6bc39476a4ff69]::DEFAULT_HOOK::{closure#0}::{closure#0}
   7:        0x10ed44bb7 - std::panicking::rust_panic_with_hook::h4686e220b4123e59
   8:        0x1232372b7 - std[e853a6d0ec043b70]::panicking::begin_panic::<rustc_errors[5974999511236221]::ExplicitBug>::{closure#0}
   9:        0x1232369c9 - std[e853a6d0ec043b70]::sys_common::backtrace::__rust_end_short_backtrace::<std[e853a6d0ec043b70]::panicking::begin_panic<rustc_errors[5974999511236221]::ExplicitBug>::{closure#0}, !>
  10:        0x1238cb589 - std[e853a6d0ec043b70]::panicking::begin_panic::<rustc_errors[5974999511236221]::ExplicitBug>
  11:        0x12319f469 - std[e853a6d0ec043b70]::panic::panic_any::<rustc_errors[5974999511236221]::ExplicitBug>
  12:        0x12319e31d - <rustc_errors[5974999511236221]::HandlerInner>::bug::<&alloc[374a688e4a400e73]::string::String>
  13:        0x12319dde7 - <rustc_errors[5974999511236221]::Handler>::bug::<&alloc[374a688e4a400e73]::string::String>
  14:        0x12330ae43 - rustc_middle[d5319f07d231351a]::ty::context::tls::with_context_opt::<rustc_middle[d5319f07d231351a]::ty::context::tls::with_opt<rustc_middle[d5319f07d231351a]::util::bug::opt_span_bug_fmt<rustc_span[db835ecaf6c42563]::span_encoding::Span>::{closure#0}, ()>::{closure#0}, ()>
  15:        0x123310191 - rustc_middle[d5319f07d231351a]::util::bug::opt_span_bug_fmt::<rustc_span[db835ecaf6c42563]::span_encoding::Span>
  16:        0x1238cf66e - rustc_middle[d5319f07d231351a]::util::bug::bug_fmt
  17:        0x1212c9dad - <rustc_hir_typeck[1fa5b17a40641e23]::cast::CastCheck>::do_check
  18:        0x1212cb4dd - <rustc_hir_typeck[1fa5b17a40641e23]::cast::CastCheck>::check
  19:        0x121216a28 - <rustc_hir_typeck[1fa5b17a40641e23]::fn_ctxt::FnCtxt>::check_casts
  20:        0x121336d99 - <rustc_hir_typeck[1fa5b17a40641e23]::inherited::InheritedBuilder>::enter::<rustc_hir_typeck[1fa5b17a40641e23]::typeck_with_fallback<rustc_hir_typeck[1fa5b17a40641e23]::typeck::{closure#0}>::{closure#0}::{closure#1}, &rustc_middle[d5319f07d231351a]::ty::context::TypeckResults>
  21:        0x1212d6fa6 - rustc_hir_typeck[1fa5b17a40641e23]::typeck
  22:        0x1222e037f - rustc_query_system[91c4ad596cfd42fe]::query::plumbing::try_execute_query::<rustc_query_impl[5858643fdf1b29eb]::plumbing::QueryCtxt, rustc_query_system[91c4ad596cfd42fe]::query::caches::VecCache<rustc_span[db835ecaf6c42563]::def_id::LocalDefId, &rustc_middle[d5319f07d231351a]::ty::context::TypeckResults>>
  23:        0x12236aac0 - rustc_query_system[91c4ad596cfd42fe]::query::plumbing::get_query::<rustc_query_impl[5858643fdf1b29eb]::queries::typeck, rustc_query_impl[5858643fdf1b29eb]::plumbing::QueryCtxt>
  24:        0x12139573b - rustc_data_structures[8f5aaa015017f2be]::sync::par_for_each_in::<&[rustc_span[db835ecaf6c42563]::def_id::LocalDefId], <rustc_middle[d5319f07d231351a]::hir::map::Map>::par_body_owners<rustc_hir_typeck[1fa5b17a40641e23]::typeck_item_bodies::{closure#0}>::{closure#0}>
  25:        0x1212d697d - rustc_hir_typeck[1fa5b17a40641e23]::typeck_item_bodies
  26:        0x1222be888 - rustc_query_system[91c4ad596cfd42fe]::query::plumbing::try_execute_query::<rustc_query_impl[5858643fdf1b29eb]::plumbing::QueryCtxt, rustc_query_system[91c4ad596cfd42fe]::query::caches::DefaultCache<(), ()>>
  27:        0x12235dfbd - rustc_query_system[91c4ad596cfd42fe]::query::plumbing::get_query::<rustc_query_impl[5858643fdf1b29eb]::queries::typeck_item_bodies, rustc_query_impl[5858643fdf1b29eb]::plumbing::QueryCtxt>
  28:        0x12147d51e - <rustc_session[bf9d936332845243]::session::Session>::time::<(), rustc_hir_analysis[59925a650e5b0dbf]::check_crate::{closure#7}>
  29:        0x12158e912 - rustc_hir_analysis[59925a650e5b0dbf]::check_crate
  30:        0x11eb2418a - rustc_interface[6b0baa6f0acee236]::passes::analysis
  31:        0x1222b078b - rustc_query_system[91c4ad596cfd42fe]::query::plumbing::try_execute_query::<rustc_query_impl[5858643fdf1b29eb]::plumbing::QueryCtxt, rustc_query_system[91c4ad596cfd42fe]::query::caches::DefaultCache<(), core[e7c8723dd1d9fd02]::result::Result<(), rustc_errors[5974999511236221]::ErrorGuaranteed>>>
  32:        0x12236ae8d - rustc_query_system[91c4ad596cfd42fe]::query::plumbing::get_query::<rustc_query_impl[5858643fdf1b29eb]::queries::analysis, rustc_query_impl[5858643fdf1b29eb]::plumbing::QueryCtxt>
  33:        0x11e9ed6d7 - <rustc_interface[6b0baa6f0acee236]::passes::QueryContext>::enter::<rustc_driver[c6bc39476a4ff69]::run_compiler::{closure#1}::{closure#2}::{closure#2}, core[e7c8723dd1d9fd02]::result::Result<(), rustc_errors[5974999511236221]::ErrorGuaranteed>>
  34:        0x11ea33b75 - <rustc_interface[6b0baa6f0acee236]::interface::Compiler>::enter::<rustc_driver[c6bc39476a4ff69]::run_compiler::{closure#1}::{closure#2}, core[e7c8723dd1d9fd02]::result::Result<core[e7c8723dd1d9fd02]::option::Option<rustc_interface[6b0baa6f0acee236]::queries::Linker>, rustc_errors[5974999511236221]::ErrorGuaranteed>>
  35:        0x11e9cfd5d - rustc_span[db835ecaf6c42563]::with_source_map::<core[e7c8723dd1d9fd02]::result::Result<(), rustc_errors[5974999511236221]::ErrorGuaranteed>, rustc_interface[6b0baa6f0acee236]::interface::run_compiler<core[e7c8723dd1d9fd02]::result::Result<(), rustc_errors[5974999511236221]::ErrorGuaranteed>, rustc_driver[c6bc39476a4ff69]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  36:        0x11ea26a9d - <scoped_tls[9dceb67bf45baec5]::ScopedKey<rustc_span[db835ecaf6c42563]::SessionGlobals>>::set::<rustc_interface[6b0baa6f0acee236]::interface::run_compiler<core[e7c8723dd1d9fd02]::result::Result<(), rustc_errors[5974999511236221]::ErrorGuaranteed>, rustc_driver[c6bc39476a4ff69]::run_compiler::{closure#1}>::{closure#0}, core[e7c8723dd1d9fd02]::result::Result<(), rustc_errors[5974999511236221]::ErrorGuaranteed>>
  37:        0x11e9f5ffa - std[e853a6d0ec043b70]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[6b0baa6f0acee236]::util::run_in_thread_pool_with_globals<rustc_interface[6b0baa6f0acee236]::interface::run_compiler<core[e7c8723dd1d9fd02]::result::Result<(), rustc_errors[5974999511236221]::ErrorGuaranteed>, rustc_driver[c6bc39476a4ff69]::run_compiler::{closure#1}>::{closure#0}, core[e7c8723dd1d9fd02]::result::Result<(), rustc_errors[5974999511236221]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[e7c8723dd1d9fd02]::result::Result<(), rustc_errors[5974999511236221]::ErrorGuaranteed>>
  38:        0x11e9d62a5 - <<std[e853a6d0ec043b70]::thread::Builder>::spawn_unchecked_<rustc_interface[6b0baa6f0acee236]::util::run_in_thread_pool_with_globals<rustc_interface[6b0baa6f0acee236]::interface::run_compiler<core[e7c8723dd1d9fd02]::result::Result<(), rustc_errors[5974999511236221]::ErrorGuaranteed>, rustc_driver[c6bc39476a4ff69]::run_compiler::{closure#1}>::{closure#0}, core[e7c8723dd1d9fd02]::result::Result<(), rustc_errors[5974999511236221]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[e7c8723dd1d9fd02]::result::Result<(), rustc_errors[5974999511236221]::ErrorGuaranteed>>::{closure#1} as core[e7c8723dd1d9fd02]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  39:        0x10ed4de87 - std::sys::unix::thread::Thread::new::thread_start::hb253bfeab5e611e1
  40:     0x7ff8083354e1 - __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.67.0-nightly (1eb62b123 2022-11-27) running on x86_64-apple-darwin

query stack during panic:
#0 [typeck] type-checking `f`
#1 [typeck_item_bodies] type-checking all item bodies
#2 [analysis] running analysis passes on this crate
end of query stack

Regression

Regression in nightly-2022-10-16 from #101832 (@compiler-errors)

Version

rustc 1.67.0-nightly (1eb62b123 2022-11-27)
binary: rustc
commit-hash: 1eb62b1235fd77200e6bd967d70e83c0f2497233
commit-date: 2022-11-27
host: x86_64-apple-darwin
release: 1.67.0-nightly
LLVM version: 15.0.4

@rustbot label +F-dyn_star

@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 Nov 30, 2022
@rustbot rustbot added the F-dyn_star `#![feature(dyn_star)]` label Nov 30, 2022
@TaKO8Ki TaKO8Ki self-assigned this Dec 2, 2022
@bors bors closed this as completed in 86bbc20 Dec 17, 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. F-dyn_star `#![feature(dyn_star)]` 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.

3 participants