Skip to content

Commit

Permalink
Streamline coroutine_kind_label.
Browse files Browse the repository at this point in the history
  • Loading branch information
nnethercote committed Sep 17, 2024
1 parent a5245c3 commit f32d5c9
Showing 1 changed file with 13 additions and 26 deletions.
39 changes: 13 additions & 26 deletions compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs
Original file line number Diff line number Diff line change
Expand Up @@ -576,33 +576,20 @@ pub fn push_item_name(tcx: TyCtxt<'_>, def_id: DefId, qualified: bool, output: &
}

fn coroutine_kind_label(coroutine_kind: Option<CoroutineKind>) -> &'static str {
use CoroutineDesugaring::*;
use CoroutineKind::*;
use CoroutineSource::*;
match coroutine_kind {
Some(CoroutineKind::Desugared(CoroutineDesugaring::Gen, CoroutineSource::Block)) => {
"gen_block"
}
Some(CoroutineKind::Desugared(CoroutineDesugaring::Gen, CoroutineSource::Closure)) => {
"gen_closure"
}
Some(CoroutineKind::Desugared(CoroutineDesugaring::Gen, CoroutineSource::Fn)) => "gen_fn",
Some(CoroutineKind::Desugared(CoroutineDesugaring::Async, CoroutineSource::Block)) => {
"async_block"
}
Some(CoroutineKind::Desugared(CoroutineDesugaring::Async, CoroutineSource::Closure)) => {
"async_closure"
}
Some(CoroutineKind::Desugared(CoroutineDesugaring::Async, CoroutineSource::Fn)) => {
"async_fn"
}
Some(CoroutineKind::Desugared(CoroutineDesugaring::AsyncGen, CoroutineSource::Block)) => {
"async_gen_block"
}
Some(CoroutineKind::Desugared(CoroutineDesugaring::AsyncGen, CoroutineSource::Closure)) => {
"async_gen_closure"
}
Some(CoroutineKind::Desugared(CoroutineDesugaring::AsyncGen, CoroutineSource::Fn)) => {
"async_gen_fn"
}
Some(CoroutineKind::Coroutine(_)) => "coroutine",
Some(Desugared(Gen, Block)) => "gen_block",
Some(Desugared(Gen, Closure)) => "gen_closure",
Some(Desugared(Gen, Fn)) => "gen_fn",
Some(Desugared(Async, Block)) => "async_block",
Some(Desugared(Async, Closure)) => "async_closure",
Some(Desugared(Async, Fn)) => "async_fn",
Some(Desugared(AsyncGen, Block)) => "async_gen_block",
Some(Desugared(AsyncGen, Closure)) => "async_gen_closure",
Some(Desugared(AsyncGen, Fn)) => "async_gen_fn",
Some(Coroutine(_)) => "coroutine",
None => "closure",
}
}
Expand Down

0 comments on commit f32d5c9

Please sign in to comment.