mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
Directly encode IsAsync in metadata.
This commit is contained in:
parent
42820daf91
commit
2129866dc0
@ -1207,7 +1207,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
|
||||
record!(self.tables.fn_arg_names[def_id] <- self.tcx.hir().body_param_names(body))
|
||||
}
|
||||
};
|
||||
record!(self.tables.asyncness[def_id] <- m_sig.header.asyncness);
|
||||
self.tables.asyncness.set(def_id.index, m_sig.header.asyncness);
|
||||
self.tables.impl_constness.set(def_id.index, hir::Constness::NotConst);
|
||||
record!(self.tables.kind[def_id] <- EntryKind::AssocFn(self.lazy(AssocFnData {
|
||||
container,
|
||||
@ -1265,7 +1265,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
|
||||
}
|
||||
ty::AssocKind::Fn => {
|
||||
let hir::ImplItemKind::Fn(ref sig, body) = ast_item.kind else { bug!() };
|
||||
record!(self.tables.asyncness[def_id] <- sig.header.asyncness);
|
||||
self.tables.asyncness.set(def_id.index, sig.header.asyncness);
|
||||
record!(self.tables.fn_arg_names[def_id] <- self.tcx.hir().body_param_names(body));
|
||||
// Can be inside `impl const Trait`, so using sig.header.constness is not reliable
|
||||
let constness = if self.tcx.is_const_fn_raw(def_id) {
|
||||
@ -1394,7 +1394,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
|
||||
EntryKind::Const
|
||||
}
|
||||
hir::ItemKind::Fn(ref sig, .., body) => {
|
||||
record!(self.tables.asyncness[def_id] <- sig.header.asyncness);
|
||||
self.tables.asyncness.set(def_id.index, sig.header.asyncness);
|
||||
record!(self.tables.fn_arg_names[def_id] <- self.tcx.hir().body_param_names(body));
|
||||
self.tables.impl_constness.set(def_id.index, sig.header.constness);
|
||||
EntryKind::Fn
|
||||
@ -1886,7 +1886,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
|
||||
|
||||
match nitem.kind {
|
||||
hir::ForeignItemKind::Fn(_, ref names, _) => {
|
||||
record!(self.tables.asyncness[def_id] <- hir::IsAsync::NotAsync);
|
||||
self.tables.asyncness.set(def_id.index, hir::IsAsync::NotAsync);
|
||||
record!(self.tables.fn_arg_names[def_id] <- *names);
|
||||
let constness = if self.tcx.is_const_fn_raw(def_id) {
|
||||
hir::Constness::Const
|
||||
|
@ -317,7 +317,7 @@ define_tables! {
|
||||
coerce_unsized_info: Table<DefIndex, Lazy!(ty::adjustment::CoerceUnsizedInfo)>,
|
||||
mir_const_qualif: Table<DefIndex, Lazy!(mir::ConstQualifs)>,
|
||||
rendered_const: Table<DefIndex, Lazy!(String)>,
|
||||
asyncness: Table<DefIndex, Lazy!(hir::IsAsync)>,
|
||||
asyncness: Table<DefIndex, hir::IsAsync>,
|
||||
fn_arg_names: Table<DefIndex, Lazy!([Ident])>,
|
||||
generator_kind: Table<DefIndex, Lazy!(hir::GeneratorKind)>,
|
||||
trait_def: Table<DefIndex, Lazy!(ty::TraitDef)>,
|
||||
|
@ -128,6 +128,13 @@ fixed_size_enum! {
|
||||
}
|
||||
}
|
||||
|
||||
fixed_size_enum! {
|
||||
hir::IsAsync {
|
||||
( NotAsync )
|
||||
( Async )
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE(eddyb) there could be an impl for `usize`, which would enable a more
|
||||
// generic `Lazy<T>` impl, but in the general case we might not need / want to
|
||||
// fit every `usize` in `u32`.
|
||||
|
Loading…
Reference in New Issue
Block a user