Skip to content

Commit

Permalink
Allow fn pointers comparisons lint in UI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Urgau committed Oct 20, 2024
1 parent 999ff42 commit f828705
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/tools/miri/tests/pass/function_pointers.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(unpredictable_function_pointer_comparisons)]

use std::mem;

trait Answer {
Expand Down
2 changes: 2 additions & 0 deletions src/tools/miri/tests/pass/issues/issue-91636.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(unpredictable_function_pointer_comparisons)]

type BuiltIn = for<'a> fn(&str);

struct Function {
Expand Down
3 changes: 3 additions & 0 deletions tests/ui/binop/binary-op-on-fn-ptr-eq.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
//@ run-pass
// Tests equality between supertype and subtype of a function
// See the issue #91636

#![allow(unpredictable_function_pointer_comparisons)]

fn foo(_a: &str) {}

fn main() {
Expand Down
3 changes: 3 additions & 0 deletions tests/ui/box/unit/unique-ffi-symbols.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
//@ run-pass
// We used to have a __rust_abi shim that resulted in duplicated symbols
// whenever the item path wasn't enough to disambiguate between them.

#![allow(unpredictable_function_pointer_comparisons)]

fn main() {
let a = {
extern "C" fn good() -> i32 { return 0; }
Expand Down
2 changes: 2 additions & 0 deletions tests/ui/consts/const-extern-function.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//@ run-pass

#![allow(non_upper_case_globals)]
#![allow(unpredictable_function_pointer_comparisons)]

extern "C" fn foopy() {}

Expand Down
2 changes: 2 additions & 0 deletions tests/ui/cross-crate/const-cross-crate-extern.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
//@ run-pass
//@ aux-build:cci_const.rs

#![allow(non_upper_case_globals)]
#![allow(unpredictable_function_pointer_comparisons)]

extern crate cci_const;
use cci_const::bar;
Expand Down
1 change: 1 addition & 0 deletions tests/ui/extern/extern-compare-with-return-type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

// Tests that we can compare various kinds of extern fn signatures.
#![allow(non_camel_case_types)]
#![allow(unpredictable_function_pointer_comparisons)]

// `dbg!()` differentiates these functions to ensure they won't be merged.
extern "C" fn voidret1() { dbg!() }
Expand Down
2 changes: 2 additions & 0 deletions tests/ui/extern/extern-take-value.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
//@ run-pass
//@ aux-build:extern-take-value.rs

#![allow(unpredictable_function_pointer_comparisons)]

extern crate extern_take_value;

pub fn main() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
//@ compile-flags: -C opt-level=3
//@ run-pass

#![allow(unpredictable_function_pointer_comparisons)]

fn foo(_i: i32) -> i32 {
1
}
Expand Down
2 changes: 2 additions & 0 deletions tests/ui/issues/issue-54696.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//@ run-pass

#![allow(unpredictable_function_pointer_comparisons)]

fn main() {
// We shouldn't promote this
let _ = &(main as fn() == main as fn());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
//@ check-pass
//@ compile-flags: -Zvalidate-mir

#![allow(unpredictable_function_pointer_comparisons)]

fn foo(_a: &str) {}

fn main() {
Expand Down

0 comments on commit f828705

Please sign in to comment.