Rust: crash: checking hyper with borrowck-migrate

Created on 2 Aug 2018  路  5Comments  路  Source: rust-lang/rust

````
git clone https://github.com/hyperium/hyper
cd hyper
git checkout v0.11.27
RUSTFLAGS="-Zborrowck=migrate" cargo check -j1

````

``` Fresh nodrop v0.1.12 Fresh cfg-if v0.1.4 Fresh libc v0.2.42 Fresh lazy_static v1.0.2 Fresh scopeguard v0.3.3 Fresh byteorder v1.2.4 Fresh memoffset v0.2.1 Fresh slab v0.4.0 Fresh futures v0.1.23 Fresh lazycell v0.6.0 Fresh version_check v0.1.4 Fresh scoped-tls v0.1.2 Fresh smallvec v0.2.1 Fresh safemem v0.2.0 Fresh slab v0.3.0 Fresh try-lock v0.1.0 Fresh take v0.1.0 Fresh language-tags v0.2.2 Fresh percent-encoding v1.0.1 Fresh arrayvec v0.4.7 Fresh crossbeam-utils v0.3.2 Fresh log v0.4.3 Fresh iovec v0.1.2 Fresh net2 v0.2.33 Fresh rand v0.4.2 Fresh num_cpus v1.8.0 Fresh time v0.1.40 Fresh tokio-executor v0.1.2 Fresh tokio-service v0.1.0 Fresh relay v0.1.1 Fresh base64 v0.9.2 Fresh crossbeam-epoch v0.4.3 Fresh log v0.3.9 Fresh want v0.0.4 Fresh bytes v0.4.9 Fresh mio v0.6.15 Fresh rand v0.3.22 Fresh futures-cpupool v0.1.8 Fresh tokio-timer v0.2.4 Fresh httparse v1.3.2 Fresh crossbeam-deque v0.3.1 Fresh tokio-io v0.1.7 Fresh unicase v2.1.0 Fresh tokio-threadpool v0.1.5 Fresh tokio-reactor v0.1.2 Fresh tokio-codec v0.1.0 Fresh mime v0.3.8 Fresh tokio-fs v0.1.2 Fresh tokio-tcp v0.1.0 Fresh tokio-udp v0.1.1 Fresh tokio v0.1.7 Fresh tokio-core v0.1.17 Fresh tokio-proto v0.1.1 Checking hyper v0.11.27 (file:///tmp/hyper) Runningrustc --crate-name hyper src/lib.rs --crate-type lib --emit=dep-info,metadata -C debuginfo=2 --cfg 'feature="default"' --cfg 'feature="server-proto"' --cfg 'feature="tokio-proto"' -C metadata=465f7886ca4a40ca -C extra-filename=-465f7886ca4a40ca --out-dir /tmp/hyper/target/debug/deps -C incremental=/tmp/hyper/target/debug/incremental -L dependency=/tmp/hyper/target/debug/deps --extern base64=/tmp/hyper/target/debug/deps/libbase64-7f888070408e9584.rmeta --extern bytes=/tmp/hyper/target/debug/deps/libbytes-926f4be38b0ef49a.rmeta --extern futures=/tmp/hyper/target/debug/deps/libfutures-3e034e8c4fadab05.rmeta --extern futures_cpupool=/tmp/hyper/target/debug/deps/libfutures_cpupool-3f3a8918cddf229d.rmeta --extern httparse=/tmp/hyper/target/debug/deps/libhttparse-7fa16ff1de6399dc.rmeta --extern iovec=/tmp/hyper/target/debug/deps/libiovec-10dda303b566010f.rmeta --extern language_tags=/tmp/hyper/target/debug/deps/liblanguage_tags-fedadc717cc3771f.rmeta --extern log=/tmp/hyper/target/debug/deps/liblog-81cb68337885c10e.rmeta --extern mime=/tmp/hyper/target/debug/deps/libmime-e6896d1a95033795.rmeta --extern net2=/tmp/hyper/target/debug/deps/libnet2-ab600f3287d3dca8.rmeta --extern percent_encoding=/tmp/hyper/target/debug/deps/libpercent_encoding-0c7a64ed7c39bd90.rmeta --extern relay=/tmp/hyper/target/debug/deps/librelay-8fa98676479e7181.rmeta --extern time=/tmp/hyper/target/debug/deps/libtime-98f6d9e519834157.rmeta --extern tokio_core=/tmp/hyper/target/debug/deps/libtokio_core-825ab810c0bbc020.rmeta --extern tokio_io=/tmp/hyper/target/debug/deps/libtokio_io-25fbcf6adf05ccf3.rmeta --extern tokio_proto=/tmp/hyper/target/debug/deps/libtokio_proto-22632b982b7a70d1.rmeta --extern tokio_service=/tmp/hyper/target/debug/deps/libtokio_service-bcd12f7a5bd6b195.rmeta --extern unicase=/tmp/hyper/target/debug/deps/libunicase-8cddf57e734c9821.rmeta --extern want=/tmp/hyper/target/debug/deps/libwant-fc7ca82b1f72e647.rmeta -Zborrowck=migrate`
thread 'main' panicked at 'scrape_region_constraints: incoming region obligations = [
(
NodeId(
4242
),
RegionObligation(sub_region=ReStatic, sup_type=B)
)
]', librustc/traits/query/type_op/custom.rs:85:5
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:479
6: std::panicking::continue_panic_fmt
at libstd/panicking.rs:390
7: std::panicking::begin_panic_fmt
at libstd/panicking.rs:345
8: as rustc::traits::query::type_op::TypeOp<'gcx, 'tcx>>::fully_perform
9: rustc_mir::borrow_check::nll::type_check::type_check
10: rustc_mir::borrow_check::nll::compute_regions
11: rustc_mir::borrow_check::do_mir_borrowck
12: rustc::ty::context::tls::with_related_context
13: rustc::infer::InferCtxtBuilder::enter
14: rustc_mir::borrow_check::mir_borrowck
15: rustc::ty::query::__query_compute::mir_borrowck
16: rustc::ty::query:: for rustc::ty::query::queries::mir_borrowck<'tcx>>::compute
17: rustc::ty::context::tls::with_context
18: rustc::dep_graph::graph::DepGraph::with_task_impl
19: rustc::ty::context::tls::with_related_context
20: rustc::ty::query::plumbing::>::force_query_with_job
21: rustc::ty::query::plumbing::>::get_query
22: rustc::ty::query::>::mir_borrowck
23: rustc_mir::borrow_check::nll::type_check::TypeChecker::check_stmt
24: rustc_mir::borrow_check::nll::type_check::TypeChecker::typeck_mir
25: rustc_mir::borrow_check::nll::type_check::type_check
26: rustc_mir::borrow_check::nll::compute_regions
27: rustc_mir::borrow_check::do_mir_borrowck
28: rustc::ty::context::tls::with_related_context
29: rustc::infer::InferCtxtBuilder::enter
30: rustc_mir::borrow_check::mir_borrowck
31: rustc::ty::query::__query_compute::mir_borrowck
32: rustc::ty::query:: for rustc::ty::query::queries::mir_borrowck<'tcx>>::compute
33: rustc::ty::context::tls::with_context
34: rustc::dep_graph::graph::DepGraph::with_task_impl
35: rustc::ty::context::tls::with_related_context
36: rustc::ty::query::plumbing::>::force_query_with_job
37: rustc::ty::query::plumbing::>::get_query
38: rustc::ty::query::>::mir_borrowck
39: rustc::ty::>::par_body_owners
40: rustc::util::common::time
41: rustc::ty::context::tls::enter_context
42: >::with
43: rustc::ty::context::TyCtxt::create_and_enter
44: rustc_driver::driver::compile_input
45: rustc_driver::run_compiler_with_pool
46: >::set
47: >::set
48: syntax::with_globals
49: as core::ops::function::FnOnce<()>>::call_once
50: __rust_maybe_catch_panic
at libpanic_unwind/lib.rs:105
51: rustc_driver::run
52: rustc_driver::main
53: std::rt::lang_start::{{closure}}
54: std::panicking::try::do_call
at libstd/rt.rs:59
at libstd/panicking.rs:310
55: __rust_maybe_catch_panic
at libpanic_unwind/lib.rs:105
56: std::rt::lang_start_internal
at libstd/panicking.rs:289
at libstd/panic.rs:392
at libstd/rt.rs:58
57: main
58: __libc_start_main
59:
query stack during panic:

