Make the THIR unsafeck use the thir_body query
This commit is contained in:
parent
6f64eb1fe6
commit
6dfdea9800
5 changed files with 55 additions and 56 deletions
|
|
@ -58,6 +58,14 @@ LL | const unsafe fn unsafe_transmute_fn_core_intrinsic() -> u32 { core::intrins
|
|||
= 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[E0658]: `transmute` is not allowed in constant functions
|
||||
--> $DIR/feature-gate-const_fn_transmute.rs:29:39
|
||||
|
|
||||
|
|
@ -68,6 +76,14 @@ LL | const fn safe_transmute_fn() -> u32 { mem::transmute(Foo(3)) }
|
|||
= 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: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[E0658]: `transmute` is not allowed in constant functions
|
||||
--> $DIR/feature-gate-const_fn_transmute.rs:33:49
|
||||
|
|
||||
|
|
@ -78,6 +94,14 @@ LL | const fn safe_transmute_fn_intrinsic() -> u32 { std::intrinsics::transmute(
|
|||
= 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: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[E0658]: `transmute` is not allowed in constant functions
|
||||
--> $DIR/feature-gate-const_fn_transmute.rs:37:54
|
||||
|
|
||||
|
|
@ -88,30 +112,6 @@ LL | const fn safe_transmute_fn_core_intrinsic() -> u32 { core::intrinsics::tran
|
|||
= 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.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,11 @@
|
|||
error[E0133]: use of extern static is unsafe and requires unsafe function or block
|
||||
--> $DIR/issue-16538.rs:14:34
|
||||
|
|
||||
LL | static foo: *const Y::X = Y::foo(Y::x as *const Y::X);
|
||||
| ^^^^ use of extern static
|
||||
|
|
||||
= note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
|
||||
|
||||
error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants
|
||||
--> $DIR/issue-16538.rs:14:27
|
||||
|
|
||||
|
|
@ -13,14 +21,6 @@ LL | static foo: *const Y::X = Y::foo(Y::x as *const Y::X);
|
|||
= help: the trait `Sync` is not implemented for `*const usize`
|
||||
= note: shared static variables must have a type that implements `Sync`
|
||||
|
||||
error[E0133]: use of extern static is unsafe and requires unsafe function or block
|
||||
--> $DIR/issue-16538.rs:14:34
|
||||
|
|
||||
LL | static foo: *const Y::X = Y::foo(Y::x as *const Y::X);
|
||||
| ^^^^ use of extern static
|
||||
|
|
||||
= note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0015, E0133, E0277.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue