File: private-reexport-in-public-api-81141.rs

package info (click to toggle)
rustc 1.85.0%2Bdfsg3-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, sid, trixie
  • size: 893,396 kB
  • sloc: xml: 158,127; python: 35,830; javascript: 19,497; cpp: 19,002; sh: 17,245; ansic: 13,127; asm: 4,376; makefile: 1,051; perl: 29; lisp: 29; ruby: 19; sql: 11
file content (125 lines) | stat: -rw-r--r-- 3,171 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
// This test ensures that if a private re-export is present in a public API, it'll be
// replaced by the first public item in the re-export chain or by the private item.

// https://github.com/rust-lang/rust/issues/81141
#![crate_name = "foo"]

use crate::bar::Bar as Alias;

pub use crate::bar::Bar as Whatever;
use crate::Whatever as Whatever2;
use crate::Whatever2 as Whatever3;
pub use crate::bar::Inner as Whatever4;

mod bar {
    pub struct Bar;
    pub use self::Bar as Inner;
}

//@ has 'foo/fn.bar.html'
//@ has - '//*[@class="rust item-decl"]/code' 'pub fn bar() -> Bar'
pub fn bar() -> Alias {
    Alias
}

//@ has 'foo/fn.bar2.html'
//@ has - '//*[@class="rust item-decl"]/code' 'pub fn bar2() -> Whatever'
pub fn bar2() -> Whatever3 {
    Whatever
}

//@ has 'foo/fn.bar3.html'
//@ has - '//*[@class="rust item-decl"]/code' 'pub fn bar3() -> Whatever4'
pub fn bar3() -> Whatever4 {
    Whatever
}

//@ has 'foo/fn.bar4.html'
//@ has - '//*[@class="rust item-decl"]/code' 'pub fn bar4() -> Bar'
pub fn bar4() -> crate::Alias {
    Alias
}

//@ has 'foo/fn.bar5.html'
//@ has - '//*[@class="rust item-decl"]/code' 'pub fn bar5() -> Whatever'
pub fn bar5() -> crate::Whatever3 {
    Whatever
}

//@ has 'foo/fn.bar6.html'
//@ has - '//*[@class="rust item-decl"]/code' 'pub fn bar6() -> Whatever4'
pub fn bar6() -> crate::Whatever4 {
    Whatever
}


//@ has 'foo/fn.bar7.html'
//@ has - '//*[@class="rust item-decl"]/code' 'pub fn bar7() -> Bar'
pub fn bar7() -> self::Alias {
    Alias
}

//@ has 'foo/fn.bar8.html'
//@ has - '//*[@class="rust item-decl"]/code' 'pub fn bar8() -> Whatever'
pub fn bar8() -> self::Whatever3 {
    Whatever
}

//@ has 'foo/fn.bar9.html'
//@ has - '//*[@class="rust item-decl"]/code' 'pub fn bar9() -> Whatever4'
pub fn bar9() -> self::Whatever4 {
    Whatever
}

mod nested {
    pub(crate) use crate::Alias;
    pub(crate) use crate::Whatever3;
    pub(crate) use crate::Whatever4;
    pub(crate) use crate::nested as nested2;
}

//@ has 'foo/fn.bar10.html'
//@ has - '//*[@class="rust item-decl"]/code' 'pub fn bar10() -> Bar'
pub fn bar10() -> nested::Alias {
    Alias
}

//@ has 'foo/fn.bar11.html'
//@ has - '//*[@class="rust item-decl"]/code' 'pub fn bar11() -> Whatever'
pub fn bar11() -> nested::Whatever3 {
    Whatever
}

//@ has 'foo/fn.bar12.html'
//@ has - '//*[@class="rust item-decl"]/code' 'pub fn bar12() -> Whatever4'
pub fn bar12() -> nested::Whatever4 {
    Whatever
}

//@ has 'foo/fn.bar13.html'
//@ has - '//*[@class="rust item-decl"]/code' 'pub fn bar13() -> Bar'
pub fn bar13() -> nested::nested2::Alias {
    Alias
}

//@ has 'foo/fn.bar14.html'
//@ has - '//*[@class="rust item-decl"]/code' 'pub fn bar14() -> Whatever'
pub fn bar14() -> nested::nested2::Whatever3 {
    Whatever
}

//@ has 'foo/fn.bar15.html'
//@ has - '//*[@class="rust item-decl"]/code' 'pub fn bar15() -> Whatever4'
pub fn bar15() -> nested::nested2::Whatever4 {
    Whatever
}

use external::Public as Private;

pub mod external {
    pub struct Public;

    //@ has 'foo/external/fn.make.html'
    //@ has - '//*[@class="rust item-decl"]/code' 'pub fn make() -> Public'
    pub fn make() -> super::Private { super::Private }
}