1
- use crate :: syntax:: atom:: Atom :: { self , * } ;
1
+ use crate :: syntax:: atom:: Atom :: * ;
2
2
use crate :: syntax:: report:: Errors ;
3
3
use crate :: syntax:: visit:: { self , Visit } ;
4
4
use crate :: syntax:: {
@@ -81,7 +81,7 @@ impl Check<'_> {
81
81
82
82
fn check_type_ident ( cx : & mut Check , name : & NamedType ) {
83
83
let ident = & name. rust ;
84
- if Atom :: from ( ident) . is_none ( )
84
+ if cx . types . builtins . get ( ident) . is_none ( )
85
85
&& !cx. types . structs . contains_key ( ident)
86
86
&& !cx. types . enums . contains_key ( ident)
87
87
&& !cx. types . cxx . contains ( ident)
@@ -102,7 +102,7 @@ fn check_type_box(cx: &mut Check, ptr: &Ty1) {
102
102
cx. error ( ptr, error:: BOX_CXX_TYPE . msg ) ;
103
103
}
104
104
105
- if Atom :: from ( & ident. rust ) . is_none ( ) {
105
+ if cx . types . builtins . get ( & ident. rust ) . is_none ( ) {
106
106
return ;
107
107
}
108
108
}
@@ -122,7 +122,7 @@ fn check_type_rust_vec(cx: &mut Check, ty: &Ty1) {
122
122
return ;
123
123
}
124
124
125
- match Atom :: from ( & ident. rust ) {
125
+ match cx . types . builtins . get ( & ident. rust ) {
126
126
None | Some ( Char ) | Some ( U8 ) | Some ( U16 ) | Some ( U32 ) | Some ( U64 ) | Some ( Usize )
127
127
| Some ( I8 ) | Some ( I16 ) | Some ( I32 ) | Some ( I64 ) | Some ( Isize ) | Some ( F32 )
128
128
| Some ( F64 ) | Some ( RustString ) => return ,
@@ -144,7 +144,7 @@ fn check_type_unique_ptr(cx: &mut Check, ptr: &Ty1) {
144
144
return ;
145
145
}
146
146
147
- match Atom :: from ( & ident. rust ) {
147
+ match cx . types . builtins . get ( & ident. rust ) {
148
148
None | Some ( CxxString ) => return ,
149
149
_ => { }
150
150
}
@@ -162,7 +162,7 @@ fn check_type_shared_ptr(cx: &mut Check, ptr: &Ty1) {
162
162
return ;
163
163
}
164
164
165
- match Atom :: from ( & ident. rust ) {
165
+ match cx . types . builtins . get ( & ident. rust ) {
166
166
None | Some ( Bool ) | Some ( U8 ) | Some ( U16 ) | Some ( U32 ) | Some ( U64 ) | Some ( Usize )
167
167
| Some ( I8 ) | Some ( I16 ) | Some ( I32 ) | Some ( I64 ) | Some ( Isize ) | Some ( F32 )
168
168
| Some ( F64 ) | Some ( CxxString ) => return ,
@@ -183,7 +183,7 @@ fn check_type_weak_ptr(cx: &mut Check, ptr: &Ty1) {
183
183
return ;
184
184
}
185
185
186
- match Atom :: from ( & ident. rust ) {
186
+ match cx . types . builtins . get ( & ident. rust ) {
187
187
None | Some ( Bool ) | Some ( U8 ) | Some ( U16 ) | Some ( U32 ) | Some ( U64 ) | Some ( Usize )
188
188
| Some ( I8 ) | Some ( I16 ) | Some ( I32 ) | Some ( I64 ) | Some ( Isize ) | Some ( F32 )
189
189
| Some ( F64 ) | Some ( CxxString ) => return ,
@@ -207,7 +207,7 @@ fn check_type_cxx_vector(cx: &mut Check, ptr: &Ty1) {
207
207
return ;
208
208
}
209
209
210
- match Atom :: from ( & ident. rust ) {
210
+ match cx . types . builtins . get ( & ident. rust ) {
211
211
None | Some ( U8 ) | Some ( U16 ) | Some ( U32 ) | Some ( U64 ) | Some ( Usize ) | Some ( I8 )
212
212
| Some ( I16 ) | Some ( I32 ) | Some ( I64 ) | Some ( Isize ) | Some ( F32 ) | Some ( F64 )
213
213
| Some ( CxxString ) => return ,
@@ -522,7 +522,7 @@ fn check_api_impl(cx: &mut Check, imp: &Impl) {
522
522
| Type :: WeakPtr ( ty)
523
523
| Type :: CxxVector ( ty) => {
524
524
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 ( ) {
526
526
return ;
527
527
}
528
528
}
@@ -568,7 +568,7 @@ fn check_mut_return_restriction(cx: &mut Check, efn: &ExternFn) {
568
568
self . found |= match ty {
569
569
Type :: Ref ( ty) => ty. mutable ,
570
570
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 ( ) => {
572
572
match self . cx . types . try_resolve ( ident) {
573
573
Some ( resolve) => !resolve. generics . lifetimes . is_empty ( ) ,
574
574
None => true ,
@@ -604,7 +604,7 @@ fn check_reserved_name(cx: &mut Check, ident: &Ident) {
604
604
|| ident == "Vec"
605
605
|| ident == "CxxVector"
606
606
|| ident == "str"
607
- || Atom :: from ( ident) . is_some ( )
607
+ || cx . types . builtins . get ( ident) . is_some ( )
608
608
{
609
609
cx. error ( ident, "reserved name" ) ;
610
610
}
@@ -709,9 +709,9 @@ fn describe(cx: &mut Check, ty: &Type) -> String {
709
709
"opaque C++ type" . to_owned ( )
710
710
} else if cx. types . rust . contains ( & ident. rust ) {
711
711
"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 ) {
713
713
"C++ string" . to_owned ( )
714
- } else if Atom :: from ( & ident. rust ) == Some ( Char ) {
714
+ } else if cx . types . builtins . get ( & ident. rust ) == Some ( & Char ) {
715
715
"C char" . to_owned ( )
716
716
} else {
717
717
ident. rust . to_string ( )
0 commit comments