2019-07-02 16:30:28 -05:00
|
|
|
// build-pass (FIXME(62277): could be check-pass?)
|
2021-04-22 14:33:16 -05:00
|
|
|
// revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
|
2022-05-27 20:17:39 -05:00
|
|
|
// compile-flags: -Z query-dep-graph -O
|
2021-04-22 14:33:16 -05:00
|
|
|
// [cfail1]compile-flags: -Zincremental-ignore-spans
|
|
|
|
// [cfail2]compile-flags: -Zincremental-ignore-spans
|
|
|
|
// [cfail3]compile-flags: -Zincremental-ignore-spans
|
2016-12-06 15:59:07 -06: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-17 20:48:17 -05:00
|
|
|
// the hash of the hir_owner_nodes node should change, but not the hash of
|
2020-02-12 09:00:15 -06:00
|
|
|
// either the hir_owner or the Metadata node.
|
2016-12-06 15:59:07 -06:00
|
|
|
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(any(cfail1,cfail4))]
|
2016-12-06 15:59:07 -06:00
|
|
|
pub fn body_not_exported_to_metadata() -> u32 {
|
|
|
|
1
|
|
|
|
}
|
|
|
|
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(not(any(cfail1,cfail4)))]
|
2020-07-06 17:35:06 -05:00
|
|
|
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
|
2017-11-12 18:24:41 -06:00
|
|
|
#[rustc_clean(cfg="cfail3")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
|
|
|
|
#[rustc_clean(cfg="cfail6")]
|
2016-12-06 15:59:07 -06: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 09:00:15 -06:00
|
|
|
// marked as #[inline]. Only the hash of the hir_owner depnode should be
|
2016-12-06 15:59:07 -06:00
|
|
|
// unaffected by a change to the body.
|
|
|
|
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(any(cfail1,cfail4))]
|
2016-12-06 15:59:07 -06:00
|
|
|
#[inline]
|
|
|
|
pub fn body_exported_to_metadata_because_of_inline() -> u32 {
|
|
|
|
1
|
|
|
|
}
|
|
|
|
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(not(any(cfail1,cfail4)))]
|
2020-07-06 17:35:06 -05:00
|
|
|
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
|
2017-11-12 18:24:41 -06:00
|
|
|
#[rustc_clean(cfg="cfail3")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
|
|
|
|
#[rustc_clean(cfg="cfail6")]
|
2016-12-06 15:59:07 -06: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 09:00:15 -06:00
|
|
|
// generic. Only the hash of the hir_owner depnode should be
|
2016-12-06 15:59:07 -06:00
|
|
|
// unaffected by a change to the body.
|
|
|
|
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(any(cfail1,cfail4))]
|
2016-12-06 15:59:07 -06:00
|
|
|
#[inline]
|
|
|
|
pub fn body_exported_to_metadata_because_of_generic() -> u32 {
|
|
|
|
1
|
|
|
|
}
|
|
|
|
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(not(any(cfail1,cfail4)))]
|
2020-07-06 17:35:06 -05:00
|
|
|
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
|
2017-11-12 18:24:41 -06:00
|
|
|
#[rustc_clean(cfg="cfail3")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
|
|
|
|
#[rustc_clean(cfg="cfail6")]
|
2016-12-06 15:59:07 -06:00
|
|
|
#[inline]
|
|
|
|
pub fn body_exported_to_metadata_because_of_generic() -> u32 {
|
|
|
|
2
|
|
|
|
}
|