Closed
Description
Reduced test case (play):
fn server() -> impl FilterBase2 {
segment2(|| { loop { } }).map2(|| "")
}
trait FilterBase2 {
fn map2<F>(self, _fn: F) -> Map2<F> where Self: Sized { loop { } }
}
struct Map2<F> { _func: F }
impl<F> FilterBase2 for Map2<F> { }
fn segment2<F>(_fn: F) -> Map2<F> where F: Fn() -> Result<(), ()> {
loop { }
}
fn main() { server(); }
Original Bug Report follows
Error:
error: internal compiler error: librustc/infer/error_reporting/mod.rs:181: ReEmpty
Cargo.toml:
[package]
name = "rustcrash"
version = "0.1.0"
authors = ["dbrgn"]
[dependencies]
warp = "0.1.8"
src/lib.rs:
extern crate warp;
use warp::Filter;
pub fn server() -> impl Filter {
warp::path("config").map(|| "{}")
}
rustc 1.30.0 (da5f414 2018-10-24):
$ RUST_BACKTRACE=1 cargo +stable build
Compiling rustcrash v0.1.0 (/mnt/data/rustysafe-crash)
error: internal compiler error: librustc/infer/error_reporting/mod.rs:183: ReEmpty
thread 'main' panicked at 'Box<Any>', librustc_errors/lib.rs:587:9
stack backtrace:
0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
1: std::sys_common::backtrace::print
at libstd/sys_common/backtrace.rs:71
at libstd/sys_common/backtrace.rs:59
2: std::panicking::default_hook::{{closure}}
at libstd/panicking.rs:211
3: std::panicking::default_hook
at libstd/panicking.rs:227
4: rustc::util::common::panic_hook
5: std::panicking::rust_panic_with_hook
at libstd/panicking.rs:481
6: std::panicking::begin_panic
7: rustc_errors::Handler::bug
8: rustc::util::bug::opt_span_bug_fmt::{{closure}}
9: rustc::ty::context::tls::with_opt::{{closure}}
10: rustc::ty::context::tls::with_context_opt
11: rustc::ty::context::tls::with_opt
12: rustc::util::bug::opt_span_bug_fmt
13: rustc::util::bug::bug_fmt
14: rustc::infer::error_reporting::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::msg_span_from_free_region
15: <rustc::infer::opaque_types::ReverseMapper<'cx, 'gcx, 'tcx> as rustc::ty::fold::TypeFolder<'gcx, 'tcx>>::fold_region
16: rustc::ty::structural_impls::<impl rustc::ty::fold::TypeFoldable<'tcx> for &'tcx rustc::ty::TyS<'tcx>>::super_fold_with
17: <rustc::infer::opaque_types::ReverseMapper<'cx, 'gcx, 'tcx> as rustc::ty::fold::TypeFolder<'gcx, 'tcx>>::fold_ty
18: rustc::ty::fold::TypeFoldable::fold_with
19: rustc::ty::structural_impls::<impl rustc::ty::fold::TypeFoldable<'tcx> for &'tcx rustc::ty::TyS<'tcx>>::super_fold_with
20: <rustc::infer::opaque_types::ReverseMapper<'cx, 'gcx, 'tcx> as rustc::ty::fold::TypeFolder<'gcx, 'tcx>>::fold_ty
21: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &'a mut F>::call_once
22: <smallvec::SmallVec<A> as core::iter::traits::FromIterator<<A as smallvec::Array>::Item>>::from_iter
23: <T as rustc::ty::context::InternIteratorElement<T, R>>::intern_with
24: <rustc::infer::opaque_types::ReverseMapper<'cx, 'gcx, 'tcx> as rustc::ty::fold::TypeFolder<'gcx, 'tcx>>::fold_ty
25: rustc::ty::fold::TypeFoldable::fold_with
26: rustc::ty::structural_impls::<impl rustc::ty::fold::TypeFoldable<'tcx> for &'tcx rustc::ty::TyS<'tcx>>::super_fold_with
27: <rustc::infer::opaque_types::ReverseMapper<'cx, 'gcx, 'tcx> as rustc::ty::fold::TypeFolder<'gcx, 'tcx>>::fold_ty
28: rustc::infer::opaque_types::<impl rustc::infer::InferCtxt<'a, 'gcx, 'tcx>>::infer_opaque_definition_from_instantiation
29: rustc_typeck::check::writeback::WritebackCx::visit_opaque_types
30: rustc_typeck::check::writeback::<impl rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx>>::resolve_type_vars_in_body
31: rustc::ty::context::tls::with_related_context
32: rustc::infer::InferCtxtBuilder::enter
33: rustc_typeck::check::typeck_tables_of
34: rustc::ty::query::__query_compute::typeck_tables_of
35: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors<'tcx> for rustc::ty::query::queries::typeck_tables_of<'tcx>>::compute
36: rustc::ty::context::tls::with_context
37: rustc::dep_graph::graph::DepGraph::with_task_impl
38: rustc::ty::context::tls::with_related_context
39: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::force_query_with_job
40: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::get_query
41: rustc::ty::query::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::typeck_tables_of
42: rustc_typeck::collect::type_of
43: rustc::ty::query::__query_compute::type_of
44: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors<'tcx> for rustc::ty::query::queries::type_of<'tcx>>::compute
45: rustc::ty::context::tls::with_context
46: rustc::dep_graph::graph::DepGraph::with_task_impl
47: rustc::ty::context::tls::with_related_context
48: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::force_query_with_job
49: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::get_query
50: rustc::ty::query::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::type_of
51: rustc_typeck::check::check_item_type
52: rustc::hir::Crate::visit_all_item_likes
53: rustc_typeck::check::check_item_types
54: rustc_typeck::check_crate
55: rustc::ty::context::tls::enter_context
56: <std::thread::local::LocalKey<T>>::with
57: rustc::ty::context::TyCtxt::create_and_enter
58: rustc_driver::driver::compile_input
59: rustc_driver::run_compiler_with_pool
60: rustc_driver::driver::spawn_thread_pool
61: rustc_driver::run_compiler
62: <scoped_tls::ScopedKey<T>>::set
63: syntax::with_globals
64: __rust_maybe_catch_panic
at libpanic_unwind/lib.rs:103
65: rustc_driver::run
66: rustc_driver::main
67: std::rt::lang_start::{{closure}}
68: std::panicking::try::do_call
at libstd/rt.rs:59
at libstd/panicking.rs:310
69: __rust_maybe_catch_panic
at libpanic_unwind/lib.rs:103
70: std::rt::lang_start_internal
at libstd/panicking.rs:289
at libstd/panic.rs:392
at libstd/rt.rs:58
71: main
72: __libc_start_main
73: <unknown>
query stack during panic:
#0 [typeck_tables_of] processing `server`
#1 [type_of] processing `server::{{impl-Trait}}`
end of query stack
error: aborting due to previous error
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.30.0 (da5f414c2 2018-10-24) 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
error: Could not compile `rustcrash`.
To learn more, run the command again with --verbose.
rustc 1.32.0-nightly (451987d 2018-11-01):
$ RUST_BACKTRACE=1 cargo +nightly build
Compiling rustcrash v0.1.0 (/mnt/data/rustysafe-crash)
error: internal compiler error: librustc/infer/error_reporting/mod.rs:181: ReEmpty
thread 'main' panicked at 'Box<Any>', librustc_errors/lib.rs:600:9
stack backtrace:
0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
1: std::sys_common::backtrace::_print
at libstd/sys_common/backtrace.rs:71
2: std::panicking::default_hook::{{closure}}
at libstd/sys_common/backtrace.rs:59
at libstd/panicking.rs:211
3: std::panicking::default_hook
at libstd/panicking.rs:227
4: rustc::util::common::panic_hook
5: std::panicking::rust_panic_with_hook
at libstd/panicking.rs:480
6: std::panicking::begin_panic
7: rustc_errors::Handler::bug
8: rustc::util::bug::opt_span_bug_fmt::{{closure}}
9: rustc::ty::context::tls::with_opt::{{closure}}
10: rustc::ty::context::tls::with_context_opt
11: rustc::ty::context::tls::with_opt
12: rustc::util::bug::opt_span_bug_fmt
13: rustc::util::bug::bug_fmt
14: rustc::infer::error_reporting::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::msg_span_from_free_region
15: <rustc::infer::opaque_types::ReverseMapper<'cx, 'gcx, 'tcx> as rustc::ty::fold::TypeFolder<'gcx, 'tcx>>::fold_region
16: rustc::ty::structural_impls::<impl rustc::ty::fold::TypeFoldable<'tcx> for &'tcx rustc::ty::TyS<'tcx>>::super_fold_with
17: <rustc::infer::opaque_types::ReverseMapper<'cx, 'gcx, 'tcx> as rustc::ty::fold::TypeFolder<'gcx, 'tcx>>::fold_ty
18: <smallvec::SmallVec<A> as core::iter::traits::FromIterator<<A as smallvec::Array>::Item>>::from_iter
19: rustc::ty::fold::TypeFoldable::fold_with
20: rustc::ty::structural_impls::<impl rustc::ty::fold::TypeFoldable<'tcx> for &'tcx rustc::ty::TyS<'tcx>>::super_fold_with
21: <rustc::infer::opaque_types::ReverseMapper<'cx, 'gcx, 'tcx> as rustc::ty::fold::TypeFolder<'gcx, 'tcx>>::fold_ty
22: <smallvec::SmallVec<A> as core::iter::traits::FromIterator<<A as smallvec::Array>::Item>>::from_iter
23: <T as rustc::ty::context::InternIteratorElement<T, R>>::intern_with
24: <rustc::infer::opaque_types::ReverseMapper<'cx, 'gcx, 'tcx> as rustc::ty::fold::TypeFolder<'gcx, 'tcx>>::fold_ty
25: <smallvec::SmallVec<A> as core::iter::traits::FromIterator<<A as smallvec::Array>::Item>>::from_iter
26: rustc::ty::fold::TypeFoldable::fold_with
27: rustc::ty::structural_impls::<impl rustc::ty::fold::TypeFoldable<'tcx> for &'tcx rustc::ty::TyS<'tcx>>::super_fold_with
28: <rustc::infer::opaque_types::ReverseMapper<'cx, 'gcx, 'tcx> as rustc::ty::fold::TypeFolder<'gcx, 'tcx>>::fold_ty
29: rustc::infer::opaque_types::<impl rustc::infer::InferCtxt<'a, 'gcx, 'tcx>>::infer_opaque_definition_from_instantiation
30: rustc_typeck::check::writeback::WritebackCx::visit_opaque_types
31: rustc_typeck::check::writeback::<impl rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx>>::resolve_type_vars_in_body
32: rustc::ty::context::tls::with_related_context
33: rustc::infer::InferCtxtBuilder::enter
34: rustc_typeck::check::typeck_tables_of
35: rustc::ty::query::__query_compute::typeck_tables_of
36: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors<'tcx> for rustc::ty::query::queries::typeck_tables_of<'tcx>>::compute
37: rustc::ty::context::tls::with_context
38: rustc::dep_graph::graph::DepGraph::with_task_impl
39: rustc::ty::context::tls::with_related_context
40: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::force_query_with_job
41: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::get_query
42: rustc::ty::query::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::typeck_tables_of
43: rustc_typeck::collect::type_of
44: rustc::ty::query::__query_compute::type_of
45: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors<'tcx> for rustc::ty::query::queries::type_of<'tcx>>::compute
46: rustc::ty::context::tls::with_context
47: rustc::dep_graph::graph::DepGraph::with_task_impl
48: rustc::ty::context::tls::with_related_context
49: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::force_query_with_job
50: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::get_query
51: rustc::ty::query::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::type_of
52: rustc_typeck::check::check_item_type
53: rustc::session::Session::track_errors
54: rustc_typeck::check_crate
55: rustc::ty::context::tls::enter_context
56: <std::thread::local::LocalKey<T>>::with
57: rustc::ty::context::TyCtxt::create_and_enter
58: rustc_driver::driver::compile_input
59: rustc_driver::run_compiler_with_pool
60: rustc_driver::driver::spawn_thread_pool
61: rustc_driver::run_compiler
62: <scoped_tls::ScopedKey<T>>::set
63: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
64: __rust_maybe_catch_panic
at libpanic_unwind/lib.rs:102
65: rustc_driver::run
66: rustc_driver::main
67: std::rt::lang_start::{{closure}}
68: std::panicking::try::do_call
at libstd/rt.rs:59
at libstd/panicking.rs:310
69: __rust_maybe_catch_panic
at libpanic_unwind/lib.rs:102
70: std::rt::lang_start_internal
at libstd/panicking.rs:289
at libstd/panic.rs:392
at libstd/rt.rs:58
71: main
72: __libc_start_main
73: <unknown>
query stack during panic:
#0 [typeck_tables_of] processing `server`
#1 [type_of] processing `server::{{impl-Trait}}`
end of query stack
error: aborting due to previous error
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.32.0-nightly (451987d86 2018-11-01) 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
error: Could not compile `rustcrash`.
To learn more, run the command again with --verbose.
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
pnkfelix commentedon Nov 2, 2018
(sorry for the label noise; I was doing some bisection but then realized I hadn't set up the test correctly in the first place...)
pnkfelix commentedon Nov 2, 2018
(I've been trying to identify whether this is a regression; its not immediately trivial because the provided test involves crates that require a relatively recent (stable) rust version, but the most recent ones trigger the failure in question. I may switch to attempting to derive a standalone test rather than continuing to work with the steps-to-reproduce that were provided.
pnkfelix commentedon Nov 2, 2018
Just to clarify my previous comment: the crate in question does not build with rust 1.25 because
impl Ttrait
was not supported at that time. But we get the ICE with rust 1.26.So, I'm going to try to derive a standalone test case now.
pnkfelix commentedon Nov 2, 2018
Reduced to the following:
pnkfelix commentedon Nov 2, 2018
I don't think this is a stable-to-stable regression. I cannot find a stable version of rust after the stabilization of
impl Trait
(which is a core component of the reduced test case) that compiled this without ICE'ing.But it might be a nightly regression. Looking now.
pnkfelix commentedon Nov 2, 2018
Okay, so after adding
#![feature(conservative_impl_trait)]
to the file, we can bisect overrustc
nightlies and find one that does not ICE. (Of course, its entirely possible that the early version that did not ICE was incorrectly analyzing/compiling the code in question.)Anyway here's the point where an ICE was introduced (though its message is not 100% the same as the one we currently see:
pnkfelix commentedon Nov 3, 2018
After fixing the root cause of the ICE (
fn msg_span_from_free_region
) to describeReEmpty
as "an empty region", I get this on the reduced test case:Rollup merge of rust-lang#55638 - pnkfelix:issue-55608-ice-reempty-ms…
Rollup merge of rust-lang#55638 - pnkfelix:issue-55608-ice-reempty-ms…
dbrgn commentedon Nov 9, 2018
Thanks @pnkfelix!