@@ -21,7 +21,9 @@ fn emit(directive: &str, value: impl Display) {
21
21
}
22
22
23
23
/// The `rerun-if-changed` instruction tells Cargo to re-run the build script if the
24
- /// file at the given path has changed. Currently, Cargo only uses the filesystem
24
+ /// file at the given path has changed.
25
+ ///
26
+ /// Currently, Cargo only uses the filesystem
25
27
/// last-modified “mtime” timestamp to determine if the file has changed. It
26
28
/// compares against an internal cached timestamp of when the build script last ran.
27
29
///
@@ -70,6 +72,7 @@ pub fn rerun_if_env_changed(key: impl AsRef<OsStr>) {
70
72
/// The `rustc-link-arg` instruction tells Cargo to pass the
71
73
/// [`-C link-arg=FLAG` option][link-arg] to the compiler, but only when building
72
74
/// supported targets (benchmarks, binaries, cdylib crates, examples, and tests).
75
+ ///
73
76
/// Its usage is highly platform specific. It is useful to set the shared library
74
77
/// version or linker script.
75
78
///
@@ -84,7 +87,9 @@ pub fn rustc_link_arg(flag: &str) {
84
87
85
88
/// The `rustc-link-arg-bin` instruction tells Cargo to pass the
86
89
/// [`-C link-arg=FLAG` option][link-arg] to the compiler, but only when building
87
- /// the binary target with name `BIN`. Its usage is highly platform specific. It
90
+ /// the binary target with name `BIN`. Its usage is highly platform specific.
91
+ ///
92
+ /// It
88
93
/// is useful to set a linker script or other linker options.
89
94
///
90
95
/// [link-arg]: https://doc.rust-lang.org/rustc/codegen-options/index.html#link-arg
@@ -101,7 +106,9 @@ pub fn rustc_link_arg_bin(bin: &str, flag: &str) {
101
106
102
107
/// The `rustc-link-arg-bins` instruction tells Cargo to pass the
103
108
/// [`-C link-arg=FLAG` option][link-arg] to the compiler, but only when building
104
- /// the binary target. Its usage is highly platform specific. It is useful to set
109
+ /// the binary target.
110
+ ///
111
+ /// Its usage is highly platform specific. It is useful to set
105
112
/// a linker script or other linker options.
106
113
///
107
114
/// [link-arg]: https://doc.rust-lang.org/rustc/codegen-options/index.html#link-arg
@@ -147,7 +154,9 @@ pub fn rustc_link_arg_benches(flag: &str) {
147
154
}
148
155
149
156
/// The `rustc-link-lib` instruction tells Cargo to link the given library using
150
- /// the compiler’s [`-l` flag][-l]. This is typically used to link a native library
157
+ /// the compiler’s [`-l` flag][-l].
158
+ ///
159
+ /// This is typically used to link a native library
151
160
/// using [FFI].
152
161
///
153
162
/// The `LIB` string is passed directly to rustc, so it supports any syntax that
@@ -229,7 +238,9 @@ pub fn rustc_link_search_kind(kind: &str, path: impl AsRef<Path>) {
229
238
}
230
239
231
240
/// The `rustc-flags` instruction tells Cargo to pass the given space-separated
232
- /// flags to the compiler. This only allows the `-l` and `-L` flags, and is
241
+ /// flags to the compiler.
242
+ ///
243
+ /// This only allows the `-l` and `-L` flags, and is
233
244
/// equivalent to using [`rustc_link_lib`] and [`rustc_link_search`].
234
245
#[ track_caller]
235
246
pub fn rustc_flags ( flags : & str ) {
@@ -240,7 +251,9 @@ pub fn rustc_flags(flags: &str) {
240
251
}
241
252
242
253
/// The `rustc-cfg` instruction tells Cargo to pass the given value to the
243
- /// [`--cfg` flag][cfg] to the compiler. This may be used for compile-time
254
+ /// [`--cfg` flag][cfg] to the compiler.
255
+ ///
256
+ /// This may be used for compile-time
244
257
/// detection of features to enable conditional compilation.
245
258
///
246
259
/// Note that this does not affect Cargo’s dependency resolution. This cannot
@@ -264,7 +277,9 @@ pub fn rustc_cfg(key: &str) {
264
277
emit ( "rustc-cfg" , key) ;
265
278
}
266
279
267
- /// Like [`rustc_cfg`], but with the value specified separately. To replace the
280
+ /// Like [`rustc_cfg`], but with the value specified separately.
281
+ ///
282
+ /// To replace the
268
283
/// less convenient `rustc_cfg(r#"my_component="foo""#)`, you can instead use
269
284
/// `rustc_cfg_value("my_component", "foo")`.
270
285
#[ track_caller]
@@ -342,7 +357,9 @@ pub fn rustc_check_cfg_values(key: &str, values: &[&str]) {
342
357
}
343
358
344
359
/// The `rustc-env` instruction tells Cargo to set the given environment variable
345
- /// when compiling the package. The value can be then retrieved by the
360
+ /// when compiling the package.
361
+ ///
362
+ /// The value can be then retrieved by the
346
363
/// [`env!` macro][env!] in the compiled crate. This is useful for embedding
347
364
/// additional metadata in crate’s code, such as the hash of git HEAD or the
348
365
/// unique identifier of a continuous integration server.
@@ -363,7 +380,9 @@ pub fn rustc_env(key: &str, value: &str) {
363
380
364
381
/// The `rustc-cdylib-link-arg` instruction tells Cargo to pass the
365
382
/// [`-C link-arg=FLAG` option][link-arg] to the compiler, but only when building
366
- /// a `cdylib` library target. Its usage is highly platform specific. It is useful
383
+ /// a `cdylib` library target.
384
+ ///
385
+ /// Its usage is highly platform specific. It is useful
367
386
/// to set the shared library version or the runtime-path.
368
387
///
369
388
/// [link-arg]: https://doc.rust-lang.org/rustc/codegen-options/index.html#link-arg
@@ -376,7 +395,9 @@ pub fn rustc_cdylib_link_arg(flag: &str) {
376
395
}
377
396
378
397
/// The `warning` instruction tells Cargo to display a warning after the build
379
- /// script has finished running. Warnings are only shown for path dependencies
398
+ /// script has finished running.
399
+ ///
400
+ /// Warnings are only shown for path dependencies
380
401
/// (that is, those you’re working on locally), so for example warnings printed
381
402
/// out in [crates.io] crates are not emitted by default. The `-vv` “very verbose”
382
403
/// flag may be used to have Cargo display warnings for all crates.
0 commit comments