-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New behavior of --feature
+ --package
combination
#5364
Comments
#5362 is I think the manifestation of the old odd behavior. |
I think #4942 is also this issue. |
And #4753 as well |
This comment has been minimized.
This comment has been minimized.
--feature
+ --pacakge
combination--feature
+ --package
combination
This broke Servo unfortunately, so we probably would need to back this out, at least in this, maximally aggressive, form. However, I wonder what we plan to do with feature-selection problems in general? I assume that we want to eventually fix the main problem with features. Currently, features are global per compilation, and that means that features bleed from dev-deps to normal deps and that Fixing that, however, would be a breaking change: suddenly, Cargo would select a smaller set of features :-( But, if we do fix that, then behavior of the combination of The core question I think is do we feel comfortable with eventually changing the set of activated features? If we are, then I think we can modify current fix to not flatly error-out, but to ignore the features argument for several packages, printing a warning like "this was accepted in previous versions of Cargo and activated features in surprising way, and not it is ignored". |
Used to work. And expectation was "Enable the specified set of futures for crates that support it".
Now we see this (thanks to CI to catch it soon and not after Rust release) and it does not matter whether all of workspace members have How come that the original issue ( |
Not that this expectation is wrong. What actually happens is that the feature is enabled only for the package in the current working directory. In other words, it is irrelevant whether all members have the
That was definitely an oversight on my part :( |
Here's a small example which demonstrates the difference in behavior: https://github.com/matklad/features-behavior |
|
Revert "Enable new behavior of `--feature`" This reverts commit 038eec5. As discussed at #5364, the new behavior unfortunately causes real-life breakage, so we have to revert it. This is kinda sad, this is a part of the larger issue with feature selection, which, at the moment, has a behavior which I would classify (loosely speaking) as unsound: * `cargo build -p foo` and `cargo build -p foo -p bar` might produce different artifacts for `foo` ([repro](https://github.com/matklad/workspace-vs-feaures)) * `cargo build -p foo` might produce different artifacts, depending on cwd ([repro](https://github.com/matklad/features-cwd)) The new feature behavior specifically addressed the second point. It is unclear what we could do with this... One option, instead of flatly erroring out, as the revreted commit does, is to print a warning, but change the set of activated features. It will still be a breaking change, but it at least has a chance of working by accident. r? @alexcrichton
Breaking changes to stable functionality are not acceptable. Please revert and find a way to make this opt-in. However weird and subjectively broken the old behavior is, it has been around for more than long enough that many large projects have built work-arounds that came to rely on it. It’s easy to say this in hindsight, but I think it shouldn’t be surprising that a change like this is definitely gonna break some builds. #5390, the PR that enable this change by default, says:
At the time of that writing, that forum thread was 2 days old and had responses from three individuals, one of them saying their build is broken. How is this "positive" enough? But even if that discussion had received community-wide attention, breakage like this without opt-in is still unacceptable IMO. The projects most likely to be affected are those with complex build system that involve many crates. They may or may not be involved in the day-to-day development of Rust and Cargo. Now if we are going to make a change around feature selection, in addition to being opt-in (possibly through |
Because of this cargo bug |
This is incorrect. Breaking changes to stable functionality are acceptable if the functionality is broken, otherwise we couldn't ever fix any bugs if the behavior of the fix could be observed by current crates. The question that we have to resolve here is whether this functionality is broken or not. If it isn't broken, you are correct in that we cannot fix it. But if it is broken, we can fix it. Depending on the impact of the fix, we might have to warn first for a sufficiently long time before applying the fix, but fixing it is possible and does not require a new edition, although we could use one to implement the fix. Currently, when I have a workspace with a package
compiles |
For me, it would be enough to have something like:
Which behaves like:
|
|
I am making a proposal to change the behavior of The intent is to cover more use cases that people have expressed interest in, and to push this towards stabilization. The new behavior is summarized in the docs. Compared to the old
I think it is possible to stabilize the new behavior as-is except for the one backwards-incompatible change of |
@ehuss I like that proposal a lot! |
Notably, this should get us building and running uffd in Linux CI. It turns out to be a tremendous pain to enable a feature flag for just one crate within a workspace. The situation is [being addressed][1], but in the meantime I believe the best route forward is to just have uffd on by default for Linux. [1]: rust-lang/cargo#5364
Notably, this should get us building and running uffd in Linux CI. It turns out to be a tremendous pain to enable a feature flag for just one crate within a workspace. The situation is [being addressed][1], but in the meantime I believe the best route forward is to just have uffd on by default for Linux. [1]: rust-lang/cargo#5364
Notably, this should get us building and running uffd in Linux CI. It turns out to be a tremendous pain to enable a feature flag for just one crate within a workspace. The situation is [being addressed][1], but in the meantime I believe the best route forward is to just have uffd on by default for Linux. [1]: rust-lang/cargo#5364
Notably, this should get us building and running uffd in Linux CI. It turns out to be a tremendous pain to enable a feature flag for just one crate within a workspace. The situation is [being addressed][1], but in the meantime I believe the best route forward is to just have uffd on by default for Linux. [1]: rust-lang/cargo#5364
Notably, this should get us building and running uffd in Linux CI. It turns out to be a tremendous pain to enable a feature flag for just one crate within a workspace. The situation is [being addressed][1], but in the meantime I believe the best route forward is to just have uffd on by default for Linux. [1]: rust-lang/cargo#5364
Notably, this should get us building and running uffd in Linux CI. It turns out to be a tremendous pain to enable a feature flag for just one crate within a workspace. The situation is [being addressed][1], but in the meantime I believe the best route forward is to just have uffd on by default for Linux. [1]: rust-lang/cargo#5364
This adds the ability to add feature flags (e.g. `--features wasi-nn`) when compiling `wasmtime-bench-api` to allow benchmarking Wasmtime with WASI proposals included. Note that due to rust-lang/cargo#5364, these features are only available: - in the `crates/bench-api` directory, e.g. `pushd crates/bench-api; cargo build --features wasi-crypto` - or from the top-level project directory using `-Zpackage-features`, e.g. `OPENVINO_INSTALL_DIR=/opt/intel/openvino cargo +nightly build -p wasmtime-bench-api -Zpackage-features --features wasi-nn`
…2677) This adds the ability to add feature flags (e.g. `--features wasi-nn`) when compiling `wasmtime-bench-api` to allow benchmarking Wasmtime with WASI proposals included. Note that due to rust-lang/cargo#5364, these features are only available: - in the `crates/bench-api` directory, e.g. `pushd crates/bench-api; cargo build --features wasi-crypto` - or from the top-level project directory using `-Zpackage-features`, e.g. `OPENVINO_INSTALL_DIR=/opt/intel/openvino cargo +nightly build -p wasmtime-bench-api -Zpackage-features --features wasi-nn`
Docs: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#package-features
A tracking issue for #5353 and #5351. Historically,
--feature
and related flags applied to the current package, and not to the package, specified via--package
. This is a bug, but fixing it could break someone's code, so currently new behavior exists under-Z package-features
opt-in. We need to check if it breaks code in the wild to see what we should do next.The text was updated successfully, but these errors were encountered: