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

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

Closed
jolhoeft opened this issue Nov 8, 2017 · 2 comments
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@jolhoeft
Copy link

jolhoeft commented Nov 8, 2017

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
@jolhoeft
Copy link
Author

jolhoeft commented Nov 8, 2017

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

@sfackler sfackler added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Nov 8, 2017
@kennytm
Copy link
Member

kennytm commented Nov 8, 2017

Looks like a duplicate of #36701.

arielb1 added a commit to arielb1/rust that referenced this issue Nov 9, 2017
Normalizing method signatures can unify inference variables, which can
cause receiver unification to fail. Unify the receivers first to avoid
that.

Fixes rust-lang#36701.
Fixes rust-lang#45801.
Fixes rust-lang#45855.
bors added a commit that referenced this issue Nov 13, 2017
check::method - unify receivers before normalizing method signatures

Normalizing method signatures can unify inference variables, which can
cause receiver unification to fail. Unify the receivers first to avoid
that.

Fixes #36701.
Fixes #45801.
Fixes #45855.

r? @eddyb

beta-nominating because #43880 made this ICE happen in more cases (the code in that issue ICEs post-#43880 only, but the unit test here ICEs on all versions).
arielb1 pushed a commit to arielb1/rust that referenced this issue Nov 14, 2017
check::method - unify receivers before normalizing method signatures

Normalizing method signatures can unify inference variables, which can
cause receiver unification to fail. Unify the receivers first to avoid
that.

Fixes rust-lang#36701.
Fixes rust-lang#45801.
Fixes rust-lang#45855.

r? @eddyb

beta-nominating because rust-lang#43880 made this ICE happen in more cases (the code in that issue ICEs post-rust-lang#43880 only, but the unit test here ICEs on all versions).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

3 participants