rustix icon indicating copy to clipboard operation
rustix copied to clipboard

Intermittent "feature cannot be used on stable release channel"

Open jyn514 opened this issue 2 years ago • 19 comments

I temporarily got this error trying to build rustix as a dependency:

error[E0554]: `#![feature]` may not be used on the stable release channel
--> /Users/jyn/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/rustix-0.36.4/src/lib.rs:99:26
   |
99 | #![cfg_attr(rustc_attrs, feature(rustc_attrs))]
   |                          ^^^^^^^^^^^^^^^^^^^^

I have unfortunately not been able to reproduce this error; I updated the version of rustix, which I originally thought fixed the issue, but when I downgraded to 0.36.4 I couldn't reproduce it again.

I think the build script needs to have rerun-if-env-changed=RUSTC or something like that? If it helps, my default toolchain is nightly but I have a rust-toolchain file that says to use 1.65.

jyn514 avatar Jan 25 '23 16:01 jyn514

cc https://github.com/rust-lang/cargo/issues/10367

jyn514 avatar Jan 25 '23 16:01 jyn514

FWIW running rm -rf target to delete the cache fixed this issue for me.

intgr avatar Jan 30 '23 17:01 intgr

I have this very error popping in my various projects (95% of the time related to rustix). A simple cargo clean is a fix, but it forces me to fully recompile big projects, which is slightly annoying.

Sometimes just adding a new dependency to my projects triggers it.

p-kraszewski avatar Feb 24 '23 09:02 p-kraszewski

I submitted https://github.com/bytecodealliance/rustix/pull/544 in hopes that it may help. However, I don't yet have a reliable way to reproduce the problem locally, so I can't say for sure whether it does.

sunfishcode avatar Feb 24 '23 14:02 sunfishcode

I have this very error popping in my various projects (95% of the time related to rustix). A simple cargo clean is a fix, but it forces me to fully recompile big projects, which is slightly annoying.

@p-kraszewski as a workaround, you can use cargo clean -p rustix to only recompile rustix instead of all your dependencies

jyn514 avatar Feb 24 '23 15:02 jyn514

#544, which may fix this, is now released in version 0.37.

sunfishcode avatar Mar 03 '23 17:03 sunfishcode

Does anyone who encountered this issue continue to see it with 0.37, or 0.36.11?

sunfishcode avatar Mar 29 '23 13:03 sunfishcode

Not encountered within at least the last 2 weeks. Thank you.

p-kraszewski avatar Mar 29 '23 14:03 p-kraszewski

just encountered it with rustix 0.37.7

mschneider avatar Apr 08 '23 14:04 mschneider

@mschneider Could you say which codebase you encountered in it, whether you use an IDE or a tool like cargo-watch, and anything special about your build configuration that might be applicable?

sunfishcode avatar Apr 08 '23 14:04 sunfishcode

The repo is: https://github.com/blockworks-foundation/mango-simulation I ran cargo build lastly on https://github.com/blockworks-foundation/mango-simulation/commit/5bea7236cb63f034c7f7c8877c13c1b4e5d27fc4 (you might not be able to repro this one, because someone force pushed a git branch linked as dependency so cargo won't be able to resolve to the cargo locked commit) then ran cargo update -p mango-feeds-connector to fix the above issue, and then ran cargo build, which presented me with the above error message

Then rm -rfed the target directory and ran build again and everything is working now.

I do use visual studio code with rust-analyzer, which is usually very aggressive in running cargo check

mschneider avatar Apr 08 '23 15:04 mschneider

@mschneider Have you seen any instances of this problem since your initial report here?

sunfishcode avatar Jun 17 '23 00:06 sunfishcode

I just saw an instance of the same issue with rustix v0.37.20. rm -rf target fixed it, but I'm not sure how to reproduce. Might have been related to me starting a build simultaneously from the command line and from inside vscode with rust-analyzer.

Luthaf avatar Jun 30 '23 15:06 Luthaf

Encountered this with rustix-0.38.4

JohnDowson avatar Jul 26 '23 11:07 JohnDowson

This did also happen to me on 0.37.24. The only thing I did was a cargo update followed by a cargo clippy. As mentioned above doing cargo clean -p rustix solved the issue.

ynhame avatar Oct 03 '23 03:10 ynhame

Encountered this with rustix-0.38.4.

Here is a partial cargo tree of my project indicating which of my dependencies are using this package:

[corporate project]
├── reqwest v0.11.20
│   ├── hyper-tls v0.5.0
│   │   ├── native-tls v0.2.11
│   │   │   └── tempfile v3.7.0
│   │   │       └── rustix v0.38.4
└── [corporate private module]
    ├── criterion v0.5.1
    │   ├── is-terminal v0.4.9
    │   │   └── rustix v0.38.4 (*)

ptdecker avatar Oct 04 '23 23:10 ptdecker

Ran into this issue with rustix 0.37.23 – after a fresh install. Fixed by running: cargo clean -p rustix

benjaminleonard avatar Oct 10 '23 16:10 benjaminleonard

Encountered this with rustix 0.37.27, cargo clean and deleting the target directory does not fix it for me. This only happens on rust analyzer for some reason (yes I did restart the server and vs code too), compiling from the command line works perfectly fine.

theRookieCoder avatar Feb 20 '24 14:02 theRookieCoder

This seems unrelated to rust-analyzer itself, the thing is, using stable rust a project referencing rustix will fail with this error on cargo check (or cargo clippy), but build fine w/o errors on cargo build. Strange.

spitfire05 avatar Feb 20 '24 14:02 spitfire05