Skip to content

error: internal compiler error: compiler\rustc_middle\src\ty\context.rs #104560

Closed
@NoahPN

Description

@NoahPN

Code

use std::{error::Error, io::stdin};
use tokio::{
    io::{AsyncBufReadExt, AsyncWriteExt, BufReader},
    net::TcpStream,
};

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
    let mut stream = TcpStream::connect("127.0.0.1:8080").await?;
    println!("connected to server");
    let (read, mut write) = stream.split();

    tokio::spawn({
        let mut reader = BufReader::new(read);
        let mut msg = String::new();

        loop {
            let bytes_read = reader.read_line(&mut msg).await?;

            if bytes_read == 0 {
                break;
            }

            println!("{}", &msg);
        }
    });

    tokio::spawn({
        let mut line = String::new();
        let stdin = stdin();

        loop {
            stdin.read_line(&mut line)?;
            write.write_all(&line.as_bytes()).await?;
            line.clear();
        }
    });

    Ok(())
}

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 mut reader = BufReader::new(read);
                                        let mut msg = String::new();

                                        loop {
                                            let bytes_read = reader.read_line(&mut msg).await?;

                                            if bytes_read == 0 {
                                                break;
                                            }

                                            println!("{}", &msg);
                                        }
                                    } (hir_id=HirId { owner: DefId(0:24 ~ client[ef42]::main), local_id: 239 })`   

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/897e37553bba8b42751c67658967889d11ecd120\compiler\rustc_errors\src\lib.rs:1462:9

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
error: could not compile `client`
Backtrace

stack backtrace:
   0:     0x7ff808258fb2 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h1086ecfa86360858
   1:     0x7ff8082940db - core::fmt::write::hbadbc3de7beb6abb
   2:     0x7ff80824b8aa - <std::io::IoSlice as core::fmt::Debug>::fmt::hb7e33fb242ec9ac1
   3:     0x7ff80825c5b4 - std::panicking::default_hook::hb8b3ce065b661264
   4:     0x7ff80825c1ea - std::panicking::default_hook::hb8b3ce065b661264
   5:     0x7fffa45725ee - rustc_driver[c6471a3a75cc3305]::describe_lints
   6:     0x7ff80825cfb2 - std::panicking::rust_panic_with_hook::h33e40e3f5d3be1f3
   7:     0x7fffa67b3583 - <rustc_middle[12c473a188441910]::ty::DestructuredConst as core[8087a2e8d825f5e1]::fmt::Debug>::fmt
   8:     0x7fffa67b2169 - <rustc_middle[12c473a188441910]::ty::DestructuredConst as core[8087a2e8d825f5e1]::fmt::Debug>::fmt
   9:     0x7fffa67da8b9 - <rustc_middle[12c473a188441910]::ty::subst::UserSubsts as rustc_middle[12c473a188441910]::ty::context::Lift>::lift_to_tcx
  10:     0x7fffa67b0a89 - <rustc_middle[12c473a188441910]::ty::DestructuredConst as core[8087a2e8d825f5e1]::fmt::Debug>::fmt
  11:     0x7fffa67ae051 - <rustc_middle[12c473a188441910]::ty::DestructuredConst as core[8087a2e8d825f5e1]::fmt::Debug>::fmt
  12:     0x7fffa67ad8d2 - <rustc_middle[12c473a188441910]::ty::DestructuredConst as core[8087a2e8d825f5e1]::fmt::Debug>::fmt
  13:     0x7fffa6815687 - <rustc_middle[12c473a188441910]::ty::sty::Binder<rustc_middle[12c473a188441910]::ty::TraitPredicate>>::print_modifiers_and_trait_path
  14:     0x7fffa6816d58 - rustc_middle[12c473a188441910]::util::bug::bug_fmt
  15:     0x7fffa6816cd5 - rustc_middle[12c473a188441910]::util::bug::bug_fmt
  16:     0x7fffa444603d - <rustc_middle[12c473a188441910]::ty::context::TypeckResults>::expr_ty_adjusted
  17:     0x7fffa66ab289 - <rustc_infer[3acbbff32055c339]::infer::InferCtxt as rustc_trait_selection[51ac1f8d3e2d292c]::traits::error_reporting::suggestions::InferCtxtExt>::suggest_fully_qualified_path
  18:     0x7fffa66bbcf7 - <rustc_infer[3acbbff32055c339]::infer::InferCtxt as rustc_trait_selection[51ac1f8d3e2d292c]::traits::error_reporting::InferCtxtPrivExt>::note_obligation_cause
  19:     0x7fffa66b0418 - <rustc_infer[3acbbff32055c339]::infer::InferCtxt as rustc_trait_selection[51ac1f8d3e2d292c]::traits::error_reporting::InferCtxtExt>::report_selection_error
  20:     0x7fffa66c019f - <rustc_infer[3acbbff32055c339]::infer::InferCtxt as rustc_trait_selection[51ac1f8d3e2d292c]::traits::error_reporting::InferCtxtPrivExt>::report_fulfillment_error
  21:     0x7fffa66aeb25 - <rustc_infer[3acbbff32055c339]::infer::InferCtxt as rustc_trait_selection[51ac1f8d3e2d292c]::traits::error_reporting::InferCtxtExt>::report_fulfillment_errors
  22:     0x7fffa3a1472b - <rustc_typeck[49c87e7593e195a8]::check::fn_ctxt::FnCtxt>::check_call
  23:     0x7fffa3a20e40 - <rustc_typeck[49c87e7593e195a8]::check::fn_ctxt::FnCtxt>::demand_coerce
  24:     0x7fffa3a221f0 - <rustc_typeck[49c87e7593e195a8]::check::fn_ctxt::FnCtxt>::demand_coerce
  25:     0x7fffa3a2118f - <rustc_typeck[49c87e7593e195a8]::check::fn_ctxt::FnCtxt>::demand_coerce
  26:     0x7fffa3a4fb56 - <rustc_typeck[49c87e7593e195a8]::check::fn_ctxt::FnCtxt>::structurally_resolved_type
  27:     0x7fffa3a11127 - <rustc_typeck[49c87e7593e195a8]::check::fn_ctxt::FnCtxt>::check_call
  28:     0x7fffa3a20e40 - <rustc_typeck[49c87e7593e195a8]::check::fn_ctxt::FnCtxt>::demand_coerce
  29:     0x7fffa3a4fb56 - <rustc_typeck[49c87e7593e195a8]::check::fn_ctxt::FnCtxt>::structurally_resolved_type    
  30:     0x7fffa3a11127 - <rustc_typeck[49c87e7593e195a8]::check::fn_ctxt::FnCtxt>::check_call
  31:     0x7fffa3a20e40 - <rustc_typeck[49c87e7593e195a8]::check::fn_ctxt::FnCtxt>::demand_coerce
  32:     0x7fffa3a5ff8c - <rustc_typeck[49c87e7593e195a8]::check::fn_ctxt::FnCtxt>::check_stmt
  33:     0x7fffa3a60a8f - <rustc_typeck[49c87e7593e195a8]::check::fn_ctxt::FnCtxt>::check_stmt
  34:     0x7fffa3a20f11 - <rustc_typeck[49c87e7593e195a8]::check::fn_ctxt::FnCtxt>::demand_coerce
  35:     0x7fffa3a5ff8c - <rustc_typeck[49c87e7593e195a8]::check::fn_ctxt::FnCtxt>::check_stmt
  36:     0x7fffa3a60a8f - <rustc_typeck[49c87e7593e195a8]::check::fn_ctxt::FnCtxt>::check_stmt
  37:     0x7fffa3a23858 - <rustc_typeck[49c87e7593e195a8]::check::fn_ctxt::FnCtxt>::demand_coerce
  38:     0x7fffa3a60ae0 - <rustc_typeck[49c87e7593e195a8]::check::fn_ctxt::FnCtxt>::check_stmt
  39:     0x7fffa3a20f11 - <rustc_typeck[49c87e7593e195a8]::check::fn_ctxt::FnCtxt>::demand_coerce
  40:     0x7fffa3a4fb56 - <rustc_typeck[49c87e7593e195a8]::check::fn_ctxt::FnCtxt>::structurally_resolved_type    
  41:     0x7fffa3a11127 - <rustc_typeck[49c87e7593e195a8]::check::fn_ctxt::FnCtxt>::check_call
  42:     0x7fffa3a20e40 - <rustc_typeck[49c87e7593e195a8]::check::fn_ctxt::FnCtxt>::demand_coerce
  43:     0x7fffa3a5ff8c - <rustc_typeck[49c87e7593e195a8]::check::fn_ctxt::FnCtxt>::check_stmt
  44:     0x7fffa3a60a8f - <rustc_typeck[49c87e7593e195a8]::check::fn_ctxt::FnCtxt>::check_stmt
  45:     0x7fffa3a20f11 - <rustc_typeck[49c87e7593e195a8]::check::fn_ctxt::FnCtxt>::demand_coerce
  46:     0x7fffa3a2c001 - <rustc_typeck[49c87e7593e195a8]::check::fn_ctxt::FnCtxt>::demand_coerce
  47:     0x7fffa3ac9131 - rustc_typeck[49c87e7593e195a8]::check::rvalue_scopes::resolve_rvalue_scopes
  48:     0x7fffa3a77c5a - <rustc_typeck[49c87e7593e195a8]::check::fn_ctxt::FnCtxt>::check_expr_closure
  49:     0x7fffa3a23381 - <rustc_typeck[49c87e7593e195a8]::check::fn_ctxt::FnCtxt>::demand_coerce
  50:     0x7fffa3a4fb56 - <rustc_typeck[49c87e7593e195a8]::check::fn_ctxt::FnCtxt>::structurally_resolved_type    
  51:     0x7fffa3a11127 - <rustc_typeck[49c87e7593e195a8]::check::fn_ctxt::FnCtxt>::check_call
  52:     0x7fffa3a20e40 - <rustc_typeck[49c87e7593e195a8]::check::fn_ctxt::FnCtxt>::demand_coerce
  53:     0x7fffa3a5f36b - <rustc_typeck[49c87e7593e195a8]::check::fn_ctxt::FnCtxt>::check_struct_path
  54:     0x7fffa3a60128 - <rustc_typeck[49c87e7593e195a8]::check::fn_ctxt::FnCtxt>::check_stmt
  55:     0x7fffa3a60a8f - <rustc_typeck[49c87e7593e195a8]::check::fn_ctxt::FnCtxt>::check_stmt
  56:     0x7fffa3a20f11 - <rustc_typeck[49c87e7593e195a8]::check::fn_ctxt::FnCtxt>::demand_coerce
  57:     0x7fffa3a2c001 - <rustc_typeck[49c87e7593e195a8]::check::fn_ctxt::FnCtxt>::demand_coerce
  58:     0x7fffa3ac9131 - rustc_typeck[49c87e7593e195a8]::check::rvalue_scopes::resolve_rvalue_scopes
  59:     0x7fffa39b82b2 - <rustc_typeck[49c87e7593e195a8]::constrained_generic_params::ParameterCollector as rustc_middle[12c473a188441910]::ty::visit::TypeVisitor>::visit_ty
  60:     0x7fffa3aa0384 - <rustc_typeck[49c87e7593e195a8]::check::UnsafetyState>::recurse
  61:     0x7fffa2906ba8 - <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
  62:     0x7fffa2a5ffbe - <&[rustc_type_ir[1421f89e31f06786]::Variance] as rustc_serialize[5ba6e6ef117c5717]::serialize::Decodable<rustc_query_impl[9648f954f060bbf5]::on_disk_cache::CacheDecoder>>::decode
  63:     0x7fffa3f99dd0 - <&[(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
  64:     0x7fffa3eda5b8 - <rustc_query_impl[9648f954f060bbf5]::Queries as rustc_middle[12c473a188441910]::ty::query::QueryEngine>::as_any
  65:     0x7fffa3aab1d5 - rustc_typeck[49c87e7593e195a8]::check::rvalue_scopes::resolve_rvalue_scopes
  66:     0x7fffa272ccd1 - rustc_typeck[49c87e7593e195a8]::check::provide
  67:     0x7fffa290881e - <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
  68:     0x7fffa2a836bb - <&[rustc_type_ir[1421f89e31f06786]::Variance] as rustc_serialize[5ba6e6ef117c5717]::serialize::Decodable<rustc_query_impl[9648f954f060bbf5]::on_disk_cache::CacheDecoder>>::decode
  69:     0x7fffa2a11ccd - <&[rustc_type_ir[1421f89e31f06786]::Variance] as rustc_serialize[5ba6e6ef117c5717]::serialize::Decodable<rustc_query_impl[9648f954f060bbf5]::on_disk_cache::CacheDecoder>>::decode
  70:     0x7fffa2a49b62 - <&[rustc_type_ir[1421f89e31f06786]::Variance] as rustc_serialize[5ba6e6ef117c5717]::serialize::Decodable<rustc_query_impl[9648f954f060bbf5]::on_disk_cache::CacheDecoder>>::decode
  71:     0x7fffa271730a - <rustc_typeck[49c87e7593e195a8]::check::fn_ctxt::FnCtxt>::write_user_type_annotation    
  72:     0x7fffa26c4893 - rustc_typeck[49c87e7593e195a8]::check_crate
  73:     0x7fffa2dea63f - rustc_interface[9c167b8dd5fe1201]::passes::analysis
  74:     0x7fffa290830e - <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
  75:     0x7fffa2a7d9c3 - <&[rustc_type_ir[1421f89e31f06786]::Variance] as rustc_serialize[5ba6e6ef117c5717]::serialize::Decodable<rustc_query_impl[9648f954f060bbf5]::on_disk_cache::CacheDecoder>>::decode
  76:     0x7fffa2a00ca7 - <&[rustc_type_ir[1421f89e31f06786]::Variance] as rustc_serialize[5ba6e6ef117c5717]::serialize::Decodable<rustc_query_impl[9648f954f060bbf5]::on_disk_cache::CacheDecoder>>::decode
  77:     0x7fffa2a510b6 - <&[rustc_type_ir[1421f89e31f06786]::Variance] as rustc_serialize[5ba6e6ef117c5717]::serialize::Decodable<rustc_query_impl[9648f954f060bbf5]::on_disk_cache::CacheDecoder>>::decode
  78:     0x7fffa1eec9d9 - rustc_driver[c6471a3a75cc3305]::args::arg_expand_all
  79:     0x7fffa1eba3a8 - rustc_driver[c6471a3a75cc3305]::main
  80:     0x7fffa1eee32a - <rustc_middle[12c473a188441910]::ty::SymbolName as core[8087a2e8d825f5e1]::fmt::Debug>::fmt
  81:     0x7fffa1ed5e60 - rustc_driver[c6471a3a75cc3305]::main
  82:     0x7fffa1eed7d7 - <rustc_middle[12c473a188441910]::ty::SymbolName as core[8087a2e8d825f5e1]::fmt::Debug>::fmt
  83:     0x7fffa1ede109 - rustc_driver[c6471a3a75cc3305]::main
  84:     0x7fffa1ede56d - rustc_driver[c6471a3a75cc3305]::main
  85:     0x7ff80826d7cc - std::sys::windows::thread::Thread::new::h742bb0c6405f02e2
  86:     0x7ff84f09244d - BaseThreadInitThunk
  87:     0x7ff84fc0dfb8 - RtlUserThreadStart

Hum I'm new in the rust community, not sure how to report a bug but I listened the compiler telling me to report it and I wanted to help the community in case I found something helpful...

Anyway

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions