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

[Bug]: cargo marker setup --auto-install-toolchain fails with E0554 #[feature] on stable channel #318

Closed
xFrednet opened this issue Nov 23, 2023 · 14 comments · Fixed by #319
Labels
A-marker-cargo Area: All things connected to `cargo_marker` C-bug Category: Something isn't working D-rustc-driver Driver: Rustc Driver S-needs-triage Status: This issue needs triage

Comments

@xFrednet
Copy link
Member

Summary

I've extracted this error from trailofbits/dylint#839, there it was reported by @tigerros

@xFrednet Yes, I want to make something like Clippy, just for a specific framework. I think Marker will do nicely. I'm having some issues with installation though. I get this output when running cargo marker setup --auto-install-toolchain. I have rustc, rustc-dev and llvm-tools installed.

Reproducer

No response

Version

Marker v0.4

Logs

> cargo marker setup --auto-install-toolchain
> info: syncing channel updates for 'nightly-2023-10-05-x86_64-pc-windows-msvc'
> 724.5 KiB / 724.5 KiB (100 %) 573.5 KiB/s in  1s ETA:  0s
> info: latest update on 2023-10-05, rust version 1.75.0-nightly (2bbb61989 2023-10-04)
> info: component 'llvm-tools' for target 'x86_64-pc-windows-msvc' is up to date
> info: component 'rustc-dev' for target 'x86_64-pc-windows-msvc' is up to date
> 
>   nightly-2023-10-05-x86_64-pc-windows-msvc unchanged - rustc 1.75.0-nightly (2bbb61989 2023-10-04)
> 
> info: checking for self-update
> 
>       Marker compiling rustc driver v0.4.0 with nightly-2023-10-05
>     Updating crates.io index
>   Installing marker_rustc_driver v0.4.0
>     Updating crates.io index
>    Compiling proc-macro2 v1.0.69
>    Compiling unicode-ident v1.0.12
>    Compiling windows_x86_64_msvc v0.48.5
>    Compiling cfg-if v1.0.0
>    Compiling once_cell v1.18.0
>    Compiling cc v1.0.83
>    Compiling winapi v0.3.9
>    Compiling thiserror v1.0.50
>    Compiling rustc-demangle v0.1.23
>    Compiling lazy_static v1.4.0
>    Compiling tracing-core v0.1.32
>    Compiling sharded-slab v0.1.7
>    Compiling windows-targets v0.48.5
>    Compiling thread_local v1.1.7
>    Compiling windows-sys v0.48.0
>    Compiling quote v1.0.33
>    Compiling serde v1.0.193
>    Compiling pin-project-lite v0.2.13
>    Compiling syn v2.0.39
>    Compiling unicode-linebreak v0.1.5
>    Compiling is_ci v1.1.1
>    Compiling smawk v0.3.2
>    Compiling unicode-width v0.1.11
>    Compiling tracing v0.1.40
>    Compiling backtrace v0.3.69
>    Compiling textwrap v0.15.2
>    Compiling tracing-subscriber v0.3.18
>    Compiling is-terminal v0.4.9
>    Compiling terminal_size v0.1.17
>    Compiling supports-unicode v2.0.0
>    Compiling supports-color v2.1.0
>    Compiling supports-hyperlinks v2.1.0
>    Compiling camino v1.1.6
>    Compiling owo-colors v3.5.0
>    Compiling either v1.9.0
>    Compiling backtrace-ext v0.2.1
>    Compiling tracing-error v0.2.0
>    Compiling rustc_tools_util v0.3.0
>    Compiling yansi v1.0.0-rc.1
>    Compiling itertools v0.11.0
>    Compiling marker_rustc_driver v0.4.0
>    Compiling libloading v0.8.1
>    Compiling bumpalo v3.14.0
>    Compiling typed-builder-macro v0.16.2
>    Compiling thiserror-impl v1.0.50
>    Compiling miette-derive v5.10.0
>    Compiling serde_derive v1.0.193
>    Compiling visibility v0.1.0
>    Compiling typed-builder v0.16.2
>    Compiling marker_api v0.4.0
>    Compiling miette v5.10.0
>    Compiling marker_error v0.4.0
>    Compiling marker_utils v0.4.0
>    Compiling marker_adapter v0.4.0
> error[E0554]: `#![feature]` may not be used on the stable release channel
>  --> C:\Users\aurel\.cargo\registry\src\index.crates.io-6f17d22bba15001f\marker_rustc_driver-0.4.0\src\lib.rs:2:1
>   |
> 2 | #![feature(rustc_private)]
>   | ^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> error[E0554]: `#![feature]` may not be used on the stable release channel
>  --> C:\Users\aurel\.cargo\registry\src\index.crates.io-6f17d22bba15001f\marker_rustc_driver-0.4.0\src\lib.rs:3:1
>   |
> 3 | #![feature(let_chains)]
>   | ^^^^^^^^^^^^^^^^^^^^^^^
> 
> error[E0554]: `#![feature]` may not be used on the stable release channel
>  --> C:\Users\aurel\.cargo\registry\src\index.crates.io-6f17d22bba15001f\marker_rustc_driver-0.4.0\src\lib.rs:4:1
>   |
> 4 | #![feature(lint_reasons)]
>   | ^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> error[E0554]: `#![feature]` may not be used on the stable release channel
>  --> C:\Users\aurel\.cargo\registry\src\index.crates.io-6f17d22bba15001f\marker_rustc_driver-0.4.0\src\lib.rs:5:1
>   |
> 5 | #![feature(iter_collect_into)]
>   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> error[E0554]: `#![feature]` may not be used on the stable release channel
>  --> C:\Users\aurel\.cargo\registry\src\index.crates.io-6f17d22bba15001f\marker_rustc_driver-0.4.0\src\lib.rs:6:1
>   |
> 6 | #![feature(non_exhaustive_omitted_patterns_lint)]
>   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> error[E0554]: `#![feature]` may not be used on the stable release channel
>  --> C:\Users\aurel\.cargo\registry\src\index.crates.io-6f17d22bba15001f\marker_rustc_driver-0.4.0\src\lib.rs:7:1
>   |
> 7 | #![feature(once_cell_try)]
>   | ^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> error[E0554]: `#![feature]` may not be used on the stable release channel
>  --> C:\Users\aurel\.cargo\registry\src\index.crates.io-6f17d22bba15001f\marker_rustc_driver-0.4.0\src\lib.rs:5:12
>   |
> 5 | #![feature(iter_collect_into)]
>   |            ^^^^^^^^^^^^^^^^^
> 
> error[E0554]: `#![feature]` may not be used on the stable release channel
>  --> C:\Users\aurel\.cargo\registry\src\index.crates.io-6f17d22bba15001f\marker_rustc_driver-0.4.0\src\lib.rs:7:12
>   |
> 7 | #![feature(once_cell_try)]
>   |            ^^^^^^^^^^^^^
> 
> For more information about this error, try `rustc --explain E0554`.
> error: could not compile `marker_rustc_driver` (lib) due to 8 previous errors
> warning: build failed, waiting for other jobs to finish...
> error: failed to compile `marker_rustc_driver v0.4.0`, intermediate artifacts can be found at `C:\Users\aurel\AppData\Local\Temp\cargo-installQlgqm7`.
> To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
>   x Failed to build the custom marker rustc driver
>   help: Make sure that you have the rustc-dev and llvm-tools components installed.
>         Try running the following command:
>         cargo marker setup --auto-install-toolchain
> 
>         or:
>         rustup toolchain install {toolchain} --component rustc-dev llvm-tools
@xFrednet xFrednet added C-bug Category: Something isn't working A-marker-cargo Area: All things connected to `cargo_marker` D-rustc-driver Driver: Rustc Driver S-needs-triage Status: This issue needs triage labels Nov 23, 2023
@xFrednet
Copy link
Member Author

