Skip to content

Bug connected with probably ambiguous data type when parsing string into i32 from &str from clap #97951

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
yarenty opened this issue Jun 10, 2022 · 3 comments
Labels
A-inference Area: Type inference C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@yarenty
Copy link

yarenty commented Jun 10, 2022

Code

use datafusion::error::Result;
use clap::{Arg, Command};


#[derive(Clone)]
pub struct KafkaConfig {
    pub partitions: i32,
}

impl KafkaConfig {
    pub fn new() -> KafkaConfig {
        KafkaConfig {
            partitions: 1,
        }
    }
    /// Set number of kafka partitions - currently round robin
    pub fn with_partitions(&mut self, partitions: impl Into<i32>) -> &mut KafkaConfig {
        self.partitions = partitions.into();
        self
    }
}

#[tokio::main]
async fn main() -> Result<()> {

    let matches = Command::new("Kafka publisher")
        .version(option_env!("CARGO_PKG_VERSION").unwrap_or(""))
        .about("Datafusion kafka publisher")
        .arg(
            Arg::new("partitions")
                .short('p')
                .long("partitions")
                .help("Number of partitions")
                .takes_value(true)
                .default_value("1"),
        )
        .get_matches();
    
    let partition = matches.value_of("partitions").unwrap();
    // BUG:
    let conf = KafkaConfig::new()
        .with_partitions(partition.parse().unwrap());
    
    Ok(())
}

Meta

rustc --version --verbose:

rustc 1.63.0-nightly (5435ed691 2022-06-07)
binary: rustc
commit-hash: 5435ed6916a59e8d5acba2149316a841c3905cbd
commit-date: 2022-06-07
host: x86_64-apple-darwin
release: 1.63.0-nightly
LLVM version: 14.0.5

Error output

   Compiling kafka_writer v0.1.0 (/opt/workspace/df_to_kafka)
