Repository: rust
Issue: ICE with Axum
Labels: I-ICE,T-compiler,C-bug,E-needs-mcve

### Code
https://github.com/VelvetThePanda/Kobalt/blob/ec48f8a07c063ecf1d68f28a3eade815ac1a393a/iridium/src/api.rs#L84-L97

### Meta
`rustc --version --verbose`:
```
rustc 1.70.0-nightly (7820b62d2 2023-03-05)
binary: rustc
commit-hash: 7820b62d20bc548096d4632a3487987308cb4b5d
commit-date: 2023-03-05
host: x86_64-pc-windows-msvc
release: 1.70.0-nightly
LLVM version: 15.0.7

```

### Error output

```
error: internal compiler error: compiler\rustc_middle\src\ty\instance.rs:397:18: failed to resolve instance for <fn(axum::extract::State<Config>, DiscordUser, axum::Json<SubmitImageResponse>) -> impl Future<Output = StatusCode> 
{create_image} as Handler<(axum_core::extract::private::ViaRequest, axum::extract::State<Config>, DiscordUser, axum::Json<SubmitImageResponse>), Config>>::with_state
```

<!--
Include a backtrace in the code block by setting `RUST_BACKTRACE=1` in your
environment. E.g. `RUST_BACKTRACE=1 cargo build`.
-->
<details><summary><strong>Backtrace</strong></summary>
<p>