@tigerros Thank you for the report. Could you maybe run the command again with more logging enabled like this:

MARKER_ERROR_TRACE=1 MARKER_LOG=info cargo marker setup --auto-install-toolchain

In the meantime, I would recommend to use our installation script to download the precompiled binaries. This will install cargo-marker and the required driver:

curl.exe -fsSL https://raw.githubusercontent.com/rust-marker/marker/v0.4/scripts/release/install.ps1 | powershell -command -

cc: @Veetaha Looking at this, we probably want to test cargo install also in our CI and not just the install scripts 🤔

@xFrednet xFrednet changed the title [Bug]: E0554 #[feature] on stable channel with [Bug]: cargo marker setup --auto-install-toolchain fails with E0554 #[feature] on stable channel Nov 23, 2023
@tigerros
Copy link

tigerros commented Nov 24, 2023

@xFrednet Sorry for not replying sooner. I'm a little confused... I ran the command again and it didn't fail, but then I cleaned both the lint crate (the template) and the crate that's using the lints (empty stable project), and it failed with the same log. However, then I ran cargo marker and it compiled fine and I got the "hello, main" lint.

Error log
2023-11-24T16:51:41.544332Z  INFO cli: ❱ cargo locate-project "--color=always" --workspace
2023-11-24T16:51:41.606825Z  INFO cli: ❱ rustup toolchain install nightly-2023-10-05 --component rustc-dev llvm-tools
info: syncing channel updates for 'nightly-2023-10-05-x86_64-pc-windows-msvc'
info: latest update on 2023-10-05, rust version 1.75.0-nightly (2bbb61989 2023-10-04)
info: component 'llvm-tools' for target 'x86_64-pc-windows-msvc' is up to date
info: component 'rustc-dev' for target 'x86_64-pc-windows-msvc' is up to date 

  nightly-2023-10-05-x86_64-pc-windows-msvc unchanged - rustc 1.75.0-nightly (2bbb61989 2023-10-04)

info: checking for self-update
2023-11-24T16:51:42.224620Z  INFO cli: ❱ rustup which --toolchain nightly-2023-10-05 cargo
2023-11-24T16:51:42.238505Z  INFO cargo_marker::backend::toolchain: Found the tool tool=cargo toolchain=nightly-2023-10-05 path=C:\Users\aurel\.rustup\toolchains\nightly-2023-10-05-x86_64-pc-windows-ms
vc\bin\cargo.exe

      Marker compiling rustc driver v0.4.0 with nightly-2023-10-05
2023-11-24T16:51:42.239400Z  INFO cli: ❱ rustup which --toolchain nightly-2023-10-05 cargo
2023-11-24T16:51:42.251834Z  INFO cargo_marker::backend::toolchain: Found the tool tool=cargo toolchain=nightly-2023-10-05 path=C:\Users\aurel\.rustup\toolchains\nightly-2023-10-05-x86_64-pc-windows-ms
vc\bin\cargo.exe
2023-11-24T16:51:42.252152Z  INFO cli: ❱ MARKER_ALLOW_DRIVER_BUILD=1 RUSTFLAGS=" --cap-lints=allow" RUSTUP_TOOLCHAIN=nightly-2023-10-05 cargo install marker_rustc_driver --version 0.4.0 --force --root 
"C:\\Users\\aurel\\.rustup\\toolchains\\nightly-2023-10-05-x86_64-pc-windows-msvc" --no-track
    Updating crates.io index
  Installing marker_rustc_driver v0.4.0
    Updating crates.io index
   Compiling proc-macro2 v1.0.69
   Compiling unicode-ident v1.0.12
   Compiling windows_x86_64_msvc v0.48.5
   Compiling once_cell v1.18.0
   Compiling cfg-if v1.0.0
   Compiling cc v1.0.83
   Compiling winapi v0.3.9
   Compiling thiserror v1.0.50
   Compiling rustc-demangle v0.1.23
   Compiling lazy_static v1.4.0
   Compiling tracing-core v0.1.32
   Compiling thread_local v1.1.7
   Compiling sharded-slab v0.1.7
   Compiling windows-targets v0.48.5
   Compiling windows-sys v0.48.0
   Compiling serde v1.0.193
   Compiling quote v1.0.33
   Compiling syn v2.0.39
   Compiling pin-project-lite v0.2.13
   Compiling unicode-linebreak v0.1.5
   Compiling is_ci v1.1.1
   Compiling smawk v0.3.2
   Compiling unicode-width v0.1.11
   Compiling tracing v0.1.40
   Compiling tracing-subscriber v0.3.18
   Compiling textwrap v0.15.2
   Compiling is-terminal v0.4.9
   Compiling backtrace v0.3.69
   Compiling terminal_size v0.1.17
   Compiling supports-hyperlinks v2.1.0
   Compiling supports-unicode v2.0.0
   Compiling supports-color v2.1.0
   Compiling owo-colors v3.5.0
   Compiling camino v1.1.6
   Compiling either v1.9.0
   Compiling backtrace-ext v0.2.1
   Compiling tracing-error v0.2.0
   Compiling yansi v1.0.0-rc.1
   Compiling rustc_tools_util v0.3.0
   Compiling itertools v0.11.0
   Compiling marker_rustc_driver v0.4.0
   Compiling libloading v0.8.1
   Compiling bumpalo v3.14.0
   Compiling thiserror-impl v1.0.50
   Compiling typed-builder-macro v0.16.2
   Compiling serde_derive v1.0.193
   Compiling miette-derive v5.10.0
   Compiling visibility v0.1.0
   Compiling typed-builder v0.16.2
   Compiling marker_api v0.4.0
   Compiling miette v5.10.0
   Compiling marker_error v0.4.0
   Compiling marker_utils v0.4.0
   Compiling marker_adapter v0.4.0
error[E0554]: `#![feature]` may not be used on the stable release channel
 --> C:\Users\aurel\.cargo\registry\src\index.crates.io-6f17d22bba15001f\marker_rustc_driver-0.4.0\src\lib.rs:2:1
  |
2 | #![feature(rustc_private)]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0554]: `#![feature]` may not be used on the stable release channel
 --> C:\Users\aurel\.cargo\registry\src\index.crates.io-6f17d22bba15001f\marker_rustc_driver-0.4.0\src\lib.rs:3:1
  |
3 | #![feature(let_chains)]
  | ^^^^^^^^^^^^^^^^^^^^^^^

error[E0554]: `#![feature]` may not be used on the stable release channel
 --> C:\Users\aurel\.cargo\registry\src\index.crates.io-6f17d22bba15001f\marker_rustc_driver-0.4.0\src\lib.rs:4:1
  |
4 | #![feature(lint_reasons)]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0554]: `#![feature]` may not be used on the stable release channel
 --> C:\Users\aurel\.cargo\registry\src\index.crates.io-6f17d22bba15001f\marker_rustc_driver-0.4.0\src\lib.rs:5:1
  |
5 | #![feature(iter_collect_into)]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0554]: `#![feature]` may not be used on the stable release channel
 --> C:\Users\aurel\.cargo\registry\src\index.crates.io-6f17d22bba15001f\marker_rustc_driver-0.4.0\src\lib.rs:6:1
  |
6 | #![feature(non_exhaustive_omitted_patterns_lint)]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0554]: `#![feature]` may not be used on the stable release channel
 --> C:\Users\aurel\.cargo\registry\src\index.crates.io-6f17d22bba15001f\marker_rustc_driver-0.4.0\src\lib.rs:7:1
  |
7 | #![feature(once_cell_try)]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0554]: `#![feature]` may not be used on the stable release channel
 --> C:\Users\aurel\.cargo\registry\src\index.crates.io-6f17d22bba15001f\marker_rustc_driver-0.4.0\src\lib.rs:5:12
  |
5 | #![feature(iter_collect_into)]
  |            ^^^^^^^^^^^^^^^^^

error[E0554]: `#![feature]` may not be used on the stable release channel
 --> C:\Users\aurel\.cargo\registry\src\index.crates.io-6f17d22bba15001f\marker_rustc_driver-0.4.0\src\lib.rs:7:12
  |
7 | #![feature(once_cell_try)]
  |            ^^^^^^^^^^^^^
For more information about this error, try `rustc --explain E0554`.
error: could not compile `marker_rustc_driver` (lib) due to 8 previous errors
warning: build failed, waiting for other jobs to finish...
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
  x Failed to build the custom marker rustc driver
  | Backtrace:
  |    0: 
  |    1: 
  |    2: 
  |    3: 
  |    4: 
  |    5: 
  |    6: 
  |    7: 
  |    8: 
  |    9: 
  |   10: BaseThreadInitThunk
  |   11: RtlUserThreadStart
  |
  | ⚠️  Spantrace wasn't captured. It may be expected if the error happened outside of any spans, or those spans were not enabled. You may
  | try capturing it by enabling tracing logging or increasing its level via MARKER_LOG env variable in cargo-marker. Spantrace capturing
  | in marker_rustc_driver isn't supported yet.
  help: Make sure that you have the rustc-dev and llvm-tools components installed.
        Try running the following command:
        cargo marker setup --auto-install-toolchain

        or:
        rustup toolchain install {toolchain} --component rustc-dev llvm-tools

