Skip to content
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

Can't build project with rustix dependency after loading project in IDE #10186

Open
Undin opened this issue Mar 1, 2023 · 10 comments
Open

Can't build project with rustix dependency after loading project in IDE #10186

Undin opened this issue Mar 1, 2023 · 10 comments
Labels
bug subsystem::project model Issues with setting up project structure and retrieving information about project from various tool

Comments

@Undin
Copy link
Member

Undin commented Mar 1, 2023

Environment

  • IntelliJ Rust plugin version: 0.4.189.5234-223
  • Rust toolchain version: 1.67.1 (d5a82bbd2 2023-02-07) x86_64-apple-darwin
  • IDE name and version: CLion 2022.3.2 (CL-223.8617.54)
  • Operating system: macOS 12.5.1
  • Macro expansion: enabled
  • Additional experimental features: org.rust.cargo.emulate.terminal, org.rust.macros.proc

Problem description

The problem is similar to #9880 - the plugin passes RUSTC_BOOTSTRAP=1 during build script evaluation to use --keep-going cargo option, it affects build scripts execution and incremental builds and as a result, you get

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

when you try to make actual building of the project

rustix as anyhow and thiserror try to build some rust code inside build script to check if some compiler feature is available or not but uses a slightly different approach, and #9901 fix doesn't work in its case

Steps to reproduce

Cargo.toml

[package]
name = "rust-project"
version = "0.1.0"
edition = "2021"

[dependencies]
rustix = "=0.36.8"

main.rs

fn main() {}
@Undin Undin added bug subsystem::project model Issues with setting up project structure and retrieving information about project from various tool labels Mar 1, 2023
@sunfishcode
Copy link

This may be due to a bug in rustix, which may be fixed by bytecodealliance/rustix#544. Could you test whether the problem still exists in rustix 0.36.9 or 0.37.1?

@flymonkey00
Copy link

This may be due to a bug in rustix, which may be fixed by bytecodealliance/rustix#544. Could you test whether the problem still exists in rustix 0.36.9 or 0.37.1?

I'm using 0.36.9, and got the same issue.
image

@vagetman
Copy link

vagetman commented Mar 9, 2023

Same for rustix 0.36.9

@kladd
Copy link

kladd commented Mar 12, 2023

Anecdotally, this Windows machine on 0.4.187 handles everything fine. Linux on the latest (0.4.189, I think?) encounters this. Patching rustix to various versions had no effect.

@rongcuid
Copy link

Same. I have to run cargo check before I open a project with IntelliJ, or else this happen and I have to clean it. I am on Mac OS

@sunfishcode
Copy link

Rustix depends on a build script in order to decide whether it can use types like OwnedFd in the standard library, or its own OwnedFd, because it supports an MSRV of 1.48. The symptoms of this bug have the appearance of the compiler version is changing without the build script being run to detect the new compiler's features. 0.36.9 added an extra check for whether the RUSTC environment variable changes, however since people are still seeing the problem, that appears insufficient.

@timethy
Copy link

timethy commented Mar 17, 2023

I managed to hack around this by:

  1. Preventing rustix recompilation when switching between IDE and terminal, see: Rustix recompiles every time switching between Intellij and CLI bytecodealliance/rustix#562
  2. First building everything in the terminal, before syncing the project in CLion/IntelliJ

It seems to me that intellij-rust is passing a bad (combination of) flags to rustc that triggers the above.

@aldanor
Copy link

aldanor commented Mar 17, 2023

Same here; switching back to intellij seems to wrongfully switch to nightly every time. Have to go back to the terminal, cargo clean and rebuild.

@vlad20012
Copy link
Member

@vlad20012
Copy link
Member

I can confirm the issue is not reproducible with rustix = "0.37.1".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug subsystem::project model Issues with setting up project structure and retrieving information about project from various tool
Projects
None yet
Development

No branches or pull requests

9 participants