Skip to content

format! inside std::path::Path::from panicks rustc #104664

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

Closed
justofisker opened this issue Nov 21, 2022 · 1 comment
Closed

format! inside std::path::Path::from panicks rustc #104664

justofisker opened this issue Nov 21, 2022 · 1 comment
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

@justofisker
Copy link

justofisker commented Nov 21, 2022

Code

fn main() {
    std::path::Path::from(format!(""));
}

Meta

rustc --version --verbose:

rustc 1.65.0 (897e37553 2022-11-02)
binary: rustc
commit-hash: 897e37553bba8b42751c67658967889d11ecd120
commit-date: 2022-11-02
host: x86_64-pc-windows-msvc
release: 1.65.0
LLVM version: 15.0.0

Error output

error: internal compiler error: compiler\rustc_middle\src\ty\context.rs:703:13: node_type: no type for node `expr {
                                        let res = $crate::fmt::format($crate::__export::format_args!($($arg)*));
                                        res
                                    } (hir_id=HirId { owner: DefId(0:6 ~ bugreport[f971]::main), local_id: 28 })`
Backtrace

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/897e37553bba8b42751c67658967889d11ecd120\compiler\rustc_errors\src\lib.rs:1462:9
stack backtrace:
   0:     0x7fff5c148fb2 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h1086ecfa86360858
   1:     0x7fff5c1840db - core::fmt::write::hbadbc3de7beb6abb
   2:     0x7fff5c13b8aa - <std::io::IoSlice as core::fmt::Debug>::fmt::hb7e33fb242ec9ac1
   3:     0x7fff5c14c5b4 - std::panicking::default_hook::hb8b3ce065b661264
   4:     0x7fff5c14c1ea - std::panicking::default_hook::hb8b3ce065b661264
   5:     0x7fff260d25ee - rustc_driver[c6471a3a75cc3305]::describe_lints
   6:     0x7fff5c14cfb2 - std::panicking::rust_panic_with_hook::h33e40e3f5d3be1f3
   7:     0x7fff28313583 - <rustc_middle[12c473a188441910]::ty::DestructuredConst as core[8087a2e8d825f5e1]::fmt::Debug>::fmt
   8:     0x7fff28312169 - <rustc_middle[12c473a188441910]::ty::DestructuredConst as core[8087a2e8d825f5e1]::fmt::Debug>::fmt
   9:     0x7fff2833a8b9 - <rustc_middle[12c473a188441910]::ty::subst::UserSubsts as rustc_middle[12c473a188441910]::ty::context::Lift>::lift_to_tcx
  10:     0x7fff28310a89 - <rustc_middle[12c473a188441910]::ty::DestructuredConst as core[8087a2e8d825f5e1]::fmt::Debug>::fmt
  11:     0x7fff2830e051 - <rustc_middle[12c473a188441910]::ty::DestructuredConst as core[8087a2e8d825f5e1]::fmt::Debug>::fmt
  12:     0x7fff2830d8d2 - <rustc_middle[12c473a188441910]::ty::DestructuredConst as core[8087a2e8d825f5e1]::fmt::Debug>::fmt
  13:     0x7fff28375687 - <rustc_middle[12c473a188441910]::ty::sty::Binder<rustc_middle[12c473a188441910]::ty::TraitPredicate>>::print_modifiers_and_trait_path
  14:     0x7fff28376d58 - rustc_middle[12c473a188441910]::util::bug::bug_fmt
  15:     0x7fff28376cd5 - rustc_middle[12c473a188441910]::util::bug::bug_fmt
  16:     0x7fff25fa603d - <rustc_middle[12c473a188441910]::ty::context::TypeckResults>::expr_ty_adjusted
  17:     0x7fff2820b289 - <rustc_infer[3acbbff32055c339]::infer::InferCtxt as rustc_trait_selection[51ac1f8d3e2d292c]::traits::error_reporting::suggestions::InferCtxtExt>::suggest_fully_qualified_path
  18:     0x7fff2821bcf7 - <rustc_infer[3acbbff32055c339]::infer::InferCtxt as rustc_trait_selection[51ac1f8d3e2d292c]::traits::error_reporting::InferCtxtPrivExt>::note_obligation_cause
  19:     0x7fff28210418 - <rustc_infer[3acbbff32055c339]::infer::InferCtxt as rustc_trait_selection[51ac1f8d3e2d292c]::traits::error_reporting::InferCtxtExt>::report_selection_error
  20:     0x7fff2822019f - <rustc_infer[3acbbff32055c339]::infer::InferCtxt as rustc_trait_selection[51ac1f8d3e2d292c]::traits::error_reporting::InferCtxtPrivExt>::report_fulfillment_error
  21:     0x7fff2820eb25 - <rustc_infer[3acbbff32055c339]::infer::InferCtxt as rustc_trait_selection[51ac1f8d3e2d292c]::traits::error_reporting::InferCtxtExt>::report_fulfillment_errors
  22:     0x7fff2557472b - <rustc_typeck[49c87e7593e195a8]::check::fn_ctxt::FnCtxt>::check_call
  23:     0x7fff25580e40 - <rustc_typeck[49c87e7593e195a8]::check::fn_ctxt::FnCtxt>::demand_coerce
  24:     0x7fff255bff8c - <rustc_typeck[49c87e7593e195a8]::check::fn_ctxt::FnCtxt>::check_stmt
  25:     0x7fff255c0a8f - <rustc_typeck[49c87e7593e195a8]::check::fn_ctxt::FnCtxt>::check_stmt
  26:     0x7fff25580f11 - <rustc_typeck[49c87e7593e195a8]::check::fn_ctxt::FnCtxt>::demand_coerce
  27:     0x7fff2558c001 - <rustc_typeck[49c87e7593e195a8]::check::fn_ctxt::FnCtxt>::demand_coerce
  28:     0x7fff25629131 - rustc_typeck[49c87e7593e195a8]::check::rvalue_scopes::resolve_rvalue_scopes
  29:     0x7fff255182b2 - <rustc_typeck[49c87e7593e195a8]::constrained_generic_params::ParameterCollector as rustc_middle[12c473a188441910]::ty::visit::TypeVisitor>::visit_ty
  30:     0x7fff25600384 - <rustc_typeck[49c87e7593e195a8]::check::UnsafetyState>::recurse
  31:     0x7fff24466ba8 - <rustc_query_impl[9648f954f060bbf5]::queries::is_reachable_non_generic as rustc_query_system[658c00a88212f6cf]::query::config::QueryDescription<rustc_query_impl[9648f954f060bbf5]::plumbing::QueryCtxt>>::execute_query
  32:     0x7fff245bffbe - <&[rustc_type_ir[1421f89e31f06786]::Variance] as rustc_serialize[5ba6e6ef117c5717]::serialize::Decodable<rustc_query_impl[9648f954f060bbf5]::on_disk_cache::CacheDecoder>>::decode
  33:     0x7fff25af9dd0 - <&[(rustc_middle[12c473a188441910]::ty::Predicate, rustc_span[335b190b38ec46cb]::span_encoding::Span)] as rustc_serialize[5ba6e6ef117c5717]::serialize::Decodable<rustc_query_impl[9648f954f060bbf5]::on_disk_cache::CacheDecoder>>::decode
  34:     0x7fff25a3a5b8 - <rustc_query_impl[9648f954f060bbf5]::Queries as rustc_middle[12c473a188441910]::ty::query::QueryEngine>::as_any
  35:     0x7fff2560b1d5 - rustc_typeck[49c87e7593e195a8]::check::rvalue_scopes::resolve_rvalue_scopes
  36:     0x7fff2428ccd1 - rustc_typeck[49c87e7593e195a8]::check::provide
  37:     0x7fff2446881e - <rustc_query_impl[9648f954f060bbf5]::queries::is_reachable_non_generic as rustc_query_system[658c00a88212f6cf]::query::config::QueryDescription<rustc_query_impl[9648f954f060bbf5]::plumbing::QueryCtxt>>::execute_query
  38:     0x7fff245e36bb - <&[rustc_type_ir[1421f89e31f06786]::Variance] as rustc_serialize[5ba6e6ef117c5717]::serialize::Decodable<rustc_query_impl[9648f954f060bbf5]::on_disk_cache::CacheDecoder>>::decode
  39:     0x7fff24571ccd - <&[rustc_type_ir[1421f89e31f06786]::Variance] as rustc_serialize[5ba6e6ef117c5717]::serialize::Decodable<rustc_query_impl[9648f954f060bbf5]::on_disk_cache::CacheDecoder>>::decode
  40:     0x7fff245a9b62 - <&[rustc_type_ir[1421f89e31f06786]::Variance] as rustc_serialize[5ba6e6ef117c5717]::serialize::Decodable<rustc_query_impl[9648f954f060bbf5]::on_disk_cache::CacheDecoder>>::decode
  41:     0x7fff2427730a - <rustc_typeck[49c87e7593e195a8]::check::fn_ctxt::FnCtxt>::write_user_type_annotation
  42:     0x7fff24224893 - rustc_typeck[49c87e7593e195a8]::check_crate
  43:     0x7fff2494a63f - rustc_interface[9c167b8dd5fe1201]::passes::analysis
  44:     0x7fff2446830e - <rustc_query_impl[9648f954f060bbf5]::queries::is_reachable_non_generic as rustc_query_system[658c00a88212f6cf]::query::config::QueryDescription<rustc_query_impl[9648f954f060bbf5]::plumbing::QueryCtxt>>::execute_query
  45:     0x7fff245dd9c3 - <&[rustc_type_ir[1421f89e31f06786]::Variance] as rustc_serialize[5ba6e6ef117c5717]::serialize::Decodable<rustc_query_impl[9648f954f060bbf5]::on_disk_cache::CacheDecoder>>::decode
  46:     0x7fff24560ca7 - <&[rustc_type_ir[1421f89e31f06786]::Variance] as rustc_serialize[5ba6e6ef117c5717]::serialize::Decodable<rustc_query_impl[9648f954f060bbf5]::on_disk_cache::CacheDecoder>>::decode
  47:     0x7fff245b10b6 - <&[rustc_type_ir[1421f89e31f06786]::Variance] as rustc_serialize[5ba6e6ef117c5717]::serialize::Decodable<rustc_query_impl[9648f954f060bbf5]::on_disk_cache::CacheDecoder>>::decode
  48:     0x7fff23a4c9d9 - rustc_driver[c6471a3a75cc3305]::args::arg_expand_all
  49:     0x7fff23a1a3a8 - rustc_driver[c6471a3a75cc3305]::main
  50:     0x7fff23a4e32a - <rustc_middle[12c473a188441910]::ty::SymbolName as core[8087a2e8d825f5e1]::fmt::Debug>::fmt
  51:     0x7fff23a35e60 - rustc_driver[c6471a3a75cc3305]::main
  52:     0x7fff23a4d7d7 - <rustc_middle[12c473a188441910]::ty::SymbolName as core[8087a2e8d825f5e1]::fmt::Debug>::fmt
  53:     0x7fff23a3e109 - rustc_driver[c6471a3a75cc3305]::main
  54:     0x7fff23a3e56d - rustc_driver[c6471a3a75cc3305]::main
  55:     0x7fff5c15d7cc - std::sys::windows::thread::Thread::new::h742bb0c6405f02e2
  56:     0x7fffcf1e244d - BaseThreadInitThunk
  57:     0x7fffd0c6dfb8 - RtlUserThreadStart

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.65.0 (897e37553 2022-11-02) running on x86_64-pc-windows-msvc

note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]

note: some of the compiler flags provided by cargo are hidden

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

@justofisker justofisker 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 21, 2022
@justofisker justofisker changed the title format! inside Path::from panicks rustc format! inside std::path::Path::from panicks rustc Nov 21, 2022
@Rageking8
Copy link
Contributor

Rageking8 commented Nov 21, 2022

Should be a dupe of #104149, #103906. The above code is already fixed for current beta (1.66) and nightly (1.67).

UI test is also not required as checked with @compiler-errors some time ago.

Compiler-errors, maybe you can close this as complete or suggest any follow-up if necessary. Thanks.

@compiler-errors compiler-errors self-assigned this Mar 16, 2023
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

No branches or pull requests

3 participants