@Veetaha
Copy link
Contributor

Veetaha commented Nov 24, 2023

@tigerros thanks for sharing the logs. The fix for this bug is in PR #319.

In the meantime I recommend you to use the installation script, which handles all the corner cases of Windows environments and installs cargo-marker correctly. You can run the following command on Windows in a PowerShell terminal to get you started:

curl.exe -fsSL https://raw.githubusercontent.com/rust-marker/marker/v0.4/scripts/release/install.ps1 | powershell -command -

I recommend using this approach because it is much faster and more reliable.


Other solution

⚠️ You should never build cargo-marker and its internal driver from sources, unless this is your explicit goal. If you do want to build from sources for now in 0.4 you should use the following command as a workaround:

cargo +nightly-2023-10-05 marker setup --auto-install-toolchain

Additionally, could you share your experience of trying to install cargo-marker, as in how you decided to install cargo marker from sources and not from the installation script?

@tigerros
Copy link

tigerros commented Nov 24, 2023

@Veetaha I've installed it through the powershell script, but now running cargo marker (on an empty stable binary with the template crate linked) produces another error.

Error log
2023-11-24T20:36:07.136003Z  INFO cli: ❱ cargo locate-project "--color=always" --workspace
2023-11-24T20:36:07.195417Z  INFO cli: ❱ rustup which --toolchain stable-x86_64-pc-windows-msvc marker_rustc_driver
2023-11-24T20:36:07.208287Z  INFO cli: ❱ rustup which --toolchain nightly-2023-11-16 marker_rustc_driver
2023-11-24T20:36:07.221229Z  INFO cargo_marker::backend::toolchain: Found the tool tool=marker_rustc_driver toolchain=nightly-2023-11-16 path=C:\Users\aurel\.rustup\toolchains\nightly-2023-11-16-x86_64
-pc-windows-msvc\bin\marker_rustc_driver.exe

      Marker compiling lints
2023-11-24T20:36:07.765011Z  INFO cli: ❱ rustup run nightly-2023-11-16 cargo fetch --manifest-path "C:\\Users\\aurel\\source\\repos\\rust_test\\target\\marker\\Cargo.toml"
2023-11-24T20:36:08.055043Z  INFO cli: ❱ RUSTFLAGS="" rustup run nightly-2023-11-16 cargo build --manifest-path "C:\\Users\\aurel\\source\\repos\\dioxus-lints\\Cargo.toml" --target-dir "C:\\Users\\aure
l\\source\\repos\\rust_test\\target\\marker\\target" --release -Z unstable-options --out-dir "C:\\Users\\aurel\\source\\repos\\rust_test\\target\\marker\\lints"
error: the `-Z` flag is only accepted on the nightly channel of Cargo, but this is the `stable` channel
See https://doc.rust-lang.org/book/appendix-07-nightly-rust.html for more information about Rust release channels.
  x Failed to compile the lint crate dioxus-lints
  | Backtrace:
  |    0: <unknown>
  |    1: <unknown>
  |    2: <unknown>
  |    3: <unknown>
  |    4: <unknown>
  |    5: <unknown>
  |    6: <unknown>
  |    7: <unknown>
  |    8: <unknown>
  |    9: <unknown>
  |   10: <unknown>
  |   11: BaseThreadInitThunk
  |   12: RtlUserThreadStart
  |
  | ⚠️  Spantrace wasn't captured. It may be expected if the error happened outside of any spans, or those spans were not enabled. You may
  | try capturing it by enabling tracing logging or increasing its level via MARKER_LOG env variable in cargo-marker. Spantrace capturing
  | in marker_rustc_driver isn't supported yet.

Additionally, could you share your experience of trying to install cargo-marker, as in how you decided to install cargo marker from sources and not from the installation script?

I wanted to have the option to easily uninstall it with cargo uninstall cargo_marker.

@Veetaha
Copy link
Contributor

Veetaha commented Nov 24, 2023

