@@ -89,7 +89,40 @@ local_data_key!(pub analysiskey: core::CrateAnalysis)
89
89
type Output = ( clean:: Crate , Vec < plugins:: PluginJson > ) ;
90
90
91
91
pub fn main ( ) {
92
- std:: os:: set_exit_status ( main_args ( std:: os:: args ( ) . as_slice ( ) ) ) ;
92
+ // Why run rustdoc in a separate task? That's a good question!
93
+ //
94
+ // We first begin our adventure at the ancient commit of e7c4fb69. In this
95
+ // commit it was discovered that the stack limit frobbing on windows ended
96
+ // up causing some syscalls to fail. This was worked around manually in the
97
+ // relevant location.
98
+ //
99
+ // Our journey now continues with #13259 where it was discovered that this
100
+ // stack limit frobbing has the ability to affect nearly any syscall. Note
101
+ // that the key idea here is that there is currently no knowledge as to why
102
+ // this is happening or how to preserve it, fun times!
103
+ //
104
+ // Now we continue along to #16275 where it was discovered that --test on
105
+ // windows didn't work at all! Yet curiously rustdoc worked without --test.
106
+ // The exact reason that #16275 cropped up is that during the expansion
107
+ // phase the compiler attempted to open libstd to read out its macros. This
108
+ // invoked the LLVMRustOpenArchive shim which in turned went to LLVM to go
109
+ // open a file and read it. Lo and behold this function returned an error!
110
+ // It was then discovered that when the same fix mentioned in #13259 was
111
+ // applied, the error went away. The plot thickens!
112
+ //
113
+ // Remember that rustdoc works without --test, which raises the question of
114
+ // how because the --test and non --test paths are almost identical. The
115
+ // first thing both paths do is parse and expand a crate! It turns out that
116
+ // the difference is that --test runs on the *main task* while the normal
117
+ // path runs in subtask. It turns out that running --test in a sub task also
118
+ // fixes the problem!
119
+ //
120
+ // So, in summary, it is unknown why this is necessary, what it is
121
+ // preventing, or what the actual bug is. In the meantime, this allows
122
+ // --test to work on windows, which seems good, right? Fun times.
123
+ spawn ( proc ( ) {
124
+ std:: os:: set_exit_status ( main_args ( std:: os:: args ( ) . as_slice ( ) ) ) ;
125
+ } ) ;
93
126
}
94
127
95
128
pub fn opts ( ) -> Vec < getopts:: OptGroup > {
0 commit comments