From c061464f20b25684751948bae2c4f8d6df1de0cb Mon Sep 17 00:00:00 2001 From: scott-linder <scott.b.linder@wmich.edu> Date: Thu, 2 Feb 2017 10:55:27 -0500 Subject: [PATCH] Add more exhaustive tests for borrow_box --- tests/compile-fail/borrow_box.rs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/tests/compile-fail/borrow_box.rs b/tests/compile-fail/borrow_box.rs index 54dee4f9016..9c1c36e6475 100644 --- a/tests/compile-fail/borrow_box.rs +++ b/tests/compile-fail/borrow_box.rs @@ -4,11 +4,22 @@ #![deny(clippy)] #![allow(boxed_local)] #![allow(blacklisted_name)] +#![allow(unused_variables)] +#![allow(dead_code)] -pub fn test(foo: &Box<bool>) { //~ ERROR you seem to be trying to use `&Box<T>` +pub fn test1(foo: &Box<bool>) { //~ ERROR you seem to be trying to use `&Box<T>` println!("{:?}", foo) } -fn main(){ - test(&Box::new(false)); +pub fn test2() { + let foo: &Box<bool>; //~ ERROR you seem to be trying to use `&Box<T>` +} + +struct Test3<'a> { + foo: &'a Box<bool> //~ ERROR you seem to be trying to use `&Box<T>` +} + +fn main(){ + test1(&Box::new(false)); + test2(); }