This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +80
-0
lines changed Expand file tree Collapse file tree 6 files changed +80
-0
lines changed Original file line number Diff line number Diff line change 1+ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
2+ --> $DIR/expr-unsafe-err.rs:8:9
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: aborting due to previous error
10+
11+ For more information about this error, try `rustc --explain E0133`.
Original file line number Diff line number Diff line change 1+ // revisions: mir thir
2+ // [thir]compile-flags: -Z thir-unsafeck
3+ #![ feature( inline_const) ]
4+ const unsafe fn require_unsafe ( ) -> usize { 1 }
5+
6+ fn main ( ) {
7+ const {
8+ require_unsafe ( ) ;
9+ //~^ ERROR [E0133]
10+ }
11+ }
Original file line number Diff line number Diff line change 1+ error[E0133]: call to unsafe function `require_unsafe` is unsafe and requires unsafe function or block
2+ --> $DIR/expr-unsafe-err.rs:8:9
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: aborting due to previous error
10+
11+ For more information about this error, try `rustc --explain E0133`.
Original file line number Diff line number Diff line change 1+ warning: unnecessary `unsafe` block
2+ --> $DIR/expr-unsafe.rs:12:13
3+ |
4+ LL | unsafe {}
5+ | ^^^^^^ unnecessary `unsafe` block
6+ |
7+ note: the lint level is defined here
8+ --> $DIR/expr-unsafe.rs:4:9
9+ |
10+ LL | #![warn(unused_unsafe)]
11+ | ^^^^^^^^^^^^^
12+
13+ warning: 1 warning emitted
14+
Original file line number Diff line number Diff line change 1+ // check-pass
2+ // revisions: mir thir
3+ // [thir]compile-flags: -Z thir-unsafeck
4+ #![ warn( unused_unsafe) ]
5+ #![ feature( inline_const) ]
6+ const unsafe fn require_unsafe ( ) -> usize { 1 }
7+
8+ fn main ( ) {
9+ unsafe {
10+ const {
11+ require_unsafe ( ) ;
12+ unsafe { }
13+ //~^ WARNING unnecessary `unsafe` block
14+ }
15+ }
16+ }
Original file line number Diff line number Diff line change 1+ warning: unnecessary `unsafe` block
2+ --> $DIR/expr-unsafe.rs:12:13
3+ |
4+ LL | unsafe {
5+ | ------ because it's nested under this `unsafe` block
6+ ...
7+ LL | unsafe {}
8+ | ^^^^^^ unnecessary `unsafe` block
9+ |
10+ note: the lint level is defined here
11+ --> $DIR/expr-unsafe.rs:4:9
12+ |
13+ LL | #![warn(unused_unsafe)]
14+ | ^^^^^^^^^^^^^
15+
16+ warning: 1 warning emitted
17+
You can’t perform that action at this time.
0 commit comments