Skip to content

Commit b7290a0

Browse files
authored
Rollup merge of #64850 - Mark-Simulacrum:dedup-dep-node, r=michaelwoerister
Remove inlines from DepNode code
2 parents 18d0c03 + 675ed48 commit b7290a0

File tree

1 file changed

+18
-22
lines changed

1 file changed

+18
-22
lines changed

src/librustc/dep_graph/dep_node.rs

+18-22
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ macro_rules! define_dep_nodes {
114114

115115
impl DepKind {
116116
#[allow(unreachable_code)]
117-
#[inline]
118117
pub fn can_reconstruct_query_key<$tcx>(&self) -> bool {
119118
match *self {
120119
$(
@@ -150,7 +149,6 @@ macro_rules! define_dep_nodes {
150149
}
151150
}
152151

153-
#[inline(always)]
154152
pub fn is_eval_always(&self) -> bool {
155153
match *self {
156154
$(
@@ -199,7 +197,6 @@ macro_rules! define_dep_nodes {
199197

200198
impl DepNode {
201199
#[allow(unreachable_code, non_snake_case)]
202-
#[inline(always)]
203200
pub fn new<'tcx>(tcx: TyCtxt<'tcx>,
204201
dep: DepConstructor<'tcx>)
205202
-> DepNode
@@ -219,14 +216,16 @@ macro_rules! define_dep_nodes {
219216
hash
220217
};
221218

222-
if cfg!(debug_assertions) &&
223-
!dep_node.kind.can_reconstruct_query_key() &&
224-
(tcx.sess.opts.debugging_opts.incremental_info ||
225-
tcx.sess.opts.debugging_opts.query_dep_graph)
219+
#[cfg(debug_assertions)]
226220
{
227-
tcx.dep_graph.register_dep_node_debug_str(dep_node, || {
228-
arg.to_debug_str(tcx)
229-
});
221+
if !dep_node.kind.can_reconstruct_query_key() &&
222+
(tcx.sess.opts.debugging_opts.incremental_info ||
223+
tcx.sess.opts.debugging_opts.query_dep_graph)
224+
{
225+
tcx.dep_graph.register_dep_node_debug_str(dep_node, || {
226+
arg.to_debug_str(tcx)
227+
});
228+
}
230229
}
231230

232231
return dep_node;
@@ -242,14 +241,16 @@ macro_rules! define_dep_nodes {
242241
hash
243242
};
244243

245-
if cfg!(debug_assertions) &&
246-
!dep_node.kind.can_reconstruct_query_key() &&
247-
(tcx.sess.opts.debugging_opts.incremental_info ||
248-
tcx.sess.opts.debugging_opts.query_dep_graph)
244+
#[cfg(debug_assertions)]
249245
{
250-
tcx.dep_graph.register_dep_node_debug_str(dep_node, || {
251-
tupled_args.to_debug_str(tcx)
252-
});
246+
if !dep_node.kind.can_reconstruct_query_key() &&
247+
(tcx.sess.opts.debugging_opts.incremental_info ||
248+
tcx.sess.opts.debugging_opts.query_dep_graph)
249+
{
250+
tcx.dep_graph.register_dep_node_debug_str(dep_node, || {
251+
tupled_args.to_debug_str(tcx)
252+
});
253+
}
253254
}
254255

255256
return dep_node;
@@ -267,7 +268,6 @@ macro_rules! define_dep_nodes {
267268
/// Construct a DepNode from the given DepKind and DefPathHash. This
268269
/// method will assert that the given DepKind actually requires a
269270
/// single DefId/DefPathHash parameter.
270-
#[inline(always)]
271271
pub fn from_def_path_hash(kind: DepKind,
272272
def_path_hash: DefPathHash)
273273
-> DepNode {
@@ -281,7 +281,6 @@ macro_rules! define_dep_nodes {
281281
/// Creates a new, parameterless DepNode. This method will assert
282282
/// that the DepNode corresponding to the given DepKind actually
283283
/// does not require any parameters.
284-
#[inline(always)]
285284
pub fn new_no_params(kind: DepKind) -> DepNode {
286285
debug_assert!(!kind.has_params());
287286
DepNode {
@@ -300,7 +299,6 @@ macro_rules! define_dep_nodes {
300299
/// DepNode. Condition (2) might not be fulfilled if a DepNode
301300
/// refers to something from the previous compilation session that
302301
/// has been removed.
303-
#[inline]
304302
pub fn extract_def_id(&self, tcx: TyCtxt<'_>) -> Option<DefId> {
305303
if self.kind.can_reconstruct_query_key() {
306304
let def_path_hash = DefPathHash(self.hash);
@@ -386,14 +384,12 @@ impl fmt::Debug for DepNode {
386384

387385

388386
impl DefPathHash {
389-
#[inline(always)]
390387
pub fn to_dep_node(self, kind: DepKind) -> DepNode {
391388
DepNode::from_def_path_hash(kind, self)
392389
}
393390
}
394391

395392
impl DefId {
396-
#[inline(always)]
397393
pub fn to_dep_node(self, tcx: TyCtxt<'_>, kind: DepKind) -> DepNode {
398394
DepNode::from_def_path_hash(kind, tcx.def_path_hash(self))
399395
}

0 commit comments

Comments
 (0)