1 #![feature(box_syntax)]
3 #![allow(warnings, clippy)]
27 fn ok_box_trait(boxed_trait: &Box<Z>) {
28 let boxed_local = boxed_trait;
37 fn warn_arg(x: Box<A>) {
41 fn nowarn_closure_arg() {
43 x.map_or((), |x| take_ref(&x));
46 fn warn_rename_call() {
50 y.foo(); // via autoderef
59 take_ref(&bz); // via deref coercion
62 fn nowarn_return() -> Box<A> {
64 fx // moved out, "escapes"
69 drop(bx) // moved in, "escapes"
73 bx.clone(); // method only available to Box, not via autoderef
78 take_box(&bx); // fn needs &Box
82 fn take_box(x: &Box<A>) {}
86 fn nowarn_ref_take() {
87 // false positive, should actually warn
94 let x = box A; // moved into a match
102 match &x { // not moved
107 fn nowarn_large_array() {
108 // should not warn, is large array
109 // and should not be on stack
110 let x = box [1; 10000];
111 match &x { // not moved
117 /// ICE regression test
122 impl<'a> Foo for &'a () {
126 pub struct PeekableSeekable<I: Foo> {
130 pub fn new(_needs_name: Box<PeekableSeekable<&()>>) -> () {