in sdk/typespec/typespec_macros/src/safe_debug.rs [128:150]
fn finish(
remaining: &[TokenStream],
all: &Punctuated<Field, Comma>,
tuple: bool,
) -> (TokenStream, TokenStream) {
const MSRV: rustc_version::Version = rustc_version::Version::new(1, 80, 0);
const MIN: rustc_version::Version = rustc_version::Version::new(1, 82, 0);
// DebugTuple::finish_non_exhaustive() wasn't added till 1.82.
let non_exhaustive_finisher = if tuple && rustc_version::version().unwrap_or(MSRV) < MIN {
quote! {.finish()}
} else {
quote! {.finish_non_exhaustive()}
};
if remaining.len() == all.len() {
(TokenStream::new(), quote! {.finish()})
} else if !remaining.is_empty() {
(quote! {, ..}, non_exhaustive_finisher)
} else {
(quote! {..}, non_exhaustive_finisher)
}
}