```
thread 'rustc' panicked at 'Box<dyn Any>', /rustc/7820b62d20bc548096d4632a3487987308cb4b5d\compiler\rustc_errors\src\lib.rs:1644:9
stack backtrace:
   0:     0x7ffb9d746c82 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h71aa14ca5a78cea9
   1:     0x7ffb9d78548b - core::fmt::write::hd6dddebeb8f05e68
   2:     0x7ffb9d73c35a - <std::io::IoSliceMut as core::fmt::Debug>::fmt::hbe5c6512075d6072
   3:     0x7ffb9d7469cb - std::sys::common::alloc::realloc_fallback::h79f7a2bf9b29d2a9
   4:     0x7ffb9d74a329 - std::panicking::default_hook::h4c92683644ea5b5f
   5:     0x7ffb9d749fab - std::panicking::default_hook::h4c92683644ea5b5f
   6:     0x7ffb71b258cc - rustc_driver_impl[af203be264558e54]::describe_lints
   7:     0x7ffb9d74ac92 - std::panicking::rust_panic_with_hook::h33ef57ac78d86764
   8:     0x7ffb7206c1e3 - <rustc_middle[ac858212b739b5f5]::mir::GeneratorInfo as core[f7d117be605e2fd8]::fmt::Debug>::fmt
   9:     0x7ffb7206a969 - <rustc_middle[ac858212b739b5f5]::mir::GeneratorInfo as core[f7d117be605e2fd8]::fmt::Debug>::fmt
  10:     0x7ffb720f41d9 - <rustc_middle[ac858212b739b5f5]::ty::print::pretty::TraitRefPrintOnlyTraitPath as rustc_middle[ac858212b739b5f5]::ty::context::Lift>::lift_to_tcx
  11:     0x7ffb720d0749 - <rustc_middle[ac858212b739b5f5]::ty::instance::InstanceDef as rustc_middle[ac858212b739b5f5]::ty::context::Lift>::lift_to_tcx
  12:     0x7ffb720ccb20 - <rustc_middle[ac858212b739b5f5]::ty::instance::InstanceDef as rustc_middle[ac858212b739b5f5]::ty::context::Lift>::lift_to_tcx
  13:     0x7ffb720cc6a2 - <rustc_middle[ac858212b739b5f5]::ty::instance::InstanceDef as rustc_middle[ac858212b739b5f5]::ty::context::Lift>::lift_to_tcx
  14:     0x7ffb720c336a - rustc_middle[ac858212b739b5f5]::util::bug::bug_fmt
  15:     0x7ffb720c1b1d - <rustc_middle[ac858212b739b5f5]::ty::consts::kind::UnevaluatedConst as rustc_errors[5eceb53523fa45d6]::diagnostic::IntoDiagnosticArg>::into_diagnostic_arg
  16:     0x7ffb720c1ae1 - <rustc_middle[ac858212b739b5f5]::ty::consts::kind::UnevaluatedConst as rustc_errors[5eceb53523fa45d6]::diagnostic::IntoDiagnosticArg>::into_diagnostic_arg
  17:     0x7ffb720c32a8 - rustc_middle[ac858212b739b5f5]::util::bug::bug_fmt
  18:     0x7ffb720c3225 - rustc_middle[ac858212b739b5f5]::util::bug::bug_fmt
  19:     0x7ffb705f084d - <rustc_monomorphize[9ab505a90e433a29]::collector::MirNeighborCollector as rustc_middle[ac858212b739b5f5]::mir::visit::Visitor>::visit_operand
  20:     0x7ffb705e5876 - <rustc_monomorphize[9ab505a90e433a29]::collector::MirNeighborCollector as rustc_middle[ac858212b739b5f5]::mir::visit::Visitor>::visit_operand
  21:     0x7ffb705e5ca3 - <rustc_monomorphize[9ab505a90e433a29]::collector::MirNeighborCollector as rustc_middle[ac858212b739b5f5]::mir::visit::Visitor>::visit_operand
  22:     0x7ffb705e5ca3 - <rustc_monomorphize[9ab505a90e433a29]::collector::MirNeighborCollector as rustc_middle[ac858212b739b5f5]::mir::visit::Visitor>::visit_operand
  23:     0x7ffb705e5ca3 - <rustc_monomorphize[9ab505a90e433a29]::collector::MirNeighborCollector as rustc_middle[ac858212b739b5f5]::mir::visit::Visitor>::visit_operand
  24:     0x7ffb705e5ca3 - <rustc_monomorphize[9ab505a90e433a29]::collector::MirNeighborCollector as rustc_middle[ac858212b739b5f5]::mir::visit::Visitor>::visit_operand
  25:     0x7ffb705e5ca3 - <rustc_monomorphize[9ab505a90e433a29]::collector::MirNeighborCollector as rustc_middle[ac858212b739b5f5]::mir::visit::Visitor>::visit_operand
  26:     0x7ffb705e5ca3 - <rustc_monomorphize[9ab505a90e433a29]::collector::MirNeighborCollector as rustc_middle[ac858212b739b5f5]::mir::visit::Visitor>::visit_operand
  27:     0x7ffb705e5ca3 - <rustc_monomorphize[9ab505a90e433a29]::collector::MirNeighborCollector as rustc_middle[ac858212b739b5f5]::mir::visit::Visitor>::visit_operand
  28:     0x7ffb705e5ca3 - <rustc_monomorphize[9ab505a90e433a29]::collector::MirNeighborCollector as rustc_middle[ac858212b739b5f5]::mir::visit::Visitor>::visit_operand
  29:     0x7ffb705e5ca3 - <rustc_monomorphize[9ab505a90e433a29]::collector::MirNeighborCollector as rustc_middle[ac858212b739b5f5]::mir::visit::Visitor>::visit_operand
  30:     0x7ffb705e5ca3 - <rustc_monomorphize[9ab505a90e433a29]::collector::MirNeighborCollector as rustc_middle[ac858212b739b5f5]::mir::visit::Visitor>::visit_operand
  31:     0x7ffb705e5ca3 - <rustc_monomorphize[9ab505a90e433a29]::collector::MirNeighborCollector as rustc_middle[ac858212b739b5f5]::mir::visit::Visitor>::visit_operand
  32:     0x7ffb705e5ca3 - <rustc_monomorphize[9ab505a90e433a29]::collector::MirNeighborCollector as rustc_middle[ac858212b739b5f5]::mir::visit::Visitor>::visit_operand
  33:     0x7ffb705e5ca3 - <rustc_monomorphize[9ab505a90e433a29]::collector::MirNeighborCollector as rustc_middle[ac858212b739b5f5]::mir::visit::Visitor>::visit_operand
  34:     0x7ffb705e5ca3 - <rustc_monomorphize[9ab505a90e433a29]::collector::MirNeighborCollector as rustc_middle[ac858212b739b5f5]::mir::visit::Visitor>::visit_operand
  35:     0x7ffb705e5ca3 - <rustc_monomorphize[9ab505a90e433a29]::collector::MirNeighborCollector as rustc_middle[ac858212b739b5f5]::mir::visit::Visitor>::visit_operand
  36:     0x7ffb6f0ebe84 - <rustc_monomorphize[9ab505a90e433a29]::partitioning::default::DefaultPartitioning as rustc_monomorphize[9ab505a90e433a29]::partitioning::Partitioner>::place_inlined_mono_items
  37:     0x7ffb6f0ed55e - <rustc_monomorphize[9ab505a90e433a29]::partitioning::default::DefaultPartitioning as rustc_monomorphize[9ab505a90e433a29]::partitioning::Partitioner>::place_inlined_mono_items
  38:     0x7ffb6f0e7791 - <rustc_mir_transform[bc774b75d18db22b]::elaborate_drops::Elaborator as rustc_mir_dataflow[8b599228352e354b]::elaborate_drops::DropElaborator>::get_drop_flag
  39:     0x7ffb6f0ef95c - rustc_monomorphize[9ab505a90e433a29]::provide
  40:     0x7ffb6f24fc1f - rustc_privacy[797d4763e5e864d1]::provide
  41:     0x7ffb6f2bd9d5 - <rustc_query_impl[f1faa5ca787a8303]::Queries as rustc_middle[ac858212b739b5f5]::ty::query::QueryEngine>::try_mark_green
  42:     0x7ffb6ecb12e2 - <rustc_codegen_llvm[801c810974492b7f]::ModuleLlvm as core[f7d117be605e2fd8]::ops::drop::Drop>::drop
  43:     0x7ffb6ecadb6b - <rustc_codegen_llvm[801c810974492b7f]::LlvmCodegenBackend as rustc_codegen_ssa[c53e3e9fe0f57c8d]::traits::backend::CodegenBackend>::codegen_crate
  44:     0x7ffb6ef562fb - rustc_interface[bff7d1d3f9751698]::passes::start_codegen
  45:     0x7ffb6ef4fb52 - rustc_interface[bff7d1d3f9751698]::passes::start_codegen
  46:     0x7ffb6ef52c4a - rustc_interface[bff7d1d3f9751698]::passes::start_codegen
  47:     0x7ffb6ef7db67 - <rustc_interface[bff7d1d3f9751698]::queries::Queries>::ongoing_codegen
  48:     0x7ffb6ed93859 - rustc_driver_impl[af203be264558e54]::main
  49:     0x7ffb6edada1c - rustc_driver_impl[af203be264558e54]::args::arg_expand_all
  50:     0x7ffb6ed8213a - rustc_driver_impl[af203be264558e54]::main
  51:     0x7ffb6ed807bd - rustc_driver_impl[af203be264558e54]::main
  52:     0x7ffb9d75cadc - std::sys::windows::thread::Thread::new::h62b556989e817ecc
  53:     0x7ffbf7197614 - BaseThreadInitThunk
  54:     0x7ffbf75e26a1 - RtlUserThreadStart

```

</p>
</details>


This was initially filed under the Axum repo as that's what I suspected was the issue (and still believe to be), [here](https://github.com/tokio-rs/axum/issues/1823), as per the recommendation of a friend, but given that it's a *compiler* error, I was pointed back here. I'd love to have an mCVE for this issue, but the closest I've gotten is tracking it down to something to do with Axum's `top_level_handler_fn!` macro.

<!-- TRIAGEBOT_START -->

<!-- TRIAGEBOT_ASSIGN_START -->

<!-- TRIAGEBOT_ASSIGN_DATA_START$${"user":"LYF1999"}$$TRIAGEBOT_ASSIGN_DATA_END -->

<!-- TRIAGEBOT_ASSIGN_END -->
<!-- TRIAGEBOT_END -->