]> git.proxmox.com Git - rustc.git/blame - src/test/codegen-units/partitioning/inlining-from-extern-crate.rs
New upstream version 1.23.0+dfsg1
[rustc.git] / src / test / codegen-units / partitioning / inlining-from-extern-crate.rs
CommitLineData
a7813a04
XL
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
11// ignore-tidy-linelength
12// We specify -Z incremental here because we want to test the partitioning for
13// incremental compilation
14// compile-flags:-Zprint-trans-items=lazy -Zincremental=tmp/partitioning-tests/inlining-from-extern-crate
ea8adc8c 15// compile-flags:-Zinline-in-all-cgus
a7813a04
XL
16
17#![crate_type="lib"]
18
19// aux-build:cgu_explicit_inlining.rs
20extern crate cgu_explicit_inlining;
21
22// This test makes sure that items inlined from external crates are privately
23// instantiated in every codegen unit they are used in.
24
5bcae85e
SL
25//~ TRANS_ITEM fn cgu_explicit_inlining::inlined[0] @@ inlining_from_extern_crate[Internal] inlining_from_extern_crate-mod1[Internal]
26//~ TRANS_ITEM fn cgu_explicit_inlining::always_inlined[0] @@ inlining_from_extern_crate[Internal] inlining_from_extern_crate-mod2[Internal]
a7813a04 27
5bcae85e 28//~ TRANS_ITEM fn inlining_from_extern_crate::user[0] @@ inlining_from_extern_crate[External]
a7813a04
XL
29pub fn user()
30{
31 cgu_explicit_inlining::inlined();
32 cgu_explicit_inlining::always_inlined();
33
34 // does not generate a translation item in this crate
35 cgu_explicit_inlining::never_inlined();
36}
37
abe05a73 38pub mod mod1 {
a7813a04
XL
39 use cgu_explicit_inlining;
40
abe05a73 41 //~ TRANS_ITEM fn inlining_from_extern_crate::mod1[0]::user[0] @@ inlining_from_extern_crate-mod1[External]
a7813a04
XL
42 pub fn user()
43 {
44 cgu_explicit_inlining::inlined();
45
46 // does not generate a translation item in this crate
47 cgu_explicit_inlining::never_inlined();
48 }
49}
50
abe05a73 51pub mod mod2 {
a7813a04
XL
52 use cgu_explicit_inlining;
53
abe05a73 54 //~ TRANS_ITEM fn inlining_from_extern_crate::mod2[0]::user[0] @@ inlining_from_extern_crate-mod2[External]
a7813a04
XL
55 pub fn user()
56 {
57 cgu_explicit_inlining::always_inlined();
58
59 // does not generate a translation item in this crate
60 cgu_explicit_inlining::never_inlined();
61 }
62}