summaryrefslogtreecommitdiffstats
path: root/tests/ui/lint/unused/unused-allocation.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/lint/unused/unused-allocation.rs')
-rw-r--r--tests/ui/lint/unused/unused-allocation.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/ui/lint/unused/unused-allocation.rs b/tests/ui/lint/unused/unused-allocation.rs
new file mode 100644
index 000000000..c1a6f5cea
--- /dev/null
+++ b/tests/ui/lint/unused/unused-allocation.rs
@@ -0,0 +1,7 @@
+#![feature(rustc_attrs, stmt_expr_attributes)]
+#![deny(unused_allocation)]
+
+fn main() {
+ _ = (#[rustc_box] Box::new([1])).len(); //~ error: unnecessary allocation, use `&` instead
+ _ = Box::new([1]).len(); //~ error: unnecessary allocation, use `&` instead
+}