To solve this problem, I tried below but it is not solved yet,
uninstall all rust toolchain with "rustup self uninstall" and re-install rust.
re-install to another version of rust such as v1.50
remove all "C++ build tool" and re-install it.
try to build in the another hard drive, that is, "d:" drive to "c:" drive
I can't find any more tring to solve this problem.
The reason why I tried to upgrade rust version was to use Rc::new_ininit() function which is written to be supported from v1.82.
So, I upgraded my rust version using "rustup update".
After that I tested my code as below:
#![feature(get_mut_unchecked)]
use std::rc::Rc;
fn main() {
let mut five = Rc::<u32>::new_uninit();
// Deferred initialization:
Rc::get_mut(&mut five).unwrap().write(5);
let five = unsafe { five.assume_init() };
assert_eq!(*five, 5)
}
After that, my rust executing environment is crashed. Any code couldn't be built even though a sample "hello word" code, and even though I down-graded the rust version to v1.5 and v1.7 but the problem is same.
I tried "cargo clean" and after that "cargo build" but it didn't work.
And also, after re-installation for new rust version, I made a new project with "cargo new test1" and tried to build it but it faild with the same error.
Just making a new project with "cargo new test1" and then without any modification of the code, I tried to build it, but it faild neither.
Potentially relevant, Windows __fastfail (an intrinsic Rust abort/rtabort!) causes a program abort via STATUS_ACCESS_VIOLATION.
Something has gone horribly wrong if a full uninstall and reinstall of rustup means that even old toolchains that previously worked are crashing. I suspect that's not the case, and you're accidentally running not the toolchain of Rust you think you are.
these should not be the problem, these two components are not essential for the toolchain to work.
based on your description, my guess is the it is probably due to some system files (e.g. essential dll libraries) being corrupted (or hijacked). did you recently update the operating system or any system software (such as hardware drivers, firewalls, or anti-virus)?
also, is there any log entries in the system event viewer? especially, in what module (i.e. which exe or dll file) did the exception happen?
1)(22:00) I was testing some code in VS Code and wanted to make Rc object with no argument.
--> this time, there was no problem to make code and build in the VS Code.
2)(22:10) I found "Rc::get_mut()" method is supported from the version 1.82 in the Rust doc site.
3)(22:15) I updated rust version using "rustup update" while VS Code programm is running.
4)(22:20)after updating, in the VS Code, I coded like below (I couldn't remember exact code)
#![feature(get_mut_unchecked)]
fn main(){
let mut r = Rc::<String>::new_uninit();
Rc::get_mut(&mut r).unwrap().write("hello");
let s1 = unsafe ( r.assume_init() };
let s2 = Rc::clone(&s1);
let s3 = Rc::clone(&s1);
println!("{s1}");
println!("{s2}");
println!("{s3}");
}
(22:25) With the above code, I pressed "Run" button in the VS Code, and then, there was a error message in the VS Code. That was a starting the error occurance and after that I can't build anything
If I guess too much, I can think of whether Rc's assume_init() or clone() has damaged OS dll, but I'll have to look through the log file of Windows as you advised.
When testing Rust compilation, try using rustc instead of cargo by creating a new file test.rs with a hello world, then rustc test.rs.
I made a "test.rs" file with text editor not using cargo and comiled it with 'rustc' but it didn't work. There was no error message but there was no exe file generated. After "rustc src\test.rs", a strange folder named "rmeta00ETvZ" was generated but it contains no files in it.
After rustup self uninstall, try clearing any .cargo or .rustup folders in your user directory before reinstalling Rust.
Yes, I checked the folders were gone after "rustup self uninstall" in my folder.
Windows has tools to verify your system files. It will also fix corruption issues for you.
Yes, I did as the guide.
Update all the remaining Windows updates in the "Update Windows" page. It took around 30 mins.
Clean the system with "DIM.exe" and "sfc /scannow"
All of them was invalid. Additionally I changed "windows/system32/ntdll.dll" file with another PC's ntdll.dll file. But it didn't work neither.
In the Windows system log, I couldn't find what dll file was damaged but only find the time when the error was started.At that time, the error message is just "error: rustc.exe" and "error: ntdll.dll". So, I deleted 'ntdll.dll' file and copied newly from the another PC. But, it didn't work neither.
I think some dll file was damaged but I couldn't fild it.
Maybe, there is only thing remaind : re-install my Windows newly.
Oof, that is not something you ever want to do, that can only ever make it worse. error: ntdll.dll doesn't mean that the DLL is bad, just that an error happened in code owned in that DLL, but the error could result from someone calling into the DLL incorrectly.
You don't ever modify OS/system files manually.
Thankfully, modern Windows supports installation which doesn't touch/lose most user data, it just reinstalls all of the system files. Given you suspect OS corruption and the tools to verify system files weren't able to fix the issue, that seems like a reasonable (if annoying and time consuming) thing to try.
I re-installed Windows 11 newly, it took around 2 hours, thanks to I divided C drive and D drive and it was easy b/c I can install Windows by formatting only the C drive and not deleting the data on the D drive.
The first thing I did after reinstalling Windows was that install the Rust toolchains and testing the 'Cargo build'. But, I got the same error. Oh no!!!!
Compiling by 'rustc' is also not working. By the command of rustc src\main.rs, there was no reply from the rustc and only a strange folder is generated. That's it. The folder name is "rmetaf4hy3k".
The main.rs code is made by default command of cargo new test1.
fn main() {
println!("Hello, world!");
}
Re-install Windows > install "MS C++ build tools" > install Rust by 'rustup_init.exe' > Test > Error
I can't find no more solution. My laptop is not changed anything. Suddenly 'cargo build' has been not working from one time after doing after rust version up and test some code.
Could someone guide me what can I do more to solve this problem?
"AhnLab V3 Internet Security 9.0" is installed which is the default Anti-mallware s/w in our company.
I'll try to remove it and re-test Rust build now.
--> I removed "AhnLab V3 Internet Security 9.0" program and test "Cargo build" again but it didn't work neither.
The only remaining the creepy program is a DRM software which is default program by our company's policy, but I can't remove this program. It's locked not to remove.
However, other PC's are OK even though it is installed the DRM software.
I tested it on the another PC in our company. The result is the same error came out. !!!!
Maybe, out company's security policy was changed suddenly, and it cause the problem.
The suspicious programs are ESCORT(PC Management S/W), NASCA(PC DRM S/W).
These security software is so annoying, I couldn't understand why these kind of S/W are used.
I'll try to solve the problem, and I'll report the result again in here. Thanks ..
I don't know about the company's policy, just a reminder:
you can install rust under WSL2, you can still cross-compile .exe files for Windows, but with extra efforts. if you decided to go this way, you can learn how to setup the Windows SDK with rust in this blog post: