summaryrefslogtreecommitdiffstats
path: root/src/test/ui/consts/min_const_fn
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
commit218caa410aa38c29984be31a5229b9fa717560ee (patch)
treec54bd55eeb6e4c508940a30e94c0032fbd45d677 /src/test/ui/consts/min_const_fn
parentReleasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz
rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/consts/min_const_fn')
-rw-r--r--src/test/ui/consts/min_const_fn/address_of.rs17
-rw-r--r--src/test/ui/consts/min_const_fn/address_of.stderr21
-rw-r--r--src/test/ui/consts/min_const_fn/address_of_const.rs19
-rw-r--r--src/test/ui/consts/min_const_fn/allow_const_fn_ptr_run_pass.rs19
-rw-r--r--src/test/ui/consts/min_const_fn/allow_raw_ptr_dereference_const_fn.rs9
-rw-r--r--src/test/ui/consts/min_const_fn/bad_const_fn_body_ice.rs7
-rw-r--r--src/test/ui/consts/min_const_fn/bad_const_fn_body_ice.stderr21
-rw-r--r--src/test/ui/consts/min_const_fn/cast_fn.rs11
-rw-r--r--src/test/ui/consts/min_const_fn/cmp_fn_pointers.rs6
-rw-r--r--src/test/ui/consts/min_const_fn/cmp_fn_pointers.stderr16
-rw-r--r--src/test/ui/consts/min_const_fn/min_const_fn.rs134
-rw-r--r--src/test/ui/consts/min_const_fn/min_const_fn.stderr213
-rw-r--r--src/test/ui/consts/min_const_fn/min_const_fn_dyn.rs15
-rw-r--r--src/test/ui/consts/min_const_fn/min_const_fn_libstd.rs26
-rw-r--r--src/test/ui/consts/min_const_fn/min_const_fn_libstd_stability.rs41
-rw-r--r--src/test/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr41
-rw-r--r--src/test/ui/consts/min_const_fn/min_const_fn_unsafe_bad.rs10
-rw-r--r--src/test/ui/consts/min_const_fn/min_const_fn_unsafe_bad.stderr30
-rw-r--r--src/test/ui/consts/min_const_fn/min_const_fn_unsafe_ok.rs44
-rw-r--r--src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.rs42
-rw-r--r--src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.stderr41
-rw-r--r--src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability2.rs35
-rw-r--r--src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability2.stderr26
-rw-r--r--src/test/ui/consts/min_const_fn/mutable_borrow.rs17
-rw-r--r--src/test/ui/consts/min_const_fn/mutable_borrow.stderr21
-rw-r--r--src/test/ui/consts/min_const_fn/promotion.rs17
-rw-r--r--src/test/ui/consts/min_const_fn/promotion.stderr68
27 files changed, 0 insertions, 967 deletions
diff --git a/src/test/ui/consts/min_const_fn/address_of.rs b/src/test/ui/consts/min_const_fn/address_of.rs
deleted file mode 100644
index 40d1882d7..000000000
--- a/src/test/ui/consts/min_const_fn/address_of.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-#![feature(raw_ref_op)]
-
-const fn mutable_address_of_in_const() {
- let mut a = 0;
- let b = &raw mut a; //~ ERROR mutable reference
-}
-
-struct X;
-
-impl X {
- const fn inherent_mutable_address_of_in_const() {
- let mut a = 0;
- let b = &raw mut a; //~ ERROR mutable reference
- }
-}
-
-fn main() {}
diff --git a/src/test/ui/consts/min_const_fn/address_of.stderr b/src/test/ui/consts/min_const_fn/address_of.stderr
deleted file mode 100644
index facc56651..000000000
--- a/src/test/ui/consts/min_const_fn/address_of.stderr
+++ /dev/null
@@ -1,21 +0,0 @@
-error[E0658]: raw mutable references are not allowed in constant functions
- --> $DIR/address_of.rs:5:13
- |
-LL | let b = &raw mut a;
- | ^^^^^^^^^^
- |
- = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
- = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
-
-error[E0658]: raw mutable references are not allowed in constant functions
- --> $DIR/address_of.rs:13:17
- |
-LL | let b = &raw mut a;
- | ^^^^^^^^^^
- |
- = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
- = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/consts/min_const_fn/address_of_const.rs b/src/test/ui/consts/min_const_fn/address_of_const.rs
deleted file mode 100644
index 3db19e9cd..000000000
--- a/src/test/ui/consts/min_const_fn/address_of_const.rs
+++ /dev/null
@@ -1,19 +0,0 @@
-// check-pass
-
-#![feature(raw_ref_op)]
-
-const fn const_address_of_in_const() {
- let mut a = 0;
- let b = &raw const a;
-}
-
-struct X;
-
-impl X {
- const fn inherent_const_address_of_in_const() {
- let mut a = 0;
- let b = &raw const a;
- }
-}
-
-fn main() {}
diff --git a/src/test/ui/consts/min_const_fn/allow_const_fn_ptr_run_pass.rs b/src/test/ui/consts/min_const_fn/allow_const_fn_ptr_run_pass.rs
deleted file mode 100644
index 2dbc424d3..000000000
--- a/src/test/ui/consts/min_const_fn/allow_const_fn_ptr_run_pass.rs
+++ /dev/null
@@ -1,19 +0,0 @@
-// run-pass
-#![feature(rustc_allow_const_fn_unstable)]
-
-#![feature(rustc_attrs, staged_api)]
-#![stable(feature = "rust1", since = "1.0.0")]
-
-#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_stable(since="1.0.0", feature = "mep")]
-const fn takes_fn_ptr(_: fn()) {}
-
-const FN: fn() = || ();
-
-const fn gives_fn_ptr() {
- takes_fn_ptr(FN)
-}
-
-fn main() {
- gives_fn_ptr();
-}
diff --git a/src/test/ui/consts/min_const_fn/allow_raw_ptr_dereference_const_fn.rs b/src/test/ui/consts/min_const_fn/allow_raw_ptr_dereference_const_fn.rs
deleted file mode 100644
index d22115755..000000000
--- a/src/test/ui/consts/min_const_fn/allow_raw_ptr_dereference_const_fn.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-// check-pass
-
-use std::ptr;
-
-const fn test_fn(x: *const i32) {
- let x2 = unsafe { ptr::addr_of!(*x) };
-}
-
-fn main() {}
diff --git a/src/test/ui/consts/min_const_fn/bad_const_fn_body_ice.rs b/src/test/ui/consts/min_const_fn/bad_const_fn_body_ice.rs
deleted file mode 100644
index 258997597..000000000
--- a/src/test/ui/consts/min_const_fn/bad_const_fn_body_ice.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-const fn foo(a: i32) -> Vec<i32> {
- vec![1, 2, 3]
- //~^ ERROR allocations are not allowed
- //~| ERROR cannot call non-const fn
-}
-
-fn main() {}
diff --git a/src/test/ui/consts/min_const_fn/bad_const_fn_body_ice.stderr b/src/test/ui/consts/min_const_fn/bad_const_fn_body_ice.stderr
deleted file mode 100644
index 742341089..000000000
--- a/src/test/ui/consts/min_const_fn/bad_const_fn_body_ice.stderr
+++ /dev/null
@@ -1,21 +0,0 @@
-error[E0010]: allocations are not allowed in constant functions
- --> $DIR/bad_const_fn_body_ice.rs:2:5
- |
-LL | vec![1, 2, 3]
- | ^^^^^^^^^^^^^ allocation not allowed in constant functions
- |
- = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error[E0015]: cannot call non-const fn `slice::<impl [i32]>::into_vec::<std::alloc::Global>` in constant functions
- --> $DIR/bad_const_fn_body_ice.rs:2:5
- |
-LL | vec![1, 2, 3]
- | ^^^^^^^^^^^^^
- |
- = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
- = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: aborting due to 2 previous errors
-
-Some errors have detailed explanations: E0010, E0015.
-For more information about an error, try `rustc --explain E0010`.
diff --git a/src/test/ui/consts/min_const_fn/cast_fn.rs b/src/test/ui/consts/min_const_fn/cast_fn.rs
deleted file mode 100644
index 85802a514..000000000
--- a/src/test/ui/consts/min_const_fn/cast_fn.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-// check-pass
-
-fn main() {}
-
-const fn unsize(x: &[u8; 3]) -> &[u8] { x }
-const fn closure() -> fn() { || {} }
-const fn closure2() {
- (|| {}) as fn();
-}
-const fn reify(f: fn()) -> unsafe fn() { f }
-const fn reify2() { main as unsafe fn(); }
diff --git a/src/test/ui/consts/min_const_fn/cmp_fn_pointers.rs b/src/test/ui/consts/min_const_fn/cmp_fn_pointers.rs
deleted file mode 100644
index 9a2775688..000000000
--- a/src/test/ui/consts/min_const_fn/cmp_fn_pointers.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-const fn cmp(x: fn(), y: fn()) -> bool {
- unsafe { x == y }
- //~^ ERROR can't compare
-}
-
-fn main() {}
diff --git a/src/test/ui/consts/min_const_fn/cmp_fn_pointers.stderr b/src/test/ui/consts/min_const_fn/cmp_fn_pointers.stderr
deleted file mode 100644
index 8a1b20a33..000000000
--- a/src/test/ui/consts/min_const_fn/cmp_fn_pointers.stderr
+++ /dev/null
@@ -1,16 +0,0 @@
-error[E0277]: can't compare `fn()` with `_` in const contexts
- --> $DIR/cmp_fn_pointers.rs:2:16
- |
-LL | unsafe { x == y }
- | ^^ no implementation for `fn() == _`
- |
- = help: the trait `~const PartialEq<_>` is not implemented for `fn()`
-note: the trait `PartialEq<_>` is implemented for `fn()`, but that implementation is not `const`
- --> $DIR/cmp_fn_pointers.rs:2:16
- |
-LL | unsafe { x == y }
- | ^^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/consts/min_const_fn/min_const_fn.rs b/src/test/ui/consts/min_const_fn/min_const_fn.rs
deleted file mode 100644
index c2891488c..000000000
--- a/src/test/ui/consts/min_const_fn/min_const_fn.rs
+++ /dev/null
@@ -1,134 +0,0 @@
-// ok
-const fn foo1() {}
-const fn foo2(x: i32) -> i32 { x }
-const fn foo3<T>(x: T) -> T { x }
-const fn foo7() {
- (
- foo1(),
- foo2(420),
- foo3(69),
- ).0
-}
-const fn foo12<T: Sized>(t: T) -> T { t }
-const fn foo13<T: ?Sized>(t: &T) -> &T { t }
-const fn foo14<'a, T: 'a>(t: &'a T) -> &'a T { t }
-const fn foo15<T>(t: T) -> T where T: Sized { t }
-const fn foo15_2<T>(t: &T) -> &T where T: ?Sized { t }
-const fn foo16(f: f32) -> f32 { f }
-const fn foo17(f: f32) -> u32 { f as u32 }
-const fn foo18(i: i32) -> i32 { i * 3 }
-const fn foo20(b: bool) -> bool { !b }
-const fn foo21<T, U>(t: T, u: U) -> (T, U) { (t, u) }
-const fn foo22(s: &[u8], i: usize) -> u8 { s[i] }
-const FOO: u32 = 42;
-const fn foo23() -> u32 { FOO }
-const fn foo24() -> &'static u32 { &FOO }
-const fn foo27(x: &u32) -> u32 { *x }
-const fn foo28(x: u32) -> u32 { *&x }
-const fn foo29(x: u32) -> i32 { x as i32 }
-const fn foo31(a: bool, b: bool) -> bool { a & b }
-const fn foo32(a: bool, b: bool) -> bool { a | b }
-const fn foo33(a: bool, b: bool) -> bool { a & b }
-const fn foo34(a: bool, b: bool) -> bool { a | b }
-const fn foo35(a: bool, b: bool) -> bool { a ^ b }
-struct Foo<T: ?Sized>(T);
-impl<T> Foo<T> {
- const fn new(t: T) -> Self { Foo(t) }
- const fn into_inner(self) -> T { self.0 } //~ destructor of
- const fn get(&self) -> &T { &self.0 }
- const fn get_mut(&mut self) -> &mut T { &mut self.0 }
- //~^ mutable references
- //~| mutable references
- //~| mutable references
-}
-impl<'a, T> Foo<T> {
- const fn new_lt(t: T) -> Self { Foo(t) }
- const fn into_inner_lt(self) -> T { self.0 } //~ destructor of
- const fn get_lt(&'a self) -> &T { &self.0 }
- const fn get_mut_lt(&'a mut self) -> &mut T { &mut self.0 }
- //~^ mutable references
- //~| mutable references
- //~| mutable references
-}
-impl<T: Sized> Foo<T> {
- const fn new_s(t: T) -> Self { Foo(t) }
- const fn into_inner_s(self) -> T { self.0 } //~ ERROR destructor
- const fn get_s(&self) -> &T { &self.0 }
- const fn get_mut_s(&mut self) -> &mut T { &mut self.0 }
- //~^ mutable references
- //~| mutable references
- //~| mutable references
-}
-impl<T: ?Sized> Foo<T> {
- const fn get_sq(&self) -> &T { &self.0 }
- const fn get_mut_sq(&mut self) -> &mut T { &mut self.0 }
- //~^ mutable references
- //~| mutable references
- //~| mutable references
-}
-
-
-const fn char_ops(c: char, d: char) -> bool { c == d }
-const fn char_ops2(c: char, d: char) -> bool { c < d }
-const fn char_ops3(c: char, d: char) -> bool { c != d }
-const fn i32_ops(c: i32, d: i32) -> bool { c == d }
-const fn i32_ops2(c: i32, d: i32) -> bool { c < d }
-const fn i32_ops3(c: i32, d: i32) -> bool { c != d }
-const fn i32_ops4(c: i32, d: i32) -> i32 { c + d }
-const fn char_cast(u: u8) -> char { u as char }
-const unsafe fn ret_i32_no_unsafe() -> i32 { 42 }
-const unsafe fn ret_null_ptr_no_unsafe<T>() -> *const T { core::ptr::null() }
-const unsafe fn ret_null_mut_ptr_no_unsafe<T>() -> *mut T { core::ptr::null_mut() }
-
-const fn foo11<T: std::fmt::Display>(t: T) -> T { t }
-const fn foo11_2<T: Send>(t: T) -> T { t }
-
-// not ok
-
-static BAR: u32 = 42;
-const fn foo25() -> u32 { BAR } //~ ERROR cannot refer to statics
-const fn foo26() -> &'static u32 { &BAR } //~ ERROR cannot refer to statics
-const fn foo30(x: *const u32) -> usize { x as usize }
-//~^ ERROR pointers cannot be cast to integers
-const fn foo30_with_unsafe(x: *const u32) -> usize { unsafe { x as usize } }
-//~^ ERROR pointers cannot be cast to integers
-const fn foo30_2(x: *mut u32) -> usize { x as usize }
-//~^ ERROR pointers cannot be cast to integers
-const fn foo30_2_with_unsafe(x: *mut u32) -> usize { unsafe { x as usize } }
-//~^ ERROR pointers cannot be cast to integers
-const fn foo30_6() -> bool { let x = true; x }
-const fn inc(x: &mut i32) { *x += 1 }
-//~^ ERROR mutable references
-
-// ok
-const fn foo36(a: bool, b: bool) -> bool { a && b }
-const fn foo37(a: bool, b: bool) -> bool { a || b }
-
-fn main() {}
-
-impl<T: std::fmt::Debug> Foo<T> {
- const fn foo(&self) {}
-}
-
-impl<T: std::fmt::Debug + Sized> Foo<T> {
- const fn foo2(&self) {}
-}
-
-impl<T: Sync + Sized> Foo<T> {
- const fn foo3(&self) {}
-}
-
-struct AlanTuring<T>(T);
-const fn no_apit2(_x: AlanTuring<impl std::fmt::Debug>) {}
-//~^ ERROR destructor
-const fn no_apit(_x: impl std::fmt::Debug) {}
-//~^ ERROR destructor
-const fn no_dyn_trait(_x: &dyn std::fmt::Debug) {}
-const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() }
-
-const fn no_unsafe() { unsafe {} }
-
-const fn traits_are_ok_i_mean_it() { (&() as &dyn std::fmt::Debug, ()).1 }
-
-const fn fn_ptrs(_x: fn()) {}
-const fn fn_ptrs2() -> fn() { fn foo() {} foo }
diff --git a/src/test/ui/consts/min_const_fn/min_const_fn.stderr b/src/test/ui/consts/min_const_fn/min_const_fn.stderr
deleted file mode 100644
index 11c79e8e2..000000000
--- a/src/test/ui/consts/min_const_fn/min_const_fn.stderr
+++ /dev/null
@@ -1,213 +0,0 @@
-error[E0493]: destructor of `Foo<T>` cannot be evaluated at compile-time
- --> $DIR/min_const_fn.rs:37:25
- |
-LL | const fn into_inner(self) -> T { self.0 }
- | ^^^^ - value is dropped here
- | |
- | the destructor for this type cannot be evaluated in constant functions
-
-error[E0658]: mutable references are not allowed in constant functions
- --> $DIR/min_const_fn.rs:39:22
- |
-LL | const fn get_mut(&mut self) -> &mut T { &mut self.0 }
- | ^^^^^^^^^
- |
- = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
- = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
-
-error[E0658]: mutable references are not allowed in constant functions
- --> $DIR/min_const_fn.rs:39:36
- |
-LL | const fn get_mut(&mut self) -> &mut T { &mut self.0 }
- | ^^^^^^
- |
- = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
- = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
-
-error[E0658]: mutable references are not allowed in constant functions
- --> $DIR/min_const_fn.rs:39:45
- |
-LL | const fn get_mut(&mut self) -> &mut T { &mut self.0 }
- | ^^^^^^^^^^^
- |
- = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
- = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
-
-error[E0493]: destructor of `Foo<T>` cannot be evaluated at compile-time
- --> $DIR/min_const_fn.rs:46:28
- |
-LL | const fn into_inner_lt(self) -> T { self.0 }
- | ^^^^ - value is dropped here
- | |
- | the destructor for this type cannot be evaluated in constant functions
-
-error[E0658]: mutable references are not allowed in constant functions
- --> $DIR/min_const_fn.rs:48:25
- |
-LL | const fn get_mut_lt(&'a mut self) -> &mut T { &mut self.0 }
- | ^^^^^^^^^^^^
- |
- = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
- = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
-
-error[E0658]: mutable references are not allowed in constant functions
- --> $DIR/min_const_fn.rs:48:42
- |
-LL | const fn get_mut_lt(&'a mut self) -> &mut T { &mut self.0 }
- | ^^^^^^
- |
- = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
- = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
-
-error[E0658]: mutable references are not allowed in constant functions
- --> $DIR/min_const_fn.rs:48:51
- |
-LL | const fn get_mut_lt(&'a mut self) -> &mut T { &mut self.0 }
- | ^^^^^^^^^^^
- |
- = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
- = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
-
-error[E0493]: destructor of `Foo<T>` cannot be evaluated at compile-time
- --> $DIR/min_const_fn.rs:55:27
- |
-LL | const fn into_inner_s(self) -> T { self.0 }
- | ^^^^ - value is dropped here
- | |
- | the destructor for this type cannot be evaluated in constant functions
-
-error[E0658]: mutable references are not allowed in constant functions
- --> $DIR/min_const_fn.rs:57:24
- |
-LL | const fn get_mut_s(&mut self) -> &mut T { &mut self.0 }
- | ^^^^^^^^^
- |
- = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
- = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
-
-error[E0658]: mutable references are not allowed in constant functions
- --> $DIR/min_const_fn.rs:57:38
- |
-LL | const fn get_mut_s(&mut self) -> &mut T { &mut self.0 }
- | ^^^^^^
- |
- = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
- = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
-
-error[E0658]: mutable references are not allowed in constant functions
- --> $DIR/min_const_fn.rs:57:47
- |
-LL | const fn get_mut_s(&mut self) -> &mut T { &mut self.0 }
- | ^^^^^^^^^^^
- |
- = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
- = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
-
-error[E0658]: mutable references are not allowed in constant functions
- --> $DIR/min_const_fn.rs:64:25
- |
-LL | const fn get_mut_sq(&mut self) -> &mut T { &mut self.0 }
- | ^^^^^^^^^
- |
- = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
- = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
-
-error[E0658]: mutable references are not allowed in constant functions
- --> $DIR/min_const_fn.rs:64:39
- |
-LL | const fn get_mut_sq(&mut self) -> &mut T { &mut self.0 }
- | ^^^^^^
- |
- = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
- = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
-
-error[E0658]: mutable references are not allowed in constant functions
- --> $DIR/min_const_fn.rs:64:48
- |
-LL | const fn get_mut_sq(&mut self) -> &mut T { &mut self.0 }
- | ^^^^^^^^^^^
- |
- = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
- = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
-
-error[E0013]: constant functions cannot refer to statics
- --> $DIR/min_const_fn.rs:89:27
- |
-LL | const fn foo25() -> u32 { BAR }
- | ^^^
- |
- = help: consider extracting the value of the `static` to a `const`, and referring to that
-
-error[E0013]: constant functions cannot refer to statics
- --> $DIR/min_const_fn.rs:90:37
- |
-LL | const fn foo26() -> &'static u32 { &BAR }
- | ^^^
- |
- = help: consider extracting the value of the `static` to a `const`, and referring to that
-
-error: pointers cannot be cast to integers during const eval
- --> $DIR/min_const_fn.rs:91:42
- |
-LL | const fn foo30(x: *const u32) -> usize { x as usize }
- | ^^^^^^^^^^
- |
- = note: at compile-time, pointers do not have an integer value
- = note: avoiding this restriction via `transmute`, `union`, or raw pointers leads to compile-time undefined behavior
-
-error: pointers cannot be cast to integers during const eval
- --> $DIR/min_const_fn.rs:93:63
- |
-LL | const fn foo30_with_unsafe(x: *const u32) -> usize { unsafe { x as usize } }
- | ^^^^^^^^^^
- |
- = note: at compile-time, pointers do not have an integer value
- = note: avoiding this restriction via `transmute`, `union`, or raw pointers leads to compile-time undefined behavior
-
-error: pointers cannot be cast to integers during const eval
- --> $DIR/min_const_fn.rs:95:42
- |
-LL | const fn foo30_2(x: *mut u32) -> usize { x as usize }
- | ^^^^^^^^^^
- |
- = note: at compile-time, pointers do not have an integer value
- = note: avoiding this restriction via `transmute`, `union`, or raw pointers leads to compile-time undefined behavior
-
-error: pointers cannot be cast to integers during const eval
- --> $DIR/min_const_fn.rs:97:63
- |
-LL | const fn foo30_2_with_unsafe(x: *mut u32) -> usize { unsafe { x as usize } }
- | ^^^^^^^^^^
- |
- = note: at compile-time, pointers do not have an integer value
- = note: avoiding this restriction via `transmute`, `union`, or raw pointers leads to compile-time undefined behavior
-
-error[E0658]: mutable references are not allowed in constant functions
- --> $DIR/min_const_fn.rs:100:14
- |
-LL | const fn inc(x: &mut i32) { *x += 1 }
- | ^
- |
- = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
- = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
-
-error[E0493]: destructor of `AlanTuring<impl std::fmt::Debug>` cannot be evaluated at compile-time
- --> $DIR/min_const_fn.rs:122:19
- |
-LL | const fn no_apit2(_x: AlanTuring<impl std::fmt::Debug>) {}
- | ^^ - value is dropped here
- | |
- | the destructor for this type cannot be evaluated in constant functions
-
-error[E0493]: destructor of `impl std::fmt::Debug` cannot be evaluated at compile-time
- --> $DIR/min_const_fn.rs:124:18
- |
-LL | const fn no_apit(_x: impl std::fmt::Debug) {}
- | ^^ - value is dropped here
- | |
- | the destructor for this type cannot be evaluated in constant functions
-
-error: aborting due to 24 previous errors
-
-Some errors have detailed explanations: E0013, E0493, E0658.
-For more information about an error, try `rustc --explain E0013`.
diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_dyn.rs b/src/test/ui/consts/min_const_fn/min_const_fn_dyn.rs
deleted file mode 100644
index 36c888009..000000000
--- a/src/test/ui/consts/min_const_fn/min_const_fn_dyn.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-// check-pass
-
-struct HasDyn {
- field: &'static dyn std::fmt::Debug,
-}
-
-struct Hide(HasDyn);
-
-const fn no_inner_dyn_trait(_x: Hide) {}
-const fn no_inner_dyn_trait2(x: Hide) {
- x.0.field;
-}
-const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasDyn { field: &0 }) }
-
-fn main() {}
diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_libstd.rs b/src/test/ui/consts/min_const_fn/min_const_fn_libstd.rs
deleted file mode 100644
index cb8f74186..000000000
--- a/src/test/ui/consts/min_const_fn/min_const_fn_libstd.rs
+++ /dev/null
@@ -1,26 +0,0 @@
-// build-pass (FIXME(62277): could be check-pass?)
-
-use std::cell::UnsafeCell;
-use std::sync::atomic::AtomicU32;
-pub struct Condvar {
- condvar: UnsafeCell<AtomicU32>,
-}
-
-unsafe impl Send for Condvar {}
-unsafe impl Sync for Condvar {}
-
-#[repr(C)]
-#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
-struct NoWait(u32);
-
-const CONDVAR_HAS_NO_WAITERS: NoWait = NoWait(42);
-
-impl Condvar {
- pub const fn new() -> Condvar {
- Condvar {
- condvar: UnsafeCell::new(AtomicU32::new(CONDVAR_HAS_NO_WAITERS.0)),
- }
- }
-}
-
-fn main() {}
diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_libstd_stability.rs b/src/test/ui/consts/min_const_fn/min_const_fn_libstd_stability.rs
deleted file mode 100644
index bb240fb4a..000000000
--- a/src/test/ui/consts/min_const_fn/min_const_fn_libstd_stability.rs
+++ /dev/null
@@ -1,41 +0,0 @@
-#![unstable(feature = "humans",
- reason = "who ever let humans program computers,
- we're apparently really bad at it",
- issue = "none")]
-
-#![feature(const_fn_floating_point_arithmetic, foo, foo2)]
-#![feature(staged_api)]
-
-#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_unstable(feature="foo", issue = "none")]
-const fn foo() -> u32 { 42 }
-
-#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_stable(feature = "rust1", since = "1.0.0")]
-// can't call non-min_const_fn
-const fn bar() -> u32 { foo() } //~ ERROR not yet stable as a const fn
-
-#[unstable(feature = "foo2", issue = "none")]
-const fn foo2() -> u32 { 42 }
-
-#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_stable(feature = "rust1", since = "1.0.0")]
-// can't call non-min_const_fn
-const fn bar2() -> u32 { foo2() } //~ ERROR not yet stable as a const fn
-
-#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_stable(feature = "rust1", since = "1.0.0")]
-// Const-stable functions cannot rely on unstable const-eval features.
-const fn bar3() -> u32 { (5f32 + 6f32) as u32 }
-//~^ ERROR const-stable function cannot use `#[feature(const_fn_floating_point_arithmetic)]`
-
-// check whether this function cannot be called even with the feature gate active
-#[unstable(feature = "foo2", issue = "none")]
-const fn foo2_gated() -> u32 { 42 }
-
-#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_stable(feature = "rust1", since = "1.0.0")]
-// can't call non-min_const_fn
-const fn bar2_gated() -> u32 { foo2_gated() } //~ ERROR not yet stable as a const fn
-
-fn main() {}
diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr b/src/test/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr
deleted file mode 100644
index 778b0e55f..000000000
--- a/src/test/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr
+++ /dev/null
@@ -1,41 +0,0 @@
-error: `foo` is not yet stable as a const fn
- --> $DIR/min_const_fn_libstd_stability.rs:16:25
- |
-LL | const fn bar() -> u32 { foo() }
- | ^^^^^
- |
- = help: const-stable functions can only call other const-stable functions
-
-error: `foo2` is not yet stable as a const fn
- --> $DIR/min_const_fn_libstd_stability.rs:24:26
- |
-LL | const fn bar2() -> u32 { foo2() }
- | ^^^^^^
- |
- = help: const-stable functions can only call other const-stable functions
-
-error: const-stable function cannot use `#[feature(const_fn_floating_point_arithmetic)]`
- --> $DIR/min_const_fn_libstd_stability.rs:29:26
- |
-LL | const fn bar3() -> u32 { (5f32 + 6f32) as u32 }
- | ^^^^^^^^^^^^^
- |
-help: if it is not part of the public API, make this function unstably const
- |
-LL | #[rustc_const_unstable(feature = "...", issue = "...")]
- |
-help: otherwise `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks
- |
-LL | #[rustc_allow_const_fn_unstable(const_fn_floating_point_arithmetic)]
- |
-
-error: `foo2_gated` is not yet stable as a const fn
- --> $DIR/min_const_fn_libstd_stability.rs:39:32
- |
-LL | const fn bar2_gated() -> u32 { foo2_gated() }
- | ^^^^^^^^^^^^
- |
- = help: const-stable functions can only call other const-stable functions
-
-error: aborting due to 4 previous errors
-
diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_unsafe_bad.rs b/src/test/ui/consts/min_const_fn/min_const_fn_unsafe_bad.rs
deleted file mode 100644
index a6e1788bb..000000000
--- a/src/test/ui/consts/min_const_fn/min_const_fn_unsafe_bad.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-const fn bad_const_fn_deref_raw(x: *mut usize) -> &'static usize { unsafe { &*x } }
-//~^ dereferencing raw mutable pointers in constant functions
-
-const unsafe fn bad_const_unsafe_deref_raw(x: *mut usize) -> usize { *x }
-//~^ dereferencing raw mutable pointers in constant functions
-
-const unsafe fn bad_const_unsafe_deref_raw_ref(x: *mut usize) -> &'static usize { &*x }
-//~^ dereferencing raw mutable pointers in constant functions
-
-fn main() {}
diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_unsafe_bad.stderr b/src/test/ui/consts/min_const_fn/min_const_fn_unsafe_bad.stderr
deleted file mode 100644
index 820b6433f..000000000
--- a/src/test/ui/consts/min_const_fn/min_const_fn_unsafe_bad.stderr
+++ /dev/null
@@ -1,30 +0,0 @@
-error[E0658]: dereferencing raw mutable pointers in constant functions is unstable
- --> $DIR/min_const_fn_unsafe_bad.rs:1:77
- |
-LL | const fn bad_const_fn_deref_raw(x: *mut usize) -> &'static usize { unsafe { &*x } }
- | ^^^
- |
- = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
- = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
-
-error[E0658]: dereferencing raw mutable pointers in constant functions is unstable
- --> $DIR/min_const_fn_unsafe_bad.rs:4:70
- |
-LL | const unsafe fn bad_const_unsafe_deref_raw(x: *mut usize) -> usize { *x }
- | ^^
- |
- = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
- = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
-
-error[E0658]: dereferencing raw mutable pointers in constant functions is unstable
- --> $DIR/min_const_fn_unsafe_bad.rs:7:83
- |
-LL | const unsafe fn bad_const_unsafe_deref_raw_ref(x: *mut usize) -> &'static usize { &*x }
- | ^^^
- |
- = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
- = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_unsafe_ok.rs b/src/test/ui/consts/min_const_fn/min_const_fn_unsafe_ok.rs
deleted file mode 100644
index 02c7970de..000000000
--- a/src/test/ui/consts/min_const_fn/min_const_fn_unsafe_ok.rs
+++ /dev/null
@@ -1,44 +0,0 @@
-// check-pass
-
-const unsafe fn ret_i32_no_unsafe() -> i32 { 42 }
-const unsafe fn ret_null_ptr_no_unsafe<T>() -> *const T { std::ptr::null() }
-const unsafe fn ret_null_mut_ptr_no_unsafe<T>() -> *mut T { std::ptr::null_mut() }
-const fn no_unsafe() { unsafe {} }
-
-const fn call_unsafe_const_fn() -> i32 {
- unsafe { ret_i32_no_unsafe() }
-}
-const fn call_unsafe_generic_const_fn() -> *const String {
- unsafe { ret_null_ptr_no_unsafe::<String>() }
-}
-const fn call_unsafe_generic_cell_const_fn()
- -> *const Vec<std::cell::Cell<u32>>
-{
- unsafe { ret_null_mut_ptr_no_unsafe::<Vec<std::cell::Cell<u32>>>() }
-}
-
-const unsafe fn call_unsafe_const_unsafe_fn() -> i32 {
- unsafe { ret_i32_no_unsafe() }
-}
-const unsafe fn call_unsafe_generic_const_unsafe_fn() -> *const String {
- unsafe { ret_null_ptr_no_unsafe::<String>() }
-}
-const unsafe fn call_unsafe_generic_cell_const_unsafe_fn()
- -> *const Vec<std::cell::Cell<u32>>
-{
- unsafe { ret_null_mut_ptr_no_unsafe::<Vec<std::cell::Cell<u32>>>() }
-}
-
-const unsafe fn call_unsafe_const_unsafe_fn_immediate() -> i32 {
- ret_i32_no_unsafe()
-}
-const unsafe fn call_unsafe_generic_const_unsafe_fn_immediate() -> *const String {
- ret_null_ptr_no_unsafe::<String>()
-}
-const unsafe fn call_unsafe_generic_cell_const_unsafe_fn_immediate()
- -> *const Vec<std::cell::Cell<u32>>
-{
- ret_null_mut_ptr_no_unsafe::<Vec<std::cell::Cell<u32>>>()
-}
-
-fn main() {}
diff --git a/src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.rs b/src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.rs
deleted file mode 100644
index 03084c867..000000000
--- a/src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.rs
+++ /dev/null
@@ -1,42 +0,0 @@
-#![unstable(feature = "humans",
- reason = "who ever let humans program computers,
- we're apparently really bad at it",
- issue = "none")]
-
-#![feature(const_fn_floating_point_arithmetic, foo, foo2)]
-#![feature(staged_api)]
-
-#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_unstable(feature="foo", issue = "none")]
-const unsafe fn foo() -> u32 { 42 }
-
-#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_stable(feature = "rust1", since = "1.0.0")]
-// can't call non-min_const_fn
-const unsafe fn bar() -> u32 { unsafe { foo() } } //~ ERROR not yet stable as a const fn
-
-#[unstable(feature = "foo2", issue = "none")]
-const unsafe fn foo2() -> u32 { 42 }
-
-#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_stable(feature = "rust1", since = "1.0.0")]
-// can't call non-min_const_fn
-const unsafe fn bar2() -> u32 { unsafe { foo2() } } //~ ERROR not yet stable as a const fn
-
-#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_stable(feature = "rust1", since = "1.0.0")]
-// conformity is required
-const unsafe fn bar3() -> u32 { (5f32 + 6f32) as u32 }
-//~^ ERROR const-stable function cannot use `#[feature(const_fn_floating_point_arithmetic)]`
-
-// check whether this function cannot be called even with the feature gate active
-#[unstable(feature = "foo2", issue = "none")]
-const unsafe fn foo2_gated() -> u32 { 42 }
-
-#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_stable(feature = "rust1", since = "1.0.0")]
-// can't call non-min_const_fn
-const unsafe fn bar2_gated() -> u32 { unsafe { foo2_gated() } }
-//~^ ERROR not yet stable as a const fn
-
-fn main() {}
diff --git a/src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.stderr b/src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.stderr
deleted file mode 100644
index 0174cb77f..000000000
--- a/src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.stderr
+++ /dev/null
@@ -1,41 +0,0 @@
-error: `foo` is not yet stable as a const fn
- --> $DIR/min_const_unsafe_fn_libstd_stability.rs:16:41
- |
-LL | const unsafe fn bar() -> u32 { unsafe { foo() } }
- | ^^^^^
- |
- = help: const-stable functions can only call other const-stable functions
-
-error: `foo2` is not yet stable as a const fn
- --> $DIR/min_const_unsafe_fn_libstd_stability.rs:24:42
- |
-LL | const unsafe fn bar2() -> u32 { unsafe { foo2() } }
- | ^^^^^^
- |
- = help: const-stable functions can only call other const-stable functions
-
-error: const-stable function cannot use `#[feature(const_fn_floating_point_arithmetic)]`
- --> $DIR/min_const_unsafe_fn_libstd_stability.rs:29:33
- |
-LL | const unsafe fn bar3() -> u32 { (5f32 + 6f32) as u32 }
- | ^^^^^^^^^^^^^
- |
-help: if it is not part of the public API, make this function unstably const
- |
-LL | #[rustc_const_unstable(feature = "...", issue = "...")]
- |
-help: otherwise `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks
- |
-LL | #[rustc_allow_const_fn_unstable(const_fn_floating_point_arithmetic)]
- |
-
-error: `foo2_gated` is not yet stable as a const fn
- --> $DIR/min_const_unsafe_fn_libstd_stability.rs:39:48
- |
-LL | const unsafe fn bar2_gated() -> u32 { unsafe { foo2_gated() } }
- | ^^^^^^^^^^^^
- |
- = help: const-stable functions can only call other const-stable functions
-
-error: aborting due to 4 previous errors
-
diff --git a/src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability2.rs b/src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability2.rs
deleted file mode 100644
index 94b620713..000000000
--- a/src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability2.rs
+++ /dev/null
@@ -1,35 +0,0 @@
-#![unstable(feature = "humans",
- reason = "who ever let humans program computers,
- we're apparently really bad at it",
- issue = "none")]
-
-#![feature(foo, foo2)]
-#![feature(staged_api)]
-
-#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_unstable(feature="foo", issue = "none")]
-const fn foo() -> u32 { 42 }
-
-#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_stable(feature = "rust1", since = "1.0.0")]
-// can't call non-min_const_fn
-const unsafe fn bar() -> u32 { foo() } //~ ERROR not yet stable as a const fn
-
-#[unstable(feature = "foo2", issue = "none")]
-const fn foo2() -> u32 { 42 }
-
-#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_stable(feature = "rust1", since = "1.0.0")]
-// can't call non-min_const_fn
-const unsafe fn bar2() -> u32 { foo2() } //~ ERROR not yet stable as a const fn
-
-// check whether this function cannot be called even with the feature gate active
-#[unstable(feature = "foo2", issue = "none")]
-const fn foo2_gated() -> u32 { 42 }
-
-#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_stable(feature = "rust1", since = "1.0.0")]
-// can't call non-min_const_fn
-const unsafe fn bar2_gated() -> u32 { foo2_gated() } //~ ERROR not yet stable as a const fn
-
-fn main() {}
diff --git a/src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability2.stderr b/src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability2.stderr
deleted file mode 100644
index e90ba9b91..000000000
--- a/src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability2.stderr
+++ /dev/null
@@ -1,26 +0,0 @@
-error: `foo` is not yet stable as a const fn
- --> $DIR/min_const_unsafe_fn_libstd_stability2.rs:16:32
- |
-LL | const unsafe fn bar() -> u32 { foo() }
- | ^^^^^
- |
- = help: const-stable functions can only call other const-stable functions
-
-error: `foo2` is not yet stable as a const fn
- --> $DIR/min_const_unsafe_fn_libstd_stability2.rs:24:33
- |
-LL | const unsafe fn bar2() -> u32 { foo2() }
- | ^^^^^^
- |
- = help: const-stable functions can only call other const-stable functions
-
-error: `foo2_gated` is not yet stable as a const fn
- --> $DIR/min_const_unsafe_fn_libstd_stability2.rs:33:39
- |
-LL | const unsafe fn bar2_gated() -> u32 { foo2_gated() }
- | ^^^^^^^^^^^^
- |
- = help: const-stable functions can only call other const-stable functions
-
-error: aborting due to 3 previous errors
-
diff --git a/src/test/ui/consts/min_const_fn/mutable_borrow.rs b/src/test/ui/consts/min_const_fn/mutable_borrow.rs
deleted file mode 100644
index 580b1d50f..000000000
--- a/src/test/ui/consts/min_const_fn/mutable_borrow.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-const fn mutable_ref_in_const() -> u8 {
- let mut a = 0;
- let b = &mut a; //~ ERROR mutable references
- *b
-}
-
-struct X;
-
-impl X {
- const fn inherent_mutable_ref_in_const() -> u8 {
- let mut a = 0;
- let b = &mut a; //~ ERROR mutable references
- *b
- }
-}
-
-fn main() {}
diff --git a/src/test/ui/consts/min_const_fn/mutable_borrow.stderr b/src/test/ui/consts/min_const_fn/mutable_borrow.stderr
deleted file mode 100644
index 8e95a4c68..000000000
--- a/src/test/ui/consts/min_const_fn/mutable_borrow.stderr
+++ /dev/null
@@ -1,21 +0,0 @@
-error[E0658]: mutable references are not allowed in constant functions
- --> $DIR/mutable_borrow.rs:3:13
- |
-LL | let b = &mut a;
- | ^^^^^^
- |
- = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
- = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
-
-error[E0658]: mutable references are not allowed in constant functions
- --> $DIR/mutable_borrow.rs:12:17
- |
-LL | let b = &mut a;
- | ^^^^^^
- |
- = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
- = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/consts/min_const_fn/promotion.rs b/src/test/ui/consts/min_const_fn/promotion.rs
deleted file mode 100644
index fbe535c71..000000000
--- a/src/test/ui/consts/min_const_fn/promotion.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-use std::cell::Cell;
-
-const fn foo1() {}
-const fn foo2(x: i32) -> i32 { x }
-const fn foo3() -> i32 { 42 }
-const fn foo4() -> Cell<i32> { Cell::new(42) }
-const fn foo5() -> Option<Cell<i32>> { Some(Cell::new(42)) }
-const fn foo6() -> Option<Cell<i32>> { None }
-
-fn main() {
- let x: &'static () = &foo1(); //~ ERROR temporary value dropped while borrowed
- let y: &'static i32 = &foo2(42); //~ ERROR temporary value dropped while borrowed
- let z: &'static i32 = &foo3(); //~ ERROR temporary value dropped while borrowed
- let a: &'static Cell<i32> = &foo4(); //~ ERROR temporary value dropped while borrowed
- let a: &'static Option<Cell<i32>> = &foo5(); //~ ERROR temporary value dropped while borrowed
- let a: &'static Option<Cell<i32>> = &foo6(); //~ ERROR temporary value dropped while borrowed
-}
diff --git a/src/test/ui/consts/min_const_fn/promotion.stderr b/src/test/ui/consts/min_const_fn/promotion.stderr
deleted file mode 100644
index 0b8dc0ce0..000000000
--- a/src/test/ui/consts/min_const_fn/promotion.stderr
+++ /dev/null
@@ -1,68 +0,0 @@
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/promotion.rs:11:27
- |
-LL | let x: &'static () = &foo1();
- | ----------- ^^^^^^ creates a temporary value which is freed while still in use
- | |
- | type annotation requires that borrow lasts for `'static`
-...
-LL | }
- | - temporary value is freed at the end of this statement
-
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/promotion.rs:12:28
- |
-LL | let y: &'static i32 = &foo2(42);
- | ------------ ^^^^^^^^ creates a temporary value which is freed while still in use
- | |
- | type annotation requires that borrow lasts for `'static`
-...
-LL | }
- | - temporary value is freed at the end of this statement
-
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/promotion.rs:13:28
- |
-LL | let z: &'static i32 = &foo3();
- | ------------ ^^^^^^ creates a temporary value which is freed while still in use
- | |
- | type annotation requires that borrow lasts for `'static`
-...
-LL | }
- | - temporary value is freed at the end of this statement
-
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/promotion.rs:14:34
- |
-LL | let a: &'static Cell<i32> = &foo4();
- | ------------------ ^^^^^^ creates a temporary value which is freed while still in use
- | |
- | type annotation requires that borrow lasts for `'static`
-...
-LL | }
- | - temporary value is freed at the end of this statement
-
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/promotion.rs:15:42
- |
-LL | let a: &'static Option<Cell<i32>> = &foo5();
- | -------------------------- ^^^^^^ creates a temporary value which is freed while still in use
- | |
- | type annotation requires that borrow lasts for `'static`
-LL | let a: &'static Option<Cell<i32>> = &foo6();
-LL | }
- | - temporary value is freed at the end of this statement
-
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/promotion.rs:16:42
- |
-LL | let a: &'static Option<Cell<i32>> = &foo6();
- | -------------------------- ^^^^^^ creates a temporary value which is freed while still in use
- | |
- | type annotation requires that borrow lasts for `'static`
-LL | }
- | - temporary value is freed at the end of this statement
-
-error: aborting due to 6 previous errors
-
-For more information about this error, try `rustc --explain E0716`.