@@ -53,11 +53,12 @@ macro_rules! hash_substruct {
53
53
}
54
54
55
55
macro_rules! top_level_options {
56
- ( pub struct Options { $(
56
+ ( $ ( # [ $top_level_attr : meta ] ) * pub struct Options { $(
57
57
$( #[ $attr: meta] ) *
58
58
$opt: ident : $t: ty [ $dep_tracking_marker: ident] ,
59
59
) * } ) => (
60
60
#[ derive( Clone ) ]
61
+ $( #[ $top_level_attr] ) *
61
62
pub struct Options {
62
63
$(
63
64
$( #[ $attr] ) *
@@ -93,38 +94,38 @@ macro_rules! top_level_options {
93
94
) ;
94
95
}
95
96
96
- // The top-level command-line options struct.
97
- //
98
- // For each option, one has to specify how it behaves with regard to the
99
- // dependency tracking system of incremental compilation. This is done via the
100
- // square-bracketed directive after the field type. The options are:
101
- //
102
- // [TRACKED]
103
- // A change in the given field will cause the compiler to completely clear the
104
- // incremental compilation cache before proceeding.
105
- //
106
- // [TRACKED_NO_CRATE_HASH]
107
- // Same as [TRACKED], but will not affect the crate hash. This is useful for options that only
108
- // affect the incremental cache.
109
- //
110
- // [UNTRACKED]
111
- // Incremental compilation is not influenced by this option.
112
- //
113
- // [SUBSTRUCT]
114
- // Second-level sub-structs containing more options.
115
- //
116
- // If you add a new option to this struct or one of the sub-structs like
117
- // `CodegenOptions`, think about how it influences incremental compilation. If in
118
- // doubt, specify [TRACKED], which is always "correct" but might lead to
119
- // unnecessary re-compilation.
120
97
top_level_options ! (
98
+ /// The top-level command-line options struct.
99
+ ///
100
+ /// For each option, one has to specify how it behaves with regard to the
101
+ /// dependency tracking system of incremental compilation. This is done via the
102
+ /// square-bracketed directive after the field type. The options are:
103
+ ///
104
+ /// [TRACKED]
105
+ /// A change in the given field will cause the compiler to completely clear the
106
+ /// incremental compilation cache before proceeding.
107
+ ///
108
+ /// [TRACKED_NO_CRATE_HASH]
109
+ /// Same as [TRACKED], but will not affect the crate hash. This is useful for options that only
110
+ /// affect the incremental cache.
111
+ ///
112
+ /// [UNTRACKED]
113
+ /// Incremental compilation is not influenced by this option.
114
+ ///
115
+ /// [SUBSTRUCT]
116
+ /// Second-level sub-structs containing more options.
117
+ ///
118
+ /// If you add a new option to this struct or one of the sub-structs like
119
+ /// `CodegenOptions`, think about how it influences incremental compilation. If in
120
+ /// doubt, specify [TRACKED], which is always "correct" but might lead to
121
+ /// unnecessary re-compilation.
121
122
pub struct Options {
122
- // The crate config requested for the session, which may be combined
123
- // with additional crate configurations during the compile process.
123
+ /// The crate config requested for the session, which may be combined
124
+ /// with additional crate configurations during the compile process.
124
125
crate_types: Vec <CrateType > [ TRACKED ] ,
125
126
optimize: OptLevel [ TRACKED ] ,
126
- // Include the `debug_assertions` flag in dependency tracking, since it
127
- // can influence whether overflow checks are done or not.
127
+ /// Include the `debug_assertions` flag in dependency tracking, since it
128
+ /// can influence whether overflow checks are done or not.
128
129
debug_assertions: bool [ TRACKED ] ,
129
130
debuginfo: DebugInfo [ TRACKED ] ,
130
131
lint_opts: Vec <( String , lint:: Level ) > [ TRACKED ] ,
@@ -140,43 +141,43 @@ top_level_options!(
140
141
test: bool [ TRACKED ] ,
141
142
error_format: ErrorOutputType [ UNTRACKED ] ,
142
143
143
- // If `Some`, enable incremental compilation, using the given
144
- // directory to store intermediate results.
144
+ /// If `Some`, enable incremental compilation, using the given
145
+ /// directory to store intermediate results.
145
146
incremental: Option <PathBuf > [ UNTRACKED ] ,
146
147
147
148
debugging_opts: DebuggingOptions [ SUBSTRUCT ] ,
148
149
prints: Vec <PrintRequest > [ UNTRACKED ] ,
149
- // Determines which borrow checker(s) to run. This is the parsed, sanitized
150
- // version of `debugging_opts.borrowck`, which is just a plain string.
150
+ /// Determines which borrow checker(s) to run. This is the parsed, sanitized
151
+ /// version of `debugging_opts.borrowck`, which is just a plain string.
151
152
borrowck_mode: BorrowckMode [ UNTRACKED ] ,
152
153
cg: CodegenOptions [ SUBSTRUCT ] ,
153
154
externs: Externs [ UNTRACKED ] ,
154
155
extern_dep_specs: ExternDepSpecs [ UNTRACKED ] ,
155
156
crate_name: Option <String > [ TRACKED ] ,
156
- // An optional name to use as the crate for std during std injection,
157
- // written `extern crate name as std`. Defaults to `std`. Used by
158
- // out-of-tree drivers.
157
+ /// An optional name to use as the crate for std during std injection,
158
+ /// written `extern crate name as std`. Defaults to `std`. Used by
159
+ /// out-of-tree drivers.
159
160
alt_std_name: Option <String > [ TRACKED ] ,
160
- // Indicates how the compiler should treat unstable features.
161
+ /// Indicates how the compiler should treat unstable features.
161
162
unstable_features: UnstableFeatures [ TRACKED ] ,
162
163
163
- // Indicates whether this run of the compiler is actually rustdoc. This
164
- // is currently just a hack and will be removed eventually, so please
165
- // try to not rely on this too much.
164
+ /// Indicates whether this run of the compiler is actually rustdoc. This
165
+ /// is currently just a hack and will be removed eventually, so please
166
+ /// try to not rely on this too much.
166
167
actually_rustdoc: bool [ TRACKED ] ,
167
168
168
- // Control path trimming.
169
+ /// Control path trimming.
169
170
trimmed_def_paths: TrimmedDefPaths [ TRACKED ] ,
170
171
171
- // Specifications of codegen units / ThinLTO which are forced as a
172
- // result of parsing command line options. These are not necessarily
173
- // what rustc was invoked with, but massaged a bit to agree with
174
- // commands like `--emit llvm-ir` which they're often incompatible with
175
- // if we otherwise use the defaults of rustc.
172
+ /// Specifications of codegen units / ThinLTO which are forced as a
173
+ /// result of parsing command line options. These are not necessarily
174
+ /// what rustc was invoked with, but massaged a bit to agree with
175
+ /// commands like `--emit llvm-ir` which they're often incompatible with
176
+ /// if we otherwise use the defaults of rustc.
176
177
cli_forced_codegen_units: Option <usize > [ UNTRACKED ] ,
177
178
cli_forced_thinlto_off: bool [ UNTRACKED ] ,
178
179
179
- // Remap source path prefixes in all output (messages, object files, debug, etc.).
180
+ /// Remap source path prefixes in all output (messages, object files, debug, etc.).
180
181
remap_path_prefix: Vec <( PathBuf , PathBuf ) > [ TRACKED_NO_CRATE_HASH ] ,
181
182
/// Base directory containing the `src/` for the Rust standard library, and
182
183
/// potentially `rustc` as well, if we can can find it. Right now it's always
@@ -189,11 +190,11 @@ top_level_options!(
189
190
190
191
edition: Edition [ TRACKED ] ,
191
192
192
- // `true` if we're emitting JSON blobs about each artifact produced
193
- // by the compiler.
193
+ /// `true` if we're emitting JSON blobs about each artifact produced
194
+ /// by the compiler.
194
195
json_artifact_notifications: bool [ TRACKED ] ,
195
196
196
- // `true` if we're emitting a JSON blob containing the unused externs
197
+ /// `true` if we're emitting a JSON blob containing the unused externs
197
198
json_unused_externs: bool [ UNTRACKED ] ,
198
199
199
200
pretty: Option <PpMode > [ UNTRACKED ] ,
@@ -212,7 +213,7 @@ macro_rules! options {
212
213
( $struct_name: ident, $setter_name: ident, $defaultfn: ident,
213
214
$buildfn: ident, $prefix: expr, $outputname: expr,
214
215
$stat: ident, $mod_desc: ident, $mod_set: ident,
215
- $( $opt: ident : $t: ty = (
216
+ $( $( # [ $attr : meta ] ) * $ opt: ident : $t: ty = (
216
217
$init: expr,
217
218
$parse: ident,
218
219
[ $dep_tracking_marker: ident] ,
@@ -223,7 +224,7 @@ macro_rules! options {
223
224
pub struct $struct_name { $( pub $opt: $t) ,* }
224
225
225
226
pub fn $defaultfn( ) -> $struct_name {
226
- $struct_name { $( $opt: $init) ,* }
227
+ $struct_name { $( $ ( # [ $attr ] ) * $opt: $init) ,* }
227
228
}
228
229
229
230
pub fn $buildfn( matches: & getopts:: Matches , error_format: ErrorOutputType ) -> $struct_name
@@ -1177,7 +1178,7 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
1177
1178
self_profile: SwitchWithOptPath = ( SwitchWithOptPath :: Disabled ,
1178
1179
parse_switch_with_opt_path, [ UNTRACKED ] ,
1179
1180
"run the self profiler and output the raw event data" ) ,
1180
- // keep this in sync with the event filter names in librustc_data_structures/profiling.rs
1181
+ /// keep this in sync with the event filter names in librustc_data_structures/profiling.rs
1181
1182
self_profile_events: Option <Vec <String >> = ( None , parse_opt_comma_list, [ UNTRACKED ] ,
1182
1183
"specify the events recorded by the self profiler;
1183
1184
for example: `-Z self-profile-events=default,query-keys`
@@ -1189,7 +1190,7 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
1189
1190
"show spans for compiler debugging (expr|pat|ty)" ) ,
1190
1191
span_debug: bool = ( false , parse_bool, [ UNTRACKED ] ,
1191
1192
"forward proc_macro::Span's `Debug` impl to `Span`" ) ,
1192
- // o/w tests have closure@path
1193
+ /// o/w tests have closure@path
1193
1194
span_free_formats: bool = ( false , parse_bool, [ UNTRACKED ] ,
1194
1195
"exclude spans when debug-printing compiler state (default: no)" ) ,
1195
1196
src_hash_algorithm: Option <SourceFileHashAlgorithm > = ( None , parse_src_file_hash, [ TRACKED ] ,
@@ -1210,10 +1211,10 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
1210
1211
"select processor to schedule for (`rustc --print target-cpus` for details)" ) ,
1211
1212
thinlto: Option <bool > = ( None , parse_opt_bool, [ TRACKED ] ,
1212
1213
"enable ThinLTO when possible" ) ,
1213
- // We default to 1 here since we want to behave like
1214
- // a sequential compiler for now. This'll likely be adjusted
1215
- // in the future. Note that -Zthreads=0 is the way to get
1216
- // the num_cpus behavior.
1214
+ /// We default to 1 here since we want to behave like
1215
+ /// a sequential compiler for now. This'll likely be adjusted
1216
+ /// in the future. Note that -Zthreads=0 is the way to get
1217
+ /// the num_cpus behavior.
1217
1218
threads: usize = ( 1 , parse_threads, [ UNTRACKED ] ,
1218
1219
"use a thread pool with N threads" ) ,
1219
1220
time: bool = ( false , parse_bool, [ UNTRACKED ] ,
0 commit comments