summaryrefslogtreecommitdiffstats
path: root/tests/ui/consts/promoted-const-drop.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/consts/promoted-const-drop.rs')
-rw-r--r--tests/ui/consts/promoted-const-drop.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/ui/consts/promoted-const-drop.rs b/tests/ui/consts/promoted-const-drop.rs
new file mode 100644
index 000000000..c896c011a
--- /dev/null
+++ b/tests/ui/consts/promoted-const-drop.rs
@@ -0,0 +1,15 @@
+#![feature(const_trait_impl)]
+#![feature(const_mut_refs)]
+
+struct A();
+
+impl const Drop for A {
+ fn drop(&mut self) {}
+}
+
+const C: A = A();
+
+fn main() {
+ let _: &'static A = &A(); //~ ERROR temporary value dropped while borrowed
+ let _: &'static [A] = &[C]; //~ ERROR temporary value dropped while borrowed
+}