0 [mir_borrowck] processing <client::Client<C, B>>::send_request::{{closure}}

1 [mir_borrowck] processing <client::Client<C, B>>::send_request

end of query stack
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.29.0-nightly (97085f9fb 2018-08-01) running on x86_64-unknown-linux-gnu
note: compiler flags: -Z borrowck=migrate -C debuginfo=2 -C incremental --crate-type lib
note: some of the compiler flags provided by cargo are hidden
error: Could not compile hyper.
Caused by:
process didn't exit successfully: rustc --crate-name hyper src/lib.rs --crate-type lib --emit=dep-info,metadata -C debuginfo=2 --cfg 'feature="default"' --cfg 'feature="server-proto"' --cfg 'feature="tokio-proto"' -C metadata=465f7886ca4a40ca -C extra-filename=-465f7886ca4a40ca --out-dir /tmp/hyper/target/debug/deps -C incremental=/tmp/hyper/target/debug/incremental -L dependency=/tmp/hyper/target/debug/deps --extern base64=/tmp/hyper/target/debug/deps/libbase64-7f888070408e9584.rmeta --extern bytes=/tmp/hyper/target/debug/deps/libbytes-926f4be38b0ef49a.rmeta --extern futures=/tmp/hyper/target/debug/deps/libfutures-3e034e8c4fadab05.rmeta --extern futures_cpupool=/tmp/hyper/target/debug/deps/libfutures_cpupool-3f3a8918cddf229d.rmeta --extern httparse=/tmp/hyper/target/debug/deps/libhttparse-7fa16ff1de6399dc.rmeta --extern iovec=/tmp/hyper/target/debug/deps/libiovec-10dda303b566010f.rmeta --extern language_tags=/tmp/hyper/target/debug/deps/liblanguage_tags-fedadc717cc3771f.rmeta --extern log=/tmp/hyper/target/debug/deps/liblog-81cb68337885c10e.rmeta --extern mime=/tmp/hyper/target/debug/deps/libmime-e6896d1a95033795.rmeta --extern net2=/tmp/hyper/target/debug/deps/libnet2-ab600f3287d3dca8.rmeta --extern percent_encoding=/tmp/hyper/target/debug/deps/libpercent_encoding-0c7a64ed7c39bd90.rmeta --extern relay=/tmp/hyper/target/debug/deps/librelay-8fa98676479e7181.rmeta --extern time=/tmp/hyper/target/debug/deps/libtime-98f6d9e519834157.rmeta --extern tokio_core=/tmp/hyper/target/debug/deps/libtokio_core-825ab810c0bbc020.rmeta --extern tokio_io=/tmp/hyper/target/debug/deps/libtokio_io-25fbcf6adf05ccf3.rmeta --extern tokio_proto=/tmp/hyper/target/debug/deps/libtokio_proto-22632b982b7a70d1.rmeta --extern tokio_service=/tmp/hyper/target/debug/deps/libtokio_service-bcd12f7a5bd6b195.rmeta --extern unicase=/tmp/hyper/target/debug/deps/libunicase-8cddf57e734c9821.rmeta --extern want=/tmp/hyper/target/debug/deps/libwant-fc7ca82b1f72e647.rmeta -Zborrowck=migrate (exit code: 101)
rustc 1.29.0-nightly (97085f9fb 2018-08-01)````

