Skip to content

Stable ICE: &mut request::Request<'mw, B, D> was a subtype of &mut request::Request<'_, _, _> but now is not? #45855

Closed

Description

@jolhoeft

I've triggered an ICE with rust 1.21.0. There seem to be a few similar reports, but they are either Beta, or fairly old. I triggered this as part of migrating nickel to hyper 0.11. I committed the code that triggers this on my fork of nickel on branch async_402. See jolhoeft/nickel.rs@d0ccf03 (in file https://github.com/jolhoeft/nickel.rs/blob/d0ccf03e57a9d37307e15f5947d6cc69b32a9031/src/body_parser.rs)

(this branch still needs a lot of work, so normal compile errors are expected)

error: internal compiler error: /checkout/src/librustc_typeck/check/method/confirm.rs:345: &mut request::Request<'mw, B, D> was a subtype of &mut request::Request<'_, _, _> but now is not?
  --> src/body_parser.rs:81:14
   |
81 |         self.get_ref::<FormBodyParser>().map_err(|e| (StatusCode::BadRequest, e))
   |              ^^^^^^^

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.21.0 (3b72af97e 2017-10-09) running on x86_64-unknown-linux-gnu

note: run with `RUST_BACKTRACE=1` for a backtrace

thread 'rustc' panicked at 'Box<Any>', /checkout/src/librustc_errors/lib.rs:437:8
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
             at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::_print
             at /checkout/src/libstd/sys_common/backtrace.rs:71
   2: std::panicking::default_hook::{{closure}}
             at /checkout/src/libstd/sys_common/backtrace.rs:60
             at /checkout/src/libstd/panicking.rs:381
   3: std::panicking::default_hook
             at /checkout/src/libstd/panicking.rs:391
   4: std::panicking::rust_panic_with_hook
             at /checkout/src/libstd/panicking.rs:611
   5: std::panicking::begin_panic
   6: rustc_errors::Handler::span_bug
   7: rustc::session::opt_span_bug_fmt::{{closure}}
   8: rustc::session::span_bug_fmt
   9: rustc_typeck::check::FnCtxt::check_method_call
  10: rustc_typeck::check::FnCtxt::check_expr_kind
  11: rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_lvalue_pref
  12: rustc_typeck::check::FnCtxt::check_method_call
  13: rustc_typeck::check::FnCtxt::check_expr_kind
  14: rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_lvalue_pref
  15: rustc_typeck::check::FnCtxt::check_block_with_expected::{{closure}}
  16: rustc_typeck::check::FnCtxt::check_block_with_expected
  17: rustc_typeck::check::FnCtxt::check_expr_kind
  18: rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_lvalue_pref
  19: rustc_typeck::check::FnCtxt::check_return_expr
  20: rustc_typeck::check::check_fn
  21: rustc_typeck::check::typeck_tables_of::{{closure}}
  22: rustc_typeck::check::typeck_tables_of
  23: rustc::dep_graph::graph::DepGraph::with_task
  24: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_tables_of<'tcx>>::try_get
  25: rustc::ty::maps::TyCtxtAt::typeck_tables_of
  26: rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::typeck_tables_of
  27: rustc_typeck::check::typeck_item_bodies
  28: rustc::dep_graph::graph::DepGraph::with_task
  29: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_item_bodies<'tcx>>::try_get
  30: rustc::ty::maps::TyCtxtAt::typeck_item_bodies
  31: rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::typeck_item_bodies
  32: rustc_typeck::check_crate
  33: rustc::ty::context::TyCtxt::create_and_enter
  34: rustc_driver::driver::compile_input
  35: rustc_driver::run_compiler

Activity

  1. jolhoeft commented on Nov 8, 2017

    @jolhoeft
    Author

    The following change got rid of the ICE for me:

    index 7e15671..90c3622 100644
    --- a/src/body_parser.rs
    +++ b/src/body_parser.rs
    @@ -76,7 +76,7 @@ pub trait FormBody {
     }
     
     #[deprecated(since = "0.11.0", note="Synchronizes async code with performance impact, will be removed in 0.12")]
    -impl<'mw, B: Stream<Item=Chunk, Error=HyperError>, D> FormBody for Request<'mw, B, D> {
    +impl<'mw, D> FormBody for Request<'mw, Body, D> {
         fn form_body(&mut self) -> Result<&Params, (StatusCode, BodyError)> {
             self.get_ref::<FormBodyParser>().map_err(|e| (StatusCode::BadRequest, e))
         }
    @@ -88,7 +88,7 @@ pub trait JsonBody {
     }
     
     #[deprecated(since = "0.11.0", note="Synchronizes async code with performance impact, will be removed in 0.12")]
    -impl<'mw, B: Stream<Item=Chunk, Error=HyperError>, D> JsonBody for Request<'mw, B, D> {
    +impl<'mw, D> JsonBody for Request<'mw, Body, D> {
         // FIXME: Update the error type.
         // Would be good to capture parsing error rather than a generic io::Error.
         // FIXME: Do the content-type check
    
  2. added
    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
    on Nov 8, 2017
  3. kennytm commented on Nov 8, 2017

    @kennytm
    Member

    Looks like a duplicate of #36701.

  4. added a commit that references this issue on Nov 13, 2017
    8efbf7a
  5. added a commit that references this issue on Nov 14, 2017
    b23c76e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions