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