about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSantiago Pastorino <spastorino@gmail.com>2023-03-08 17:57:54 -0300
committerSantiago Pastorino <spastorino@gmail.com>2023-03-14 10:16:19 -0300
commitb535da6841c8dec255a1734b9ac1ed9e9e7c5e25 (patch)
tree87343fc675b131343e6c3487df555bad3dd927a8
parent0058748944abb3282aba0e0a74823c6411703565 (diff)
downloadrust-b535da6841c8dec255a1734b9ac1ed9e9e7c5e25.tar.gz
rust-b535da6841c8dec255a1734b9ac1ed9e9e7c5e25.zip
Get impl defaultness using query
-rw-r--r--compiler/rustc_metadata/src/rmeta/encoder.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/rustc_metadata/src/rmeta/encoder.rs b/compiler/rustc_metadata/src/rmeta/encoder.rs
index bbab8a62a2b..59e2e57e6c2 100644
--- a/compiler/rustc_metadata/src/rmeta/encoder.rs
+++ b/compiler/rustc_metadata/src/rmeta/encoder.rs
@@ -1356,13 +1356,14 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
         debug!("EncodeContext::encode_info_for_impl_item({:?})", def_id);
         let tcx = self.tcx;
 
-        let ast_item = self.tcx.hir().expect_impl_item(def_id.expect_local());
-        self.tables.impl_defaultness.set_some(def_id.index, ast_item.defaultness);
+        let defaultness = self.tcx.impl_defaultness(def_id.expect_local());
+        self.tables.impl_defaultness.set_some(def_id.index, defaultness);
         let impl_item = self.tcx.associated_item(def_id);
         self.tables.assoc_container.set_some(def_id.index, impl_item.container);
 
         match impl_item.kind {
             ty::AssocKind::Fn => {
+                let ast_item = self.tcx.hir().expect_impl_item(def_id.expect_local());
                 let hir::ImplItemKind::Fn(ref sig, body) = ast_item.kind else { bug!() };
                 self.tables.asyncness.set_some(def_id.index, sig.header.asyncness);
                 record_array!(self.tables.fn_arg_names[def_id] <- self.tcx.hir().body_param_names(body));