Skip to content

Commit

Permalink
Auto merge of #50129 - wesleywiser:clean_up1, r=michaelwoerister
Browse files Browse the repository at this point in the history
Clean up `IsolatedEncoder::encode_info_for_impl_item()` a bit

Suggested in the [comments of #49991](https://github.com/rust-lang/rust/pull/49991/files/4a77d35c1ed89310a0ed128ce931cd4b85ca4cd4#r183048939)
  • Loading branch information
bors committed Apr 23, 2018
2 parents f5cf1a8 + 732cc73 commit 1fac3ca
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 1fac3ca

Please sign in to comment.