Lines Matching +full:is +full:- +full:generator +full:- +full:fn
17 generator: Generator, field
20 pub(crate) enum Generator { enum
21 // cxx-build crate, cxxbridge cli, cxx-gen.
24 // cxxbridge-macro. This is relevant in that the macro output is going to
27 // macro API is able to produce), we avoid duplicating them in our own
33 pub(crate) fn typecheck(cx: &mut Errors, apis: &[Api], types: &Types, generator: Generator) { in typecheck() argument
38 generator, in typecheck()
42 fn do_typecheck(cx: &mut Check) { in do_typecheck()
57 Type::Fn(ty) => check_type_fn(cx, ty), in do_typecheck()
77 pub(crate) fn error(&mut self, sp: impl ToTokens, msg: impl Display) { in error()
82 fn check_type_ident(cx: &mut Check, name: &NamedType) { in check_type_ident()
95 fn check_type_box(cx: &mut Check, ptr: &Ty1) { in check_type_box()
113 fn check_type_rust_vec(cx: &mut Check, ty: &Ty1) { in check_type_rust_vec()
121 cx.error(ty, "Rust Vec containing C++ type is not supported yet"); in check_type_rust_vec()
141 fn check_type_unique_ptr(cx: &mut Check, ptr: &Ty1) { in check_type_unique_ptr()
144 cx.error(ptr, "unique_ptr of a Rust type is not supported yet"); in check_type_unique_ptr()
159 fn check_type_shared_ptr(cx: &mut Check, ptr: &Ty1) { in check_type_shared_ptr()
162 cx.error(ptr, "shared_ptr of a Rust type is not supported yet"); in check_type_shared_ptr()
175 cx.error(ptr, "std::shared_ptr<std::vector> is not supported yet"); in check_type_shared_ptr()
182 fn check_type_weak_ptr(cx: &mut Check, ptr: &Ty1) { in check_type_weak_ptr()
185 cx.error(ptr, "weak_ptr of a Rust type is not supported yet"); in check_type_weak_ptr()
198 cx.error(ptr, "std::weak_ptr<std::vector> is not supported yet"); in check_type_weak_ptr()
205 fn check_type_cxx_vector(cx: &mut Check, ptr: &Ty1) { in check_type_cxx_vector()
210 "C++ vector containing a Rust type is not supported yet", in check_type_cxx_vector()
228 fn check_type_ref(cx: &mut Check, ty: &Ref) { in check_type_ref()
240 "mutable reference to C++ type requires a pin -- use Pin<&mut {}>", in check_type_ref()
248 Type::Fn(_) | Type::Void(_) => {} in check_type_ref()
259 fn check_type_ptr(cx: &mut Check, ty: &Ptr) { in check_type_ptr()
261 Type::Fn(_) | Type::Void(_) => {} in check_type_ptr()
272 fn check_type_slice_ref(cx: &mut Check, ty: &SliceRef) { in check_type_slice_ref()
286 msg += ": opaque C++ type is not supported yet"; in check_type_slice_ref()
293 fn check_type_array(cx: &mut Check, ty: &Array) { in check_type_array()
301 fn check_type_fn(cx: &mut Check, ty: &Signature) { in check_type_fn()
303 cx.error(ty, "function pointer returning Result is not supported yet"); in check_type_fn()
318 fn check_api_struct(cx: &mut Check, strct: &Struct) { in check_api_struct()
337 let msg = format!("derive({}) on shared struct is not supported", derive); in check_api_struct()
343 if let Type::Fn(_) = field.ty { in check_api_struct()
350 let msg = format!("using {} by value is not supported", desc); in check_api_struct()
356 fn check_api_enum(cx: &mut Check, enm: &Enum) { in check_api_enum()
364 "explicit #[repr(...)] is required for enum without any variants", in check_api_enum()
370 let msg = format!("derive({}) on shared enum is not supported", derive); in check_api_enum()
376 fn check_api_type(cx: &mut Check, ety: &ExternType) { in check_api_type()
389 "derive({}) on opaque {} type is not supported yet", in check_api_type()
410 fn check_api_fn(cx: &mut Check, efn: &ExternFn) { in check_api_fn()
422 "must be `unsafe fn {}` in order to expose explicit lifetimes to C++", in check_api_fn()
441 …"unnamed receiver type is only allowed if the surrounding extern block contains exactly one extern… in check_api_fn()
459 … "mutable reference to opaque C++ type requires a pin -- use `self: Pin<&mut {}>`", in check_api_fn()
467 if let Type::Fn(_) = arg.ty { in check_api_fn()
471 "passing a function pointer from C++ to Rust is not implemented yet", in check_api_fn()
483 let msg = format!("passing {} by value is not supported", desc); in check_api_fn()
489 if let Type::Fn(_) = ty { in check_api_fn()
490 cx.error(ty, "returning a function pointer is not implemented yet"); in check_api_fn()
493 let msg = format!("returning {} by value is not supported", desc); in check_api_fn()
503 fn check_api_type_alias(cx: &mut Check, alias: &TypeAlias) { in check_api_type_alias()
507 let msg = format!("derive({}) on extern type alias is not supported", derive); in check_api_type_alias()
512 fn check_api_impl(cx: &mut Check, imp: &Impl) { in check_api_impl()
519 cx.error(span, "negative impl is not supported yet"); in check_api_impl()
542 fn check_mut_return_restriction(cx: &mut Check, efn: &ExternFn) { in check_mut_return_restriction()
544 // Unrestricted as long as the function is made unsafe-to-call. in check_mut_return_restriction()
573 fn visit_type(&mut self, ty: &'t Type) { in check_mut_return_restriction()
601 "&mut return type is not allowed unless there is a &mut argument", in check_mut_return_restriction()
605 fn check_reserved_name(cx: &mut Check, ident: &Ident) { in check_reserved_name()
619 fn check_reserved_lifetime(cx: &mut Check, lifetime: &Lifetime) { in check_reserved_lifetime()
621 match cx.generator { in check_reserved_lifetime()
622 Generator::Macro => { /* rustc already reports this */ } in check_reserved_lifetime()
623 Generator::Build => { in check_reserved_lifetime()
630 fn check_lifetimes(cx: &mut Check, generics: &Lifetimes) { in check_lifetimes()
636 fn check_generics(cx: &mut Check, generics: &Generics) { in check_generics()
644 fn is_unsized(cx: &mut Check, ty: &Type) -> bool { in is_unsized()
651 Type::CxxVector(_) | Type::Fn(_) | Type::Void(_) => true, in is_unsized()
664 fn is_opaque_cxx(cx: &mut Check, ty: &Ident) -> bool { in is_opaque_cxx()
671 fn span_for_struct_error(strct: &Struct) -> TokenStream { in span_for_struct_error()
678 fn span_for_enum_error(enm: &Enum) -> TokenStream { in span_for_enum_error()
685 fn span_for_receiver_error(receiver: &Receiver) -> TokenStream { in span_for_receiver_error()
698 fn span_for_generics_error(efn: &ExternFn) -> TokenStream { in span_for_generics_error()
705 fn describe(cx: &mut Check, ty: &Type) -> String { in describe()
736 Type::Fn(_) => "function pointer".to_owned(), in describe()