Question about the permission used in the build process

I've recently been making a program that works on Docker. What this program does is to receive a source code as a string and then build this file to inform you of the execution results. For security purposes, this program uses an account that only has access to the folder in which the source code is created. However, in the process of building the source code, the following error related to the authority occurs.

error: could not write output to Main.11a3kiytxcdc79z1.rcgu.o: Permission denied 
error: aborting due to previous error

These error messages do not appear when compiling with a root account. Because of this, I thought that during the Rust program build process, I should allow access to certain folders other than those with source code, but I couldn't find them. Is there any other folder that you should allow access to when you need to compile the Rust program?

Assuming use of cargo, at least:

I'm using rustc to compile. Not cargo.

Perhaps you need to use rustc's --out-dir option? There's also -C incremental dir.