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

println! macro is unsafe

Open perry-blueberry opened this issue 6 months ago • 2 comments

Same issue that has been reported a few times popped up again: https://github.com/rust-lang/rust-analyzer/issues/10022. I'm using 1.89.0-nightly (255aa2208 2025-06-19). This happen inside vscode on Ubuntu 24.04 if that makes a difference.

perry-blueberry avatar Jun 20 '25 12:06 perry-blueberry

Likely https://github.com/rust-lang/rust/pull/140748 / https://github.com/rust-lang/rust-analyzer/issues/19929

Veykril avatar Jun 20 '25 12:06 Veykril

Switched to yesterday's nightly and it works fine.

perry-blueberry avatar Jun 20 '25 12:06 perry-blueberry

Switched to yesterday's nightly and it works fine.

I got the same error and have been unsuccessfully trying to understand the problem for legit 5 hours, just to see your issue. Life is tough

Is it a rustc issue though ? What should I roll-back ? Rust-analyzer ? Because I also tried multiple previous versions of it (actually, previous versions of the extension) and none worked, even when cargo cleaning and reloading the window/extensions

brvtalcake avatar Jun 22 '25 03:06 brvtalcake

It's not a rustc issue, it's a rust-analyzer issue, but it only occurs when you're on a new nightly toolchain. So you can rollback to a nightly before https://github.com/rust-lang/rust/pull/140748. Alternatively, set "rust-analyzer.cargo.extraEnv": { "RUSTUP_TOOLCHAIN": "stable" }, which will cause r-a to analyze stable std instead.

ChayimFriedman2 avatar Jun 22 '25 04:06 ChayimFriedman2

I got the same error and have been unsuccessfully trying to understand the problem for legit 5 hours, just to see your issue. Life is tough

Is it a rustc issue though ? What should I roll-back ? Rust-analyzer ? Because I also tried multiple previous versions of it (actually, previous versions of the extension) and none worked, even when cargo cleaning and reloading the window/extensions

This is caused by internal changes within rustc that not yet implemented in rust-analyzer, so basically rust-analyzer issue. So, switching rust-analyzer versions won't work for now.

Switched to yesterday's nightly and it works fine.

I think what perry-blueberry meant with this comment is that they switched to yesterday(Of course, from the moment that they wrote the comment)'s nightly rustc without problematic change and it worked fine with it.

ShoyuVanilla avatar Jun 22 '25 04:06 ShoyuVanilla

As #20056 has been merged, I think this would be fixed in next rust-analyzer releases, both nightly and stable. Though we still have some remaining homeworks in #20058, I'll finish it soon

ShoyuVanilla avatar Jun 22 '25 04:06 ShoyuVanilla

I believe I'm hitting this on beta too.

runiq avatar Jul 05 '25 17:07 runiq

@Veykril could it be that #20056 is not on beta?

ChayimFriedman2 avatar Jul 05 '25 18:07 ChayimFriedman2

Oh indeed, we need to backport that

Veykril avatar Jul 06 '25 07:07 Veykril