Skip to content

Commit 002a066

Browse files
committed
lint ImproperCTypes: make clippy happy [...]
about the changes in rust_codegen_llvm
1 parent f71cfba commit 002a066

File tree

7 files changed

+15
-8
lines changed

7 files changed

+15
-8
lines changed

compiler/rustc_codegen_llvm/src/llvm/ffi.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1306,7 +1306,8 @@ unsafe extern "C" {
13061306
);
13071307

13081308
// Instruction builders
1309-
|wrap pub(crate) fn LLVMCreateBuilderInContext(C: &Context) -> &mut Builder<'_>;
1309+
|wrap #[allow(clippy::mut_from_ref)] // FIXME?
1310+
pub(crate) fn LLVMCreateBuilderInContext(C: &Context) -> &mut Builder<'_>;
13101311
pub(crate) fn LLVMPositionBuilderAtEnd<'a>(Builder: &Builder<'a>, Block: &'a BasicBlock);
13111312
|wrap pub(crate) fn LLVMGetInsertBlock<'a>(Builder_: &Builder<'a>) -> &'a BasicBlock;
13121313
pub(crate) fn LLVMDisposeBuilder<'a>(Builder: &'a mut Builder<'a>);
@@ -2566,7 +2567,8 @@ unsafe extern "C" {
25662567
pub(crate) fn LLVMRustRunRestrictionPass(M: &Module, syms: *const *const c_char, len: size_t);
25672568

25682569
pub(crate) fn LLVMRustOpenArchive(path: *const c_char) -> Option<&'static mut Archive>;
2569-
|wrap pub(crate) fn LLVMRustArchiveIteratorNew(AR: &Archive) -> &mut ArchiveIterator<'_>;
2570+
|wrap #[allow(clippy::mut_from_ref)] // FIXME?
2571+
pub(crate) fn LLVMRustArchiveIteratorNew(AR: &Archive) -> &mut ArchiveIterator<'_>;
25702572
pub(crate) fn LLVMRustArchiveIteratorNext<'a>(
25712573
AIR: &ArchiveIterator<'a>,
25722574
) -> Option<&'a mut ArchiveChild<'a>>;
@@ -2687,7 +2689,8 @@ unsafe extern "C" {
26872689
out_len: &mut usize,
26882690
) -> *const u8;
26892691

2690-
|wrap pub(crate) fn LLVMRustLinkerNew(M: &Module) -> &mut Linker<'_>;
2692+
|wrap #[allow(clippy::mut_from_ref)] // FIXME?
2693+
pub(crate) fn LLVMRustLinkerNew(M: &Module) -> &mut Linker<'_>;
26912694
pub(crate) fn LLVMRustLinkerAdd(
26922695
linker: &Linker<'_>,
26932696
bytecode: *const c_char,

compiler/rustc_lint/src/types/improper_ctypes.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2038,7 +2038,8 @@ declare_lint! {
20382038
/// ### Example
20392039
///
20402040
/// ```rust
2041-
/// # #![unsafe(no_mangle)]
2041+
/// # #[unsafe(no_mangle)]
2042+
/// # #[used]
20422043
/// static mut PLUGIN_ABI_MIN_VERSION: &'static str = "0.0.5";
20432044
/// ```
20442045
///

src/tools/clippy/tests/ui/boxed_local.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,11 @@ mod issue_3739 {
171171
/// Issue #5542
172172
///
173173
/// This shouldn't warn for `boxed_local` as it is intended to called from non-Rust code.
174-
pub extern "C" fn do_not_warn_me(_c_pointer: Box<String>) -> () {}
174+
pub extern "C" fn do_not_warn_me(_c_pointer: Option<Box<String>>) -> () {}
175175

176176
#[allow(missing_abi)]
177177
#[rustfmt::skip] // Forces rustfmt to not add ABI
178-
pub extern fn do_not_warn_me_no_abi(_c_pointer: Box<String>) -> () {}
178+
pub extern fn do_not_warn_me_no_abi(_c_pointer: Option<Box<String>>) -> () {}
179179

180180
// Issue #4804 - default implementation in trait
181181
mod issue4804 {

src/tools/clippy/tests/ui/ptr_arg.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@ mod issue_9218 {
317317
}
318318
}
319319

320+
#[allow(improper_c_fn_definitions)]
320321
mod issue_11181 {
321322
extern "C" fn allowed(_v: &Vec<u32>) {}
322323

src/tools/clippy/tests/ui/ptr_arg.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,13 +229,13 @@ LL | fn cow_bad_ret_ty_2<'a, 'b>(input: &'a Cow<'a, str>) -> &'b str {
229229
| ^^^^^^^^^^^^^^^^ help: change this to: `&str`
230230

231231
error: writing `&String` instead of `&str` involves a new object where a slice will do
232-
--> tests/ui/ptr_arg.rs:347:17
232+
--> tests/ui/ptr_arg.rs:348:17
233233
|
234234
LL | fn good(v1: &String, v2: &String) {
235235
| ^^^^^^^ help: change this to: `&str`
236236

237237
error: writing `&String` instead of `&str` involves a new object where a slice will do
238-
--> tests/ui/ptr_arg.rs:347:30
238+
--> tests/ui/ptr_arg.rs:348:30
239239
|
240240
LL | fn good(v1: &String, v2: &String) {
241241
| ^^^^^^^ help: change this to: `&str`

src/tools/lint-docs/src/groups.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ static GROUP_DESCRIPTIONS: &[(&str, &str)] = &[
2626
"Lints that detect identifiers which will be come keywords in later editions",
2727
),
2828
("deprecated-safe", "Lints for functions which were erroneously marked as safe in the past"),
29+
("improper-c-boundaries", "Lints for points where rust code interacts with non-rust code"),
2930
];
3031

3132
type LintGroups = BTreeMap<String, BTreeSet<String>>;

src/tools/miri/tests/fail/function_calls/exported_symbol_wrong_type.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#[no_mangle]
2+
#[allow(improper_c_var_definitions)]
23
static FOO: () = ();
34

45
fn main() {

0 commit comments

Comments
 (0)