]> git.proxmox.com Git - rustc.git/blob - src/test/incremental/hashes/exported_vs_not.rs
New upstream version 1.44.1+dfsg1
[rustc.git] / src / test / incremental / hashes / exported_vs_not.rs
1 // build-pass (FIXME(62277): could be check-pass?)
2 // revisions: cfail1 cfail2 cfail3
3 // compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
4
5 #![allow(warnings)]
6 #![feature(rustc_attrs)]
7 #![crate_type="rlib"]
8
9 // Case 1: The function body is not exported to metadata. If the body changes,
10 // the hash of the hir_owner_nodes node should change, but not the hash of
11 // either the hir_owner or the Metadata node.
12
13 #[cfg(cfail1)]
14 pub fn body_not_exported_to_metadata() -> u32 {
15 1
16 }
17
18 #[cfg(not(cfail1))]
19 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,mir_built,optimized_mir")]
20 #[rustc_clean(cfg="cfail3")]
21 pub fn body_not_exported_to_metadata() -> u32 {
22 2
23 }
24
25
26
27 // Case 2: The function body *is* exported to metadata because the function is
28 // marked as #[inline]. Only the hash of the hir_owner depnode should be
29 // unaffected by a change to the body.
30
31 #[cfg(cfail1)]
32 #[inline]
33 pub fn body_exported_to_metadata_because_of_inline() -> u32 {
34 1
35 }
36
37 #[cfg(not(cfail1))]
38 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,mir_built,optimized_mir")]
39 #[rustc_clean(cfg="cfail3")]
40 #[inline]
41 pub fn body_exported_to_metadata_because_of_inline() -> u32 {
42 2
43 }
44
45
46
47 // Case 2: The function body *is* exported to metadata because the function is
48 // generic. Only the hash of the hir_owner depnode should be
49 // unaffected by a change to the body.
50
51 #[cfg(cfail1)]
52 #[inline]
53 pub fn body_exported_to_metadata_because_of_generic() -> u32 {
54 1
55 }
56
57 #[cfg(not(cfail1))]
58 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,mir_built,optimized_mir")]
59 #[rustc_clean(cfg="cfail3")]
60 #[inline]
61 pub fn body_exported_to_metadata_because_of_generic() -> u32 {
62 2
63 }