Where does Rust store the core and std libraries to guarantee that they're accessible to rustc and cargo when compiling Rust projects?
Does rustc know about std and core? Or does cargo implicitly include these at build time as if they're any other crate?
Context
I'm hacking on a domain-specific programming language (very much inspired by Rust) and we've reached the point where we're ready to include the language's core and std libraries implicitly (currently, users have to manually specify std and core dependencies in their manifest). We don't have a prelude module yet, but to begin we just want to start by ensuring that core and std are accessible without having to manually declare them as dependencies, and this got me curious about Rust's approach
For the most part, rustc just inherently knows about them, and finds compiled versions of them in the sysroot.
However, I would recommend learning from what we're moving towards rather than what we currently do. Just add the logic to always build core and std from source, exactly like any other package, and then separately add logic for caching compiled binaries. Don't special-case the standard library; you may end up regretting that special case later, and it may be hard to fix.
Is the plan to install a copy of each crate's src in a common, local user directory during installation? And then perhaps sync their major.minor version with rustc so that cargo knows which to use?
I'd imagine the implicit core and std crates won't be fetched from crates.io or the rust git repo in order to ensure that folks can build new projects offline.