Skip to content

src\librustc_mir\transform\generator.rs:739:13: Broken MIR: generator contains type &rocket::http::Cookie in MIR, but typeck only knows about for... #74961

Closed
@Weasy666

Description

Code

Minimal verifiable example can be found here: https://github.com/Weasy666/rustc-bug
Just clone and cargo run.

Meta

rustc --version --verbose:

rustc 1.47.0-nightly (6c8927b0c 2020-07-26)
binary: rustc
commit-hash: 6c8927b0cf80ceee19386026cf9d7fd4fd9d486f
commit-date: 2020-07-26
host: x86_64-pc-windows-msvc
release: 1.47.0-nightly
LLVM version: 10.0

Error output

error: internal compiler error: src\librustc_mir\transform\generator.rs:739:13: Broken MIR: generator contains type &rocket::http::Cookie in MIR, but typeck only knows about for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5, 't6> {std::future::ResumeTy, &'r rocket::Request<'s>, rocket::http::Cookies<'t0>, &'t1 mut rocket::http::Cookies<'t2>, &'t3 str, std::option::Option<rocket::http::Cookie<'t4>>, rocket::http::Cookie<'t5>, std::pin::Pin<std::boxed::Box<(dyn std::future::Future<Output = rocket::outcome::Outcome<rocket_airlock::Airlock<hatch::SimpleHatch>, (rocket::http::Status, ()), ()>> + std::marker::Send + 't6)>>, ()}
  --> src\user.rs:16:83
   |
