2024-02-22 06:10:29 -06:00
|
|
|
//@ build-pass (FIXME(62277): could be check-pass?)
|
|
|
|
//@ revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
|
|
|
|
//@ compile-flags: -Z query-dep-graph -O
|
|
|
|
//@ [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,
|
2024-01-25 10:16:38 -06:00
|
|
|
// the hash of the opt_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)))]
|
2024-01-25 10:16:38 -06:00
|
|
|
#[rustc_clean(cfg="cfail2", except="opt_hir_owner_nodes,optimized_mir")]
|
2017-11-12 18:24:41 -06:00
|
|
|
#[rustc_clean(cfg="cfail3")]
|
2024-01-25 10:16:38 -06:00
|
|
|
#[rustc_clean(cfg="cfail5", except="opt_hir_owner_nodes,optimized_mir")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[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)))]
|
2024-01-25 10:16:38 -06:00
|
|
|
#[rustc_clean(cfg="cfail2", except="opt_hir_owner_nodes,optimized_mir")]
|
2017-11-12 18:24:41 -06:00
|
|
|
#[rustc_clean(cfg="cfail3")]
|
2024-01-25 10:16:38 -06:00
|
|
|
#[rustc_clean(cfg="cfail5", except="opt_hir_owner_nodes,optimized_mir")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[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)))]
|
2024-01-25 10:16:38 -06:00
|
|
|
#[rustc_clean(cfg="cfail2", except="opt_hir_owner_nodes,optimized_mir")]
|
2017-11-12 18:24:41 -06:00
|
|
|
#[rustc_clean(cfg="cfail3")]
|
2024-01-25 10:16:38 -06:00
|
|
|
#[rustc_clean(cfg="cfail5", except="opt_hir_owner_nodes,optimized_mir")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[rustc_clean(cfg="cfail6")]
|
2016-12-06 15:59:07 -06:00
|
|
|
#[inline]
|
|
|
|
pub fn body_exported_to_metadata_because_of_generic() -> u32 {
|
|
|
|
2
|
|
|
|
}
|