diff options
| author | Oliver Scherer <github35764891676564198441@oli-obk.de> | 2018-11-05 18:06:26 +0100 |
|---|---|---|
| committer | Oliver Scherer <github35764891676564198441@oli-obk.de> | 2018-12-04 10:17:36 +0100 |
| commit | 4497ff37627d860690613249a31cf3ee4c4195ef (patch) | |
| tree | 632c96a9ead5264bd33c51fdd0e350f02787e1be /src/test/ui/consts | |
| parent | e5d90652e203aee41ae41b7ad696652e77654766 (diff) | |
| download | rust-4497ff37627d860690613249a31cf3ee4c4195ef.tar.gz rust-4497ff37627d860690613249a31cf3ee4c4195ef.zip | |
Emit feature gate suggestion
Diffstat (limited to 'src/test/ui/consts')
| -rw-r--r-- | src/test/ui/consts/min_const_fn/min_const_fn_unsafe.rs | 6 | ||||
| -rw-r--r-- | src/test/ui/consts/min_const_fn/min_const_fn_unsafe.stderr | 24 |
2 files changed, 15 insertions, 15 deletions
diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_unsafe.rs b/src/test/ui/consts/min_const_fn/min_const_fn_unsafe.rs index 7a84992e14b..02a357551df 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn_unsafe.rs +++ b/src/test/ui/consts/min_const_fn/min_const_fn_unsafe.rs @@ -18,13 +18,13 @@ const fn no_unsafe() { unsafe {} } // not ok const fn foo8() -> i32 { - unsafe { foo4() } //~ ERROR unsafe operations are not allowed in const fn + unsafe { foo4() } //~ ERROR calls to `const unsafe fn` in const fns are unstable } const fn foo9() -> *const String { - unsafe { foo5::<String>() } //~ ERROR unsafe operations are not allowed in const fn + unsafe { foo5::<String>() } //~ ERROR calls to `const unsafe fn` in const fns are unstable } const fn foo10() -> *const Vec<std::cell::Cell<u32>> { - unsafe { foo6::<Vec<std::cell::Cell<u32>>>() } //~ ERROR not allowed in const fn + unsafe { foo6::<Vec<std::cell::Cell<u32>>>() } //~ ERROR calls to `const unsafe fn` in const fns } const unsafe fn foo30_3(x: *mut usize) -> usize { *x } //~ ERROR not allowed in const fn //~^ dereferencing raw pointers in constant functions diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_unsafe.stderr b/src/test/ui/consts/min_const_fn/min_const_fn_unsafe.stderr index 17cba8569c1..0b8ff4717c1 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn_unsafe.stderr +++ b/src/test/ui/consts/min_const_fn/min_const_fn_unsafe.stderr @@ -14,29 +14,29 @@ LL | Foo { x: () }.y //~ ERROR not allowed in const fn | = help: add #![feature(const_fn_union)] to the crate attributes to enable -error: call to unsafe function is unsafe and unsafe operations are not allowed in const fn +error[E0658]: calls to `const unsafe fn` in const fns are unstable (see issue #55607) --> $DIR/min_const_fn_unsafe.rs:21:14 | -LL | unsafe { foo4() } //~ ERROR unsafe operations are not allowed in const fn - | ^^^^^^ call to unsafe function +LL | unsafe { foo4() } //~ ERROR calls to `const unsafe fn` in const fns are unstable + | ^^^^^^ | - = note: consult the function's documentation for information on how to avoid undefined behavior + = help: add #![feature(min_const_unsafe_fn)] to the crate attributes to enable -error: call to unsafe function is unsafe and unsafe operations are not allowed in const fn +error[E0658]: calls to `const unsafe fn` in const fns are unstable (see issue #55607) --> $DIR/min_const_fn_unsafe.rs:24:14 | -LL | unsafe { foo5::<String>() } //~ ERROR unsafe operations are not allowed in const fn - | ^^^^^^^^^^^^^^^^ call to unsafe function +LL | unsafe { foo5::<String>() } //~ ERROR calls to `const unsafe fn` in const fns are unstable + | ^^^^^^^^^^^^^^^^ | - = note: consult the function's documentation for information on how to avoid undefined behavior + = help: add #![feature(min_const_unsafe_fn)] to the crate attributes to enable -error: call to unsafe function is unsafe and unsafe operations are not allowed in const fn +error[E0658]: calls to `const unsafe fn` in const fns are unstable (see issue #55607) --> $DIR/min_const_fn_unsafe.rs:27:14 | -LL | unsafe { foo6::<Vec<std::cell::Cell<u32>>>() } //~ ERROR not allowed in const fn - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function +LL | unsafe { foo6::<Vec<std::cell::Cell<u32>>>() } //~ ERROR calls to `const unsafe fn` in const fns + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: consult the function's documentation for information on how to avoid undefined behavior + = help: add #![feature(min_const_unsafe_fn)] to the crate attributes to enable error: dereference of raw pointer is unsafe and unsafe operations are not allowed in const fn --> $DIR/min_const_fn_unsafe.rs:29:51 |
