diff options
Diffstat (limited to 'src/test')
6 files changed, 35 insertions, 59 deletions
diff --git a/src/test/ui/async-await/async-unsafe-fn-call-in-safe.rs b/src/test/ui/async-await/async-unsafe-fn-call-in-safe.rs index 2ed343b4a07..fc37822cb7b 100644 --- a/src/test/ui/async-await/async-unsafe-fn-call-in-safe.rs +++ b/src/test/ui/async-await/async-unsafe-fn-call-in-safe.rs @@ -16,6 +16,6 @@ async fn g() { } fn main() { - S::f(); //~ ERROR call to unsafe function is unsafe - f(); //~ ERROR call to unsafe function is unsafe + S::f(); //[mir]~ ERROR call to unsafe function is unsafe + f(); //[mir]~ ERROR call to unsafe function is unsafe } diff --git a/src/test/ui/async-await/async-unsafe-fn-call-in-safe.thir.stderr b/src/test/ui/async-await/async-unsafe-fn-call-in-safe.thir.stderr index d22413beecb..21ba45d7f1e 100644 --- a/src/test/ui/async-await/async-unsafe-fn-call-in-safe.thir.stderr +++ b/src/test/ui/async-await/async-unsafe-fn-call-in-safe.thir.stderr @@ -14,22 +14,6 @@ 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: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 +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0133`. diff --git a/src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.rs b/src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.rs index 1ce78147970..031e67a1e3c 100644 --- a/src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.rs +++ b/src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.rs @@ -9,5 +9,5 @@ fn main() { let a: [u8; foo()]; //~^ ERROR call to unsafe function is unsafe and requires unsafe function or block foo(); - //~^ ERROR call to unsafe function is unsafe and requires unsafe function or block + //[mir]~^ ERROR call to unsafe function is unsafe and requires unsafe function or block } diff --git a/src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.thir.stderr b/src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.thir.stderr index b643ecc0ce8..c6077da768b 100644 --- a/src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.thir.stderr +++ b/src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.thir.stderr @@ -1,12 +1,4 @@ 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()]; @@ -14,6 +6,6 @@ LL | let a: [u8; foo()]; | = note: consult the function's documentation for information on how to avoid undefined behavior -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0133`. diff --git a/src/test/ui/feature-gates/feature-gate-const_fn_transmute.thir.stderr b/src/test/ui/feature-gates/feature-gate-const_fn_transmute.thir.stderr index 04efea0b230..df0de7a9590 100644 --- a/src/test/ui/feature-gates/feature-gate-const_fn_transmute.thir.stderr +++ b/src/test/ui/feature-gates/feature-gate-const_fn_transmute.thir.stderr @@ -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,49 +76,41 @@ 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[E0658]: `transmute` is not allowed in constant functions +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: 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 + = 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 + --> $DIR/feature-gate-const_fn_transmute.rs:33:49 | -LL | const fn safe_transmute_fn_core_intrinsic() -> u32 { core::intrinsics::transmute(Foo(3)) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +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[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 + --> $DIR/feature-gate-const_fn_transmute.rs:37:54 | -LL | const fn safe_transmute_fn_intrinsic() -> u32 { std::intrinsics::transmute(Foo(3)) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function +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[E0133]: call to unsafe function is unsafe and requires unsafe function or block +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)) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: consult the function's documentation for information on how to avoid undefined behavior + = 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: aborting due to 12 previous errors diff --git a/src/test/ui/issues/issue-16538.thir.stderr b/src/test/ui/issues/issue-16538.thir.stderr index d7e8c08bb01..435334c3228 100644 --- a/src/test/ui/issues/issue-16538.thir.stderr +++ b/src/test/ui/issues/issue-16538.thir.stderr @@ -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. |
