/src/test/codegen-units/partitioning/statics.rs

https://gitlab.com/jianglu/rust · Rust · 48 lines · 15 code · 10 blank · 23 comment · 0 complexity · 44fc082c77a5903e57c2c8b78548ed42 MD5 · raw file

  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.
  4. //
  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.
  10. // ignore-tidy-linelength
  11. // We specify -Z incremental here because we want to test the partitioning for
  12. // incremental compilation
  13. // compile-flags:-Zprint-mono-items=lazy -Zincremental=tmp/partitioning-tests/statics
  14. #![crate_type="rlib"]
  15. //~ MONO_ITEM static statics::FOO[0] @@ statics[Internal]
  16. static FOO: u32 = 0;
  17. //~ MONO_ITEM static statics::BAR[0] @@ statics[Internal]
  18. static BAR: u32 = 0;
  19. //~ MONO_ITEM fn statics::function[0] @@ statics[External]
  20. pub fn function() {
  21. //~ MONO_ITEM static statics::function[0]::FOO[0] @@ statics[Internal]
  22. static FOO: u32 = 0;
  23. //~ MONO_ITEM static statics::function[0]::BAR[0] @@ statics[Internal]
  24. static BAR: u32 = 0;
  25. }
  26. pub mod mod1 {
  27. //~ MONO_ITEM static statics::mod1[0]::FOO[0] @@ statics-mod1[Internal]
  28. static FOO: u32 = 0;
  29. //~ MONO_ITEM static statics::mod1[0]::BAR[0] @@ statics-mod1[Internal]
  30. static BAR: u32 = 0;
  31. //~ MONO_ITEM fn statics::mod1[0]::function[0] @@ statics-mod1[External]
  32. pub fn function() {
  33. //~ MONO_ITEM static statics::mod1[0]::function[0]::FOO[0] @@ statics-mod1[Internal]
  34. static FOO: u32 = 0;
  35. //~ MONO_ITEM static statics::mod1[0]::function[0]::BAR[0] @@ statics-mod1[Internal]
  36. static BAR: u32 = 0;
  37. }
  38. }