A-NLL I-ICE NLL-complete P-high

Most helpful comment

I tried to reduce this some more (especially removing itertools). This is the smallest example that I could come up with that still reproduces the ICE:

#![feature(nll)]

fn main() {
    S1 {}
        .into_iter()
        .map(|_| ());
}

pub struct S1 {}

pub struct S2<'a>
{
    phantom: &'a (),
}

pub struct S3<'a, I: 'a>
    where I: Iterator,
          I::Item: 'a,
{
    it: &'a I,
}

impl<'a> IntoIterator for &'a S1
{
    type Item = S3<'a, std::iter::Empty<()>>;
    type IntoIter = S2<'a>;

    fn into_iter(self) -> Self::IntoIter {
        S2 { phantom: &() }
    }
}

impl<'a> Iterator for S2<'a>
{
    type Item = S3<'a, std::iter::Empty<()>>;

    fn next(&mut self) -> Option<Self::Item> {
        None
    }
}

playground

All 5 comments

I get (probably) the same ICE with the following code using itertools 0.7.8:

#![feature(nll)]

extern crate itertools;
use itertools::Itertools;

fn main() {
    vec![0]
        .into_iter()
        .group_by(|_| 0)
        .into_iter()
        .map(|_| 0);
}

The ICE happens on the first closure (the group_by one) with an identical backtrace and it does not crash without the map.

thread 'main' panicked at 'scrape_region_constraints: incoming region obligations = [
    (
        NodeId(
            23
        ),
        RegionObligation(sub_region='_#1r, sup_type=i32)
    )
]', librustc/traits/query/type_op/custom.rs:85:5
[鈥
note: rustc 1.30.0-nightly (3edb355b7 2018-08-03) running on x86_64-unknown-linux-gnu
note: compiler flags: -C debuginfo=2 -C incremental --crate-type bin

You beat me to the report. I ran into the same issue with group_by() and was trying to minimize the test case.

I tried to reduce this some more (especially removing itertools). This is the smallest example that I could come up with that still reproduces the ICE:

#![feature(nll)]

fn main() {
    S1 {}
        .into_iter()
        .map(|_| ());
}

pub struct S1 {}

pub struct S2<'a>
{
    phantom: &'a (),
}

pub struct S3<'a, I: 'a>
    where I: Iterator,
          I::Item: 'a,
{
    it: &'a I,
}

impl<'a> IntoIterator for &'a S1
{
    type Item = S3<'a, std::iter::Empty<()>>;
    type IntoIter = S2<'a>;

    fn into_iter(self) -> Self::IntoIter {
        S2 { phantom: &() }
    }
}

impl<'a> Iterator for S2<'a>
{
    type Item = S3<'a, std::iter::Empty<()>>;

    fn next(&mut self) -> Option<Self::Item> {
        None
    }
}

playground

And another round of minification, removing any dependency on std/core and two levels of structs. I guess it won't become much smaller:

#![feature(nll)]

fn main() {}

fn fail<'a>() -> Struct<'a, Generic<()>> {
    Struct(&Generic(()))
}

struct Struct<'a, T>(&'a T) where
    T: Trait + 'a,
    T::AT: 'a; // only fails with this bound

struct Generic<T>(T);

trait Trait {
    type AT;
}

impl<T> Trait for Generic<T> {
    type AT = T; // only fails with a generic AT
}

playground

Was this page helpful?
0 / 5 - 0 ratings