@@ -1385,7 +1385,7 @@ Valid operations are the following:
1385
1385
1386
1386
Cargo can directly run ` .rs ` files as:
1387
1387
``` console
1388
- $ cargo -Zscript file.rs
1388
+ $ cargo +nightly -Zscript file.rs
1389
1389
```
1390
1390
where ` file.rs ` can be as simple as:
1391
1391
``` rust
@@ -1423,6 +1423,9 @@ files), we are adding the concept of single-file packages which may contain an
1423
1423
embedded manifest. There is no required distinguishment for a single-file
1424
1424
` .rs ` package from any other ` .rs ` file.
1425
1425
1426
+ Single-file packages may be selected via ` --manifest-path ` , like
1427
+ ` cargo test --manifest-path foo.rs ` . Unlike ` Cargo.toml ` , these files cannot be auto-discovered.
1428
+
1426
1429
A single-file package may contain an embedded manifest. An embedded manifest
1427
1430
is stored using ` TOML ` in a markdown code-fence with ` cargo ` at the start of the
1428
1431
infostring inside a target-level doc-comment. It is an error to have multiple
@@ -1448,18 +1451,16 @@ Inferred / defaulted manifest fields:
1448
1451
later add support for including them in a workspace.
1449
1452
- ` package.edition = <current> ` to avoid always having to add an embedded
1450
1453
manifest at the cost of potentially breaking scripts on rust upgrades
1451
- - Warn when ` edition ` is unspecified. While with single-file packages this will be
1452
- silenced by default, users wanting stability are also likely to be using
1453
- other commands, like ` cargo test ` and will see it.
1454
+ - Warn when ` edition ` is unspecified to raise awareness of this
1454
1455
1455
1456
Disallowed manifest fields:
1456
1457
- ` [workspace] ` , ` [lib] ` , ` [[bin]] ` , ` [[example]] ` , ` [[test]] ` , ` [[bench]] `
1457
1458
- ` package.workspace ` , ` package.build ` , ` package.links ` , ` package.autobins ` , ` package.autoexamples ` , ` package.autotests ` , ` package.autobenches `
1458
1459
1459
- As the primary role for these files is exploratory programming which has a high
1460
- edit-to-run ratio, building should be fast. Therefore ` CARGO_TARGET_DIR ` will
1461
- be shared between single-file packages to allow reusing intermediate build
1462
- artifacts.
1460
+ The default ` CARGO_TARGET_DIR ` for single-file packages is at ` $CARGO_HOME/target/<hash> ` :
1461
+ - Avoid conflicts from multiple single-file packages being in the same directory
1462
+ - Avoid problems with the single-file package's parent directory being read-only
1463
+ - Avoid cluttering the user's directory
1463
1464
1464
1465
The lockfile for single-file packages will be placed in ` CARGO_TARGET_DIR ` . In
1465
1466
the future, when workspaces are supported, that will allow a user to have a
0 commit comments