error[E0433] for folder + files in folder


I moved a bunch of files around in my project earlier, and now it's broken.

I fixed up my imports (almost) with the exception of these two:

Here is my folder structure:

I don't get it, both of these folders are on the same level in the src folder, shouldn't rust be able to see them? I do have a file in both for the components in each folder as well.

I know I'm missing something simple, but I don't see it.

Can someone help?


First, I'm going to assume you're using edition 2018. You can look for edition = "2018" in Cargo.toml to be sure. The module pathing was updated across editions and you may need to change some things or try rustfix if you're updating code from one edition to the another. Most but probably not all of what follows applies to both currently existing editions.

Next, I see a src/ As far as I know, nothing looks for that file automatically. You almost certainly meant src/ The first thing I would try is renaming that file.

After that, note that aside from src/ and src/, cargo and rust don't look for files that just happen to be in src. Instead you have to declare modules in the files it's already looking in. So it's possible that you're missing some statements like mod nnet_auto_optimization; in (what will presumably soon be renamed to) Once you have a, if you're still getting those errors, this is the next thing I would check.

Furthermore, you don't need src/submodule/ anymore, you can use src/ instead. But you can still use src/submodule/ if you prefer, so this shouldn't be a source of any of your problems.

Taken altogether, I would expect something like

  • -- declares mod nnet_auto_optimization and mod testing_config
  • -- declares mod optimize_nnet and mod optimizer_parameters
    • nnet_auto_optimization/
    • nnet_auto_optimization/
  • -- declares mod test_config
    • testing_config/

One thing I notice immediately is that you have a file directly in src. Normally you wouldn't have that because the has that role in the top-level folder.


I did delete that after I took that screenshot. I should have retaken the screenshot after I deleted it.