/src/test/codegen-units/partitioning/local-drop-glue.rs

https://gitlab.com/jianglu/rust · Rust · 64 lines · 34 code · 9 blank · 21 comment · 1 complexity · 29122a8d02d929fee9c98909c8192406 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/local-drop-glue
  14. // compile-flags:-Zinline-in-all-cgus
  15. #![allow(dead_code)]
  16. #![crate_type="rlib"]
  17. //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<local_drop_glue::Struct[0]> @@ local_drop_glue[Internal] local_drop_glue-mod1[Internal]
  18. struct Struct {
  19. _a: u32
  20. }
  21. impl Drop for Struct {
  22. //~ MONO_ITEM fn local_drop_glue::{{impl}}[0]::drop[0] @@ local_drop_glue[External]
  23. fn drop(&mut self) {}
  24. }
  25. //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<local_drop_glue::Outer[0]> @@ local_drop_glue[Internal]
  26. struct Outer {
  27. _a: Struct
  28. }
  29. //~ MONO_ITEM fn local_drop_glue::user[0] @@ local_drop_glue[External]
  30. pub fn user()
  31. {
  32. let _ = Outer {
  33. _a: Struct {
  34. _a: 0
  35. }
  36. };
  37. }
  38. pub mod mod1
  39. {
  40. use super::Struct;
  41. //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<local_drop_glue::mod1[0]::Struct2[0]> @@ local_drop_glue-mod1[Internal]
  42. struct Struct2 {
  43. _a: Struct,
  44. //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<(u32, local_drop_glue::Struct[0])> @@ local_drop_glue-mod1[Internal]
  45. _b: (u32, Struct),
  46. }
  47. //~ MONO_ITEM fn local_drop_glue::mod1[0]::user[0] @@ local_drop_glue-mod1[External]
  48. pub fn user()
  49. {
  50. let _ = Struct2 {
  51. _a: Struct { _a: 0 },
  52. _b: (0, Struct { _a: 0 }),
  53. };
  54. }
  55. }