1 // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // must-compile-successfully
12 // revisions: cfail1 cfail2 cfail3
13 // compile-flags: -Z query-dep-graph
16 #![feature(rustc_attrs)]
19 // Case 1: The function body is not exported to metadata. If the body changes,
20 // the hash of the HirBody node should change, but not the hash of
21 // either the Hir or the Metadata node.
24 pub fn body_not_exported_to_metadata() -> u32 {
29 #[rustc_clean(label="Hir", cfg="cfail2")]
30 #[rustc_clean(label="Hir", cfg="cfail3")]
31 #[rustc_dirty(label="HirBody", cfg="cfail2")]
32 #[rustc_clean(label="HirBody", cfg="cfail3")]
33 #[rustc_metadata_clean(cfg="cfail2")]
34 #[rustc_metadata_clean(cfg="cfail3")]
35 pub fn body_not_exported_to_metadata() -> u32 {
41 // Case 2: The function body *is* exported to metadata because the function is
42 // marked as #[inline]. Only the hash of the Hir depnode should be
43 // unaffected by a change to the body.
47 pub fn body_exported_to_metadata_because_of_inline() -> u32 {
52 #[rustc_clean(label="Hir", cfg="cfail2")]
53 #[rustc_clean(label="Hir", cfg="cfail3")]
54 #[rustc_dirty(label="HirBody", cfg="cfail2")]
55 #[rustc_clean(label="HirBody", cfg="cfail3")]
56 #[rustc_metadata_dirty(cfg="cfail2")]
57 #[rustc_metadata_clean(cfg="cfail3")]
59 pub fn body_exported_to_metadata_because_of_inline() -> u32 {
65 // Case 2: The function body *is* exported to metadata because the function is
66 // generic. Only the hash of the Hir depnode should be
67 // unaffected by a change to the body.
71 pub fn body_exported_to_metadata_because_of_generic() -> u32 {
76 #[rustc_clean(label="Hir", cfg="cfail2")]
77 #[rustc_clean(label="Hir", cfg="cfail3")]
78 #[rustc_dirty(label="HirBody", cfg="cfail2")]
79 #[rustc_clean(label="HirBody", cfg="cfail3")]
80 #[rustc_metadata_dirty(cfg="cfail2")]
81 #[rustc_metadata_clean(cfg="cfail3")]
83 pub fn body_exported_to_metadata_because_of_generic() -> u32 {