Skip to content

Commit 6c5c546

Browse files
committed
[DO NOT MERGE] Temporarily make the lint deny-by-default from crater
1 parent 23214cb commit 6c5c546

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

compiler/rustc_lint/src/types.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ declare_lint! {
192192
/// code generation units. Furthermore, different functions could have the
193193
/// same address after being merged together.
194194
UNPREDICTABLE_FUNCTION_POINTER_COMPARISONS,
195-
Warn,
195+
Deny,
196196
"detects unpredictable function pointer comparisons"
197197
}
198198

tests/ui/lint/fn-ptr-comparisons.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// check-pass
1+
// check-fail
22

33
extern "C" {
44
fn test();
@@ -14,21 +14,21 @@ fn main() {
1414
let g: F = f;
1515

1616
let _ = f == a;
17-
//~^ WARN function pointer comparisons
17+
//~^ ERROR function pointer comparisons
1818
let _ = f != a;
19-
//~^ WARN function pointer comparisons
19+
//~^ ERROR function pointer comparisons
2020
let _ = f == g;
21-
//~^ WARN function pointer comparisons
21+
//~^ ERROR function pointer comparisons
2222
let _ = f == f;
23-
//~^ WARN function pointer comparisons
23+
//~^ ERROR function pointer comparisons
2424
let _ = g == g;
25-
//~^ WARN function pointer comparisons
25+
//~^ ERROR function pointer comparisons
2626

2727
let cfn: extern "C" fn() = c;
2828
let _ = cfn == c;
29-
//~^ WARN function pointer comparisons
29+
//~^ ERROR function pointer comparisons
3030

3131
let t: unsafe extern "C" fn() = test;
3232
let _ = t == test;
33-
//~^ WARN function pointer comparisons
33+
//~^ ERROR function pointer comparisons
3434
}
+9-9
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
warning: function pointer comparisons do not produce meaningful results since their addresses are not guaranteed to be unique
1+
error: function pointer comparisons do not produce meaningful results since their addresses are not guaranteed to be unique
22
--> $DIR/fn-ptr-comparisons.rs:16:13
33
|
44
LL | let _ = f == a;
55
| ^^^^^^
66
|
77
= note: the address of the same function can very between different codegen units
88
= note: furthermore, different functions could have the same address after being merged together
9-
= note: `#[warn(unpredictable_function_pointer_comparisons)]` on by default
9+
= note: `#[deny(unpredictable_function_pointer_comparisons)]` on by default
1010

11-
warning: function pointer comparisons do not produce meaningful results since their addresses are not guaranteed to be unique
11+
error: function pointer comparisons do not produce meaningful results since their addresses are not guaranteed to be unique
1212
--> $DIR/fn-ptr-comparisons.rs:18:13
1313
|
1414
LL | let _ = f != a;
@@ -17,7 +17,7 @@ LL | let _ = f != a;
1717
= note: the address of the same function can very between different codegen units
1818
= note: furthermore, different functions could have the same address after being merged together
1919

20-
warning: function pointer comparisons do not produce meaningful results since their addresses are not guaranteed to be unique
20+
error: function pointer comparisons do not produce meaningful results since their addresses are not guaranteed to be unique
2121
--> $DIR/fn-ptr-comparisons.rs:20:13
2222
|
2323
LL | let _ = f == g;
@@ -26,7 +26,7 @@ LL | let _ = f == g;
2626
= note: the address of the same function can very between different codegen units
2727
= note: furthermore, different functions could have the same address after being merged together
2828

29-
warning: function pointer comparisons do not produce meaningful results since their addresses are not guaranteed to be unique
29+
error: function pointer comparisons do not produce meaningful results since their addresses are not guaranteed to be unique
3030
--> $DIR/fn-ptr-comparisons.rs:22:13
3131
|
3232
LL | let _ = f == f;
@@ -35,7 +35,7 @@ LL | let _ = f == f;
3535
= note: the address of the same function can very between different codegen units
3636
= note: furthermore, different functions could have the same address after being merged together
3737

38-
warning: function pointer comparisons do not produce meaningful results since their addresses are not guaranteed to be unique
38+
error: function pointer comparisons do not produce meaningful results since their addresses are not guaranteed to be unique
3939
--> $DIR/fn-ptr-comparisons.rs:24:13
4040
|
4141
LL | let _ = g == g;
@@ -44,7 +44,7 @@ LL | let _ = g == g;
4444
= note: the address of the same function can very between different codegen units
4545
= note: furthermore, different functions could have the same address after being merged together
4646

47-
warning: function pointer comparisons do not produce meaningful results since their addresses are not guaranteed to be unique
47+
error: function pointer comparisons do not produce meaningful results since their addresses are not guaranteed to be unique
4848
--> $DIR/fn-ptr-comparisons.rs:28:13
4949
|
5050
LL | let _ = cfn == c;
@@ -53,7 +53,7 @@ LL | let _ = cfn == c;
5353
= note: the address of the same function can very between different codegen units
5454
= note: furthermore, different functions could have the same address after being merged together
5555

56-
warning: function pointer comparisons do not produce meaningful results since their addresses are not guaranteed to be unique
56+
error: function pointer comparisons do not produce meaningful results since their addresses are not guaranteed to be unique
5757
--> $DIR/fn-ptr-comparisons.rs:32:13
5858
|
5959
LL | let _ = t == test;
@@ -62,5 +62,5 @@ LL | let _ = t == test;
6262
= note: the address of the same function can very between different codegen units
6363
= note: furthermore, different functions could have the same address after being merged together
6464

65-
warning: 7 warnings emitted
65+
error: aborting due to 7 previous errors
6666

0 commit comments

Comments
 (0)