pub struct ImproperCTypesLint;
Implementations§
Source§impl<'tcx> ImproperCTypesLint
impl<'tcx> ImproperCTypesLint
Sourcefn check_type_for_external_abi_fnptr(
&mut self,
cx: &LateContext<'tcx>,
state: VisitorState,
hir_ty: &Ty<'tcx>,
ty: Ty<'tcx>,
fn_mode: CItemKind,
)
fn check_type_for_external_abi_fnptr( &mut self, cx: &LateContext<'tcx>, state: VisitorState, hir_ty: &Ty<'tcx>, ty: Ty<'tcx>, fn_mode: CItemKind, )
Find any fn-ptr types with external ABIs in ty
, and FFI-checks them.
For example, Option<extern "C" fn()>
FFI-checks extern "C" fn()
.
Sourcefn check_fn_for_external_abi_fnptr(
&mut self,
cx: &LateContext<'tcx>,
fn_mode: CItemKind,
def_id: LocalDefId,
decl: &'tcx FnDecl<'_>,
)
fn check_fn_for_external_abi_fnptr( &mut self, cx: &LateContext<'tcx>, fn_mode: CItemKind, def_id: LocalDefId, decl: &'tcx FnDecl<'_>, )
Regardless of a function’s need to be “ffi-safe”, look for fn-ptr argument/return types that need to be checked for ffi-safety.
Sourcefn check_reprc_adt(
&mut self,
cx: &LateContext<'tcx>,
item: &'tcx Item<'tcx>,
adt_def: AdtDef<'tcx>,
)
fn check_reprc_adt( &mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'tcx>, adt_def: AdtDef<'tcx>, )
For a local definition of a #[repr(C)] struct/enum/union, check that it is indeed FFI-safe.
fn check_foreign_static( &mut self, cx: &LateContext<'tcx>, id: OwnerId, span: Span, )
Sourcefn check_foreign_fn(
&mut self,
cx: &LateContext<'tcx>,
fn_mode: CItemKind,
def_id: LocalDefId,
decl: &'tcx FnDecl<'_>,
)
fn check_foreign_fn( &mut self, cx: &LateContext<'tcx>, fn_mode: CItemKind, def_id: LocalDefId, decl: &'tcx FnDecl<'_>, )
Check if a function’s argument types and result type are “ffi-safe”.
fn process_ffi_result( &self, cx: &LateContext<'tcx>, sp: Span, res: FfiResult<'tcx>, fn_mode: CItemKind, )
fn emit_ffi_unsafe_type_lint( &self, cx: &LateContext<'tcx>, ty: Ty<'tcx>, sp: Span, note: DiagMessage, help: Option<DiagMessage>, fn_mode: CItemKind, )
Trait Implementations§
Source§impl Clone for ImproperCTypesLint
impl Clone for ImproperCTypesLint
Source§fn clone(&self) -> ImproperCTypesLint
fn clone(&self) -> ImproperCTypesLint
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<'tcx> LateLintPass<'tcx> for ImproperCTypesLint
ImproperCTypesDefinitions
checks items outside of foreign items (e.g. stuff that isn’t in
extern "C" { }
blocks):
impl<'tcx> LateLintPass<'tcx> for ImproperCTypesLint
ImproperCTypesDefinitions
checks items outside of foreign items (e.g. stuff that isn’t in
extern "C" { }
blocks):
extern "<abi>" fn
definitions are checked in the same way as theImproperCtypesDeclarations
visitor checks functions if<abi>
is external (e.g. “C”).- All other items which contain types (e.g. other functions, struct definitions, etc) are checked for extern fn-ptrs with external ABIs.
fn check_foreign_item(&mut self, cx: &LateContext<'tcx>, it: &ForeignItem<'tcx>)
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'tcx>)
fn check_field_def( &mut self, cx: &LateContext<'tcx>, field: &'tcx FieldDef<'tcx>, )
fn check_fn( &mut self, cx: &LateContext<'tcx>, kind: FnKind<'tcx>, decl: &'tcx FnDecl<'_>, _: &'tcx Body<'_>, _: Span, id: LocalDefId, )
fn check_body(&mut self, _: &LateContext<'tcx>, _: &Body<'tcx>)
fn check_body_post(&mut self, _: &LateContext<'tcx>, _: &Body<'tcx>)
fn check_crate(&mut self, _: &LateContext<'tcx>)
fn check_crate_post(&mut self, _: &LateContext<'tcx>)
fn check_mod(&mut self, _: &LateContext<'tcx>, _: &'tcx Mod<'tcx>, _: HirId)
fn check_item_post(&mut self, _: &LateContext<'tcx>, _: &'tcx Item<'tcx>)
fn check_local(&mut self, _: &LateContext<'tcx>, _: &'tcx LetStmt<'tcx>)
fn check_block(&mut self, _: &LateContext<'tcx>, _: &'tcx Block<'tcx>)
fn check_block_post(&mut self, _: &LateContext<'tcx>, _: &'tcx Block<'tcx>)
fn check_stmt(&mut self, _: &LateContext<'tcx>, _: &'tcx Stmt<'tcx>)
fn check_arm(&mut self, _: &LateContext<'tcx>, _: &'tcx Arm<'tcx>)
fn check_pat(&mut self, _: &LateContext<'tcx>, _: &'tcx Pat<'tcx>)
fn check_lit(&mut self, _: &LateContext<'tcx>, _: HirId, _: Lit, _: bool)
fn check_expr(&mut self, _: &LateContext<'tcx>, _: &'tcx Expr<'tcx>)
fn check_expr_post(&mut self, _: &LateContext<'tcx>, _: &'tcx Expr<'tcx>)
fn check_ty(&mut self, _: &LateContext<'tcx>, _: &'tcx Ty<'tcx, AmbigArg>)
fn check_generic_param( &mut self, _: &LateContext<'tcx>, _: &'tcx GenericParam<'tcx>, )
fn check_generics(&mut self, _: &LateContext<'tcx>, _: &'tcx Generics<'tcx>)
fn check_poly_trait_ref( &mut self, _: &LateContext<'tcx>, _: &'tcx PolyTraitRef<'tcx>, )
fn check_trait_item(&mut self, _: &LateContext<'tcx>, _: &'tcx TraitItem<'tcx>)
fn check_impl_item(&mut self, _: &LateContext<'tcx>, _: &'tcx ImplItem<'tcx>)
fn check_impl_item_post( &mut self, _: &LateContext<'tcx>, _: &'tcx ImplItem<'tcx>, )
fn check_struct_def( &mut self, _: &LateContext<'tcx>, _: &'tcx VariantData<'tcx>, )
fn check_variant(&mut self, _: &LateContext<'tcx>, _: &'tcx Variant<'tcx>)
fn check_path(&mut self, _: &LateContext<'tcx>, _: &Path<'tcx>, _: HirId)
fn check_attribute(&mut self, _: &LateContext<'tcx>, _: &'tcx Attribute)
fn check_attributes(&mut self, _: &LateContext<'tcx>, _: &'tcx [Attribute])
fn check_attributes_post(&mut self, _: &LateContext<'tcx>, _: &'tcx [Attribute])
Source§impl LintPass for ImproperCTypesLint
impl LintPass for ImproperCTypesLint
impl Copy for ImproperCTypesLint
Auto Trait Implementations§
impl DynSend for ImproperCTypesLint
impl DynSync for ImproperCTypesLint
impl Freeze for ImproperCTypesLint
impl RefUnwindSafe for ImproperCTypesLint
impl Send for ImproperCTypesLint
impl Sync for ImproperCTypesLint
impl Unpin for ImproperCTypesLint
impl UnwindSafe for ImproperCTypesLint
Blanket Implementations§
Source§impl<'tcx, T> ArenaAllocatable<'tcx, IsCopy> for Twhere
T: Copy,
impl<'tcx, T> ArenaAllocatable<'tcx, IsCopy> for Twhere
T: Copy,
fn allocate_on(self, arena: &'tcx Arena<'tcx>) -> &'tcx mut T
fn allocate_from_iter( arena: &'tcx Arena<'tcx>, iter: impl IntoIterator<Item = T>, ) -> &'tcx mut [T]
Source§impl<'tcx, T> ArenaAllocatable<'tcx, IsCopy> for Twhere
T: Copy,
impl<'tcx, T> ArenaAllocatable<'tcx, IsCopy> for Twhere
T: Copy,
fn allocate_on(self, arena: &'tcx Arena<'tcx>) -> &'tcx mut T
fn allocate_from_iter( arena: &'tcx Arena<'tcx>, iter: impl IntoIterator<Item = T>, ) -> &'tcx mut [T]
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<P> IntoQueryParam<P> for P
impl<P> IntoQueryParam<P> for P
fn into_query_param(self) -> P
Source§impl<T> MaybeResult<T> for T
impl<T> MaybeResult<T> for T
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<I, T, U> Upcast<I, U> for Twhere
U: UpcastFrom<I, T>,
impl<I, T, U> Upcast<I, U> for Twhere
U: UpcastFrom<I, T>,
Source§impl<I, T> UpcastFrom<I, T> for T
impl<I, T> UpcastFrom<I, T> for T
fn upcast_from(from: T, _tcx: I) -> T
Source§impl<Tcx, T> Value<Tcx> for Twhere
Tcx: DepContext,
impl<Tcx, T> Value<Tcx> for Twhere
Tcx: DepContext,
default fn from_cycle_error( tcx: Tcx, cycle_error: &CycleError, _guar: ErrorGuaranteed, ) -> T
Source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
Source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
Source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<T> ErasedDestructor for Twhere
T: 'static,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 0 bytes