The rust compiler supports building with some dependencies from crates.io. For example, log and env_logger come from crates.io.
In general, you should avoid adding dependencies to the compiler for several reasons:
As of July 2021, there is no official policy for vetting new dependencies to the compiler. Generally, new dependencies are not added to the compiler unless there is a good reason to do so.
The tidy tool has a list of crates that are allowed. To add a dependency that is not already in the compiler, you will need to add it to the list.