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

called Result::unwrap() on an Err value: NoSolution in trace.rs #107960

Closed
richardstephens opened this issue Feb 12, 2023 · 4 comments
Closed

called Result::unwrap() on an Err value: NoSolution in trace.rs #107960

richardstephens opened this issue Feb 12, 2023 · 4 comments
Labels
C-bug Category: This is a bug. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example 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

@richardstephens
Copy link

Code

A minimal project is published here:
https://github.com/richardstephens/rust-bug-report

I will try to minimise this further

Meta

rustc --version --verbose:

rustc 1.69.0-nightly (585f3eef2 2023-02-11)
binary: rustc
commit-hash: 585f3eef26f04440bca726c29193af7b4fa90e54
commit-date: 2023-02-11
host: x86_64-unknown-linux-gnu
release: 1.69.0-nightly
LLVM version: 15.0.7

Error output

error: 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.69.0-nightly (585f3eef2 2023-02-11) running on x86_64-unknown-linux-gnu

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 [mir_borrowck] borrow-checking `status_service::start_web_server::{closure#0}::{closure#0}`
#1 [mir_borrowck] borrow-checking `status_service::start_web_server::{closure#0}`
#2 [mir_borrowck] borrow-checking `status_service::start_web_server`
#3 [type_of] computing type of `status_service::start_web_server::{opaque#0}`
#4 [check_mod_item_types] checking item types in module `status_service`
#5 [analysis] running analysis passes on this crate
end of query stack
Some errors have detailed explanations: E0282, E0412, E0425, E0432, E0433.
For more information about an error, try `rustc --explain E0282`.

Backtrace

thread 'rustc' panicked at 'called `Result::unwrap()` on an `Err` value: NoSolution', compiler/rustc_borrowck/src/type_check/liveness/trace.rs:574:88
stack backtrace:
   0: rust_begin_unwind
             at /rustc/585f3eef26f04440bca726c29193af7b4fa90e54/library/std/src/panicking.rs:575:5
   1: core::panicking::panic_fmt
             at /rustc/585f3eef26f04440bca726c29193af7b4fa90e54/library/core/src/panicking.rs:64:14
   2: core::result::unwrap_failed
             at /rustc/585f3eef26f04440bca726c29193af7b4fa90e54/library/core/src/result.rs:1790:5
   3: <rustc_borrowck::type_check::liveness::trace::LivenessContext>::add_drop_live_facts_for
   4: rustc_borrowck::type_check::liveness::trace::trace
   5: rustc_borrowck::type_check::liveness::generate
   6: rustc_borrowck::type_check::type_check
   7: rustc_borrowck::nll::compute_regions
   8: rustc_borrowck::do_mir_borrowck
   9: rustc_borrowck::mir_borrowck
  10: <rustc_borrowck::provide::{closure#0} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId)>>::call_once
  11: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId, &rustc_middle::mir::query::BorrowCheckResult>
  12: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_borrowck, rustc_query_impl::plumbing::QueryCtxt>
  13: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::mir_borrowck
  14: <rustc_borrowck::type_check::TypeChecker>::prove_closure_bounds
  15: <rustc_borrowck::type_check::TypeChecker>::typeck_mir
  16: rustc_borrowck::type_check::type_check
  17: rustc_borrowck::nll::compute_regions
  18: rustc_borrowck::do_mir_borrowck
  19: rustc_borrowck::mir_borrowck
  20: <rustc_borrowck::provide::{closure#0} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId)>>::call_once
  21: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId, &rustc_middle::mir::query::BorrowCheckResult>
  22: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_borrowck, rustc_query_impl::plumbing::QueryCtxt>
  23: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::mir_borrowck
  24: <rustc_borrowck::type_check::TypeChecker>::prove_closure_bounds
  25: <rustc_borrowck::type_check::TypeChecker>::typeck_mir
  26: rustc_borrowck::type_check::type_check
  27: rustc_borrowck::nll::compute_regions
  28: rustc_borrowck::do_mir_borrowck
  29: rustc_borrowck::mir_borrowck
  30: <rustc_borrowck::provide::{closure#0} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId)>>::call_once
  31: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId, &rustc_middle::mir::query::BorrowCheckResult>
  32: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_borrowck, rustc_query_impl::plumbing::QueryCtxt>
  33: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::mir_borrowck
  34: rustc_hir_analysis::collect::type_of::type_of
  35: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, rustc_span::def_id::DefId, rustc_middle::ty::Ty>
  36: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::type_of, rustc_query_impl::plumbing::QueryCtxt, rustc_middle::dep_graph::dep_node::DepKind>
  37: rustc_hir_analysis::check::check::check_mod_item_types
  38: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId, ()>
  39: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::check_mod_item_types, rustc_query_impl::plumbing::QueryCtxt>
  40: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::check_mod_item_types
  41: <rustc_session::session::Session>::time::<(), rustc_hir_analysis::check_crate::{closure#6}>
  42: rustc_hir_analysis::check_crate
  43: rustc_interface::passes::analysis
  44: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, (), core::result::Result<(), rustc_errors::ErrorGuaranteed>>
  45: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt>
  46: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
  47: <rustc_middle::ty::context::GlobalCtxt>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}::{closure#3}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
  48: <rustc_interface::interface::Compiler>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_errors::ErrorGuaranteed>>
  49: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  50: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

@richardstephens richardstephens 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 Feb 12, 2023
@richardstephens richardstephens changed the title called Result::unwrap() on an Err value: NoSolution trace.rs called Result::unwrap() on an Err value: NoSolution in trace.rs Feb 12, 2023
@jieyouxu
Copy link
Member

jieyouxu commented Feb 13, 2023

Slightly smaller: https://github.com/jieyouxu/issue-107960-minimizer/blob/minimize/src/main.rs

#![feature(allocator_api)]

use std::net::SocketAddr;

use hyper::server::conn::http1;
use hyper::service::service_fn;
use hyper::Response;
use hyper::body::Bytes;
use tokio::net::TcpListener;

async fn handle_req() -> Result<Response<BoxBody<Bytes, hyper::Error>>, Box<dyn std::error::Error + Send + Sync>> {
    todo!()
}

pub async fn start_web_server() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
    let addr = SocketAddr::from(([127, 0, 0, 1], 3000));
    let listener = TcpListener::bind(addr).await?;
    loop {
        let (stream, _) = listener.accept().await?;
        tokio::task::spawn(async move {
            http1::Builder::new()
                .serve_connection(stream, service_fn(|_| handle_req()))
                .await;
        });
    }
}

fn main() {}

@matthiaskrgr
Copy link
Member

Probably similar to #103899

@JohnTitor JohnTitor added the E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example label Mar 3, 2023
@Luk-ESC
Copy link
Contributor

Luk-ESC commented Sep 26, 2023

Neither https://github.com/richardstephens/rust-bug-report nor the minimized code ICEs for me on the latest nightly

@richardstephens
Copy link
Author

I did some quick testing and it no longer ICE's on 1.71 stable either, so I'm happy to consider this closed.

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. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example 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

5 participants