Closed
Description
Code
main.rs
:
use rustc_panic::{Point, Segment};
fn main() {
draw_segment(&Segment(Point(0)));
}
fn draw_segment(s: &Segment) {
for p in s.points() {
draw_point(p);
}
}
fn draw_point(_: &Point) {}
lib.rs
pub struct Point(pub i32);
pub struct Segment(pub Point);
impl Segment {
pub fn points(&self) -> impl std::iter::Iterator + '_ {
(0..1).map(|t| Point(self.0 .0 + t))
}
}
Meta
rustc --version --verbose
:
rustc 1.57.0 (f1edd0429 2021-11-29)
binary: rustc
commit-hash: f1edd0429582dd29cccacaf50fd134b05593bd9c
commit-date: 2021-11-29
host: x86_64-apple-darwin
release: 1.57.0
LLVM version: 13.0.0
Error output
% cargo build
Compiling rustc_panic v0.1.0 (/Users/myst/Projects/rustc_panic)
thread 'rustc' panicked at 'DefId::expect_local: `DefId(18:11 ~ rustc_panic[612c]::{impl#0}::points::{opaque#0})` isn't local', /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/compiler/rustc_span/src/def_id.rs:234:43
note: run with `RUST_BACKTRACE=1` environment variable to display a 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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
note: rustc 1.57.0 (f1edd0429 2021-11-29) running on x86_64-apple-darwin
note: compiler flags: -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C incremental --crate-type bin
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
#0 [typeck] type-checking `draw_segment`
#1 [typeck_item_bodies] type-checking all item bodies
end of query stack
error: internal compiler error: trimmed_def_paths constructed
|
= note: delayed at 0: std::backtrace::Backtrace::create
1: std::backtrace::Backtrace::force_capture
2: rustc_errors::Handler::delay_good_path_bug
3: rustc_middle::ty::print::pretty::trimmed_def_paths
4: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
5: rustc_data_structures::stack::ensure_sufficient_stack
6: rustc_query_system::query::plumbing::try_execute_query
7: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::trimmed_def_paths
8: <rustc_middle::ty::print::pretty::FmtPrinter<F> as rustc_middle::ty::print::Printer>::print_def_path
9: rustc_middle::ty::print::pretty::PrettyPrinter::pretty_print_type
10: rustc_middle::ty::print::pretty::<impl rustc_middle::ty::print::Print<P> for rustc_middle::ty::sty::TypeAndMut>::print
11: rustc_middle::ty::print::pretty::PrettyPrinter::pretty_print_type
12: rustc_middle::ty::print::pretty::<impl core::fmt::Display for &rustc_middle::ty::TyS>::fmt
13: rustc_infer::infer::error_reporting::<impl rustc_infer::infer::InferCtxt>::cmp
14: rustc_infer::infer::error_reporting::<impl rustc_infer::infer::InferCtxt>::values_str
15: rustc_infer::infer::error_reporting::<impl rustc_infer::infer::InferCtxt>::note_type_err
16: rustc_infer::infer::error_reporting::<impl rustc_infer::infer::InferCtxt>::report_and_explain_type_error
17: rustc_infer::infer::InferCtxt::report_mismatched_types
18: rustc_typeck::check::demand::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::demand_coerce_diag
19: rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_argument_types
20: rustc_typeck::check::callee::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::confirm_builtin_call
21: rustc_typeck::check::callee::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_call
22: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
23: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
24: rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_stmt
25: rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_block_with_expected
26: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
27: rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_stmt
28: rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_block_with_expected
29: rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_block_no_value
30: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
31: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
32: rustc_typeck::check::_match::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_match
33: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
34: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
35: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
36: rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_block_with_expected
37: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
38: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_return_expr
39: rustc_typeck::check::check::check_fn
40: rustc_infer::infer::InferCtxtBuilder::enter
41: rustc_typeck::check::typeck
42: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
43: rustc_data_structures::stack::ensure_sufficient_stack
44: rustc_query_system::query::plumbing::try_execute_query
45: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck
46: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
47: rustc_data_structures::sync::par_for_each_in
48: rustc_typeck::check::typeck_item_bodies
49: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
50: rustc_data_structures::stack::ensure_sufficient_stack
51: rustc_query_system::query::plumbing::try_execute_query
52: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck_item_bodies
53: rustc_session::utils::<impl rustc_session::session::Session>::time
54: rustc_typeck::check_crate
55: rustc_interface::passes::analysis
56: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
57: rustc_data_structures::stack::ensure_sufficient_stack
58: rustc_query_system::query::plumbing::try_execute_query
59: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
60: rustc_interface::passes::QueryContext::enter
61: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
62: rustc_span::with_source_map
63: scoped_tls::ScopedKey<T>::set
64: std::sys_common::backtrace::__rust_begin_short_backtrace
65: core::ops::function::FnOnce::call_once{{vtable.shim}}
66: std::sys::unix::thread::Thread::new::thread_start
67: __pthread_start
thread 'rustc' panicked at 'no warnings or errors encountered even though `delayed_good_path_bugs` issued', compiler/rustc_errors/src/lib.rs:1165:13
stack backtrace:
0: 0x1086f9321 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h4edbddd26fc45697
1: 0x10874a4bb - core::fmt::write::h266c957f12b1655a
2: 0x1086e9d3a - std::io::Write::write_fmt::h65d4ee621e8d810d
3: 0x1086fc585 - std::panicking::default_hook::{{closure}}::h5b4886cd9f93dfca
4: 0x1086fc16f - std::panicking::default_hook::h986d152c7bd7e732
5: 0x1102b57c8 - rustc_driver::DEFAULT_HOOK::{{closure}}::{{closure}}::h997411fe6ff6a285
6: 0x1086fcdc6 - std::panicking::rust_panic_with_hook::h151f3b3bf37b4f17
7: 0x1086fc83e - std::panicking::begin_panic_handler::{{closure}}::hf6660086d9ebd48c
8: 0x1086f9797 - std::sys_common::backtrace::__rust_end_short_backtrace::h34152178ea368a9a
9: 0x1086fc7aa - _rust_begin_unwind
10: 0x10877505f - core::panicking::panic_fmt::hb64a2db862b4aca0
11: 0x1149199d2 - core::panicking::panic_display::hf3cbb9a8f3ec50df
12: 0x11491e685 - rustc_errors::HandlerInner::flush_delayed::h293119edf764a79d
13: 0x11491a8a6 - <rustc_errors::HandlerInner as core::ops::drop::Drop>::drop::h3f7218073ad25818
14: 0x11032045a - core::ptr::drop_in_place<rustc_session::parse::ParseSess>::h358cdf3f0cba848b
15: 0x1103286b7 - <alloc::rc::Rc<T> as core::ops::drop::Drop>::drop::h51adef2b2544e01f
16: 0x1102c5812 - core::ptr::drop_in_place<rustc_interface::interface::Compiler>::h2c5e72eab1dedf3c
17: 0x1102c46c2 - rustc_span::with_source_map::h5222a0af0f8eb603
18: 0x1102f23ac - scoped_tls::ScopedKey<T>::set::h1d3d67352154478d
19: 0x1102c8c32 - std::sys_common::backtrace::__rust_begin_short_backtrace::hb945015c1b1cd51d
20: 0x11031a9a5 - core::ops::function::FnOnce::call_once{{vtable.shim}}::hc43c9a06b1d9c32a
21: 0x108706ba7 - std::sys::unix::thread::Thread::new::thread_start::h1ebadf8a3a1817e4
22: 0x7ff8084e3514 - __pthread_start
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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
note: rustc 1.57.0 (f1edd0429 2021-11-29) running on x86_64-apple-darwin
note: compiler flags: -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C incremental --crate-type bin
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
end of query stack
thread panicked while panicking. aborting.
error: could not compile `rustc_panic`
Caused by:
process didn't exit successfully: `rustc --crate-name rustc_panic --edition=2021 src/main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C metadata=46b7e562499556be -C extra-filename=-46b7e562499556be --out-dir /Users/myst/Projects/rustc_panic/target/debug/deps -C incremental=/Users/myst/Projects/rustc_panic/target/debug/incremental -L dependency=/Users/myst/Projects/rustc_panic/target/debug/deps --extern rustc_panic=/Users/myst/Projects/rustc_panic/target/debug/deps/librustc_panic-799842390127a3c5.rlib` (signal: 4, SIGILL: illegal instruction)
Backtrace
stack backtrace:
0: _rust_begin_unwind
1: core::panicking::panic_fmt
2: rustc_span::def_id::DefId::expect_local::{{closure}}
3: rustc_middle::ty::error::<impl rustc_middle::ty::context::TyCtxt>::suggest_constraining_opaque_associated_type
4: rustc_middle::ty::error::<impl rustc_middle::ty::context::TyCtxt>::note_and_explain_type_err
5: rustc_infer::infer::error_reporting::<impl rustc_infer::infer::InferCtxt>::note_type_err
6: rustc_infer::infer::error_reporting::<impl rustc_infer::infer::InferCtxt>::report_and_explain_type_error
7: rustc_infer::infer::InferCtxt::report_mismatched_types
8: rustc_typeck::check::demand::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::demand_coerce_diag
9: rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_argument_types
10: rustc_typeck::check::callee::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::confirm_builtin_call
11: rustc_typeck::check::callee::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_call
12: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
13: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
14: rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_stmt
15: rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_block_with_expected
16: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
17: rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_stmt
18: rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_block_with_expected
19: rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_block_no_value
20: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
21: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
22: rustc_typeck::check::_match::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_match
23: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
24: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
25: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
26: rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_block_with_expected
27: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
28: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_return_expr
29: rustc_typeck::check::check::check_fn
30: rustc_infer::infer::InferCtxtBuilder::enter
31: rustc_typeck::check::typeck
32: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
33: rustc_data_structures::stack::ensure_sufficient_stack
34: rustc_query_system::query::plumbing::try_execute_query
35: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck
36: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
37: rustc_data_structures::sync::par_for_each_in
38: rustc_typeck::check::typeck_item_bodies
39: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
40: rustc_data_structures::stack::ensure_sufficient_stack
41: rustc_query_system::query::plumbing::try_execute_query
42: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck_item_bodies
43: rustc_session::utils::<impl rustc_session::session::Session>::time
44: rustc_typeck::check_crate
45: rustc_interface::passes::analysis
46: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
47: rustc_data_structures::stack::ensure_sufficient_stack
48: rustc_query_system::query::plumbing::try_execute_query
49: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
50: rustc_interface::passes::QueryContext::enter
51: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
52: rustc_span::with_source_map
53: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.