I am trying to write some code for a compiler for rust written in C++. I have been working on resolving structs provided by standard library which are already included in every rust file via prelude. As they are not imported like use::foo::Bar. It is difficult to resolve their path as it does not have one and also how make sure they are the correct functions or structs.
My question is how are these things implemented in other compilers?
I started to think like this :
Make a list namely stdList of all the things present inside the prelude and then just check if the current token is one of the token present in the stdList. However I don't think this is the correct way to do.