Skip to content

Commit

Permalink
Enable tests for unsafe blocks in inline const patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewjasper committed Jan 29, 2024
1 parent 83fa46f commit 44824e0
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 3 deletions.
2 changes: 0 additions & 2 deletions tests/ui/inline-const/pat-unsafe-err.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// ignore-test This is currently broken

#![allow(incomplete_features)]
#![feature(inline_const_pat)]

Expand Down
19 changes: 19 additions & 0 deletions tests/ui/inline-const/pat-unsafe-err.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
error[E0133]: call to unsafe function `require_unsafe` is unsafe and requires unsafe function or block
--> $DIR/pat-unsafe-err.rs:11:13
|
LL | require_unsafe();
| ^^^^^^^^^^^^^^^^ call to unsafe function
|
= note: consult the function's documentation for information on how to avoid undefined behavior

error[E0133]: call to unsafe function `require_unsafe` is unsafe and requires unsafe function or block
--> $DIR/pat-unsafe-err.rs:18:13
|
LL | require_unsafe()
| ^^^^^^^^^^^^^^^^ call to unsafe function
|
= note: consult the function's documentation for information on how to avoid undefined behavior

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0133`.
1 change: 0 additions & 1 deletion tests/ui/inline-const/pat-unsafe.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// check-pass
// ignore-test This is currently broken

#![allow(incomplete_features)]
#![warn(unused_unsafe)]
Expand Down
20 changes: 20 additions & 0 deletions tests/ui/inline-const/pat-unsafe.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
warning: unnecessary `unsafe` block
--> $DIR/pat-unsafe.rs:16:17
|
LL | unsafe {}
| ^^^^^^ unnecessary `unsafe` block
|
note: the lint level is defined here
--> $DIR/pat-unsafe.rs:4:9
|
LL | #![warn(unused_unsafe)]
| ^^^^^^^^^^^^^

warning: unnecessary `unsafe` block
--> $DIR/pat-unsafe.rs:23:17
|
LL | unsafe {}
| ^^^^^^ unnecessary `unsafe` block

warning: 2 warnings emitted

0 comments on commit 44824e0

Please sign in to comment.