Test -Zthir-unsafeck for unsafe function calls
This commit is contained in:
parent
29780f43e2
commit
a95b342f02
46 changed files with 422 additions and 45 deletions
|
|
@ -1,5 +1,5 @@
|
|||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/async-unsafe-fn-call-in-safe.rs:12:5
|
||||
--> $DIR/async-unsafe-fn-call-in-safe.rs:14:5
|
||||
|
|
||||
LL | S::f();
|
||||
| ^^^^^^ call to unsafe function
|
||||
|
|
@ -7,7 +7,7 @@ LL | S::f();
|
|||
= note: consult the function's documentation for information on how to avoid undefined behavior
|
||||
|
||||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/async-unsafe-fn-call-in-safe.rs:13:5
|
||||
--> $DIR/async-unsafe-fn-call-in-safe.rs:15:5
|
||||
|
|
||||
LL | f();
|
||||
| ^^^ call to unsafe function
|
||||
|
|
@ -15,7 +15,7 @@ LL | f();
|
|||
= note: consult the function's documentation for information on how to avoid undefined behavior
|
||||
|
||||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/async-unsafe-fn-call-in-safe.rs:17:5
|
||||
--> $DIR/async-unsafe-fn-call-in-safe.rs:19:5
|
||||
|
|
||||
LL | S::f();
|
||||
| ^^^^^^ call to unsafe function
|
||||
|
|
@ -23,7 +23,7 @@ LL | S::f();
|
|||
= note: consult the function's documentation for information on how to avoid undefined behavior
|
||||
|
||||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/async-unsafe-fn-call-in-safe.rs:18:5
|
||||
--> $DIR/async-unsafe-fn-call-in-safe.rs:20:5
|
||||
|
|
||||
LL | f();
|
||||
| ^^^ call to unsafe function
|
||||
|
|
@ -1,4 +1,6 @@
|
|||
// edition:2018
|
||||
// revisions: mir thir
|
||||
// [thir]compile-flags: -Z thir-unsafeck
|
||||
|
||||
struct S;
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/async-unsafe-fn-call-in-safe.rs:14:5
|
||||
|
|
||||
LL | S::f();
|
||||
| ^^^^^^ call to unsafe function
|
||||
|
|
||||
= note: consult the function's documentation for information on how to avoid undefined behavior
|
||||
|
||||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/async-unsafe-fn-call-in-safe.rs:15:5
|
||||
|
|
||||
LL | f();
|
||||
| ^^^ call to unsafe function
|
||||
|
|
||||
= note: consult the function's documentation for information on how to avoid undefined behavior
|
||||
|
||||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/async-unsafe-fn-call-in-safe.rs:19:5
|
||||
|
|
||||
LL | S::f();
|
||||
| ^^^^^^ call to unsafe function
|
||||
|
|
||||
= note: consult the function's documentation for information on how to avoid undefined behavior
|
||||
|
||||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/async-unsafe-fn-call-in-safe.rs:20:5
|
||||
|
|
||||
LL | f();
|
||||
| ^^^ call to unsafe function
|
||||
|
|
||||
= note: consult the function's documentation for information on how to avoid undefined behavior
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0133`.
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/closure_no_cap_coerce_many_unsafe_0.rs:12:23
|
||||
--> $DIR/closure_no_cap_coerce_many_unsafe_0.rs:15:23
|
||||
|
|
||||
LL | let result: i32 = foo(5, 5);
|
||||
| ^^^^^^^^^ call to unsafe function
|
||||
|
|
@ -7,7 +7,7 @@ LL | let result: i32 = foo(5, 5);
|
|||
= note: consult the function's documentation for information on how to avoid undefined behavior
|
||||
|
||||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/closure_no_cap_coerce_many_unsafe_0.rs:21:23
|
||||
--> $DIR/closure_no_cap_coerce_many_unsafe_0.rs:24:23
|
||||
|
|
||||
LL | let result: i32 = foo(5, 5);
|
||||
| ^^^^^^^^^ call to unsafe function
|
||||
|
|
@ -1,3 +1,6 @@
|
|||
// revisions: mir thir
|
||||
// [thir]compile-flags: -Z thir-unsafeck
|
||||
|
||||
// Ensure we get unsafe function after coercion
|
||||
unsafe fn add(a: i32, b: i32) -> i32 {
|
||||
a + b
|
||||
|
|
|
|||
|
|
@ -0,0 +1,19 @@
|
|||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/closure_no_cap_coerce_many_unsafe_0.rs:15:23
|
||||
|
|
||||
LL | let result: i32 = foo(5, 5);
|
||||
| ^^^^^^^^^ call to unsafe function
|
||||
|
|
||||
= note: consult the function's documentation for information on how to avoid undefined behavior
|
||||
|
||||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/closure_no_cap_coerce_many_unsafe_0.rs:24:23
|
||||
|
|
||||
LL | let result: i32 = foo(5, 5);
|
||||
| ^^^^^^^^^ 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,5 +1,5 @@
|
|||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/coerce-unsafe-closure-to-unsafe-fn-ptr.rs:2:31
|
||||
--> $DIR/coerce-unsafe-closure-to-unsafe-fn-ptr.rs:5:31
|
||||
|
|
||||
LL | let _: unsafe fn() = || { ::std::pin::Pin::new_unchecked(&0_u8); };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
||||
|
|
@ -1,3 +1,6 @@
|
|||
// revisions: mir thir
|
||||
// [thir]compile-flags: -Z thir-unsafeck
|
||||
|
||||
fn main() {
|
||||
let _: unsafe fn() = || { ::std::pin::Pin::new_unchecked(&0_u8); };
|
||||
//~^ ERROR E0133
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/coerce-unsafe-closure-to-unsafe-fn-ptr.rs:5:31
|
||||
|
|
||||
LL | let _: unsafe fn() = || { ::std::pin::Pin::new_unchecked(&0_u8); };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
||||
|
|
||||
= note: consult the function's documentation for information on how to avoid undefined behavior
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0133`.
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/const-extern-fn-requires-unsafe.rs:8:5
|
||||
--> $DIR/const-extern-fn-requires-unsafe.rs:11:5
|
||||
|
|
||||
LL | foo();
|
||||
| ^^^^^ call to unsafe function
|
||||
|
|
@ -7,7 +7,7 @@ LL | foo();
|
|||
= note: consult the function's documentation for information on how to avoid undefined behavior
|
||||
|
||||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/const-extern-fn-requires-unsafe.rs:6:17
|
||||
--> $DIR/const-extern-fn-requires-unsafe.rs:9:17
|
||||
|
|
||||
LL | let a: [u8; foo()];
|
||||
| ^^^^^ call to unsafe function
|
||||
|
|
@ -1,3 +1,6 @@
|
|||
// revisions: mir thir
|
||||
// [thir]compile-flags: -Z thir-unsafeck
|
||||
|
||||
#![feature(const_extern_fn)]
|
||||
|
||||
const unsafe extern "C" fn foo() -> usize { 5 }
|
||||
|
|
|
|||
|
|
@ -0,0 +1,19 @@
|
|||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/const-extern-fn-requires-unsafe.rs:11:5
|
||||
|
|
||||
LL | foo();
|
||||
| ^^^^^ call to unsafe function
|
||||
|
|
||||
= note: consult the function's documentation for information on how to avoid undefined behavior
|
||||
|
||||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/const-extern-fn-requires-unsafe.rs:9:17
|
||||
|
|
||||
LL | let a: [u8; foo()];
|
||||
| ^^^^^ 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,5 +1,5 @@
|
|||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/E0133.rs:4:5
|
||||
--> $DIR/E0133.rs:7:5
|
||||
|
|
||||
LL | f();
|
||||
| ^^^ call to unsafe function
|
||||
|
|
@ -1,3 +1,6 @@
|
|||
// revisions: mir thir
|
||||
// [thir]compile-flags: -Z thir-unsafeck
|
||||
|
||||
unsafe fn f() { return; }
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/unsafe-fn-called-from-safe.rs:4:5
|
||||
--> $DIR/E0133.rs:7:5
|
||||
|
|
||||
LL | f();
|
||||
| ^^^ call to unsafe function
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0658]: `transmute` is not allowed in constant functions
|
||||
--> $DIR/feature-gate-const_fn_transmute.rs:8:43
|
||||
--> $DIR/feature-gate-const_fn_transmute.rs:11:43
|
||||
|
|
||||
LL | const fn transmute_fn() -> u32 { unsafe { mem::transmute(Foo(3)) } }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -9,7 +9,7 @@ LL | const fn transmute_fn() -> u32 { unsafe { mem::transmute(Foo(3)) } }
|
|||
= note: `transmute` is only allowed in constants and statics for now
|
||||
|
||||
error[E0658]: `transmute` is not allowed in constant functions
|
||||
--> $DIR/feature-gate-const_fn_transmute.rs:11:53
|
||||
--> $DIR/feature-gate-const_fn_transmute.rs:14:53
|
||||
|
|
||||
LL | const fn transmute_fn_intrinsic() -> u32 { unsafe { std::intrinsics::transmute(Foo(3)) } }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -19,7 +19,7 @@ LL | const fn transmute_fn_intrinsic() -> u32 { unsafe { std::intrinsics::transm
|
|||
= note: `transmute` is only allowed in constants and statics for now
|
||||
|
||||
error[E0658]: `transmute` is not allowed in constant functions
|
||||
--> $DIR/feature-gate-const_fn_transmute.rs:14:58
|
||||
--> $DIR/feature-gate-const_fn_transmute.rs:17:58
|
||||
|
|
||||
LL | const fn transmute_fn_core_intrinsic() -> u32 { unsafe { core::intrinsics::transmute(Foo(3)) } }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -29,7 +29,7 @@ LL | const fn transmute_fn_core_intrinsic() -> u32 { unsafe { core::intrinsics::
|
|||
= note: `transmute` is only allowed in constants and statics for now
|
||||
|
||||
error[E0658]: `transmute` is not allowed in constant functions
|
||||
--> $DIR/feature-gate-const_fn_transmute.rs:17:48
|
||||
--> $DIR/feature-gate-const_fn_transmute.rs:20:48
|
||||
|
|
||||
LL | const unsafe fn unsafe_transmute_fn() -> u32 { mem::transmute(Foo(3)) }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -39,7 +39,7 @@ LL | const unsafe fn unsafe_transmute_fn() -> u32 { mem::transmute(Foo(3)) }
|
|||
= note: `transmute` is only allowed in constants and statics for now
|
||||
|
||||
error[E0658]: `transmute` is not allowed in constant functions
|
||||
--> $DIR/feature-gate-const_fn_transmute.rs:20:58
|
||||
--> $DIR/feature-gate-const_fn_transmute.rs:23:58
|
||||
|
|
||||
LL | const unsafe fn unsafe_transmute_fn_intrinsic() -> u32 { std::intrinsics::transmute(Foo(3)) }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -49,7 +49,7 @@ LL | const unsafe fn unsafe_transmute_fn_intrinsic() -> u32 { std::intrinsics::t
|
|||
= note: `transmute` is only allowed in constants and statics for now
|
||||
|
||||
error[E0658]: `transmute` is not allowed in constant functions
|
||||
--> $DIR/feature-gate-const_fn_transmute.rs:23:63
|
||||
--> $DIR/feature-gate-const_fn_transmute.rs:26:63
|
||||
|
|
||||
LL | const unsafe fn unsafe_transmute_fn_core_intrinsic() -> u32 { core::intrinsics::transmute(Foo(3)) }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -59,7 +59,7 @@ LL | const unsafe fn unsafe_transmute_fn_core_intrinsic() -> u32 { core::intrins
|
|||
= note: `transmute` is only allowed in constants and statics for now
|
||||
|
||||
error[E0658]: `transmute` is not allowed in constant functions
|
||||
--> $DIR/feature-gate-const_fn_transmute.rs:26:39
|
||||
--> $DIR/feature-gate-const_fn_transmute.rs:29:39
|
||||
|
|
||||
LL | const fn safe_transmute_fn() -> u32 { mem::transmute(Foo(3)) }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -69,7 +69,7 @@ LL | const fn safe_transmute_fn() -> u32 { mem::transmute(Foo(3)) }
|
|||
= note: `transmute` is only allowed in constants and statics for now
|
||||
|
||||
error[E0658]: `transmute` is not allowed in constant functions
|
||||
--> $DIR/feature-gate-const_fn_transmute.rs:30:49
|
||||
--> $DIR/feature-gate-const_fn_transmute.rs:33:49
|
||||
|
|
||||
LL | const fn safe_transmute_fn_intrinsic() -> u32 { std::intrinsics::transmute(Foo(3)) }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -79,7 +79,7 @@ LL | const fn safe_transmute_fn_intrinsic() -> u32 { std::intrinsics::transmute(
|
|||
= note: `transmute` is only allowed in constants and statics for now
|
||||
|
||||
error[E0658]: `transmute` is not allowed in constant functions
|
||||
--> $DIR/feature-gate-const_fn_transmute.rs:34:54
|
||||
--> $DIR/feature-gate-const_fn_transmute.rs:37:54
|
||||
|
|
||||
LL | const fn safe_transmute_fn_core_intrinsic() -> u32 { core::intrinsics::transmute(Foo(3)) }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -89,7 +89,7 @@ LL | const fn safe_transmute_fn_core_intrinsic() -> u32 { core::intrinsics::tran
|
|||
= note: `transmute` is only allowed in constants and statics for now
|
||||
|
||||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/feature-gate-const_fn_transmute.rs:26:39
|
||||
--> $DIR/feature-gate-const_fn_transmute.rs:29:39
|
||||
|
|
||||
LL | const fn safe_transmute_fn() -> u32 { mem::transmute(Foo(3)) }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
||||
|
|
@ -97,7 +97,7 @@ LL | const fn safe_transmute_fn() -> u32 { mem::transmute(Foo(3)) }
|
|||
= note: consult the function's documentation for information on how to avoid undefined behavior
|
||||
|
||||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/feature-gate-const_fn_transmute.rs:30:49
|
||||
--> $DIR/feature-gate-const_fn_transmute.rs:33:49
|
||||
|
|
||||
LL | const fn safe_transmute_fn_intrinsic() -> u32 { std::intrinsics::transmute(Foo(3)) }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
||||
|
|
@ -105,7 +105,7 @@ LL | const fn safe_transmute_fn_intrinsic() -> u32 { std::intrinsics::transmute(
|
|||
= note: consult the function's documentation for information on how to avoid undefined behavior
|
||||
|
||||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/feature-gate-const_fn_transmute.rs:34:54
|
||||
--> $DIR/feature-gate-const_fn_transmute.rs:37:54
|
||||
|
|
||||
LL | const fn safe_transmute_fn_core_intrinsic() -> u32 { core::intrinsics::transmute(Foo(3)) }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
||||
|
|
@ -1,3 +1,6 @@
|
|||
// revisions: mir thir
|
||||
// [thir]compile-flags: -Z thir-unsafeck
|
||||
|
||||
use std::mem;
|
||||
|
||||
#[repr(transparent)]
|
||||
|
|
|
|||
|
|
@ -0,0 +1,118 @@
|
|||
error[E0658]: `transmute` is not allowed in constant functions
|
||||
--> $DIR/feature-gate-const_fn_transmute.rs:11:43
|
||||
|
|
||||
LL | const fn transmute_fn() -> u32 { unsafe { mem::transmute(Foo(3)) } }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #53605 <https://github.com/rust-lang/rust/issues/53605> for more information
|
||||
= help: add `#![feature(const_fn_transmute)]` to the crate attributes to enable
|
||||
= note: `transmute` is only allowed in constants and statics for now
|
||||
|
||||
error[E0658]: `transmute` is not allowed in constant functions
|
||||
--> $DIR/feature-gate-const_fn_transmute.rs:14:53
|
||||
|
|
||||
LL | const fn transmute_fn_intrinsic() -> u32 { unsafe { std::intrinsics::transmute(Foo(3)) } }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #53605 <https://github.com/rust-lang/rust/issues/53605> for more information
|
||||
= help: add `#![feature(const_fn_transmute)]` to the crate attributes to enable
|
||||
= note: `transmute` is only allowed in constants and statics for now
|
||||
|
||||
error[E0658]: `transmute` is not allowed in constant functions
|
||||
--> $DIR/feature-gate-const_fn_transmute.rs:17:58
|
||||
|
|
||||
LL | const fn transmute_fn_core_intrinsic() -> u32 { unsafe { core::intrinsics::transmute(Foo(3)) } }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #53605 <https://github.com/rust-lang/rust/issues/53605> for more information
|
||||
= help: add `#![feature(const_fn_transmute)]` to the crate attributes to enable
|
||||
= note: `transmute` is only allowed in constants and statics for now
|
||||
|
||||
error[E0658]: `transmute` is not allowed in constant functions
|
||||
--> $DIR/feature-gate-const_fn_transmute.rs:20:48
|
||||
|
|
||||
LL | const unsafe fn unsafe_transmute_fn() -> u32 { mem::transmute(Foo(3)) }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #53605 <https://github.com/rust-lang/rust/issues/53605> for more information
|
||||
= help: add `#![feature(const_fn_transmute)]` to the crate attributes to enable
|
||||
= note: `transmute` is only allowed in constants and statics for now
|
||||
|
||||
error[E0658]: `transmute` is not allowed in constant functions
|
||||
--> $DIR/feature-gate-const_fn_transmute.rs:23:58
|
||||
|
|
||||
LL | const unsafe fn unsafe_transmute_fn_intrinsic() -> u32 { std::intrinsics::transmute(Foo(3)) }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #53605 <https://github.com/rust-lang/rust/issues/53605> for more information
|
||||
= help: add `#![feature(const_fn_transmute)]` to the crate attributes to enable
|
||||
= note: `transmute` is only allowed in constants and statics for now
|
||||
|
||||
error[E0658]: `transmute` is not allowed in constant functions
|
||||
--> $DIR/feature-gate-const_fn_transmute.rs:26:63
|
||||
|
|
||||
LL | const unsafe fn unsafe_transmute_fn_core_intrinsic() -> u32 { core::intrinsics::transmute(Foo(3)) }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #53605 <https://github.com/rust-lang/rust/issues/53605> for more information
|
||||
= help: add `#![feature(const_fn_transmute)]` to the crate attributes to enable
|
||||
= note: `transmute` is only allowed in constants and statics for now
|
||||
|
||||
error[E0658]: `transmute` is not allowed in constant functions
|
||||
--> $DIR/feature-gate-const_fn_transmute.rs:29:39
|
||||
|
|
||||
LL | const fn safe_transmute_fn() -> u32 { mem::transmute(Foo(3)) }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #53605 <https://github.com/rust-lang/rust/issues/53605> for more information
|
||||
= help: add `#![feature(const_fn_transmute)]` to the crate attributes to enable
|
||||
= note: `transmute` is only allowed in constants and statics for now
|
||||
|
||||
error[E0658]: `transmute` is not allowed in constant functions
|
||||
--> $DIR/feature-gate-const_fn_transmute.rs:33:49
|
||||
|
|
||||
LL | const fn safe_transmute_fn_intrinsic() -> u32 { std::intrinsics::transmute(Foo(3)) }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #53605 <https://github.com/rust-lang/rust/issues/53605> for more information
|
||||
= help: add `#![feature(const_fn_transmute)]` to the crate attributes to enable
|
||||
= note: `transmute` is only allowed in constants and statics for now
|
||||
|
||||
error[E0658]: `transmute` is not allowed in constant functions
|
||||
--> $DIR/feature-gate-const_fn_transmute.rs:37:54
|
||||
|
|
||||
LL | const fn safe_transmute_fn_core_intrinsic() -> u32 { core::intrinsics::transmute(Foo(3)) }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #53605 <https://github.com/rust-lang/rust/issues/53605> for more information
|
||||
= help: add `#![feature(const_fn_transmute)]` to the crate attributes to enable
|
||||
= note: `transmute` is only allowed in constants and statics for now
|
||||
|
||||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/feature-gate-const_fn_transmute.rs:29:39
|
||||
|
|
||||
LL | const fn safe_transmute_fn() -> u32 { mem::transmute(Foo(3)) }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
||||
|
|
||||
= note: consult the function's documentation for information on how to avoid undefined behavior
|
||||
|
||||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/feature-gate-const_fn_transmute.rs:33:49
|
||||
|
|
||||
LL | const fn safe_transmute_fn_intrinsic() -> u32 { std::intrinsics::transmute(Foo(3)) }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
||||
|
|
||||
= note: consult the function's documentation for information on how to avoid undefined behavior
|
||||
|
||||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/feature-gate-const_fn_transmute.rs:37:54
|
||||
|
|
||||
LL | const fn safe_transmute_fn_core_intrinsic() -> u32 { core::intrinsics::transmute(Foo(3)) }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
||||
|
|
||||
= note: consult the function's documentation for information on how to avoid undefined behavior
|
||||
|
||||
error: aborting due to 12 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0133, E0658.
|
||||
For more information about an error, try `rustc --explain E0133`.
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/foreign-unsafe-fn-called.rs:8:5
|
||||
--> $DIR/foreign-unsafe-fn-called.rs:11:5
|
||||
|
|
||||
LL | test::free();
|
||||
| ^^^^^^^^^^^^ call to unsafe function
|
||||
|
|
@ -1,3 +1,6 @@
|
|||
// revisions: mir thir
|
||||
// [thir]compile-flags: -Z thir-unsafeck
|
||||
|
||||
mod test {
|
||||
extern "C" {
|
||||
pub fn free();
|
||||
|
|
|
|||
11
src/test/ui/foreign-unsafe-fn-called.thir.stderr
Normal file
11
src/test/ui/foreign-unsafe-fn-called.thir.stderr
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/foreign-unsafe-fn-called.rs:11:5
|
||||
|
|
||||
LL | test::free();
|
||||
| ^^^^^^^^^^^^ call to unsafe function
|
||||
|
|
||||
= note: consult the function's documentation for information on how to avoid undefined behavior
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0133`.
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/unchecked_math_unsafe.rs:5:15
|
||||
--> $DIR/unchecked_math_unsafe.rs:8:15
|
||||
|
|
||||
LL | let add = std::intrinsics::unchecked_add(x, y);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
||||
|
|
@ -7,7 +7,7 @@ LL | let add = std::intrinsics::unchecked_add(x, y);
|
|||
= note: consult the function's documentation for information on how to avoid undefined behavior
|
||||
|
||||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/unchecked_math_unsafe.rs:6:15
|
||||
--> $DIR/unchecked_math_unsafe.rs:9:15
|
||||
|
|
||||
LL | let sub = std::intrinsics::unchecked_sub(x, y);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
||||
|
|
@ -15,7 +15,7 @@ LL | let sub = std::intrinsics::unchecked_sub(x, y);
|
|||
= note: consult the function's documentation for information on how to avoid undefined behavior
|
||||
|
||||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/unchecked_math_unsafe.rs:7:15
|
||||
--> $DIR/unchecked_math_unsafe.rs:10:15
|
||||
|
|
||||
LL | let mul = std::intrinsics::unchecked_mul(x, y);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
||||
|
|
@ -1,3 +1,6 @@
|
|||
// revisions: mir thir
|
||||
// [thir]compile-flags: -Z thir-unsafeck
|
||||
|
||||
#![feature(core_intrinsics)]
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
27
src/test/ui/intrinsics/unchecked_math_unsafe.thir.stderr
Normal file
27
src/test/ui/intrinsics/unchecked_math_unsafe.thir.stderr
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/unchecked_math_unsafe.rs:8:15
|
||||
|
|
||||
LL | let add = std::intrinsics::unchecked_add(x, y);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
||||
|
|
||||
= note: consult the function's documentation for information on how to avoid undefined behavior
|
||||
|
||||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/unchecked_math_unsafe.rs:9:15
|
||||
|
|
||||
LL | let sub = std::intrinsics::unchecked_sub(x, y);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
||||
|
|
||||
= note: consult the function's documentation for information on how to avoid undefined behavior
|
||||
|
||||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/unchecked_math_unsafe.rs:10:15
|
||||
|
|
||||
LL | let mul = std::intrinsics::unchecked_mul(x, y);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
||||
|
|
||||
= note: consult the function's documentation for information on how to avoid undefined behavior
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0133`.
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/issue-28776.rs:4:5
|
||||
--> $DIR/issue-28776.rs:7:5
|
||||
|
|
||||
LL | (&ptr::write)(1 as *mut _, 42);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
||||
|
|
@ -1,3 +1,6 @@
|
|||
// revisions: mir thir
|
||||
// [thir]compile-flags: -Z thir-unsafeck
|
||||
|
||||
use std::ptr;
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
11
src/test/ui/issues/issue-28776.thir.stderr
Normal file
11
src/test/ui/issues/issue-28776.thir.stderr
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/issue-28776.rs:7:5
|
||||
|
|
||||
LL | (&ptr::write)(1 as *mut _, 42);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
||||
|
|
||||
= note: consult the function's documentation for information on how to avoid undefined behavior
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0133`.
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/issue-3080.rs:7:5
|
||||
--> $DIR/issue-3080.rs:10:5
|
||||
|
|
||||
LL | X(()).with();
|
||||
| ^^^^^^^^^^^^ call to unsafe function
|
||||
|
|
@ -1,3 +1,6 @@
|
|||
// revisions: mir thir
|
||||
// [thir]compile-flags: -Z thir-unsafeck
|
||||
|
||||
struct X(());
|
||||
impl X {
|
||||
pub unsafe fn with(&self) { }
|
||||
|
|
|
|||
11
src/test/ui/issues/issue-3080.thir.stderr
Normal file
11
src/test/ui/issues/issue-3080.thir.stderr
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/issue-3080.rs:10:5
|
||||
|
|
||||
LL | X(()).with();
|
||||
| ^^^^^^^^^^^^ call to unsafe function
|
||||
|
|
||||
= note: consult the function's documentation for information on how to avoid undefined behavior
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0133`.
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/issue-5844.rs:6:5
|
||||
--> $DIR/issue-5844.rs:8:5
|
||||
|
|
||||
LL | issue_5844_aux::rand();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
||||
|
|
@ -1,4 +1,6 @@
|
|||
//aux-build:issue-5844-aux.rs
|
||||
// revisions: mir thir
|
||||
// [thir]compile-flags: -Z thir-unsafeck
|
||||
|
||||
extern crate issue_5844_aux;
|
||||
|
||||
|
|
|
|||
11
src/test/ui/issues/issue-5844.thir.stderr
Normal file
11
src/test/ui/issues/issue-5844.thir.stderr
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/issue-5844.rs:8:5
|
||||
|
|
||||
LL | issue_5844_aux::rand();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
||||
|
|
||||
= note: consult the function's documentation for information on how to avoid undefined behavior
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0133`.
|
||||
|
|
@ -7,10 +7,10 @@ LL | __KEY.get(Default::default)
|
|||
= note: consult the function's documentation for information on how to avoid undefined behavior
|
||||
|
||||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/issue-43733.rs:21:5
|
||||
--> $DIR/issue-43733.rs:20:42
|
||||
|
|
||||
LL | std::thread::LocalKey::new(__getit);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
||||
LL | static FOO: std::thread::LocalKey<Foo> = std::thread::LocalKey::new(__getit);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
||||
|
|
||||
= note: consult the function's documentation for information on how to avoid undefined behavior
|
||||
|
||||
|
|
@ -1,3 +1,6 @@
|
|||
// revisions: mir thir
|
||||
// [thir]compile-flags: -Z thir-unsafeck
|
||||
|
||||
#![feature(thread_local)]
|
||||
#![feature(cfg_target_thread_local, thread_local_internals)]
|
||||
|
||||
|
|
@ -5,26 +8,24 @@ type Foo = std::cell::RefCell<String>;
|
|||
|
||||
#[cfg(target_thread_local)]
|
||||
#[thread_local]
|
||||
static __KEY: std::thread::__FastLocalKeyInner<Foo> =
|
||||
std::thread::__FastLocalKeyInner::new();
|
||||
static __KEY: std::thread::__FastLocalKeyInner<Foo> = std::thread::__FastLocalKeyInner::new();
|
||||
|
||||
#[cfg(not(target_thread_local))]
|
||||
static __KEY: std::thread::__OsLocalKeyInner<Foo> =
|
||||
std::thread::__OsLocalKeyInner::new();
|
||||
static __KEY: std::thread::__OsLocalKeyInner<Foo> = std::thread::__OsLocalKeyInner::new();
|
||||
|
||||
fn __getit() -> std::option::Option<&'static Foo>
|
||||
{
|
||||
fn __getit() -> std::option::Option<&'static Foo> {
|
||||
__KEY.get(Default::default) //~ ERROR call to unsafe function is unsafe
|
||||
}
|
||||
|
||||
static FOO: std::thread::LocalKey<Foo> =
|
||||
std::thread::LocalKey::new(__getit);
|
||||
static FOO: std::thread::LocalKey<Foo> = std::thread::LocalKey::new(__getit);
|
||||
//~^ ERROR call to unsafe function is unsafe
|
||||
|
||||
fn main() {
|
||||
FOO.with(|foo| println!("{}", foo.borrow()));
|
||||
std::thread::spawn(|| {
|
||||
FOO.with(|foo| *foo.borrow_mut() += "foo");
|
||||
}).join().unwrap();
|
||||
})
|
||||
.join()
|
||||
.unwrap();
|
||||
FOO.with(|foo| println!("{}", foo.borrow()));
|
||||
}
|
||||
|
|
|
|||
19
src/test/ui/threads-sendsync/issue-43733.thir.stderr
Normal file
19
src/test/ui/threads-sendsync/issue-43733.thir.stderr
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/issue-43733.rs:17:5
|
||||
|
|
||||
LL | __KEY.get(Default::default)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
||||
|
|
||||
= note: consult the function's documentation for information on how to avoid undefined behavior
|
||||
|
||||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/issue-43733.rs:20:42
|
||||
|
|
||||
LL | static FOO: std::thread::LocalKey<Foo> = std::thread::LocalKey::new(__getit);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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,5 +1,5 @@
|
|||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/unsafe-const-fn.rs:7:18
|
||||
--> $DIR/unsafe-const-fn.rs:10:18
|
||||
|
|
||||
LL | const VAL: u32 = dummy(0xFFFF);
|
||||
| ^^^^^^^^^^^^^ call to unsafe function
|
||||
|
|
@ -1,5 +1,8 @@
|
|||
// A quick test of 'unsafe const fn' functionality
|
||||
|
||||
// revisions: mir thir
|
||||
// [thir]compile-flags: -Z thir-unsafeck
|
||||
|
||||
const unsafe fn dummy(v: u32) -> u32 {
|
||||
!v
|
||||
}
|
||||
|
|
|
|||
11
src/test/ui/unsafe/unsafe-const-fn.thir.stderr
Normal file
11
src/test/ui/unsafe/unsafe-const-fn.thir.stderr
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/unsafe-const-fn.rs:10:18
|
||||
|
|
||||
LL | const VAL: u32 = dummy(0xFFFF);
|
||||
| ^^^^^^^^^^^^^ call to unsafe function
|
||||
|
|
||||
= note: consult the function's documentation for information on how to avoid undefined behavior
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0133`.
|
||||
11
src/test/ui/unsafe/unsafe-fn-called-from-safe.mir.stderr
Normal file
11
src/test/ui/unsafe/unsafe-fn-called-from-safe.mir.stderr
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/unsafe-fn-called-from-safe.rs:7:5
|
||||
|
|
||||
LL | f();
|
||||
| ^^^ call to unsafe function
|
||||
|
|
||||
= note: consult the function's documentation for information on how to avoid undefined behavior
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0133`.
|
||||
|
|
@ -1,3 +1,6 @@
|
|||
// revisions: mir thir
|
||||
// [thir]compile-flags: -Z thir-unsafeck
|
||||
|
||||
unsafe fn f() { return; }
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
11
src/test/ui/unsafe/unsafe-fn-called-from-safe.thir.stderr
Normal file
11
src/test/ui/unsafe/unsafe-fn-called-from-safe.thir.stderr
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/unsafe-fn-called-from-safe.rs:7:5
|
||||
|
|
||||
LL | f();
|
||||
| ^^^ call to unsafe function
|
||||
|
|
||||
= note: consult the function's documentation for information on how to avoid undefined behavior
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0133`.
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/unsafe-fn-used-as-value.rs:5:5
|
||||
--> $DIR/unsafe-fn-used-as-value.rs:8:5
|
||||
|
|
||||
LL | x();
|
||||
| ^^^ call to unsafe function
|
||||
|
|
@ -1,3 +1,6 @@
|
|||
// revisions: mir thir
|
||||
// [thir]compile-flags: -Z thir-unsafeck
|
||||
|
||||
unsafe fn f() { return; }
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
11
src/test/ui/unsafe/unsafe-fn-used-as-value.thir.stderr
Normal file
11
src/test/ui/unsafe/unsafe-fn-used-as-value.thir.stderr
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/unsafe-fn-used-as-value.rs:8:5
|
||||
|
|
||||
LL | x();
|
||||
| ^^^ call to unsafe function
|
||||
|
|
||||
= note: consult the function's documentation for information on how to avoid undefined behavior
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0133`.
|
||||
|
|
@ -7,7 +7,7 @@ use std::path::Path;
|
|||
|
||||
const ENTRY_LIMIT: usize = 1000;
|
||||
// FIXME: The following limits should be reduced eventually.
|
||||
const ROOT_ENTRY_LIMIT: usize = 1388;
|
||||
const ROOT_ENTRY_LIMIT: usize = 1369;
|
||||
const ISSUES_ENTRY_LIMIT: usize = 2551;
|
||||
|
||||
fn check_entries(path: &Path, bad: &mut bool) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue