Skip to content

Commit 0435917

Browse files
committed
Enable tests for unsafe blocks in inline const patterns
1 parent 3b2bf26 commit 0435917

File tree

4 files changed

+39
-3
lines changed

4 files changed

+39
-3
lines changed

Diff for: tests/ui/inline-const/pat-unsafe-err.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// ignore-test This is currently broken
2-
31
#![allow(incomplete_features)]
42
#![feature(inline_const_pat)]
53

Diff for: tests/ui/inline-const/pat-unsafe-err.stderr

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
error[E0133]: call to unsafe function `require_unsafe` is unsafe and requires unsafe function or block
2+
--> $DIR/pat-unsafe-err.rs:11:13
3+
|
4+
LL | require_unsafe();
5+
| ^^^^^^^^^^^^^^^^ call to unsafe function
6+
|
7+
= note: consult the function's documentation for information on how to avoid undefined behavior
8+
9+
error[E0133]: call to unsafe function `require_unsafe` is unsafe and requires unsafe function or block
10+
--> $DIR/pat-unsafe-err.rs:18:13
11+
|
12+
LL | require_unsafe()
13+
| ^^^^^^^^^^^^^^^^ call to unsafe function
14+
|
15+
= note: consult the function's documentation for information on how to avoid undefined behavior
16+
17+
error: aborting due to 2 previous errors
18+
19+
For more information about this error, try `rustc --explain E0133`.

Diff for: tests/ui/inline-const/pat-unsafe.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// check-pass
2-
// ignore-test This is currently broken
32

43
#![allow(incomplete_features)]
54
#![warn(unused_unsafe)]

Diff for: tests/ui/inline-const/pat-unsafe.stderr

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
warning: unnecessary `unsafe` block
2+
--> $DIR/pat-unsafe.rs:16:17
3+
|
4+
LL | unsafe {}
5+
| ^^^^^^ unnecessary `unsafe` block
6+
|
7+
note: the lint level is defined here
8+
--> $DIR/pat-unsafe.rs:4:9
9+
|
10+
LL | #![warn(unused_unsafe)]
11+
| ^^^^^^^^^^^^^
12+
13+
warning: unnecessary `unsafe` block
14+
--> $DIR/pat-unsafe.rs:23:17
15+
|
16+
LL | unsafe {}
17+
| ^^^^^^ unnecessary `unsafe` block
18+
19+
warning: 2 warnings emitted
20+

0 commit comments

Comments
 (0)