vscode-rust icon indicating copy to clipboard operation
vscode-rust copied to clipboard

False positive compilation errors using Rust

Open adrianboston opened this issue 3 years ago • 5 comments

Issue Type: Bug

I get false positive compilation errors showing up in the "Problems" dropdown that seems to be an iterative real-time compile. Run/Debug works with no issue. Turning to terminal compiles with no errors.

It started very soon after adding unit tests into the source, using the #[test] pragma. Sometimes the error shows within commented code.

Prior to that, no issues.

Extension version: 0.7.8 VS Code version: Code 1.63.2 (Universal) (899d46d82c4c95423fb7e10e68eba52050e30ba3, 2021-12-15T09:37:28.172Z) OS version: Darwin x64 17.7.0 Restricted Mode: No

System Info
Item Value
CPUs Intel(R) Xeon(R) CPU E5-2650 v2 @ 2.60GHz (32 x 2594)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
webgl: enabled
webgl2: enabled
Load (avg) 3, 3, 3
Memory (System) 64.00GB (4.40GB free)
Process Argv --crash-reporter-id 3459ab68-b960-4433-b56f-adab7430e7a4
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythontb:30283811
pythonvspyt551cf:30345471
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscoreces:30384385
pythondataviewer:30285071
vscod805cf:30301675
pythonvspyt200:30340761
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593:30376534
vsc1dsc:30414009
pythonvs932:30410667
vscop804:30404766
vs360cf:30404996
vsrem710cf:30416617
vscexrecpromp3c:30407761

adrianboston avatar Jan 27 '22 07:01 adrianboston

@adrianboston your report isn't actionable. You should include at least a screenshot, the problematic code and maybe a reduced copy of it, which someone can paste into Code to reproduce the problem.

Having said that, you should try https://marketplace.visualstudio.com/items?itemName=matklad.rust-analyzer, see https://github.com/rust-lang/vscode-rust/issues/927 for details. rust-analyzer too has false positive diagnostics and corner cases, but it is currently more actively maintained.

lnicola avatar Jan 27 '22 08:01 lnicola

It is not reproducible. False positive shows up; then disappear. Its m-m-m-magic. I will endeavour to post some very short code that displays this behaviour. It's currently part of a large proj. Im using this rust although it states powered by rust analyzer. I found it very stable.

adrianboston avatar Jan 27 '22 08:01 adrianboston

Im using this rust although it states powered by rust analyzer.

It's not. It has an option for that, but it's been broken for one year and a half, I think.

I found it very stable.

It's all right if you like it, but the last commit in this repository is from February 2021. If you run into any issues, it's unlikely that they will be solved soon.

lnicola avatar Jan 27 '22 08:01 lnicola

I found its nothing to do with particular code. The errors are one from a previous build. The error line number is sometimes within commented lines. The error and line number remains the same in the Problems area despite updates and changes.

A reboot of the window / project clears the window of the error, returning it to either a clean build or clear/refresh the Problem window.

Perhaps VS Code needs a "Clear" or "Refresh" facility by way of a button. Or a Trashcan symbol as found in terminal. That simply cleans, clears or refresh the last compilation.

adrianboston avatar Jan 27 '22 20:01 adrianboston

I mean, it's still worth trying rust-analyzer, since it will replace RLS at some point in the future. Issues reported here are unlikely to be addressed.

Beware of some missing functionality, though: the biggest one is that in rust-analyzer most diagnostics are recomputed after you save a file and not while typing.

lnicola avatar Jan 28 '22 11:01 lnicola