Skip to content
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

ICE on stable / nightly: ReEmpty #55608

Closed
dbrgn opened this issue Nov 2, 2018 · 8 comments
Closed

ICE on stable / nightly: ReEmpty #55608

dbrgn opened this issue Nov 2, 2018 · 8 comments
Assignees
Labels
A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. 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.

Comments

@dbrgn
Copy link
Contributor

dbrgn commented Nov 2, 2018

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.
@pnkfelix pnkfelix self-assigned this Nov 2, 2018
@pnkfelix pnkfelix added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. regression-from-stable-to-stable Performance or correctness regression from one stable version to another. and removed regression-from-stable-to-stable Performance or correctness regression from one stable version to another. labels Nov 2, 2018
@pnkfelix
Copy link
Member

pnkfelix commented 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
Copy link
Member

pnkfelix commented 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
Copy link
Member

pnkfelix commented 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
Copy link
Member

pnkfelix commented Nov 2, 2018

Reduced to the following:

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(); }

@pnkfelix
Copy link
Member

pnkfelix commented 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 pnkfelix added A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ labels Nov 2, 2018
@pnkfelix
Copy link
Member

pnkfelix commented Nov 2, 2018

Okay, so after adding #![feature(conservative_impl_trait)] to the file, we can bisect over rustc 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:

  • code accepted without ICE: rustc 1.26.0-nightly (75af15e 2018-03-20)
  • compiler ICE's: rustc 1.26.0-nightly (c08480f 2018-03-23)
% cat ../issue-55608.rs
#![feature(conservative_impl_trait)]

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(); }
% rustup default nightly-2018-03-21-x86_64-unknown-linux-gnu
info: using existing install for 'nightly-2018-03-21-x86_64-unknown-linux-gnu'
info: default toolchain set to 'nightly-2018-03-21-x86_64-unknown-linux-gnu'

  nightly-2018-03-21-x86_64-unknown-linux-gnu unchanged - rustc 1.26.0-nightly (75af15ee6 2018-03-20)

% rustc ../issue-55608.rs
% rustup default nightly-2018-03-22-x86_64-unknown-linux-gnu
info: syncing channel updates for 'nightly-2018-03-22-x86_64-unknown-linux-gnu'
error: no release found for 'nightly-2018-03-22'
% rustup default nightly-2018-03-23-x86_64-unknown-linux-gnu
info: syncing channel updates for 'nightly-2018-03-23-x86_64-unknown-linux-gnu'
error: no release found for 'nightly-2018-03-23'
% rustup default nightly-2018-03-24-x86_64-unknown-linux-gnu
info: using existing install for 'nightly-2018-03-24-x86_64-unknown-linux-gnu'
info: default toolchain set to 'nightly-2018-03-24-x86_64-unknown-linux-gnu'

  nightly-2018-03-24-x86_64-unknown-linux-gnu unchanged - rustc 1.26.0-nightly (c08480fce 2018-03-23)

% rustc ../issue-55608.rs
error: internal compiler error: librustc/infer/error_reporting/mod.rs:184: impossible case reached

thread 'rustc' panicked at 'Box<Any>', librustc_errors/lib.rs:543:9
note: Run with `RUST_BACKTRACE=1` for a backtrace.

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.26.0-nightly (c08480fce 2018-03-23) running on x86_64-unknown-linux-gnu
%

@pnkfelix
Copy link
Member

pnkfelix commented Nov 3, 2018

After fixing the root cause of the ICE (fn msg_span_from_free_region) to describe ReEmpty as "an empty region", I get this on the reduced test case:

error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
 --> issue-55608.rs:3:16
  |
3 | fn server() -> impl FilterBase2 {
  |                ^^^^^^^^^^^^^^^^
  |
  = note: hidden type `Map2<[closure@issue-55608.rs:4:36: 4:41]>` captures an empty lifetime

error: aborting due to previous error

kennytm added a commit to kennytm/rust that referenced this issue Nov 8, 2018
…g_span_from_free_region, r=estebank

Fix ICE in msg_span_from_free_region on ReEmpty

On an example like this:

```rust
#![feature(conservative_impl_trait)]

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 { }
}
```

we now, instead of ICE'ing, get a diagnostic like:

```
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
 --> issue-55608.rs:3:16
  |
3 | fn server() -> impl FilterBase2 {
  |                ^^^^^^^^^^^^^^^^
  |
  = note: hidden type `Map2<[closure@issue-55608.rs:4:36: 4:41]>` captures an empty lifetime
```

Fix rust-lang#55608
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this issue Nov 9, 2018
…g_span_from_free_region, r=estebank

Fix ICE in msg_span_from_free_region on ReEmpty

On an example like this:

```rust
#![feature(conservative_impl_trait)]

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 { }
}
```

we now, instead of ICE'ing, get a diagnostic like:

```
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
 --> issue-55608.rs:3:16
  |
3 | fn server() -> impl FilterBase2 {
  |                ^^^^^^^^^^^^^^^^
  |
  = note: hidden type `Map2<[closure@issue-55608.rs:4:36: 4:41]>` captures an empty lifetime
```

Fix rust-lang#55608
@dbrgn
Copy link
Contributor Author

dbrgn commented Nov 9, 2018

Thanks @pnkfelix!

nikomatsakis added a commit to nikomatsakis/rust that referenced this issue Nov 19, 2018
Summary:

- A few tests that used to compile, but which were highly
  questionable, now fail to compile. These are tests that also fail
  under NLL -- they have to do with closures that are returning
  invalid values (e.g., other closures that contain values that would
  be out of scope if used), but our regionck rules permitted them for
  some reason.
- One test for rust-lang#55608 now compiles successfully -- looking at it, I
  can't I see any reason that it should *not* compile.
- Some errors messages changed in small ways, in some cases improving
  quite a bit, but often just "different".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. 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.
Projects
None yet
Development

No branches or pull requests

2 participants