Allow builtin atoms to be shadowed by user type definitions#908
Allow builtin atoms to be shadowed by user type definitions#908CAD97 wants to merge 1 commit intodtolnay:masterfrom
Conversation
|
Thanks for working on this! |
|
The difference between an atom and a builtin is that an atom is a non-generic type, and a builtin is a generic type[1]. As such, builtins are parsed specially, and are unique kinds of As such, my proposal for how to handle builtin shadowing is a bit interesting: don't! Or rather,
The key insight here is that cxx doesn't actually mind if we define types with the reserved builtin names (as far as I understand it); the issue comes for the user juggling that [1]: |
WIP, but potentially working already; needs judicious tests. Addresses part of #682.
Based on the sketch in #682, the to-do list is roughly
Typesparse_repr_attribute,parse_int_suffix,implicit_impl, and centralized spotting; all seem legitIf anyone would like to pick this up, feel free to do so (and/or PR tests onto my branch)!
Note that this does not handle builtins (that is,
Box,UniquePtr,SharedPtr,WeakPtr,Vec,CxxVector, andstr), which are different from atoms (that is,bool,c_char,uNN,iNN,fNN,CxxString,String). Those will take more thorough refactoring to weaken similarly.