Skip to content

Commit

Permalink
Clean up IsolatedEncoder::encode_info_for_impl_item() a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
wesleywiser committed Apr 20, 2018
1 parent 05dc5e7 commit 732cc73
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions src/librustc_metadata/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -925,18 +925,19 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> {
};

let mir =
if let hir::ImplItemKind::Const(..) = ast_item.node {
true
} else if let hir::ImplItemKind::Method(ref sig, _) = ast_item.node {
let generics = self.tcx.generics_of(def_id);
let types = generics.parent_types as usize + generics.types.len();
let needs_inline = (types > 0 || tcx.trans_fn_attrs(def_id).requests_inline()) &&
!self.metadata_output_only();
let is_const_fn = sig.constness == hir::Constness::Const;
let always_encode_mir = self.tcx.sess.opts.debugging_opts.always_encode_mir;
needs_inline || is_const_fn || always_encode_mir
} else {
false
match ast_item.node {
hir::ImplItemKind::Const(..) => true,
hir::ImplItemKind::Method(ref sig, _) => {
let generics = self.tcx.generics_of(def_id);
let types = generics.parent_types as usize + generics.types.len();
let needs_inline =
(types > 0 || tcx.trans_fn_attrs(def_id).requests_inline())
&& !self.metadata_output_only();
let is_const_fn = sig.constness == hir::Constness::Const;
let always_encode_mir = self.tcx.sess.opts.debugging_opts.always_encode_mir;
needs_inline || is_const_fn || always_encode_mir
},
hir::ImplItemKind::Type(..) => false,
};

Entry {
Expand Down

0 comments on commit 732cc73

Please sign in to comment.