error: internal compiler error: compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs:856:33: unexpected path: def=clap::App substs=['_#1r] path=Path { span: examples/bug.rs:26:19: 26:26 (#0), res: Def(TyAlias, DefId(154:881 ~ clap[cfd3]::build::command::Command)), segments: [PathSegment { ident: Command#0, hir_id: Some(HirId { owner: DefId(0:21 ~ bug[6e6c]::main), local_id: 11 }), res: Some(Err), args: Some(GenericArgs { args: [Lifetime(Lifetime { hir_id: HirId { owner: DefId(0:21 ~ bug[6e6c]::main), local_id: 10 }, span: examples/bug.rs:26:19: 26:26 (#0), name: Implicit })], bindings: [], parenthesized: false, span_ext: examples/bug.rs:26:31: 26:31 (#0) }), infer_args: true }] }

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/5435ed6916a59e8d5acba2149316a841c3905cbd/compiler/rustc_errors/src/lib.rs:1334:9
stack backtrace:
   0:        0x10329cd84 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hd5eaae041b3d7e91
   1:        0x1032f798b - core::fmt::write::h68d5f006b73f08a4
   2:        0x10328f5a8 - std::io::Write::write_fmt::hff9b2edbd686a8fe
   3:        0x1032a004d - std::panicking::default_hook::{{closure}}::h9943793f78c1fb3d
   4:        0x10329fda4 - std::panicking::default_hook::h78b5b4127ed55415
   5:        0x10e45752a - rustc_driver[b342e6794a2ca09]::DEFAULT_HOOK::{closure#0}::{closure#0}
   6:        0x1032a06ab - std::panicking::rust_panic_with_hook::h6d5c90d5c96e8a1e
   7:        0x112984ef7 - std[9cea2893a9205424]::panicking::begin_panic::<rustc_errors[716e5c41f5f232d2]::ExplicitBug>::{closure#0}
   8:        0x112983d19 - std[9cea2893a9205424]::sys_common::backtrace::__rust_end_short_backtrace::<std[9cea2893a9205424]::panicking::begin_panic<rustc_errors[716e5c41f5f232d2]::ExplicitBug>::{closure#0}, !>
   9:        0x112e5c219 - std[9cea2893a9205424]::panicking::begin_panic::<rustc_errors[716e5c41f5f232d2]::ExplicitBug>
  10:        0x1128e0699 - std[9cea2893a9205424]::panic::panic_any::<rustc_errors[716e5c41f5f232d2]::ExplicitBug>
  11:        0x1128df966 - <rustc_errors[716e5c41f5f232d2]::HandlerInner>::bug::<&alloc[467fe5c8443f9999]::string::String>
  12:        0x1128dd867 - <rustc_errors[716e5c41f5f232d2]::Handler>::bug::<&alloc[467fe5c8443f9999]::string::String>
  13:        0x11297e7f5 - rustc_middle[c490e9a429e30d2b]::ty::context::tls::with_opt::<rustc_middle[c490e9a429e30d2b]::util::bug::opt_span_bug_fmt<rustc_span[a8db8103318bb60f]::span_encoding::Span>::{closure#0}, ()>
  14:        0x11297e871 - rustc_middle[c490e9a429e30d2b]::util::bug::opt_span_bug_fmt::<rustc_span[a8db8103318bb60f]::span_encoding::Span>
  15:        0x112e621de - rustc_middle[c490e9a429e30d2b]::util::bug::bug_fmt
  16:        0x11276d005 - <rustc_infer[819d5f6d099d5d76]::infer::error_reporting::need_type_info::FindInferSourceVisitor>::path_inferred_subst_iter
  17:        0x11276d70d - <rustc_infer[819d5f6d099d5d76]::infer::error_reporting::need_type_info::FindInferSourceVisitor as rustc_hir[8d721f1aad66e6e7]::intravisit::Visitor>::visit_expr
  18:        0x11276d4e0 - <rustc_infer[819d5f6d099d5d76]::infer::error_reporting::need_type_info::FindInferSourceVisitor as rustc_hir[8d721f1aad66e6e7]::intravisit::Visitor>::visit_expr
  19:        0x11278f5bf - rustc_hir[8d721f1aad66e6e7]::intravisit::walk_expr::<rustc_infer[819d5f6d099d5d76]::infer::error_reporting::need_type_info::FindInferSourceVisitor>
  20:        0x11276d4f1 - <rustc_infer[819d5f6d099d5d76]::infer::error_reporting::need_type_info::FindInferSourceVisitor as rustc_hir[8d721f1aad66e6e7]::intravisit::Visitor>::visit_expr
  21:        0x11278f5bf - rustc_hir[8d721f1aad66e6e7]::intravisit::walk_expr::<rustc_infer[819d5f6d099d5d76]::infer::error_reporting::need_type_info::FindInferSourceVisitor>
  22:        0x11276d4f1 - <rustc_infer[819d5f6d099d5d76]::infer::error_reporting::need_type_info::FindInferSourceVisitor as rustc_hir[8d721f1aad66e6e7]::intravisit::Visitor>::visit_expr
  23:        0x11278f5bf - rustc_hir[8d721f1aad66e6e7]::intravisit::walk_expr::<rustc_infer[819d5f6d099d5d76]::infer::error_reporting::need_type_info::FindInferSourceVisitor>
  24:        0x11276d4f1 - <rustc_infer[819d5f6d099d5d76]::infer::error_reporting::need_type_info::FindInferSourceVisitor as rustc_hir[8d721f1aad66e6e7]::intravisit::Visitor>::visit_expr
  25:        0x11278f5bf - rustc_hir[8d721f1aad66e6e7]::intravisit::walk_expr::<rustc_infer[819d5f6d099d5d76]::infer::error_reporting::need_type_info::FindInferSourceVisitor>
  26:        0x11276d4f1 - <rustc_infer[819d5f6d099d5d76]::infer::error_reporting::need_type_info::FindInferSourceVisitor as rustc_hir[8d721f1aad66e6e7]::intravisit::Visitor>::visit_expr
  27:        0x11276d068 - <rustc_infer[819d5f6d099d5d76]::infer::error_reporting::need_type_info::FindInferSourceVisitor as rustc_hir[8d721f1aad66e6e7]::intravisit::Visitor>::visit_local
  28:        0x11278f7e7 - rustc_hir[8d721f1aad66e6e7]::intravisit::walk_expr::<rustc_infer[819d5f6d099d5d76]::infer::error_reporting::need_type_info::FindInferSourceVisitor>
  29:        0x11276d4f1 - <rustc_infer[819d5f6d099d5d76]::infer::error_reporting::need_type_info::FindInferSourceVisitor as rustc_hir[8d721f1aad66e6e7]::intravisit::Visitor>::visit_expr
  30:        0x11276d455 - <rustc_infer[819d5f6d099d5d76]::infer::error_reporting::need_type_info::FindInferSourceVisitor as rustc_hir[8d721f1aad66e6e7]::intravisit::Visitor>::visit_body
  31:        0x11278f8fc - rustc_hir[8d721f1aad66e6e7]::intravisit::walk_expr::<rustc_infer[819d5f6d099d5d76]::infer::error_reporting::need_type_info::FindInferSourceVisitor>
  32:        0x11276d4f1 - <rustc_infer[819d5f6d099d5d76]::infer::error_reporting::need_type_info::FindInferSourceVisitor as rustc_hir[8d721f1aad66e6e7]::intravisit::Visitor>::visit_expr
  33:        0x11276d4cc - <rustc_infer[819d5f6d099d5d76]::infer::error_reporting::need_type_info::FindInferSourceVisitor as rustc_hir[8d721f1aad66e6e7]::intravisit::Visitor>::visit_expr
  34:        0x11276d068 - <rustc_infer[819d5f6d099d5d76]::infer::error_reporting::need_type_info::FindInferSourceVisitor as rustc_hir[8d721f1aad66e6e7]::intravisit::Visitor>::visit_local
  35:        0x11278f7e7 - rustc_hir[8d721f1aad66e6e7]::intravisit::walk_expr::<rustc_infer[819d5f6d099d5d76]::infer::error_reporting::need_type_info::FindInferSourceVisitor>
  36:        0x11276d4f1 - <rustc_infer[819d5f6d099d5d76]::infer::error_reporting::need_type_info::FindInferSourceVisitor as rustc_hir[8d721f1aad66e6e7]::intravisit::Visitor>::visit_expr
  37:        0x1126f79c8 - <rustc_infer[819d5f6d099d5d76]::infer::InferCtxt>::emit_inference_failure_err
  38:        0x1125c8e65 - <rustc_infer[819d5f6d099d5d76]::infer::InferCtxt as rustc_trait_selection[e2df6e942a926503]::traits::error_reporting::InferCtxtPrivExt>::maybe_report_ambiguity
  39:        0x1125b8113 - <rustc_infer[819d5f6d099d5d76]::infer::InferCtxt as rustc_trait_selection[e2df6e942a926503]::traits::error_reporting::InferCtxtExt>::report_fulfillment_errors
  40:        0x110e68aa7 - <rustc_typeck[8464770ce1972b1c]::check::fn_ctxt::FnCtxt>::select_all_obligations_or_error
  41:        0x110f9cab9 - <rustc_infer[819d5f6d099d5d76]::infer::InferCtxtBuilder>::enter::<&rustc_middle[c490e9a429e30d2b]::ty::context::TypeckResults, <rustc_typeck[8464770ce1972b1c]::check::inherited::InheritedBuilder>::enter<rustc_typeck[8464770ce1972b1c]::check::typeck_with_fallback<rustc_typeck[8464770ce1972b1c]::check::typeck::{closure#0}>::{closure#1}, &rustc_middle[c490e9a429e30d2b]::ty::context::TypeckResults>::{closure#0}>
  42:        0x110ef55e1 - rustc_typeck[8464770ce1972b1c]::check::typeck
  43:        0x1119f7108 - rustc_query_system[e51505c10b9ab743]::query::plumbing::try_execute_query::<rustc_query_impl[e5c90d3fb8f966bf]::plumbing::QueryCtxt, rustc_query_system[e51505c10b9ab743]::query::caches::DefaultCache<rustc_span[a8db8103318bb60f]::def_id::LocalDefId, &rustc_middle[c490e9a429e30d2b]::ty::context::TypeckResults>>
  44:        0x111af994e - rustc_query_system[e51505c10b9ab743]::query::plumbing::get_query::<rustc_query_impl[e5c90d3fb8f966bf]::queries::typeck, rustc_query_impl[e5c90d3fb8f966bf]::plumbing::QueryCtxt>
  45:        0x110ef5897 - rustc_typeck[8464770ce1972b1c]::check::typeck
  46:        0x1119f7108 - rustc_query_system[e51505c10b9ab743]::query::plumbing::try_execute_query::<rustc_query_impl[e5c90d3fb8f966bf]::plumbing::QueryCtxt, rustc_query_system[e51505c10b9ab743]::query::caches::DefaultCache<rustc_span[a8db8103318bb60f]::def_id::LocalDefId, &rustc_middle[c490e9a429e30d2b]::ty::context::TypeckResults>>
  47:        0x111af994e - rustc_query_system[e51505c10b9ab743]::query::plumbing::get_query::<rustc_query_impl[e5c90d3fb8f966bf]::queries::typeck, rustc_query_impl[e5c90d3fb8f966bf]::plumbing::QueryCtxt>
  48:        0x111064c93 - <rustc_middle[c490e9a429e30d2b]::hir::map::Map>::par_body_owners::<rustc_typeck[8464770ce1972b1c]::check::typeck_item_bodies::{closure#0}>
  49:        0x110efaac5 - rustc_typeck[8464770ce1972b1c]::check::typeck_item_bodies
  50:        0x111a60193 - rustc_query_system[e51505c10b9ab743]::query::plumbing::try_execute_query::<rustc_query_impl[e5c90d3fb8f966bf]::plumbing::QueryCtxt, rustc_query_system[e51505c10b9ab743]::query::caches::DefaultCache<(), ()>>
  51:        0x111ad0812 - rustc_query_system[e51505c10b9ab743]::query::plumbing::get_query::<rustc_query_impl[e5c90d3fb8f966bf]::queries::typeck_item_bodies, rustc_query_impl[e5c90d3fb8f966bf]::plumbing::QueryCtxt>
  52:        0x110fd5952 - <rustc_session[48019e335b6d1bd9]::session::Session>::time::<(), rustc_typeck[8464770ce1972b1c]::check_crate::{closure#7}>
  53:        0x110f8dc8d - rustc_typeck[8464770ce1972b1c]::check_crate
  54:        0x10e587bba - rustc_interface[db934e3ab70250f2]::passes::analysis
  55:        0x111a52237 - rustc_query_system[e51505c10b9ab743]::query::plumbing::try_execute_query::<rustc_query_impl[e5c90d3fb8f966bf]::plumbing::QueryCtxt, rustc_query_system[e51505c10b9ab743]::query::caches::DefaultCache<(), core[b2a037fb97e116ca]::result::Result<(), rustc_errors[716e5c41f5f232d2]::ErrorGuaranteed>>>
  56:        0x111af9d2f - rustc_query_system[e51505c10b9ab743]::query::plumbing::get_query::<rustc_query_impl[e5c90d3fb8f966bf]::queries::analysis, rustc_query_impl[e5c90d3fb8f966bf]::plumbing::QueryCtxt>
  57:        0x10e4130b2 - <rustc_interface[db934e3ab70250f2]::passes::QueryContext>::enter::<rustc_driver[b342e6794a2ca09]::run_compiler::{closure#1}::{closure#2}::{closure#3}, core[b2a037fb97e116ca]::result::Result<(), rustc_errors[716e5c41f5f232d2]::ErrorGuaranteed>>
  58:        0x10e3f2a67 - <rustc_interface[db934e3ab70250f2]::interface::Compiler>::enter::<rustc_driver[b342e6794a2ca09]::run_compiler::{closure#1}::{closure#2}, core[b2a037fb97e116ca]::result::Result<core[b2a037fb97e116ca]::option::Option<rustc_interface[db934e3ab70250f2]::queries::Linker>, rustc_errors[716e5c41f5f232d2]::ErrorGuaranteed>>
  59:        0x10e459b18 - rustc_span[a8db8103318bb60f]::with_source_map::<core[b2a037fb97e116ca]::result::Result<(), rustc_errors[716e5c41f5f232d2]::ErrorGuaranteed>, rustc_interface[db934e3ab70250f2]::interface::create_compiler_and_run<core[b2a037fb97e116ca]::result::Result<(), rustc_errors[716e5c41f5f232d2]::ErrorGuaranteed>, rustc_driver[b342e6794a2ca09]::run_compiler::{closure#1}>::{closure#1}>
  60:        0x10e3f36b9 - <scoped_tls[1c1410eb7de21f6f]::ScopedKey<rustc_span[a8db8103318bb60f]::SessionGlobals>>::set::<rustc_interface[db934e3ab70250f2]::interface::run_compiler<core[b2a037fb97e116ca]::result::Result<(), rustc_errors[716e5c41f5f232d2]::ErrorGuaranteed>, rustc_driver[b342e6794a2ca09]::run_compiler::{closure#1}>::{closure#0}, core[b2a037fb97e116ca]::result::Result<(), rustc_errors[716e5c41f5f232d2]::ErrorGuaranteed>>
  61:        0x10e415b89 - std[9cea2893a9205424]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[db934e3ab70250f2]::util::run_in_thread_pool_with_globals<rustc_interface[db934e3ab70250f2]::interface::run_compiler<core[b2a037fb97e116ca]::result::Result<(), rustc_errors[716e5c41f5f232d2]::ErrorGuaranteed>, rustc_driver[b342e6794a2ca09]::run_compiler::{closure#1}>::{closure#0}, core[b2a037fb97e116ca]::result::Result<(), rustc_errors[716e5c41f5f232d2]::ErrorGuaranteed>>::{closure#0}, core[b2a037fb97e116ca]::result::Result<(), rustc_errors[716e5c41f5f232d2]::ErrorGuaranteed>>
  62:        0x10e416521 - <<std[9cea2893a9205424]::thread::Builder>::spawn_unchecked_<rustc_interface[db934e3ab70250f2]::util::run_in_thread_pool_with_globals<rustc_interface[db934e3ab70250f2]::interface::run_compiler<core[b2a037fb97e116ca]::result::Result<(), rustc_errors[716e5c41f5f232d2]::ErrorGuaranteed>, rustc_driver[b342e6794a2ca09]::run_compiler::{closure#1}>::{closure#0}, core[b2a037fb97e116ca]::result::Result<(), rustc_errors[716e5c41f5f232d2]::ErrorGuaranteed>>::{closure#0}, core[b2a037fb97e116ca]::result::Result<(), rustc_errors[716e5c41f5f232d2]::ErrorGuaranteed>>::{closure#1} as core[b2a037fb97e116ca]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  63:        0x1032a9937 - std::sys::unix::thread::Thread::new::thread_start::ha88bcdb8ab549b40
  64:     0x7ff80485d4e1 - __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.63.0-nightly (5435ed691 2022-06-07) running on x86_64-apple-darwin

note: compiler flags: --crate-type bin -C opt-level=3 -C embed-bitcode=no

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

query stack during panic:
#0 [typeck] type-checking `main`
#1 [typeck] type-checking `main::{closure#0}`
#2 [typeck_item_bodies] type-checking all item bodies
#3 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `kafka_writer`

Backtrace

 RUST_BACKTRACE=1  cargo build --release --example bug                                                                                                                                                                                                (master+) 16:22:27
   Compiling kafka_writer v0.1.0 (/opt/workspace/df_to_kafka)
error: internal compiler error: compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs:856:33: unexpected path: def=clap::App substs=['_#1r] path=Path { span: examples/bug.rs:26:19: 26:26 (#0), res: Def(TyAlias, DefId(154:881 ~ clap[cfd3]::build::command::Command)), segments: [PathSegment { ident: Command#0, hir_id: Some(HirId { owner: DefId(0:21 ~ bug[6e6c]::main), local_id: 11 }), res: Some(Err), args: Some(GenericArgs { args: [Lifetime(Lifetime { hir_id: HirId { owner: DefId(0:21 ~ bug[6e6c]::main), local_id: 10 }, span: examples/bug.rs:26:19: 26:26 (#0), name: Implicit })], bindings: [], parenthesized: false, span_ext: examples/bug.rs:26:31: 26:31 (#0) }), infer_args: true }] }

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/5435ed6916a59e8d5acba2149316a841c3905cbd/compiler/rustc_errors/src/lib.rs:1334:9
stack backtrace:
   0: std::panicking::begin_panic::<rustc_errors::ExplicitBug>
   1: std::panic::panic_any::<rustc_errors::ExplicitBug>
   2: <rustc_errors::HandlerInner>::bug::<&alloc::string::String>
   3: <rustc_errors::Handler>::bug::<&alloc::string::String>
   4: rustc_middle::ty::context::tls::with_opt::<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, ()>
   5: rustc_middle::util::bug::opt_span_bug_fmt::<rustc_span::span_encoding::Span>
   6: rustc_middle::util::bug::bug_fmt
   7: <rustc_infer::infer::error_reporting::need_type_info::FindInferSourceVisitor>::path_inferred_subst_iter
   8: <rustc_infer::infer::error_reporting::need_type_info::FindInferSourceVisitor as rustc_hir::intravisit::Visitor>::visit_expr
   9: <rustc_infer::infer::error_reporting::need_type_info::FindInferSourceVisitor as rustc_hir::intravisit::Visitor>::visit_expr
  10: rustc_hir::intravisit::walk_expr::<rustc_infer::infer::error_reporting::need_type_info::FindInferSourceVisitor>
  11: <rustc_infer::infer::error_reporting::need_type_info::FindInferSourceVisitor as rustc_hir::intravisit::Visitor>::visit_expr
  12: rustc_hir::intravisit::walk_expr::<rustc_infer::infer::error_reporting::need_type_info::FindInferSourceVisitor>
  13: <rustc_infer::infer::error_reporting::need_type_info::FindInferSourceVisitor as rustc_hir::intravisit::Visitor>::visit_expr
  14: rustc_hir::intravisit::walk_expr::<rustc_infer::infer::error_reporting::need_type_info::FindInferSourceVisitor>
  15: <rustc_infer::infer::error_reporting::need_type_info::FindInferSourceVisitor as rustc_hir::intravisit::Visitor>::visit_expr
  16: rustc_hir::intravisit::walk_expr::<rustc_infer::infer::error_reporting::need_type_info::FindInferSourceVisitor>
  17: <rustc_infer::infer::error_reporting::need_type_info::FindInferSourceVisitor as rustc_hir::intravisit::Visitor>::visit_expr
  18: <rustc_infer::infer::error_reporting::need_type_info::FindInferSourceVisitor as rustc_hir::intravisit::Visitor>::visit_local
  19: rustc_hir::intravisit::walk_expr::<rustc_infer::infer::error_reporting::need_type_info::FindInferSourceVisitor>
  20: <rustc_infer::infer::error_reporting::need_type_info::FindInferSourceVisitor as rustc_hir::intravisit::Visitor>::visit_expr
  21: <rustc_infer::infer::error_reporting::need_type_info::FindInferSourceVisitor as rustc_hir::intravisit::Visitor>::visit_body
  22: rustc_hir::intravisit::walk_expr::<rustc_infer::infer::error_reporting::need_type_info::FindInferSourceVisitor>
  23: <rustc_infer::infer::error_reporting::need_type_info::FindInferSourceVisitor as rustc_hir::intravisit::Visitor>::visit_expr
  24: <rustc_infer::infer::error_reporting::need_type_info::FindInferSourceVisitor as rustc_hir::intravisit::Visitor>::visit_expr
  25: <rustc_infer::infer::error_reporting::need_type_info::FindInferSourceVisitor as rustc_hir::intravisit::Visitor>::visit_local
  26: rustc_hir::intravisit::walk_expr::<rustc_infer::infer::error_reporting::need_type_info::FindInferSourceVisitor>
  27: <rustc_infer::infer::error_reporting::need_type_info::FindInferSourceVisitor as rustc_hir::intravisit::Visitor>::visit_expr
  28: <rustc_infer::infer::InferCtxt>::emit_inference_failure_err
  29: <rustc_infer::infer::InferCtxt as rustc_trait_selection::traits::error_reporting::InferCtxtPrivExt>::maybe_report_ambiguity
  30: <rustc_infer::infer::InferCtxt as rustc_trait_selection::traits::error_reporting::InferCtxtExt>::report_fulfillment_errors
  31: <rustc_typeck::check::fn_ctxt::FnCtxt>::select_all_obligations_or_error
  32: <rustc_infer::infer::InferCtxtBuilder>::enter::<&rustc_middle::ty::context::TypeckResults, <rustc_typeck::check::inherited::InheritedBuilder>::enter<rustc_typeck::check::typeck_with_fallback<rustc_typeck::check::typeck::{closure#0}>::{closure#1}, &rustc_middle::ty::context::TypeckResults>::{closure#0}>
  33: rustc_typeck::check::typeck
  34: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::LocalDefId, &rustc_middle::ty::context::TypeckResults>>
  35: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::typeck, rustc_query_impl::plumbing::QueryCtxt>
  36: rustc_typeck::check::typeck
  37: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::LocalDefId, &rustc_middle::ty::context::TypeckResults>>
  38: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::typeck, rustc_query_impl::plumbing::QueryCtxt>
  39: <rustc_middle::hir::map::Map>::par_body_owners::<rustc_typeck::check::typeck_item_bodies::{closure#0}>
  40: rustc_typeck::check::typeck_item_bodies
  41: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<(), ()>>
  42: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::typeck_item_bodies, rustc_query_impl::plumbing::QueryCtxt>
  43: <rustc_session::session::Session>::time::<(), rustc_typeck::check_crate::{closure#7}>
  44: rustc_typeck::check_crate
  45: rustc_interface::passes::analysis
  46: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<(), core::result::Result<(), rustc_errors::ErrorGuaranteed>>>
  47: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt>
  48: <rustc_interface::passes::QueryContext>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}::{closure#3}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
  49: <rustc_interface::interface::Compiler>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_errors::ErrorGuaranteed>>
  50: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_interface::interface::create_compiler_and_run<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#1}>
  51: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::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.

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.63.0-nightly (5435ed691 2022-06-07) running on x86_64-apple-darwin

note: compiler flags: --crate-type bin -C opt-level=3 -C embed-bitcode=no

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

query stack during panic:
#0 [typeck] type-checking `main`
#1 [typeck] type-checking `main::{closure#0}`
#2 [typeck_item_bodies] type-checking all item bodies
#3 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `kafka_writer`

@yarenty yarenty 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 Jun 10, 2022
@eggyal
Copy link
Contributor

eggyal commented Jun 10, 2022

Reduced example:

fn ice_on_inference_failure(_: impl Into<i32>) {}

fn test() {
    let s: &str = clap::Command::new("").get_matches().value_of("").unwrap();
    let p = s.parse().unwrap();
    ice_on_inference_failure(p);
}

https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=5bc8ef48088f6050b939796574e95a99

I can't get it to ICE if the clap::ArgMatches nor even clap::Command is passed in as an argument to the test function.

@rustbot label +A-inference +requires-nightly

@rustbot rustbot added requires-nightly This issue requires a nightly compiler in some way. A-inference Area: Type inference labels Jun 10, 2022
@compiler-errors compiler-errors changed the title Bug connected with probably ambiguous data type when parsing string into i32 from &str from clap - fixed easily, however Cargo told me to post it here Bug connected with probably ambiguous data type when parsing string into i32 from &str from clap Jun 10, 2022
@matthiaskrgr
Copy link
Member

another duplicate of #97698 ?

@cjgillot
Copy link
Contributor

cjgillot commented Sep 5, 2022

Closing as duplicate of closed #97698.

@cjgillot cjgillot closed this as completed Sep 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-inference Area: Type inference C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. 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