From: bors Date: Thu, 30 May 2019 07:29:28 +0000 (+0000) Subject: Auto merge of #4155 - phansch:rustup_trait_obj, r=oli-obk X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=d2f51228152a139a2a8aaba59b8a4e68f498ff26;hp=018fa30c564a47669420d3d00e15abae49d6e32f;p=rust.git Auto merge of #4155 - phansch:rustup_trait_obj, r=oli-obk Rustup to https://github.com/rust-lang/rust/pull/61203 See https://github.com/rust-lang/rust/pull/61203 Migrates all trait objects to use `dyn` in our ui tests changelog: none --- diff --git a/tests/ui/borrow_box.rs b/tests/ui/borrow_box.rs index 3b53aab7e23..b30f7290ffe 100644 --- a/tests/ui/borrow_box.rs +++ b/tests/ui/borrow_box.rs @@ -27,46 +27,46 @@ fn test4(a: &Box) { use std::any::Any; -pub fn test5(foo: &mut Box) { +pub fn test5(foo: &mut Box) { println!("{:?}", foo) } pub fn test6() { - let foo: &Box; + let foo: &Box; } struct Test7<'a> { - foo: &'a Box, + foo: &'a Box, } trait Test8 { - fn test8(a: &Box); + fn test8(a: &Box); } impl<'a> Test8 for Test7<'a> { - fn test8(a: &Box) { + fn test8(a: &Box) { unimplemented!(); } } -pub fn test9(foo: &mut Box) { +pub fn test9(foo: &mut Box) { let _ = foo; } pub fn test10() { - let foo: &Box; + let foo: &Box; } struct Test11<'a> { - foo: &'a Box, + foo: &'a Box, } trait Test12 { - fn test4(a: &Box); + fn test4(a: &Box); } impl<'a> Test12 for Test11<'a> { - fn test4(a: &Box) { + fn test4(a: &Box) { unimplemented!(); } } @@ -74,8 +74,8 @@ fn test4(a: &Box) { fn main() { test1(&mut Box::new(false)); test2(); - test5(&mut (Box::new(false) as Box)); + test5(&mut (Box::new(false) as Box)); test6(); - test9(&mut (Box::new(false) as Box)); + test9(&mut (Box::new(false) as Box)); test10(); } diff --git a/tests/ui/box_vec.rs b/tests/ui/box_vec.rs index af3ba5b4d35..87b67c23704 100644 --- a/tests/ui/box_vec.rs +++ b/tests/ui/box_vec.rs @@ -15,7 +15,7 @@ pub fn test(foo: Box>) { println!("{:?}", foo.get(0)) } -pub fn test2(foo: Box)>) { +pub fn test2(foo: Box)>) { // pass if #31 is fixed foo(vec![1, 2, 3]) } diff --git a/tests/ui/escape_analysis.rs b/tests/ui/escape_analysis.rs index e3f78182fd1..78d332c7a31 100644 --- a/tests/ui/escape_analysis.rs +++ b/tests/ui/escape_analysis.rs @@ -21,7 +21,7 @@ fn bar(&self) { fn main() {} -fn ok_box_trait(boxed_trait: &Box) { +fn ok_box_trait(boxed_trait: &Box) { let boxed_local = boxed_trait; // done } diff --git a/tests/ui/eta.fixed b/tests/ui/eta.fixed index a3e57956f35..1ad836d25ff 100644 --- a/tests/ui/eta.fixed +++ b/tests/ui/eta.fixed @@ -32,8 +32,8 @@ fn main() { let e = Some(1u8).map(generic); let e = Some(1u8).map(generic); // See #515 - let a: Option>> = - Some(vec![1i32, 2]).map(|v| -> Box<::std::ops::Deref> { Box::new(v) }); + let a: Option)>> = + Some(vec![1i32, 2]).map(|v| -> Box)> { Box::new(v) }); } trait TestTrait { @@ -108,7 +108,7 @@ fn test_redundant_closures_containing_method_calls() { let _: Vec<_> = arr.iter().map(|x| x.map_err(some.take().unwrap())).collect(); } -struct Thunk(Box T>); +struct Thunk(Box T>); impl Thunk { fn new T>(f: F) -> Thunk { diff --git a/tests/ui/eta.rs b/tests/ui/eta.rs index 58adf21b1d5..41a13d769a6 100644 --- a/tests/ui/eta.rs +++ b/tests/ui/eta.rs @@ -32,8 +32,8 @@ fn main() { let e = Some(1u8).map(|a| generic(a)); let e = Some(1u8).map(generic); // See #515 - let a: Option>> = - Some(vec![1i32, 2]).map(|v| -> Box<::std::ops::Deref> { Box::new(v) }); + let a: Option)>> = + Some(vec![1i32, 2]).map(|v| -> Box)> { Box::new(v) }); } trait TestTrait { @@ -108,7 +108,7 @@ fn test_different_borrow_levels(t: &[&T]) let _: Vec<_> = arr.iter().map(|x| x.map_err(|e| some.take().unwrap()(e))).collect(); } -struct Thunk(Box T>); +struct Thunk(Box T>); impl Thunk { fn new T>(f: F) -> Thunk { diff --git a/tests/ui/extra_unused_lifetimes.rs b/tests/ui/extra_unused_lifetimes.rs index ba7c42b3a90..9f05f8c1ed0 100644 --- a/tests/ui/extra_unused_lifetimes.rs +++ b/tests/ui/extra_unused_lifetimes.rs @@ -25,7 +25,7 @@ fn lt_return_only<'a>() -> &'a u8 { panic!() } -fn unused_lt_blergh<'a>(x: Option>) {} +fn unused_lt_blergh<'a>(x: Option>) {} trait Foo<'a> { fn x(&self, a: &'a u8); diff --git a/tests/ui/len_zero.fixed b/tests/ui/len_zero.fixed index 56109a0fa5f..624e5ef8fcf 100644 --- a/tests/ui/len_zero.fixed +++ b/tests/ui/len_zero.fixed @@ -70,7 +70,7 @@ fn main() { println!("This should not happen either!"); } - let z: &TraitsToo = &y; + let z: &dyn TraitsToo = &y; if z.len() > 0 { // No error; `TraitsToo` has no `.is_empty()` method. println!("Nor should this!"); @@ -125,7 +125,7 @@ fn main() { } assert!(!has_is_empty.is_empty()); - let with_is_empty: &WithIsEmpty = &Wither; + let with_is_empty: &dyn WithIsEmpty = &Wither; if with_is_empty.is_empty() { println!("Or this!"); } diff --git a/tests/ui/len_zero.rs b/tests/ui/len_zero.rs index 0a77f119462..7fba971cfd8 100644 --- a/tests/ui/len_zero.rs +++ b/tests/ui/len_zero.rs @@ -70,7 +70,7 @@ fn main() { println!("This should not happen either!"); } - let z: &TraitsToo = &y; + let z: &dyn TraitsToo = &y; if z.len() > 0 { // No error; `TraitsToo` has no `.is_empty()` method. println!("Nor should this!"); @@ -125,7 +125,7 @@ fn main() { } assert!(!has_is_empty.is_empty()); - let with_is_empty: &WithIsEmpty = &Wither; + let with_is_empty: &dyn WithIsEmpty = &Wither; if with_is_empty.len() == 0 { println!("Or this!"); } diff --git a/tests/ui/needless_borrow.rs b/tests/ui/needless_borrow.rs index a59254625dc..d4ac2b89854 100644 --- a/tests/ui/needless_borrow.rs +++ b/tests/ui/needless_borrow.rs @@ -41,7 +41,7 @@ trait Trait {} impl<'a> Trait for &'a str {} -fn h(_: &Trait) {} +fn h(_: &dyn Trait) {} #[warn(clippy::needless_borrow)] #[allow(dead_code)] fn issue_1432() { diff --git a/tests/ui/needless_lifetimes.rs b/tests/ui/needless_lifetimes.rs index e2d680ceaeb..f585be2fd03 100644 --- a/tests/ui/needless_lifetimes.rs +++ b/tests/ui/needless_lifetimes.rs @@ -166,16 +166,16 @@ fn struct_with_lt4<'a, 'b>(_foo: &'a Foo<'b>) -> &'a str { trait WithLifetime<'a> {} -type WithLifetimeAlias<'a> = WithLifetime<'a>; +type WithLifetimeAlias<'a> = dyn WithLifetime<'a>; // Should not warn because it won't build without the lifetime. -fn trait_obj_elided<'a>(_arg: &'a WithLifetime) -> &'a str { +fn trait_obj_elided<'a>(_arg: &'a dyn WithLifetime) -> &'a str { unimplemented!() } // Should warn because there is no lifetime on `Drop`, so this would be // unambiguous if we elided the lifetime. -fn trait_obj_elided2<'a>(_arg: &'a Drop) -> &'a str { +fn trait_obj_elided2<'a>(_arg: &'a dyn Drop) -> &'a str { unimplemented!() } @@ -226,7 +226,7 @@ struct Test { } impl Test { - fn iter<'a>(&'a self) -> Box + 'a> { + fn iter<'a>(&'a self) -> Box + 'a> { unimplemented!() } } diff --git a/tests/ui/needless_lifetimes.stderr b/tests/ui/needless_lifetimes.stderr index 9334076fc71..bbb69aeda1c 100644 --- a/tests/ui/needless_lifetimes.stderr +++ b/tests/ui/needless_lifetimes.stderr @@ -81,7 +81,7 @@ LL | | } error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration) --> $DIR/needless_lifetimes.rs:178:1 | -LL | / fn trait_obj_elided2<'a>(_arg: &'a Drop) -> &'a str { +LL | / fn trait_obj_elided2<'a>(_arg: &'a dyn Drop) -> &'a str { LL | | unimplemented!() LL | | } | |_^ diff --git a/tests/ui/non_copy_const.rs b/tests/ui/non_copy_const.rs index 00cbcaeacb9..46cbb3fee35 100644 --- a/tests/ui/non_copy_const.rs +++ b/tests/ui/non_copy_const.rs @@ -27,7 +27,7 @@ macro_rules! declare_const { const COW: Cow = Cow::Borrowed("abcdef"); //^ note: a const item of Cow is used in the `postgres` package. -const NO_ANN: &Display = &70; +const NO_ANN: &dyn Display = &70; static STATIC_TUPLE: (AtomicUsize, String) = (ATOMIC, STRING); //^ there should be no lints on this line diff --git a/tests/ui/unnecessary_clone.rs b/tests/ui/unnecessary_clone.rs index 570536d0a56..2e0fc122778 100644 --- a/tests/ui/unnecessary_clone.rs +++ b/tests/ui/unnecessary_clone.rs @@ -44,7 +44,7 @@ fn clone_on_ref_ptr() { sync::Weak::clone(&arc_weak); let x = Arc::new(SomeImpl); - let _: Arc = x.clone(); + let _: Arc = x.clone(); } fn clone_on_copy_generic(t: T) { diff --git a/tests/ui/unnecessary_clone.stderr b/tests/ui/unnecessary_clone.stderr index a014478597f..8d5d54e7de6 100644 --- a/tests/ui/unnecessary_clone.stderr +++ b/tests/ui/unnecessary_clone.stderr @@ -45,10 +45,10 @@ LL | arc_weak.clone(); | ^^^^^^^^^^^^^^^^ help: try this: `Weak::::clone(&arc_weak)` error: using '.clone()' on a ref-counted pointer - --> $DIR/unnecessary_clone.rs:47:29 + --> $DIR/unnecessary_clone.rs:47:33 | -LL | let _: Arc = x.clone(); - | ^^^^^^^^^ help: try this: `Arc::::clone(&x)` +LL | let _: Arc = x.clone(); + | ^^^^^^^^^ help: try this: `Arc::::clone(&x)` error: using `clone` on a `Copy` type --> $DIR/unnecessary_clone.rs:51:5 diff --git a/tests/ui/unused_unit.fixed b/tests/ui/unused_unit.fixed index 64124589683..3c9e91a19f9 100644 --- a/tests/ui/unused_unit.fixed +++ b/tests/ui/unused_unit.fixed @@ -17,7 +17,7 @@ impl Unitter { #[allow(clippy::no_effect)] pub fn get_unit (), G>(&self, f: F, _g: G) where G: Fn() -> () { - let _y: &Fn() -> () = &f; + let _y: &dyn Fn() -> () = &f; (); // this should not lint, as it's not in return type position } } diff --git a/tests/ui/unused_unit.rs b/tests/ui/unused_unit.rs index 8e31385b70c..1acd427be1e 100644 --- a/tests/ui/unused_unit.rs +++ b/tests/ui/unused_unit.rs @@ -18,7 +18,7 @@ impl Unitter { pub fn get_unit (), G>(&self, f: F, _g: G) -> () where G: Fn() -> () { - let _y: &Fn() -> () = &f; + let _y: &dyn Fn() -> () = &f; (); // this should not lint, as it's not in return type position } }