-   Notifications  You must be signed in to change notification settings 
- Fork 13.9k
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.Performance or correctness regression from stable to nightly.
Description
I tried code very similar to this:
use serde::de::*; pub trait IpldVisitorExt<'de>: Visitor<'de> { fn visit_link<E>(self, _cid: Cid) -> Result<<Self as Visitor<'de>>::Value, E> where E: Error; } struct JsonVisitor<V>(V); impl<'de, V: IpldVisitorExt<'de>> Visitor<'de> for JsonVisitor<V> { type Value = V::Value; #[inline] fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result { formatter.write_str("a JSON map, link object or byte object") } #[inline] fn visit_map<A>(self, map: A) -> Result<Self::Value, A::Error> where A: MapAccess<'de>, { let deserializer = value::MapAccessDeserializer::<A>::new(map); // uncommenting the following line triggers the error // let temp: value::MapAccessDeserializer<A> = deserializer.clone(); Err(Error::custom("")) } }and it produces some type of type checking error when uncommenting the line beginning with let temp.
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', src/librustc_typeck/check/method/suggest.rs:550:46 ... query stack during panic: #0 [typeck_tables_of] type-checking `<codec::dag_json::JsonVisitor<V> as serde::de::Visitor<'de>>::visit_map` #1 [typeck_item_bodies] type-checking all item bodies #2 [analysis] running analysis passes on this crate end of query stack Meta
rustc --version --verbose:
rustc 1.43.0-nightly (4ad624882 2020-03-03) binary: rustc commit-hash: 4ad62488258972bdb0e2df225d100f99ef58dbad commit-date: 2020-03-03 host: x86_64-unknown-linux-gnu release: 1.43.0-nightly LLVM version: 9.0 Backtrace:
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', src/librustc_typeck/check/method/suggest.rs:550:46 stack backtrace: 0: backtrace::backtrace::libunwind::trace at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.44/src/backtrace/libunwind.rs:86 1: backtrace::backtrace::trace_unsynchronized at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.44/src/backtrace/mod.rs:66 2: std::sys_common::backtrace::_print_fmt at src/libstd/sys_common/backtrace.rs:78 3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt at src/libstd/sys_common/backtrace.rs:59 4: core::fmt::write at src/libcore/fmt/mod.rs:1053 5: std::io::Write::write_fmt at src/libstd/io/mod.rs:1428 6: std::sys_common::backtrace::_print at src/libstd/sys_common/backtrace.rs:62 7: std::sys_common::backtrace::print at src/libstd/sys_common/backtrace.rs:49 8: std::panicking::default_hook::{{closure}} at src/libstd/panicking.rs:204 9: std::panicking::default_hook at src/libstd/panicking.rs:224 10: rustc_driver::report_ice 11: <alloc::boxed::Box<F> as core::ops::function::Fn<A>>::call at /rustc/4ad62488258972bdb0e2df225d100f99ef58dbad/src/liballoc/boxed.rs:1031 12: proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::enter::{{closure}}::{{closure}} at /rustc/4ad62488258972bdb0e2df225d100f99ef58dbad/src/libproc_macro/bridge/client.rs:305 13: std::panicking::rust_panic_with_hook at src/libstd/panicking.rs:474 14: rust_begin_unwind at src/libstd/panicking.rs:378 15: core::panicking::panic_fmt at src/libcore/panicking.rs:85 16: core::panicking::panic at src/libcore/panicking.rs:52 17: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut 18: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T,I>>::from_iter 19: rustc_typeck::check::method::suggest::<impl rustc_typeck::check::FnCtxt>::report_method_error 20: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind 21: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs 22: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_coercable_to_type 23: rustc_typeck::check::FnCtxt::check_decl_local 24: rustc_typeck::check::FnCtxt::check_stmt 25: rustc_typeck::check::FnCtxt::check_block_with_expected 26: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind 27: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs 28: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_return_expr 29: rustc_typeck::check::check_fn 30: rustc::ty::context::GlobalCtxt::enter_local 31: rustc_typeck::check::typeck_tables_of 32: rustc::ty::query::__query_compute::typeck_tables_of 33: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::typeck_tables_of>::compute 34: rustc::dep_graph::graph::DepGraph::with_task_impl 35: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query 36: rustc::ty::<impl rustc::ty::context::TyCtxt>::par_body_owners 37: rustc_typeck::check::typeck_item_bodies 38: rustc::ty::query::__query_compute::typeck_item_bodies 39: rustc::dep_graph::graph::DepGraph::with_task_impl 40: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query 41: rustc_typeck::check_crate 42: rustc_interface::passes::analysis 43: rustc::ty::query::__query_compute::analysis 44: rustc::dep_graph::graph::DepGraph::with_task_impl 45: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query 46: rustc::ty::context::tls::enter_global 47: rustc_interface::interface::run_compiler_in_existing_thread_pool 48: rustc_ast::attr::with_globals note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. error: internal compiler error: unexpected panic note: the compiler unexpectedly panicked. this is a bug. note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports note: rustc 1.43.0-nightly (4ad624882 2020-03-03) running on x86_64-unknown-linux-gnu note: compiler flags: -C debuginfo=2 -C incremental --crate-type lib note: some of the compiler flags provided by cargo are hidden query stack during panic: #0 [typeck_tables_of] type-checking `<codec::dag_json::JsonVisitor<V> as serde::de::Visitor<'de>>::visit_map` #1 [typeck_item_bodies] type-checking all item bodies #2 [analysis] running analysis passes on this crate end of query stack ivan
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.Performance or correctness regression from stable to nightly.