1- use crate :: syntax:: atom:: Atom :: { self , * } ;
1+ use crate :: syntax:: atom:: Atom :: * ;
22use crate :: syntax:: report:: Errors ;
33use crate :: syntax:: visit:: { self , Visit } ;
44use crate :: syntax:: {
@@ -81,7 +81,7 @@ impl Check<'_> {
8181
8282fn check_type_ident ( cx : & mut Check , name : & NamedType ) {
8383 let ident = & name. rust ;
84- if Atom :: from ( ident) . is_none ( )
84+ if cx . types . builtins . get ( ident) . is_none ( )
8585 && !cx. types . structs . contains_key ( ident)
8686 && !cx. types . enums . contains_key ( ident)
8787 && !cx. types . cxx . contains ( ident)
@@ -102,7 +102,7 @@ fn check_type_box(cx: &mut Check, ptr: &Ty1) {
102102 cx. error ( ptr, error:: BOX_CXX_TYPE . msg ) ;
103103 }
104104
105- if Atom :: from ( & ident. rust ) . is_none ( ) {
105+ if cx . types . builtins . get ( & ident. rust ) . is_none ( ) {
106106 return ;
107107 }
108108 }
@@ -122,7 +122,7 @@ fn check_type_rust_vec(cx: &mut Check, ty: &Ty1) {
122122 return ;
123123 }
124124
125- match Atom :: from ( & ident. rust ) {
125+ match cx . types . builtins . get ( & ident. rust ) {
126126 None | Some ( Char ) | Some ( U8 ) | Some ( U16 ) | Some ( U32 ) | Some ( U64 ) | Some ( Usize )
127127 | Some ( I8 ) | Some ( I16 ) | Some ( I32 ) | Some ( I64 ) | Some ( Isize ) | Some ( F32 )
128128 | Some ( F64 ) | Some ( RustString ) => return ,
@@ -144,7 +144,7 @@ fn check_type_unique_ptr(cx: &mut Check, ptr: &Ty1) {
144144 return ;
145145 }
146146
147- match Atom :: from ( & ident. rust ) {
147+ match cx . types . builtins . get ( & ident. rust ) {
148148 None | Some ( CxxString ) => return ,
149149 _ => { }
150150 }
@@ -162,7 +162,7 @@ fn check_type_shared_ptr(cx: &mut Check, ptr: &Ty1) {
162162 return ;
163163 }
164164
165- match Atom :: from ( & ident. rust ) {
165+ match cx . types . builtins . get ( & ident. rust ) {
166166 None | Some ( Bool ) | Some ( U8 ) | Some ( U16 ) | Some ( U32 ) | Some ( U64 ) | Some ( Usize )
167167 | Some ( I8 ) | Some ( I16 ) | Some ( I32 ) | Some ( I64 ) | Some ( Isize ) | Some ( F32 )
168168 | Some ( F64 ) | Some ( CxxString ) => return ,
@@ -183,7 +183,7 @@ fn check_type_weak_ptr(cx: &mut Check, ptr: &Ty1) {
183183 return ;
184184 }
185185
186- match Atom :: from ( & ident. rust ) {
186+ match cx . types . builtins . get ( & ident. rust ) {
187187 None | Some ( Bool ) | Some ( U8 ) | Some ( U16 ) | Some ( U32 ) | Some ( U64 ) | Some ( Usize )
188188 | Some ( I8 ) | Some ( I16 ) | Some ( I32 ) | Some ( I64 ) | Some ( Isize ) | Some ( F32 )
189189 | Some ( F64 ) | Some ( CxxString ) => return ,
@@ -207,7 +207,7 @@ fn check_type_cxx_vector(cx: &mut Check, ptr: &Ty1) {
207207 return ;
208208 }
209209
210- match Atom :: from ( & ident. rust ) {
210+ match cx . types . builtins . get ( & ident. rust ) {
211211 None | Some ( U8 ) | Some ( U16 ) | Some ( U32 ) | Some ( U64 ) | Some ( Usize ) | Some ( I8 )
212212 | Some ( I16 ) | Some ( I32 ) | Some ( I64 ) | Some ( Isize ) | Some ( F32 ) | Some ( F64 )
213213 | Some ( CxxString ) => return ,
@@ -522,7 +522,7 @@ fn check_api_impl(cx: &mut Check, imp: &Impl) {
522522 | Type :: WeakPtr ( ty)
523523 | Type :: CxxVector ( ty) => {
524524 if let Type :: Ident ( inner) = & ty. inner {
525- if Atom :: from ( & inner. rust ) . is_none ( ) {
525+ if cx . types . builtins . get ( & inner. rust ) . is_none ( ) {
526526 return ;
527527 }
528528 }
@@ -568,7 +568,7 @@ fn check_mut_return_restriction(cx: &mut Check, efn: &ExternFn) {
568568 self . found |= match ty {
569569 Type :: Ref ( ty) => ty. mutable ,
570570 Type :: SliceRef ( slice) => slice. mutable ,
571- Type :: Ident ( ident) if Atom :: from ( & ident. rust ) . is_none ( ) => {
571+ Type :: Ident ( ident) if self . cx . types . builtins . get ( & ident. rust ) . is_none ( ) => {
572572 match self . cx . types . try_resolve ( ident) {
573573 Some ( resolve) => !resolve. generics . lifetimes . is_empty ( ) ,
574574 None => true ,
@@ -604,7 +604,7 @@ fn check_reserved_name(cx: &mut Check, ident: &Ident) {
604604 || ident == "Vec"
605605 || ident == "CxxVector"
606606 || ident == "str"
607- || Atom :: from ( ident) . is_some ( )
607+ || cx . types . builtins . get ( ident) . is_some ( )
608608 {
609609 cx. error ( ident, "reserved name" ) ;
610610 }
@@ -709,9 +709,9 @@ fn describe(cx: &mut Check, ty: &Type) -> String {
709709 "opaque C++ type" . to_owned ( )
710710 } else if cx. types . rust . contains ( & ident. rust ) {
711711 "opaque Rust type" . to_owned ( )
712- } else if Atom :: from ( & ident. rust ) == Some ( CxxString ) {
712+ } else if cx . types . builtins . get ( & ident. rust ) == Some ( & CxxString ) {
713713 "C++ string" . to_owned ( )
714- } else if Atom :: from ( & ident. rust ) == Some ( Char ) {
714+ } else if cx . types . builtins . get ( & ident. rust ) == Some ( & Char ) {
715715 "C char" . to_owned ( )
716716 } else {
717717 ident. rust . to_string ( )
0 commit comments