Closed tigerros closed 11 months ago
Thank you for the report! Have you been able to run Marker on a normal crate, or does that also happen there?
Thank you for the report! Have you been able to run Marker on a normal crate, or does that also happen there?
Running cargo marker
on a crate that uses the same lint crate works, if that's what you mean.
Yes, that's what I meant. Then it seems to be a problem with the configuration of Marker's testing framework :thinking:
I'm not quite sure what could cause it, but that's what debugging is for. Since it works on my Linux machine and the CI of that crate, I'm guessing that it has something to do with windows.
@tigerros, would you mind running two tests for me?
"rust-std"
component in the component list of the rust-toolchain.toml
file of the lint crate, and run the tests again?MARKER_ERROR_TRACE=1 MARKER_LOG=info
?That would be super helpful!
I'm pretty sure I enabled logging in the first log... Anyway, same issue.
@xFrednet I believe I already saw this issue when debugging something unrelated long ago, but didn't think it would be reproducable outside of my debugging setup. The core problem is with custom handling of --sysroot
parameter in the driver here:
https://github.com/rust-marker/marker/blob/e1dfde8dc49373c1459d27af12bc690d5909f6e2/marker_rustc_driver/src/lib.rs#L309-L353
I don't remember the conditions under which the problem reproduces, and I'm not sure that's windows specific. Some combination of RUSTUP_TOOLCHAIN
and rust-toolchain
or +{toolchain}
plus the CARGO
env vars in the test process causes this. The behavior that is implemented in that referenced function differs from real rustc
's behavior. At that moment I wondered why that function event exists in the first place, and why not to forward processing of that parameter to RunCompiler
, but didn't go further.
I had the feeling this code will come back to bite me. This way of getting the sysroot was taken from Clippy, with some refactorings for readability. I never use the --sysroot
flag and don't know why it requires special handling in tools.
Some months back, there was a PR in rustc to move this special handling code into rustc https://github.com/rust-lang/rust/pull/103660. I've created https://github.com/rust-marker/marker/issues/48 to migrate Marker as well, but haven't gotten too it yet, since I assumed it worked fine as is.
Checking Clippy's driver code, it looks like there is still some code to forward the sysroot
flag, but it's definitely cleaner than the old setup:
https://github.com/rust-lang/rust-clippy/blob/8b0bf6423dfaf5545014db85fcba7bc745beed4c/src/driver.rs#L191-L200
Edit: I just looked it up, apparently the flag was added for cross compilation: https://github.com/rust-lang/cargo/issues/2312 It might be used for other things as well, but that seems to be the origin.
@tigerros We've created a release candidate for v0.4.3, which might fix the bug. Would you mind testing it on your machine?
This is the install script for the release candidate. You might have to specify v0.4.3-rc
in the lint crate template, instead of the v0.4
version which is the default. If this fixes the bug, we'll do a proper v0.4.3 release.
curl.exe -fsSL https://raw.githubusercontent.com/rust-marker/marker/v0.4.3-rc/scripts/release/install.ps1 | powershell -command -
I think I figured out another problem... When I released v0.4.1 I accidentally did that from the master branch, which updated the used nightly toolchain. This update never made it to the master of the lint crate template. I'll fix that! Let's hope that fixes everything
Edit: The upside of this mess, is that I learned to never release hotfix versions from the master branch again
Okay, now everything should be back in order. Sorry :sweat_smile:
@xFrednet It works. And yes, it's necessary to specify 0.4.3-rc
for the marker deps in the template. Thanks!
Perfect, thank you!
Summary
I'm not positive that this is a bug, but running Marker on a different crate instead of testing does work, so I think something is wrong with the testing.
Reproducer
Windows 10
git clone https://github.com/rust-marker/lint-crate-template.git
cd lint-crate-template
cargo uitest
Using the latest nightly toolchain and latest Marker dependencies (
0.4.2
) doesn't help.Version
Logs