@tigerros could you share the command that you ran and also the layout of files in your directory? I can't reproduce this error. Ideally, a git repo I could clone and run the command in to reproduce would be cool

@tigerros
Copy link

@Veetaha I ran cargo new --bin rust-test, then added this to the Cargo.toml:

[workspace.metadata.marker.lints]
lint-crate-template = { git = "https://github.com/rust-marker/lint-crate-template" }

Perhaps I should just reinstall marker. How would I do that?

@tigerros
Copy link

I should also point out that if I switch to nightly, I still get an error, although a different one.

Error log
2023-11-24T21:38:50.152081Z  INFO cli: ❱ cargo locate-project "--color=always" --workspace
2023-11-24T21:38:50.221009Z  INFO cli: ❱ rustup which --toolchain nightly-x86_64-pc-windows-msvc marker_rustc_driver
2023-11-24T21:38:50.235938Z  INFO cli: ❱ rustup which --toolchain nightly-2023-11-16 marker_rustc_driver
2023-11-24T21:38:50.250114Z  INFO cargo_marker::backend::toolchain: Found the tool tool=marker_rustc_driver toolchain=nightly-2023-11-16 path=C:\Users\aurel\.rustup\toolchains\nightly-2023-11-16-x86_64
-pc-windows-msvc\bin\marker_rustc_driver.exe

      Marker compiling lints
2023-11-24T21:38:50.379029Z  INFO cli: ❱ rustup run nightly-2023-11-16 cargo fetch --manifest-path "C:\\Users\\aurel\\source\\repos\\rust-test\\target\\marker\\Cargo.toml"
2023-11-24T21:38:50.545719Z  INFO cli: ❱ RUSTFLAGS="" rustup run nightly-2023-11-16 cargo build --manifest-path "C:\\Users\\aurel\\.cargo\\git\\checkouts\\lint-crate-template-3b291724b43048ce\\51edffe\
\Cargo.toml" --target-dir "C:\\Users\\aurel\\source\\repos\\rust-test\\target\\marker\\target" --release -Z unstable-options --out-dir "C:\\Users\\aurel\\source\\repos\\rust-test\\target\\marker\\lints
"
    Updating crates.io index
   Compiling marker_api v0.4.1
   Compiling marker_utils v0.4.1
   Compiling lint-crate-template v0.1.0 (C:\Users\aurel\.cargo\git\checkouts\lint-crate-template-3b291724b43048ce\51edffe)
    Finished release [optimized] target(s) in 5.66s

      Marker linting
2023-11-24T21:38:56.251396Z  INFO cli: ❱ MARKER_LINT_CRATES="lint-crate-template:C:\\Users\\aurel\\source\\repos\\rust-test\\target\\marker\\lints\\lint_crate_template.dll" RUSTC_WORKSPACE_WRAPPER="C:\
\Users\\aurel\\.rustup\\toolchains\\nightly-2023-11-16-x86_64-pc-windows-msvc\\bin\\marker_rustc_driver.exe" RUSTUP_TOOLCHAIN=nightly-2023-11-16 rustup run nightly-2023-11-16 cargo check
    Checking rust-test v0.1.0 (C:\Users\aurel\source\repos\rust-test)
error: could not compile `rust-test` (bin "rust-test")

Caused by:
  process didn't exit successfully: `C:\Users\aurel\.rustup\toolchains\nightly-2023-11-16-x86_64-pc-windows-msvc\bin\marker_rustc_driver.exe rustc --crate-name rust_test --edition=2021 src\main.rs --er
ror-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=200 --crate-type bin --emit=dep-info,metadata -C embed-bitcode=no -C debuginfo=2 -C metadata=454d531098a0849
5 -C extra-filename=-454d531098a08495 --out-dir C:\Users\aurel\source\repos\rust-test\target\debug\deps -C incremental=C:\Users\aurel\source\repos\rust-test\target\debug\incremental -L dependency=C:\Us
ers\aurel\source\repos\rust-test\target\debug\deps` (exit code: 0xc0000005, STATUS_ACCESS_VIOLATION)
  x linting finished with an error
  | Backtrace:
  |    0: <unknown>
  |    1: <unknown>
  |    2: <unknown>
  |    3: <unknown>
  |    4: <unknown>
  |    5: <unknown>
  |    6: <unknown>
  |    7: <unknown>
  |    8: <unknown>
  |    9: BaseThreadInitThunk
  |   10: RtlUserThreadStart
  |
  | ⚠️  Spantrace wasn't captured. It may be expected if the error happened outside of any spans, or those spans were not enabled. You may
  | try capturing it by enabling tracing logging or increasing its level via MARKER_LOG env variable in cargo-marker. Spantrace capturing
  | in marker_rustc_driver isn't supported yet.

@Veetaha
Copy link
Contributor

Veetaha commented Nov 24, 2023

The error (exit code: 0xc0000005, STATUS_ACCESS_VIOLATION) is a tricky one. I guess this is again windows-specific. I suppose it's something with the windows pre-compiled binary. I can't tell what exactly right now.

Let's try do this with a clean from-source build. Just run the following, and this should work for you.

cargo install cargo_marker --force
cargo +nightly-2023-11-16 marker setup --auto-install-toolchain

# Run the linting
cargo +nightly-2023-11-16 marker

@Veetaha I ran cargo new --bin rust-test, then added this to the Cargo.toml:

[workspace.metadata.marker.lints]
lint-crate-template = { git = "https://github.com/rust-marker/lint-crate-template" }

Perhaps I should just reinstall marker. How would I do that?

I still can't reproduce it with this setup. There must be something I'm missing in your environment.

To further proceed with the debugging. Could you check if the following command works if you run it directly.

RUSTFLAGS="" rustup run nightly-2023-11-16 cargo build --manifest-path "C:\\Users\\aurel\\source\\repos\\dioxus-lints\\Cargo.toml" --target-dir "C:\\Users\\aure
l\\source\\repos\\rust_test\\target\\marker\\target" --release -Z unstable-options --out-dir "C:\\Users\\aurel\\source\\repos\\rust_test\\target\\marker\\lints"

If not, then, could you share the output of echo $env:Path in Powershell?

@tigerros
Copy link

@Veetaha I get an error saying that cargo is not applicable for the nightly toolchain you provided. I'll try reinstalling Rust.

@Veetaha
Copy link
Contributor

Veetaha commented Nov 24, 2023

Yeah, you can run:

rustup uninstall nightly-2023-11-16
rustup install nightly-2023-11-16

Sometimes rustup just doesn't have cargo installed.

@tigerros
Copy link

I uninstalled Rust completely, installed cargo marker with the precompiled binary, ran the auto setup and it works. I guess something was wrong with my Rust toolchains. Don't really know.

@Veetaha
Copy link
Contributor

Veetaha commented Nov 24, 2023

@tigerros does it mean that now you can run cargo marker without the explicit nightly toolchain as in cargo +{toolchain} marker?

@tigerros
Copy link

Yes

@Veetaha
Copy link
Contributor

Veetaha commented Nov 24, 2023

Thanks, nice to hear that!

Btw. thanks for reporting this #318 (comment).

I created a PR to fix the release build for windows #320. It should fix (exit code: 0xc0000005, STATUS_ACCESS_VIOLATION). We'll make a patch for that.

xFrednet pushed a commit that referenced this issue Nov 25, 2023
Fixes marker_rustc_driver crashing on windows with `exit code: 0xc0000005, STATUS_ACCESS_VIOLATION`. Reported in  #318 (comment).

I disabled LTO, in release build and it fixes the problem.

I extended the CI to perform a really simple release smoke test both for the current release and for the previous release (in github action test CI job).

Here, for example, you may see that the bug reproduces in master on the changed CI
- [CI job for the current version of marker](https://github.com/rust-marker/marker/actions/runs/6985541482/job/19009920759?pr=320#step:4:93)
- [CI job for the released version of marker](https://github.com/rust-marker/marker/actions/runs/6985541482/job/19009920759?pr=320#step:4:93)


With the disabled LTO `release-smoke-test` [passes](https://github.com/rust-marker/marker/actions/runs/6985586586/job/19010007386?pr=320)


Btw. @xFrednet could you add the `release-smoke-test` jobs to required ones please?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-marker-cargo Area: All things connected to `cargo_marker` C-bug Category: Something isn't working D-rustc-driver Driver: Rustc Driver S-needs-triage Status: This issue needs triage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants