Comments (5)
FWIW, I tried to remove the macro by implementing Deref/DerefMut<Target=Command>
for the wrappers instead. It would have worked.. were it not for the builder pattern :) Because if we implement the helper functions (like env
) on Command
directly, then they have to return &mut Self
, which means that you would have to use all of the top-level command wrapper methods before using any of the Command
methods, which is annoying. For example, rustc().crate_type().env()
would work, but rustc().env().crate_type()
wouldn't work, because env()
would return Command
, and not Rustc
.
I'm not aware of any way of resolving this without using a macro. That being said, I think that the current macro is fine, it just adds a bunch of methods, and does not have any specific requirements on the wrapper apart from having a cmd
field. The documentation needs to be updated though (#126188).
from rust.
I'm going to close this issue, because I think using a trait here unfortunately just makes the API worse.
from rust.
Drawback: test writer would need to bring the trait into scope to use the helper methods...
from rust.
There could be inherent methods that simply forward to the trait methods. That's more boilerplate though.
from rust.
We don't need command_output
on each wrapper struct anymore as of #126121. I don't think that a trait pulls its weight here, due the tests having to import it (it's a bit annoying since run-make tests are typically not very friendly with IDEs). It would be nice to remove the macro, but we can do that also with other approaches than a trait (e.g. Deref
).
from rust.
Related Issues (20)
- ICE: `errors selecting obligation during MIR typeck: [TrueError]` HOT 1
- Apple deployment target, SDK root and SDK version
- LLVM's peephole-opt pass shreds debug info for aggregate types
- Tracking Issue for `string_from_utf8_lossy_owned`
- Stop using "Hack to avoid function merging"
- Debugging rust compiler with lldb, unable to display variables HOT 2
- Compile error with type mismatch in `Fn() -> !` HOT 4
- ICE: coherence: `did not expect successful goal when collecting ambiguity errors` HOT 1
- Decide whether we want MSRV-gating HOT 5
- Should debuginfo special-case vectors?
- Negative UI test error annotations HOT 2
- Remove time-boxed `time` inference regression mitigation note HOT 1
- ICE when combining `asm_const` and `const_refs_to_static` HOT 1
- The `#[pointee]` attribute is required even if there is only one generic parameter HOT 2
- `repr_transparent_external_private_fields` lint fires on `ManuallyDrop` containing a ZST HOT 1
- f16 usage triggers a compiler internal error, despite good error messages HOT 1
- Confusing Error when accidentally constructing a type alias with array of fixed size for struct that is generic over an array size HOT 1
- Unstable Feature Usage Metrics
- Wasm ABI special cases scalar pairs (against tool conventions) and is not documented HOT 11
- HWasan with external clang runtime (undefined symbol: __hwasan_tls) HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rust.