16 |       async fn from_request(request: &'a Request<'r>) -> Outcome<Self, Self::Error> {
   |  ___________________________________________________________________________________^
17 | |         let mut cookies = request.cookies();
18 | |         match cookies.get_private("logged_in") {
19 | |             Some(logged_in) if request.guard::<Airlock<hatch::SimpleHatch>>().await.expect("Hatch 'SimpleHatch' was not installed into th...
...  |
25 | |         }
26 | |     }
   | |_____^

thread 'rustc' panicked at 'Box<Any>', /rustc/6c8927b0cf80ceee19386026cf9d7fd4fd9d486f\src\libstd\macros.rs:13:23
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md


note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type bin

note: some of the compiler flags provided by cargo are hidden
Backtrace

stack backtrace:
   0: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
   1: core::fmt::write
   2: <std::io::IoSliceMut as core::fmt::Debug>::fmt
   3: std::panicking::take_hook
   4: std::panicking::take_hook
   5: rustc_driver::report_ice
   6: std::panicking::rust_panic_with_hook
   7: rustc_mir_build::provide
   8: <rustc_mir::borrow_check::InitializationRequiringAction as core::fmt::Debug>::fmt
   9: <rustc_mir::borrow_check::InitializationRequiringAction as core::fmt::Debug>::fmt
  10: <rustc_mir::borrow_check::InitializationRequiringAction as core::fmt::Debug>::fmt
  11: <rustc_mir::borrow_check::InitializationRequiringAction as core::fmt::Debug>::fmt
  12: <rustc_mir::borrow_check::InitializationRequiringAction as core::fmt::Debug>::fmt
  13: <rustc_mir::borrow_check::InitializationRequiringAction as core::fmt::Debug>::fmt
  14: <rustc_mir::borrow_check::InitializationRequiringAction as core::fmt::Debug>::fmt
  15: <rustc_mir::transform::generator::StateTransform as rustc_mir::transform::MirPass>::run_pass
  16: rustc_mir::transform::run_passes
  17: rustc_mir::transform::run_passes
  18: rustc_mir::transform::run_passes
  19: rustc_mir::transform::run_passes
  20: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::debug_node
  21: <rustc_middle::ty::consts::kind::InferConst as core::fmt::Debug>::fmt
  22: <rustc_middle::ty::subst::UserSubsts as core::fmt::Debug>::fmt
  23: rustc_middle::ty::structural_impls::<impl rustc_middle::ty::context::Lift for rustc_middle::ty::TraitPredicate>::lift_to_tcx
  24: rustc_middle::ty::layout::provide
  25: <rustc_middle::ty::layout::LayoutError as core::fmt::Display>::fmt
  26: <rustc_middle::ty::query::Query as rustc_data_structures::stable_hasher::HashStable<rustc_middle::ich::hcx::StableHashingContext>>::hash_stable
  27: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::debug_node
  28: <rustc_middle::ty::consts::kind::InferConst as core::fmt::Debug>::fmt
  29: <rustc_middle::ty::subst::UserSubsts as core::fmt::Debug>::fmt
  30: rustc_middle::ty::structural_impls::<impl rustc_middle::ty::context::Lift for rustc_middle::ty::TraitPredicate>::lift_to_tcx
  31: <rustc_middle::ty::layout::LayoutCx<rustc_middle::ty::context::TyCtxt> as rustc_target::abi::LayoutOf>::layout_of
  32: <rustc_middle::ty::relate::GeneratorWitness as core::fmt::Debug>::fmt
  33: ZN238_$LT$rustc_infer..infer..undo_log..UndoLog$u20$as$u20$core..convert..From$LT$rustc_data_structures..snapshot_map..UndoLog$LT$rustc_infer..traits..project..ProjectionCacheKey$C$rustc_infer..traits..project..ProjectionCacheEntry$GT$$GT$$GT$4from17h3714
  34: <rustc_middle::ty::relate::GeneratorWitness as core::fmt::Debug>::fmt
  35: ZN238_$LT$rustc_infer..infer..undo_log..UndoLog$u20$as$u20$core..convert..From$LT$rustc_data_structures..snapshot_map..UndoLog$LT$rustc_infer..traits..project..ProjectionCacheKey$C$rustc_infer..traits..project..ProjectionCacheEntry$GT$$GT$$GT$4from17h3714
  36: rustc_middle::ty::layout::provide
  37: <rustc_middle::ty::layout::LayoutError as core::fmt::Display>::fmt
  38: <rustc_middle::ty::query::Query as rustc_data_structures::stable_hasher::HashStable<rustc_middle::ich::hcx::StableHashingContext>>::hash_stable
  39: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::debug_node
  40: <rustc_middle::ty::consts::kind::InferConst as core::fmt::Debug>::fmt
  41: <rustc_middle::ty::subst::UserSubsts as core::fmt::Debug>::fmt
  42: rustc_middle::ty::structural_impls::<impl rustc_middle::ty::context::Lift for rustc_middle::ty::TraitPredicate>::lift_to_tcx
  43: <rustc_middle::ty::layout::LayoutCx<rustc_middle::ty::query::TyCtxtAt> as rustc_target::abi::LayoutOf>::layout_of
  44: <rustc_mir::transform::const_prop::ConstProp as rustc_mir::transform::MirPass>::run_pass
  45: rustc_mir::transform::run_passes
  46: rustc_mir::transform::run_passes
  47: rustc_mir::transform::run_passes
  48: rustc_mir::transform::run_passes
  49: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::debug_node
  50: <rustc_middle::ty::consts::kind::InferConst as core::fmt::Debug>::fmt
  51: <rustc_middle::ty::subst::UserSubsts as core::fmt::Debug>::fmt
  52: rustc_middle::ty::structural_impls::<impl rustc_middle::ty::context::Lift for rustc_middle::ty::TraitPredicate>::lift_to_tcx
  53: rustc_middle::ty::<impl rustc_middle::ty::context::TyCtxt>::instance_mir
  54: <rustc_mir::monomorphize::collector::RootCollector as rustc_hir::itemlikevisit::ItemLikeVisitor>::visit_impl_item
  55: rustc_mir::monomorphize::collector::collect_crate_mono_items
  56: rustc_mir::monomorphize::collector::collect_crate_mono_items
  57: rustc_mir::monomorphize::collector::collect_crate_mono_items
  58: rustc_mir::monomorphize::collector::collect_crate_mono_items
  59: rustc_mir::monomorphize::collector::collect_crate_mono_items
  60: rustc_mir::monomorphize::collector::collect_crate_mono_items
  61: <rustc_mir::interpret::machine::StackPopJump as core::fmt::Debug>::fmt
  62: rustc_mir::monomorphize::collector::collect_crate_mono_items
  63: rustc_mir::monomorphize::partitioning::compute_codegen_unit_name
  64: <rustc_target::abi::TyAndLayout<&rustc_middle::ty::TyS> as rustc_codegen_llvm::type_of::LayoutLlvmExt>::pointee_info_at
  65: rustc_codegen_llvm::llvm_::archive_ro::Child::data
  66: <rustc_codegen_llvm::llvm_::ffi::debuginfo::DISPFlags as core::fmt::Debug>::fmt
  67: <rustc_codegen_llvm::debuginfo::metadata::MemberDescription as core::fmt::Debug>::fmt
  68: <rustc_codegen_llvm::llvm_::ffi::debuginfo::DISPFlags as core::fmt::Debug>::fmt
  69: <rustc_target::abi::TyAndLayout<&rustc_middle::ty::TyS> as rustc_codegen_llvm::type_of::LayoutLlvmExt>::pointee_info_at
  70: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
  71: rustc_interface::passes::QueryContext::print_stats
  72: rustc_interface::passes::BoxedResolver::complete
  73: rustc_interface::queries::Queries::ongoing_codegen
  74: <rustc_lint::BuiltinCombinedModuleLateLintPass as rustc_lint::passes::LateLintPass>::check_trait_item_post
  75: <env_logger::filter::inner::Filter as core::fmt::Display>::fmt
  76: <rustc_driver::DEFAULT_HOOK as core::ops::deref::Deref>::deref
  77: <rustc_driver::DEFAULT_HOOK as core::ops::deref::Deref>::deref
  78: <rustc_mir::shim::DropShimElaborator as rustc_mir::util::elaborate_drops::DropElaborator>::array_subpath
  79: std::sys::windows::thread::Thread::new
  80: BaseThreadInitThunk
  81: RtlUserThreadStart
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.47.0-nightly (6c8927b0c 2020-07-26) running on x86_64-pc-windows-msvc

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type bin

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [optimized_mir] optimizing MIR for `<user::User as rocket::request::FromRequest<'a, 'r>>::from_request::__from_request::{{closure}}#0`
#1 [layout_raw] computing layout of `[static generator@src\user.rs:16:83: 26:6 request:&rocket::Request for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5, 't6> {std::future::ResumeTy, &'r rocket::Request<'s>, rocket::http::Cookies<'t0>, &'t1 mut rocket::http::Cookies<'t2>, &'t3 str, std::option::Option<rocket::http::Cookie<'t4>>, rocket::http::Cookie<'t5>, std::pin::Pin<std::boxed::Box<(dyn std::future::Future<Output = rocket::outcome::Outcome<rocket_airlock::Airlock<hatch::SimpleHatch>, (rocket::http::Status, ()), ()>> + std::marker::Send + 't6)>>, ()}]`
#2 [layout_raw] computing layout of `std::future::from_generator::GenFuture<[static generator@src\user.rs:16:83: 26:6 request:&rocket::Request for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5, 't6> {std::future::ResumeTy, &'r rocket::Request<'s>, rocket::http::Cookies<'t0>, &'t1 mut rocket::http::Cookies<'t2>, &'t3 str, std::option::Option<rocket::http::Cookie<'t4>>, rocket::http::Cookie<'t5>, std::pin::Pin<std::boxed::Box<(dyn std::future::Future<Output = rocket::outcome::Outcome<rocket_airlock::Airlock<hatch::SimpleHatch>, (rocket::http::Status, ()), ()>> + std::marker::Send + 't6)>>, ()}]>`
#3 [optimized_mir] optimizing MIR for `<user::User as rocket::request::FromRequest<'a, 'r>>::from_request::__from_request`
#4 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    A-async-awaitArea: Async & AwaitA-coroutinesArea: CoroutinesC-bugCategory: This is a bug.E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions