2019-07-02 21:30:28 +00:00
|
|
|
// build-pass (FIXME(62277): could be check-pass?)
|
2016-12-06 21:59:07 +00:00
|
|
|
// revisions: cfail1 cfail2 cfail3
|
2017-12-04 11:47:16 +00:00
|
|
|
// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
|
2016-12-06 21:59:07 +00:00
|
|
|
|
|
|
|
#![allow(warnings)]
|
|
|
|
#![feature(rustc_attrs)]
|
|
|
|
#![crate_type="rlib"]
|
|
|
|
|
|
|
|
// Case 1: The function body is not exported to metadata. If the body changes,
|
2020-03-18 01:48:17 +00:00
|
|
|
// the hash of the hir_owner_nodes node should change, but not the hash of
|
2020-02-12 15:00:15 +00:00
|
|
|
// either the hir_owner or the Metadata node.
|
2016-12-06 21:59:07 +00:00
|
|
|
|
|
|
|
#[cfg(cfail1)]
|
|
|
|
pub fn body_not_exported_to_metadata() -> u32 {
|
|
|
|
1
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(not(cfail1))]
|
2020-07-06 22:35:06 +00:00
|
|
|
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
|
2017-11-13 00:24:41 +00:00
|
|
|
#[rustc_clean(cfg="cfail3")]
|
2016-12-06 21:59:07 +00:00
|
|
|
pub fn body_not_exported_to_metadata() -> u32 {
|
|
|
|
2
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Case 2: The function body *is* exported to metadata because the function is
|
2020-02-12 15:00:15 +00:00
|
|
|
// marked as #[inline]. Only the hash of the hir_owner depnode should be
|
2016-12-06 21:59:07 +00:00
|
|
|
// unaffected by a change to the body.
|
|
|
|
|
|
|
|
#[cfg(cfail1)]
|
|
|
|
#[inline]
|
|
|
|
pub fn body_exported_to_metadata_because_of_inline() -> u32 {
|
|
|
|
1
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(not(cfail1))]
|
2020-07-06 22:35:06 +00:00
|
|
|
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
|
2017-11-13 00:24:41 +00:00
|
|
|
#[rustc_clean(cfg="cfail3")]
|
2016-12-06 21:59:07 +00:00
|
|
|
#[inline]
|
|
|
|
pub fn body_exported_to_metadata_because_of_inline() -> u32 {
|
|
|
|
2
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Case 2: The function body *is* exported to metadata because the function is
|
2020-02-12 15:00:15 +00:00
|
|
|
// generic. Only the hash of the hir_owner depnode should be
|
2016-12-06 21:59:07 +00:00
|
|
|
// unaffected by a change to the body.
|
|
|
|
|
|
|
|
#[cfg(cfail1)]
|
|
|
|
#[inline]
|
|
|
|
pub fn body_exported_to_metadata_because_of_generic() -> u32 {
|
|
|
|
1
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(not(cfail1))]
|
2020-07-06 22:35:06 +00:00
|
|
|
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
|
2017-11-13 00:24:41 +00:00
|
|
|
#[rustc_clean(cfg="cfail3")]
|
2016-12-06 21:59:07 +00:00
|
|
|
#[inline]
|
|
|
|
pub fn body_exported_to_metadata_because_of_generic() -> u32 {
|
|
|
|
2
|
|
|
|
}
|