@@ -416,6 +416,8 @@ To allow the xor, we enforce that
416416- manifests must be passed in as ` Cargo.toml ` , ` foo.rs ` , or have a ` / ` in them
417417- no built-in command may look like an accepted manifest
418418
419+ When piping ` cargo <file>.rs ` , ` --quiet ` will be assumed.
420+
419421# Drawbacks
420422[ drawbacks ] : #drawbacks
421423
@@ -468,6 +470,18 @@ However
468470
469471Therefore, this RFC proposes we limit the scope of the new command to ` cargo run ` for single-file rust packages.
470472
473+ ## Misc
474+
475+ - Rejected: Defaulting to ` RUST_BACKTRACE=1 ` for ` cargo foo.rs ` runs
476+ - Enabling backtraces provides more context to problems, much like Python scripts, which helps with experiments
477+ - This comes at the cost of making things worse for scripts
478+ - Decided against it to minimize special casing
479+ - See also [ t-cargo zulip thread] ( https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/Smarter.20.60RUST_BACKTRACE.60.20behavior.3F )
480+ - The package name is slugified according the stricter ` cargo new ` validation
481+ rules, making it consistent across platforms as some names are invalid on
482+ some platforms
483+ - See [ rust-lang/cargo #12255 ] ( https://github.com/rust-lang/cargo/pull/12255 )
484+
471485## Naming
472486[ naming ] : #naming
473487
@@ -622,6 +636,8 @@ Benefits
622636Downsides
623637- People are likely to make mistakes in wrapping these in code fences when posting issues to github (this post originally had the code fence wrong)
624638
639+ See also [ t-lang zulup thread] ( https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/Embedding.20cargo.20manifests.20in.20rust.20source )
640+
625641** Alternative 1: Doc-comment**
626642
627643``` rust
@@ -877,6 +893,8 @@ Note: this is a reversible decision on an edition boundary
877893> with editions. If we learn this doesn't work as well as we want, this would
878894> allow us to switch to requiring the edition in the future.
879895
896+ See also [ t-cargo zulip thread] ( https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/cargo.20script.20and.20edition )
897+
880898** Alternative 1: No default but error**
881899
882900It is invalid for an embedded manifest to be missing ` edition ` , erroring when it is missing.
@@ -1135,17 +1153,6 @@ See also [Single-file scripts that download their dependencies](https://dbohdan.
11351153# Unresolved questions
11361154[ unresolved-questions ] : #unresolved-questions
11371155
1138- - Since single-file packages cannot be inferred and require an explicit
1139- ` --manifest-path ` , is there an alternative shorthand we should provide, like
1140- a short-flag for ` --manifest-path ` or a shorter, more targeted alias?
1141- - ` --script ` with ` -s ` or ` -S ` for a short flag, but is the meaning clear
1142- enough? What about in the context of multi-file packages taking advantage
1143- of it?
1144- - ` p ` is taken by ` --package `
1145- - ` -m ` , ` -M ` , and ` -P ` are available, but are the meanings clear enough?
1146- - Is there a way we could track what dependency versions have been built in the
1147- ` CARGO_TARGET_DIR ` and give preference to resolve to them, if possible.
1148-
11491156# Future possibilities
11501157[ future-possibilities ] : #future-possibilities
11511158
@@ -1155,6 +1162,55 @@ Note: we are assuming the following are **not** future possibilities in this des
11551162- Embedding ` rustup-toolchain.toml ` files
11561163- Embedding other source files or additional packages
11571164
1165+ ## Dealing with leaked ` target/ `
1166+
1167+ As ` target/ ` is out of sight, it is easy to "leak" them, eating up disk space.
1168+ Users would need to know to run ` cargo clean --manifest-path foo.rs ` before
1169+ deleting ` foo.rs ` or to just do ` rm -rf ~/.cargo/target ` and wipe everything
1170+ (since the specific target directory will be non-obvious).
1171+
1172+ In the future we can
1173+ [ track embedded manifests and garbage collect their ` target/ ` ] ( https://github.com/rust-lang/cargo/issues/12633 ) .
1174+
1175+ ## ` cargo new ` support
1176+
1177+ A ` cargo new <flag> foo.rs ` could generate a source file with an embedded manifest.
1178+
1179+ Questions
1180+ - Should we do this implicitly with the ` .rs ` extension?
1181+ - If we have a flag, what should we name it?
1182+
1183+ ## A shorter flag for ` --manifest-path `
1184+
1185+ Cargo users are used to the ` --manifest-path ` argument being inferred from
1186+ their current working directory but that doesn't work for embedded manifests.
1187+
1188+ It would be helpful if we had an alias for this argument to make it easier to
1189+ specify, whether it was a short word for a "short flag".
1190+
1191+ Options include
1192+ - ` --script ` with ` -s ` or ` -S ` for a short flag, but is the meaning clear
1193+ enough? What about in the context of multi-file packages taking advantage
1194+ of it?
1195+ - ` p ` is taken by ` --package `
1196+ - ` -m ` , ` -M ` , and ` -P ` are available, but are the meanings clear enough?
1197+
1198+ ## Cleaner output
1199+
1200+ ` cargo foo.rs ` is just a wrapper around ` cargo run --manifest-path foo.rs ` and cargo can be quite noisy.
1201+ The out-of-tree prototype for this instead ran `cargo run --quiet
1202+ --manifest-path foo.rs` but that was confusing as it is unclear when a long
1203+ execution time is from a slow compile or from the program.
1204+
1205+ In the future, we could try to find ways to better control cargo's output so at
1206+ least ` cargo foo.rs ` is less noisy but appears responsive.
1207+
1208+ See
1209+ [ t-cargo zulip thread] ( https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/Re-thinking.20cargo's.20output )
1210+ and [ rust-lang/cargo #8889 ] ( https://github.com/rust-lang/cargo/issues/8889 ) .
1211+
1212+ Note: ` --quiet ` is inferred when piping to a file ([ rust-lang/cargo #12305 ] ( https://github.com/rust-lang/cargo/pull/12305 ) )
1213+
11581214## Executing ` <stdin> `
11591215
11601216We could extend this to allow accepting single-file packages from stdin, either
0 commit comments