Surround PhantomData in backticks

This commit is contained in:
varkor 2019-09-10 18:16:47 +01:00
parent df7e496f85
commit 79368db1ce
3 changed files with 7 additions and 7 deletions

View File

@ -903,7 +903,7 @@ fn check_type_for_ffi_and_report_errors(&mut self, sp: Span, ty: Ty<'tcx>) {
self.cx.span_lint(IMPROPER_CTYPES,
sp,
&format!("`extern` block uses type `{}` which is not FFI-safe: \
composed only of PhantomData", ty));
composed only of `PhantomData`", ty));
}
FfiResult::FfiUnsafe { ty: unsafe_ty, reason, help } => {
let msg = format!("`extern` block uses type `{}` which is not FFI-safe: {}",

View File

@ -1,7 +1,7 @@
#![deny(improper_ctypes)]
#![feature(rustc_private)]
#![allow(private_in_public)]
#![deny(improper_ctypes)]
extern crate libc;
@ -55,9 +55,9 @@ pub struct StructWithProjectionAndLifetime<'a>(
pub fn tuple_type(p: (i32, i32)); //~ ERROR uses type `(i32, i32)`
pub fn tuple_type2(p: I32Pair); //~ ERROR uses type `(i32, i32)`
pub fn zero_size(p: ZeroSize); //~ ERROR struct has no fields
pub fn zero_size_phantom(p: ZeroSizeWithPhantomData); //~ ERROR composed only of PhantomData
pub fn zero_size_phantom(p: ZeroSizeWithPhantomData); //~ ERROR composed only of `PhantomData`
pub fn zero_size_phantom_toplevel()
-> ::std::marker::PhantomData<bool>; //~ ERROR: composed only of PhantomData
-> ::std::marker::PhantomData<bool>; //~ ERROR: composed only of `PhantomData`
pub fn fn_type(p: RustFn); //~ ERROR function pointer has Rust-specific
pub fn fn_type2(p: fn()); //~ ERROR function pointer has Rust-specific
pub fn fn_contained(p: RustBadRet); //~ ERROR: uses type `std::boxed::Box<u32>`

View File

@ -5,7 +5,7 @@ LL | pub fn ptr_type1(size: *const Foo);
| ^^^^^^^^^^
|
note: lint level defined here
--> $DIR/lint-ctypes.rs:1:9
--> $DIR/lint-ctypes.rs:4:9
|
LL | #![deny(improper_ctypes)]
| ^^^^^^^^^^^^^^^
@ -108,13 +108,13 @@ note: type defined here
LL | pub struct ZeroSize;
| ^^^^^^^^^^^^^^^^^^^^
error: `extern` block uses type `ZeroSizeWithPhantomData` which is not FFI-safe: composed only of PhantomData
error: `extern` block uses type `ZeroSizeWithPhantomData` which is not FFI-safe: composed only of `PhantomData`
--> $DIR/lint-ctypes.rs:58:33
|
LL | pub fn zero_size_phantom(p: ZeroSizeWithPhantomData);
| ^^^^^^^^^^^^^^^^^^^^^^^
error: `extern` block uses type `std::marker::PhantomData<bool>` which is not FFI-safe: composed only of PhantomData
error: `extern` block uses type `std::marker::PhantomData<bool>` which is not FFI-safe: composed only of `PhantomData`
--> $DIR/lint-ctypes.rs:60:12
|
LL | -> ::std::marker::PhantomData<bool>;