diff --git a/src/test/ui/anonymous-higher-ranked-lifetime.rs b/src/test/ui/anonymous-higher-ranked-lifetime.rs index 2e2a124db9a5..8a1744ed5f8a 100644 --- a/src/test/ui/anonymous-higher-ranked-lifetime.rs +++ b/src/test/ui/anonymous-higher-ranked-lifetime.rs @@ -31,11 +31,11 @@ fn f4(_: F) where F: for<'r> Fn(&(), &'r ()) {} fn f5(_: F) where F: for<'r> Fn(&'r (), &'r ()) {} // Nested -fn g1(_: F) where F: Fn(&(), Box) {} +fn g1(_: F) where F: Fn(&(), Box) {} fn g2(_: F) where F: Fn(&(), fn(&())) {} -fn g3(_: F) where F: for<'s> Fn(&'s (), Box) {} +fn g3(_: F) where F: for<'s> Fn(&'s (), Box) {} fn g4(_: F) where F: Fn(&(), for<'r> fn(&'r ())) {} // Mixed -fn h1(_: F) where F: Fn(&(), Box, &(), fn(&(), &())) {} -fn h2(_: F) where F: for<'t0> Fn(&(), Box, &'t0 (), fn(&(), &())) {} +fn h1(_: F) where F: Fn(&(), Box, &(), fn(&(), &())) {} +fn h2(_: F) where F: for<'t0> Fn(&(), Box, &'t0 (), fn(&(), &())) {} diff --git a/src/test/ui/anonymous-higher-ranked-lifetime.stderr b/src/test/ui/anonymous-higher-ranked-lifetime.stderr index 86547303978d..0ca3ca843746 100644 --- a/src/test/ui/anonymous-higher-ranked-lifetime.stderr +++ b/src/test/ui/anonymous-higher-ranked-lifetime.stderr @@ -149,8 +149,8 @@ LL | g1(|_: (), _: ()| {}); note: required by `g1` --> $DIR/anonymous-higher-ranked-lifetime.rs:34:1 | -LL | fn g1(_: F) where F: Fn(&(), Box) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn g1(_: F) where F: Fn(&(), Box) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:12:5 @@ -163,8 +163,8 @@ LL | g1(|_: (), _: ()| {}); note: required by `g1` --> $DIR/anonymous-higher-ranked-lifetime.rs:34:1 | -LL | fn g1(_: F) where F: Fn(&(), Box) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn g1(_: F) where F: Fn(&(), Box) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:14:5 @@ -205,8 +205,8 @@ LL | g3(|_: (), _: ()| {}); note: required by `g3` --> $DIR/anonymous-higher-ranked-lifetime.rs:36:1 | -LL | fn g3(_: F) where F: for<'s> Fn(&'s (), Box) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn g3(_: F) where F: for<'s> Fn(&'s (), Box) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:16:5 @@ -219,8 +219,8 @@ LL | g3(|_: (), _: ()| {}); note: required by `g3` --> $DIR/anonymous-higher-ranked-lifetime.rs:36:1 | -LL | fn g3(_: F) where F: for<'s> Fn(&'s (), Box) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn g3(_: F) where F: for<'s> Fn(&'s (), Box) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:18:5 @@ -261,8 +261,8 @@ LL | h1(|_: (), _: (), _: (), _: ()| {}); note: required by `h1` --> $DIR/anonymous-higher-ranked-lifetime.rs:40:1 | -LL | fn h1(_: F) where F: Fn(&(), Box, &(), fn(&(), &())) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn h1(_: F) where F: Fn(&(), Box, &(), fn(&(), &())) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:20:5 @@ -275,8 +275,8 @@ LL | h1(|_: (), _: (), _: (), _: ()| {}); note: required by `h1` --> $DIR/anonymous-higher-ranked-lifetime.rs:40:1 | -LL | fn h1(_: F) where F: Fn(&(), Box, &(), fn(&(), &())) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn h1(_: F) where F: Fn(&(), Box, &(), fn(&(), &())) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:22:5 @@ -289,8 +289,8 @@ LL | h2(|_: (), _: (), _: (), _: ()| {}); note: required by `h2` --> $DIR/anonymous-higher-ranked-lifetime.rs:41:1 | -LL | fn h2(_: F) where F: for<'t0> Fn(&(), Box, &'t0 (), fn(&(), &())) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn h2(_: F) where F: for<'t0> Fn(&(), Box, &'t0 (), fn(&(), &())) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:22:5 @@ -303,8 +303,8 @@ LL | h2(|_: (), _: (), _: (), _: ()| {}); note: required by `h2` --> $DIR/anonymous-higher-ranked-lifetime.rs:41:1 | -LL | fn h2(_: F) where F: for<'t0> Fn(&(), Box, &'t0 (), fn(&(), &())) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn h2(_: F) where F: for<'t0> Fn(&(), Box, &'t0 (), fn(&(), &())) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 22 previous errors diff --git a/src/test/ui/associated-const/associated-const-in-trait.rs b/src/test/ui/associated-const/associated-const-in-trait.rs index 187708a60b44..cc3acd539562 100644 --- a/src/test/ui/associated-const/associated-const-in-trait.rs +++ b/src/test/ui/associated-const/associated-const-in-trait.rs @@ -6,7 +6,7 @@ trait Trait { const N: usize; } -impl Trait { +impl dyn Trait { //~^ ERROR the trait `Trait` cannot be made into an object [E0038] const fn n() -> usize { Self::N } } diff --git a/src/test/ui/associated-const/associated-const-in-trait.stderr b/src/test/ui/associated-const/associated-const-in-trait.stderr index 44a92639b5d7..dff268a55c90 100644 --- a/src/test/ui/associated-const/associated-const-in-trait.stderr +++ b/src/test/ui/associated-const/associated-const-in-trait.stderr @@ -1,8 +1,8 @@ error[E0038]: the trait `Trait` cannot be made into an object --> $DIR/associated-const-in-trait.rs:9:6 | -LL | impl Trait { - | ^^^^^ the trait `Trait` cannot be made into an object +LL | impl dyn Trait { + | ^^^^^^^^^ the trait `Trait` cannot be made into an object | = note: the trait cannot contain associated consts like `N` diff --git a/src/test/ui/associated-type/associated-type-projection-from-multiple-supertraits.rs b/src/test/ui/associated-type/associated-type-projection-from-multiple-supertraits.rs index df9143d685ff..7a678445796e 100644 --- a/src/test/ui/associated-type/associated-type-projection-from-multiple-supertraits.rs +++ b/src/test/ui/associated-type/associated-type-projection-from-multiple-supertraits.rs @@ -20,7 +20,7 @@ fn dent(c: C, color: C::Color) { //~^ ERROR ambiguous associated type `Color` in bounds of `C` } -fn dent_object(c: BoxCar) { +fn dent_object(c: dyn BoxCar) { //~^ ERROR ambiguous associated type //~| ERROR the value of the associated type `Color` (from the trait `Vehicle`) must be specified } diff --git a/src/test/ui/associated-type/associated-type-projection-from-multiple-supertraits.stderr b/src/test/ui/associated-type/associated-type-projection-from-multiple-supertraits.stderr index dd46ad64692c..6118ebef125a 100644 --- a/src/test/ui/associated-type/associated-type-projection-from-multiple-supertraits.stderr +++ b/src/test/ui/associated-type/associated-type-projection-from-multiple-supertraits.stderr @@ -11,7 +11,7 @@ LL | fn dent(c: C, color: C::Color) { | ^^^^^^^^ ambiguous associated type `Color` error[E0221]: ambiguous associated type `Color` in bounds of `BoxCar` - --> $DIR/associated-type-projection-from-multiple-supertraits.rs:23:33 + --> $DIR/associated-type-projection-from-multiple-supertraits.rs:23:37 | LL | type Color; | ----------- ambiguous `Color` from `Vehicle` @@ -19,8 +19,8 @@ LL | type Color; LL | type Color; | ----------- ambiguous `Color` from `Box` ... -LL | fn dent_object(c: BoxCar) { - | ^^^^^^^^^^^ ambiguous associated type `Color` +LL | fn dent_object(c: dyn BoxCar) { + | ^^^^^^^^^^^ ambiguous associated type `Color` error[E0191]: the value of the associated type `Color` (from the trait `Vehicle`) must be specified --> $DIR/associated-type-projection-from-multiple-supertraits.rs:23:26 @@ -28,8 +28,8 @@ error[E0191]: the value of the associated type `Color` (from the trait `Vehicle` LL | type Color; | ----------- `Color` defined here ... -LL | fn dent_object(c: BoxCar) { - | ^^^^^^^^^^^^^^^^^^^ associated type `Color` must be specified +LL | fn dent_object(c: dyn BoxCar) { + | ^^^^^^^^^^^^^^^^^^^^^^^ associated type `Color` must be specified error[E0221]: ambiguous associated type `Color` in bounds of `C` --> $DIR/associated-type-projection-from-multiple-supertraits.rs:28:29 diff --git a/src/test/ui/associated-types/associated-types-eq-3.rs b/src/test/ui/associated-types/associated-types-eq-3.rs index 1a58dcca9e24..9366148b587d 100644 --- a/src/test/ui/associated-types/associated-types-eq-3.rs +++ b/src/test/ui/associated-types/associated-types-eq-3.rs @@ -28,7 +28,7 @@ fn foo2(x: I) { } -pub fn baz(x: &Foo) { +pub fn baz(x: &dyn Foo) { let _: Bar = x.boo(); } diff --git a/src/test/ui/associated-types/associated-types-incomplete-object.rs b/src/test/ui/associated-types/associated-types-incomplete-object.rs index c93f3bec4d7d..4993b1312154 100644 --- a/src/test/ui/associated-types/associated-types-incomplete-object.rs +++ b/src/test/ui/associated-types/associated-types-incomplete-object.rs @@ -18,14 +18,14 @@ impl Foo for isize { } pub fn main() { - let a = &42isize as &Foo; + let a = &42isize as &dyn Foo; - let b = &42isize as &Foo; + let b = &42isize as &dyn Foo; //~^ ERROR the value of the associated type `B` (from the trait `Foo`) must be specified - let c = &42isize as &Foo; + let c = &42isize as &dyn Foo; //~^ ERROR the value of the associated type `A` (from the trait `Foo`) must be specified - let d = &42isize as &Foo; + let d = &42isize as &dyn Foo; //~^ ERROR the value of the associated types `A` (from the trait `Foo`), `B` (from the trait } diff --git a/src/test/ui/associated-types/associated-types-incomplete-object.stderr b/src/test/ui/associated-types/associated-types-incomplete-object.stderr index d152e028eb73..b4c08f4a4cce 100644 --- a/src/test/ui/associated-types/associated-types-incomplete-object.stderr +++ b/src/test/ui/associated-types/associated-types-incomplete-object.stderr @@ -4,8 +4,8 @@ error[E0191]: the value of the associated type `B` (from the trait `Foo`) must b LL | type B; | ------- `B` defined here ... -LL | let b = &42isize as &Foo; - | ^^^^^^^^^^^^ associated type `B` must be specified +LL | let b = &42isize as &dyn Foo; + | ^^^^^^^^^^^^^^^^ associated type `B` must be specified error[E0191]: the value of the associated type `A` (from the trait `Foo`) must be specified --> $DIR/associated-types-incomplete-object.rs:26:26 @@ -13,8 +13,8 @@ error[E0191]: the value of the associated type `A` (from the trait `Foo`) must b LL | type A; | ------- `A` defined here ... -LL | let c = &42isize as &Foo; - | ^^^^^^^^^^^ associated type `A` must be specified +LL | let c = &42isize as &dyn Foo; + | ^^^^^^^^^^^^^^^ associated type `A` must be specified error[E0191]: the value of the associated types `A` (from the trait `Foo`), `B` (from the trait `Foo`) must be specified --> $DIR/associated-types-incomplete-object.rs:29:26 @@ -24,8 +24,8 @@ LL | type A; LL | type B; | ------- `B` defined here ... -LL | let d = &42isize as &Foo; - | ^^^ +LL | let d = &42isize as &dyn Foo; + | ^^^^^^^ | | | associated type `A` must be specified | associated type `B` must be specified diff --git a/src/test/ui/associated-types/associated-types-overridden-binding-2.rs b/src/test/ui/associated-types/associated-types-overridden-binding-2.rs index 7467f3320472..109feb8e969a 100644 --- a/src/test/ui/associated-types/associated-types-overridden-binding-2.rs +++ b/src/test/ui/associated-types/associated-types-overridden-binding-2.rs @@ -3,6 +3,6 @@ trait I32Iterator = Iterator; fn main() { - let _: &I32Iterator = &vec![42].into_iter(); + let _: &dyn I32Iterator = &vec![42].into_iter(); //~^ ERROR type mismatch } diff --git a/src/test/ui/associated-types/associated-types-overridden-binding-2.stderr b/src/test/ui/associated-types/associated-types-overridden-binding-2.stderr index 85724cb7c6e8..aff067c28910 100644 --- a/src/test/ui/associated-types/associated-types-overridden-binding-2.stderr +++ b/src/test/ui/associated-types/associated-types-overridden-binding-2.stderr @@ -1,8 +1,8 @@ error[E0271]: type mismatch resolving ` as std::iter::Iterator>::Item == i32` - --> $DIR/associated-types-overridden-binding-2.rs:6:39 + --> $DIR/associated-types-overridden-binding-2.rs:6:43 | -LL | let _: &I32Iterator = &vec![42].into_iter(); - | ^^^^^^^^^^^^^^^^^^^^^ expected u32, found i32 +LL | let _: &dyn I32Iterator = &vec![42].into_iter(); + | ^^^^^^^^^^^^^^^^^^^^^ expected u32, found i32 | = note: expected type `u32` found type `i32` diff --git a/src/test/ui/associated-types/associated-types-overridden-binding.rs b/src/test/ui/associated-types/associated-types-overridden-binding.rs index ea3a61b2befa..fa1889389fd5 100644 --- a/src/test/ui/associated-types/associated-types-overridden-binding.rs +++ b/src/test/ui/associated-types/associated-types-overridden-binding.rs @@ -7,5 +7,5 @@ trait I32Iterator = Iterator; trait U32Iterator = I32Iterator; fn main() { - let _: &I32Iterator; + let _: &dyn I32Iterator; } diff --git a/src/test/ui/associated-types/bound-lifetime-constrained.object.stderr b/src/test/ui/associated-types/bound-lifetime-constrained.object.stderr index 9258854245c8..36fa06cce4dd 100644 --- a/src/test/ui/associated-types/bound-lifetime-constrained.object.stderr +++ b/src/test/ui/associated-types/bound-lifetime-constrained.object.stderr @@ -1,14 +1,14 @@ error[E0582]: binding for associated type `Output` references lifetime `'a`, which does not appear in the trait input types - --> $DIR/bound-lifetime-constrained.rs:28:56 + --> $DIR/bound-lifetime-constrained.rs:28:60 | -LL | fn object1(_: Box Fn(<() as Foo<'a>>::Item) -> &'a i32>) { - | ^^^^^^^ +LL | fn object1(_: Box Fn(<() as Foo<'a>>::Item) -> &'a i32>) { + | ^^^^^^^ error[E0582]: binding for associated type `Output` references lifetime `'a`, which does not appear in the trait input types - --> $DIR/bound-lifetime-constrained.rs:33:35 + --> $DIR/bound-lifetime-constrained.rs:33:39 | -LL | fn object2(_: Box Fn() -> <() as Foo<'a>>::Item>) { - | ^^^^^^^^^^^^^^^^^^^^^ +LL | fn object2(_: Box Fn() -> <() as Foo<'a>>::Item>) { + | ^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/associated-types/bound-lifetime-constrained.rs b/src/test/ui/associated-types/bound-lifetime-constrained.rs index b590f88b60dc..fb82b3fa6666 100644 --- a/src/test/ui/associated-types/bound-lifetime-constrained.rs +++ b/src/test/ui/associated-types/bound-lifetime-constrained.rs @@ -25,12 +25,12 @@ fn func2(_: for<'a> fn() -> <() as Foo<'a>>::Item) { } #[cfg(object)] -fn object1(_: Box Fn(<() as Foo<'a>>::Item) -> &'a i32>) { +fn object1(_: Box Fn(<() as Foo<'a>>::Item) -> &'a i32>) { //[object]~^ ERROR E0582 } #[cfg(object)] -fn object2(_: Box Fn() -> <() as Foo<'a>>::Item>) { +fn object2(_: Box Fn() -> <() as Foo<'a>>::Item>) { //[object]~^ ERROR E0582 } diff --git a/src/test/ui/associated-types/bound-lifetime-in-binding-only.angle.stderr b/src/test/ui/associated-types/bound-lifetime-in-binding-only.angle.stderr index fee64c0f663b..54f4bb9076b2 100644 --- a/src/test/ui/associated-types/bound-lifetime-in-binding-only.angle.stderr +++ b/src/test/ui/associated-types/bound-lifetime-in-binding-only.angle.stderr @@ -17,10 +17,10 @@ LL | fn angle2() where for<'a> T: Foo { | ^^^^^^^^^^^^ error[E0582]: binding for associated type `Item` references lifetime `'a`, which does not appear in the trait input types - --> $DIR/bound-lifetime-in-binding-only.rs:27:27 + --> $DIR/bound-lifetime-in-binding-only.rs:27:31 | -LL | fn angle3(_: &for<'a> Foo) { - | ^^^^^^^^^^^^ +LL | fn angle3(_: &dyn for<'a> Foo) { + | ^^^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/associated-types/bound-lifetime-in-binding-only.paren.stderr b/src/test/ui/associated-types/bound-lifetime-in-binding-only.paren.stderr index 8c9480027e62..74bc84c222aa 100644 --- a/src/test/ui/associated-types/bound-lifetime-in-binding-only.paren.stderr +++ b/src/test/ui/associated-types/bound-lifetime-in-binding-only.paren.stderr @@ -17,10 +17,10 @@ LL | fn paren2() where for<'a> T: Fn() -> &'a i32 { | ^^^^^^^ error[E0582]: binding for associated type `Output` references lifetime `'a`, which does not appear in the trait input types - --> $DIR/bound-lifetime-in-binding-only.rs:47:31 + --> $DIR/bound-lifetime-in-binding-only.rs:47:35 | -LL | fn paren3(_: &for<'a> Fn() -> &'a i32) { - | ^^^^^^^ +LL | fn paren3(_: &dyn for<'a> Fn() -> &'a i32) { + | ^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/associated-types/bound-lifetime-in-binding-only.rs b/src/test/ui/associated-types/bound-lifetime-in-binding-only.rs index e1989d35bbb8..843f5f061958 100644 --- a/src/test/ui/associated-types/bound-lifetime-in-binding-only.rs +++ b/src/test/ui/associated-types/bound-lifetime-in-binding-only.rs @@ -24,7 +24,7 @@ fn angle2() where for<'a> T: Foo { } #[cfg(angle)] -fn angle3(_: &for<'a> Foo) { +fn angle3(_: &dyn for<'a> Foo) { //[angle]~^ ERROR binding for associated type `Item` references lifetime `'a` } @@ -44,7 +44,7 @@ fn paren2() where for<'a> T: Fn() -> &'a i32 { } #[cfg(paren)] -fn paren3(_: &for<'a> Fn() -> &'a i32) { +fn paren3(_: &dyn for<'a> Fn() -> &'a i32) { //[paren]~^ ERROR binding for associated type `Output` references lifetime `'a` } diff --git a/src/test/ui/associated-types/bound-lifetime-in-return-only.rs b/src/test/ui/associated-types/bound-lifetime-in-return-only.rs index 5a7e086fd476..9c0dc61494d1 100644 --- a/src/test/ui/associated-types/bound-lifetime-in-return-only.rs +++ b/src/test/ui/associated-types/bound-lifetime-in-return-only.rs @@ -38,11 +38,11 @@ fn elision(_: fn() -> &i32) { struct Parameterized<'a> { x: &'a str } #[cfg(ok)] -fn ok1(_: &for<'a> Fn(&Parameterized<'a>) -> &'a i32) { +fn ok1(_: &dyn for<'a> Fn(&Parameterized<'a>) -> &'a i32) { } #[cfg(ok)] -fn ok2(_: &for<'a,'b> Fn<(&'b Parameterized<'a>,), Output=&'a i32>) { +fn ok2(_: &dyn for<'a,'b> Fn<(&'b Parameterized<'a>,), Output=&'a i32>) { } #[rustc_error] diff --git a/src/test/ui/async-await/async-with-closure.rs b/src/test/ui/async-await/async-with-closure.rs index 856a778078a6..e94a5f0853d7 100644 --- a/src/test/ui/async-await/async-with-closure.rs +++ b/src/test/ui/async-await/async-with-closure.rs @@ -19,7 +19,7 @@ struct MyStream { async fn get_future(_stream: MyStream) {} async fn f() { - let messages: MyStream = unimplemented!(); + let messages: MyStream = unimplemented!(); await!(get_future(messages)); } diff --git a/src/test/ui/async-await/issues/issue-53249.rs b/src/test/ui/async-await/issues/issue-53249.rs index 9e4ff43ecd11..2157cf7d4f7a 100644 --- a/src/test/ui/async-await/issues/issue-53249.rs +++ b/src/test/ui/async-await/issues/issue-53249.rs @@ -35,7 +35,7 @@ impl Future for Lazy } async fn __receive(want: WantFn) -> () - where Fut: Future, WantFn: Fn(&Box) -> Fut, + where Fut: Future, WantFn: Fn(&Box) -> Fut, { await!(lazy(|_| ())); } diff --git a/src/test/ui/async-await/issues/issue-54974.rs b/src/test/ui/async-await/issues/issue-54974.rs index d6f18875c9e3..ad18f4118756 100644 --- a/src/test/ui/async-await/issues/issue-54974.rs +++ b/src/test/ui/async-await/issues/issue-54974.rs @@ -9,7 +9,7 @@ trait SomeTrait: Send + Sync + 'static { fn do_something(&self); } -async fn my_task(obj: Arc) { +async fn my_task(obj: Arc) { unimplemented!() } diff --git a/src/test/ui/bad/bad-sized.rs b/src/test/ui/bad/bad-sized.rs index 0da4e456f088..b899c59ff2ea 100644 --- a/src/test/ui/bad/bad-sized.rs +++ b/src/test/ui/bad/bad-sized.rs @@ -1,7 +1,7 @@ trait Trait {} pub fn main() { - let x: Vec = Vec::new(); + let x: Vec = Vec::new(); //~^ ERROR only auto traits can be used as additional traits in a trait object //~| ERROR the size for values of type //~| ERROR the size for values of type diff --git a/src/test/ui/bad/bad-sized.stderr b/src/test/ui/bad/bad-sized.stderr index 6307af5d725d..e9ded557281a 100644 --- a/src/test/ui/bad/bad-sized.stderr +++ b/src/test/ui/bad/bad-sized.stderr @@ -1,29 +1,29 @@ error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/bad-sized.rs:4:24 + --> $DIR/bad-sized.rs:4:28 | -LL | let x: Vec = Vec::new(); - | ----- ^^^^^ - | | | - | | additional non-auto trait - | | trait alias used in trait object type (additional use) - | first non-auto trait - | trait alias used in trait object type (first use) +LL | let x: Vec = Vec::new(); + | ----- ^^^^^ + | | | + | | additional non-auto trait + | | trait alias used in trait object type (additional use) + | first non-auto trait + | trait alias used in trait object type (first use) error[E0277]: the size for values of type `dyn Trait` cannot be known at compilation time --> $DIR/bad-sized.rs:4:12 | -LL | let x: Vec = Vec::new(); - | ^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time +LL | let x: Vec = Vec::new(); + | ^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `dyn Trait` = note: to learn more, visit = note: required by `std::vec::Vec` error[E0277]: the size for values of type `dyn Trait` cannot be known at compilation time - --> $DIR/bad-sized.rs:4:33 + --> $DIR/bad-sized.rs:4:37 | -LL | let x: Vec = Vec::new(); - | ^^^^^^^^ doesn't have a size known at compile-time +LL | let x: Vec = Vec::new(); + | ^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `dyn Trait` = note: to learn more, visit diff --git a/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.rs b/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.rs index 5e853afd38c8..b4d85b60cd5a 100644 --- a/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.rs +++ b/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.rs @@ -8,7 +8,7 @@ trait Foo { fn f2(&mut self); } -fn test(x: &mut Foo) { +fn test(x: &mut dyn Foo) { let y = x.f1(); x.f2(); //~ ERROR cannot borrow `*x` as mutable y.use_ref(); diff --git a/src/test/ui/borrowck/borrowck-consume-upcast-box.rs b/src/test/ui/borrowck/borrowck-consume-upcast-box.rs index ed669c4d9015..6b32d185b6fd 100644 --- a/src/test/ui/borrowck/borrowck-consume-upcast-box.rs +++ b/src/test/ui/borrowck/borrowck-consume-upcast-box.rs @@ -2,10 +2,10 @@ trait Foo { fn dummy(&self); } -fn consume(_: Box) { +fn consume(_: Box) { } -fn foo(b: Box) { +fn foo(b: Box) { consume(b); consume(b); //~ ERROR use of moved value } diff --git a/src/test/ui/borrowck/borrowck-consume-upcast-box.stderr b/src/test/ui/borrowck/borrowck-consume-upcast-box.stderr index e8194ad69440..356cda01e29c 100644 --- a/src/test/ui/borrowck/borrowck-consume-upcast-box.stderr +++ b/src/test/ui/borrowck/borrowck-consume-upcast-box.stderr @@ -1,7 +1,7 @@ error[E0382]: use of moved value: `b` --> $DIR/borrowck-consume-upcast-box.rs:10:13 | -LL | fn foo(b: Box) { +LL | fn foo(b: Box) { | - move occurs because `b` has type `std::boxed::Box`, which does not implement the `Copy` trait LL | consume(b); | - value moved here diff --git a/src/test/ui/borrowck/borrowck-escaping-closure-error-2.rs b/src/test/ui/borrowck/borrowck-escaping-closure-error-2.rs index a44e3031e256..b50d455637b9 100644 --- a/src/test/ui/borrowck/borrowck-escaping-closure-error-2.rs +++ b/src/test/ui/borrowck/borrowck-escaping-closure-error-2.rs @@ -6,7 +6,7 @@ // closure may outlive the current function, but it borrows `books`, // which is owned by the current function -fn foo<'a>(x: &'a i32) -> Box { +fn foo<'a>(x: &'a i32) -> Box { let mut books = vec![1,2,3]; Box::new(|| books.push(4)) //~^ ERROR E0373 diff --git a/src/test/ui/borrowck/borrowck-in-static.rs b/src/test/ui/borrowck/borrowck-in-static.rs index 43bb652a024f..c468740bc3bf 100644 --- a/src/test/ui/borrowck/borrowck-in-static.rs +++ b/src/test/ui/borrowck/borrowck-in-static.rs @@ -1,6 +1,6 @@ // check that borrowck looks inside consts/statics -static FN : &'static (Fn() -> (BoxBox>) + Sync) = &|| { +static FN : &'static (dyn Fn() -> (BoxBox>) + Sync) = &|| { let x = Box::new(0); Box::new(|| x) //~ ERROR cannot move out of captured variable in an `Fn` closure }; diff --git a/src/test/ui/borrowck/borrowck-object-lifetime.rs b/src/test/ui/borrowck/borrowck-object-lifetime.rs index 495516cf9763..137a9adbc40a 100644 --- a/src/test/ui/borrowck/borrowck-object-lifetime.rs +++ b/src/test/ui/borrowck/borrowck-object-lifetime.rs @@ -8,26 +8,26 @@ trait Foo { fn mut_borrowed(&mut self) -> &(); } -fn borrowed_receiver(x: &Foo) { +fn borrowed_receiver(x: &dyn Foo) { let y = x.borrowed(); let z = x.borrowed(); z.use_ref(); y.use_ref(); } -fn mut_borrowed_receiver(x: &mut Foo) { +fn mut_borrowed_receiver(x: &mut dyn Foo) { let y = x.borrowed(); let z = x.mut_borrowed(); //~ ERROR cannot borrow y.use_ref(); } -fn mut_owned_receiver(mut x: Box) { +fn mut_owned_receiver(mut x: Box) { let y = x.borrowed(); let z = &mut x; //~ ERROR cannot borrow y.use_ref(); } -fn imm_owned_receiver(mut x: Box) { +fn imm_owned_receiver(mut x: Box) { let y = x.borrowed(); let z = &x; z.use_ref(); diff --git a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.rs b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.rs index 1e272372f6c9..3ce721618149 100644 --- a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.rs +++ b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.rs @@ -6,5 +6,5 @@ impl Foo for i32 { } fn main() { let x: &i32; - let y = x as *const Foo; //~ ERROR [E0381] + let y = x as *const dyn Foo; //~ ERROR [E0381] } diff --git a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.stderr b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.stderr index df610cbb5618..2b80140c6b37 100644 --- a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.stderr +++ b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.stderr @@ -1,7 +1,7 @@ error[E0381]: borrow of possibly uninitialized variable: `x` --> $DIR/borrowck-use-uninitialized-in-cast-trait.rs:9:13 | -LL | let y = x as *const Foo; +LL | let y = x as *const dyn Foo; | ^ use of possibly uninitialized `*x` error: aborting due to previous error diff --git a/src/test/ui/borrowck/regions-escape-unboxed-closure.rs b/src/test/ui/borrowck/regions-escape-unboxed-closure.rs index 62ddf4decfca..d8bef927fd72 100644 --- a/src/test/ui/borrowck/regions-escape-unboxed-closure.rs +++ b/src/test/ui/borrowck/regions-escape-unboxed-closure.rs @@ -1,4 +1,4 @@ -fn with_int(f: &mut FnMut(&isize)) { +fn with_int(f: &mut dyn FnMut(&isize)) { } fn main() { diff --git a/src/test/ui/borrowck/two-phase-nonrecv-autoref.nll.stderr b/src/test/ui/borrowck/two-phase-nonrecv-autoref.nll.stderr index fca425da34d3..baf122df5e26 100644 --- a/src/test/ui/borrowck/two-phase-nonrecv-autoref.nll.stderr +++ b/src/test/ui/borrowck/two-phase-nonrecv-autoref.nll.stderr @@ -29,7 +29,7 @@ LL | f(f(10)); error[E0382]: use of moved value: `f` --> $DIR/two-phase-nonrecv-autoref.rs:80:11 | -LL | fn twice_ten_oo(f: Box i32>) { +LL | fn twice_ten_oo(f: Box i32>) { | - move occurs because `f` has type `std::boxed::Box i32>`, which does not implement the `Copy` trait LL | f(f(10)); | - ^ value used here after move diff --git a/src/test/ui/borrowck/two-phase-nonrecv-autoref.rs b/src/test/ui/borrowck/two-phase-nonrecv-autoref.rs index c0a117d6766d..b29664e3d8cb 100644 --- a/src/test/ui/borrowck/two-phase-nonrecv-autoref.rs +++ b/src/test/ui/borrowck/two-phase-nonrecv-autoref.rs @@ -68,15 +68,15 @@ fn overloaded_call_traits() { //[g2p]~^^ ERROR use of moved value: `f` } - fn twice_ten_om(f: &mut FnMut(i32) -> i32) { + fn twice_ten_om(f: &mut dyn FnMut(i32) -> i32) { f(f(10)); //[nll]~^ ERROR cannot borrow `*f` as mutable more than once at a time //[g2p]~^^ ERROR cannot borrow `*f` as mutable more than once at a time } - fn twice_ten_oi(f: &mut Fn(i32) -> i32) { + fn twice_ten_oi(f: &mut dyn Fn(i32) -> i32) { f(f(10)); } - fn twice_ten_oo(f: Box i32>) { + fn twice_ten_oo(f: Box i32>) { f(f(10)); //[nll]~^ ERROR use of moved value: `f` //[g2p]~^^ ERROR use of moved value: `f` diff --git a/src/test/ui/bounds-lifetime.rs b/src/test/ui/bounds-lifetime.rs index 8abfe3e4b762..31aa4011b911 100644 --- a/src/test/ui/bounds-lifetime.rs +++ b/src/test/ui/bounds-lifetime.rs @@ -2,6 +2,6 @@ type A = for<'b, 'a: 'b> fn(); //~ ERROR lifetime bounds cannot be used in this type B = for<'b, 'a: 'b,> fn(); //~ ERROR lifetime bounds cannot be used in this context type C = for<'b, 'a: 'b +> fn(); //~ ERROR lifetime bounds cannot be used in this context type D = for<'a, T> fn(); //~ ERROR only lifetime parameters can be used in this context -type E = for Fn(); //~ ERROR only lifetime parameters can be used in this context +type E = dyn for Fn(); //~ ERROR only lifetime parameters can be used in this context fn main() {} diff --git a/src/test/ui/bounds-lifetime.stderr b/src/test/ui/bounds-lifetime.stderr index 21a781462674..a0395ed49045 100644 --- a/src/test/ui/bounds-lifetime.stderr +++ b/src/test/ui/bounds-lifetime.stderr @@ -23,10 +23,10 @@ LL | type D = for<'a, T> fn(); | ^ error: only lifetime parameters can be used in this context - --> $DIR/bounds-lifetime.rs:5:14 + --> $DIR/bounds-lifetime.rs:5:18 | -LL | type E = for Fn(); - | ^ +LL | type E = dyn for Fn(); + | ^ error: aborting due to 5 previous errors diff --git a/src/test/ui/cast/cast-to-unsized-trait-object-suggestion.rs b/src/test/ui/cast/cast-to-unsized-trait-object-suggestion.rs index ac859c512637..5342b595c7c5 100644 --- a/src/test/ui/cast/cast-to-unsized-trait-object-suggestion.rs +++ b/src/test/ui/cast/cast-to-unsized-trait-object-suggestion.rs @@ -1,4 +1,4 @@ fn main() { - &1 as Send; //~ ERROR cast to unsized - Box::new(1) as Send; //~ ERROR cast to unsized + &1 as dyn Send; //~ ERROR cast to unsized + Box::new(1) as dyn Send; //~ ERROR cast to unsized } diff --git a/src/test/ui/cast/cast-to-unsized-trait-object-suggestion.stderr b/src/test/ui/cast/cast-to-unsized-trait-object-suggestion.stderr index bd7a0e1834aa..ffa02533d8b6 100644 --- a/src/test/ui/cast/cast-to-unsized-trait-object-suggestion.stderr +++ b/src/test/ui/cast/cast-to-unsized-trait-object-suggestion.stderr @@ -1,18 +1,18 @@ error[E0620]: cast to unsized type: `&{integer}` as `dyn std::marker::Send` --> $DIR/cast-to-unsized-trait-object-suggestion.rs:2:5 | -LL | &1 as Send; - | ^^^^^^---- +LL | &1 as dyn Send; + | ^^^^^^-------- | | - | help: try casting to a reference instead: `&Send` + | help: try casting to a reference instead: `&dyn Send` error[E0620]: cast to unsized type: `std::boxed::Box<{integer}>` as `dyn std::marker::Send` --> $DIR/cast-to-unsized-trait-object-suggestion.rs:3:5 | -LL | Box::new(1) as Send; - | ^^^^^^^^^^^^^^^---- +LL | Box::new(1) as dyn Send; + | ^^^^^^^^^^^^^^^-------- | | - | help: try casting to a `Box` instead: `Box` + | help: try casting to a `Box` instead: `Box` error: aborting due to 2 previous errors diff --git a/src/test/ui/casts-differing-anon.rs b/src/test/ui/casts-differing-anon.rs index cba178104c99..d4a0f9613055 100644 --- a/src/test/ui/casts-differing-anon.rs +++ b/src/test/ui/casts-differing-anon.rs @@ -5,7 +5,7 @@ fn foo() -> Box { x } fn bar() -> Box { - let y: Box = Box::new([0]); + let y: Box = Box::new([0]); y } diff --git a/src/test/ui/class-cast-to-trait.rs b/src/test/ui/class-cast-to-trait.rs index 3ae4987254fc..bb4c3fac9380 100644 --- a/src/test/ui/class-cast-to-trait.rs +++ b/src/test/ui/class-cast-to-trait.rs @@ -49,6 +49,6 @@ fn cat(in_x : usize, in_y : isize, in_name: String) -> Cat { } fn main() { - let nyan: Box = box cat(0, 2, "nyan".to_string()) as Box; + let nyan: Box = box cat(0, 2, "nyan".to_string()) as Box; nyan.eat(); //~ ERROR no method named `eat` found } diff --git a/src/test/ui/closure_context/issue-26046-fn-mut.rs b/src/test/ui/closure_context/issue-26046-fn-mut.rs index e5840181e41e..0a015ea1436c 100644 --- a/src/test/ui/closure_context/issue-26046-fn-mut.rs +++ b/src/test/ui/closure_context/issue-26046-fn-mut.rs @@ -1,4 +1,4 @@ -fn foo() -> Box { +fn foo() -> Box { let num = 5; let closure = || { //~ ERROR expected a closure that diff --git a/src/test/ui/closure_context/issue-26046-fn-once.rs b/src/test/ui/closure_context/issue-26046-fn-once.rs index d33420c52a03..511690e9dd4b 100644 --- a/src/test/ui/closure_context/issue-26046-fn-once.rs +++ b/src/test/ui/closure_context/issue-26046-fn-once.rs @@ -1,4 +1,4 @@ -fn get_closure() -> Box Vec> { +fn get_closure() -> Box Vec> { let vec = vec![1u8, 2u8]; let closure = move || { //~ ERROR expected a closure diff --git a/src/test/ui/closures/closure-immutable-outer-variable.fixed b/src/test/ui/closures/closure-immutable-outer-variable.fixed index 03240d4857ca..102f1f94a36e 100644 --- a/src/test/ui/closures/closure-immutable-outer-variable.fixed +++ b/src/test/ui/closures/closure-immutable-outer-variable.fixed @@ -2,7 +2,7 @@ // Point at the captured immutable outer variable -fn foo(mut f: Box) { +fn foo(mut f: Box) { f(); } diff --git a/src/test/ui/closures/closure-immutable-outer-variable.rs b/src/test/ui/closures/closure-immutable-outer-variable.rs index 8fa9e44845d5..6eb43b372c96 100644 --- a/src/test/ui/closures/closure-immutable-outer-variable.rs +++ b/src/test/ui/closures/closure-immutable-outer-variable.rs @@ -2,7 +2,7 @@ // Point at the captured immutable outer variable -fn foo(mut f: Box) { +fn foo(mut f: Box) { f(); } diff --git a/src/test/ui/codemap_tests/coherence-overlapping-inherent-impl-trait.rs b/src/test/ui/codemap_tests/coherence-overlapping-inherent-impl-trait.rs index f35fbad7cd6d..414acfd84ce4 100644 --- a/src/test/ui/codemap_tests/coherence-overlapping-inherent-impl-trait.rs +++ b/src/test/ui/codemap_tests/coherence-overlapping-inherent-impl-trait.rs @@ -1,6 +1,6 @@ #![allow(dead_code)] trait C {} -impl C { fn f() {} } //~ ERROR duplicate -impl C { fn f() {} } +impl dyn C { fn f() {} } //~ ERROR duplicate +impl dyn C { fn f() {} } fn main() { } diff --git a/src/test/ui/codemap_tests/coherence-overlapping-inherent-impl-trait.stderr b/src/test/ui/codemap_tests/coherence-overlapping-inherent-impl-trait.stderr index 16cdca774ba3..a97161b131d4 100644 --- a/src/test/ui/codemap_tests/coherence-overlapping-inherent-impl-trait.stderr +++ b/src/test/ui/codemap_tests/coherence-overlapping-inherent-impl-trait.stderr @@ -1,10 +1,10 @@ error[E0592]: duplicate definitions with name `f` - --> $DIR/coherence-overlapping-inherent-impl-trait.rs:4:10 + --> $DIR/coherence-overlapping-inherent-impl-trait.rs:4:14 | -LL | impl C { fn f() {} } - | ^^^^^^^^^ duplicate definitions for `f` -LL | impl C { fn f() {} } - | --------- other definition for `f` +LL | impl dyn C { fn f() {} } + | ^^^^^^^^^ duplicate definitions for `f` +LL | impl dyn C { fn f() {} } + | --------- other definition for `f` error: aborting due to previous error diff --git a/src/test/ui/codemap_tests/two_files_data.rs b/src/test/ui/codemap_tests/two_files_data.rs index db8ab14e6737..b4d2f5d3c6d0 100644 --- a/src/test/ui/codemap_tests/two_files_data.rs +++ b/src/test/ui/codemap_tests/two_files_data.rs @@ -2,4 +2,4 @@ trait Foo { } -type Bar = Foo; +type Bar = dyn Foo; diff --git a/src/test/ui/coercion/coerce-expect-unsized-ascribed.rs b/src/test/ui/coercion/coerce-expect-unsized-ascribed.rs index 9a4e134cb39a..c139e823c2ae 100644 --- a/src/test/ui/coercion/coerce-expect-unsized-ascribed.rs +++ b/src/test/ui/coercion/coerce-expect-unsized-ascribed.rs @@ -10,23 +10,23 @@ pub fn main() { let _ = box if true { [1, 2, 3] } else { [1, 3, 4] }: Box<[i32]>; //~ ERROR mismatched types let _ = box match true { true => [1, 2, 3], false => [1, 3, 4] }: Box<[i32]>; //~^ ERROR mismatched types - let _ = box { |x| (x as u8) }: Box _>; //~ ERROR mismatched types - let _ = box if true { false } else { true }: Box; //~ ERROR mismatched types - let _ = box match true { true => 'a', false => 'b' }: Box; //~ ERROR mismatched types + let _ = box { |x| (x as u8) }: Box _>; //~ ERROR mismatched types + let _ = box if true { false } else { true }: Box; //~ ERROR mismatched types + let _ = box match true { true => 'a', false => 'b' }: Box; //~ ERROR mismatched types let _ = &{ [1, 2, 3] }: &[i32]; //~ ERROR mismatched types let _ = &if true { [1, 2, 3] } else { [1, 3, 4] }: &[i32]; //~ ERROR mismatched types let _ = &match true { true => [1, 2, 3], false => [1, 3, 4] }: &[i32]; //~^ ERROR mismatched types - let _ = &{ |x| (x as u8) }: &Fn(i32) -> _; //~ ERROR mismatched types - let _ = &if true { false } else { true }: &Debug; //~ ERROR mismatched types - let _ = &match true { true => 'a', false => 'b' }: &Debug; //~ ERROR mismatched types + let _ = &{ |x| (x as u8) }: &dyn Fn(i32) -> _; //~ ERROR mismatched types + let _ = &if true { false } else { true }: &dyn Debug; //~ ERROR mismatched types + let _ = &match true { true => 'a', false => 'b' }: &dyn Debug; //~ ERROR mismatched types let _ = Box::new([1, 2, 3]): Box<[i32]>; //~ ERROR mismatched types - let _ = Box::new(|x| (x as u8)): Box _>; //~ ERROR mismatched types + let _ = Box::new(|x| (x as u8)): Box _>; //~ ERROR mismatched types let _ = vec![ Box::new(|x| (x as u8)), box |x| (x as i16 as u8), - ]: Vec _>>; + ]: Vec _>>; } diff --git a/src/test/ui/coercion/coerce-expect-unsized-ascribed.stderr b/src/test/ui/coercion/coerce-expect-unsized-ascribed.stderr index be362c9a78b9..3b81610a06e0 100644 --- a/src/test/ui/coercion/coerce-expect-unsized-ascribed.stderr +++ b/src/test/ui/coercion/coerce-expect-unsized-ascribed.stderr @@ -28,7 +28,7 @@ LL | let _ = box match true { true => [1, 2, 3], false => [1, 3, 4] }: Box<[ error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:13:13 | -LL | let _ = box { |x| (x as u8) }: Box _>; +LL | let _ = box { |x| (x as u8) }: Box _>; | ^^^^^^^^^^^^^^^^^^^^^ expected trait std::ops::Fn, found closure | = note: expected type `std::boxed::Box u8>` @@ -37,7 +37,7 @@ LL | let _ = box { |x| (x as u8) }: Box _>; error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:14:13 | -LL | let _ = box if true { false } else { true }: Box; +LL | let _ = box if true { false } else { true }: Box; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::fmt::Debug, found bool | = note: expected type `std::boxed::Box` @@ -46,7 +46,7 @@ LL | let _ = box if true { false } else { true }: Box; error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:15:13 | -LL | let _ = box match true { true => 'a', false => 'b' }: Box; +LL | let _ = box match true { true => 'a', false => 'b' }: Box; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::fmt::Debug, found char | = note: expected type `std::boxed::Box` @@ -82,7 +82,7 @@ LL | let _ = &match true { true => [1, 2, 3], false => [1, 3, 4] }: &[i32]; error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:21:13 | -LL | let _ = &{ |x| (x as u8) }: &Fn(i32) -> _; +LL | let _ = &{ |x| (x as u8) }: &dyn Fn(i32) -> _; | ^^^^^^^^^^^^^^^^^^ expected trait std::ops::Fn, found closure | = note: expected type `&dyn std::ops::Fn(i32) -> u8` @@ -91,7 +91,7 @@ LL | let _ = &{ |x| (x as u8) }: &Fn(i32) -> _; error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:22:13 | -LL | let _ = &if true { false } else { true }: &Debug; +LL | let _ = &if true { false } else { true }: &dyn Debug; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::fmt::Debug, found bool | = note: expected type `&dyn std::fmt::Debug` @@ -100,7 +100,7 @@ LL | let _ = &if true { false } else { true }: &Debug; error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:23:13 | -LL | let _ = &match true { true => 'a', false => 'b' }: &Debug; +LL | let _ = &match true { true => 'a', false => 'b' }: &dyn Debug; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::fmt::Debug, found char | = note: expected type `&dyn std::fmt::Debug` @@ -118,7 +118,7 @@ LL | let _ = Box::new([1, 2, 3]): Box<[i32]>; error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:26:13 | -LL | let _ = Box::new(|x| (x as u8)): Box _>; +LL | let _ = Box::new(|x| (x as u8)): Box _>; | ^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::ops::Fn, found closure | = note: expected type `std::boxed::Box _>` diff --git a/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.old.stderr b/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.old.stderr index b48f6bbfb941..c38d7456a995 100644 --- a/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.old.stderr +++ b/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.old.stderr @@ -1,7 +1,7 @@ error[E0038]: the trait `NotObjectSafe` cannot be made into an object --> $DIR/coherence-impl-trait-for-trait-object-safe.rs:11:6 | -LL | impl NotObjectSafe for NotObjectSafe { } +LL | impl NotObjectSafe for dyn NotObjectSafe { } | ^^^^^^^^^^^^^ the trait `NotObjectSafe` cannot be made into an object | = note: method `eq` references the `Self` type in its arguments or return type diff --git a/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.re.stderr b/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.re.stderr index b48f6bbfb941..c38d7456a995 100644 --- a/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.re.stderr +++ b/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.re.stderr @@ -1,7 +1,7 @@ error[E0038]: the trait `NotObjectSafe` cannot be made into an object --> $DIR/coherence-impl-trait-for-trait-object-safe.rs:11:6 | -LL | impl NotObjectSafe for NotObjectSafe { } +LL | impl NotObjectSafe for dyn NotObjectSafe { } | ^^^^^^^^^^^^^ the trait `NotObjectSafe` cannot be made into an object | = note: method `eq` references the `Self` type in its arguments or return type diff --git a/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.rs b/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.rs index 803e8fc6bca6..b4c88e937830 100644 --- a/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.rs +++ b/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.rs @@ -8,7 +8,7 @@ // If the trait is not object-safe, we give a more tailored message // because we're such schnuckels: trait NotObjectSafe { fn eq(&self, other: Self); } -impl NotObjectSafe for NotObjectSafe { } +impl NotObjectSafe for dyn NotObjectSafe { } //[old]~^ ERROR E0038 //[re]~^^ ERROR E0038 diff --git a/src/test/ui/coherence/coherence-impl-trait-for-trait.old.stderr b/src/test/ui/coherence/coherence-impl-trait-for-trait.old.stderr index 324747603f91..4819ce9260e7 100644 --- a/src/test/ui/coherence/coherence-impl-trait-for-trait.old.stderr +++ b/src/test/ui/coherence/coherence-impl-trait-for-trait.old.stderr @@ -1,20 +1,20 @@ error[E0371]: the object type `(dyn Baz + 'static)` automatically implements the trait `Foo` --> $DIR/coherence-impl-trait-for-trait.rs:13:1 | -LL | impl Foo for Baz { } - | ^^^^^^^^^^^^^^^^ `(dyn Baz + 'static)` automatically implements trait `Foo` +LL | impl Foo for dyn Baz { } + | ^^^^^^^^^^^^^^^^^^^^ `(dyn Baz + 'static)` automatically implements trait `Foo` error[E0371]: the object type `(dyn Baz + 'static)` automatically implements the trait `Bar` --> $DIR/coherence-impl-trait-for-trait.rs:16:1 | -LL | impl Bar for Baz { } - | ^^^^^^^^^^^^^^^^ `(dyn Baz + 'static)` automatically implements trait `Bar` +LL | impl Bar for dyn Baz { } + | ^^^^^^^^^^^^^^^^^^^^ `(dyn Baz + 'static)` automatically implements trait `Bar` error[E0371]: the object type `(dyn Baz + 'static)` automatically implements the trait `Baz` --> $DIR/coherence-impl-trait-for-trait.rs:19:1 | -LL | impl Baz for Baz { } - | ^^^^^^^^^^^^^^^^ `(dyn Baz + 'static)` automatically implements trait `Baz` +LL | impl Baz for dyn Baz { } + | ^^^^^^^^^^^^^^^^^^^^ `(dyn Baz + 'static)` automatically implements trait `Baz` error: aborting due to 3 previous errors diff --git a/src/test/ui/coherence/coherence-impl-trait-for-trait.re.stderr b/src/test/ui/coherence/coherence-impl-trait-for-trait.re.stderr index 324747603f91..4819ce9260e7 100644 --- a/src/test/ui/coherence/coherence-impl-trait-for-trait.re.stderr +++ b/src/test/ui/coherence/coherence-impl-trait-for-trait.re.stderr @@ -1,20 +1,20 @@ error[E0371]: the object type `(dyn Baz + 'static)` automatically implements the trait `Foo` --> $DIR/coherence-impl-trait-for-trait.rs:13:1 | -LL | impl Foo for Baz { } - | ^^^^^^^^^^^^^^^^ `(dyn Baz + 'static)` automatically implements trait `Foo` +LL | impl Foo for dyn Baz { } + | ^^^^^^^^^^^^^^^^^^^^ `(dyn Baz + 'static)` automatically implements trait `Foo` error[E0371]: the object type `(dyn Baz + 'static)` automatically implements the trait `Bar` --> $DIR/coherence-impl-trait-for-trait.rs:16:1 | -LL | impl Bar for Baz { } - | ^^^^^^^^^^^^^^^^ `(dyn Baz + 'static)` automatically implements trait `Bar` +LL | impl Bar for dyn Baz { } + | ^^^^^^^^^^^^^^^^^^^^ `(dyn Baz + 'static)` automatically implements trait `Bar` error[E0371]: the object type `(dyn Baz + 'static)` automatically implements the trait `Baz` --> $DIR/coherence-impl-trait-for-trait.rs:19:1 | -LL | impl Baz for Baz { } - | ^^^^^^^^^^^^^^^^ `(dyn Baz + 'static)` automatically implements trait `Baz` +LL | impl Baz for dyn Baz { } + | ^^^^^^^^^^^^^^^^^^^^ `(dyn Baz + 'static)` automatically implements trait `Baz` error: aborting due to 3 previous errors diff --git a/src/test/ui/coherence/coherence-impl-trait-for-trait.rs b/src/test/ui/coherence/coherence-impl-trait-for-trait.rs index dcaf564fdecf..3ce3dca0660b 100644 --- a/src/test/ui/coherence/coherence-impl-trait-for-trait.rs +++ b/src/test/ui/coherence/coherence-impl-trait-for-trait.rs @@ -10,18 +10,18 @@ trait Bar: Foo { } trait Baz: Bar { } // Supertraits of Baz are not legal: -impl Foo for Baz { } +impl Foo for dyn Baz { } //[old]~^ ERROR E0371 //[re]~^^ ERROR E0371 -impl Bar for Baz { } +impl Bar for dyn Baz { } //[old]~^ ERROR E0371 //[re]~^^ ERROR E0371 -impl Baz for Baz { } +impl Baz for dyn Baz { } //[old]~^ ERROR E0371 //[re]~^^ ERROR E0371 // But other random traits are: trait Other { } -impl Other for Baz { } // OK, Other not a supertrait of Baz +impl Other for dyn Baz { } // OK, Other not a supertrait of Baz fn main() { } diff --git a/src/test/ui/confuse-field-and-method/issue-2392.rs b/src/test/ui/confuse-field-and-method/issue-2392.rs index c242b6c2c20a..8aef091fe318 100644 --- a/src/test/ui/confuse-field-and-method/issue-2392.rs +++ b/src/test/ui/confuse-field-and-method/issue-2392.rs @@ -14,7 +14,7 @@ struct Obj where F: FnOnce() -> u32 { } struct BoxedObj { - boxed_closure: Box u32>, + boxed_closure: Box u32>, } struct Wrapper where F: FnMut() -> u32 { @@ -25,8 +25,8 @@ fn func() -> u32 { 0 } -fn check_expression() -> Obj u32>> { - Obj { closure: Box::new(|| 42_u32) as Box u32>, not_closure: 42 } +fn check_expression() -> Obj u32>> { + Obj { closure: Box::new(|| 42_u32) as Box u32>, not_closure: 42 } } fn main() { @@ -44,7 +44,7 @@ fn main() { let boxed_fn = BoxedObj { boxed_closure: Box::new(func) }; boxed_fn.boxed_closure();//~ ERROR no method named `boxed_closure` found - let boxed_closure = BoxedObj { boxed_closure: Box::new(|| 42_u32) as Box u32> }; + let boxed_closure = BoxedObj { boxed_closure: Box::new(|| 42_u32) as Box u32> }; boxed_closure.boxed_closure();//~ ERROR no method named `boxed_closure` found // test expression writing in the notes diff --git a/src/test/ui/confuse-field-and-method/issue-32128.rs b/src/test/ui/confuse-field-and-method/issue-32128.rs index 02c6838d4194..5a024aa4b674 100644 --- a/src/test/ui/confuse-field-and-method/issue-32128.rs +++ b/src/test/ui/confuse-field-and-method/issue-32128.rs @@ -1,5 +1,5 @@ struct Example { - example: Box i32> + example: Box i32> } fn main() { diff --git a/src/test/ui/consts/const-eval/const_transmute.rs b/src/test/ui/consts/const-eval/const_transmute.rs index e4f7fb155ab9..4726f9dde3a8 100644 --- a/src/test/ui/consts/const-eval/const_transmute.rs +++ b/src/test/ui/consts/const-eval/const_transmute.rs @@ -41,7 +41,7 @@ struct VTable { bar: for<'a> fn(&'a Foo) -> u32, } -const FOO: &Bar = &Foo { foo: 128, bar: false }; +const FOO: &dyn Bar = &Foo { foo: 128, bar: false }; const G: Fat = unsafe { Transmute { t: FOO }.u }; const F: Option fn(&'a mut Foo)> = G.1.drop; const H: for<'a> fn(&'a Foo) -> u32 = G.1.bar; diff --git a/src/test/ui/consts/const-eval/issue-53401.rs b/src/test/ui/consts/const-eval/issue-53401.rs index 89834aa94fc5..e8ac5a90880c 100644 --- a/src/test/ui/consts/const-eval/issue-53401.rs +++ b/src/test/ui/consts/const-eval/issue-53401.rs @@ -1,6 +1,6 @@ // compile-pass -pub const STATIC_TRAIT: &Test = &(); +pub const STATIC_TRAIT: &dyn Test = &(); fn main() {} diff --git a/src/test/ui/consts/const-eval/ub-upvars.rs b/src/test/ui/consts/const-eval/ub-upvars.rs index 9b7bca6b72d6..0a427cd8857e 100644 --- a/src/test/ui/consts/const-eval/ub-upvars.rs +++ b/src/test/ui/consts/const-eval/ub-upvars.rs @@ -3,7 +3,7 @@ use std::mem; -const BAD_UPVAR: &FnOnce() = &{ //~ ERROR it is undefined behavior to use this value +const BAD_UPVAR: &dyn FnOnce() = &{ //~ ERROR it is undefined behavior to use this value let bad_ref: &'static u16 = unsafe { mem::transmute(0usize) }; let another_var = 13; move || { let _ = bad_ref; let _ = another_var; } diff --git a/src/test/ui/consts/const-eval/ub-upvars.stderr b/src/test/ui/consts/const-eval/ub-upvars.stderr index 21d2847db1e8..f8273ba902a8 100644 --- a/src/test/ui/consts/const-eval/ub-upvars.stderr +++ b/src/test/ui/consts/const-eval/ub-upvars.stderr @@ -1,7 +1,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-upvars.rs:6:1 | -LL | / const BAD_UPVAR: &FnOnce() = &{ +LL | / const BAD_UPVAR: &dyn FnOnce() = &{ LL | | let bad_ref: &'static u16 = unsafe { mem::transmute(0usize) }; LL | | let another_var = 13; LL | | move || { let _ = bad_ref; let _ = another_var; } diff --git a/src/test/ui/consts/const-eval/union-ub-fat-ptr.rs b/src/test/ui/consts/const-eval/union-ub-fat-ptr.rs index 13489c50a122..d5405f3441fe 100644 --- a/src/test/ui/consts/const-eval/union-ub-fat-ptr.rs +++ b/src/test/ui/consts/const-eval/union-ub-fat-ptr.rs @@ -59,7 +59,7 @@ union DynTransmute { repr: DynRepr, repr2: DynRepr2, bad: BadDynRepr, - rust: &'static Trait, + rust: &'static dyn Trait, } trait Trait {} @@ -94,17 +94,17 @@ const C3: &[u8] = unsafe { SliceTransmute { bad: BadSliceRepr { ptr: &42, len: & //~^ ERROR it is undefined behavior to use this value // bad trait object -const D: &Trait = unsafe { DynTransmute { repr: DynRepr { ptr: &92, vtable: &3 } }.rust}; +const D: &dyn Trait = unsafe { DynTransmute { repr: DynRepr { ptr: &92, vtable: &3 } }.rust}; //~^ ERROR it is undefined behavior to use this value // bad trait object -const E: &Trait = unsafe { DynTransmute { repr2: DynRepr2 { ptr: &92, vtable: &3 } }.rust}; +const E: &dyn Trait = unsafe { DynTransmute { repr2: DynRepr2 { ptr: &92, vtable: &3 } }.rust}; //~^ ERROR it is undefined behavior to use this value // bad trait object -const F: &Trait = unsafe { DynTransmute { bad: BadDynRepr { ptr: &92, vtable: 3 } }.rust}; +const F: &dyn Trait = unsafe { DynTransmute { bad: BadDynRepr { ptr: &92, vtable: 3 } }.rust}; //~^ ERROR it is undefined behavior to use this value // bad data *inside* the trait object -const G: &Trait = &unsafe { BoolTransmute { val: 3 }.bl }; +const G: &dyn Trait = &unsafe { BoolTransmute { val: 3 }.bl }; //~^ ERROR it is undefined behavior to use this value // bad data *inside* the slice diff --git a/src/test/ui/consts/const-eval/union-ub-fat-ptr.stderr b/src/test/ui/consts/const-eval/union-ub-fat-ptr.stderr index 761a5fc4445e..5048a97d1951 100644 --- a/src/test/ui/consts/const-eval/union-ub-fat-ptr.stderr +++ b/src/test/ui/consts/const-eval/union-ub-fat-ptr.stderr @@ -41,32 +41,32 @@ LL | const C3: &[u8] = unsafe { SliceTransmute { bad: BadSliceRepr { ptr: &42, l error[E0080]: it is undefined behavior to use this value --> $DIR/union-ub-fat-ptr.rs:97:1 | -LL | const D: &Trait = unsafe { DynTransmute { repr: DynRepr { ptr: &92, vtable: &3 } }.rust}; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered invalid drop fn in vtable +LL | const D: &dyn Trait = unsafe { DynTransmute { repr: DynRepr { ptr: &92, vtable: &3 } }.rust}; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered invalid drop fn in vtable | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior error[E0080]: it is undefined behavior to use this value --> $DIR/union-ub-fat-ptr.rs:100:1 | -LL | const E: &Trait = unsafe { DynTransmute { repr2: DynRepr2 { ptr: &92, vtable: &3 } }.rust}; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered invalid drop fn in vtable +LL | const E: &dyn Trait = unsafe { DynTransmute { repr2: DynRepr2 { ptr: &92, vtable: &3 } }.rust}; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered invalid drop fn in vtable | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior error[E0080]: it is undefined behavior to use this value --> $DIR/union-ub-fat-ptr.rs:103:1 | -LL | const F: &Trait = unsafe { DynTransmute { bad: BadDynRepr { ptr: &92, vtable: 3 } }.rust}; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered non-pointer vtable in fat pointer +LL | const F: &dyn Trait = unsafe { DynTransmute { bad: BadDynRepr { ptr: &92, vtable: 3 } }.rust}; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered non-pointer vtable in fat pointer | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior error[E0080]: it is undefined behavior to use this value --> $DIR/union-ub-fat-ptr.rs:107:1 | -LL | const G: &Trait = &unsafe { BoolTransmute { val: 3 }.bl }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 3 at .., but expected something less or equal to 1 +LL | const G: &dyn Trait = &unsafe { BoolTransmute { val: 3 }.bl }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 3 at .., but expected something less or equal to 1 | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior diff --git a/src/test/ui/consts/const-unsized.rs b/src/test/ui/consts/const-unsized.rs index e20ded68ceb9..319b8ef97dea 100644 --- a/src/test/ui/consts/const-unsized.rs +++ b/src/test/ui/consts/const-unsized.rs @@ -1,12 +1,12 @@ use std::fmt::Debug; -const CONST_0: Debug+Sync = *(&0 as &(Debug+Sync)); +const CONST_0: dyn Debug + Sync = *(&0 as &(dyn Debug + Sync)); //~^ ERROR the size for values of type const CONST_FOO: str = *"foo"; //~^ ERROR the size for values of type -static STATIC_1: Debug+Sync = *(&1 as &(Debug+Sync)); +static STATIC_1: dyn Debug + Sync = *(&1 as &(dyn Debug + Sync)); //~^ ERROR the size for values of type static STATIC_BAR: str = *"bar"; diff --git a/src/test/ui/consts/const-unsized.stderr b/src/test/ui/consts/const-unsized.stderr index 0f996fcd9434..beeea87bfb1d 100644 --- a/src/test/ui/consts/const-unsized.stderr +++ b/src/test/ui/consts/const-unsized.stderr @@ -1,8 +1,8 @@ error[E0277]: the size for values of type `(dyn std::fmt::Debug + std::marker::Sync + 'static)` cannot be known at compilation time --> $DIR/const-unsized.rs:3:16 | -LL | const CONST_0: Debug+Sync = *(&0 as &(Debug+Sync)); - | ^^^^^^^^^^ doesn't have a size known at compile-time +LL | const CONST_0: dyn Debug + Sync = *(&0 as &(dyn Debug + Sync)); + | ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn std::fmt::Debug + std::marker::Sync + 'static)` = note: to learn more, visit @@ -19,8 +19,8 @@ LL | const CONST_FOO: str = *"foo"; error[E0277]: the size for values of type `(dyn std::fmt::Debug + std::marker::Sync + 'static)` cannot be known at compilation time --> $DIR/const-unsized.rs:9:18 | -LL | static STATIC_1: Debug+Sync = *(&1 as &(Debug+Sync)); - | ^^^^^^^^^^ doesn't have a size known at compile-time +LL | static STATIC_1: dyn Debug + Sync = *(&1 as &(dyn Debug + Sync)); + | ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn std::fmt::Debug + std::marker::Sync + 'static)` = note: to learn more, visit diff --git a/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr b/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr index 8d962384a121..7a10c469c51a 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr +++ b/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr @@ -298,8 +298,8 @@ LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() } error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable --> $DIR/min_const_fn.rs:144:41 | -LL | const fn really_no_traits_i_mean_it() { (&() as &std::fmt::Debug, ()).1 } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | const fn really_no_traits_i_mean_it() { (&() as &dyn std::fmt::Debug, ()).1 } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563 = help: add #![feature(const_fn)] to the crate attributes to enable diff --git a/src/test/ui/consts/min_const_fn/min_const_fn.rs b/src/test/ui/consts/min_const_fn/min_const_fn.rs index 783c79005ae3..96b6057c8fd2 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn.rs +++ b/src/test/ui/consts/min_const_fn/min_const_fn.rs @@ -141,7 +141,7 @@ const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() } const fn no_unsafe() { unsafe {} } -const fn really_no_traits_i_mean_it() { (&() as &std::fmt::Debug, ()).1 } +const fn really_no_traits_i_mean_it() { (&() as &dyn std::fmt::Debug, ()).1 } //~^ ERROR trait bounds other than `Sized` const fn no_fn_ptrs(_x: fn()) {} diff --git a/src/test/ui/consts/min_const_fn/min_const_fn.stderr b/src/test/ui/consts/min_const_fn/min_const_fn.stderr index 93b57bc24a82..e388b443d234 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn.stderr +++ b/src/test/ui/consts/min_const_fn/min_const_fn.stderr @@ -302,8 +302,8 @@ LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() } error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable --> $DIR/min_const_fn.rs:144:41 | -LL | const fn really_no_traits_i_mean_it() { (&() as &std::fmt::Debug, ()).1 } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | const fn really_no_traits_i_mean_it() { (&() as &dyn std::fmt::Debug, ()).1 } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563 = help: add #![feature(const_fn)] to the crate attributes to enable diff --git a/src/test/ui/cross/cross-borrow-trait.rs b/src/test/ui/cross/cross-borrow-trait.rs index d8d7537f24a6..274cdad75ec2 100644 --- a/src/test/ui/cross/cross-borrow-trait.rs +++ b/src/test/ui/cross/cross-borrow-trait.rs @@ -6,8 +6,8 @@ trait Trait { fn foo(&self) {} } impl Trait for Foo {} pub fn main() { - let x: Box = Box::new(Foo); - let _y: &Trait = x; //~ ERROR E0308 - //~| expected type `&dyn Trait` - //~| found type `std::boxed::Box` + let x: Box = Box::new(Foo); + let _y: &dyn Trait = x; //~ ERROR E0308 + //~| expected type `&dyn Trait` + //~| found type `std::boxed::Box` } diff --git a/src/test/ui/cross/cross-borrow-trait.stderr b/src/test/ui/cross/cross-borrow-trait.stderr index b35f59658c04..ada1c0204eb0 100644 --- a/src/test/ui/cross/cross-borrow-trait.stderr +++ b/src/test/ui/cross/cross-borrow-trait.stderr @@ -1,11 +1,11 @@ error[E0308]: mismatched types - --> $DIR/cross-borrow-trait.rs:10:22 + --> $DIR/cross-borrow-trait.rs:10:26 | -LL | let _y: &Trait = x; - | ^ - | | - | expected &dyn Trait, found struct `std::boxed::Box` - | help: consider borrowing here: `&x` +LL | let _y: &dyn Trait = x; + | ^ + | | + | expected &dyn Trait, found struct `std::boxed::Box` + | help: consider borrowing here: `&x` | = note: expected type `&dyn Trait` found type `std::boxed::Box` diff --git a/src/test/ui/custom-test-frameworks-simple.rs b/src/test/ui/custom-test-frameworks-simple.rs index a8aac6ec1427..aee0040ef4de 100644 --- a/src/test/ui/custom-test-frameworks-simple.rs +++ b/src/test/ui/custom-test-frameworks-simple.rs @@ -5,7 +5,7 @@ #![test_runner(crate::foo_runner)] #[cfg(test)] -fn foo_runner(ts: &[&Fn(usize)->()]) { +fn foo_runner(ts: &[&dyn Fn(usize)->()]) { for (i, t) in ts.iter().enumerate() { t(i); } diff --git a/src/test/ui/cycle-trait/cycle-trait-default-type-trait.rs b/src/test/ui/cycle-trait/cycle-trait-default-type-trait.rs index d658753eb242..6175b7df1107 100644 --- a/src/test/ui/cycle-trait/cycle-trait-default-type-trait.rs +++ b/src/test/ui/cycle-trait/cycle-trait-default-type-trait.rs @@ -1,7 +1,7 @@ // Test a cycle where a type parameter on a trait has a default that // again references the trait. -trait Foo> { +trait Foo> { //~^ ERROR cycle detected } diff --git a/src/test/ui/cycle-trait/cycle-trait-default-type-trait.stderr b/src/test/ui/cycle-trait/cycle-trait-default-type-trait.stderr index aa45462a52e4..e89d25742a0a 100644 --- a/src/test/ui/cycle-trait/cycle-trait-default-type-trait.stderr +++ b/src/test/ui/cycle-trait/cycle-trait-default-type-trait.stderr @@ -1,15 +1,15 @@ error[E0391]: cycle detected when processing `Foo::X` - --> $DIR/cycle-trait-default-type-trait.rs:4:19 + --> $DIR/cycle-trait-default-type-trait.rs:4:23 | -LL | trait Foo> { - | ^^^ +LL | trait Foo> { + | ^^^ | = note: ...which again requires processing `Foo::X`, completing the cycle note: cycle used when collecting item types in top-level module --> $DIR/cycle-trait-default-type-trait.rs:4:1 | -LL | trait Foo> { - | ^^^^^^^^^^^^^^^^^^^^^^^ +LL | trait Foo> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/destructure-trait-ref.rs b/src/test/ui/destructure-trait-ref.rs index 66be493cb1f9..71cf37ca8495 100644 --- a/src/test/ui/destructure-trait-ref.rs +++ b/src/test/ui/destructure-trait-ref.rs @@ -18,27 +18,28 @@ fn main() { // if n > m, it's a type mismatch error. // n < m - let &x = &(&1isize as &T); - let &x = &&(&1isize as &T); - let &&x = &&(&1isize as &T); + let &x = &(&1isize as &dyn T); + let &x = &&(&1isize as &dyn T); + let &&x = &&(&1isize as &dyn T); // n == m - let &x = &1isize as &T; //~ ERROR type `&dyn T` cannot be dereferenced - let &&x = &(&1isize as &T); //~ ERROR type `&dyn T` cannot be dereferenced - let box x = box 1isize as Box; //~ ERROR type `std::boxed::Box` cannot be dereferenced + let &x = &1isize as &dyn T; //~ ERROR type `&dyn T` cannot be dereferenced + let &&x = &(&1isize as &dyn T); //~ ERROR type `&dyn T` cannot be dereferenced + let box x = box 1isize as Box; + //~^ ERROR type `std::boxed::Box` cannot be dereferenced // n > m - let &&x = &1isize as &T; + let &&x = &1isize as &dyn T; //~^ ERROR mismatched types //~| expected type `dyn T` //~| found type `&_` //~| expected trait T, found reference - let &&&x = &(&1isize as &T); + let &&&x = &(&1isize as &dyn T); //~^ ERROR mismatched types //~| expected type `dyn T` //~| found type `&_` //~| expected trait T, found reference - let box box x = box 1isize as Box; + let box box x = box 1isize as Box; //~^ ERROR mismatched types //~| expected type `dyn T` //~| found type `std::boxed::Box<_>` diff --git a/src/test/ui/destructure-trait-ref.stderr b/src/test/ui/destructure-trait-ref.stderr index bc3013b78b38..d3ad21eb24ff 100644 --- a/src/test/ui/destructure-trait-ref.stderr +++ b/src/test/ui/destructure-trait-ref.stderr @@ -1,25 +1,25 @@ error[E0033]: type `&dyn T` cannot be dereferenced --> $DIR/destructure-trait-ref.rs:26:9 | -LL | let &x = &1isize as &T; +LL | let &x = &1isize as &dyn T; | ^^ type `&dyn T` cannot be dereferenced error[E0033]: type `&dyn T` cannot be dereferenced --> $DIR/destructure-trait-ref.rs:27:10 | -LL | let &&x = &(&1isize as &T); +LL | let &&x = &(&1isize as &dyn T); | ^^ type `&dyn T` cannot be dereferenced error[E0033]: type `std::boxed::Box` cannot be dereferenced --> $DIR/destructure-trait-ref.rs:28:9 | -LL | let box x = box 1isize as Box; +LL | let box x = box 1isize as Box; | ^^^^^ type `std::boxed::Box` cannot be dereferenced error[E0308]: mismatched types - --> $DIR/destructure-trait-ref.rs:31:10 + --> $DIR/destructure-trait-ref.rs:32:10 | -LL | let &&x = &1isize as &T; +LL | let &&x = &1isize as &dyn T; | ^^ | | | expected trait T, found reference @@ -29,9 +29,9 @@ LL | let &&x = &1isize as &T; found type `&_` error[E0308]: mismatched types - --> $DIR/destructure-trait-ref.rs:36:11 + --> $DIR/destructure-trait-ref.rs:37:11 | -LL | let &&&x = &(&1isize as &T); +LL | let &&&x = &(&1isize as &dyn T); | ^^ | | | expected trait T, found reference @@ -41,9 +41,9 @@ LL | let &&&x = &(&1isize as &T); found type `&_` error[E0308]: mismatched types - --> $DIR/destructure-trait-ref.rs:41:13 + --> $DIR/destructure-trait-ref.rs:42:13 | -LL | let box box x = box 1isize as Box; +LL | let box box x = box 1isize as Box; | ^^^^^ expected trait T, found struct `std::boxed::Box` | = note: expected type `dyn T` diff --git a/src/test/ui/did_you_mean/E0178.rs b/src/test/ui/did_you_mean/E0178.rs index aad95dc2c20e..095df640c38f 100644 --- a/src/test/ui/did_you_mean/E0178.rs +++ b/src/test/ui/did_you_mean/E0178.rs @@ -1,3 +1,5 @@ +#![allow(bare_trait_objects)] + trait Foo {} struct Bar<'a> { diff --git a/src/test/ui/did_you_mean/E0178.stderr b/src/test/ui/did_you_mean/E0178.stderr index 44e6ddd0eac8..58ac6e90823f 100644 --- a/src/test/ui/did_you_mean/E0178.stderr +++ b/src/test/ui/did_you_mean/E0178.stderr @@ -1,23 +1,23 @@ error[E0178]: expected a path on the left-hand side of `+`, not `&'a Foo` - --> $DIR/E0178.rs:4:8 + --> $DIR/E0178.rs:6:8 | LL | w: &'a Foo + Copy, | ^^^^^^^^^^^^^^ help: try adding parentheses: `&'a (Foo + Copy)` error[E0178]: expected a path on the left-hand side of `+`, not `&'a Foo` - --> $DIR/E0178.rs:5:8 + --> $DIR/E0178.rs:7:8 | LL | x: &'a Foo + 'a, | ^^^^^^^^^^^^ help: try adding parentheses: `&'a (Foo + 'a)` error[E0178]: expected a path on the left-hand side of `+`, not `&'a mut Foo` - --> $DIR/E0178.rs:6:8 + --> $DIR/E0178.rs:8:8 | LL | y: &'a mut Foo + 'a, | ^^^^^^^^^^^^^^^^ help: try adding parentheses: `&'a mut (Foo + 'a)` error[E0178]: expected a path on the left-hand side of `+`, not `fn() -> Foo` - --> $DIR/E0178.rs:7:8 + --> $DIR/E0178.rs:9:8 | LL | z: fn() -> Foo + 'a, | ^^^^^^^^^^^^^^^^ perhaps you forgot parentheses? diff --git a/src/test/ui/did_you_mean/bad-assoc-ty.rs b/src/test/ui/did_you_mean/bad-assoc-ty.rs index 85e36f887be0..fccfb7911cec 100644 --- a/src/test/ui/did_you_mean/bad-assoc-ty.rs +++ b/src/test/ui/did_you_mean/bad-assoc-ty.rs @@ -24,7 +24,7 @@ type F = &'static (u8)::AssocTy; // Qualified paths cannot appear in bounds, so the recovery // should apply to the whole sum and not `(Send)`. -type G = 'static + (Send)::AssocTy; +type G = dyn 'static + (Send)::AssocTy; //~^ ERROR missing angle brackets in associated item path //~| ERROR ambiguous associated type diff --git a/src/test/ui/did_you_mean/bad-assoc-ty.stderr b/src/test/ui/did_you_mean/bad-assoc-ty.stderr index 8c694f9d42b3..0ae64edcc054 100644 --- a/src/test/ui/did_you_mean/bad-assoc-ty.stderr +++ b/src/test/ui/did_you_mean/bad-assoc-ty.stderr @@ -37,8 +37,8 @@ LL | type F = &'static (u8)::AssocTy; error: missing angle brackets in associated item path --> $DIR/bad-assoc-ty.rs:27:10 | -LL | type G = 'static + (Send)::AssocTy; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `<'static + (Send)>::AssocTy` +LL | type G = dyn 'static + (Send)::AssocTy; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `::AssocTy` error: missing angle brackets in associated item path --> $DIR/bad-assoc-ty.rs:44:10 @@ -94,8 +94,8 @@ LL | type F = &'static (u8)::AssocTy; error[E0223]: ambiguous associated type --> $DIR/bad-assoc-ty.rs:27:10 | -LL | type G = 'static + (Send)::AssocTy; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use fully-qualified syntax: `<(dyn std::marker::Send + 'static) as Trait>::AssocTy` +LL | type G = dyn 'static + (Send)::AssocTy; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use fully-qualified syntax: `<(dyn std::marker::Send + 'static) as Trait>::AssocTy` error[E0223]: ambiguous associated type --> $DIR/bad-assoc-ty.rs:33:10 diff --git a/src/test/ui/did_you_mean/issue-40006.rs b/src/test/ui/did_you_mean/issue-40006.rs index 75ea02b6a9d4..a1184f757e2a 100644 --- a/src/test/ui/did_you_mean/issue-40006.rs +++ b/src/test/ui/did_you_mean/issue-40006.rs @@ -1,4 +1,4 @@ -impl X { //~ ERROR cannot be made into an object +impl dyn X { //~ ERROR cannot be made into an object //~^ ERROR missing Y } diff --git a/src/test/ui/did_you_mean/issue-40006.stderr b/src/test/ui/did_you_mean/issue-40006.stderr index f6f7fe5fa38c..87e48cd1e1cd 100644 --- a/src/test/ui/did_you_mean/issue-40006.stderr +++ b/src/test/ui/did_you_mean/issue-40006.stderr @@ -1,8 +1,8 @@ error: missing `fn`, `type`, or `const` for impl-item declaration - --> $DIR/issue-40006.rs:1:9 + --> $DIR/issue-40006.rs:1:13 | -LL | impl X { - | _________^ +LL | impl dyn X { + | _____________^ LL | | LL | | Y | |____^ missing `fn`, `type`, or `const` @@ -59,8 +59,8 @@ LL | pub hello_method(&self) { error[E0038]: the trait `X` cannot be made into an object --> $DIR/issue-40006.rs:1:6 | -LL | impl X { - | ^ the trait `X` cannot be made into an object +LL | impl dyn X { + | ^^^^^ the trait `X` cannot be made into an object | = note: method `xxx` has no receiver diff --git a/src/test/ui/did_you_mean/trait-object-reference-without-parens-suggestion.rs b/src/test/ui/did_you_mean/trait-object-reference-without-parens-suggestion.rs index a05227416cfd..c9a097d3610a 100644 --- a/src/test/ui/did_you_mean/trait-object-reference-without-parens-suggestion.rs +++ b/src/test/ui/did_you_mean/trait-object-reference-without-parens-suggestion.rs @@ -1,3 +1,5 @@ +#![allow(bare_trait_objects)] + fn main() { let _: &Copy + 'static; //~ ERROR expected a path //~^ ERROR cannot be made into an object diff --git a/src/test/ui/did_you_mean/trait-object-reference-without-parens-suggestion.stderr b/src/test/ui/did_you_mean/trait-object-reference-without-parens-suggestion.stderr index de1efcd7e0f7..8c6c33b11865 100644 --- a/src/test/ui/did_you_mean/trait-object-reference-without-parens-suggestion.stderr +++ b/src/test/ui/did_you_mean/trait-object-reference-without-parens-suggestion.stderr @@ -1,17 +1,17 @@ error[E0178]: expected a path on the left-hand side of `+`, not `&Copy` - --> $DIR/trait-object-reference-without-parens-suggestion.rs:2:12 + --> $DIR/trait-object-reference-without-parens-suggestion.rs:4:12 | LL | let _: &Copy + 'static; | ^^^^^^^^^^^^^^^ help: try adding parentheses: `&(Copy + 'static)` error[E0178]: expected a path on the left-hand side of `+`, not `&'static Copy` - --> $DIR/trait-object-reference-without-parens-suggestion.rs:4:12 + --> $DIR/trait-object-reference-without-parens-suggestion.rs:6:12 | LL | let _: &'static Copy + 'static; | ^^^^^^^^^^^^^^^^^^^^^^^ help: try adding parentheses: `&'static (Copy + 'static)` error[E0038]: the trait `std::marker::Copy` cannot be made into an object - --> $DIR/trait-object-reference-without-parens-suggestion.rs:2:12 + --> $DIR/trait-object-reference-without-parens-suggestion.rs:4:12 | LL | let _: &Copy + 'static; | ^^^^^ the trait `std::marker::Copy` cannot be made into an object diff --git a/src/test/ui/dropck/dropck_trait_cycle_checked.rs b/src/test/ui/dropck/dropck_trait_cycle_checked.rs index 128bbb04ee0e..bea77dc9f5c4 100644 --- a/src/test/ui/dropck/dropck_trait_cycle_checked.rs +++ b/src/test/ui/dropck/dropck_trait_cycle_checked.rs @@ -63,14 +63,14 @@ impl Drop for CheckId { } trait Obj<'a> : HasId { - fn set0(&self, b: &'a Box>); - fn set1(&self, b: &'a Box>); + fn set0(&self, b: &'a Box>); + fn set1(&self, b: &'a Box>); } struct O<'a> { id: Id, - obj0: CheckId>>>>, - obj1: CheckId>>>>, + obj0: CheckId>>>>, + obj1: CheckId>>>>, } impl<'a> HasId for O<'a> { @@ -87,7 +87,7 @@ impl<'a> O<'a> { } } -impl<'a> HasId for Cell>>> { +impl<'a> HasId for Cell>>> { fn count(&self) -> usize { match self.get() { None => 1, @@ -97,17 +97,17 @@ impl<'a> HasId for Cell>>> { } impl<'a> Obj<'a> for O<'a> { - fn set0(&self, b: &'a Box>) { + fn set0(&self, b: &'a Box>) { self.obj0.v.set(Some(b)) } - fn set1(&self, b: &'a Box>) { + fn set1(&self, b: &'a Box>) { self.obj1.v.set(Some(b)) } } fn f() { - let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); + let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); o1.set0(&o2); //~ ERROR `o2` does not live long enough o1.set1(&o3); //~ ERROR `o3` does not live long enough o2.set0(&o2); //~ ERROR `o2` does not live long enough diff --git a/src/test/ui/dropck/dropck_trait_cycle_checked.stderr b/src/test/ui/dropck/dropck_trait_cycle_checked.stderr index 8c669b597c3c..1e779208e58a 100644 --- a/src/test/ui/dropck/dropck_trait_cycle_checked.stderr +++ b/src/test/ui/dropck/dropck_trait_cycle_checked.stderr @@ -1,8 +1,8 @@ error[E0597]: `o2` does not live long enough --> $DIR/dropck_trait_cycle_checked.rs:111:13 | -LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); - | -------- cast requires that `o2` is borrowed for `'static` +LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); + | -------- cast requires that `o2` is borrowed for `'static` LL | o1.set0(&o2); | ^^^ borrowed value does not live long enough ... @@ -12,8 +12,8 @@ LL | } error[E0597]: `o3` does not live long enough --> $DIR/dropck_trait_cycle_checked.rs:112:13 | -LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); - | -------- cast requires that `o3` is borrowed for `'static` +LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); + | -------- cast requires that `o3` is borrowed for `'static` LL | o1.set0(&o2); LL | o1.set1(&o3); | ^^^ borrowed value does not live long enough @@ -24,8 +24,8 @@ LL | } error[E0597]: `o2` does not live long enough --> $DIR/dropck_trait_cycle_checked.rs:113:13 | -LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); - | -------- cast requires that `o2` is borrowed for `'static` +LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); + | -------- cast requires that `o2` is borrowed for `'static` ... LL | o2.set0(&o2); | ^^^ borrowed value does not live long enough @@ -36,8 +36,8 @@ LL | } error[E0597]: `o3` does not live long enough --> $DIR/dropck_trait_cycle_checked.rs:114:13 | -LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); - | -------- cast requires that `o3` is borrowed for `'static` +LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); + | -------- cast requires that `o3` is borrowed for `'static` ... LL | o2.set1(&o3); | ^^^ borrowed value does not live long enough @@ -48,8 +48,8 @@ LL | } error[E0597]: `o1` does not live long enough --> $DIR/dropck_trait_cycle_checked.rs:115:13 | -LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); - | -------- cast requires that `o1` is borrowed for `'static` +LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); + | -------- cast requires that `o1` is borrowed for `'static` ... LL | o3.set0(&o1); | ^^^ borrowed value does not live long enough @@ -60,8 +60,8 @@ LL | } error[E0597]: `o2` does not live long enough --> $DIR/dropck_trait_cycle_checked.rs:116:13 | -LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); - | -------- cast requires that `o2` is borrowed for `'static` +LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); + | -------- cast requires that `o2` is borrowed for `'static` ... LL | o3.set1(&o2); | ^^^ borrowed value does not live long enough diff --git a/src/test/ui/dst/dst-bad-assign-2.rs b/src/test/ui/dst/dst-bad-assign-2.rs index b4f72d034f5c..7ba31bf2e517 100644 --- a/src/test/ui/dst/dst-bad-assign-2.rs +++ b/src/test/ui/dst/dst-bad-assign-2.rs @@ -30,8 +30,8 @@ impl ToBar for Bar1 { pub fn main() { // Assignment. - let f5: &mut Fat = &mut Fat { f1: 5, f2: "some str", ptr: Bar1 {f :42} }; - let z: Box = Box::new(Bar1 {f: 36}); + let f5: &mut Fat = &mut Fat { f1: 5, f2: "some str", ptr: Bar1 {f :42} }; + let z: Box = Box::new(Bar1 {f: 36}); f5.ptr = *z; //~^ ERROR the size for values of type diff --git a/src/test/ui/dst/dst-bad-assign-3.rs b/src/test/ui/dst/dst-bad-assign-3.rs index 5124abc7d822..691909a23174 100644 --- a/src/test/ui/dst/dst-bad-assign-3.rs +++ b/src/test/ui/dst/dst-bad-assign-3.rs @@ -28,8 +28,8 @@ impl ToBar for Bar1 { pub fn main() { // Assignment. - let f5: &mut Fat = &mut (5, "some str", Bar1 {f :42}); - let z: Box = Box::new(Bar1 {f: 36}); + let f5: &mut Fat = &mut (5, "some str", Bar1 {f :42}); + let z: Box = Box::new(Bar1 {f: 36}); f5.2 = Bar1 {f: 36}; //~^ ERROR mismatched types //~| expected type `dyn ToBar` diff --git a/src/test/ui/dst/dst-bad-assign.rs b/src/test/ui/dst/dst-bad-assign.rs index 003c80b4dc42..4f2648653f05 100644 --- a/src/test/ui/dst/dst-bad-assign.rs +++ b/src/test/ui/dst/dst-bad-assign.rs @@ -30,8 +30,8 @@ impl ToBar for Bar1 { pub fn main() { // Assignment. - let f5: &mut Fat = &mut Fat { f1: 5, f2: "some str", ptr: Bar1 {f :42} }; - let z: Box = Box::new(Bar1 {f: 36}); + let f5: &mut Fat = &mut Fat { f1: 5, f2: "some str", ptr: Bar1 {f :42} }; + let z: Box = Box::new(Bar1 {f: 36}); f5.ptr = Bar1 {f: 36}; //~^ ERROR mismatched types //~| expected type `dyn ToBar` diff --git a/src/test/ui/dst/dst-bad-coerce1.rs b/src/test/ui/dst/dst-bad-coerce1.rs index 8ca34234c031..7ef237e39e36 100644 --- a/src/test/ui/dst/dst-bad-coerce1.rs +++ b/src/test/ui/dst/dst-bad-coerce1.rs @@ -19,7 +19,7 @@ pub fn main() { // With a trait. let f1 = Fat { ptr: Foo }; let f2: &Fat = &f1; - let f3: &Fat = f2; + let f3: &Fat = f2; //~^ ERROR `Foo: Bar` is not satisfied // Tuple with a vec of isize. @@ -31,6 +31,6 @@ pub fn main() { // Tuple with a trait. let f1 = (Foo,); let f2: &(Foo,) = &f1; - let f3: &(Bar,) = f2; + let f3: &(dyn Bar,) = f2; //~^ ERROR `Foo: Bar` is not satisfied } diff --git a/src/test/ui/dst/dst-bad-coerce1.stderr b/src/test/ui/dst/dst-bad-coerce1.stderr index 3776ce71c611..a48f37b20be9 100644 --- a/src/test/ui/dst/dst-bad-coerce1.stderr +++ b/src/test/ui/dst/dst-bad-coerce1.stderr @@ -8,10 +8,10 @@ LL | let f3: &Fat<[usize]> = f2; found type `&Fat<[isize; 3]>` error[E0277]: the trait bound `Foo: Bar` is not satisfied - --> $DIR/dst-bad-coerce1.rs:22:25 + --> $DIR/dst-bad-coerce1.rs:22:29 | -LL | let f3: &Fat = f2; - | ^^ the trait `Bar` is not implemented for `Foo` +LL | let f3: &Fat = f2; + | ^^ the trait `Bar` is not implemented for `Foo` | = note: required for the cast to the object type `dyn Bar` @@ -25,10 +25,10 @@ LL | let f3: &([usize],) = f2; found type `&([isize; 3],)` error[E0277]: the trait bound `Foo: Bar` is not satisfied - --> $DIR/dst-bad-coerce1.rs:34:23 + --> $DIR/dst-bad-coerce1.rs:34:27 | -LL | let f3: &(Bar,) = f2; - | ^^ the trait `Bar` is not implemented for `Foo` +LL | let f3: &(dyn Bar,) = f2; + | ^^ the trait `Bar` is not implemented for `Foo` | = note: required for the cast to the object type `dyn Bar` diff --git a/src/test/ui/dst/dst-bad-coerce2.rs b/src/test/ui/dst/dst-bad-coerce2.rs index 2bc7ecced0aa..e7ce20b89587 100644 --- a/src/test/ui/dst/dst-bad-coerce2.rs +++ b/src/test/ui/dst/dst-bad-coerce2.rs @@ -17,7 +17,7 @@ pub fn main() { // With a trait. let f1 = Fat { ptr: Foo }; let f2: &Fat = &f1; - let f3: &mut Fat = f2; //~ ERROR mismatched types + let f3: &mut Fat = f2; //~ ERROR mismatched types // Tuple with a vec of ints. let f1 = ([1, 2, 3],); @@ -27,5 +27,5 @@ pub fn main() { // Tuple with a trait. let f1 = (Foo,); let f2: &(Foo,) = &f1; - let f3: &mut (Bar,) = f2; //~ ERROR mismatched types + let f3: &mut (dyn Bar,) = f2; //~ ERROR mismatched types } diff --git a/src/test/ui/dst/dst-bad-coerce2.stderr b/src/test/ui/dst/dst-bad-coerce2.stderr index cae4ec51c37c..d1da9b6ca074 100644 --- a/src/test/ui/dst/dst-bad-coerce2.stderr +++ b/src/test/ui/dst/dst-bad-coerce2.stderr @@ -8,10 +8,10 @@ LL | let f3: &mut Fat<[isize]> = f2; found type `&Fat<[isize; 3]>` error[E0308]: mismatched types - --> $DIR/dst-bad-coerce2.rs:20:29 + --> $DIR/dst-bad-coerce2.rs:20:33 | -LL | let f3: &mut Fat = f2; - | ^^ types differ in mutability +LL | let f3: &mut Fat = f2; + | ^^ types differ in mutability | = note: expected type `&mut Fat` found type `&Fat` @@ -26,10 +26,10 @@ LL | let f3: &mut ([isize],) = f2; found type `&([isize; 3],)` error[E0308]: mismatched types - --> $DIR/dst-bad-coerce2.rs:30:27 + --> $DIR/dst-bad-coerce2.rs:30:31 | -LL | let f3: &mut (Bar,) = f2; - | ^^ types differ in mutability +LL | let f3: &mut (dyn Bar,) = f2; + | ^^ types differ in mutability | = note: expected type `&mut (dyn Bar,)` found type `&(Foo,)` diff --git a/src/test/ui/dst/dst-bad-coerce3.rs b/src/test/ui/dst/dst-bad-coerce3.rs index 58c988520eb0..fd5ee3b57bb4 100644 --- a/src/test/ui/dst/dst-bad-coerce3.rs +++ b/src/test/ui/dst/dst-bad-coerce3.rs @@ -19,7 +19,7 @@ fn baz<'a>() { // With a trait. let f1 = Fat { ptr: Foo }; let f2: &Fat = &f1; //~ ERROR `f1` does not live long enough - let f3: &'a Fat = f2; + let f3: &'a Fat = f2; // Tuple with a vec of ints. let f1 = ([1, 2, 3],); @@ -29,7 +29,7 @@ fn baz<'a>() { // Tuple with a trait. let f1 = (Foo,); let f2: &(Foo,) = &f1; //~ ERROR `f1` does not live long enough - let f3: &'a (Bar,) = f2; + let f3: &'a (dyn Bar,) = f2; } pub fn main() { diff --git a/src/test/ui/dst/dst-bad-coerce3.stderr b/src/test/ui/dst/dst-bad-coerce3.stderr index 289d451f02a7..957e98bbeee9 100644 --- a/src/test/ui/dst/dst-bad-coerce3.stderr +++ b/src/test/ui/dst/dst-bad-coerce3.stderr @@ -20,8 +20,8 @@ LL | fn baz<'a>() { ... LL | let f2: &Fat = &f1; | ^^^ borrowed value does not live long enough -LL | let f3: &'a Fat = f2; - | ------------ type annotation requires that `f1` is borrowed for `'a` +LL | let f3: &'a Fat = f2; + | ---------------- type annotation requires that `f1` is borrowed for `'a` ... LL | } | - `f1` dropped here while still borrowed @@ -48,8 +48,8 @@ LL | fn baz<'a>() { ... LL | let f2: &(Foo,) = &f1; | ^^^ borrowed value does not live long enough -LL | let f3: &'a (Bar,) = f2; - | ---------- type annotation requires that `f1` is borrowed for `'a` +LL | let f3: &'a (dyn Bar,) = f2; + | -------------- type annotation requires that `f1` is borrowed for `'a` LL | } | - `f1` dropped here while still borrowed diff --git a/src/test/ui/dst/dst-bad-coercions.rs b/src/test/ui/dst/dst-bad-coercions.rs index 9aa697225d5b..bffef378c921 100644 --- a/src/test/ui/dst/dst-bad-coercions.rs +++ b/src/test/ui/dst/dst-bad-coercions.rs @@ -12,15 +12,15 @@ pub fn main() { // Test that we cannot convert from *-ptr to &S and &T let x: *const S = &S; let y: &S = x; //~ ERROR mismatched types - let y: &T = x; //~ ERROR mismatched types + let y: &dyn T = x; //~ ERROR mismatched types // Test that we cannot convert from *-ptr to &S and &T (mut version) let x: *mut S = &mut S; let y: &S = x; //~ ERROR mismatched types - let y: &T = x; //~ ERROR mismatched types + let y: &dyn T = x; //~ ERROR mismatched types // Test that we cannot convert an immutable ptr to a mutable one using *-ptrs - let x: &mut T = &S; //~ ERROR mismatched types - let x: *mut T = &S; //~ ERROR mismatched types + let x: &mut dyn T = &S; //~ ERROR mismatched types + let x: *mut dyn T = &S; //~ ERROR mismatched types let x: *mut S = &S; //~ ERROR mismatched types } diff --git a/src/test/ui/dst/dst-bad-coercions.stderr b/src/test/ui/dst/dst-bad-coercions.stderr index 27016829a07f..e4bc6ee0010a 100644 --- a/src/test/ui/dst/dst-bad-coercions.stderr +++ b/src/test/ui/dst/dst-bad-coercions.stderr @@ -8,13 +8,13 @@ LL | let y: &S = x; found type `*const S` error[E0308]: mismatched types - --> $DIR/dst-bad-coercions.rs:15:17 + --> $DIR/dst-bad-coercions.rs:15:21 | -LL | let y: &T = x; - | ^ - | | - | expected &dyn T, found *-ptr - | help: consider borrowing here: `&x` +LL | let y: &dyn T = x; + | ^ + | | + | expected &dyn T, found *-ptr + | help: consider borrowing here: `&x` | = note: expected type `&dyn T` found type `*const S` @@ -29,31 +29,31 @@ LL | let y: &S = x; found type `*mut S` error[E0308]: mismatched types - --> $DIR/dst-bad-coercions.rs:20:17 + --> $DIR/dst-bad-coercions.rs:20:21 | -LL | let y: &T = x; - | ^ - | | - | expected &dyn T, found *-ptr - | help: consider borrowing here: `&x` +LL | let y: &dyn T = x; + | ^ + | | + | expected &dyn T, found *-ptr + | help: consider borrowing here: `&x` | = note: expected type `&dyn T` found type `*mut S` error[E0308]: mismatched types - --> $DIR/dst-bad-coercions.rs:23:21 + --> $DIR/dst-bad-coercions.rs:23:25 | -LL | let x: &mut T = &S; - | ^^ types differ in mutability +LL | let x: &mut dyn T = &S; + | ^^ types differ in mutability | = note: expected type `&mut dyn T` found type `&S` error[E0308]: mismatched types - --> $DIR/dst-bad-coercions.rs:24:21 + --> $DIR/dst-bad-coercions.rs:24:25 | -LL | let x: *mut T = &S; - | ^^ types differ in mutability +LL | let x: *mut dyn T = &S; + | ^^ types differ in mutability | = note: expected type `*mut dyn T` found type `&S` diff --git a/src/test/ui/dst/dst-index.rs b/src/test/ui/dst/dst-index.rs index 71ff067bbd9d..fced3144eb85 100644 --- a/src/test/ui/dst/dst-index.rs +++ b/src/test/ui/dst/dst-index.rs @@ -19,9 +19,9 @@ impl Index for S { struct T; impl Index for T { - type Output = Debug + 'static; + type Output = dyn Debug + 'static; - fn index<'a>(&'a self, idx: usize) -> &'a (Debug + 'static) { + fn index<'a>(&'a self, idx: usize) -> &'a (dyn Debug + 'static) { static x: usize = 42; &x } diff --git a/src/test/ui/dst/dst-object-from-unsized-type.rs b/src/test/ui/dst/dst-object-from-unsized-type.rs index f4ee1783a2e3..3cd5b1ed6f46 100644 --- a/src/test/ui/dst/dst-object-from-unsized-type.rs +++ b/src/test/ui/dst/dst-object-from-unsized-type.rs @@ -5,22 +5,22 @@ impl Foo for str {} impl Foo for [u8] {} fn test1(t: &T) { - let u: &Foo = t; + let u: &dyn Foo = t; //~^ ERROR the size for values of type } fn test2(t: &T) { - let v: &Foo = t as &Foo; + let v: &dyn Foo = t as &dyn Foo; //~^ ERROR the size for values of type } fn test3() { - let _: &[&Foo] = &["hi"]; + let _: &[&dyn Foo] = &["hi"]; //~^ ERROR the size for values of type } fn test4(x: &[u8]) { - let _: &Foo = x as &Foo; + let _: &dyn Foo = x as &dyn Foo; //~^ ERROR the size for values of type } diff --git a/src/test/ui/dst/dst-object-from-unsized-type.stderr b/src/test/ui/dst/dst-object-from-unsized-type.stderr index 4851ca108285..55ac625fc985 100644 --- a/src/test/ui/dst/dst-object-from-unsized-type.stderr +++ b/src/test/ui/dst/dst-object-from-unsized-type.stderr @@ -1,8 +1,8 @@ error[E0277]: the size for values of type `T` cannot be known at compilation time - --> $DIR/dst-object-from-unsized-type.rs:8:19 + --> $DIR/dst-object-from-unsized-type.rs:8:23 | -LL | let u: &Foo = t; - | ^ doesn't have a size known at compile-time +LL | let u: &dyn Foo = t; + | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `T` = note: to learn more, visit @@ -10,10 +10,10 @@ LL | let u: &Foo = t; = note: required for the cast to the object type `dyn Foo` error[E0277]: the size for values of type `T` cannot be known at compilation time - --> $DIR/dst-object-from-unsized-type.rs:13:19 + --> $DIR/dst-object-from-unsized-type.rs:13:23 | -LL | let v: &Foo = t as &Foo; - | ^ doesn't have a size known at compile-time +LL | let v: &dyn Foo = t as &dyn Foo; + | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `T` = note: to learn more, visit @@ -21,20 +21,20 @@ LL | let v: &Foo = t as &Foo; = note: required for the cast to the object type `dyn Foo` error[E0277]: the size for values of type `str` cannot be known at compilation time - --> $DIR/dst-object-from-unsized-type.rs:18:24 + --> $DIR/dst-object-from-unsized-type.rs:18:28 | -LL | let _: &[&Foo] = &["hi"]; - | ^^^^ doesn't have a size known at compile-time +LL | let _: &[&dyn Foo] = &["hi"]; + | ^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` = note: to learn more, visit = note: required for the cast to the object type `dyn Foo` error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> $DIR/dst-object-from-unsized-type.rs:23:19 + --> $DIR/dst-object-from-unsized-type.rs:23:23 | -LL | let _: &Foo = x as &Foo; - | ^ doesn't have a size known at compile-time +LL | let _: &dyn Foo = x as &dyn Foo; + | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[u8]` = note: to learn more, visit diff --git a/src/test/ui/elide-errors-on-mismatched-tuple.rs b/src/test/ui/elide-errors-on-mismatched-tuple.rs index e68358fd978b..7d87b0a7756b 100644 --- a/src/test/ui/elide-errors-on-mismatched-tuple.rs +++ b/src/test/ui/elide-errors-on-mismatched-tuple.rs @@ -13,6 +13,6 @@ impl A { fn main() { let (a, b, c) = (A::new(), A::new()); // This tuple is 2 elements, should be three //~^ ERROR mismatched types - let ts: Vec<&T> = vec![&a, &b, &c]; + let ts: Vec<&dyn T> = vec![&a, &b, &c]; // There is no E0277 error above, as `a`, `b` and `c` are `TyErr` } diff --git a/src/test/ui/error-codes/E0033-teach.rs b/src/test/ui/error-codes/E0033-teach.rs index 0f0b8d864dc4..6a27b07fa8b7 100644 --- a/src/test/ui/error-codes/E0033-teach.rs +++ b/src/test/ui/error-codes/E0033-teach.rs @@ -5,7 +5,7 @@ trait SomeTrait { } fn main() { - let trait_obj: &SomeTrait = SomeTrait; + let trait_obj: &dyn SomeTrait = SomeTrait; //~^ ERROR expected value, found trait `SomeTrait` //~| ERROR E0038 //~| method `foo` has no receiver diff --git a/src/test/ui/error-codes/E0033-teach.stderr b/src/test/ui/error-codes/E0033-teach.stderr index 1b78820cae07..fb630de7fc14 100644 --- a/src/test/ui/error-codes/E0033-teach.stderr +++ b/src/test/ui/error-codes/E0033-teach.stderr @@ -1,14 +1,14 @@ error[E0423]: expected value, found trait `SomeTrait` - --> $DIR/E0033-teach.rs:8:33 + --> $DIR/E0033-teach.rs:8:37 | -LL | let trait_obj: &SomeTrait = SomeTrait; - | ^^^^^^^^^ not a value +LL | let trait_obj: &dyn SomeTrait = SomeTrait; + | ^^^^^^^^^ not a value error[E0038]: the trait `SomeTrait` cannot be made into an object --> $DIR/E0033-teach.rs:8:20 | -LL | let trait_obj: &SomeTrait = SomeTrait; - | ^^^^^^^^^^ the trait `SomeTrait` cannot be made into an object +LL | let trait_obj: &dyn SomeTrait = SomeTrait; + | ^^^^^^^^^^^^^^ the trait `SomeTrait` cannot be made into an object | = note: method `foo` has no receiver diff --git a/src/test/ui/error-codes/E0033.rs b/src/test/ui/error-codes/E0033.rs index 5a4f3cbce60e..582600e110ba 100644 --- a/src/test/ui/error-codes/E0033.rs +++ b/src/test/ui/error-codes/E0033.rs @@ -3,7 +3,7 @@ trait SomeTrait { } fn main() { - let trait_obj: &SomeTrait = SomeTrait; + let trait_obj: &dyn SomeTrait = SomeTrait; //~^ ERROR expected value, found trait `SomeTrait` //~| ERROR E0038 //~| method `foo` has no receiver diff --git a/src/test/ui/error-codes/E0033.stderr b/src/test/ui/error-codes/E0033.stderr index 976b0e0286fa..fe9f45d86a6a 100644 --- a/src/test/ui/error-codes/E0033.stderr +++ b/src/test/ui/error-codes/E0033.stderr @@ -1,14 +1,14 @@ error[E0423]: expected value, found trait `SomeTrait` - --> $DIR/E0033.rs:6:33 + --> $DIR/E0033.rs:6:37 | -LL | let trait_obj: &SomeTrait = SomeTrait; - | ^^^^^^^^^ not a value +LL | let trait_obj: &dyn SomeTrait = SomeTrait; + | ^^^^^^^^^ not a value error[E0038]: the trait `SomeTrait` cannot be made into an object --> $DIR/E0033.rs:6:20 | -LL | let trait_obj: &SomeTrait = SomeTrait; - | ^^^^^^^^^^ the trait `SomeTrait` cannot be made into an object +LL | let trait_obj: &dyn SomeTrait = SomeTrait; + | ^^^^^^^^^^^^^^ the trait `SomeTrait` cannot be made into an object | = note: method `foo` has no receiver diff --git a/src/test/ui/error-codes/E0038.rs b/src/test/ui/error-codes/E0038.rs index b2226803da7f..9757e2ab10c7 100644 --- a/src/test/ui/error-codes/E0038.rs +++ b/src/test/ui/error-codes/E0038.rs @@ -2,7 +2,7 @@ trait Trait { fn foo(&self) -> Self; } -fn call_foo(x: Box) { +fn call_foo(x: Box) { //~^ ERROR E0038 let y = x.foo(); } diff --git a/src/test/ui/error-codes/E0038.stderr b/src/test/ui/error-codes/E0038.stderr index 74b77338c85c..e3d7593e42a7 100644 --- a/src/test/ui/error-codes/E0038.stderr +++ b/src/test/ui/error-codes/E0038.stderr @@ -1,8 +1,8 @@ error[E0038]: the trait `Trait` cannot be made into an object --> $DIR/E0038.rs:5:1 | -LL | fn call_foo(x: Box) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` cannot be made into an object +LL | fn call_foo(x: Box) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` cannot be made into an object | = note: method `foo` references the `Self` type in its arguments or return type diff --git a/src/test/ui/error-codes/E0120.rs b/src/test/ui/error-codes/E0120.rs index 049707415e50..287a4088183f 100644 --- a/src/test/ui/error-codes/E0120.rs +++ b/src/test/ui/error-codes/E0120.rs @@ -1,6 +1,6 @@ trait MyTrait { fn foo() {} } -impl Drop for MyTrait { +impl Drop for dyn MyTrait { //~^ ERROR E0120 fn drop(&mut self) {} } diff --git a/src/test/ui/error-codes/E0120.stderr b/src/test/ui/error-codes/E0120.stderr index 9b6603dbaca9..68ca7d800d5c 100644 --- a/src/test/ui/error-codes/E0120.stderr +++ b/src/test/ui/error-codes/E0120.stderr @@ -1,8 +1,8 @@ error[E0120]: the Drop trait may only be implemented on structures --> $DIR/E0120.rs:3:15 | -LL | impl Drop for MyTrait { - | ^^^^^^^ implementing Drop requires a struct +LL | impl Drop for dyn MyTrait { + | ^^^^^^^^^^^ implementing Drop requires a struct error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0191.rs b/src/test/ui/error-codes/E0191.rs index 356110671e71..22f739b9e76c 100644 --- a/src/test/ui/error-codes/E0191.rs +++ b/src/test/ui/error-codes/E0191.rs @@ -2,6 +2,6 @@ trait Trait { type Bar; } -type Foo = Trait; //~ ERROR E0191 +type Foo = dyn Trait; //~ ERROR E0191 fn main() {} diff --git a/src/test/ui/error-codes/E0191.stderr b/src/test/ui/error-codes/E0191.stderr index 2d9fdfe5d29c..92fa85bca0ef 100644 --- a/src/test/ui/error-codes/E0191.stderr +++ b/src/test/ui/error-codes/E0191.stderr @@ -4,8 +4,8 @@ error[E0191]: the value of the associated type `Bar` (from the trait `Trait`) mu LL | type Bar; | --------- `Bar` defined here ... -LL | type Foo = Trait; - | ^^^^^ associated type `Bar` must be specified +LL | type Foo = dyn Trait; + | ^^^^^^^^^ associated type `Bar` must be specified error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0220.rs b/src/test/ui/error-codes/E0220.rs index f4798042538d..e11a570df79d 100644 --- a/src/test/ui/error-codes/E0220.rs +++ b/src/test/ui/error-codes/E0220.rs @@ -2,7 +2,7 @@ trait Trait { type Bar; } -type Foo = Trait; //~ ERROR E0220 - //~| ERROR E0191 +type Foo = dyn Trait; //~ ERROR E0220 + //~| ERROR E0191 fn main() { } diff --git a/src/test/ui/error-codes/E0220.stderr b/src/test/ui/error-codes/E0220.stderr index bd2205fb7527..5da302748cda 100644 --- a/src/test/ui/error-codes/E0220.stderr +++ b/src/test/ui/error-codes/E0220.stderr @@ -1,8 +1,8 @@ error[E0220]: associated type `F` not found for `Trait` - --> $DIR/E0220.rs:5:18 + --> $DIR/E0220.rs:5:22 | -LL | type Foo = Trait; - | ^^^^^ associated type `F` not found +LL | type Foo = dyn Trait; + | ^^^^^ associated type `F` not found error[E0191]: the value of the associated type `Bar` (from the trait `Trait`) must be specified --> $DIR/E0220.rs:5:12 @@ -10,8 +10,8 @@ error[E0191]: the value of the associated type `Bar` (from the trait `Trait`) mu LL | type Bar; | --------- `Bar` defined here ... -LL | type Foo = Trait; - | ^^^^^^^^^^^^ associated type `Bar` must be specified +LL | type Foo = dyn Trait; + | ^^^^^^^^^^^^^^^^ associated type `Bar` must be specified error: aborting due to 2 previous errors diff --git a/src/test/ui/error-codes/E0393.rs b/src/test/ui/error-codes/E0393.rs index bdd4deafc838..0c1a369806d8 100644 --- a/src/test/ui/error-codes/E0393.rs +++ b/src/test/ui/error-codes/E0393.rs @@ -1,6 +1,6 @@ trait A {} -fn together_we_will_rule_the_galaxy(son: &A) {} +fn together_we_will_rule_the_galaxy(son: &dyn A) {} //~^ ERROR E0393 fn main() { diff --git a/src/test/ui/error-codes/E0393.stderr b/src/test/ui/error-codes/E0393.stderr index bf564ef10210..543e3213633c 100644 --- a/src/test/ui/error-codes/E0393.stderr +++ b/src/test/ui/error-codes/E0393.stderr @@ -1,8 +1,8 @@ error[E0393]: the type parameter `T` must be explicitly specified - --> $DIR/E0393.rs:3:43 + --> $DIR/E0393.rs:3:47 | -LL | fn together_we_will_rule_the_galaxy(son: &A) {} - | ^ missing reference to `T` +LL | fn together_we_will_rule_the_galaxy(son: &dyn A) {} + | ^ missing reference to `T` | = note: because of the default `Self` reference, type parameters must be specified on object types diff --git a/src/test/ui/error-codes/E0478.rs b/src/test/ui/error-codes/E0478.rs index 1b5ca09d5a6c..b1562dc0a8ba 100644 --- a/src/test/ui/error-codes/E0478.rs +++ b/src/test/ui/error-codes/E0478.rs @@ -1,7 +1,7 @@ trait Wedding<'t>: 't { } struct Prince<'kiss, 'SnowWhite> { - child: Box + 'SnowWhite>, //~ ERROR E0478 + child: Box + 'SnowWhite>, //~ ERROR E0478 } fn main() { diff --git a/src/test/ui/error-codes/E0478.stderr b/src/test/ui/error-codes/E0478.stderr index 71e490364d7a..587125fdc336 100644 --- a/src/test/ui/error-codes/E0478.stderr +++ b/src/test/ui/error-codes/E0478.stderr @@ -1,8 +1,8 @@ error[E0478]: lifetime bound not satisfied --> $DIR/E0478.rs:4:5 | -LL | child: Box + 'SnowWhite>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | child: Box + 'SnowWhite>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: lifetime parameter instantiated with the lifetime 'SnowWhite as defined on the struct at 3:22 --> $DIR/E0478.rs:3:22 diff --git a/src/test/ui/error-codes/E0719.rs b/src/test/ui/error-codes/E0719.rs index 6b572f49cee8..3311e190937c 100644 --- a/src/test/ui/error-codes/E0719.rs +++ b/src/test/ui/error-codes/E0719.rs @@ -3,12 +3,12 @@ trait Foo: Iterator {} type Unit = (); -fn test() -> Box> { +fn test() -> Box> { //~^ ERROR is already specified Box::new(None.into_iter()) } fn main() { - let _: &Iterator; + let _: &dyn Iterator; test(); } diff --git a/src/test/ui/error-codes/E0719.stderr b/src/test/ui/error-codes/E0719.stderr index 5854cd7e1438..c5b9a71c6599 100644 --- a/src/test/ui/error-codes/E0719.stderr +++ b/src/test/ui/error-codes/E0719.stderr @@ -7,12 +7,12 @@ LL | trait Foo: Iterator {} | `Item` bound here first error[E0719]: the value of the associated type `Item` (from the trait `std::iter::Iterator`) is already specified - --> $DIR/E0719.rs:6:38 + --> $DIR/E0719.rs:6:42 | -LL | fn test() -> Box> { - | --------- ^^^^^^^^^^^ re-bound here - | | - | `Item` bound here first +LL | fn test() -> Box> { + | --------- ^^^^^^^^^^^ re-bound here + | | + | `Item` bound here first error: aborting due to 2 previous errors diff --git a/src/test/ui/fat-ptr-cast.rs b/src/test/ui/fat-ptr-cast.rs index eb419ba2036a..a0fad583a164 100644 --- a/src/test/ui/fat-ptr-cast.rs +++ b/src/test/ui/fat-ptr-cast.rs @@ -19,6 +19,6 @@ fn main() { q as *const [i32]; //~ ERROR cannot cast // #21397 - let t: *mut (Trait + 'static) = 0 as *mut _; //~ ERROR casting + let t: *mut (dyn Trait + 'static) = 0 as *mut _; //~ ERROR casting let mut fail: *const str = 0 as *const str; //~ ERROR casting } diff --git a/src/test/ui/fat-ptr-cast.stderr b/src/test/ui/fat-ptr-cast.stderr index bb7a4d3ff7f6..93e1471838f7 100644 --- a/src/test/ui/fat-ptr-cast.stderr +++ b/src/test/ui/fat-ptr-cast.stderr @@ -53,10 +53,10 @@ LL | q as *const [i32]; | ^^^^^^^^^^^^^^^^^ error[E0606]: casting `usize` as `*mut (dyn Trait + 'static)` is invalid - --> $DIR/fat-ptr-cast.rs:22:37 + --> $DIR/fat-ptr-cast.rs:22:41 | -LL | let t: *mut (Trait + 'static) = 0 as *mut _; - | ^^^^^^^^^^^ +LL | let t: *mut (dyn Trait + 'static) = 0 as *mut _; + | ^^^^^^^^^^^ error[E0606]: casting `usize` as `*const str` is invalid --> $DIR/fat-ptr-cast.rs:23:32 diff --git a/src/test/ui/feature-gates/feature-gate-trivial_bounds.rs b/src/test/ui/feature-gates/feature-gate-trivial_bounds.rs index e5028f2f8aa7..3dbaf5dea250 100644 --- a/src/test/ui/feature-gates/feature-gate-trivial_bounds.rs +++ b/src/test/ui/feature-gates/feature-gate-trivial_bounds.rs @@ -52,8 +52,8 @@ struct Dst { struct TwoStrs(str, str) where str: Sized; //~ ERROR -fn unsized_local() where Dst: Sized { //~ ERROR - let x: Dst = *(Box::new(Dst { x: 1 }) as Box>); +fn unsized_local() where Dst: Sized { //~ ERROR + let x: Dst = *(Box::new(Dst { x: 1 }) as Box>); } fn return_str() -> str where str: Sized { //~ ERROR diff --git a/src/test/ui/feature-gates/feature-gate-trivial_bounds.stderr b/src/test/ui/feature-gates/feature-gate-trivial_bounds.stderr index b04a6e4d671b..1d346fd42ffa 100644 --- a/src/test/ui/feature-gates/feature-gate-trivial_bounds.stderr +++ b/src/test/ui/feature-gates/feature-gate-trivial_bounds.stderr @@ -102,8 +102,8 @@ LL | struct TwoStrs(str, str) where str: Sized; error[E0277]: the size for values of type `(dyn A + 'static)` cannot be known at compilation time --> $DIR/feature-gate-trivial_bounds.rs:55:1 | -LL | / fn unsized_local() where Dst: Sized { -LL | | let x: Dst = *(Box::new(Dst { x: 1 }) as Box>); +LL | / fn unsized_local() where Dst: Sized { +LL | | let x: Dst = *(Box::new(Dst { x: 1 }) as Box>); LL | | } | |_^ doesn't have a size known at compile-time | diff --git a/src/test/ui/feature-gates/feature-gate-unsized_locals.rs b/src/test/ui/feature-gates/feature-gate-unsized_locals.rs index a8f81f3f113c..3686e7b37f4c 100644 --- a/src/test/ui/feature-gates/feature-gate-unsized_locals.rs +++ b/src/test/ui/feature-gates/feature-gate-unsized_locals.rs @@ -1,4 +1,4 @@ -fn f(f: FnOnce()) {} +fn f(f: dyn FnOnce()) {} //~^ ERROR E0277 fn main() { diff --git a/src/test/ui/feature-gates/feature-gate-unsized_locals.stderr b/src/test/ui/feature-gates/feature-gate-unsized_locals.stderr index bde39cbeaeb2..d20b9e2981e8 100644 --- a/src/test/ui/feature-gates/feature-gate-unsized_locals.stderr +++ b/src/test/ui/feature-gates/feature-gate-unsized_locals.stderr @@ -1,7 +1,7 @@ error[E0277]: the size for values of type `(dyn std::ops::FnOnce() + 'static)` cannot be known at compilation time --> $DIR/feature-gate-unsized_locals.rs:1:6 | -LL | fn f(f: FnOnce()) {} +LL | fn f(f: dyn FnOnce()) {} | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn std::ops::FnOnce() + 'static)` diff --git a/src/test/ui/feature-gates/feature-gate-unsized_tuple_coercion.rs b/src/test/ui/feature-gates/feature-gate-unsized_tuple_coercion.rs index f781bc9aeddd..c3d62a231e5e 100644 --- a/src/test/ui/feature-gates/feature-gate-unsized_tuple_coercion.rs +++ b/src/test/ui/feature-gates/feature-gate-unsized_tuple_coercion.rs @@ -1,4 +1,4 @@ fn main() { - let _ : &(Send,) = &((),); + let _ : &(dyn Send,) = &((),); //~^ ERROR unsized tuple coercion is not stable enough } diff --git a/src/test/ui/feature-gates/feature-gate-unsized_tuple_coercion.stderr b/src/test/ui/feature-gates/feature-gate-unsized_tuple_coercion.stderr index 669e87ceadaf..5b93c889db1c 100644 --- a/src/test/ui/feature-gates/feature-gate-unsized_tuple_coercion.stderr +++ b/src/test/ui/feature-gates/feature-gate-unsized_tuple_coercion.stderr @@ -1,8 +1,8 @@ error[E0658]: unsized tuple coercion is not stable enough for use and is subject to change - --> $DIR/feature-gate-unsized_tuple_coercion.rs:2:24 + --> $DIR/feature-gate-unsized_tuple_coercion.rs:2:28 | -LL | let _ : &(Send,) = &((),); - | ^^^^^^ +LL | let _ : &(dyn Send,) = &((),); + | ^^^^^^ | = note: for more information, see https://github.com/rust-lang/rust/issues/42877 = help: add #![feature(unsized_tuple_coercion)] to the crate attributes to enable diff --git a/src/test/ui/fn/fn-trait-formatting.rs b/src/test/ui/fn/fn-trait-formatting.rs index 21da39dd4004..5c16c1a7e88b 100644 --- a/src/test/ui/fn/fn-trait-formatting.rs +++ b/src/test/ui/fn/fn-trait-formatting.rs @@ -3,15 +3,15 @@ fn needs_fn(x: F) where F: Fn(isize) -> isize {} fn main() { - let _: () = (box |_: isize| {}) as Box; + let _: () = (box |_: isize| {}) as Box; //~^ ERROR mismatched types //~| expected type `()` //~| found type `std::boxed::Box` - let _: () = (box |_: isize, isize| {}) as Box; + let _: () = (box |_: isize, isize| {}) as Box; //~^ ERROR mismatched types //~| expected type `()` //~| found type `std::boxed::Box` - let _: () = (box || -> isize { unimplemented!() }) as Box isize>; + let _: () = (box || -> isize { unimplemented!() }) as Box isize>; //~^ ERROR mismatched types //~| expected type `()` //~| found type `std::boxed::Box isize>` diff --git a/src/test/ui/fn/fn-trait-formatting.stderr b/src/test/ui/fn/fn-trait-formatting.stderr index 6b76a6c914f0..504bc2605ec3 100644 --- a/src/test/ui/fn/fn-trait-formatting.stderr +++ b/src/test/ui/fn/fn-trait-formatting.stderr @@ -1,8 +1,8 @@ error[E0308]: mismatched types --> $DIR/fn-trait-formatting.rs:6:17 | -LL | let _: () = (box |_: isize| {}) as Box; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found struct `std::boxed::Box` +LL | let _: () = (box |_: isize| {}) as Box; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found struct `std::boxed::Box` | = note: expected type `()` found type `std::boxed::Box` @@ -10,8 +10,8 @@ LL | let _: () = (box |_: isize| {}) as Box; error[E0308]: mismatched types --> $DIR/fn-trait-formatting.rs:10:17 | -LL | let _: () = (box |_: isize, isize| {}) as Box; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found struct `std::boxed::Box` +LL | let _: () = (box |_: isize, isize| {}) as Box; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found struct `std::boxed::Box` | = note: expected type `()` found type `std::boxed::Box` @@ -19,8 +19,8 @@ LL | let _: () = (box |_: isize, isize| {}) as Box; error[E0308]: mismatched types --> $DIR/fn-trait-formatting.rs:14:17 | -LL | let _: () = (box || -> isize { unimplemented!() }) as Box isize>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found struct `std::boxed::Box` +LL | let _: () = (box || -> isize { unimplemented!() }) as Box isize>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found struct `std::boxed::Box` | = note: expected type `()` found type `std::boxed::Box isize>` diff --git a/src/test/ui/higher-lifetime-bounds.rs b/src/test/ui/higher-lifetime-bounds.rs index 546f4d436633..f3393347d90d 100644 --- a/src/test/ui/higher-lifetime-bounds.rs +++ b/src/test/ui/higher-lifetime-bounds.rs @@ -58,12 +58,12 @@ struct S3(F) where for<'xa, 'xb: 'xa> F: Fn(&'xa i32, &'xb i32) -> &'xa i32; struct S_fnty(for<'xa, 'xb: 'xa> fn(&'xa i32, &'xb i32) -> &'xa i32); //~^ ERROR lifetime bounds cannot be used in this context -type T1 = Box Fn(&'xa i32, &'xb i32) -> &'xa i32>; +type T1 = Box Fn(&'xa i32, &'xb i32) -> &'xa i32>; //~^ ERROR lifetime bounds cannot be used in this context fn main() { let _ : Option fn(&'xa i32, &'xb i32) -> &'xa i32> = None; //~^ ERROR lifetime bounds cannot be used in this context - let _ : Option Fn(&'xa i32, &'xb i32) -> &'xa i32>> = None; + let _ : Option Fn(&'xa i32, &'xb i32) -> &'xa i32>> = None; //~^ ERROR lifetime bounds cannot be used in this context } diff --git a/src/test/ui/higher-lifetime-bounds.stderr b/src/test/ui/higher-lifetime-bounds.stderr index 431a89f5eb81..bc6d2288cdfc 100644 --- a/src/test/ui/higher-lifetime-bounds.stderr +++ b/src/test/ui/higher-lifetime-bounds.stderr @@ -47,10 +47,10 @@ LL | struct S_fnty(for<'xa, 'xb: 'xa> fn(&'xa i32, &'xb i32) -> &'xa i32); | ^^^ error: lifetime bounds cannot be used in this context - --> $DIR/higher-lifetime-bounds.rs:61:29 + --> $DIR/higher-lifetime-bounds.rs:61:33 | -LL | type T1 = Box Fn(&'xa i32, &'xb i32) -> &'xa i32>; - | ^^^ +LL | type T1 = Box Fn(&'xa i32, &'xb i32) -> &'xa i32>; + | ^^^ error: lifetime bounds cannot be used in this context --> $DIR/higher-lifetime-bounds.rs:65:34 @@ -59,10 +59,10 @@ LL | let _ : Option fn(&'xa i32, &'xb i32) -> &'xa i32> = | ^^^ error: lifetime bounds cannot be used in this context - --> $DIR/higher-lifetime-bounds.rs:67:38 + --> $DIR/higher-lifetime-bounds.rs:67:42 | -LL | let _ : Option Fn(&'xa i32, &'xb i32) -> &'xa i32>> = None; - | ^^^ +LL | let _ : Option Fn(&'xa i32, &'xb i32) -> &'xa i32>> = None; + | ^^^ error: aborting due to 11 previous errors diff --git a/src/test/ui/imports/extern-crate-used.rs b/src/test/ui/imports/extern-crate-used.rs index 26150c7d4a16..8198c1816a14 100644 --- a/src/test/ui/imports/extern-crate-used.rs +++ b/src/test/ui/imports/extern-crate-used.rs @@ -20,13 +20,13 @@ extern crate core; //~ ERROR unused extern crate mod m { use iso1::any as are_you_okay1; use ::iso2::any as are_you_okay2; - type AreYouOkay1 = iso3::any::Any; - type AreYouOkay2 = ::iso4::any::Any; + type AreYouOkay1 = dyn iso3::any::Any; + type AreYouOkay2 = dyn (::iso4::any::Any); use core::any as are_you_okay3; use ::core::any as are_you_okay4; - type AreYouOkay3 = core::any::Any; - type AreYouOkay4 = ::core::any::Any; + type AreYouOkay3 = dyn core::any::Any; + type AreYouOkay4 = dyn (::core::any::Any); } fn main() {} diff --git a/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.rs b/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.rs index d4535ac44253..d131a944721d 100644 --- a/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.rs +++ b/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.rs @@ -4,8 +4,8 @@ trait Trait {} struct Struct; impl Deref for Struct { - type Target = Trait; - fn deref(&self) -> &Trait { + type Target = dyn Trait; + fn deref(&self) -> &dyn Trait { unimplemented!(); } } diff --git a/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.stderr b/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.stderr index e56a56e2dae2..b50a926c6379 100644 --- a/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.stderr +++ b/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.stderr @@ -1,13 +1,13 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter in generic type due to conflicting requirements --> $DIR/mismatched_trait_impl-2.rs:8:5 | -LL | fn deref(&self) -> &Trait { - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn deref(&self) -> &dyn Trait { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the method body at 8:5... --> $DIR/mismatched_trait_impl-2.rs:8:5 | -LL | / fn deref(&self) -> &Trait { +LL | / fn deref(&self) -> &dyn Trait { LL | | unimplemented!(); LL | | } | |_____^ diff --git a/src/test/ui/issues/issue-10291.nll.stderr b/src/test/ui/issues/issue-10291.nll.stderr index 45f29fd79565..a7b827d27a87 100644 --- a/src/test/ui/issues/issue-10291.nll.stderr +++ b/src/test/ui/issues/issue-10291.nll.stderr @@ -3,7 +3,7 @@ error: lifetime may not live long enough | LL | fn test<'x>(x: &'x isize) { | -- lifetime `'x` defined here -LL | drop:: FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { +LL | drop:: FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { LL | x | ^ returning this value requires that `'x` must outlive `'static` diff --git a/src/test/ui/issues/issue-10291.rs b/src/test/ui/issues/issue-10291.rs index 877b0aba4739..559c5fcac954 100644 --- a/src/test/ui/issues/issue-10291.rs +++ b/src/test/ui/issues/issue-10291.rs @@ -1,5 +1,5 @@ fn test<'x>(x: &'x isize) { - drop:: FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { + drop:: FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { x //~ ERROR E0312 })); } diff --git a/src/test/ui/issues/issue-10291.stderr b/src/test/ui/issues/issue-10291.stderr index 0d653e6ced1e..5e63469da59f 100644 --- a/src/test/ui/issues/issue-10291.stderr +++ b/src/test/ui/issues/issue-10291.stderr @@ -4,11 +4,11 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content... LL | x | ^ | -note: ...the reference is valid for the anonymous lifetime #2 defined on the body at 2:65... - --> $DIR/issue-10291.rs:2:65 +note: ...the reference is valid for the anonymous lifetime #2 defined on the body at 2:69... + --> $DIR/issue-10291.rs:2:69 | -LL | drop:: FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { - | _________________________________________________________________^ +LL | drop:: FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { + | _____________________________________________________________________^ LL | | x LL | | })); | |_____^ diff --git a/src/test/ui/issues/issue-10902.rs b/src/test/ui/issues/issue-10902.rs index 672386bc8a6c..5e7f8ed7fd5d 100644 --- a/src/test/ui/issues/issue-10902.rs +++ b/src/test/ui/issues/issue-10902.rs @@ -4,16 +4,16 @@ pub mod two_tuple { pub trait T { fn dummy(&self) { } } - pub struct P<'a>(&'a (T + 'a), &'a (T + 'a)); - pub fn f<'a>(car: &'a T, cdr: &'a T) -> P<'a> { + pub struct P<'a>(&'a (dyn T + 'a), &'a (dyn T + 'a)); + pub fn f<'a>(car: &'a dyn T, cdr: &'a dyn T) -> P<'a> { P(car, cdr) } } pub mod two_fields { pub trait T { fn dummy(&self) { } } - pub struct P<'a> { car: &'a (T + 'a), cdr: &'a (T + 'a) } - pub fn f<'a>(car: &'a T, cdr: &'a T) -> P<'a> { + pub struct P<'a> { car: &'a (dyn T + 'a), cdr: &'a (dyn T + 'a) } + pub fn f<'a>(car: &'a dyn T, cdr: &'a dyn T) -> P<'a> { P{ car: car, cdr: cdr } } } diff --git a/src/test/ui/issues/issue-11374.rs b/src/test/ui/issues/issue-11374.rs index f00da0acf812..7519ba2826e7 100644 --- a/src/test/ui/issues/issue-11374.rs +++ b/src/test/ui/issues/issue-11374.rs @@ -2,11 +2,11 @@ use std::io::{self, Read}; use std::vec; pub struct Container<'a> { - reader: &'a mut Read + reader: &'a mut dyn Read } impl<'a> Container<'a> { - pub fn wrap<'s>(reader: &'s mut io::Read) -> Container<'s> { + pub fn wrap<'s>(reader: &'s mut dyn io::Read) -> Container<'s> { Container { reader: reader } } @@ -17,7 +17,7 @@ impl<'a> Container<'a> { pub fn for_stdin<'a>() -> Container<'a> { let mut r = io::stdin(); - Container::wrap(&mut r as &mut io::Read) + Container::wrap(&mut r as &mut dyn io::Read) } fn main() { diff --git a/src/test/ui/issues/issue-11515.rs b/src/test/ui/issues/issue-11515.rs index 7eab2a26178a..a7671b9282a9 100644 --- a/src/test/ui/issues/issue-11515.rs +++ b/src/test/ui/issues/issue-11515.rs @@ -1,10 +1,10 @@ #![feature(box_syntax)] struct Test { - func: Box + func: Box } fn main() { - let closure: Box = Box::new(|| ()); + let closure: Box = Box::new(|| ()); let test = box Test { func: closure }; //~ ERROR mismatched types } diff --git a/src/test/ui/issues/issue-11612.rs b/src/test/ui/issues/issue-11612.rs index 4d6f4656d589..fd4fb2443cbe 100644 --- a/src/test/ui/issues/issue-11612.rs +++ b/src/test/ui/issues/issue-11612.rs @@ -14,11 +14,11 @@ struct B<'a, T:'a> { impl<'a, T> A for B<'a, T> {} -fn foo(_: &A) {} +fn foo(_: &dyn A) {} fn bar(b: &B) { foo(b); // Coercion should work - foo(b as &A); // Explicit cast should work as well + foo(b as &dyn A); // Explicit cast should work as well } fn main() {} diff --git a/src/test/ui/issues/issue-12470.rs b/src/test/ui/issues/issue-12470.rs index 77b78c8a1f72..0ade359923a0 100644 --- a/src/test/ui/issues/issue-12470.rs +++ b/src/test/ui/issues/issue-12470.rs @@ -16,10 +16,10 @@ impl X for B { } struct A<'a> { - p: &'a (X+'a) + p: &'a (dyn X + 'a) } -fn make_a<'a>(p: &'a X) -> A<'a> { +fn make_a<'a>(p: &'a dyn X) -> A<'a> { A { p: p } } diff --git a/src/test/ui/issues/issue-13033.rs b/src/test/ui/issues/issue-13033.rs index a6c9e9712c05..e5274eb823d4 100644 --- a/src/test/ui/issues/issue-13033.rs +++ b/src/test/ui/issues/issue-13033.rs @@ -1,11 +1,11 @@ trait Foo { - fn bar(&mut self, other: &mut Foo); + fn bar(&mut self, other: &mut dyn Foo); } struct Baz; impl Foo for Baz { - fn bar(&mut self, other: &Foo) {} + fn bar(&mut self, other: &dyn Foo) {} //~^ ERROR method `bar` has an incompatible type for trait //~| expected type `fn(&mut Baz, &mut dyn Foo)` //~| found type `fn(&mut Baz, &dyn Foo)` diff --git a/src/test/ui/issues/issue-13033.stderr b/src/test/ui/issues/issue-13033.stderr index d1e8eb31c883..195d0c39b298 100644 --- a/src/test/ui/issues/issue-13033.stderr +++ b/src/test/ui/issues/issue-13033.stderr @@ -1,18 +1,18 @@ error[E0053]: method `bar` has an incompatible type for trait --> $DIR/issue-13033.rs:8:30 | -LL | fn bar(&mut self, other: &mut Foo); - | -------- type in trait +LL | fn bar(&mut self, other: &mut dyn Foo); + | ------------ type in trait ... -LL | fn bar(&mut self, other: &Foo) {} - | ^^^^ types differ in mutability +LL | fn bar(&mut self, other: &dyn Foo) {} + | ^^^^^^^^ types differ in mutability | = note: expected type `fn(&mut Baz, &mut dyn Foo)` found type `fn(&mut Baz, &dyn Foo)` help: consider change the type to match the mutability in trait | -LL | fn bar(&mut self, other: &mut Foo) {} - | ^^^^^^^^ +LL | fn bar(&mut self, other: &mut dyn Foo) {} + | ^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-13352.rs b/src/test/ui/issues/issue-13352.rs index c711e3b713f2..e6995be27d20 100644 --- a/src/test/ui/issues/issue-13352.rs +++ b/src/test/ui/issues/issue-13352.rs @@ -1,6 +1,6 @@ // ignore-cloudabi no std::process -fn foo(_: Box) {} +fn foo(_: Box) {} fn main() { foo(loop { diff --git a/src/test/ui/issues/issue-13853-2.rs b/src/test/ui/issues/issue-13853-2.rs index b58f2bd3b3b7..27319c98d6e3 100644 --- a/src/test/ui/issues/issue-13853-2.rs +++ b/src/test/ui/issues/issue-13853-2.rs @@ -2,5 +2,5 @@ trait FromStructReader<'a> { } trait ResponseHook { fn get(&self); } -fn foo(res : Box) { res.get } //~ ERROR attempted to take value of method +fn foo(res : Box) { res.get } //~ ERROR attempted to take value of method fn main() {} diff --git a/src/test/ui/issues/issue-13853-2.stderr b/src/test/ui/issues/issue-13853-2.stderr index 0853f5cffb76..ea3b38940cf0 100644 --- a/src/test/ui/issues/issue-13853-2.stderr +++ b/src/test/ui/issues/issue-13853-2.stderr @@ -1,8 +1,8 @@ error[E0615]: attempted to take value of method `get` on type `std::boxed::Box<(dyn ResponseHook + 'static)>` - --> $DIR/issue-13853-2.rs:5:39 + --> $DIR/issue-13853-2.rs:5:43 | -LL | fn foo(res : Box) { res.get } - | ^^^ help: use parentheses to call the method: `get()` +LL | fn foo(res : Box) { res.get } + | ^^^ help: use parentheses to call the method: `get()` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-14285.rs b/src/test/ui/issues/issue-14285.rs index 934d72a67ca1..2ba9ff717739 100644 --- a/src/test/ui/issues/issue-14285.rs +++ b/src/test/ui/issues/issue-14285.rs @@ -6,9 +6,9 @@ struct A; impl Foo for A {} -struct B<'a>(&'a (Foo+'a)); +struct B<'a>(&'a (dyn Foo + 'a)); -fn foo<'a>(a: &Foo) -> B<'a> { +fn foo<'a>(a: &dyn Foo) -> B<'a> { B(a) //~ ERROR explicit lifetime required in the type of `a` [E0621] } diff --git a/src/test/ui/issues/issue-14285.stderr b/src/test/ui/issues/issue-14285.stderr index c180ed03e540..5c07066018e8 100644 --- a/src/test/ui/issues/issue-14285.stderr +++ b/src/test/ui/issues/issue-14285.stderr @@ -1,8 +1,8 @@ error[E0621]: explicit lifetime required in the type of `a` --> $DIR/issue-14285.rs:12:5 | -LL | fn foo<'a>(a: &Foo) -> B<'a> { - | ---- help: add explicit lifetime `'a` to the type of `a`: `&'a (dyn Foo + 'a)` +LL | fn foo<'a>(a: &dyn Foo) -> B<'a> { + | -------- help: add explicit lifetime `'a` to the type of `a`: `&'a (dyn Foo + 'a)` LL | B(a) | ^^^^ lifetime `'a` required diff --git a/src/test/ui/issues/issue-14366.rs b/src/test/ui/issues/issue-14366.rs index a6298f25d470..bb338860d8b7 100644 --- a/src/test/ui/issues/issue-14366.rs +++ b/src/test/ui/issues/issue-14366.rs @@ -1,4 +1,4 @@ fn main() { - let _x = "test" as &::std::any::Any; + let _x = "test" as &dyn (::std::any::Any); //~^ ERROR the size for values of type } diff --git a/src/test/ui/issues/issue-14366.stderr b/src/test/ui/issues/issue-14366.stderr index a3588bb8ebe1..542d8a904c4e 100644 --- a/src/test/ui/issues/issue-14366.stderr +++ b/src/test/ui/issues/issue-14366.stderr @@ -1,7 +1,7 @@ error[E0277]: the size for values of type `str` cannot be known at compilation time --> $DIR/issue-14366.rs:2:14 | -LL | let _x = "test" as &::std::any::Any; +LL | let _x = "test" as &dyn (::std::any::Any); | ^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` diff --git a/src/test/ui/issues/issue-14901.rs b/src/test/ui/issues/issue-14901.rs index 61b2b64ddf0c..9b89c1631df1 100644 --- a/src/test/ui/issues/issue-14901.rs +++ b/src/test/ui/issues/issue-14901.rs @@ -2,7 +2,7 @@ pub trait Reader {} enum Wrapper<'a> { - WrapReader(&'a (Reader + 'a)) + WrapReader(&'a (dyn Reader + 'a)) } trait Wrap<'a> { @@ -11,7 +11,7 @@ trait Wrap<'a> { impl<'a, R: Reader> Wrap<'a> for &'a mut R { fn wrap(self) -> Wrapper<'a> { - Wrapper::WrapReader(self as &'a mut Reader) + Wrapper::WrapReader(self as &'a mut dyn Reader) } } diff --git a/src/test/ui/issues/issue-14959.rs b/src/test/ui/issues/issue-14959.rs index 78ae21e2837a..60daaafbcc8b 100644 --- a/src/test/ui/issues/issue-14959.rs +++ b/src/test/ui/issues/issue-14959.rs @@ -26,20 +26,20 @@ impl Alloy { } } -impl<'b> Fn<(&'b mut (Response+'b),)> for SendFile { - extern "rust-call" fn call(&self, (_res,): (&'b mut (Response+'b),)) {} +impl<'b> Fn<(&'b mut (dyn Response + 'b),)> for SendFile { + extern "rust-call" fn call(&self, (_res,): (&'b mut (dyn Response + 'b),)) {} } -impl<'b> FnMut<(&'b mut (Response+'b),)> for SendFile { - extern "rust-call" fn call_mut(&mut self, (_res,): (&'b mut (Response+'b),)) { +impl<'b> FnMut<(&'b mut (dyn Response + 'b),)> for SendFile { + extern "rust-call" fn call_mut(&mut self, (_res,): (&'b mut (dyn Response+'b),)) { self.call((_res,)) } } -impl<'b> FnOnce<(&'b mut (Response+'b),)> for SendFile { +impl<'b> FnOnce<(&'b mut (dyn Response + 'b),)> for SendFile { type Output = (); - extern "rust-call" fn call_once(self, (_res,): (&'b mut (Response+'b),)) { + extern "rust-call" fn call_once(self, (_res,): (&'b mut (dyn Response+'b),)) { self.call((_res,)) } } diff --git a/src/test/ui/issues/issue-16668.rs b/src/test/ui/issues/issue-16668.rs index f69ca4677c9c..b570a2ced67b 100644 --- a/src/test/ui/issues/issue-16668.rs +++ b/src/test/ui/issues/issue-16668.rs @@ -1,7 +1,7 @@ // compile-pass #![allow(dead_code)] struct Parser<'a, I, O> { - parse: Box Result + 'a> + parse: Box Result + 'a> } impl<'a, I: 'a, O: 'a> Parser<'a, I, O> { diff --git a/src/test/ui/issues/issue-16922.rs b/src/test/ui/issues/issue-16922.rs index 1e865515c4b7..10a5cccbceef 100644 --- a/src/test/ui/issues/issue-16922.rs +++ b/src/test/ui/issues/issue-16922.rs @@ -1,7 +1,7 @@ use std::any::Any; -fn foo(value: &T) -> Box { - Box::new(value) as Box +fn foo(value: &T) -> Box { + Box::new(value) as Box //~^ ERROR explicit lifetime required in the type of `value` [E0621] } diff --git a/src/test/ui/issues/issue-16922.stderr b/src/test/ui/issues/issue-16922.stderr index 1f3b3fe739c4..4e3d3ecb9c03 100644 --- a/src/test/ui/issues/issue-16922.stderr +++ b/src/test/ui/issues/issue-16922.stderr @@ -1,9 +1,9 @@ error[E0621]: explicit lifetime required in the type of `value` --> $DIR/issue-16922.rs:4:5 | -LL | fn foo(value: &T) -> Box { +LL | fn foo(value: &T) -> Box { | -- help: add explicit lifetime `'static` to the type of `value`: `&'static T` -LL | Box::new(value) as Box +LL | Box::new(value) as Box | ^^^^^^^^^^^^^^^ lifetime `'static` required error: aborting due to previous error diff --git a/src/test/ui/issues/issue-16994.rs b/src/test/ui/issues/issue-16994.rs index d356ce8a4da4..d5f1b1310eb5 100644 --- a/src/test/ui/issues/issue-16994.rs +++ b/src/test/ui/issues/issue-16994.rs @@ -1,6 +1,6 @@ // compile-pass // skip-codegen -fn cb<'a,T>(_x: Box, bool))) -> T>) -> T { +fn cb<'a,T>(_x: Box, bool))) -> T>) -> T { panic!() } diff --git a/src/test/ui/issues/issue-17441.rs b/src/test/ui/issues/issue-17441.rs index cfb2fe674edf..b9813ef1eef7 100644 --- a/src/test/ui/issues/issue-17441.rs +++ b/src/test/ui/issues/issue-17441.rs @@ -2,10 +2,10 @@ fn main() { let _foo = &[1_usize, 2] as [usize]; //~^ ERROR cast to unsized type: `&[usize; 2]` as `[usize]` - let _bar = Box::new(1_usize) as std::fmt::Debug; + let _bar = Box::new(1_usize) as dyn std::fmt::Debug; //~^ ERROR cast to unsized type: `std::boxed::Box` as `dyn std::fmt::Debug` - let _baz = 1_usize as std::fmt::Debug; + let _baz = 1_usize as dyn std::fmt::Debug; //~^ ERROR cast to unsized type: `usize` as `dyn std::fmt::Debug` let _quux = [1_usize, 2] as [usize]; diff --git a/src/test/ui/issues/issue-17441.stderr b/src/test/ui/issues/issue-17441.stderr index 436ee7325f8e..0ab035515a05 100644 --- a/src/test/ui/issues/issue-17441.stderr +++ b/src/test/ui/issues/issue-17441.stderr @@ -13,21 +13,21 @@ LL | let _foo = &[1_usize, 2] as [usize]; error[E0620]: cast to unsized type: `std::boxed::Box` as `dyn std::fmt::Debug` --> $DIR/issue-17441.rs:5:16 | -LL | let _bar = Box::new(1_usize) as std::fmt::Debug; - | ^^^^^^^^^^^^^^^^^^^^^--------------- +LL | let _bar = Box::new(1_usize) as dyn std::fmt::Debug; + | ^^^^^^^^^^^^^^^^^^^^^------------------- | | - | help: try casting to a `Box` instead: `Box` + | help: try casting to a `Box` instead: `Box` error[E0620]: cast to unsized type: `usize` as `dyn std::fmt::Debug` --> $DIR/issue-17441.rs:8:16 | -LL | let _baz = 1_usize as std::fmt::Debug; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | let _baz = 1_usize as dyn std::fmt::Debug; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: consider using a box or reference as appropriate --> $DIR/issue-17441.rs:8:16 | -LL | let _baz = 1_usize as std::fmt::Debug; +LL | let _baz = 1_usize as dyn std::fmt::Debug; | ^^^^^^^ error[E0620]: cast to unsized type: `[usize; 2]` as `[usize]` diff --git a/src/test/ui/issues/issue-17959.rs b/src/test/ui/issues/issue-17959.rs index d56f346ecd45..73865ae2d2eb 100644 --- a/src/test/ui/issues/issue-17959.rs +++ b/src/test/ui/issues/issue-17959.rs @@ -17,5 +17,5 @@ impl Drop for G { } fn main() { - let x:G; + let x:G; } diff --git a/src/test/ui/issues/issue-18107.rs b/src/test/ui/issues/issue-18107.rs index 184d122d5cd6..122940f1c172 100644 --- a/src/test/ui/issues/issue-18107.rs +++ b/src/test/ui/issues/issue-18107.rs @@ -1,7 +1,7 @@ pub trait AbstractRenderer {} fn _create_render(_: &()) -> - AbstractRenderer + dyn AbstractRenderer //~^ ERROR the size for values of type { match 0 { diff --git a/src/test/ui/issues/issue-18107.stderr b/src/test/ui/issues/issue-18107.stderr index 23b58c3f6df3..9bdf470413b1 100644 --- a/src/test/ui/issues/issue-18107.stderr +++ b/src/test/ui/issues/issue-18107.stderr @@ -1,8 +1,8 @@ error[E0277]: the size for values of type `(dyn AbstractRenderer + 'static)` cannot be known at compilation time --> $DIR/issue-18107.rs:4:5 | -LL | AbstractRenderer - | ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time +LL | dyn AbstractRenderer + | ^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn AbstractRenderer + 'static)` = note: to learn more, visit diff --git a/src/test/ui/issues/issue-18188.rs b/src/test/ui/issues/issue-18188.rs index 8e39dc15597e..4d0c4464759c 100644 --- a/src/test/ui/issues/issue-18188.rs +++ b/src/test/ui/issues/issue-18188.rs @@ -5,7 +5,7 @@ pub trait Promisable: Send + Sync {} impl Promisable for T {} pub fn propagate<'a, T, E, F, G>(mut action: F) - -> Box) -> Result + 'a> + -> Box) -> Result + 'a> where T: Promisable + Clone + 'a, E: Promisable + Clone + 'a, diff --git a/src/test/ui/issues/issue-18446-2.rs b/src/test/ui/issues/issue-18446-2.rs index 2f05ece31979..3e04a914d458 100644 --- a/src/test/ui/issues/issue-18446-2.rs +++ b/src/test/ui/issues/issue-18446-2.rs @@ -6,7 +6,7 @@ trait T { fn foo(&self) -> i32 { 0 } } -impl<'a> T + 'a { +impl<'a> dyn T + 'a { fn foo(&self) -> i32 { 1 } } diff --git a/src/test/ui/issues/issue-18446.rs b/src/test/ui/issues/issue-18446.rs index 64c89df3868c..a2e238da03a3 100644 --- a/src/test/ui/issues/issue-18446.rs +++ b/src/test/ui/issues/issue-18446.rs @@ -5,7 +5,7 @@ trait T { fn foo(&self); } -impl<'a> T + 'a { +impl<'a> dyn T + 'a { fn foo(&self) {} } @@ -14,6 +14,6 @@ impl T for i32 { } fn main() { - let x: &T = &0i32; + let x: &dyn T = &0i32; x.foo(); //~ ERROR multiple applicable items in scope [E0034] } diff --git a/src/test/ui/issues/issue-18783.rs b/src/test/ui/issues/issue-18783.rs index b84a1adb4256..d4851ac14187 100644 --- a/src/test/ui/issues/issue-18783.rs +++ b/src/test/ui/issues/issue-18783.rs @@ -18,11 +18,11 @@ fn ufcs() { } trait Push<'c> { - fn push<'f: 'c>(&self, push: Box); + fn push<'f: 'c>(&self, push: Box); } -impl<'c> Push<'c> for RefCell>> { - fn push<'f: 'c>(&self, fun: Box) { +impl<'c> Push<'c> for RefCell>> { + fn push<'f: 'c>(&self, fun: Box) { self.borrow_mut().push(fun) } } diff --git a/src/test/ui/issues/issue-18819.rs b/src/test/ui/issues/issue-18819.rs index 80db056e7dd3..e634c55f824f 100644 --- a/src/test/ui/issues/issue-18819.rs +++ b/src/test/ui/issues/issue-18819.rs @@ -8,7 +8,7 @@ impl Foo for X { type Item = bool; } -fn print_x(_: &Foo, extra: &str) { +fn print_x(_: &dyn Foo, extra: &str) { println!("{}", extra); } diff --git a/src/test/ui/issues/issue-18819.stderr b/src/test/ui/issues/issue-18819.stderr index eb7e4ad405fa..41e8470ecd04 100644 --- a/src/test/ui/issues/issue-18819.stderr +++ b/src/test/ui/issues/issue-18819.stderr @@ -1,8 +1,8 @@ error[E0061]: this function takes 2 parameters but 1 parameter was supplied --> $DIR/issue-18819.rs:16:5 | -LL | fn print_x(_: &Foo, extra: &str) { - | ------------------------------------------- defined here +LL | fn print_x(_: &dyn Foo, extra: &str) { + | ----------------------------------------------- defined here ... LL | print_x(X); | ^^^^^^^^^^ expected 2 parameters diff --git a/src/test/ui/issues/issue-18919.rs b/src/test/ui/issues/issue-18919.rs index 9db308491823..91fbb13cd698 100644 --- a/src/test/ui/issues/issue-18919.rs +++ b/src/test/ui/issues/issue-18919.rs @@ -1,4 +1,4 @@ -type FuncType<'f> = Fn(&isize) -> isize + 'f; +type FuncType<'f> = dyn Fn(&isize) -> isize + 'f; fn ho_func(f: Option) { //~^ ERROR the size for values of type diff --git a/src/test/ui/issues/issue-18937.rs b/src/test/ui/issues/issue-18937.rs index f3824765f237..ab4c9c736d89 100644 --- a/src/test/ui/issues/issue-18937.rs +++ b/src/test/ui/issues/issue-18937.rs @@ -6,7 +6,7 @@ use std::fmt; struct MyString<'a>(&'a String); struct B { - list: Vec>, + list: Vec>, } trait A<'a> { diff --git a/src/test/ui/issues/issue-18959.rs b/src/test/ui/issues/issue-18959.rs index b07800928bc2..4b6f04e251b9 100644 --- a/src/test/ui/issues/issue-18959.rs +++ b/src/test/ui/issues/issue-18959.rs @@ -8,13 +8,13 @@ impl Foo for Thing { } #[inline(never)] -fn foo(b: &Bar) { +fn foo(b: &dyn Bar) { //~^ ERROR E0038 b.foo(&0) } fn main() { let mut thing = Thing; - let test: &Bar = &mut thing; + let test: &dyn Bar = &mut thing; foo(test); } diff --git a/src/test/ui/issues/issue-18959.stderr b/src/test/ui/issues/issue-18959.stderr index 939390102c38..63c33b7f4472 100644 --- a/src/test/ui/issues/issue-18959.stderr +++ b/src/test/ui/issues/issue-18959.stderr @@ -1,8 +1,8 @@ error[E0038]: the trait `Bar` cannot be made into an object --> $DIR/issue-18959.rs:11:1 | -LL | fn foo(b: &Bar) { - | ^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object +LL | fn foo(b: &dyn Bar) { + | ^^^^^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object | = note: method `foo` has generic type parameters diff --git a/src/test/ui/issues/issue-18988.rs b/src/test/ui/issues/issue-18988.rs index e03934866495..7fe662e907d7 100644 --- a/src/test/ui/issues/issue-18988.rs +++ b/src/test/ui/issues/issue-18988.rs @@ -3,7 +3,7 @@ pub trait Foo : Send { } pub struct MyFoo { - children: Vec>, + children: Vec>, } impl Foo for MyFoo { } diff --git a/src/test/ui/issues/issue-19380.rs b/src/test/ui/issues/issue-19380.rs index efbc5a0346ac..5c10e2067e40 100644 --- a/src/test/ui/issues/issue-19380.rs +++ b/src/test/ui/issues/issue-19380.rs @@ -8,7 +8,7 @@ impl Qiz for Foo { } struct Bar { - foos: &'static [&'static (Qiz + 'static)] + foos: &'static [&'static (dyn Qiz + 'static)] //~^ ERROR E0038 } diff --git a/src/test/ui/issues/issue-19380.stderr b/src/test/ui/issues/issue-19380.stderr index 060e160f2e48..27e3ff57bf9a 100644 --- a/src/test/ui/issues/issue-19380.stderr +++ b/src/test/ui/issues/issue-19380.stderr @@ -1,8 +1,8 @@ error[E0038]: the trait `Qiz` cannot be made into an object --> $DIR/issue-19380.rs:11:3 | -LL | foos: &'static [&'static (Qiz + 'static)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Qiz` cannot be made into an object +LL | foos: &'static [&'static (dyn Qiz + 'static)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Qiz` cannot be made into an object | = note: method `qiz` has no receiver diff --git a/src/test/ui/issues/issue-19404.rs b/src/test/ui/issues/issue-19404.rs index cdec74fe9684..59544393bae0 100644 --- a/src/test/ui/issues/issue-19404.rs +++ b/src/test/ui/issues/issue-19404.rs @@ -12,10 +12,10 @@ trait Component: 'static {} impl Component for Engine {} trait Env { - fn get_component_type_id(&self, type_id: TypeId) -> Option>; + fn get_component_type_id(&self, type_id: TypeId) -> Option>; } -impl<'a> Env+'a { +impl<'a> dyn Env + 'a { fn get_component(&self) -> Option> { let x = self.get_component_type_id(TypeId::of::()); None @@ -23,13 +23,13 @@ impl<'a> Env+'a { } trait Figment { - fn init(&mut self, env: &Env); + fn init(&mut self, env: &dyn Env); } struct MyFigment; impl Figment for MyFigment { - fn init(&mut self, env: &Env) { + fn init(&mut self, env: &dyn Env) { let engine = env.get_component::(); } } diff --git a/src/test/ui/issues/issue-19482.rs b/src/test/ui/issues/issue-19482.rs index 6ba334905499..9e4b77d87f8b 100644 --- a/src/test/ui/issues/issue-19482.rs +++ b/src/test/ui/issues/issue-19482.rs @@ -7,7 +7,7 @@ trait Foo { fn dummy(&self) { } } -fn bar(x: &Foo) {} +fn bar(x: &dyn Foo) {} //~^ ERROR the associated type `A` (from the trait `Foo`) must be specified pub fn main() {} diff --git a/src/test/ui/issues/issue-19482.stderr b/src/test/ui/issues/issue-19482.stderr index a8894f84e743..f1e5419c7122 100644 --- a/src/test/ui/issues/issue-19482.stderr +++ b/src/test/ui/issues/issue-19482.stderr @@ -4,8 +4,8 @@ error[E0191]: the value of the associated type `A` (from the trait `Foo`) must b LL | type A; | ------- `A` defined here ... -LL | fn bar(x: &Foo) {} - | ^^^ associated type `A` must be specified +LL | fn bar(x: &dyn Foo) {} + | ^^^^^^^ associated type `A` must be specified error: aborting due to previous error diff --git a/src/test/ui/issues/issue-19538.rs b/src/test/ui/issues/issue-19538.rs index 9f0b08d6c357..7054ef41b1c8 100644 --- a/src/test/ui/issues/issue-19538.rs +++ b/src/test/ui/issues/issue-19538.rs @@ -14,7 +14,7 @@ impl Bar for Thing { } fn main() { let mut thing = Thing; - let test: &mut Bar = &mut thing; + let test: &mut dyn Bar = &mut thing; //~^ ERROR E0038 //~| ERROR E0038 } diff --git a/src/test/ui/issues/issue-19538.stderr b/src/test/ui/issues/issue-19538.stderr index d0f05a41d4d3..e5da0a9b0dac 100644 --- a/src/test/ui/issues/issue-19538.stderr +++ b/src/test/ui/issues/issue-19538.stderr @@ -1,16 +1,16 @@ error[E0038]: the trait `Bar` cannot be made into an object --> $DIR/issue-19538.rs:17:15 | -LL | let test: &mut Bar = &mut thing; - | ^^^^^^^^ the trait `Bar` cannot be made into an object +LL | let test: &mut dyn Bar = &mut thing; + | ^^^^^^^^^^^^ the trait `Bar` cannot be made into an object | = note: method `foo` has generic type parameters error[E0038]: the trait `Bar` cannot be made into an object - --> $DIR/issue-19538.rs:17:26 + --> $DIR/issue-19538.rs:17:30 | -LL | let test: &mut Bar = &mut thing; - | ^^^^^^^^^^ the trait `Bar` cannot be made into an object +LL | let test: &mut dyn Bar = &mut thing; + | ^^^^^^^^^^ the trait `Bar` cannot be made into an object | = note: method `foo` has generic type parameters = note: required because of the requirements on the impl of `std::ops::CoerceUnsized<&mut dyn Bar>` for `&mut Thing` diff --git a/src/test/ui/issues/issue-20396.rs b/src/test/ui/issues/issue-20396.rs index b6dfffbd69eb..0e69b7f3d1e0 100644 --- a/src/test/ui/issues/issue-20396.rs +++ b/src/test/ui/issues/issue-20396.rs @@ -10,7 +10,7 @@ trait Foo { enum Bar { Bla(T) } struct Baz<'a> { - inner: for<'b> Foo> + 'a, + inner: dyn for<'b> Foo> + 'a, } fn main() {} diff --git a/src/test/ui/issues/issue-20605.rs b/src/test/ui/issues/issue-20605.rs index 11a2a573ea67..17b7d32ebf59 100644 --- a/src/test/ui/issues/issue-20605.rs +++ b/src/test/ui/issues/issue-20605.rs @@ -1,4 +1,4 @@ -fn changer<'a>(mut things: Box>) { +fn changer<'a>(mut things: Box>) { for item in *things { *item = 0 } //~^ ERROR the size for values of type } diff --git a/src/test/ui/issues/issue-20692.rs b/src/test/ui/issues/issue-20692.rs index ea89bca78d07..2a05bba7b163 100644 --- a/src/test/ui/issues/issue-20692.rs +++ b/src/test/ui/issues/issue-20692.rs @@ -4,7 +4,7 @@ fn f(x: &T) { let _ = x //~^ ERROR `Array` cannot be made into an object as - &Array; + &dyn Array; //~^ ERROR `Array` cannot be made into an object } diff --git a/src/test/ui/issues/issue-20692.stderr b/src/test/ui/issues/issue-20692.stderr index acc223c0b2df..66309394a426 100644 --- a/src/test/ui/issues/issue-20692.stderr +++ b/src/test/ui/issues/issue-20692.stderr @@ -1,8 +1,8 @@ error[E0038]: the trait `Array` cannot be made into an object --> $DIR/issue-20692.rs:7:5 | -LL | &Array; - | ^^^^^^ the trait `Array` cannot be made into an object +LL | &dyn Array; + | ^^^^^^^^^^ the trait `Array` cannot be made into an object | = note: the trait cannot require that `Self : Sized` diff --git a/src/test/ui/issues/issue-20831-debruijn.rs b/src/test/ui/issues/issue-20831-debruijn.rs index 6d3c7331a457..ef4b1581fd87 100644 --- a/src/test/ui/issues/issue-20831-debruijn.rs +++ b/src/test/ui/issues/issue-20831-debruijn.rs @@ -12,7 +12,7 @@ pub trait Subscriber { pub trait Publisher<'a> { type Output; - fn subscribe(&mut self, _: Box + 'a>); + fn subscribe(&mut self, _: Box + 'a>); } pub trait Processor<'a> : Subscriber + Publisher<'a> { } @@ -20,12 +20,12 @@ pub trait Processor<'a> : Subscriber + Publisher<'a> { } impl<'a, P> Processor<'a> for P where P : Subscriber + Publisher<'a> { } struct MyStruct<'a> { - sub: Box + 'a> + sub: Box + 'a> } impl<'a> Publisher<'a> for MyStruct<'a> { type Output = u64; - fn subscribe(&mut self, t : Box::Output> + 'a>) { + fn subscribe(&mut self, t : Box::Output> + 'a>) { // Not obvious, but there is an implicit lifetime here -------^ //~^^ ERROR cannot infer //~| ERROR mismatched types diff --git a/src/test/ui/issues/issue-20831-debruijn.stderr b/src/test/ui/issues/issue-20831-debruijn.stderr index 70a395d0b89e..64e3cdc64c11 100644 --- a/src/test/ui/issues/issue-20831-debruijn.stderr +++ b/src/test/ui/issues/issue-20831-debruijn.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-20831-debruijn.rs:28:5 | -LL | / fn subscribe(&mut self, t : Box::Output> + 'a>) { +LL | / fn subscribe(&mut self, t : Box::Output> + 'a>) { LL | | // Not obvious, but there is an implicit lifetime here -------^ LL | | LL | | @@ -15,7 +15,7 @@ LL | | } note: the anonymous lifetime #2 defined on the method body at 28:5... --> $DIR/issue-20831-debruijn.rs:28:5 | -LL | / fn subscribe(&mut self, t : Box::Output> + 'a>) { +LL | / fn subscribe(&mut self, t : Box::Output> + 'a>) { LL | | // Not obvious, but there is an implicit lifetime here -------^ LL | | LL | | @@ -32,7 +32,7 @@ LL | impl<'a> Publisher<'a> for MyStruct<'a> { error[E0308]: mismatched types --> $DIR/issue-20831-debruijn.rs:28:5 | -LL | / fn subscribe(&mut self, t : Box::Output> + 'a>) { +LL | / fn subscribe(&mut self, t : Box::Output> + 'a>) { LL | | // Not obvious, but there is an implicit lifetime here -------^ LL | | LL | | @@ -51,7 +51,7 @@ LL | impl<'a> Publisher<'a> for MyStruct<'a> { note: ...does not necessarily outlive the anonymous lifetime #2 defined on the method body at 28:5 --> $DIR/issue-20831-debruijn.rs:28:5 | -LL | / fn subscribe(&mut self, t : Box::Output> + 'a>) { +LL | / fn subscribe(&mut self, t : Box::Output> + 'a>) { LL | | // Not obvious, but there is an implicit lifetime here -------^ LL | | LL | | @@ -63,7 +63,7 @@ LL | | } error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements --> $DIR/issue-20831-debruijn.rs:28:5 | -LL | / fn subscribe(&mut self, t : Box::Output> + 'a>) { +LL | / fn subscribe(&mut self, t : Box::Output> + 'a>) { LL | | // Not obvious, but there is an implicit lifetime here -------^ LL | | LL | | @@ -75,7 +75,7 @@ LL | | } note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the method body at 28:5... --> $DIR/issue-20831-debruijn.rs:28:5 | -LL | / fn subscribe(&mut self, t : Box::Output> + 'a>) { +LL | / fn subscribe(&mut self, t : Box::Output> + 'a>) { LL | | // Not obvious, but there is an implicit lifetime here -------^ LL | | LL | | diff --git a/src/test/ui/issues/issue-20939.rs b/src/test/ui/issues/issue-20939.rs index 259fff2e6c2f..c0c222978970 100644 --- a/src/test/ui/issues/issue-20939.rs +++ b/src/test/ui/issues/issue-20939.rs @@ -1,6 +1,6 @@ trait Foo {} -impl<'a> Foo for Foo+'a {} +impl<'a> Foo for dyn Foo + 'a {} //~^ ERROR the object type `(dyn Foo + 'a)` automatically implements the trait `Foo` fn main() {} diff --git a/src/test/ui/issues/issue-20939.stderr b/src/test/ui/issues/issue-20939.stderr index d15a5196667f..3819a21a2cff 100644 --- a/src/test/ui/issues/issue-20939.stderr +++ b/src/test/ui/issues/issue-20939.stderr @@ -1,8 +1,8 @@ error[E0371]: the object type `(dyn Foo + 'a)` automatically implements the trait `Foo` --> $DIR/issue-20939.rs:3:1 | -LL | impl<'a> Foo for Foo+'a {} - | ^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Foo + 'a)` automatically implements trait `Foo` +LL | impl<'a> Foo for dyn Foo + 'a {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Foo + 'a)` automatically implements trait `Foo` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-21363.rs b/src/test/ui/issues/issue-21363.rs index 5e30db17c6d1..12efce9496ef 100644 --- a/src/test/ui/issues/issue-21363.rs +++ b/src/test/ui/issues/issue-21363.rs @@ -8,7 +8,7 @@ trait Iterator { fn dummy(&self) { } } -impl<'a, T> Iterator for &'a mut (Iterator + 'a) { +impl<'a, T> Iterator for &'a mut (dyn Iterator + 'a) { type Item = T; } diff --git a/src/test/ui/issues/issue-21950.rs b/src/test/ui/issues/issue-21950.rs index b902893bf822..0bc87824ccec 100644 --- a/src/test/ui/issues/issue-21950.rs +++ b/src/test/ui/issues/issue-21950.rs @@ -2,7 +2,7 @@ use std::ops::Add; fn main() { let x = &10 as - &Add; + &dyn Add; //~^ ERROR E0393 //~| ERROR E0191 } diff --git a/src/test/ui/issues/issue-21950.stderr b/src/test/ui/issues/issue-21950.stderr index 7655e0811e06..9be7b052da31 100644 --- a/src/test/ui/issues/issue-21950.stderr +++ b/src/test/ui/issues/issue-21950.stderr @@ -1,16 +1,16 @@ error[E0393]: the type parameter `Rhs` must be explicitly specified - --> $DIR/issue-21950.rs:5:14 + --> $DIR/issue-21950.rs:5:18 | -LL | &Add; - | ^^^ missing reference to `Rhs` +LL | &dyn Add; + | ^^^ missing reference to `Rhs` | = note: because of the default `Self` reference, type parameters must be specified on object types error[E0191]: the value of the associated type `Output` (from the trait `std::ops::Add`) must be specified --> $DIR/issue-21950.rs:5:14 | -LL | &Add; - | ^^^ associated type `Output` must be specified +LL | &dyn Add; + | ^^^^^^^ associated type `Output` must be specified error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-22034.rs b/src/test/ui/issues/issue-22034.rs index 75ac78ad24fe..508c9c91b04e 100644 --- a/src/test/ui/issues/issue-22034.rs +++ b/src/test/ui/issues/issue-22034.rs @@ -4,8 +4,8 @@ extern crate libc; fn main() { let ptr: *mut () = 0 as *mut _; - let _: &mut Fn() = unsafe { - &mut *(ptr as *mut Fn()) + let _: &mut dyn Fn() = unsafe { + &mut *(ptr as *mut dyn Fn()) //~^ ERROR expected a `std::ops::Fn<()>` closure, found `()` }; } diff --git a/src/test/ui/issues/issue-22034.stderr b/src/test/ui/issues/issue-22034.stderr index de2d315ff5c6..19fb080154a4 100644 --- a/src/test/ui/issues/issue-22034.stderr +++ b/src/test/ui/issues/issue-22034.stderr @@ -1,7 +1,7 @@ error[E0277]: expected a `std::ops::Fn<()>` closure, found `()` --> $DIR/issue-22034.rs:8:16 | -LL | &mut *(ptr as *mut Fn()) +LL | &mut *(ptr as *mut dyn Fn()) | ^^^ expected an `Fn<()>` closure, found `()` | = help: the trait `std::ops::Fn<()>` is not implemented for `()` diff --git a/src/test/ui/issues/issue-22289.rs b/src/test/ui/issues/issue-22289.rs index b683834de441..e1b3dfe5b61b 100644 --- a/src/test/ui/issues/issue-22289.rs +++ b/src/test/ui/issues/issue-22289.rs @@ -1,3 +1,3 @@ fn main() { - 0 as &std::any::Any; //~ ERROR non-primitive cast + 0 as &dyn std::any::Any; //~ ERROR non-primitive cast } diff --git a/src/test/ui/issues/issue-22289.stderr b/src/test/ui/issues/issue-22289.stderr index e9846b848f43..cc7ace30cabe 100644 --- a/src/test/ui/issues/issue-22289.stderr +++ b/src/test/ui/issues/issue-22289.stderr @@ -1,8 +1,8 @@ error[E0605]: non-primitive cast: `i32` as `&(dyn std::any::Any + 'static)` --> $DIR/issue-22289.rs:2:5 | -LL | 0 as &std::any::Any; - | ^^^^^^^^^^^^^^^^^^^ +LL | 0 as &dyn std::any::Any; + | ^^^^^^^^^^^^^^^^^^^^^^^ | = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait diff --git a/src/test/ui/issues/issue-22312.rs b/src/test/ui/issues/issue-22312.rs index f7ebdb0372ad..250fec258870 100644 --- a/src/test/ui/issues/issue-22312.rs +++ b/src/test/ui/issues/issue-22312.rs @@ -8,7 +8,7 @@ pub trait Array2D: Index { return None; } let i = y * self.columns() + x; - let indexer = &(*self as &Index>::Output>); + let indexer = &(*self as &dyn Index>::Output>); //~^ERROR non-primitive cast Some(indexer.index(i)) } diff --git a/src/test/ui/issues/issue-22312.stderr b/src/test/ui/issues/issue-22312.stderr index 6a012b214c50..fc32fd376b75 100644 --- a/src/test/ui/issues/issue-22312.stderr +++ b/src/test/ui/issues/issue-22312.stderr @@ -1,8 +1,8 @@ error[E0605]: non-primitive cast: `Self` as `&dyn std::ops::Index>::Output>` --> $DIR/issue-22312.rs:11:24 | -LL | let indexer = &(*self as &Index>::Output>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | let indexer = &(*self as &dyn Index>::Output>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait diff --git a/src/test/ui/issues/issue-22370.rs b/src/test/ui/issues/issue-22370.rs index 90912cfda0d4..bab0469c0119 100644 --- a/src/test/ui/issues/issue-22370.rs +++ b/src/test/ui/issues/issue-22370.rs @@ -1,6 +1,6 @@ trait A {} -fn f(a: &A) {} +fn f(a: &dyn A) {} //~^ ERROR E0393 fn main() {} diff --git a/src/test/ui/issues/issue-22370.stderr b/src/test/ui/issues/issue-22370.stderr index f21551a55bc9..3ce164e9548b 100644 --- a/src/test/ui/issues/issue-22370.stderr +++ b/src/test/ui/issues/issue-22370.stderr @@ -1,8 +1,8 @@ error[E0393]: the type parameter `T` must be explicitly specified - --> $DIR/issue-22370.rs:3:10 + --> $DIR/issue-22370.rs:3:14 | -LL | fn f(a: &A) {} - | ^ missing reference to `T` +LL | fn f(a: &dyn A) {} + | ^ missing reference to `T` | = note: because of the default `Self` reference, type parameters must be specified on object types diff --git a/src/test/ui/issues/issue-22434.rs b/src/test/ui/issues/issue-22434.rs index 0d7d67cbc1bc..3e800a2b61db 100644 --- a/src/test/ui/issues/issue-22434.rs +++ b/src/test/ui/issues/issue-22434.rs @@ -2,7 +2,7 @@ pub trait Foo { type A; } -type I<'a> = &'a (Foo + 'a); +type I<'a> = &'a (dyn Foo + 'a); //~^ ERROR the value of the associated type `A` (from the trait `Foo`) must be specified fn main() {} diff --git a/src/test/ui/issues/issue-22434.stderr b/src/test/ui/issues/issue-22434.stderr index bbdbeb6ae980..eb78c4fc311f 100644 --- a/src/test/ui/issues/issue-22434.stderr +++ b/src/test/ui/issues/issue-22434.stderr @@ -4,8 +4,8 @@ error[E0191]: the value of the associated type `A` (from the trait `Foo`) must b LL | type A; | ------- `A` defined here ... -LL | type I<'a> = &'a (Foo + 'a); - | ^^^^^^^^ associated type `A` must be specified +LL | type I<'a> = &'a (dyn Foo + 'a); + | ^^^^^^^^^^^^ associated type `A` must be specified error: aborting due to previous error diff --git a/src/test/ui/issues/issue-22560.rs b/src/test/ui/issues/issue-22560.rs index 4b8e3aa9eb3e..acee99dbedcc 100644 --- a/src/test/ui/issues/issue-22560.rs +++ b/src/test/ui/issues/issue-22560.rs @@ -1,6 +1,6 @@ use std::ops::{Add, Sub}; -type Test = Add + +type Test = dyn Add + //~^ ERROR E0393 //~| ERROR E0191 Sub; diff --git a/src/test/ui/issues/issue-22560.stderr b/src/test/ui/issues/issue-22560.stderr index 322136d35cad..5b58adb197c6 100644 --- a/src/test/ui/issues/issue-22560.stderr +++ b/src/test/ui/issues/issue-22560.stderr @@ -7,21 +7,21 @@ LL | Sub; = note: because of the default `Self` reference, type parameters must be specified on object types error[E0393]: the type parameter `Rhs` must be explicitly specified - --> $DIR/issue-22560.rs:3:13 + --> $DIR/issue-22560.rs:3:17 | -LL | type Test = Add + - | ^^^ missing reference to `Rhs` +LL | type Test = dyn Add + + | ^^^ missing reference to `Rhs` | = note: because of the default `Self` reference, type parameters must be specified on object types error[E0225]: only auto traits can be used as additional traits in a trait object --> $DIR/issue-22560.rs:6:13 | -LL | type Test = Add + - | --- - | | - | first non-auto trait - | trait alias used in trait object type (first use) +LL | type Test = dyn Add + + | --- + | | + | first non-auto trait + | trait alias used in trait object type (first use) ... LL | Sub; | ^^^ @@ -32,7 +32,7 @@ LL | Sub; error[E0191]: the value of the associated types `Output` (from the trait `std::ops::Add`), `Output` (from the trait `std::ops::Sub`) must be specified --> $DIR/issue-22560.rs:3:13 | -LL | type Test = Add + +LL | type Test = dyn Add + | _____________^ | |_____________| | | diff --git a/src/test/ui/issues/issue-22781.rs b/src/test/ui/issues/issue-22781.rs index 5df3d88b168f..a7b94c106a4c 100644 --- a/src/test/ui/issues/issue-22781.rs +++ b/src/test/ui/issues/issue-22781.rs @@ -4,7 +4,7 @@ use std::collections::HashMap; use std::collections::hash_map::Entry::Vacant; pub fn foo() { - type F = Box; + type F = Box; let mut map: HashMap<(), F> = HashMap::new(); let x: &mut F = match map.entry(()) { Vacant(_) => unimplemented!(), diff --git a/src/test/ui/issues/issue-22872.rs b/src/test/ui/issues/issue-22872.rs index 8ef4af15bd46..5db2891e65e7 100644 --- a/src/test/ui/issues/issue-22872.rs +++ b/src/test/ui/issues/issue-22872.rs @@ -17,7 +17,7 @@ pub trait Process<'a> { } fn push_process

(process: P) where P: Process<'static> { - let _: Box Wrap<'b>> = Box::new(Wrapper(process)); + let _: Box Wrap<'b>> = Box::new(Wrapper(process)); //~^ ERROR is not an iterator } diff --git a/src/test/ui/issues/issue-22872.stderr b/src/test/ui/issues/issue-22872.stderr index ebd096f1dde5..fc5de23752b3 100644 --- a/src/test/ui/issues/issue-22872.stderr +++ b/src/test/ui/issues/issue-22872.stderr @@ -1,8 +1,8 @@ error[E0277]: `

>::Item` is not an iterator - --> $DIR/issue-22872.rs:20:36 + --> $DIR/issue-22872.rs:20:40 | -LL | let _: Box Wrap<'b>> = Box::new(Wrapper(process)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ `

>::Item` is not an iterator +LL | let _: Box Wrap<'b>> = Box::new(Wrapper(process)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ `

>::Item` is not an iterator | = help: the trait `std::iter::Iterator` is not implemented for `

>::Item` = help: consider adding a `where

>::Item: std::iter::Iterator` bound diff --git a/src/test/ui/issues/issue-23024.rs b/src/test/ui/issues/issue-23024.rs index 0639ce30aa0e..2638e15f0eae 100644 --- a/src/test/ui/issues/issue-23024.rs +++ b/src/test/ui/issues/issue-23024.rs @@ -4,9 +4,9 @@ use std::any::Any; fn main() { fn h(x:i32) -> i32 {3*x} - let mut vfnfer:Vec> = vec![]; + let mut vfnfer:Vec> = vec![]; vfnfer.push(box h); - println!("{:?}",(vfnfer[0] as Fn)(3)); + println!("{:?}",(vfnfer[0] as dyn Fn)(3)); //~^ ERROR the precise format of `Fn`-family traits' //~| ERROR wrong number of type arguments: expected 1, found 0 [E0107] //~| ERROR the value of the associated type `Output` (from the trait `std::ops::FnOnce`) diff --git a/src/test/ui/issues/issue-23024.stderr b/src/test/ui/issues/issue-23024.stderr index fbefbe4f56e6..e99854539de8 100644 --- a/src/test/ui/issues/issue-23024.stderr +++ b/src/test/ui/issues/issue-23024.stderr @@ -1,23 +1,23 @@ error[E0658]: the precise format of `Fn`-family traits' type parameters is subject to change. Use parenthetical notation (Fn(Foo, Bar) -> Baz) instead - --> $DIR/issue-23024.rs:9:35 + --> $DIR/issue-23024.rs:9:39 | -LL | println!("{:?}",(vfnfer[0] as Fn)(3)); - | ^^ +LL | println!("{:?}",(vfnfer[0] as dyn Fn)(3)); + | ^^ | = note: for more information, see https://github.com/rust-lang/rust/issues/29625 = help: add #![feature(unboxed_closures)] to the crate attributes to enable error[E0107]: wrong number of type arguments: expected 1, found 0 - --> $DIR/issue-23024.rs:9:35 + --> $DIR/issue-23024.rs:9:39 | -LL | println!("{:?}",(vfnfer[0] as Fn)(3)); - | ^^ expected 1 type argument +LL | println!("{:?}",(vfnfer[0] as dyn Fn)(3)); + | ^^ expected 1 type argument error[E0191]: the value of the associated type `Output` (from the trait `std::ops::FnOnce`) must be specified --> $DIR/issue-23024.rs:9:35 | -LL | println!("{:?}",(vfnfer[0] as Fn)(3)); - | ^^ associated type `Output` must be specified +LL | println!("{:?}",(vfnfer[0] as dyn Fn)(3)); + | ^^^^^^ associated type `Output` must be specified error: aborting due to 3 previous errors diff --git a/src/test/ui/issues/issue-23041.rs b/src/test/ui/issues/issue-23041.rs index a18e85806d91..a1371521a0aa 100644 --- a/src/test/ui/issues/issue-23041.rs +++ b/src/test/ui/issues/issue-23041.rs @@ -2,6 +2,6 @@ use std::any::Any; fn main() { fn bar(x:i32) ->i32 { 3*x }; - let b:Box = Box::new(bar as fn(_)->_); + let b:Box = Box::new(bar as fn(_)->_); b.downcast_ref::_>(); //~ ERROR E0282 } diff --git a/src/test/ui/issues/issue-23046.rs b/src/test/ui/issues/issue-23046.rs index 898654b7b596..a68369616d8b 100644 --- a/src/test/ui/issues/issue-23046.rs +++ b/src/test/ui/issues/issue-23046.rs @@ -1,6 +1,6 @@ pub enum Expr<'var, VAR> { Let(Box>, - Box Fn(Expr<'v, VAR>) -> Expr<'v, VAR> + 'var>) + Box Fn(Expr<'v, VAR>) -> Expr<'v, VAR> + 'var>) } pub fn add<'var, VAR> diff --git a/src/test/ui/issues/issue-23281.rs b/src/test/ui/issues/issue-23281.rs index 2b457a57d3ed..d5f747288627 100644 --- a/src/test/ui/issues/issue-23281.rs +++ b/src/test/ui/issues/issue-23281.rs @@ -1,7 +1,7 @@ pub struct Struct; impl Struct { - pub fn function(funs: Vec ()>) {} + pub fn function(funs: Vec ()>) {} //~^ ERROR the size for values of type } diff --git a/src/test/ui/issues/issue-23281.stderr b/src/test/ui/issues/issue-23281.stderr index e540d4e81924..f1def4745836 100644 --- a/src/test/ui/issues/issue-23281.stderr +++ b/src/test/ui/issues/issue-23281.stderr @@ -1,8 +1,8 @@ error[E0277]: the size for values of type `(dyn std::ops::Fn() + 'static)` cannot be known at compilation time --> $DIR/issue-23281.rs:4:5 | -LL | pub fn function(funs: Vec ()>) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time +LL | pub fn function(funs: Vec ()>) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn std::ops::Fn() + 'static)` = note: to learn more, visit diff --git a/src/test/ui/issues/issue-24446.rs b/src/test/ui/issues/issue-24446.rs index c5e1b49e5ed1..ffd6dfabc289 100644 --- a/src/test/ui/issues/issue-24446.rs +++ b/src/test/ui/issues/issue-24446.rs @@ -1,5 +1,5 @@ fn main() { - static foo: Fn() -> u32 = || -> u32 { + static foo: dyn Fn() -> u32 = || -> u32 { //~^ ERROR the size for values of type 0 }; diff --git a/src/test/ui/issues/issue-24446.stderr b/src/test/ui/issues/issue-24446.stderr index ffec73b1ab4a..344443e78303 100644 --- a/src/test/ui/issues/issue-24446.stderr +++ b/src/test/ui/issues/issue-24446.stderr @@ -1,8 +1,8 @@ error[E0277]: the size for values of type `(dyn std::ops::Fn() -> u32 + 'static)` cannot be known at compilation time --> $DIR/issue-24446.rs:2:17 | -LL | static foo: Fn() -> u32 = || -> u32 { - | ^^^^^^^^^^^ doesn't have a size known at compile-time +LL | static foo: dyn Fn() -> u32 = || -> u32 { + | ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn std::ops::Fn() -> u32 + 'static)` = note: to learn more, visit diff --git a/src/test/ui/issues/issue-25180.rs b/src/test/ui/issues/issue-25180.rs index 739d571d7275..297f403c05ee 100644 --- a/src/test/ui/issues/issue-25180.rs +++ b/src/test/ui/issues/issue-25180.rs @@ -2,6 +2,6 @@ #![allow(dead_code)] #![allow(non_upper_case_globals)] -const x: &'static Fn() = &|| println!("ICE here"); +const x: &'static dyn Fn() = &|| println!("ICE here"); fn main() {} diff --git a/src/test/ui/issues/issue-26056.rs b/src/test/ui/issues/issue-26056.rs index 0d9973b45484..99d43ec792b3 100644 --- a/src/test/ui/issues/issue-26056.rs +++ b/src/test/ui/issues/issue-26056.rs @@ -17,6 +17,6 @@ impl Map for K { fn main() { let _ = &() - as &Map; + as &dyn Map; //~^ ERROR E0038 } diff --git a/src/test/ui/issues/issue-26056.stderr b/src/test/ui/issues/issue-26056.stderr index 44fabd0db195..9c4cf0b18acf 100644 --- a/src/test/ui/issues/issue-26056.stderr +++ b/src/test/ui/issues/issue-26056.stderr @@ -1,8 +1,8 @@ error[E0038]: the trait `Map` cannot be made into an object --> $DIR/issue-26056.rs:20:13 | -LL | as &Map; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Map` cannot be made into an object +LL | as &dyn Map; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Map` cannot be made into an object | = note: the trait cannot use `Self` as a type parameter in the supertraits or where-clauses diff --git a/src/test/ui/issues/issue-26638.rs b/src/test/ui/issues/issue-26638.rs index 0f5ed5caa74c..72fe4286a06b 100644 --- a/src/test/ui/issues/issue-26638.rs +++ b/src/test/ui/issues/issue-26638.rs @@ -1,4 +1,4 @@ -fn parse_type(iter: Box+'static>) -> &str { iter.next() } +fn parse_type(iter: Box+'static>) -> &str { iter.next() } //~^ ERROR missing lifetime specifier [E0106] fn parse_type_2(iter: fn(&u8)->&u8) -> &str { iter() } diff --git a/src/test/ui/issues/issue-26638.stderr b/src/test/ui/issues/issue-26638.stderr index 64c2cd43264d..6d7c1b0c43fc 100644 --- a/src/test/ui/issues/issue-26638.stderr +++ b/src/test/ui/issues/issue-26638.stderr @@ -1,8 +1,8 @@ error[E0106]: missing lifetime specifier - --> $DIR/issue-26638.rs:1:58 + --> $DIR/issue-26638.rs:1:62 | -LL | fn parse_type(iter: Box+'static>) -> &str { iter.next() } - | ^ expected lifetime parameter +LL | fn parse_type(iter: Box+'static>) -> &str { iter.next() } + | ^ expected lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say which one of `iter`'s 2 lifetimes it is borrowed from diff --git a/src/test/ui/issues/issue-26905.rs b/src/test/ui/issues/issue-26905.rs index efd06219c3de..4c5c67d58bc3 100644 --- a/src/test/ui/issues/issue-26905.rs +++ b/src/test/ui/issues/issue-26905.rs @@ -19,5 +19,5 @@ fn main() { let data = [1, 2, 3]; let iter = data.iter(); let x = MyRc { _ptr: &iter, _boo: NotPhantomData(PhantomData) }; - let _y: MyRc> = x; + let _y: MyRc> = x; } diff --git a/src/test/ui/issues/issue-27105.rs b/src/test/ui/issues/issue-27105.rs index 5f0dff12aec9..1aafa11768fd 100644 --- a/src/test/ui/issues/issue-27105.rs +++ b/src/test/ui/issues/issue-27105.rs @@ -3,7 +3,7 @@ use std::cell::RefCell; use std::rc::Rc; pub struct Callbacks { - callbacks: Vec>>, + callbacks: Vec>>, } impl Callbacks { diff --git a/src/test/ui/issues/issue-28279.rs b/src/test/ui/issues/issue-28279.rs index c770c5098595..fab91160a88b 100644 --- a/src/test/ui/issues/issue-28279.rs +++ b/src/test/ui/issues/issue-28279.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] use std::rc::Rc; -fn test1() -> Rc Fn(&'a usize) + 'static> { +fn test1() -> Rc Fn(&'a usize) + 'static> { if let Some(_) = Some(1) { loop{} } else { @@ -10,7 +10,7 @@ fn test1() -> Rc Fn(&'a usize) + 'static> { } } -fn test2() -> *mut (for<'a> Fn(&'a usize) + 'static) { +fn test2() -> *mut (dyn for<'a> Fn(&'a usize) + 'static) { if let Some(_) = Some(1) { loop{} } else { diff --git a/src/test/ui/issues/issue-28576.rs b/src/test/ui/issues/issue-28576.rs index de665d5aa168..972c839b6480 100644 --- a/src/test/ui/issues/issue-28576.rs +++ b/src/test/ui/issues/issue-28576.rs @@ -4,7 +4,7 @@ pub trait Foo { pub trait Bar: Foo { fn new(&self, b: & - Bar //~ ERROR the trait `Bar` cannot be made into an object + dyn Bar //~ ERROR the trait `Bar` cannot be made into an object ); } diff --git a/src/test/ui/issues/issue-28576.stderr b/src/test/ui/issues/issue-28576.stderr index cf6174ba857b..3249d76e69b5 100644 --- a/src/test/ui/issues/issue-28576.stderr +++ b/src/test/ui/issues/issue-28576.stderr @@ -1,7 +1,7 @@ error[E0038]: the trait `Bar` cannot be made into an object --> $DIR/issue-28576.rs:7:12 | -LL | / Bar +LL | / dyn Bar LL | | | |________________________^ the trait `Bar` cannot be made into an object | diff --git a/src/test/ui/issues/issue-2904.rs b/src/test/ui/issues/issue-2904.rs index 7755b7ecee30..42f71a1b0961 100644 --- a/src/test/ui/issues/issue-2904.rs +++ b/src/test/ui/issues/issue-2904.rs @@ -55,7 +55,7 @@ fn square_from_char(c: char) -> square { fn read_board_grid(mut input: rdr) -> Vec> { - let mut input: &mut Read = &mut input; + let mut input: &mut dyn Read = &mut input; let mut grid = Vec::new(); let mut line = [0; 10]; input.read(&mut line); diff --git a/src/test/ui/issues/issue-32963.rs b/src/test/ui/issues/issue-32963.rs index be59d3522b86..ee099069f024 100644 --- a/src/test/ui/issues/issue-32963.rs +++ b/src/test/ui/issues/issue-32963.rs @@ -5,7 +5,7 @@ trait Misc {} fn size_of_copy() -> usize { mem::size_of::() } fn main() { - size_of_copy::(); + size_of_copy::(); //~^ ERROR only auto traits can be used as additional traits in a trait object //~| ERROR the trait bound `dyn Misc: std::marker::Copy` is not satisfied } diff --git a/src/test/ui/issues/issue-32963.stderr b/src/test/ui/issues/issue-32963.stderr index cde4123dc3f4..a31a74a07f46 100644 --- a/src/test/ui/issues/issue-32963.stderr +++ b/src/test/ui/issues/issue-32963.stderr @@ -1,19 +1,19 @@ error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/issue-32963.rs:8:25 + --> $DIR/issue-32963.rs:8:31 | -LL | size_of_copy::(); - | ---- ^^^^ - | | | - | | additional non-auto trait - | | trait alias used in trait object type (additional use) - | first non-auto trait - | trait alias used in trait object type (first use) +LL | size_of_copy::(); + | ---- ^^^^ + | | | + | | additional non-auto trait + | | trait alias used in trait object type (additional use) + | first non-auto trait + | trait alias used in trait object type (first use) error[E0277]: the trait bound `dyn Misc: std::marker::Copy` is not satisfied --> $DIR/issue-32963.rs:8:5 | -LL | size_of_copy::(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `dyn Misc` +LL | size_of_copy::(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `dyn Misc` | note: required by `size_of_copy` --> $DIR/issue-32963.rs:5:1 diff --git a/src/test/ui/issues/issue-32995.rs b/src/test/ui/issues/issue-32995.rs index c32fb63f1e58..3526deffc79a 100644 --- a/src/test/ui/issues/issue-32995.rs +++ b/src/test/ui/issues/issue-32995.rs @@ -17,11 +17,11 @@ fn main() { //~^ ERROR parenthesized type parameters may only be used with a `Fn` trait //~| WARN previously accepted - let o : Box<::std::marker()::Send> = Box::new(1); + let o : Box = Box::new(1); //~^ ERROR parenthesized type parameters may only be used with a `Fn` trait //~| WARN previously accepted - let o : Box = Box::new(1); + let o : Box = Box::new(1); //~^ ERROR parenthesized type parameters may only be used with a `Fn` trait //~| WARN previously accepted } diff --git a/src/test/ui/issues/issue-32995.stderr b/src/test/ui/issues/issue-32995.stderr index 97b4b7fa76ca..f97d86f6522a 100644 --- a/src/test/ui/issues/issue-32995.stderr +++ b/src/test/ui/issues/issue-32995.stderr @@ -36,19 +36,19 @@ LL | let p = ::std::str::from_utf8::()(b"foo").unwrap(); = note: for more information, see issue #42238 error: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/issue-32995.rs:20:30 + --> $DIR/issue-32995.rs:20:35 | -LL | let o : Box<::std::marker()::Send> = Box::new(1); - | ^^ +LL | let o : Box = Box::new(1); + | ^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #42238 error: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/issue-32995.rs:24:37 + --> $DIR/issue-32995.rs:24:41 | -LL | let o : Box = Box::new(1); - | ^^ +LL | let o : Box = Box::new(1); + | ^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #42238 diff --git a/src/test/ui/issues/issue-33140-traitobject-crate.rs b/src/test/ui/issues/issue-33140-traitobject-crate.rs index 2b644817df11..078f3f3dd2cd 100644 --- a/src/test/ui/issues/issue-33140-traitobject-crate.rs +++ b/src/test/ui/issues/issue-33140-traitobject-crate.rs @@ -13,85 +13,85 @@ /// Implementations for all traits in std are provided. pub unsafe trait Trait {} -unsafe impl Trait for ::std::any::Any + Send { } -unsafe impl Trait for ::std::any::Any + Sync { } -unsafe impl Trait for ::std::any::Any + Send + Sync { } -unsafe impl Trait for ::std::borrow::Borrow + Send { } -unsafe impl Trait for ::std::borrow::Borrow + Sync { } -unsafe impl Trait for ::std::borrow::Borrow + Send + Sync { } -unsafe impl Trait for ::std::borrow::BorrowMut + Send { } -unsafe impl Trait for ::std::borrow::BorrowMut + Sync { } -unsafe impl Trait for ::std::borrow::BorrowMut + Send + Sync { } -unsafe impl Trait for ::std::convert::AsMut + Send { } -unsafe impl Trait for ::std::convert::AsMut + Sync { } -unsafe impl Trait for ::std::convert::AsMut + Send + Sync { } -unsafe impl Trait for ::std::convert::AsRef + Send { } -unsafe impl Trait for ::std::convert::AsRef + Sync { } -unsafe impl Trait for ::std::convert::AsRef + Send + Sync { } -unsafe impl Trait for ::std::error::Error + Send { } -unsafe impl Trait for ::std::error::Error + Sync { } -unsafe impl Trait for ::std::error::Error + Send + Sync { } -unsafe impl Trait for ::std::fmt::Binary + Send { } -unsafe impl Trait for ::std::fmt::Binary + Sync { } -unsafe impl Trait for ::std::fmt::Binary + Send + Sync { } -unsafe impl Trait for ::std::fmt::Debug + Send { } -unsafe impl Trait for ::std::fmt::Debug + Sync { } -unsafe impl Trait for ::std::fmt::Debug + Send + Sync { } -unsafe impl Trait for ::std::fmt::Display + Send { } -unsafe impl Trait for ::std::fmt::Display + Sync { } -unsafe impl Trait for ::std::fmt::Display + Send + Sync { } -unsafe impl Trait for ::std::fmt::LowerExp + Send { } -unsafe impl Trait for ::std::fmt::LowerExp + Sync { } -unsafe impl Trait for ::std::fmt::LowerExp + Send + Sync { } -unsafe impl Trait for ::std::fmt::LowerHex + Send { } -unsafe impl Trait for ::std::fmt::LowerHex + Sync { } -unsafe impl Trait for ::std::fmt::LowerHex + Send + Sync { } -unsafe impl Trait for ::std::fmt::Octal + Send { } -unsafe impl Trait for ::std::fmt::Octal + Sync { } -unsafe impl Trait for ::std::fmt::Octal + Send + Sync { } -unsafe impl Trait for ::std::fmt::Pointer + Send { } -unsafe impl Trait for ::std::fmt::Pointer + Sync { } -unsafe impl Trait for ::std::fmt::Pointer + Send + Sync { } -unsafe impl Trait for ::std::fmt::UpperExp + Send { } -unsafe impl Trait for ::std::fmt::UpperExp + Sync { } -unsafe impl Trait for ::std::fmt::UpperExp + Send + Sync { } -unsafe impl Trait for ::std::fmt::UpperHex + Send { } -unsafe impl Trait for ::std::fmt::UpperHex + Sync { } -unsafe impl Trait for ::std::fmt::UpperHex + Send + Sync { } -unsafe impl Trait for ::std::fmt::Write + Send { } -unsafe impl Trait for ::std::fmt::Write + Sync { } -unsafe impl Trait for ::std::fmt::Write + Send + Sync { } -unsafe impl Trait for ::std::hash::Hasher + Send { } -unsafe impl Trait for ::std::hash::Hasher + Sync { } -unsafe impl Trait for ::std::hash::Hasher + Send + Sync { } -unsafe impl Trait for ::std::io::BufRead + Send { } -unsafe impl Trait for ::std::io::BufRead + Sync { } -unsafe impl Trait for ::std::io::BufRead + Send + Sync { } -unsafe impl Trait for ::std::io::Read + Send { } -unsafe impl Trait for ::std::io::Read + Sync { } -unsafe impl Trait for ::std::io::Read + Send + Sync { } -unsafe impl Trait for ::std::io::Seek + Send { } -unsafe impl Trait for ::std::io::Seek + Sync { } -unsafe impl Trait for ::std::io::Seek + Send + Sync { } -unsafe impl Trait for ::std::io::Write + Send { } -unsafe impl Trait for ::std::io::Write + Sync { } -unsafe impl Trait for ::std::io::Write + Send + Sync { } -unsafe impl Trait for ::std::iter::IntoIterator { } -unsafe impl Trait for ::std::iter::Iterator + Send { } -unsafe impl Trait for ::std::iter::Iterator + Sync { } -unsafe impl Trait for ::std::iter::Iterator + Send + Sync { } -unsafe impl Trait for ::std::marker::Send + Send { } -unsafe impl Trait for ::std::marker::Send + Sync { } -unsafe impl Trait for ::std::marker::Send + Send + Sync { } -unsafe impl Trait for ::std::marker::Sync + Send { } -unsafe impl Trait for ::std::marker::Sync + Sync { } -unsafe impl Trait for ::std::marker::Sync + Send + Sync { } -unsafe impl Trait for ::std::ops::Drop + Send { } -unsafe impl Trait for ::std::ops::Drop + Sync { } -unsafe impl Trait for ::std::ops::Drop + Send + Sync { } -unsafe impl Trait for ::std::string::ToString + Send { } -unsafe impl Trait for ::std::string::ToString + Sync { } -unsafe impl Trait for ::std::string::ToString + Send + Sync { } +unsafe impl Trait for dyn (::std::any::Any) + Send { } +unsafe impl Trait for dyn (::std::any::Any) + Sync { } +unsafe impl Trait for dyn (::std::any::Any) + Send + Sync { } +unsafe impl Trait for dyn (::std::borrow::Borrow) + Send { } +unsafe impl Trait for dyn (::std::borrow::Borrow) + Sync { } +unsafe impl Trait for dyn (::std::borrow::Borrow) + Send + Sync { } +unsafe impl Trait for dyn (::std::borrow::BorrowMut) + Send { } +unsafe impl Trait for dyn (::std::borrow::BorrowMut) + Sync { } +unsafe impl Trait for dyn (::std::borrow::BorrowMut) + Send + Sync { } +unsafe impl Trait for dyn (::std::convert::AsMut) + Send { } +unsafe impl Trait for dyn (::std::convert::AsMut) + Sync { } +unsafe impl Trait for dyn (::std::convert::AsMut) + Send + Sync { } +unsafe impl Trait for dyn (::std::convert::AsRef) + Send { } +unsafe impl Trait for dyn (::std::convert::AsRef) + Sync { } +unsafe impl Trait for dyn (::std::convert::AsRef) + Send + Sync { } +unsafe impl Trait for dyn (::std::error::Error) + Send { } +unsafe impl Trait for dyn (::std::error::Error) + Sync { } +unsafe impl Trait for dyn (::std::error::Error) + Send + Sync { } +unsafe impl Trait for dyn (::std::fmt::Binary) + Send { } +unsafe impl Trait for dyn (::std::fmt::Binary) + Sync { } +unsafe impl Trait for dyn (::std::fmt::Binary) + Send + Sync { } +unsafe impl Trait for dyn (::std::fmt::Debug) + Send { } +unsafe impl Trait for dyn (::std::fmt::Debug) + Sync { } +unsafe impl Trait for dyn (::std::fmt::Debug) + Send + Sync { } +unsafe impl Trait for dyn (::std::fmt::Display) + Send { } +unsafe impl Trait for dyn (::std::fmt::Display) + Sync { } +unsafe impl Trait for dyn (::std::fmt::Display) + Send + Sync { } +unsafe impl Trait for dyn (::std::fmt::LowerExp) + Send { } +unsafe impl Trait for dyn (::std::fmt::LowerExp) + Sync { } +unsafe impl Trait for dyn (::std::fmt::LowerExp) + Send + Sync { } +unsafe impl Trait for dyn (::std::fmt::LowerHex) + Send { } +unsafe impl Trait for dyn (::std::fmt::LowerHex) + Sync { } +unsafe impl Trait for dyn (::std::fmt::LowerHex) + Send + Sync { } +unsafe impl Trait for dyn (::std::fmt::Octal) + Send { } +unsafe impl Trait for dyn (::std::fmt::Octal) + Sync { } +unsafe impl Trait for dyn (::std::fmt::Octal) + Send + Sync { } +unsafe impl Trait for dyn (::std::fmt::Pointer) + Send { } +unsafe impl Trait for dyn (::std::fmt::Pointer) + Sync { } +unsafe impl Trait for dyn (::std::fmt::Pointer) + Send + Sync { } +unsafe impl Trait for dyn (::std::fmt::UpperExp) + Send { } +unsafe impl Trait for dyn (::std::fmt::UpperExp) + Sync { } +unsafe impl Trait for dyn (::std::fmt::UpperExp) + Send + Sync { } +unsafe impl Trait for dyn (::std::fmt::UpperHex) + Send { } +unsafe impl Trait for dyn (::std::fmt::UpperHex) + Sync { } +unsafe impl Trait for dyn (::std::fmt::UpperHex) + Send + Sync { } +unsafe impl Trait for dyn (::std::fmt::Write) + Send { } +unsafe impl Trait for dyn (::std::fmt::Write) + Sync { } +unsafe impl Trait for dyn (::std::fmt::Write) + Send + Sync { } +unsafe impl Trait for dyn (::std::hash::Hasher) + Send { } +unsafe impl Trait for dyn (::std::hash::Hasher) + Sync { } +unsafe impl Trait for dyn (::std::hash::Hasher) + Send + Sync { } +unsafe impl Trait for dyn (::std::io::BufRead) + Send { } +unsafe impl Trait for dyn (::std::io::BufRead) + Sync { } +unsafe impl Trait for dyn (::std::io::BufRead) + Send + Sync { } +unsafe impl Trait for dyn (::std::io::Read) + Send { } +unsafe impl Trait for dyn (::std::io::Read) + Sync { } +unsafe impl Trait for dyn (::std::io::Read) + Send + Sync { } +unsafe impl Trait for dyn (::std::io::Seek) + Send { } +unsafe impl Trait for dyn (::std::io::Seek) + Sync { } +unsafe impl Trait for dyn (::std::io::Seek) + Send + Sync { } +unsafe impl Trait for dyn (::std::io::Write) + Send { } +unsafe impl Trait for dyn (::std::io::Write) + Sync { } +unsafe impl Trait for dyn (::std::io::Write) + Send + Sync { } +unsafe impl Trait for dyn (::std::iter::IntoIterator) { } +unsafe impl Trait for dyn (::std::iter::Iterator) + Send { } +unsafe impl Trait for dyn (::std::iter::Iterator) + Sync { } +unsafe impl Trait for dyn (::std::iter::Iterator) + Send + Sync { } +unsafe impl Trait for dyn (::std::marker::Send) + Send { } +unsafe impl Trait for dyn (::std::marker::Send) + Sync { } +unsafe impl Trait for dyn (::std::marker::Send) + Send + Sync { } +unsafe impl Trait for dyn (::std::marker::Sync) + Send { } +unsafe impl Trait for dyn (::std::marker::Sync) + Sync { } +unsafe impl Trait for dyn (::std::marker::Sync) + Send + Sync { } +unsafe impl Trait for dyn (::std::ops::Drop) + Send { } +unsafe impl Trait for dyn (::std::ops::Drop) + Sync { } +unsafe impl Trait for dyn (::std::ops::Drop) + Send + Sync { } +unsafe impl Trait for dyn (::std::string::ToString) + Send { } +unsafe impl Trait for dyn (::std::string::ToString) + Sync { } +unsafe impl Trait for dyn (::std::string::ToString) + Send + Sync { } fn assert_trait() {} fn main() { diff --git a/src/test/ui/issues/issue-33140-traitobject-crate.stderr b/src/test/ui/issues/issue-33140-traitobject-crate.stderr index 6f71e79d0ee7..76db98aa38bb 100644 --- a/src/test/ui/issues/issue-33140-traitobject-crate.stderr +++ b/src/test/ui/issues/issue-33140-traitobject-crate.stderr @@ -1,10 +1,10 @@ warning: conflicting implementations of trait `Trait` for type `(dyn std::marker::Send + std::marker::Sync + 'static)`: (E0119) --> $DIR/issue-33140-traitobject-crate.rs:85:1 | -LL | unsafe impl Trait for ::std::marker::Send + Sync { } - | ------------------------------------------------ first implementation here -LL | unsafe impl Trait for ::std::marker::Send + Send + Sync { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)` +LL | unsafe impl Trait for dyn (::std::marker::Send) + Sync { } + | ------------------------------------------------------ first implementation here +LL | unsafe impl Trait for dyn (::std::marker::Send) + Send + Sync { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)` | note: lint level defined here --> $DIR/issue-33140-traitobject-crate.rs:3:9 @@ -17,10 +17,10 @@ LL | #![warn(order_dependent_trait_objects)] warning: conflicting implementations of trait `Trait` for type `(dyn std::marker::Send + std::marker::Sync + 'static)`: (E0119) --> $DIR/issue-33140-traitobject-crate.rs:86:1 | -LL | unsafe impl Trait for ::std::marker::Send + Send + Sync { } - | ------------------------------------------------------- first implementation here -LL | unsafe impl Trait for ::std::marker::Sync + Send { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)` +LL | unsafe impl Trait for dyn (::std::marker::Send) + Send + Sync { } + | ------------------------------------------------------------- first implementation here +LL | unsafe impl Trait for dyn (::std::marker::Sync) + Send { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)` | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #56484 @@ -28,11 +28,11 @@ LL | unsafe impl Trait for ::std::marker::Sync + Send { } warning: conflicting implementations of trait `Trait` for type `(dyn std::marker::Send + std::marker::Sync + 'static)`: (E0119) --> $DIR/issue-33140-traitobject-crate.rs:88:1 | -LL | unsafe impl Trait for ::std::marker::Sync + Send { } - | ------------------------------------------------ first implementation here -LL | unsafe impl Trait for ::std::marker::Sync + Sync { } -LL | unsafe impl Trait for ::std::marker::Sync + Send + Sync { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)` +LL | unsafe impl Trait for dyn (::std::marker::Sync) + Send { } + | ------------------------------------------------------ first implementation here +LL | unsafe impl Trait for dyn (::std::marker::Sync) + Sync { } +LL | unsafe impl Trait for dyn (::std::marker::Sync) + Send + Sync { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)` | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #56484 diff --git a/src/test/ui/issues/issue-33140.rs b/src/test/ui/issues/issue-33140.rs index 930e24218ac7..9bdac4b8375c 100644 --- a/src/test/ui/issues/issue-33140.rs +++ b/src/test/ui/issues/issue-33140.rs @@ -38,10 +38,10 @@ impl Foo { } fn main() { - assert_eq!(::xyz(), false); - assert_eq!(::xyz(), true); - assert_eq!(::uvw(), false); - assert_eq!(::uvw(), true); - assert_eq!(>::abc(), false); - assert_eq!(>::abc(), true); + assert_eq!(::xyz(), false); + assert_eq!(::xyz(), true); + assert_eq!(::uvw(), false); + assert_eq!(::uvw(), true); + assert_eq!(>::abc(), false); + assert_eq!(>::abc(), true); } diff --git a/src/test/ui/issues/issue-33241.rs b/src/test/ui/issues/issue-33241.rs index 4c5052a60d3f..4d6204cb2883 100644 --- a/src/test/ui/issues/issue-33241.rs +++ b/src/test/ui/issues/issue-33241.rs @@ -9,6 +9,6 @@ fn any() -> T { unreachable!() } fn main() { - let t: &(u8, fmt::Debug) = any(); + let t: &(u8, dyn fmt::Debug) = any(); println!("{:?}", &t.1); } diff --git a/src/test/ui/issues/issue-3424.rs b/src/test/ui/issues/issue-3424.rs index a9ba5f5408bd..19f9f13e1441 100644 --- a/src/test/ui/issues/issue-3424.rs +++ b/src/test/ui/issues/issue-3424.rs @@ -5,7 +5,7 @@ pub struct Path; -type rsrc_loader = Box Result>; +type rsrc_loader = Box Result>; fn tester() { diff --git a/src/test/ui/issues/issue-35139.rs b/src/test/ui/issues/issue-35139.rs index 1ee00fc7ec2d..e462f3543735 100644 --- a/src/test/ui/issues/issue-35139.rs +++ b/src/test/ui/issues/issue-35139.rs @@ -7,14 +7,14 @@ pub trait MethodType { pub struct MTFn; impl<'a> MethodType for MTFn { //~ ERROR E0207 - type GetProp = fmt::Debug + 'a; + type GetProp = dyn fmt::Debug + 'a; } -fn bad(a: Box<::GetProp>) -> Box { +fn bad(a: Box<::GetProp>) -> Box { a } -fn dangling(a: &str) -> Box { +fn dangling(a: &str) -> Box { bad(Box::new(a)) } diff --git a/src/test/ui/issues/issue-35546.rs b/src/test/ui/issues/issue-35546.rs index 19c0491e4bc2..500ba48e0b71 100644 --- a/src/test/ui/issues/issue-35546.rs +++ b/src/test/ui/issues/issue-35546.rs @@ -6,11 +6,11 @@ // `value` field of `Node`). struct Node { - next: Option>>, + next: Option>>, value: T, } -fn clear(head: &mut Option>>) { +fn clear(head: &mut Option>>) { match head.take() { Some(node) => *head = node.next, None => (), diff --git a/src/test/ui/issues/issue-35570.rs b/src/test/ui/issues/issue-35570.rs index e809b46bcdca..9bb9db63951c 100644 --- a/src/test/ui/issues/issue-35570.rs +++ b/src/test/ui/issues/issue-35570.rs @@ -8,7 +8,7 @@ trait Trait2<'a> { type Ty; } -fn _ice(param: Box Trait1<<() as Trait2<'a>>::Ty>>) { +fn _ice(param: Box Trait1<<() as Trait2<'a>>::Ty>>) { let _e: (usize, usize) = unsafe{mem::transmute(param)}; } diff --git a/src/test/ui/issues/issue-35976.rs b/src/test/ui/issues/issue-35976.rs index 95c0cc95bb2b..d075794d9946 100644 --- a/src/test/ui/issues/issue-35976.rs +++ b/src/test/ui/issues/issue-35976.rs @@ -3,14 +3,14 @@ mod private { fn wait(&self) where Self: Sized; } - impl Future for Box { + impl Future for Box { fn wait(&self) { } } } //use private::Future; -fn bar(arg: Box) { +fn bar(arg: Box) { arg.wait(); //~^ ERROR the `wait` method cannot be invoked on a trait object } diff --git a/src/test/ui/issues/issue-3609.rs b/src/test/ui/issues/issue-3609.rs index c76c183821e5..9bccb2a21e33 100644 --- a/src/test/ui/issues/issue-3609.rs +++ b/src/test/ui/issues/issue-3609.rs @@ -6,7 +6,7 @@ use std::thread; use std::sync::mpsc::Sender; type RingBuffer = Vec ; -type SamplesFn = Box; +type SamplesFn = Box; enum Msg { diff --git a/src/test/ui/issues/issue-36839.rs b/src/test/ui/issues/issue-36839.rs index 0944d07896e5..a660368f4015 100644 --- a/src/test/ui/issues/issue-36839.rs +++ b/src/test/ui/issues/issue-36839.rs @@ -19,5 +19,5 @@ impl Broken for T { fn main() { - let _m: &Broken = &(); + let _m: &dyn Broken = &(); } diff --git a/src/test/ui/issues/issue-3702-2.rs b/src/test/ui/issues/issue-3702-2.rs index c3a92a23cef5..d47f6d248f70 100644 --- a/src/test/ui/issues/issue-3702-2.rs +++ b/src/test/ui/issues/issue-3702-2.rs @@ -7,12 +7,12 @@ impl ToPrimitive for isize {} trait Add { fn to_int(&self) -> isize; - fn add_dynamic(&self, other: &Add) -> isize; + fn add_dynamic(&self, other: &dyn Add) -> isize; } impl Add for isize { fn to_int(&self) -> isize { *self } - fn add_dynamic(&self, other: &Add) -> isize { + fn add_dynamic(&self, other: &dyn Add) -> isize { self.to_int() + other.to_int() //~ ERROR multiple applicable items in scope } } diff --git a/src/test/ui/issues/issue-37515.rs b/src/test/ui/issues/issue-37515.rs index 090b9bbf1ec4..cc07bd1d9150 100644 --- a/src/test/ui/issues/issue-37515.rs +++ b/src/test/ui/issues/issue-37515.rs @@ -2,7 +2,7 @@ // compile-pass #![warn(unused)] -type Z = for<'x> Send; +type Z = dyn for<'x> Send; //~^ WARN type alias is never used diff --git a/src/test/ui/issues/issue-37515.stderr b/src/test/ui/issues/issue-37515.stderr index 1b4965594848..1476d17cdc64 100644 --- a/src/test/ui/issues/issue-37515.stderr +++ b/src/test/ui/issues/issue-37515.stderr @@ -1,8 +1,8 @@ warning: type alias is never used: `Z` --> $DIR/issue-37515.rs:5:1 | -LL | type Z = for<'x> Send; - | ^^^^^^^^^^^^^^^^^^^^^^ +LL | type Z = dyn for<'x> Send; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here --> $DIR/issue-37515.rs:3:9 diff --git a/src/test/ui/issues/issue-38404.rs b/src/test/ui/issues/issue-38404.rs index cddd75e267c4..1a92acc34042 100644 --- a/src/test/ui/issues/issue-38404.rs +++ b/src/test/ui/issues/issue-38404.rs @@ -1,6 +1,6 @@ trait A: std::ops::Add + Sized {} trait B: A {} -trait C: A> {} +trait C: A> {} //~^ ERROR the trait `B` cannot be made into an object fn main() {} diff --git a/src/test/ui/issues/issue-38404.stderr b/src/test/ui/issues/issue-38404.stderr index 06bcf220f183..d18a26b3a763 100644 --- a/src/test/ui/issues/issue-38404.stderr +++ b/src/test/ui/issues/issue-38404.stderr @@ -1,8 +1,8 @@ error[E0038]: the trait `B` cannot be made into an object --> $DIR/issue-38404.rs:3:15 | -LL | trait C: A> {} - | ^^^^^^^^^^^^^^^^^^ the trait `B` cannot be made into an object +LL | trait C: A> {} + | ^^^^^^^^^^^^^^^^^^^^^^ the trait `B` cannot be made into an object | = note: the trait cannot use `Self` as a type parameter in the supertraits or where-clauses diff --git a/src/test/ui/issues/issue-38604.rs b/src/test/ui/issues/issue-38604.rs index c172595a245c..002a3c43fcba 100644 --- a/src/test/ui/issues/issue-38604.rs +++ b/src/test/ui/issues/issue-38604.rs @@ -11,6 +11,6 @@ impl Foo for () { } fn main() { - let _f: Box = //~ ERROR `Foo` cannot be made into an object + let _f: Box = //~ ERROR `Foo` cannot be made into an object Box::new(()); //~ ERROR `Foo` cannot be made into an object } diff --git a/src/test/ui/issues/issue-38604.stderr b/src/test/ui/issues/issue-38604.stderr index 77b42b80613c..8ef7d346cb33 100644 --- a/src/test/ui/issues/issue-38604.stderr +++ b/src/test/ui/issues/issue-38604.stderr @@ -1,8 +1,8 @@ error[E0038]: the trait `Foo` cannot be made into an object --> $DIR/issue-38604.rs:14:13 | -LL | let _f: Box = - | ^^^^^^^^ the trait `Foo` cannot be made into an object +LL | let _f: Box = + | ^^^^^^^^^^^^ the trait `Foo` cannot be made into an object | = note: the trait cannot use `Self` as a type parameter in the supertraits or where-clauses diff --git a/src/test/ui/issues/issue-40000.rs b/src/test/ui/issues/issue-40000.rs index 320992c0764c..9d5ef481afc3 100644 --- a/src/test/ui/issues/issue-40000.rs +++ b/src/test/ui/issues/issue-40000.rs @@ -1,7 +1,7 @@ fn main() { let bar: fn(&mut u32) = |_| {}; - fn foo(x: Box) {} - let bar = Box::new(|x: &i32| {}) as Box; + fn foo(x: Box) {} + let bar = Box::new(|x: &i32| {}) as Box; foo(bar); //~ ERROR E0308 } diff --git a/src/test/ui/issues/issue-41139.rs b/src/test/ui/issues/issue-41139.rs index f3e6c44ecb92..4814232607cf 100644 --- a/src/test/ui/issues/issue-41139.rs +++ b/src/test/ui/issues/issue-41139.rs @@ -1,8 +1,8 @@ trait Trait {} -fn get_function<'a>() -> &'a Fn() -> Trait { panic!("") } +fn get_function<'a>() -> &'a dyn Fn() -> dyn Trait { panic!("") } fn main() { - let t : &Trait = &get_function()(); + let t : &dyn Trait = &get_function()(); //~^ ERROR cannot move a value of type dyn Trait } diff --git a/src/test/ui/issues/issue-41139.stderr b/src/test/ui/issues/issue-41139.stderr index 4dd017b0a919..829d0cfa72ca 100644 --- a/src/test/ui/issues/issue-41139.stderr +++ b/src/test/ui/issues/issue-41139.stderr @@ -1,8 +1,8 @@ error[E0161]: cannot move a value of type dyn Trait: the size of dyn Trait cannot be statically determined - --> $DIR/issue-41139.rs:6:23 + --> $DIR/issue-41139.rs:6:27 | -LL | let t : &Trait = &get_function()(); - | ^^^^^^^^^^^^^^^^ +LL | let t : &dyn Trait = &get_function()(); + | ^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-42312.rs b/src/test/ui/issues/issue-42312.rs index b1c651f665b7..426efcbf9b16 100644 --- a/src/test/ui/issues/issue-42312.rs +++ b/src/test/ui/issues/issue-42312.rs @@ -5,7 +5,7 @@ pub trait Foo { //~^ ERROR the size for values of type } -pub fn f(_: ToString) {} +pub fn f(_: dyn ToString) {} //~^ ERROR the size for values of type fn main() { } diff --git a/src/test/ui/issues/issue-42312.stderr b/src/test/ui/issues/issue-42312.stderr index 20c8d085cbc6..bfdc4272fb30 100644 --- a/src/test/ui/issues/issue-42312.stderr +++ b/src/test/ui/issues/issue-42312.stderr @@ -11,10 +11,10 @@ LL | fn baz(_: Self::Target) where Self: Deref {} = help: unsized locals are gated as an unstable feature error[E0277]: the size for values of type `(dyn std::string::ToString + 'static)` cannot be known at compilation time - --> $DIR/issue-42312.rs:8:23 + --> $DIR/issue-42312.rs:8:27 | -LL | pub fn f(_: ToString) {} - | ^ doesn't have a size known at compile-time +LL | pub fn f(_: dyn ToString) {} + | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn std::string::ToString + 'static)` = note: to learn more, visit diff --git a/src/test/ui/issues/issue-4335.rs b/src/test/ui/issues/issue-4335.rs index d3c9954cdb05..a10ae9a1243a 100644 --- a/src/test/ui/issues/issue-4335.rs +++ b/src/test/ui/issues/issue-4335.rs @@ -2,7 +2,7 @@ fn id(t: T) -> T { t } -fn f<'r, T>(v: &'r T) -> Box T + 'r> { +fn f<'r, T>(v: &'r T) -> Box T + 'r> { id(Box::new(|| *v)) //~^ ERROR E0373 //~| ERROR E0507 diff --git a/src/test/ui/issues/issue-4335.stderr b/src/test/ui/issues/issue-4335.stderr index 1b5cab249291..f1b6e475949d 100644 --- a/src/test/ui/issues/issue-4335.stderr +++ b/src/test/ui/issues/issue-4335.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of captured variable in an `FnMut` closure --> $DIR/issue-4335.rs:6:20 | -LL | fn f<'r, T>(v: &'r T) -> Box T + 'r> { +LL | fn f<'r, T>(v: &'r T) -> Box T + 'r> { | - captured outer variable LL | id(Box::new(|| *v)) | ^^ cannot move out of captured variable in an `FnMut` closure diff --git a/src/test/ui/issues/issue-45730.rs b/src/test/ui/issues/issue-45730.rs index 5709125e5f01..3776759fe07a 100644 --- a/src/test/ui/issues/issue-45730.rs +++ b/src/test/ui/issues/issue-45730.rs @@ -3,7 +3,7 @@ fn main() { let x: *const _ = 0 as _; //~ ERROR cannot cast let x: *const _ = 0 as *const _; //~ ERROR cannot cast - let y: Option<*const fmt::Debug> = Some(x) as _; + let y: Option<*const dyn fmt::Debug> = Some(x) as _; let x = 0 as *const i32 as *const _ as *mut _; //~ ERROR cannot cast } diff --git a/src/test/ui/issues/issue-4972.rs b/src/test/ui/issues/issue-4972.rs index 9c95a9794766..fab258f137e6 100644 --- a/src/test/ui/issues/issue-4972.rs +++ b/src/test/ui/issues/issue-4972.rs @@ -6,10 +6,10 @@ trait MyTrait { } pub enum TraitWrapper { - A(Box), + A(Box), } -fn get_tw_map(tw: &TraitWrapper) -> &MyTrait { +fn get_tw_map(tw: &TraitWrapper) -> &dyn MyTrait { match *tw { TraitWrapper::A(box ref map) => map, //~ ERROR cannot be dereferenced } diff --git a/src/test/ui/issues/issue-50761.rs b/src/test/ui/issues/issue-50761.rs index bcf3ebcd60a5..70b4bc8b755a 100644 --- a/src/test/ui/issues/issue-50761.rs +++ b/src/test/ui/issues/issue-50761.rs @@ -14,7 +14,7 @@ mod b { } impl Builder { - pub fn with_a(&mut self, _a: fn() -> ::a::A) {} + pub fn with_a(&mut self, _a: fn() -> dyn (::a::A)) {} } } diff --git a/src/test/ui/issues/issue-50781.rs b/src/test/ui/issues/issue-50781.rs index edf8d82b4805..3c5e5a9f69af 100644 --- a/src/test/ui/issues/issue-50781.rs +++ b/src/test/ui/issues/issue-50781.rs @@ -15,5 +15,5 @@ impl Trait for dyn X {} pub fn main() { // Check that this does not segfault. - ::foo(&()); + ::foo(&()); } diff --git a/src/test/ui/issues/issue-5153.rs b/src/test/ui/issues/issue-5153.rs index 551880ae009f..e6737662088f 100644 --- a/src/test/ui/issues/issue-5153.rs +++ b/src/test/ui/issues/issue-5153.rs @@ -7,6 +7,6 @@ impl Foo for isize { } fn main() { - (&5isize as &Foo).foo(); + (&5isize as &dyn Foo).foo(); //~^ ERROR: no method named `foo` found for type `&dyn Foo` in the current scope } diff --git a/src/test/ui/issues/issue-5153.stderr b/src/test/ui/issues/issue-5153.stderr index 48adfee0dec0..97214fbdc52d 100644 --- a/src/test/ui/issues/issue-5153.stderr +++ b/src/test/ui/issues/issue-5153.stderr @@ -1,8 +1,8 @@ error[E0599]: no method named `foo` found for type `&dyn Foo` in the current scope - --> $DIR/issue-5153.rs:10:23 + --> $DIR/issue-5153.rs:10:27 | -LL | (&5isize as &Foo).foo(); - | ^^^ +LL | (&5isize as &dyn Foo).foo(); + | ^^^ | = help: items from traits can only be used if the trait is implemented and in scope = note: the following trait defines an item `foo`, perhaps you need to implement it: diff --git a/src/test/ui/issues/issue-5216.rs b/src/test/ui/issues/issue-5216.rs index fd490884fa1f..35b343edfbdb 100644 --- a/src/test/ui/issues/issue-5216.rs +++ b/src/test/ui/issues/issue-5216.rs @@ -1,10 +1,10 @@ fn f() { } -struct S(Box); +struct S(Box); pub static C: S = S(f); //~ ERROR mismatched types fn g() { } -type T = Box; +type T = Box; pub static D: T = g; //~ ERROR mismatched types fn main() {} diff --git a/src/test/ui/issues/issue-53419.rs b/src/test/ui/issues/issue-53419.rs index 52149cf486dc..bf6791734d4e 100644 --- a/src/test/ui/issues/issue-53419.rs +++ b/src/test/ui/issues/issue-53419.rs @@ -1,7 +1,7 @@ //compile-pass struct Foo { - bar: for<'r> Fn(usize, &'r FnMut()) + bar: dyn for<'r> Fn(usize, &'r dyn FnMut()) } fn main() { diff --git a/src/test/ui/issues/issue-54582.rs b/src/test/ui/issues/issue-54582.rs index c2dbf361911b..8c50cac67f8f 100644 --- a/src/test/ui/issues/issue-54582.rs +++ b/src/test/ui/issues/issue-54582.rs @@ -9,7 +9,7 @@ pub enum Enum { impl Stage for Enum {} -pub static ARRAY: [(&Stage, &str); 1] = [ +pub static ARRAY: [(&dyn Stage, &str); 1] = [ (&Enum::A, ""), ]; diff --git a/src/test/ui/issues/issue-55796.rs b/src/test/ui/issues/issue-55796.rs index efdea5c9b1e1..088d4301c51b 100644 --- a/src/test/ui/issues/issue-55796.rs +++ b/src/test/ui/issues/issue-55796.rs @@ -12,12 +12,12 @@ pub trait Graph<'a> { fn out_edges(&'a self, u: &Self::Node) -> Self::EdgesIter; fn in_edges(&'a self, u: &Self::Node) -> Self::EdgesIter; - fn out_neighbors(&'a self, u: &Self::Node) -> Box> { + fn out_neighbors(&'a self, u: &Self::Node) -> Box> { Box::new(self.out_edges(u).map(|e| e.target())) //~^ ERROR cannot infer } - fn in_neighbors(&'a self, u: &Self::Node) -> Box> { + fn in_neighbors(&'a self, u: &Self::Node) -> Box> { Box::new(self.in_edges(u).map(|e| e.target())) //~^ ERROR cannot infer } diff --git a/src/test/ui/issues/issue-5883.rs b/src/test/ui/issues/issue-5883.rs index b4a73ba99c57..0de535023972 100644 --- a/src/test/ui/issues/issue-5883.rs +++ b/src/test/ui/issues/issue-5883.rs @@ -1,10 +1,10 @@ trait A {} struct Struct { - r: A+'static + r: dyn A + 'static } -fn new_struct(r: A+'static) +fn new_struct(r: dyn A + 'static) -> Struct { //~^ ERROR the size for values of type //~^ ERROR the size for values of type Struct { r: r } diff --git a/src/test/ui/issues/issue-5883.stderr b/src/test/ui/issues/issue-5883.stderr index 7753881f7368..c2de1d095505 100644 --- a/src/test/ui/issues/issue-5883.stderr +++ b/src/test/ui/issues/issue-5883.stderr @@ -1,7 +1,7 @@ error[E0277]: the size for values of type `(dyn A + 'static)` cannot be known at compilation time --> $DIR/issue-5883.rs:7:15 | -LL | fn new_struct(r: A+'static) +LL | fn new_struct(r: dyn A + 'static) | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn A + 'static)` diff --git a/src/test/ui/issues/issue-60989.rs b/src/test/ui/issues/issue-60989.rs index 930e98bedce8..6dae1e1347b7 100644 --- a/src/test/ui/issues/issue-60989.rs +++ b/src/test/ui/issues/issue-60989.rs @@ -13,6 +13,6 @@ fn main() { //~^ ERROR type arguments are not allowed for this type let c1 = A {}; - c1::>; + c1::>; //~^ ERROR type arguments are not allowed for this type } diff --git a/src/test/ui/issues/issue-60989.stderr b/src/test/ui/issues/issue-60989.stderr index 55a0b9626df7..5d2d9e83c9b9 100644 --- a/src/test/ui/issues/issue-60989.stderr +++ b/src/test/ui/issues/issue-60989.stderr @@ -7,8 +7,8 @@ LL | c1::<()>; error[E0109]: type arguments are not allowed for this type --> $DIR/issue-60989.rs:16:10 | -LL | c1::>; - | ^^^^^^^ type argument not allowed +LL | c1::>; + | ^^^^^^^^^^^ type argument not allowed error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-7013.rs b/src/test/ui/issues/issue-7013.rs index ee68aa8623b3..3d72b67e391c 100644 --- a/src/test/ui/issues/issue-7013.rs +++ b/src/test/ui/issues/issue-7013.rs @@ -19,10 +19,10 @@ impl Foo for B { } struct A { - v: Box, + v: Box, } fn main() { - let a = A {v: box B{v: None} as Box}; + let a = A {v: box B{v: None} as Box}; //~^ ERROR `std::rc::Rc>` cannot be sent between threads safely } diff --git a/src/test/ui/issues/issue-7013.stderr b/src/test/ui/issues/issue-7013.stderr index 22185c7da344..f2668d331228 100644 --- a/src/test/ui/issues/issue-7013.stderr +++ b/src/test/ui/issues/issue-7013.stderr @@ -1,7 +1,7 @@ error[E0277]: `std::rc::Rc>` cannot be sent between threads safely --> $DIR/issue-7013.rs:26:19 | -LL | let a = A {v: box B{v: None} as Box}; +LL | let a = A {v: box B{v: None} as Box}; | ^^^^^^^^^^^^^^ `std::rc::Rc>` cannot be sent between threads safely | = help: within `B`, the trait `std::marker::Send` is not implemented for `std::rc::Rc>` diff --git a/src/test/ui/issues/issue-7673-cast-generically-implemented-trait.rs b/src/test/ui/issues/issue-7673-cast-generically-implemented-trait.rs index 7dd6b07177f9..619256c78719 100644 --- a/src/test/ui/issues/issue-7673-cast-generically-implemented-trait.rs +++ b/src/test/ui/issues/issue-7673-cast-generically-implemented-trait.rs @@ -18,5 +18,5 @@ trait A { impl A for T {} -fn owned2(a: Box) { a as Box; } -fn owned3(a: Box) { box a as Box; } +fn owned2(a: Box) { a as Box; } +fn owned3(a: Box) { box a as Box; } diff --git a/src/test/ui/issues/issue-8398.rs b/src/test/ui/issues/issue-8398.rs index bd37b8582b20..a65c667b08e4 100644 --- a/src/test/ui/issues/issue-8398.rs +++ b/src/test/ui/issues/issue-8398.rs @@ -6,7 +6,7 @@ pub trait Writer { fn write(&mut self, b: &[u8]) -> Result<(), ()>; } -fn foo(a: &mut Writer) { +fn foo(a: &mut dyn Writer) { a.write(&[]).unwrap(); } diff --git a/src/test/ui/issues/issue-9719.rs b/src/test/ui/issues/issue-9719.rs index 96865344e746..1e38ab9c6c2a 100644 --- a/src/test/ui/issues/issue-9719.rs +++ b/src/test/ui/issues/issue-9719.rs @@ -12,8 +12,8 @@ mod a { } impl X for isize {} - pub struct Z<'a>(Enum<&'a (X+'a)>); - fn foo() { let x: isize = 42; let z = Z(Enum::A(&x as &X)); let _ = z; } + pub struct Z<'a>(Enum<&'a (dyn X + 'a)>); + fn foo() { let x: isize = 42; let z = Z(Enum::A(&x as &dyn X)); let _ = z; } } mod b { @@ -22,20 +22,20 @@ mod b { } impl X for isize {} struct Y<'a>{ - x:Option<&'a (X+'a)>, + x:Option<&'a (dyn X + 'a)>, } fn bar() { let x: isize = 42; - let _y = Y { x: Some(&x as &X) }; + let _y = Y { x: Some(&x as &dyn X) }; } } mod c { pub trait X { fn f(&self); } impl X for isize { fn f(&self) {} } - pub struct Z<'a>(Option<&'a (X+'a)>); - fn main() { let x: isize = 42; let z = Z(Some(&x as &X)); let _ = z; } + pub struct Z<'a>(Option<&'a (dyn X + 'a)>); + fn main() { let x: isize = 42; let z = Z(Some(&x as &dyn X)); let _ = z; } } pub fn main() {} diff --git a/src/test/ui/kindck/kindck-copy.rs b/src/test/ui/kindck/kindck-copy.rs index dadeb9569644..eb18613682f6 100644 --- a/src/test/ui/kindck/kindck-copy.rs +++ b/src/test/ui/kindck/kindck-copy.rs @@ -34,16 +34,16 @@ fn test<'a,T,U:Copy>(_: &'a isize) { assert_copy::>(); //~ ERROR : std::marker::Copy` is not satisfied // borrowed object types are generally ok - assert_copy::<&'a Dummy>(); - assert_copy::<&'a (Dummy+Send)>(); - assert_copy::<&'static (Dummy+Send)>(); + assert_copy::<&'a dyn Dummy>(); + assert_copy::<&'a (dyn Dummy + Send)>(); + assert_copy::<&'static (dyn Dummy + Send)>(); // owned object types are not ok - assert_copy::>(); //~ ERROR : std::marker::Copy` is not satisfied - assert_copy::>(); //~ ERROR : std::marker::Copy` is not satisfied + assert_copy::>(); //~ ERROR : std::marker::Copy` is not satisfied + assert_copy::>(); //~ ERROR : std::marker::Copy` is not satisfied // mutable object types are not ok - assert_copy::<&'a mut (Dummy+Send)>(); //~ ERROR : std::marker::Copy` is not satisfied + assert_copy::<&'a mut (dyn Dummy + Send)>(); //~ ERROR : std::marker::Copy` is not satisfied // unsafe ptrs are ok assert_copy::<*const isize>(); diff --git a/src/test/ui/kindck/kindck-copy.stderr b/src/test/ui/kindck/kindck-copy.stderr index 2680cb7c012f..929a80765620 100644 --- a/src/test/ui/kindck/kindck-copy.stderr +++ b/src/test/ui/kindck/kindck-copy.stderr @@ -77,8 +77,8 @@ LL | fn assert_copy() { } error[E0277]: the trait bound `std::boxed::Box: std::marker::Copy` is not satisfied --> $DIR/kindck-copy.rs:42:5 | -LL | assert_copy::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::boxed::Box` +LL | assert_copy::>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::boxed::Box` | note: required by `assert_copy` --> $DIR/kindck-copy.rs:5:1 @@ -89,8 +89,8 @@ LL | fn assert_copy() { } error[E0277]: the trait bound `std::boxed::Box: std::marker::Copy` is not satisfied --> $DIR/kindck-copy.rs:43:5 | -LL | assert_copy::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::boxed::Box` +LL | assert_copy::>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::boxed::Box` | note: required by `assert_copy` --> $DIR/kindck-copy.rs:5:1 @@ -101,8 +101,8 @@ LL | fn assert_copy() { } error[E0277]: the trait bound `&'a mut (dyn Dummy + std::marker::Send + 'a): std::marker::Copy` is not satisfied --> $DIR/kindck-copy.rs:46:5 | -LL | assert_copy::<&'a mut (Dummy+Send)>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `&'a mut (dyn Dummy + std::marker::Send + 'a)` +LL | assert_copy::<&'a mut (dyn Dummy + Send)>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `&'a mut (dyn Dummy + std::marker::Send + 'a)` | note: required by `assert_copy` --> $DIR/kindck-copy.rs:5:1 diff --git a/src/test/ui/kindck/kindck-impl-type-params.nll.stderr b/src/test/ui/kindck/kindck-impl-type-params.nll.stderr index c1f662fda610..25d0e74187f7 100644 --- a/src/test/ui/kindck/kindck-impl-type-params.nll.stderr +++ b/src/test/ui/kindck/kindck-impl-type-params.nll.stderr @@ -1,7 +1,7 @@ error[E0277]: `T` cannot be sent between threads safely --> $DIR/kindck-impl-type-params.rs:18:13 | -LL | let a = &t as &Gettable; +LL | let a = &t as &dyn Gettable; | ^^ `T` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `T` @@ -12,7 +12,7 @@ LL | let a = &t as &Gettable; error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied --> $DIR/kindck-impl-type-params.rs:18:13 | -LL | let a = &t as &Gettable; +LL | let a = &t as &dyn Gettable; | ^^ the trait `std::marker::Copy` is not implemented for `T` | = help: consider adding a `where T: std::marker::Copy` bound @@ -20,10 +20,10 @@ LL | let a = &t as &Gettable; = note: required for the cast to the object type `dyn Gettable` error[E0277]: `T` cannot be sent between threads safely - --> $DIR/kindck-impl-type-params.rs:25:27 + --> $DIR/kindck-impl-type-params.rs:25:31 | -LL | let a: &Gettable = &t; - | ^^ `T` cannot be sent between threads safely +LL | let a: &dyn Gettable = &t; + | ^^ `T` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `T` = help: consider adding a `where T: std::marker::Send` bound @@ -31,10 +31,10 @@ LL | let a: &Gettable = &t; = note: required for the cast to the object type `dyn Gettable` error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied - --> $DIR/kindck-impl-type-params.rs:25:27 + --> $DIR/kindck-impl-type-params.rs:25:31 | -LL | let a: &Gettable = &t; - | ^^ the trait `std::marker::Copy` is not implemented for `T` +LL | let a: &dyn Gettable = &t; + | ^^ the trait `std::marker::Copy` is not implemented for `T` | = help: consider adding a `where T: std::marker::Copy` bound = note: required because of the requirements on the impl of `Gettable` for `S` @@ -43,17 +43,17 @@ LL | let a: &Gettable = &t; error[E0277]: the trait bound `std::string::String: std::marker::Copy` is not satisfied --> $DIR/kindck-impl-type-params.rs:38:13 | -LL | let a = t as Box>; +LL | let a = t as Box>; | ^ the trait `std::marker::Copy` is not implemented for `std::string::String` | = note: required because of the requirements on the impl of `Gettable` for `S` = note: required for the cast to the object type `dyn Gettable` error[E0277]: the trait bound `foo3::Foo: std::marker::Copy` is not satisfied - --> $DIR/kindck-impl-type-params.rs:46:33 + --> $DIR/kindck-impl-type-params.rs:46:37 | -LL | let a: Box> = t; - | ^ the trait `std::marker::Copy` is not implemented for `foo3::Foo` +LL | let a: Box> = t; + | ^ the trait `std::marker::Copy` is not implemented for `foo3::Foo` | = note: required because of the requirements on the impl of `Gettable` for `S` = note: required for the cast to the object type `dyn Gettable` diff --git a/src/test/ui/kindck/kindck-impl-type-params.rs b/src/test/ui/kindck/kindck-impl-type-params.rs index a47e418709dc..c4f90f36acfc 100644 --- a/src/test/ui/kindck/kindck-impl-type-params.rs +++ b/src/test/ui/kindck/kindck-impl-type-params.rs @@ -15,27 +15,27 @@ impl Gettable for S {} fn f(val: T) { let t: S = S(marker::PhantomData); - let a = &t as &Gettable; + let a = &t as &dyn Gettable; //~^ ERROR `T` cannot be sent between threads safely //~| ERROR : std::marker::Copy` is not satisfied } fn g(val: T) { let t: S = S(marker::PhantomData); - let a: &Gettable = &t; + let a: &dyn Gettable = &t; //~^ ERROR `T` cannot be sent between threads safely //~| ERROR : std::marker::Copy` is not satisfied } fn foo<'a>() { let t: S<&'a isize> = S(marker::PhantomData); - let a = &t as &Gettable<&'a isize>; + let a = &t as &dyn Gettable<&'a isize>; //~^ ERROR does not fulfill } fn foo2<'a>() { let t: Box> = box S(marker::PhantomData); - let a = t as Box>; + let a = t as Box>; //~^ ERROR : std::marker::Copy` is not satisfied } @@ -43,7 +43,7 @@ fn foo3<'a>() { struct Foo; // does not impl Copy let t: Box> = box S(marker::PhantomData); - let a: Box> = t; + let a: Box> = t; //~^ ERROR : std::marker::Copy` is not satisfied } diff --git a/src/test/ui/kindck/kindck-impl-type-params.stderr b/src/test/ui/kindck/kindck-impl-type-params.stderr index 8580e6812b41..e6f7088bd463 100644 --- a/src/test/ui/kindck/kindck-impl-type-params.stderr +++ b/src/test/ui/kindck/kindck-impl-type-params.stderr @@ -1,7 +1,7 @@ error[E0277]: `T` cannot be sent between threads safely --> $DIR/kindck-impl-type-params.rs:18:13 | -LL | let a = &t as &Gettable; +LL | let a = &t as &dyn Gettable; | ^^ `T` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `T` @@ -12,7 +12,7 @@ LL | let a = &t as &Gettable; error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied --> $DIR/kindck-impl-type-params.rs:18:13 | -LL | let a = &t as &Gettable; +LL | let a = &t as &dyn Gettable; | ^^ the trait `std::marker::Copy` is not implemented for `T` | = help: consider adding a `where T: std::marker::Copy` bound @@ -20,10 +20,10 @@ LL | let a = &t as &Gettable; = note: required for the cast to the object type `dyn Gettable` error[E0277]: `T` cannot be sent between threads safely - --> $DIR/kindck-impl-type-params.rs:25:27 + --> $DIR/kindck-impl-type-params.rs:25:31 | -LL | let a: &Gettable = &t; - | ^^ `T` cannot be sent between threads safely +LL | let a: &dyn Gettable = &t; + | ^^ `T` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `T` = help: consider adding a `where T: std::marker::Send` bound @@ -31,10 +31,10 @@ LL | let a: &Gettable = &t; = note: required for the cast to the object type `dyn Gettable` error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied - --> $DIR/kindck-impl-type-params.rs:25:27 + --> $DIR/kindck-impl-type-params.rs:25:31 | -LL | let a: &Gettable = &t; - | ^^ the trait `std::marker::Copy` is not implemented for `T` +LL | let a: &dyn Gettable = &t; + | ^^ the trait `std::marker::Copy` is not implemented for `T` | = help: consider adding a `where T: std::marker::Copy` bound = note: required because of the requirements on the impl of `Gettable` for `S` @@ -43,7 +43,7 @@ LL | let a: &Gettable = &t; error[E0477]: the type `&'a isize` does not fulfill the required lifetime --> $DIR/kindck-impl-type-params.rs:32:13 | -LL | let a = &t as &Gettable<&'a isize>; +LL | let a = &t as &dyn Gettable<&'a isize>; | ^^ | = note: type must satisfy the static lifetime @@ -51,17 +51,17 @@ LL | let a = &t as &Gettable<&'a isize>; error[E0277]: the trait bound `std::string::String: std::marker::Copy` is not satisfied --> $DIR/kindck-impl-type-params.rs:38:13 | -LL | let a = t as Box>; +LL | let a = t as Box>; | ^ the trait `std::marker::Copy` is not implemented for `std::string::String` | = note: required because of the requirements on the impl of `Gettable` for `S` = note: required for the cast to the object type `dyn Gettable` error[E0277]: the trait bound `foo3::Foo: std::marker::Copy` is not satisfied - --> $DIR/kindck-impl-type-params.rs:46:33 + --> $DIR/kindck-impl-type-params.rs:46:37 | -LL | let a: Box> = t; - | ^ the trait `std::marker::Copy` is not implemented for `foo3::Foo` +LL | let a: Box> = t; + | ^ the trait `std::marker::Copy` is not implemented for `foo3::Foo` | = note: required because of the requirements on the impl of `Gettable` for `S` = note: required for the cast to the object type `dyn Gettable` diff --git a/src/test/ui/kindck/kindck-inherited-copy-bound.rs b/src/test/ui/kindck/kindck-inherited-copy-bound.rs index 0134636fa0d3..61e72908248d 100644 --- a/src/test/ui/kindck/kindck-inherited-copy-bound.rs +++ b/src/test/ui/kindck/kindck-inherited-copy-bound.rs @@ -21,7 +21,7 @@ fn a() { fn b() { let x: Box<_> = box 3; let y = &x; - let z = &x as &Foo; + let z = &x as &dyn Foo; //~^ ERROR E0038 //~| ERROR E0038 } diff --git a/src/test/ui/kindck/kindck-inherited-copy-bound.stderr b/src/test/ui/kindck/kindck-inherited-copy-bound.stderr index 0ed2da46fbae..1e719e260842 100644 --- a/src/test/ui/kindck/kindck-inherited-copy-bound.stderr +++ b/src/test/ui/kindck/kindck-inherited-copy-bound.stderr @@ -14,15 +14,15 @@ LL | fn take_param(foo: &T) { } error[E0038]: the trait `Foo` cannot be made into an object --> $DIR/kindck-inherited-copy-bound.rs:24:19 | -LL | let z = &x as &Foo; - | ^^^^ the trait `Foo` cannot be made into an object +LL | let z = &x as &dyn Foo; + | ^^^^^^^^ the trait `Foo` cannot be made into an object | = note: the trait cannot require that `Self : Sized` error[E0038]: the trait `Foo` cannot be made into an object --> $DIR/kindck-inherited-copy-bound.rs:24:13 | -LL | let z = &x as &Foo; +LL | let z = &x as &dyn Foo; | ^^ the trait `Foo` cannot be made into an object | = note: the trait cannot require that `Self : Sized` diff --git a/src/test/ui/kindck/kindck-send-object.rs b/src/test/ui/kindck/kindck-send-object.rs index 97f46c3953d5..6411e688b4aa 100644 --- a/src/test/ui/kindck/kindck-send-object.rs +++ b/src/test/ui/kindck/kindck-send-object.rs @@ -9,18 +9,18 @@ trait Message : Send { } // careful with object types, who knows what they close over... fn object_ref_with_static_bound_not_ok() { - assert_send::<&'static (Dummy+'static)>(); + assert_send::<&'static (dyn Dummy + 'static)>(); //~^ ERROR `(dyn Dummy + 'static)` cannot be shared between threads safely [E0277] } fn box_object_with_no_bound_not_ok<'a>() { - assert_send::>(); + assert_send::>(); //~^ ERROR `dyn Dummy` cannot be sent between threads safely } fn object_with_send_bound_ok() { - assert_send::<&'static (Dummy+Sync)>(); - assert_send::>(); + assert_send::<&'static (dyn Dummy + Sync)>(); + assert_send::>(); } fn main() { } diff --git a/src/test/ui/kindck/kindck-send-object.stderr b/src/test/ui/kindck/kindck-send-object.stderr index 8d9935660292..c9aadd85a53f 100644 --- a/src/test/ui/kindck/kindck-send-object.stderr +++ b/src/test/ui/kindck/kindck-send-object.stderr @@ -1,8 +1,8 @@ error[E0277]: `(dyn Dummy + 'static)` cannot be shared between threads safely --> $DIR/kindck-send-object.rs:12:5 | -LL | assert_send::<&'static (Dummy+'static)>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'static)` cannot be shared between threads safely +LL | assert_send::<&'static (dyn Dummy + 'static)>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'static)` cannot be shared between threads safely | = help: the trait `std::marker::Sync` is not implemented for `(dyn Dummy + 'static)` = note: required because of the requirements on the impl of `std::marker::Send` for `&'static (dyn Dummy + 'static)` @@ -15,8 +15,8 @@ LL | fn assert_send() { } error[E0277]: `dyn Dummy` cannot be sent between threads safely --> $DIR/kindck-send-object.rs:17:5 | -LL | assert_send::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ `dyn Dummy` cannot be sent between threads safely +LL | assert_send::>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `dyn Dummy` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `dyn Dummy` = note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique` diff --git a/src/test/ui/kindck/kindck-send-object1.nll.stderr b/src/test/ui/kindck/kindck-send-object1.nll.stderr index 1df7412132bd..998dc90456f1 100644 --- a/src/test/ui/kindck/kindck-send-object1.nll.stderr +++ b/src/test/ui/kindck/kindck-send-object1.nll.stderr @@ -1,8 +1,8 @@ error[E0277]: `(dyn Dummy + 'a)` cannot be shared between threads safely --> $DIR/kindck-send-object1.rs:10:5 | -LL | assert_send::<&'a Dummy>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be shared between threads safely +LL | assert_send::<&'a dyn Dummy>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be shared between threads safely | = help: the trait `std::marker::Sync` is not implemented for `(dyn Dummy + 'a)` = note: required because of the requirements on the impl of `std::marker::Send` for `&'a (dyn Dummy + 'a)` @@ -15,8 +15,8 @@ LL | fn assert_send() { } error[E0277]: `(dyn Dummy + 'a)` cannot be sent between threads safely --> $DIR/kindck-send-object1.rs:29:5 | -LL | assert_send::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be sent between threads safely +LL | assert_send::>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `(dyn Dummy + 'a)` = note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique<(dyn Dummy + 'a)>` diff --git a/src/test/ui/kindck/kindck-send-object1.rs b/src/test/ui/kindck/kindck-send-object1.rs index 341985467de6..0e198395c26f 100644 --- a/src/test/ui/kindck/kindck-send-object1.rs +++ b/src/test/ui/kindck/kindck-send-object1.rs @@ -7,26 +7,26 @@ trait Dummy { } // careful with object types, who knows what they close over... fn test51<'a>() { - assert_send::<&'a Dummy>(); + assert_send::<&'a dyn Dummy>(); //~^ ERROR `(dyn Dummy + 'a)` cannot be shared between threads safely [E0277] } fn test52<'a>() { - assert_send::<&'a (Dummy+Sync)>(); + assert_send::<&'a (dyn Dummy + Sync)>(); //~^ ERROR does not fulfill the required lifetime } // ...unless they are properly bounded fn test60() { - assert_send::<&'static (Dummy+Sync)>(); + assert_send::<&'static (dyn Dummy + Sync)>(); } fn test61() { - assert_send::>(); + assert_send::>(); } // closure and object types can have lifetime bounds which make // them not ok fn test_71<'a>() { - assert_send::>(); + assert_send::>(); //~^ ERROR `(dyn Dummy + 'a)` cannot be sent between threads safely } diff --git a/src/test/ui/kindck/kindck-send-object1.stderr b/src/test/ui/kindck/kindck-send-object1.stderr index a4b908e4101f..757b41ab6cb7 100644 --- a/src/test/ui/kindck/kindck-send-object1.stderr +++ b/src/test/ui/kindck/kindck-send-object1.stderr @@ -1,8 +1,8 @@ error[E0277]: `(dyn Dummy + 'a)` cannot be shared between threads safely --> $DIR/kindck-send-object1.rs:10:5 | -LL | assert_send::<&'a Dummy>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be shared between threads safely +LL | assert_send::<&'a dyn Dummy>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be shared between threads safely | = help: the trait `std::marker::Sync` is not implemented for `(dyn Dummy + 'a)` = note: required because of the requirements on the impl of `std::marker::Send` for `&'a (dyn Dummy + 'a)` @@ -15,16 +15,16 @@ LL | fn assert_send() { } error[E0477]: the type `&'a (dyn Dummy + std::marker::Sync + 'a)` does not fulfill the required lifetime --> $DIR/kindck-send-object1.rs:14:5 | -LL | assert_send::<&'a (Dummy+Sync)>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | assert_send::<&'a (dyn Dummy + Sync)>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: type must satisfy the static lifetime error[E0277]: `(dyn Dummy + 'a)` cannot be sent between threads safely --> $DIR/kindck-send-object1.rs:29:5 | -LL | assert_send::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be sent between threads safely +LL | assert_send::>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `(dyn Dummy + 'a)` = note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique<(dyn Dummy + 'a)>` diff --git a/src/test/ui/kindck/kindck-send-object2.rs b/src/test/ui/kindck/kindck-send-object2.rs index 911ad988081f..b797588e446d 100644 --- a/src/test/ui/kindck/kindck-send-object2.rs +++ b/src/test/ui/kindck/kindck-send-object2.rs @@ -4,21 +4,21 @@ fn assert_send() { } trait Dummy { } fn test50() { - assert_send::<&'static Dummy>(); + assert_send::<&'static dyn Dummy>(); //~^ ERROR `(dyn Dummy + 'static)` cannot be shared between threads safely [E0277] } fn test53() { - assert_send::>(); + assert_send::>(); //~^ ERROR `dyn Dummy` cannot be sent between threads safely } // ...unless they are properly bounded fn test60() { - assert_send::<&'static (Dummy+Sync)>(); + assert_send::<&'static (dyn Dummy + Sync)>(); } fn test61() { - assert_send::>(); + assert_send::>(); } fn main() { } diff --git a/src/test/ui/kindck/kindck-send-object2.stderr b/src/test/ui/kindck/kindck-send-object2.stderr index db79989dc5f6..c1c9db9da839 100644 --- a/src/test/ui/kindck/kindck-send-object2.stderr +++ b/src/test/ui/kindck/kindck-send-object2.stderr @@ -1,8 +1,8 @@ error[E0277]: `(dyn Dummy + 'static)` cannot be shared between threads safely --> $DIR/kindck-send-object2.rs:7:5 | -LL | assert_send::<&'static Dummy>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'static)` cannot be shared between threads safely +LL | assert_send::<&'static dyn Dummy>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'static)` cannot be shared between threads safely | = help: the trait `std::marker::Sync` is not implemented for `(dyn Dummy + 'static)` = note: required because of the requirements on the impl of `std::marker::Send` for `&'static (dyn Dummy + 'static)` @@ -15,8 +15,8 @@ LL | fn assert_send() { } error[E0277]: `dyn Dummy` cannot be sent between threads safely --> $DIR/kindck-send-object2.rs:12:5 | -LL | assert_send::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ `dyn Dummy` cannot be sent between threads safely +LL | assert_send::>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `dyn Dummy` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `dyn Dummy` = note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique` diff --git a/src/test/ui/lifetimes/lifetime-bound-will-change-warning.nll.stderr b/src/test/ui/lifetimes/lifetime-bound-will-change-warning.nll.stderr index 8b24563e9200..f2cf19abdac3 100644 --- a/src/test/ui/lifetimes/lifetime-bound-will-change-warning.nll.stderr +++ b/src/test/ui/lifetimes/lifetime-bound-will-change-warning.nll.stderr @@ -1,7 +1,7 @@ error[E0521]: borrowed data escapes outside of function --> $DIR/lifetime-bound-will-change-warning.rs:34:5 | -LL | fn test2<'a>(x: &'a Box) { +LL | fn test2<'a>(x: &'a Box) { | - `x` is a reference that is only valid in the function body LL | // but ref_obj will not, so warn. LL | ref_obj(x) @@ -10,7 +10,7 @@ LL | ref_obj(x) error[E0521]: borrowed data escapes outside of function --> $DIR/lifetime-bound-will-change-warning.rs:39:5 | -LL | fn test2cc<'a>(x: &'a Box) { +LL | fn test2cc<'a>(x: &'a Box) { | - `x` is a reference that is only valid in the function body LL | // same as test2, but cross crate LL | lib::ref_obj(x) diff --git a/src/test/ui/lifetimes/lifetime-bound-will-change-warning.rs b/src/test/ui/lifetimes/lifetime-bound-will-change-warning.rs index 5461f875af6c..3c6d92234c4f 100644 --- a/src/test/ui/lifetimes/lifetime-bound-will-change-warning.rs +++ b/src/test/ui/lifetimes/lifetime-bound-will-change-warning.rs @@ -9,42 +9,42 @@ extern crate lifetime_bound_will_change_warning_lib as lib; -fn just_ref(x: &Fn()) { +fn just_ref(x: &dyn Fn()) { } -fn ref_obj(x: &Box) { +fn ref_obj(x: &Box) { // this will change to &Box... // Note: no warning is issued here, because the type of `x` will change to 'static if false { ref_obj(x); } } -fn test1<'a>(x: &'a Box) { +fn test1<'a>(x: &'a Box) { // just_ref will stay the same. just_ref(&**x) } -fn test1cc<'a>(x: &'a Box) { +fn test1cc<'a>(x: &'a Box) { // same as test1, but cross-crate lib::just_ref(&**x) } -fn test2<'a>(x: &'a Box) { +fn test2<'a>(x: &'a Box) { // but ref_obj will not, so warn. ref_obj(x) //~ ERROR mismatched types } -fn test2cc<'a>(x: &'a Box) { +fn test2cc<'a>(x: &'a Box) { // same as test2, but cross crate lib::ref_obj(x) //~ ERROR mismatched types } -fn test3<'a>(x: &'a Box) { +fn test3<'a>(x: &'a Box) { // here, we have a 'static bound, so even when ref_obj changes, no error results ref_obj(x) } -fn test3cc<'a>(x: &'a Box) { +fn test3cc<'a>(x: &'a Box) { // same as test3, but cross crate lib::ref_obj(x) } diff --git a/src/test/ui/lifetimes/lifetime-bound-will-change-warning.stderr b/src/test/ui/lifetimes/lifetime-bound-will-change-warning.stderr index 1af4bd501ba4..35d63c172765 100644 --- a/src/test/ui/lifetimes/lifetime-bound-will-change-warning.stderr +++ b/src/test/ui/lifetimes/lifetime-bound-will-change-warning.stderr @@ -9,7 +9,7 @@ LL | ref_obj(x) note: the lifetime 'a as defined on the function body at 32:10... --> $DIR/lifetime-bound-will-change-warning.rs:32:10 | -LL | fn test2<'a>(x: &'a Box) { +LL | fn test2<'a>(x: &'a Box) { | ^^ = note: ...does not necessarily outlive the static lifetime @@ -24,7 +24,7 @@ LL | lib::ref_obj(x) note: the lifetime 'a as defined on the function body at 37:12... --> $DIR/lifetime-bound-will-change-warning.rs:37:12 | -LL | fn test2cc<'a>(x: &'a Box) { +LL | fn test2cc<'a>(x: &'a Box) { | ^^ = note: ...does not necessarily outlive the static lifetime diff --git a/src/test/ui/lifetimes/lifetime-elision-return-type-trait.rs b/src/test/ui/lifetimes/lifetime-elision-return-type-trait.rs index 1c288a7e44f3..2370084b072c 100644 --- a/src/test/ui/lifetimes/lifetime-elision-return-type-trait.rs +++ b/src/test/ui/lifetimes/lifetime-elision-return-type-trait.rs @@ -5,7 +5,7 @@ trait Future { use std::error::Error; -fn foo() -> impl Future> { +fn foo() -> impl Future> { //~^ ERROR missing lifetime Ok(()) } diff --git a/src/test/ui/lifetimes/lifetime-elision-return-type-trait.stderr b/src/test/ui/lifetimes/lifetime-elision-return-type-trait.stderr index b2a3d9a94361..06b317ce9527 100644 --- a/src/test/ui/lifetimes/lifetime-elision-return-type-trait.stderr +++ b/src/test/ui/lifetimes/lifetime-elision-return-type-trait.stderr @@ -1,8 +1,8 @@ error[E0106]: missing lifetime specifier --> $DIR/lifetime-elision-return-type-trait.rs:8:44 | -LL | fn foo() -> impl Future> { - | ^^^^^ help: consider giving it a 'static lifetime: `Error + 'static` +LL | fn foo() -> impl Future> { + | ^^^^^^^^^ help: consider giving it a 'static lifetime: `dyn Error + 'static` | = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.nll.stderr index c4e7ff90069d..3c95be95db08 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.nll.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.nll.stderr @@ -1,18 +1,18 @@ error[E0596]: cannot borrow `y` as mutable, as it is not declared as mutable --> $DIR/ex3-both-anon-regions-using-trait-objects.rs:2:3 | -LL | fn foo(x:Box , y: Vec<&u8>, z: &u8) { - | - help: consider changing this to be mutable: `mut y` +LL | fn foo(x:Box , y: Vec<&u8>, z: &u8) { + | - help: consider changing this to be mutable: `mut y` LL | y.push(z); | ^ cannot borrow as mutable error: lifetime may not live long enough --> $DIR/ex3-both-anon-regions-using-trait-objects.rs:2:3 | -LL | fn foo(x:Box , y: Vec<&u8>, z: &u8) { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` +LL | fn foo(x:Box , y: Vec<&u8>, z: &u8) { + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` LL | y.push(z); | ^^^^^^^^^ argument requires that `'1` must outlive `'2` diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.rs index 324a5846c94a..6625d41c7de2 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.rs @@ -1,4 +1,4 @@ -fn foo(x:Box , y: Vec<&u8>, z: &u8) { +fn foo(x:Box , y: Vec<&u8>, z: &u8) { y.push(z); //~ ERROR lifetime mismatch } diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr index 6cd175b8a617..bfecb4d33931 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr @@ -1,8 +1,8 @@ error[E0623]: lifetime mismatch --> $DIR/ex3-both-anon-regions-using-trait-objects.rs:2:10 | -LL | fn foo(x:Box , y: Vec<&u8>, z: &u8) { - | --- --- these two types are declared with different lifetimes... +LL | fn foo(x:Box , y: Vec<&u8>, z: &u8) { + | --- --- these two types are declared with different lifetimes... LL | y.push(z); | ^ ...but data from `z` flows into `y` here diff --git a/src/test/ui/lint/lint-ctypes.rs b/src/test/ui/lint/lint-ctypes.rs index 816177abdeaf..a3d9b6febdbb 100644 --- a/src/test/ui/lint/lint-ctypes.rs +++ b/src/test/ui/lint/lint-ctypes.rs @@ -51,7 +51,7 @@ extern { pub fn char_type(p: char); //~ ERROR uses type `char` pub fn i128_type(p: i128); //~ ERROR uses type `i128` pub fn u128_type(p: u128); //~ ERROR uses type `u128` - pub fn trait_type(p: &Clone); //~ ERROR uses type `dyn std::clone::Clone` + pub fn trait_type(p: &dyn Clone); //~ ERROR uses type `dyn std::clone::Clone` pub fn tuple_type(p: (i32, i32)); //~ ERROR uses type `(i32, i32)` pub fn tuple_type2(p: I32Pair); //~ ERROR uses type `(i32, i32)` pub fn zero_size(p: ZeroSize); //~ ERROR struct has no fields diff --git a/src/test/ui/lint/lint-ctypes.stderr b/src/test/ui/lint/lint-ctypes.stderr index 67ba30a81c50..03c18e4530b8 100644 --- a/src/test/ui/lint/lint-ctypes.stderr +++ b/src/test/ui/lint/lint-ctypes.stderr @@ -76,8 +76,8 @@ LL | pub fn u128_type(p: u128); error: `extern` block uses type `dyn std::clone::Clone` which is not FFI-safe: trait objects have no C equivalent --> $DIR/lint-ctypes.rs:54:26 | -LL | pub fn trait_type(p: &Clone); - | ^^^^^^ +LL | pub fn trait_type(p: &dyn Clone); + | ^^^^^^^^^^ error: `extern` block uses type `(i32, i32)` which is not FFI-safe: tuples have unspecified layout --> $DIR/lint-ctypes.rs:55:26 diff --git a/src/test/ui/lint/lint-dead-code-3.rs b/src/test/ui/lint/lint-dead-code-3.rs index 00b250f83dd6..4397522f3f32 100644 --- a/src/test/ui/lint/lint-dead-code-3.rs +++ b/src/test/ui/lint/lint-dead-code-3.rs @@ -73,6 +73,6 @@ mod inner { } pub fn foo() { - let a: &inner::Trait = &1_isize; + let a: &dyn inner::Trait = &1_isize; a.f(); } diff --git a/src/test/ui/lint/lint-stability-2.rs b/src/test/ui/lint/lint-stability-2.rs index 12e7b086d35d..53eee35a9ca2 100644 --- a/src/test/ui/lint/lint-stability-2.rs +++ b/src/test/ui/lint/lint-stability-2.rs @@ -148,7 +148,7 @@ mod cross_crate { ::trait_stable(&foo); } - fn test_method_object(foo: &Trait) { + fn test_method_object(foo: &dyn Trait) { foo.trait_deprecated(); foo.trait_deprecated_text(); foo.trait_deprecated_unstable(); @@ -373,7 +373,7 @@ mod this_crate { ::trait_stable(&foo); } - fn test_method_object(foo: &Trait) { + fn test_method_object(foo: &dyn Trait) { foo.trait_deprecated(); foo.trait_deprecated_text(); foo.trait_unstable(); diff --git a/src/test/ui/lint/lint-stability-deprecated.rs b/src/test/ui/lint/lint-stability-deprecated.rs index bf574d7144d0..a2031c2189ae 100644 --- a/src/test/ui/lint/lint-stability-deprecated.rs +++ b/src/test/ui/lint/lint-stability-deprecated.rs @@ -98,7 +98,7 @@ mod cross_crate { struct S1(T::TypeUnstable); struct S2(T::TypeDeprecated); //~^ WARN use of deprecated item 'lint_stability::TraitWithAssociatedTypes::TypeDeprecated': text - type A = TraitWithAssociatedTypes< + type A = dyn TraitWithAssociatedTypes< TypeUnstable = u8, TypeDeprecated = u16, //~^ WARN use of deprecated item 'lint_stability::TraitWithAssociatedTypes::TypeDeprecated' @@ -170,7 +170,7 @@ mod cross_crate { ::trait_stable(&foo); } - fn test_method_object(foo: &Trait) { + fn test_method_object(foo: &dyn Trait) { foo.trait_deprecated(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated' foo.trait_deprecated_text(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text foo.trait_deprecated_unstable(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable' @@ -423,7 +423,7 @@ mod this_crate { ::trait_stable(&foo); } - fn test_method_object(foo: &Trait) { + fn test_method_object(foo: &dyn Trait) { foo.trait_deprecated(); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated' foo.trait_deprecated_text(); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated_text': text foo.trait_unstable(); diff --git a/src/test/ui/lint/lint-stability.rs b/src/test/ui/lint/lint-stability.rs index 3e4a3874d2c4..fde27eec7d3e 100644 --- a/src/test/ui/lint/lint-stability.rs +++ b/src/test/ui/lint/lint-stability.rs @@ -88,7 +88,7 @@ mod cross_crate { struct S1(T::TypeUnstable); //~^ ERROR use of unstable library feature struct S2(T::TypeDeprecated); - type A = TraitWithAssociatedTypes< + type A = dyn TraitWithAssociatedTypes< TypeUnstable = u8, //~ ERROR use of unstable library feature TypeDeprecated = u16, >; @@ -161,7 +161,7 @@ mod cross_crate { ::trait_stable(&foo); } - fn test_method_object(foo: &Trait) { + fn test_method_object(foo: &dyn Trait) { foo.trait_deprecated(); foo.trait_deprecated_text(); foo.trait_stable(); @@ -414,7 +414,7 @@ mod this_crate { ::trait_stable(&foo); } - fn test_method_object(foo: &Trait) { + fn test_method_object(foo: &dyn Trait) { foo.trait_deprecated(); foo.trait_deprecated_text(); foo.trait_unstable(); diff --git a/src/test/ui/lint/lint-unconditional-recursion.rs b/src/test/ui/lint/lint-unconditional-recursion.rs index 44af1179097e..ab60a326cd22 100644 --- a/src/test/ui/lint/lint-unconditional-recursion.rs +++ b/src/test/ui/lint/lint-unconditional-recursion.rs @@ -39,7 +39,7 @@ trait Foo { } } -impl Foo for Box { +impl Foo for Box { fn bar(&self) { //~ ERROR function cannot return without recursing loop { self.bar() @@ -67,7 +67,7 @@ trait Foo2 { } } -impl Foo2 for Box { +impl Foo2 for Box { fn bar(&self) { //~ ERROR function cannot return without recursing loop { Foo2::bar(self) diff --git a/src/test/ui/loops/loops-reject-lifetime-shadowing-label.rs b/src/test/ui/loops/loops-reject-lifetime-shadowing-label.rs index f48e98484566..656ed6576e26 100644 --- a/src/test/ui/loops/loops-reject-lifetime-shadowing-label.rs +++ b/src/test/ui/loops/loops-reject-lifetime-shadowing-label.rs @@ -18,7 +18,7 @@ fn foo() { let z = 3_i8; 'a: loop { - let b = Box::new(|x: &i8| *x) as Box Fn(&'a i8) -> i8>; + let b = Box::new(|x: &i8| *x) as Box Fn(&'a i8) -> i8>; //~^ WARN lifetime name `'a` shadows a label name that is already in scope assert_eq!((*b)(&z), z); break 'a; diff --git a/src/test/ui/loops/loops-reject-lifetime-shadowing-label.stderr b/src/test/ui/loops/loops-reject-lifetime-shadowing-label.stderr index 4c4d9218ec9e..e5d376675c62 100644 --- a/src/test/ui/loops/loops-reject-lifetime-shadowing-label.stderr +++ b/src/test/ui/loops/loops-reject-lifetime-shadowing-label.stderr @@ -1,8 +1,8 @@ warning: lifetime name `'a` shadows a label name that is already in scope - --> $DIR/loops-reject-lifetime-shadowing-label.rs:21:51 + --> $DIR/loops-reject-lifetime-shadowing-label.rs:21:55 | LL | 'a: loop { | -- first declared here -LL | let b = Box::new(|x: &i8| *x) as Box Fn(&'a i8) -> i8>; - | ^^ lifetime 'a already in scope +LL | let b = Box::new(|x: &i8| *x) as Box Fn(&'a i8) -> i8>; + | ^^ lifetime 'a already in scope diff --git a/src/test/ui/lub-glb/old-lub-glb-object.rs b/src/test/ui/lub-glb/old-lub-glb-object.rs index dcd604a5157e..f303c07e6d79 100644 --- a/src/test/ui/lub-glb/old-lub-glb-object.rs +++ b/src/test/ui/lub-glb/old-lub-glb-object.rs @@ -4,8 +4,8 @@ trait Foo { } fn foo( - x: &for<'a, 'b> Foo<&'a u8, &'b u8>, - y: &for<'a> Foo<&'a u8, &'a u8>, + x: &dyn for<'a, 'b> Foo<&'a u8, &'b u8>, + y: &dyn for<'a> Foo<&'a u8, &'a u8>, ) { let z = match 22 { 0 => x, @@ -14,12 +14,12 @@ fn foo( } fn bar( - x: &for<'a, 'b> Foo<&'a u8, &'b u8>, - y: &for<'a> Foo<&'a u8, &'a u8>, + x: &dyn for<'a, 'b> Foo<&'a u8, &'b u8>, + y: &dyn for<'a> Foo<&'a u8, &'a u8>, ) { // Accepted with explicit case: let z = match 22 { - 0 => x as &for<'a> Foo<&'a u8, &'a u8>, + 0 => x as &dyn for<'a> Foo<&'a u8, &'a u8>, _ => y, }; } diff --git a/src/test/ui/map-types.rs b/src/test/ui/map-types.rs index dab7863415f6..c355a0e420f8 100644 --- a/src/test/ui/map-types.rs +++ b/src/test/ui/map-types.rs @@ -13,7 +13,7 @@ impl Map for HashMap {} fn main() { let x: Box> = box HashMap::new(); - let x: Box> = x; - let y: Box> = Box::new(x); + let x: Box> = x; + let y: Box> = Box::new(x); //~^ ERROR `std::boxed::Box>: Map` is not satisfied } diff --git a/src/test/ui/map-types.stderr b/src/test/ui/map-types.stderr index 9aa980442421..21dac1ab1edf 100644 --- a/src/test/ui/map-types.stderr +++ b/src/test/ui/map-types.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `std::boxed::Box>: Map` is not satisfied - --> $DIR/map-types.rs:17:37 + --> $DIR/map-types.rs:17:41 | -LL | let y: Box> = Box::new(x); - | ^^^^^^^^^^^ the trait `Map` is not implemented for `std::boxed::Box>` +LL | let y: Box> = Box::new(x); + | ^^^^^^^^^^^ the trait `Map` is not implemented for `std::boxed::Box>` | = note: required for the cast to the object type `dyn Map` diff --git a/src/test/ui/methods/method-call-lifetime-args-lint-fail.rs b/src/test/ui/methods/method-call-lifetime-args-lint-fail.rs index 36a1a2fda699..23893911eabd 100644 --- a/src/test/ui/methods/method-call-lifetime-args-lint-fail.rs +++ b/src/test/ui/methods/method-call-lifetime-args-lint-fail.rs @@ -11,10 +11,10 @@ impl S { // 'late lifetimes here belong to nested types not to the tested functions. fn early_tricky_explicit<'a>(_: for<'late> fn(&'late u8), - _: Box Fn(&'late u8)>) + _: Box Fn(&'late u8)>) -> &'a u8 { loop {} } fn early_tricky_implicit<'a>(_: fn(&u8), - _: Box) + _: Box) -> &'a u8 { loop {} } } diff --git a/src/test/ui/mismatched_types/cast-rfc0401.rs b/src/test/ui/mismatched_types/cast-rfc0401.rs index a5e03a18e6af..2f88c6496c42 100644 --- a/src/test/ui/mismatched_types/cast-rfc0401.rs +++ b/src/test/ui/mismatched_types/cast-rfc0401.rs @@ -24,7 +24,7 @@ fn main() let v = 0 as *const u8; let fat_v : *const [u8] = unsafe { &*(0 as *const [u8; 1])}; let fat_sv : *const [i8] = unsafe { &*(0 as *const [i8; 1])}; - let foo: &Foo = &f; + let foo: &dyn Foo = &f; let _ = v as &u8; //~ ERROR non-primitive cast let _ = v as E; //~ ERROR non-primitive cast @@ -50,7 +50,7 @@ fn main() let _ = 42usize as *const [u8]; //~ ERROR is invalid let _ = v as *const [u8]; //~ ERROR cannot cast - let _ = fat_v as *const Foo; //~ ERROR the size for values of type + let _ = fat_v as *const dyn Foo; //~ ERROR the size for values of type let _ = foo as *const str; //~ ERROR is invalid let _ = foo as *mut str; //~ ERROR is invalid let _ = main as *mut str; //~ ERROR is invalid @@ -59,14 +59,14 @@ fn main() let _ = fat_sv as usize; //~ ERROR is invalid let a : *const str = "hello"; - let _ = a as *const Foo; //~ ERROR the size for values of type + let _ = a as *const dyn Foo; //~ ERROR the size for values of type // check no error cascade let _ = main.f as *const u32; //~ ERROR no field - let cf: *const Foo = &0; + let cf: *const dyn Foo = &0; let _ = cf as *const [u16]; //~ ERROR is invalid - let _ = cf as *const Bar; //~ ERROR is invalid + let _ = cf as *const dyn Bar; //~ ERROR is invalid vec![0.0].iter().map(|s| s as f32).collect::>(); //~ ERROR is invalid } diff --git a/src/test/ui/mismatched_types/cast-rfc0401.stderr b/src/test/ui/mismatched_types/cast-rfc0401.stderr index 0e0bb8da81e4..f94dfd100a6f 100644 --- a/src/test/ui/mismatched_types/cast-rfc0401.stderr +++ b/src/test/ui/mismatched_types/cast-rfc0401.stderr @@ -207,15 +207,15 @@ LL | let _ = cf as *const [u16]; error[E0606]: casting `*const dyn Foo` as `*const dyn Bar` is invalid --> $DIR/cast-rfc0401.rs:69:13 | -LL | let _ = cf as *const Bar; - | ^^^^^^^^^^^^^^^^ +LL | let _ = cf as *const dyn Bar; + | ^^^^^^^^^^^^^^^^^^^^ | = note: vtable kinds may not match error[E0277]: the size for values of type `[u8]` cannot be known at compilation time --> $DIR/cast-rfc0401.rs:53:13 | -LL | let _ = fat_v as *const Foo; +LL | let _ = fat_v as *const dyn Foo; | ^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[u8]` @@ -225,7 +225,7 @@ LL | let _ = fat_v as *const Foo; error[E0277]: the size for values of type `str` cannot be known at compilation time --> $DIR/cast-rfc0401.rs:62:13 | -LL | let _ = a as *const Foo; +LL | let _ = a as *const dyn Foo; | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` diff --git a/src/test/ui/mismatched_types/issue-19109.rs b/src/test/ui/mismatched_types/issue-19109.rs index 030b7a40ca6f..eae6a87905b3 100644 --- a/src/test/ui/mismatched_types/issue-19109.rs +++ b/src/test/ui/mismatched_types/issue-19109.rs @@ -1,7 +1,7 @@ trait Trait { } -fn function(t: &mut Trait) { - t as *mut Trait +fn function(t: &mut dyn Trait) { + t as *mut dyn Trait //~^ ERROR: mismatched types } diff --git a/src/test/ui/mismatched_types/issue-19109.stderr b/src/test/ui/mismatched_types/issue-19109.stderr index db2d484edff0..b826ca66c683 100644 --- a/src/test/ui/mismatched_types/issue-19109.stderr +++ b/src/test/ui/mismatched_types/issue-19109.stderr @@ -1,10 +1,10 @@ error[E0308]: mismatched types --> $DIR/issue-19109.rs:4:5 | -LL | fn function(t: &mut Trait) { - | - help: try adding a return type: `-> *mut dyn Trait` -LL | t as *mut Trait - | ^^^^^^^^^^^^^^^ expected (), found *-ptr +LL | fn function(t: &mut dyn Trait) { + | - help: try adding a return type: `-> *mut dyn Trait` +LL | t as *mut dyn Trait + | ^^^^^^^^^^^^^^^^^^^ expected (), found *-ptr | = note: expected type `()` found type `*mut dyn Trait` diff --git a/src/test/ui/mismatched_types/trait-bounds-cant-coerce.rs b/src/test/ui/mismatched_types/trait-bounds-cant-coerce.rs index be5fab871b42..882533992bd3 100644 --- a/src/test/ui/mismatched_types/trait-bounds-cant-coerce.rs +++ b/src/test/ui/mismatched_types/trait-bounds-cant-coerce.rs @@ -2,14 +2,14 @@ trait Foo { fn dummy(&self) { } } -fn a(_x: Box) { +fn a(_x: Box) { } -fn c(x: Box) { +fn c(x: Box) { a(x); } -fn d(x: Box) { +fn d(x: Box) { a(x); //~ ERROR mismatched types [E0308] } diff --git a/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.rs b/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.rs index 3fa11878629c..0385a120ce21 100644 --- a/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.rs +++ b/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.rs @@ -6,7 +6,7 @@ struct R<'a> { // This struct is needed to create the // otherwise infinite type of a fn that // accepts itself as argument: - c: Box + c: Box } fn innocent_looking_victim() { diff --git a/src/test/ui/nll/issue-52663-trait-object.rs b/src/test/ui/nll/issue-52663-trait-object.rs index e8e571aadc36..a7be365bde4b 100644 --- a/src/test/ui/nll/issue-52663-trait-object.rs +++ b/src/test/ui/nll/issue-52663-trait-object.rs @@ -10,7 +10,7 @@ fn main() { let _ = { let tmp0 = 3; let tmp1 = &tmp0; - box tmp1 as Box + box tmp1 as Box }; //~^^^ ERROR `tmp0` does not live long enough } diff --git a/src/test/ui/nll/issue-52663-trait-object.stderr b/src/test/ui/nll/issue-52663-trait-object.stderr index 9262117f3975..b71893de7f8b 100644 --- a/src/test/ui/nll/issue-52663-trait-object.stderr +++ b/src/test/ui/nll/issue-52663-trait-object.stderr @@ -3,8 +3,8 @@ error[E0597]: `tmp0` does not live long enough | LL | let tmp1 = &tmp0; | ^^^^^ borrowed value does not live long enough -LL | box tmp1 as Box - | ------------------------- borrow later captured here by trait object +LL | box tmp1 as Box + | ----------------------------- borrow later captured here by trait object LL | }; | - `tmp0` dropped here while still borrowed diff --git a/src/test/ui/nll/issue-53570.rs b/src/test/ui/nll/issue-53570.rs index cea458dcb65b..81c50edfed1a 100644 --- a/src/test/ui/nll/issue-53570.rs +++ b/src/test/ui/nll/issue-53570.rs @@ -14,11 +14,11 @@ trait AnyVec<'a> { } trait GenericVec { - fn unwrap<'a, 'b>(vec: &'b AnyVec<'a>) -> &'b [T] where T: 'a; + fn unwrap<'a, 'b>(vec: &'b dyn AnyVec<'a>) -> &'b [T] where T: 'a; } struct Scratchpad<'a> { - buffers: RefCell>>, + buffers: RefCell>>, } impl<'a> Scratchpad<'a> { diff --git a/src/test/ui/object-does-not-impl-trait.rs b/src/test/ui/object-does-not-impl-trait.rs index 2d72b4588f75..104e7b2e2155 100644 --- a/src/test/ui/object-does-not-impl-trait.rs +++ b/src/test/ui/object-does-not-impl-trait.rs @@ -3,6 +3,6 @@ trait Foo {} fn take_foo(f: F) {} -fn take_object(f: Box) { take_foo(f); } +fn take_object(f: Box) { take_foo(f); } //~^ ERROR `std::boxed::Box: Foo` is not satisfied fn main() {} diff --git a/src/test/ui/object-does-not-impl-trait.stderr b/src/test/ui/object-does-not-impl-trait.stderr index 0e28875ced63..288ce9682c20 100644 --- a/src/test/ui/object-does-not-impl-trait.stderr +++ b/src/test/ui/object-does-not-impl-trait.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `std::boxed::Box: Foo` is not satisfied - --> $DIR/object-does-not-impl-trait.rs:6:31 + --> $DIR/object-does-not-impl-trait.rs:6:35 | -LL | fn take_object(f: Box) { take_foo(f); } - | ^^^^^^^^ the trait `Foo` is not implemented for `std::boxed::Box` +LL | fn take_object(f: Box) { take_foo(f); } + | ^^^^^^^^ the trait `Foo` is not implemented for `std::boxed::Box` | note: required by `take_foo` --> $DIR/object-does-not-impl-trait.rs:5:1 diff --git a/src/test/ui/object-lifetime/object-lifetime-default-ambiguous.rs b/src/test/ui/object-lifetime/object-lifetime-default-ambiguous.rs index d14351aef9a4..5dae92fee5f9 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-ambiguous.rs +++ b/src/test/ui/object-lifetime/object-lifetime-default-ambiguous.rs @@ -20,27 +20,27 @@ struct Ref2<'a,'b:'a,T:'a+'b+?Sized> { r: &'a &'b T } -fn a<'a,'b>(t: Ref2<'a,'b,Test>) { +fn a<'a,'b>(t: Ref2<'a,'b, dyn Test>) { //~^ ERROR lifetime bound for this object type cannot be deduced from context } -fn b(t: Ref2) { +fn b(t: Ref2) { //~^ ERROR lifetime bound for this object type cannot be deduced from context } -fn c(t: Ref2<&Test>) { +fn c(t: Ref2<&dyn Test>) { // In this case, the &'a overrides. } -fn d(t: Ref2>) { +fn d(t: Ref2>) { // In this case, the lifetime parameter from the Ref1 overrides. } -fn e(t: Ref2>) { +fn e(t: Ref2>) { // In this case, Ref2 is ambiguous, but Ref0 overrides with 'static. } -fn f(t: &Ref2) { +fn f(t: &Ref2) { //~^ ERROR lifetime bound for this object type cannot be deduced from context } diff --git a/src/test/ui/object-lifetime/object-lifetime-default-ambiguous.stderr b/src/test/ui/object-lifetime/object-lifetime-default-ambiguous.stderr index 0319c7bfbe27..0c3dbffeea63 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-ambiguous.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default-ambiguous.stderr @@ -1,20 +1,20 @@ error[E0228]: the lifetime bound for this object type cannot be deduced from context; please supply an explicit bound - --> $DIR/object-lifetime-default-ambiguous.rs:23:27 + --> $DIR/object-lifetime-default-ambiguous.rs:23:28 | -LL | fn a<'a,'b>(t: Ref2<'a,'b,Test>) { - | ^^^^ +LL | fn a<'a,'b>(t: Ref2<'a,'b, dyn Test>) { + | ^^^^^^^^ error[E0228]: the lifetime bound for this object type cannot be deduced from context; please supply an explicit bound --> $DIR/object-lifetime-default-ambiguous.rs:27:14 | -LL | fn b(t: Ref2) { - | ^^^^ +LL | fn b(t: Ref2) { + | ^^^^^^^^ error[E0228]: the lifetime bound for this object type cannot be deduced from context; please supply an explicit bound --> $DIR/object-lifetime-default-ambiguous.rs:43:15 | -LL | fn f(t: &Ref2) { - | ^^^^ +LL | fn f(t: &Ref2) { + | ^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/object-lifetime/object-lifetime-default-elision.nll.stderr b/src/test/ui/object-lifetime/object-lifetime-default-elision.nll.stderr index 19cdd66ef759..e94f2a92125c 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-elision.nll.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default-elision.nll.stderr @@ -1,7 +1,7 @@ error: lifetime may not live long enough --> $DIR/object-lifetime-default-elision.rs:71:5 | -LL | fn load3<'a,'b>(ss: &'a SomeTrait) -> &'b SomeTrait { +LL | fn load3<'a,'b>(ss: &'a dyn SomeTrait) -> &'b dyn SomeTrait { | -- -- lifetime `'b` defined here | | | lifetime `'a` defined here diff --git a/src/test/ui/object-lifetime/object-lifetime-default-elision.rs b/src/test/ui/object-lifetime/object-lifetime-default-elision.rs index cf15a4e8676b..dc42edfba2cc 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-elision.rs +++ b/src/test/ui/object-lifetime/object-lifetime-default-elision.rs @@ -8,7 +8,7 @@ trait SomeTrait { } struct SomeStruct<'a> { - r: Box + r: Box } fn deref(ss: &T) -> T { @@ -17,7 +17,7 @@ fn deref(ss: &T) -> T { loop { } } -fn load0<'a>(ss: &'a Box) -> Box { +fn load0<'a>(ss: &'a Box) -> Box { // Under old rules, the fully elaborated types of input/output were: // // for<'a,'b> fn(&'a Box) -> Box @@ -31,7 +31,7 @@ fn load0<'a>(ss: &'a Box) -> Box { deref(ss) } -fn load1(ss: &SomeTrait) -> &SomeTrait { +fn load1(ss: &dyn SomeTrait) -> &dyn SomeTrait { // Under old rules, the fully elaborated types of input/output were: // // for<'a,'b> fn(&'a (SomeTrait+'b)) -> &'a (SomeTrait+'a) @@ -45,13 +45,13 @@ fn load1(ss: &SomeTrait) -> &SomeTrait { ss } -fn load2<'a>(ss: &'a SomeTrait) -> &SomeTrait { +fn load2<'a>(ss: &'a dyn SomeTrait) -> &dyn SomeTrait { // Same as `load1` but with an explicit name thrown in for fun. ss } -fn load3<'a,'b>(ss: &'a SomeTrait) -> &'b SomeTrait { +fn load3<'a,'b>(ss: &'a dyn SomeTrait) -> &'b dyn SomeTrait { // Under old rules, the fully elaborated types of input/output were: // // for<'a,'b,'c>fn(&'a (SomeTrait+'c)) -> &'b (SomeTrait+'a) diff --git a/src/test/ui/object-lifetime/object-lifetime-default-elision.stderr b/src/test/ui/object-lifetime/object-lifetime-default-elision.stderr index dcb07a1706f3..2cdd6c5d890f 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-elision.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default-elision.stderr @@ -7,7 +7,7 @@ LL | ss note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 54:10... --> $DIR/object-lifetime-default-elision.rs:54:10 | -LL | fn load3<'a,'b>(ss: &'a SomeTrait) -> &'b SomeTrait { +LL | fn load3<'a,'b>(ss: &'a dyn SomeTrait) -> &'b dyn SomeTrait { | ^^ note: ...so that reference does not outlive borrowed content --> $DIR/object-lifetime-default-elision.rs:71:5 @@ -17,7 +17,7 @@ LL | ss note: but, the lifetime must be valid for the lifetime 'b as defined on the function body at 54:13... --> $DIR/object-lifetime-default-elision.rs:54:13 | -LL | fn load3<'a,'b>(ss: &'a SomeTrait) -> &'b SomeTrait { +LL | fn load3<'a,'b>(ss: &'a dyn SomeTrait) -> &'b dyn SomeTrait { | ^^ = note: ...so that the expression is assignable: expected &'b (dyn SomeTrait + 'b) @@ -32,7 +32,7 @@ LL | ss note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 54:10... --> $DIR/object-lifetime-default-elision.rs:54:10 | -LL | fn load3<'a,'b>(ss: &'a SomeTrait) -> &'b SomeTrait { +LL | fn load3<'a,'b>(ss: &'a dyn SomeTrait) -> &'b dyn SomeTrait { | ^^ note: ...so that the declared lifetime parameter bounds are satisfied --> $DIR/object-lifetime-default-elision.rs:71:5 @@ -42,7 +42,7 @@ LL | ss note: but, the lifetime must be valid for the lifetime 'b as defined on the function body at 54:13... --> $DIR/object-lifetime-default-elision.rs:54:13 | -LL | fn load3<'a,'b>(ss: &'a SomeTrait) -> &'b SomeTrait { +LL | fn load3<'a,'b>(ss: &'a dyn SomeTrait) -> &'b dyn SomeTrait { | ^^ = note: ...so that the expression is assignable: expected &'b (dyn SomeTrait + 'b) diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.nll.stderr b/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.nll.stderr index 9e68647214c2..17fb7c4acdff 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.nll.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.nll.stderr @@ -1,7 +1,7 @@ error[E0621]: explicit lifetime required in the type of `ss` --> $DIR/object-lifetime-default-from-box-error.rs:18:5 | -LL | fn load(ss: &mut SomeStruct) -> Box { +LL | fn load(ss: &mut SomeStruct) -> Box { | --------------- help: add explicit lifetime `'static` to the type of `ss`: `&mut SomeStruct<'static>` ... LL | ss.r @@ -16,7 +16,7 @@ LL | ss.r error[E0621]: explicit lifetime required in the type of `ss` --> $DIR/object-lifetime-default-from-box-error.rs:31:5 | -LL | fn store1<'b>(ss: &mut SomeStruct, b: Box) { +LL | fn store1<'b>(ss: &mut SomeStruct, b: Box) { | --------------- help: add explicit lifetime `'b` to the type of `ss`: `&mut SomeStruct<'b>` ... LL | ss.r = b; diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.rs b/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.rs index b6d72f1fce3f..587aab1edce3 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.rs +++ b/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.rs @@ -8,24 +8,24 @@ trait SomeTrait { } struct SomeStruct<'a> { - r: Box + r: Box } -fn load(ss: &mut SomeStruct) -> Box { +fn load(ss: &mut SomeStruct) -> Box { // `Box` defaults to a `'static` bound, so this return // is illegal. ss.r //~ ERROR explicit lifetime required in the type of `ss` [E0621] } -fn store(ss: &mut SomeStruct, b: Box) { +fn store(ss: &mut SomeStruct, b: Box) { // No error: b is bounded by 'static which outlives the // (anonymous) lifetime on the struct. ss.r = b; } -fn store1<'b>(ss: &mut SomeStruct, b: Box) { +fn store1<'b>(ss: &mut SomeStruct, b: Box) { // Here we override the lifetimes explicitly, and so naturally we get an error. ss.r = b; //~ ERROR explicit lifetime required in the type of `ss` [E0621] diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.stderr b/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.stderr index 0077c95139f4..78e4bdd374da 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.stderr @@ -1,7 +1,7 @@ error[E0621]: explicit lifetime required in the type of `ss` --> $DIR/object-lifetime-default-from-box-error.rs:18:5 | -LL | fn load(ss: &mut SomeStruct) -> Box { +LL | fn load(ss: &mut SomeStruct) -> Box { | --------------- help: add explicit lifetime `'static` to the type of `ss`: `&mut SomeStruct<'static>` ... LL | ss.r @@ -10,7 +10,7 @@ LL | ss.r error[E0621]: explicit lifetime required in the type of `ss` --> $DIR/object-lifetime-default-from-box-error.rs:31:12 | -LL | fn store1<'b>(ss: &mut SomeStruct, b: Box) { +LL | fn store1<'b>(ss: &mut SomeStruct, b: Box) { | --------------- help: add explicit lifetime `'b` to the type of `ss`: `&mut SomeStruct<'b>` ... LL | ss.r = b; diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.nll.stderr b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.nll.stderr index 6d183ddf22d1..7d6f9f39d13e 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.nll.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.nll.stderr @@ -1,7 +1,7 @@ error: lifetime may not live long enough --> $DIR/object-lifetime-default-from-rptr-box-error.rs:15:5 | -LL | fn c<'a>(t: &'a Box, mut ss: SomeStruct<'a>) { +LL | fn c<'a>(t: &'a Box, mut ss: SomeStruct<'a>) { | -- lifetime `'a` defined here LL | ss.t = t; | ^^^^^^^^ assignment requires that `'a` must outlive `'static` diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.rs b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.rs index 91b384e00713..bf9e0beb57cd 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.rs +++ b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.rs @@ -8,10 +8,10 @@ trait Test { } struct SomeStruct<'a> { - t: &'a Box, + t: &'a Box, } -fn c<'a>(t: &'a Box, mut ss: SomeStruct<'a>) { +fn c<'a>(t: &'a Box, mut ss: SomeStruct<'a>) { ss.t = t; //~ ERROR mismatched types } diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.stderr b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.stderr index d7e3a171333e..4f9cef12c5ef 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.stderr @@ -9,7 +9,7 @@ LL | ss.t = t; note: the lifetime 'a as defined on the function body at 14:6... --> $DIR/object-lifetime-default-from-rptr-box-error.rs:14:6 | -LL | fn c<'a>(t: &'a Box, mut ss: SomeStruct<'a>) { +LL | fn c<'a>(t: &'a Box, mut ss: SomeStruct<'a>) { | ^^ = note: ...does not necessarily outlive the static lifetime diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.nll.stderr b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.nll.stderr index fe3b21fa39c5..6df54638ce00 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.nll.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.nll.stderr @@ -1,7 +1,7 @@ error: lifetime may not live long enough --> $DIR/object-lifetime-default-from-rptr-struct-error.rs:21:5 | -LL | fn c<'a>(t: &'a MyBox, mut ss: SomeStruct<'a>) { +LL | fn c<'a>(t: &'a MyBox, mut ss: SomeStruct<'a>) { | -- lifetime `'a` defined here LL | ss.t = t; | ^^^^^^^^ assignment requires that `'a` must outlive `'static` diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.rs b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.rs index 6a84621f59e4..ae2878539cfd 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.rs +++ b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.rs @@ -9,15 +9,15 @@ trait Test { } struct SomeStruct<'a> { - t: &'a MyBox, - u: &'a MyBox, + t: &'a MyBox, + u: &'a MyBox, } struct MyBox { b: Box } -fn c<'a>(t: &'a MyBox, mut ss: SomeStruct<'a>) { +fn c<'a>(t: &'a MyBox, mut ss: SomeStruct<'a>) { ss.t = t; //~ ERROR mismatched types } diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.stderr b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.stderr index 4d082530dc52..3b7faee68aab 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.stderr @@ -9,7 +9,7 @@ LL | ss.t = t; note: the lifetime 'a as defined on the function body at 20:6... --> $DIR/object-lifetime-default-from-rptr-struct-error.rs:20:6 | -LL | fn c<'a>(t: &'a MyBox, mut ss: SomeStruct<'a>) { +LL | fn c<'a>(t: &'a MyBox, mut ss: SomeStruct<'a>) { | ^^ = note: ...does not necessarily outlive the static lifetime diff --git a/src/test/ui/object-lifetime/object-lifetime-default-mybox.nll.stderr b/src/test/ui/object-lifetime/object-lifetime-default-mybox.nll.stderr index 448fe9e55109..cdfbf0fc878c 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-mybox.nll.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default-mybox.nll.stderr @@ -1,7 +1,7 @@ error: lifetime may not live long enough --> $DIR/object-lifetime-default-mybox.rs:27:5 | -LL | fn load1<'a,'b>(a: &'a MyBox, +LL | fn load1<'a,'b>(a: &'a MyBox, | -- -- lifetime `'b` defined here | | | lifetime `'a` defined here @@ -12,7 +12,7 @@ LL | a error[E0521]: borrowed data escapes outside of function --> $DIR/object-lifetime-default-mybox.rs:31:5 | -LL | fn load2<'a>(ss: &MyBox) -> MyBox { +LL | fn load2<'a>(ss: &MyBox) -> MyBox { | -- `ss` is a reference that is only valid in the function body LL | load0(ss) | ^^^^^^^^^ `ss` escapes the function body here diff --git a/src/test/ui/object-lifetime/object-lifetime-default-mybox.rs b/src/test/ui/object-lifetime/object-lifetime-default-mybox.rs index c94df82a1775..eb27fe90f47c 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-mybox.rs +++ b/src/test/ui/object-lifetime/object-lifetime-default-mybox.rs @@ -16,18 +16,18 @@ fn deref(ss: &T) -> T { loop { } } -fn load0(ss: &MyBox) -> MyBox { +fn load0(ss: &MyBox) -> MyBox { deref(ss) } -fn load1<'a,'b>(a: &'a MyBox, - b: &'b MyBox) - -> &'b MyBox +fn load1<'a,'b>(a: &'a MyBox, + b: &'b MyBox) + -> &'b MyBox { a //~ ERROR lifetime mismatch } -fn load2<'a>(ss: &MyBox) -> MyBox { +fn load2<'a>(ss: &MyBox) -> MyBox { load0(ss) //~ ERROR mismatched types } diff --git a/src/test/ui/object-lifetime/object-lifetime-default-mybox.stderr b/src/test/ui/object-lifetime/object-lifetime-default-mybox.stderr index 4c23f867be81..928b92019823 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-mybox.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default-mybox.stderr @@ -1,11 +1,11 @@ error[E0623]: lifetime mismatch --> $DIR/object-lifetime-default-mybox.rs:27:5 | -LL | fn load1<'a,'b>(a: &'a MyBox, - | -------------------- this parameter and the return type are declared with different lifetimes... -LL | b: &'b MyBox) -LL | -> &'b MyBox - | -------------------- +LL | fn load1<'a,'b>(a: &'a MyBox, + | ------------------------ this parameter and the return type are declared with different lifetimes... +LL | b: &'b MyBox) +LL | -> &'b MyBox + | ------------------------ LL | { LL | a | ^ ...but data from `a` is returned here @@ -21,7 +21,7 @@ LL | load0(ss) note: the lifetime 'a as defined on the function body at 30:10... --> $DIR/object-lifetime-default-mybox.rs:30:10 | -LL | fn load2<'a>(ss: &MyBox) -> MyBox { +LL | fn load2<'a>(ss: &MyBox) -> MyBox { | ^^ = note: ...does not necessarily outlive the static lifetime diff --git a/src/test/ui/object-pointer-types.rs b/src/test/ui/object-pointer-types.rs index a8a482fb5a6c..760a50e5b797 100644 --- a/src/test/ui/object-pointer-types.rs +++ b/src/test/ui/object-pointer-types.rs @@ -5,19 +5,19 @@ trait Foo { fn owned(self: Box); } -fn borrowed_receiver(x: &Foo) { +fn borrowed_receiver(x: &dyn Foo) { x.borrowed(); x.borrowed_mut(); // See [1] x.owned(); //~ ERROR no method named `owned` found } -fn borrowed_mut_receiver(x: &mut Foo) { +fn borrowed_mut_receiver(x: &mut dyn Foo) { x.borrowed(); x.borrowed_mut(); x.owned(); //~ ERROR no method named `owned` found } -fn owned_receiver(x: Box) { +fn owned_receiver(x: Box) { x.borrowed(); x.borrowed_mut(); // See [1] x.managed(); //~ ERROR no method named `managed` found diff --git a/src/test/ui/object-safety/object-safety-associated-consts.rs b/src/test/ui/object-safety/object-safety-associated-consts.rs index 79b7e541af82..5900019ea915 100644 --- a/src/test/ui/object-safety/object-safety-associated-consts.rs +++ b/src/test/ui/object-safety/object-safety-associated-consts.rs @@ -6,7 +6,7 @@ trait Bar { const X: usize; } -fn make_bar(t: &T) -> &Bar { +fn make_bar(t: &T) -> &dyn Bar { //~^ ERROR E0038 t } diff --git a/src/test/ui/object-safety/object-safety-associated-consts.stderr b/src/test/ui/object-safety/object-safety-associated-consts.stderr index 96962c10720a..55f9e3f9f138 100644 --- a/src/test/ui/object-safety/object-safety-associated-consts.stderr +++ b/src/test/ui/object-safety/object-safety-associated-consts.stderr @@ -1,8 +1,8 @@ error[E0038]: the trait `Bar` cannot be made into an object --> $DIR/object-safety-associated-consts.rs:9:1 | -LL | fn make_bar(t: &T) -> &Bar { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object +LL | fn make_bar(t: &T) -> &dyn Bar { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object | = note: the trait cannot contain associated consts like `X` diff --git a/src/test/ui/object-safety/object-safety-by-value-self-use.rs b/src/test/ui/object-safety/object-safety-by-value-self-use.rs index 0b70c8ad45e7..f903f26c0901 100644 --- a/src/test/ui/object-safety/object-safety-by-value-self-use.rs +++ b/src/test/ui/object-safety/object-safety-by-value-self-use.rs @@ -11,7 +11,7 @@ trait Baz { fn baz(self: Self); } -fn use_bar(t: Box) { +fn use_bar(t: Box) { t.bar() //~ ERROR cannot move a value of type dyn Bar } diff --git a/src/test/ui/object-safety/object-safety-by-value-self.rs b/src/test/ui/object-safety/object-safety-by-value-self.rs index dee31f6e370f..a8b1ddfaba7f 100644 --- a/src/test/ui/object-safety/object-safety-by-value-self.rs +++ b/src/test/ui/object-safety/object-safety-by-value-self.rs @@ -17,28 +17,28 @@ trait Quux { fn baz(self: Self) where Self : Sized; } -fn make_bar(t: &T) -> &Bar { +fn make_bar(t: &T) -> &dyn Bar { t // legal } -fn make_bar_explicit(t: &T) -> &Bar { - t as &Bar // legal +fn make_bar_explicit(t: &T) -> &dyn Bar { + t as &dyn Bar // legal } -fn make_baz(t: &T) -> &Baz { +fn make_baz(t: &T) -> &dyn Baz { t // legal } -fn make_baz_explicit(t: &T) -> &Baz { - t as &Baz // legal +fn make_baz_explicit(t: &T) -> &dyn Baz { + t as &dyn Baz // legal } -fn make_quux(t: &T) -> &Quux { +fn make_quux(t: &T) -> &dyn Quux { t } -fn make_quux_explicit(t: &T) -> &Quux { - t as &Quux +fn make_quux_explicit(t: &T) -> &dyn Quux { + t as &dyn Quux } diff --git a/src/test/ui/object-safety/object-safety-generics.rs b/src/test/ui/object-safety/object-safety-generics.rs index 5f4aabf5469c..d63ea28c8f22 100644 --- a/src/test/ui/object-safety/object-safety-generics.rs +++ b/src/test/ui/object-safety/object-safety-generics.rs @@ -11,22 +11,22 @@ trait Quux { where Self : Sized; } -fn make_bar(t: &T) -> &Bar { +fn make_bar(t: &T) -> &dyn Bar { //~^ ERROR E0038 t } -fn make_bar_explicit(t: &T) -> &Bar { +fn make_bar_explicit(t: &T) -> &dyn Bar { //~^ ERROR E0038 - t as &Bar + t as &dyn Bar } -fn make_quux(t: &T) -> &Quux { +fn make_quux(t: &T) -> &dyn Quux { t } -fn make_quux_explicit(t: &T) -> &Quux { - t as &Quux +fn make_quux_explicit(t: &T) -> &dyn Quux { + t as &dyn Quux } fn main() { diff --git a/src/test/ui/object-safety/object-safety-generics.stderr b/src/test/ui/object-safety/object-safety-generics.stderr index 7ae44794ceba..d66cdb98448d 100644 --- a/src/test/ui/object-safety/object-safety-generics.stderr +++ b/src/test/ui/object-safety/object-safety-generics.stderr @@ -1,16 +1,16 @@ error[E0038]: the trait `Bar` cannot be made into an object --> $DIR/object-safety-generics.rs:14:1 | -LL | fn make_bar(t: &T) -> &Bar { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object +LL | fn make_bar(t: &T) -> &dyn Bar { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object | = note: method `bar` has generic type parameters error[E0038]: the trait `Bar` cannot be made into an object --> $DIR/object-safety-generics.rs:19:1 | -LL | fn make_bar_explicit(t: &T) -> &Bar { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object +LL | fn make_bar_explicit(t: &T) -> &dyn Bar { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object | = note: method `bar` has generic type parameters diff --git a/src/test/ui/object-safety/object-safety-issue-22040.rs b/src/test/ui/object-safety/object-safety-issue-22040.rs index eb28fcf0d5af..1fc5c5442c21 100644 --- a/src/test/ui/object-safety/object-safety-issue-22040.rs +++ b/src/test/ui/object-safety/object-safety-issue-22040.rs @@ -9,7 +9,7 @@ trait Expr: Debug + PartialEq { //#[derive(PartialEq)] #[derive(Debug)] struct SExpr<'x> { - elements: Vec>, + elements: Vec>, //~^ ERROR E0038 } @@ -35,8 +35,8 @@ impl <'x> Expr for SExpr<'x> { } fn main() { - let a: Box = Box::new(SExpr::new()); - let b: Box = Box::new(SExpr::new()); + let a: Box = Box::new(SExpr::new()); + let b: Box = Box::new(SExpr::new()); // assert_eq!(a , b); } diff --git a/src/test/ui/object-safety/object-safety-issue-22040.stderr b/src/test/ui/object-safety/object-safety-issue-22040.stderr index 85721f1a5f81..1f5c472ddc25 100644 --- a/src/test/ui/object-safety/object-safety-issue-22040.stderr +++ b/src/test/ui/object-safety/object-safety-issue-22040.stderr @@ -1,8 +1,8 @@ error[E0038]: the trait `Expr` cannot be made into an object --> $DIR/object-safety-issue-22040.rs:12:23 | -LL | elements: Vec>, - | ^^^^^^^^ the trait `Expr` cannot be made into an object +LL | elements: Vec>, + | ^^^^^^^^^^^^^ the trait `Expr` cannot be made into an object | = note: the trait cannot use `Self` as a type parameter in the supertraits or where-clauses diff --git a/src/test/ui/object-safety/object-safety-mentions-Self.rs b/src/test/ui/object-safety/object-safety-mentions-Self.rs index 8e1bd83cec00..f13ffe536267 100644 --- a/src/test/ui/object-safety/object-safety-mentions-Self.rs +++ b/src/test/ui/object-safety/object-safety-mentions-Self.rs @@ -14,22 +14,22 @@ trait Quux { fn get(&self, s: &Self) -> Self where Self : Sized; } -fn make_bar(t: &T) -> &Bar { +fn make_bar(t: &T) -> &dyn Bar { //~^ ERROR E0038 loop { } } -fn make_baz(t: &T) -> &Baz { +fn make_baz(t: &T) -> &dyn Baz { //~^ ERROR E0038 t } -fn make_quux(t: &T) -> &Quux { +fn make_quux(t: &T) -> &dyn Quux { t } -fn make_quux_explicit(t: &T) -> &Quux { - t as &Quux +fn make_quux_explicit(t: &T) -> &dyn Quux { + t as &dyn Quux } fn main() { diff --git a/src/test/ui/object-safety/object-safety-mentions-Self.stderr b/src/test/ui/object-safety/object-safety-mentions-Self.stderr index ed3aed983cf7..c0c471c2b1e7 100644 --- a/src/test/ui/object-safety/object-safety-mentions-Self.stderr +++ b/src/test/ui/object-safety/object-safety-mentions-Self.stderr @@ -1,16 +1,16 @@ error[E0038]: the trait `Bar` cannot be made into an object --> $DIR/object-safety-mentions-Self.rs:17:1 | -LL | fn make_bar(t: &T) -> &Bar { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object +LL | fn make_bar(t: &T) -> &dyn Bar { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object | = note: method `bar` references the `Self` type in its arguments or return type error[E0038]: the trait `Baz` cannot be made into an object --> $DIR/object-safety-mentions-Self.rs:22:1 | -LL | fn make_baz(t: &T) -> &Baz { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Baz` cannot be made into an object +LL | fn make_baz(t: &T) -> &dyn Baz { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Baz` cannot be made into an object | = note: method `bar` references the `Self` type in its arguments or return type diff --git a/src/test/ui/object-safety/object-safety-no-static.rs b/src/test/ui/object-safety/object-safety-no-static.rs index 4faf9386f9a8..55d31ce80876 100644 --- a/src/test/ui/object-safety/object-safety-no-static.rs +++ b/src/test/ui/object-safety/object-safety-no-static.rs @@ -5,7 +5,7 @@ trait Foo { fn foo(); } -fn foo_implicit(b: Box) -> Box { +fn foo_implicit(b: Box) -> Box { //~^ ERROR E0038 loop { } } diff --git a/src/test/ui/object-safety/object-safety-no-static.stderr b/src/test/ui/object-safety/object-safety-no-static.stderr index 3b8ccb594c18..da8dd657c2a9 100644 --- a/src/test/ui/object-safety/object-safety-no-static.stderr +++ b/src/test/ui/object-safety/object-safety-no-static.stderr @@ -1,8 +1,8 @@ error[E0038]: the trait `Foo` cannot be made into an object --> $DIR/object-safety-no-static.rs:8:1 | -LL | fn foo_implicit(b: Box) -> Box { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` cannot be made into an object +LL | fn foo_implicit(b: Box) -> Box { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` cannot be made into an object | = note: method `foo` has no receiver diff --git a/src/test/ui/object-safety/object-safety-phantom-fn.rs b/src/test/ui/object-safety/object-safety-phantom-fn.rs index f8875e4995b4..59ed12c78f02 100644 --- a/src/test/ui/object-safety/object-safety-phantom-fn.rs +++ b/src/test/ui/object-safety/object-safety-phantom-fn.rs @@ -9,11 +9,11 @@ trait Baz { trait Bar { } -fn make_bar>(t: &T) -> &Bar { +fn make_bar>(t: &T) -> &dyn Bar { t } -fn make_baz(t: &T) -> &Baz { +fn make_baz(t: &T) -> &dyn Baz { t } diff --git a/src/test/ui/object-safety/object-safety-sized-2.rs b/src/test/ui/object-safety/object-safety-sized-2.rs index baeb3734677f..7235b22404e2 100644 --- a/src/test/ui/object-safety/object-safety-sized-2.rs +++ b/src/test/ui/object-safety/object-safety-sized-2.rs @@ -7,7 +7,7 @@ trait Bar fn bar(&self, t: T); } -fn make_bar(t: &T) -> &Bar { +fn make_bar(t: &T) -> &dyn Bar { //~^ ERROR E0038 loop { } } diff --git a/src/test/ui/object-safety/object-safety-sized-2.stderr b/src/test/ui/object-safety/object-safety-sized-2.stderr index 2b8bfa341d79..dcaf2ff0bc29 100644 --- a/src/test/ui/object-safety/object-safety-sized-2.stderr +++ b/src/test/ui/object-safety/object-safety-sized-2.stderr @@ -1,8 +1,8 @@ error[E0038]: the trait `Bar` cannot be made into an object --> $DIR/object-safety-sized-2.rs:10:1 | -LL | fn make_bar(t: &T) -> &Bar { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object +LL | fn make_bar(t: &T) -> &dyn Bar { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object | = note: the trait cannot require that `Self : Sized` diff --git a/src/test/ui/object-safety/object-safety-sized.rs b/src/test/ui/object-safety/object-safety-sized.rs index 77dc7390aff0..1312bb34717e 100644 --- a/src/test/ui/object-safety/object-safety-sized.rs +++ b/src/test/ui/object-safety/object-safety-sized.rs @@ -5,7 +5,7 @@ trait Bar : Sized { fn bar(&self, t: T); } -fn make_bar(t: &T) -> &Bar { +fn make_bar(t: &T) -> &dyn Bar { //~^ ERROR E0038 t } diff --git a/src/test/ui/object-safety/object-safety-sized.stderr b/src/test/ui/object-safety/object-safety-sized.stderr index ba98e2f1ef65..98bc73e38d4c 100644 --- a/src/test/ui/object-safety/object-safety-sized.stderr +++ b/src/test/ui/object-safety/object-safety-sized.stderr @@ -1,8 +1,8 @@ error[E0038]: the trait `Bar` cannot be made into an object --> $DIR/object-safety-sized.rs:8:1 | -LL | fn make_bar(t: &T) -> &Bar { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object +LL | fn make_bar(t: &T) -> &dyn Bar { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object | = note: the trait cannot require that `Self : Sized` diff --git a/src/test/ui/object-safety/object-safety-supertrait-mentions-Self.rs b/src/test/ui/object-safety/object-safety-supertrait-mentions-Self.rs index 9d0da4e327c7..2445b33c8144 100644 --- a/src/test/ui/object-safety/object-safety-supertrait-mentions-Self.rs +++ b/src/test/ui/object-safety/object-safety-supertrait-mentions-Self.rs @@ -8,11 +8,11 @@ trait Bar { trait Baz : Bar { } -fn make_bar>(t: &T) -> &Bar { +fn make_bar>(t: &T) -> &dyn Bar { t } -fn make_baz(t: &T) -> &Baz { +fn make_baz(t: &T) -> &dyn Baz { //~^ ERROR E0038 t } diff --git a/src/test/ui/object-safety/object-safety-supertrait-mentions-Self.stderr b/src/test/ui/object-safety/object-safety-supertrait-mentions-Self.stderr index 5db34a23fff6..8ae89832703d 100644 --- a/src/test/ui/object-safety/object-safety-supertrait-mentions-Self.stderr +++ b/src/test/ui/object-safety/object-safety-supertrait-mentions-Self.stderr @@ -1,8 +1,8 @@ error[E0038]: the trait `Baz` cannot be made into an object --> $DIR/object-safety-supertrait-mentions-Self.rs:15:31 | -LL | fn make_baz(t: &T) -> &Baz { - | ^^^ the trait `Baz` cannot be made into an object +LL | fn make_baz(t: &T) -> &dyn Baz { + | ^^^^^^^ the trait `Baz` cannot be made into an object | = note: the trait cannot use `Self` as a type parameter in the supertraits or where-clauses diff --git a/src/test/ui/privacy/private-in-public-non-principal-2.rs b/src/test/ui/privacy/private-in-public-non-principal-2.rs index 02fd92aa7a4e..8a59073fa6c7 100644 --- a/src/test/ui/privacy/private-in-public-non-principal-2.rs +++ b/src/test/ui/privacy/private-in-public-non-principal-2.rs @@ -4,7 +4,7 @@ mod m { pub trait PubPrincipal {} auto trait PrivNonPrincipal {} - pub fn leak_dyn_nonprincipal() -> Box { loop {} } + pub fn leak_dyn_nonprincipal() -> Box { loop {} } } fn main() { diff --git a/src/test/ui/privacy/private-in-public-non-principal.rs b/src/test/ui/privacy/private-in-public-non-principal.rs index 5de5a685208c..5d89d8105b11 100644 --- a/src/test/ui/privacy/private-in-public-non-principal.rs +++ b/src/test/ui/privacy/private-in-public-non-principal.rs @@ -3,7 +3,7 @@ pub trait PubPrincipal {} auto trait PrivNonPrincipal {} -pub fn leak_dyn_nonprincipal() -> Box { loop {} } +pub fn leak_dyn_nonprincipal() -> Box { loop {} } //~^ WARN private trait `PrivNonPrincipal` in public interface //~| WARN this was previously accepted diff --git a/src/test/ui/privacy/private-in-public-non-principal.stderr b/src/test/ui/privacy/private-in-public-non-principal.stderr index 729b94ed8926..578f4380b422 100644 --- a/src/test/ui/privacy/private-in-public-non-principal.stderr +++ b/src/test/ui/privacy/private-in-public-non-principal.stderr @@ -1,8 +1,8 @@ warning: private trait `PrivNonPrincipal` in public interface (error E0445) --> $DIR/private-in-public-non-principal.rs:6:1 | -LL | pub fn leak_dyn_nonprincipal() -> Box { loop {} } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | pub fn leak_dyn_nonprincipal() -> Box { loop {} } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: #[warn(private_in_public)] on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/src/test/ui/privacy/private-inferred-type.rs b/src/test/ui/privacy/private-inferred-type.rs index d9bb421b53f8..dab440b2d991 100644 --- a/src/test/ui/privacy/private-inferred-type.rs +++ b/src/test/ui/privacy/private-inferred-type.rs @@ -65,9 +65,9 @@ mod m { pub fn leak_anon2() -> impl TraitWithTyParam { 0 } pub fn leak_anon3() -> impl TraitWithAssocTy { 0 } - pub fn leak_dyn1() -> Box { Box::new(0) } - pub fn leak_dyn2() -> Box> { Box::new(0) } - pub fn leak_dyn3() -> Box> { Box::new(0) } + pub fn leak_dyn1() -> Box { Box::new(0) } + pub fn leak_dyn2() -> Box> { Box::new(0) } + pub fn leak_dyn3() -> Box> { Box::new(0) } } mod adjust { diff --git a/src/test/ui/regions/region-borrow-params-issue-29793-small.rs b/src/test/ui/regions/region-borrow-params-issue-29793-small.rs index a1ccf6676710..5f1c2ed08f6b 100644 --- a/src/test/ui/regions/region-borrow-params-issue-29793-small.rs +++ b/src/test/ui/regions/region-borrow-params-issue-29793-small.rs @@ -51,7 +51,7 @@ fn ok_borrow_of_fn_params(a: usize, b:usize) { // TOP-LEVEL FN'S fn escaping_borrow_of_fn_params_1() { - fn g<'a>(x: usize, y:usize) -> Box usize + 'a> { + fn g<'a>(x: usize, y:usize) -> Box usize + 'a> { let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) //~^ ERROR E0373 //~| ERROR E0373 @@ -62,7 +62,7 @@ fn escaping_borrow_of_fn_params_1() { } fn escaping_borrow_of_fn_params_2() { - fn g<'a>(x: usize, y:usize) -> Box usize + 'a> { + fn g<'a>(x: usize, y:usize) -> Box usize + 'a> { let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) //~^ ERROR E0373 //~| ERROR E0373 @@ -73,7 +73,7 @@ fn escaping_borrow_of_fn_params_2() { } fn move_of_fn_params() { - fn g<'a>(x: usize, y:usize) -> Box usize + 'a> { + fn g<'a>(x: usize, y:usize) -> Box usize + 'a> { let f = move |t: bool| if t { x } else { y }; return Box::new(f); }; @@ -86,7 +86,7 @@ fn move_of_fn_params() { fn escaping_borrow_of_method_params_1() { struct S; impl S { - fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a> { + fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a> { let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) //~^ ERROR E0373 //~| ERROR E0373 @@ -100,7 +100,7 @@ fn escaping_borrow_of_method_params_1() { fn escaping_borrow_of_method_params_2() { struct S; impl S { - fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a> { + fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a> { let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) //~^ ERROR E0373 //~| ERROR E0373 @@ -113,7 +113,7 @@ fn escaping_borrow_of_method_params_2() { fn move_of_method_params() { struct S; impl S { - fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a> { + fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a> { let f = move |t: bool| if t { x } else { y }; return Box::new(f); } @@ -125,10 +125,10 @@ fn move_of_method_params() { // TRAIT IMPL METHODS fn escaping_borrow_of_trait_impl_params_1() { - trait T { fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a>; } + trait T { fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a>; } struct S; impl T for S { - fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a> { + fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a> { let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) //~^ ERROR E0373 //~| ERROR E0373 @@ -140,10 +140,10 @@ fn escaping_borrow_of_trait_impl_params_1() { } fn escaping_borrow_of_trait_impl_params_2() { - trait T { fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a>; } + trait T { fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a>; } struct S; impl T for S { - fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a> { + fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a> { let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) //~^ ERROR E0373 //~| ERROR E0373 @@ -154,10 +154,10 @@ fn escaping_borrow_of_trait_impl_params_2() { } fn move_of_trait_impl_params() { - trait T { fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a>; } + trait T { fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a>; } struct S; impl T for S { - fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a> { + fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a> { let f = move |t: bool| if t { x } else { y }; return Box::new(f); } @@ -171,7 +171,7 @@ fn move_of_trait_impl_params() { fn escaping_borrow_of_trait_default_params_1() { struct S; trait T { - fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a> { + fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a> { let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) //~^ ERROR E0373 //~| ERROR E0373 @@ -185,7 +185,7 @@ fn escaping_borrow_of_trait_default_params_1() { fn escaping_borrow_of_trait_default_params_2() { struct S; trait T { - fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a> { + fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a> { let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) //~^ ERROR E0373 //~| ERROR E0373 @@ -199,7 +199,7 @@ fn escaping_borrow_of_trait_default_params_2() { fn move_of_trait_default_params() { struct S; trait T { - fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a> { + fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a> { let f = move |t: bool| if t { x } else { y }; return Box::new(f); } diff --git a/src/test/ui/regions/region-bounds-on-objects-and-type-parameters.rs b/src/test/ui/regions/region-bounds-on-objects-and-type-parameters.rs index 3a211b046360..40d2b740b430 100644 --- a/src/test/ui/regions/region-bounds-on-objects-and-type-parameters.rs +++ b/src/test/ui/regions/region-bounds-on-objects-and-type-parameters.rs @@ -10,15 +10,15 @@ trait SomeTrait { } struct Foo<'a,'b,'c> { //~ ERROR parameter `'c` is never used // All of these are ok, because we can derive exactly one bound: - a: Box, - b: Box>, - c: Box>, - d: Box, - e: Box+Send>, // we can derive two bounds, but one is 'static, so ok - f: Box, // OK, defaults to 'static due to RFC 599. - g: Box, + a: Box, + b: Box>, + c: Box>, + d: Box, + e: Box+Send>, // we can derive two bounds, but one is 'static, so ok + f: Box, // OK, defaults to 'static due to RFC 599. + g: Box, - z: Box+'b+'c>, + z: Box+'b+'c>, //~^ ERROR only a single explicit lifetime bound is permitted //~| ERROR lifetime bound not satisfied } diff --git a/src/test/ui/regions/region-bounds-on-objects-and-type-parameters.stderr b/src/test/ui/regions/region-bounds-on-objects-and-type-parameters.stderr index 8bcb2da45779..003dd0699d38 100644 --- a/src/test/ui/regions/region-bounds-on-objects-and-type-parameters.stderr +++ b/src/test/ui/regions/region-bounds-on-objects-and-type-parameters.stderr @@ -1,14 +1,14 @@ error[E0226]: only a single explicit lifetime bound is permitted - --> $DIR/region-bounds-on-objects-and-type-parameters.rs:21:22 + --> $DIR/region-bounds-on-objects-and-type-parameters.rs:21:26 | -LL | z: Box+'b+'c>, - | ^^ +LL | z: Box+'b+'c>, + | ^^ error[E0478]: lifetime bound not satisfied --> $DIR/region-bounds-on-objects-and-type-parameters.rs:21:5 | -LL | z: Box+'b+'c>, - | ^^^^^^^^^^^^^^^^^^^^ +LL | z: Box+'b+'c>, + | ^^^^^^^^^^^^^^^^^^^^^^^^ | note: lifetime parameter instantiated with the lifetime 'b as defined on the struct at 11:15 --> $DIR/region-bounds-on-objects-and-type-parameters.rs:11:15 diff --git a/src/test/ui/regions/region-object-lifetime-2.nll.stderr b/src/test/ui/regions/region-object-lifetime-2.nll.stderr index 56e8c40c99f7..60084773466a 100644 --- a/src/test/ui/regions/region-object-lifetime-2.nll.stderr +++ b/src/test/ui/regions/region-object-lifetime-2.nll.stderr @@ -1,7 +1,7 @@ error: lifetime may not live long enough --> $DIR/region-object-lifetime-2.rs:10:5 | -LL | fn borrowed_receiver_different_lifetimes<'a,'b>(x: &'a Foo) -> &'b () { +LL | fn borrowed_receiver_different_lifetimes<'a,'b>(x: &'a dyn Foo) -> &'b () { | -- -- lifetime `'b` defined here | | | lifetime `'a` defined here diff --git a/src/test/ui/regions/region-object-lifetime-2.rs b/src/test/ui/regions/region-object-lifetime-2.rs index 92c85020e9a8..427984878933 100644 --- a/src/test/ui/regions/region-object-lifetime-2.rs +++ b/src/test/ui/regions/region-object-lifetime-2.rs @@ -6,7 +6,7 @@ trait Foo { } // Borrowed receiver but two distinct lifetimes, we get an error. -fn borrowed_receiver_different_lifetimes<'a,'b>(x: &'a Foo) -> &'b () { +fn borrowed_receiver_different_lifetimes<'a,'b>(x: &'a dyn Foo) -> &'b () { x.borrowed() //~ ERROR cannot infer } diff --git a/src/test/ui/regions/region-object-lifetime-2.stderr b/src/test/ui/regions/region-object-lifetime-2.stderr index d3552ab0c4b2..0c5e22ebae28 100644 --- a/src/test/ui/regions/region-object-lifetime-2.stderr +++ b/src/test/ui/regions/region-object-lifetime-2.stderr @@ -7,7 +7,7 @@ LL | x.borrowed() note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 9:42... --> $DIR/region-object-lifetime-2.rs:9:42 | -LL | fn borrowed_receiver_different_lifetimes<'a,'b>(x: &'a Foo) -> &'b () { +LL | fn borrowed_receiver_different_lifetimes<'a,'b>(x: &'a dyn Foo) -> &'b () { | ^^ note: ...so that reference does not outlive borrowed content --> $DIR/region-object-lifetime-2.rs:10:5 @@ -17,7 +17,7 @@ LL | x.borrowed() note: but, the lifetime must be valid for the lifetime 'b as defined on the function body at 9:45... --> $DIR/region-object-lifetime-2.rs:9:45 | -LL | fn borrowed_receiver_different_lifetimes<'a,'b>(x: &'a Foo) -> &'b () { +LL | fn borrowed_receiver_different_lifetimes<'a,'b>(x: &'a dyn Foo) -> &'b () { | ^^ note: ...so that reference does not outlive borrowed content --> $DIR/region-object-lifetime-2.rs:10:5 diff --git a/src/test/ui/regions/region-object-lifetime-4.nll.stderr b/src/test/ui/regions/region-object-lifetime-4.nll.stderr index aa91c371f41b..75b049dae21f 100644 --- a/src/test/ui/regions/region-object-lifetime-4.nll.stderr +++ b/src/test/ui/regions/region-object-lifetime-4.nll.stderr @@ -1,7 +1,7 @@ error: lifetime may not live long enough --> $DIR/region-object-lifetime-4.rs:12:5 | -LL | fn borrowed_receiver_related_lifetimes2<'a,'b>(x: &'a (Foo+'b)) -> &'b () { +LL | fn borrowed_receiver_related_lifetimes2<'a,'b>(x: &'a (dyn Foo + 'b)) -> &'b () { | -- -- lifetime `'b` defined here | | | lifetime `'a` defined here diff --git a/src/test/ui/regions/region-object-lifetime-4.rs b/src/test/ui/regions/region-object-lifetime-4.rs index d2ab617ebb76..4fe12b2acfc6 100644 --- a/src/test/ui/regions/region-object-lifetime-4.rs +++ b/src/test/ui/regions/region-object-lifetime-4.rs @@ -8,7 +8,7 @@ trait Foo { // Here we have two distinct lifetimes, but we try to return a pointer // with the longer lifetime when (from the signature) we only know // that it lives as long as the shorter lifetime. Therefore, error. -fn borrowed_receiver_related_lifetimes2<'a,'b>(x: &'a (Foo+'b)) -> &'b () { +fn borrowed_receiver_related_lifetimes2<'a,'b>(x: &'a (dyn Foo + 'b)) -> &'b () { x.borrowed() //~ ERROR cannot infer } diff --git a/src/test/ui/regions/region-object-lifetime-4.stderr b/src/test/ui/regions/region-object-lifetime-4.stderr index 75b26ffc6d57..e737d27d5606 100644 --- a/src/test/ui/regions/region-object-lifetime-4.stderr +++ b/src/test/ui/regions/region-object-lifetime-4.stderr @@ -7,7 +7,7 @@ LL | x.borrowed() note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 11:41... --> $DIR/region-object-lifetime-4.rs:11:41 | -LL | fn borrowed_receiver_related_lifetimes2<'a,'b>(x: &'a (Foo+'b)) -> &'b () { +LL | fn borrowed_receiver_related_lifetimes2<'a,'b>(x: &'a (dyn Foo + 'b)) -> &'b () { | ^^ note: ...so that reference does not outlive borrowed content --> $DIR/region-object-lifetime-4.rs:12:5 @@ -17,7 +17,7 @@ LL | x.borrowed() note: but, the lifetime must be valid for the lifetime 'b as defined on the function body at 11:44... --> $DIR/region-object-lifetime-4.rs:11:44 | -LL | fn borrowed_receiver_related_lifetimes2<'a,'b>(x: &'a (Foo+'b)) -> &'b () { +LL | fn borrowed_receiver_related_lifetimes2<'a,'b>(x: &'a (dyn Foo + 'b)) -> &'b () { | ^^ note: ...so that reference does not outlive borrowed content --> $DIR/region-object-lifetime-4.rs:12:5 diff --git a/src/test/ui/regions/region-object-lifetime-5.rs b/src/test/ui/regions/region-object-lifetime-5.rs index bd68aebbeeb0..307bbcbd58d7 100644 --- a/src/test/ui/regions/region-object-lifetime-5.rs +++ b/src/test/ui/regions/region-object-lifetime-5.rs @@ -7,7 +7,7 @@ trait Foo { // Here, the object is bounded by an anonymous lifetime and returned // as `&'static`, so you get an error. -fn owned_receiver(x: Box) -> &'static () { +fn owned_receiver(x: Box) -> &'static () { x.borrowed() //~ ERROR cannot return value referencing local data `*x` } diff --git a/src/test/ui/regions/region-object-lifetime-in-coercion.nll.stderr b/src/test/ui/regions/region-object-lifetime-in-coercion.nll.stderr index a54f8f5faab5..43acbfd412d9 100644 --- a/src/test/ui/regions/region-object-lifetime-in-coercion.nll.stderr +++ b/src/test/ui/regions/region-object-lifetime-in-coercion.nll.stderr @@ -1,15 +1,15 @@ error[E0621]: explicit lifetime required in the type of `v` --> $DIR/region-object-lifetime-in-coercion.rs:8:12 | -LL | fn a(v: &[u8]) -> Box { +LL | fn a(v: &[u8]) -> Box { | ----- help: add explicit lifetime `'static` to the type of `v`: `&'static [u8]` -LL | let x: Box = Box::new(v); - | ^^^^^^^^^^^^^^^^^^ lifetime `'static` required +LL | let x: Box = Box::new(v); + | ^^^^^^^^^^^^^^^^^^^^^^ lifetime `'static` required error[E0621]: explicit lifetime required in the type of `v` --> $DIR/region-object-lifetime-in-coercion.rs:14:5 | -LL | fn b(v: &[u8]) -> Box { +LL | fn b(v: &[u8]) -> Box { | ----- help: add explicit lifetime `'static` to the type of `v`: `&'static [u8]` LL | Box::new(v) | ^^^^^^^^^^^ lifetime `'static` required @@ -17,7 +17,7 @@ LL | Box::new(v) error[E0621]: explicit lifetime required in the type of `v` --> $DIR/region-object-lifetime-in-coercion.rs:21:5 | -LL | fn c(v: &[u8]) -> Box { +LL | fn c(v: &[u8]) -> Box { | ----- help: add explicit lifetime `'static` to the type of `v`: `&'static [u8]` ... LL | Box::new(v) @@ -26,7 +26,7 @@ LL | Box::new(v) error: lifetime may not live long enough --> $DIR/region-object-lifetime-in-coercion.rs:26:5 | -LL | fn d<'a,'b>(v: &'a [u8]) -> Box { +LL | fn d<'a,'b>(v: &'a [u8]) -> Box { | -- -- lifetime `'b` defined here | | | lifetime `'a` defined here diff --git a/src/test/ui/regions/region-object-lifetime-in-coercion.rs b/src/test/ui/regions/region-object-lifetime-in-coercion.rs index dfba04b0d25f..2dc67599913a 100644 --- a/src/test/ui/regions/region-object-lifetime-in-coercion.rs +++ b/src/test/ui/regions/region-object-lifetime-in-coercion.rs @@ -4,30 +4,30 @@ trait Foo {} impl<'a> Foo for &'a [u8] {} -fn a(v: &[u8]) -> Box { - let x: Box = Box::new(v); +fn a(v: &[u8]) -> Box { + let x: Box = Box::new(v); //~^ ERROR explicit lifetime required in the type of `v` [E0621] x } -fn b(v: &[u8]) -> Box { +fn b(v: &[u8]) -> Box { Box::new(v) //~^ ERROR explicit lifetime required in the type of `v` [E0621] } -fn c(v: &[u8]) -> Box { +fn c(v: &[u8]) -> Box { // same as previous case due to RFC 599 Box::new(v) //~^ ERROR explicit lifetime required in the type of `v` [E0621] } -fn d<'a,'b>(v: &'a [u8]) -> Box { +fn d<'a,'b>(v: &'a [u8]) -> Box { Box::new(v) //~^ ERROR cannot infer an appropriate lifetime due to conflicting } -fn e<'a:'b,'b>(v: &'a [u8]) -> Box { +fn e<'a:'b,'b>(v: &'a [u8]) -> Box { Box::new(v) // OK, thanks to 'a:'b } diff --git a/src/test/ui/regions/region-object-lifetime-in-coercion.stderr b/src/test/ui/regions/region-object-lifetime-in-coercion.stderr index c94a25ce6047..8209fa1840d0 100644 --- a/src/test/ui/regions/region-object-lifetime-in-coercion.stderr +++ b/src/test/ui/regions/region-object-lifetime-in-coercion.stderr @@ -1,15 +1,15 @@ error[E0621]: explicit lifetime required in the type of `v` - --> $DIR/region-object-lifetime-in-coercion.rs:8:33 + --> $DIR/region-object-lifetime-in-coercion.rs:8:37 | -LL | fn a(v: &[u8]) -> Box { +LL | fn a(v: &[u8]) -> Box { | ----- help: add explicit lifetime `'static` to the type of `v`: `&'static [u8]` -LL | let x: Box = Box::new(v); - | ^^^^^^^^^^^ lifetime `'static` required +LL | let x: Box = Box::new(v); + | ^^^^^^^^^^^ lifetime `'static` required error[E0621]: explicit lifetime required in the type of `v` --> $DIR/region-object-lifetime-in-coercion.rs:14:5 | -LL | fn b(v: &[u8]) -> Box { +LL | fn b(v: &[u8]) -> Box { | ----- help: add explicit lifetime `'static` to the type of `v`: `&'static [u8]` LL | Box::new(v) | ^^^^^^^^^^^ lifetime `'static` required @@ -17,7 +17,7 @@ LL | Box::new(v) error[E0621]: explicit lifetime required in the type of `v` --> $DIR/region-object-lifetime-in-coercion.rs:21:5 | -LL | fn c(v: &[u8]) -> Box { +LL | fn c(v: &[u8]) -> Box { | ----- help: add explicit lifetime `'static` to the type of `v`: `&'static [u8]` ... LL | Box::new(v) @@ -32,7 +32,7 @@ LL | Box::new(v) note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 25:6... --> $DIR/region-object-lifetime-in-coercion.rs:25:6 | -LL | fn d<'a,'b>(v: &'a [u8]) -> Box { +LL | fn d<'a,'b>(v: &'a [u8]) -> Box { | ^^ = note: ...so that the expression is assignable: expected &[u8] @@ -40,7 +40,7 @@ LL | fn d<'a,'b>(v: &'a [u8]) -> Box { note: but, the lifetime must be valid for the lifetime 'b as defined on the function body at 25:9... --> $DIR/region-object-lifetime-in-coercion.rs:25:9 | -LL | fn d<'a,'b>(v: &'a [u8]) -> Box { +LL | fn d<'a,'b>(v: &'a [u8]) -> Box { | ^^ = note: ...so that the expression is assignable: expected std::boxed::Box<(dyn Foo + 'b)> diff --git a/src/test/ui/regions/regions-close-associated-type-into-object.rs b/src/test/ui/regions/regions-close-associated-type-into-object.rs index 853d96113871..0cbdc828c507 100644 --- a/src/test/ui/regions/regions-close-associated-type-into-object.rs +++ b/src/test/ui/regions/regions-close-associated-type-into-object.rs @@ -9,54 +9,54 @@ trait Iter { fn as_item(&self) -> &Self::Item; } -fn bad1(v: T) -> Box +fn bad1(v: T) -> Box { let item = v.into_item(); Box::new(item) //~ ERROR associated type `::Item` may not live long enough } -fn bad2(v: T) -> Box +fn bad2(v: T) -> Box where Box : X { let item: Box<_> = box v.into_item(); Box::new(item) //~ ERROR associated type `::Item` may not live long enough } -fn bad3<'a, T: Iter>(v: T) -> Box +fn bad3<'a, T: Iter>(v: T) -> Box { let item = v.into_item(); Box::new(item) //~ ERROR associated type `::Item` may not live long enough } -fn bad4<'a, T: Iter>(v: T) -> Box +fn bad4<'a, T: Iter>(v: T) -> Box where Box : X { let item: Box<_> = box v.into_item(); Box::new(item) //~ ERROR associated type `::Item` may not live long enough } -fn ok1<'a, T: Iter>(v: T) -> Box +fn ok1<'a, T: Iter>(v: T) -> Box where T::Item : 'a { let item = v.into_item(); Box::new(item) // OK, T::Item : 'a is declared } -fn ok2<'a, T: Iter>(v: &T, w: &'a T::Item) -> Box +fn ok2<'a, T: Iter>(v: &T, w: &'a T::Item) -> Box where T::Item : Clone { let item = Clone::clone(w); Box::new(item) // OK, T::Item : 'a is implied } -fn ok3<'a, T: Iter>(v: &'a T) -> Box +fn ok3<'a, T: Iter>(v: &'a T) -> Box where T::Item : Clone + 'a { let item = Clone::clone(v.as_item()); Box::new(item) // OK, T::Item : 'a was declared } -fn meh1<'a, T: Iter>(v: &'a T) -> Box +fn meh1<'a, T: Iter>(v: &'a T) -> Box where T::Item : Clone { // This case is kind of interesting. It's the same as `ok3` but diff --git a/src/test/ui/regions/regions-close-object-into-object-2.nll.stderr b/src/test/ui/regions/regions-close-object-into-object-2.nll.stderr index 42df9b1c49fb..806a3ca82425 100644 --- a/src/test/ui/regions/regions-close-object-into-object-2.nll.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-2.nll.stderr @@ -1,16 +1,16 @@ error: lifetime may not live long enough --> $DIR/regions-close-object-into-object-2.rs:10:5 | -LL | fn g<'a, T: 'static>(v: Box+'a>) -> Box { +LL | fn g<'a, T: 'static>(v: Box + 'a>) -> Box { | -- lifetime `'a` defined here -LL | box B(&*v) as Box - | ^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` +LL | box B(&*v) as Box + | ^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` error[E0515]: cannot return value referencing local data `*v` --> $DIR/regions-close-object-into-object-2.rs:10:5 | -LL | box B(&*v) as Box - | ^^^^^^---^^^^^^^^^^^ +LL | box B(&*v) as Box + | ^^^^^^---^^^^^^^^^^^^^^^ | | | | | `*v` is borrowed here | returns a value referencing data owned by the current function diff --git a/src/test/ui/regions/regions-close-object-into-object-2.rs b/src/test/ui/regions/regions-close-object-into-object-2.rs index cebb4ac68cbc..2364ba272860 100644 --- a/src/test/ui/regions/regions-close-object-into-object-2.rs +++ b/src/test/ui/regions/regions-close-object-into-object-2.rs @@ -1,13 +1,13 @@ #![feature(box_syntax)] trait A { } -struct B<'a, T:'a>(&'a (A+'a)); +struct B<'a, T:'a>(&'a (dyn A + 'a)); trait X { } impl<'a, T> X for B<'a, T> {} -fn g<'a, T: 'static>(v: Box+'a>) -> Box { - box B(&*v) as Box //~ ERROR cannot infer +fn g<'a, T: 'static>(v: Box + 'a>) -> Box { + box B(&*v) as Box //~ ERROR cannot infer } fn main() { } diff --git a/src/test/ui/regions/regions-close-object-into-object-2.stderr b/src/test/ui/regions/regions-close-object-into-object-2.stderr index b5b03e618e1d..fa203debb3a1 100644 --- a/src/test/ui/regions/regions-close-object-into-object-2.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-2.stderr @@ -1,18 +1,18 @@ error[E0495]: cannot infer an appropriate lifetime for borrow expression due to conflicting requirements --> $DIR/regions-close-object-into-object-2.rs:10:11 | -LL | box B(&*v) as Box +LL | box B(&*v) as Box | ^^^ | note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 9:6... --> $DIR/regions-close-object-into-object-2.rs:9:6 | -LL | fn g<'a, T: 'static>(v: Box+'a>) -> Box { +LL | fn g<'a, T: 'static>(v: Box + 'a>) -> Box { | ^^ note: ...so that the type `(dyn A + 'a)` is not borrowed for too long --> $DIR/regions-close-object-into-object-2.rs:10:11 | -LL | box B(&*v) as Box +LL | box B(&*v) as Box | ^^^ = note: but, the lifetime must be valid for the static lifetime... = note: ...so that the expression is assignable: diff --git a/src/test/ui/regions/regions-close-object-into-object-4.nll.stderr b/src/test/ui/regions/regions-close-object-into-object-4.nll.stderr index 8af94fa7e79b..1e57023bc232 100644 --- a/src/test/ui/regions/regions-close-object-into-object-4.nll.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-4.nll.stderr @@ -1,7 +1,7 @@ error[E0310]: the parameter type `U` may not live long enough --> $DIR/regions-close-object-into-object-4.rs:10:5 | -LL | box B(&*v) as Box +LL | box B(&*v) as Box | ^^^^^^^^^^ | = help: consider adding an explicit lifetime bound `U: 'static`... @@ -9,16 +9,16 @@ LL | box B(&*v) as Box error: lifetime may not live long enough --> $DIR/regions-close-object-into-object-4.rs:10:5 | -LL | fn i<'a, T, U>(v: Box+'a>) -> Box { +LL | fn i<'a, T, U>(v: Box+'a>) -> Box { | -- lifetime `'a` defined here -LL | box B(&*v) as Box - | ^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` +LL | box B(&*v) as Box + | ^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` error[E0515]: cannot return value referencing local data `*v` --> $DIR/regions-close-object-into-object-4.rs:10:5 | -LL | box B(&*v) as Box - | ^^^^^^---^^^^^^^^^^^ +LL | box B(&*v) as Box + | ^^^^^^---^^^^^^^^^^^^^^^ | | | | | `*v` is borrowed here | returns a value referencing data owned by the current function @@ -26,7 +26,7 @@ LL | box B(&*v) as Box error[E0310]: the parameter type `U` may not live long enough --> $DIR/regions-close-object-into-object-4.rs:10:9 | -LL | box B(&*v) as Box +LL | box B(&*v) as Box | ^^^^^^ | = help: consider adding an explicit lifetime bound `U: 'static`... diff --git a/src/test/ui/regions/regions-close-object-into-object-4.rs b/src/test/ui/regions/regions-close-object-into-object-4.rs index 91aab057bb9a..d53107704368 100644 --- a/src/test/ui/regions/regions-close-object-into-object-4.rs +++ b/src/test/ui/regions/regions-close-object-into-object-4.rs @@ -1,13 +1,13 @@ #![feature(box_syntax)] trait A { } -struct B<'a, T:'a>(&'a (A+'a)); +struct B<'a, T:'a>(&'a (dyn A + 'a)); trait X { } impl<'a, T> X for B<'a, T> {} -fn i<'a, T, U>(v: Box+'a>) -> Box { - box B(&*v) as Box //~ ERROR cannot infer +fn i<'a, T, U>(v: Box+'a>) -> Box { + box B(&*v) as Box //~ ERROR cannot infer } fn main() {} diff --git a/src/test/ui/regions/regions-close-object-into-object-4.stderr b/src/test/ui/regions/regions-close-object-into-object-4.stderr index 20cbcbb841f2..f5e66f84a9ee 100644 --- a/src/test/ui/regions/regions-close-object-into-object-4.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-4.stderr @@ -1,18 +1,18 @@ error[E0495]: cannot infer an appropriate lifetime for borrow expression due to conflicting requirements --> $DIR/regions-close-object-into-object-4.rs:10:11 | -LL | box B(&*v) as Box +LL | box B(&*v) as Box | ^^^ | note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 9:6... --> $DIR/regions-close-object-into-object-4.rs:9:6 | -LL | fn i<'a, T, U>(v: Box+'a>) -> Box { +LL | fn i<'a, T, U>(v: Box+'a>) -> Box { | ^^ note: ...so that the type `(dyn A + 'a)` is not borrowed for too long --> $DIR/regions-close-object-into-object-4.rs:10:11 | -LL | box B(&*v) as Box +LL | box B(&*v) as Box | ^^^ = note: but, the lifetime must be valid for the static lifetime... = note: ...so that the expression is assignable: diff --git a/src/test/ui/regions/regions-close-over-type-parameter-1.nll.stderr b/src/test/ui/regions/regions-close-over-type-parameter-1.nll.stderr index 30fdb820e363..7d3d51bdb437 100644 --- a/src/test/ui/regions/regions-close-over-type-parameter-1.nll.stderr +++ b/src/test/ui/regions/regions-close-over-type-parameter-1.nll.stderr @@ -1,7 +1,7 @@ error[E0310]: the parameter type `A` may not live long enough --> $DIR/regions-close-over-type-parameter-1.rs:10:5 | -LL | box v as Box +LL | box v as Box | ^^^^^ | = help: consider adding an explicit lifetime bound `A: 'static`... @@ -9,7 +9,7 @@ LL | box v as Box error[E0309]: the parameter type `A` may not live long enough --> $DIR/regions-close-over-type-parameter-1.rs:20:5 | -LL | box v as Box +LL | box v as Box | ^^^^^ | = help: consider adding an explicit lifetime bound `A: 'b`... diff --git a/src/test/ui/regions/regions-close-over-type-parameter-1.rs b/src/test/ui/regions/regions-close-over-type-parameter-1.rs index 9aee9663e8f4..6a9aa66a446c 100644 --- a/src/test/ui/regions/regions-close-over-type-parameter-1.rs +++ b/src/test/ui/regions/regions-close-over-type-parameter-1.rs @@ -6,18 +6,18 @@ trait SomeTrait { fn get(&self) -> isize; } -fn make_object1(v: A) -> Box { - box v as Box +fn make_object1(v: A) -> Box { + box v as Box //~^ ERROR the parameter type `A` may not live long enough //~| ERROR the parameter type `A` may not live long enough } -fn make_object2<'a,A:SomeTrait+'a>(v: A) -> Box { - box v as Box +fn make_object2<'a,A:SomeTrait+'a>(v: A) -> Box { + box v as Box } -fn make_object3<'a,'b,A:SomeTrait+'a>(v: A) -> Box { - box v as Box +fn make_object3<'a,'b,A:SomeTrait+'a>(v: A) -> Box { + box v as Box //~^ ERROR the parameter type `A` may not live long enough //~| ERROR the parameter type `A` may not live long enough } diff --git a/src/test/ui/regions/regions-close-over-type-parameter-1.stderr b/src/test/ui/regions/regions-close-over-type-parameter-1.stderr index 615c55d9da34..81534b7b770d 100644 --- a/src/test/ui/regions/regions-close-over-type-parameter-1.stderr +++ b/src/test/ui/regions/regions-close-over-type-parameter-1.stderr @@ -1,58 +1,58 @@ error[E0310]: the parameter type `A` may not live long enough --> $DIR/regions-close-over-type-parameter-1.rs:10:5 | -LL | fn make_object1(v: A) -> Box { +LL | fn make_object1(v: A) -> Box { | -- help: consider adding an explicit lifetime bound `A: 'static`... -LL | box v as Box +LL | box v as Box | ^^^^^ | note: ...so that the type `A` will meet its required lifetime bounds --> $DIR/regions-close-over-type-parameter-1.rs:10:5 | -LL | box v as Box +LL | box v as Box | ^^^^^ error[E0310]: the parameter type `A` may not live long enough --> $DIR/regions-close-over-type-parameter-1.rs:10:5 | -LL | fn make_object1(v: A) -> Box { +LL | fn make_object1(v: A) -> Box { | -- help: consider adding an explicit lifetime bound `A: 'static`... -LL | box v as Box - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | box v as Box + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: ...so that it can be closed over into an object --> $DIR/regions-close-over-type-parameter-1.rs:10:5 | -LL | box v as Box - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | box v as Box + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0309]: the parameter type `A` may not live long enough --> $DIR/regions-close-over-type-parameter-1.rs:20:5 | -LL | fn make_object3<'a,'b,A:SomeTrait+'a>(v: A) -> Box { +LL | fn make_object3<'a,'b,A:SomeTrait+'a>(v: A) -> Box { | -- help: consider adding an explicit lifetime bound `A: 'b`... -LL | box v as Box +LL | box v as Box | ^^^^^ | note: ...so that the type `A` will meet its required lifetime bounds --> $DIR/regions-close-over-type-parameter-1.rs:20:5 | -LL | box v as Box +LL | box v as Box | ^^^^^ error[E0309]: the parameter type `A` may not live long enough --> $DIR/regions-close-over-type-parameter-1.rs:20:5 | -LL | fn make_object3<'a,'b,A:SomeTrait+'a>(v: A) -> Box { +LL | fn make_object3<'a,'b,A:SomeTrait+'a>(v: A) -> Box { | -- help: consider adding an explicit lifetime bound `A: 'b`... -LL | box v as Box - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | box v as Box + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: ...so that it can be closed over into an object --> $DIR/regions-close-over-type-parameter-1.rs:20:5 | -LL | box v as Box - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | box v as Box + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/regions/regions-close-over-type-parameter-multiple.nll.stderr b/src/test/ui/regions/regions-close-over-type-parameter-multiple.nll.stderr index 001ed7fe4c53..88d6abd1428a 100644 --- a/src/test/ui/regions/regions-close-over-type-parameter-multiple.nll.stderr +++ b/src/test/ui/regions/regions-close-over-type-parameter-multiple.nll.stderr @@ -1,13 +1,13 @@ error: lifetime may not live long enough --> $DIR/regions-close-over-type-parameter-multiple.rs:20:5 | -LL | fn make_object_bad<'a,'b,'c,A:SomeTrait+'a+'b>(v: A) -> Box { +LL | fn make_object_bad<'a,'b,'c,A:SomeTrait+'a+'b>(v: A) -> Box { | -- -- lifetime `'c` defined here | | | lifetime `'a` defined here LL | // A outlives 'a AND 'b...but not 'c. -LL | box v as Box - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'c` +LL | box v as Box + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'c` error: aborting due to previous error diff --git a/src/test/ui/regions/regions-close-over-type-parameter-multiple.rs b/src/test/ui/regions/regions-close-over-type-parameter-multiple.rs index defbc5d9f239..26643e08985b 100644 --- a/src/test/ui/regions/regions-close-over-type-parameter-multiple.rs +++ b/src/test/ui/regions/regions-close-over-type-parameter-multiple.rs @@ -5,19 +5,19 @@ trait SomeTrait { fn get(&self) -> isize; } -fn make_object_good1<'a,'b,A:SomeTrait+'a+'b>(v: A) -> Box { +fn make_object_good1<'a,'b,A:SomeTrait+'a+'b>(v: A) -> Box { // A outlives 'a AND 'b... - box v as Box // ...hence this type is safe. + box v as Box // ...hence this type is safe. } -fn make_object_good2<'a,'b,A:SomeTrait+'a+'b>(v: A) -> Box { +fn make_object_good2<'a,'b,A:SomeTrait+'a+'b>(v: A) -> Box { // A outlives 'a AND 'b... - box v as Box // ...hence this type is safe. + box v as Box // ...hence this type is safe. } -fn make_object_bad<'a,'b,'c,A:SomeTrait+'a+'b>(v: A) -> Box { +fn make_object_bad<'a,'b,'c,A:SomeTrait+'a+'b>(v: A) -> Box { // A outlives 'a AND 'b...but not 'c. - box v as Box //~ ERROR cannot infer an appropriate lifetime + box v as Box //~ ERROR cannot infer an appropriate lifetime } fn main() { diff --git a/src/test/ui/regions/regions-close-over-type-parameter-multiple.stderr b/src/test/ui/regions/regions-close-over-type-parameter-multiple.stderr index 96e6a329e7d5..8b3dbc8b6490 100644 --- a/src/test/ui/regions/regions-close-over-type-parameter-multiple.stderr +++ b/src/test/ui/regions/regions-close-over-type-parameter-multiple.stderr @@ -1,23 +1,23 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements --> $DIR/regions-close-over-type-parameter-multiple.rs:20:5 | -LL | box v as Box - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | box v as Box + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 18:20... --> $DIR/regions-close-over-type-parameter-multiple.rs:18:20 | -LL | fn make_object_bad<'a,'b,'c,A:SomeTrait+'a+'b>(v: A) -> Box { +LL | fn make_object_bad<'a,'b,'c,A:SomeTrait+'a+'b>(v: A) -> Box { | ^^ note: ...so that the declared lifetime parameter bounds are satisfied --> $DIR/regions-close-over-type-parameter-multiple.rs:20:5 | -LL | box v as Box - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | box v as Box + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: but, the lifetime must be valid for the lifetime 'c as defined on the function body at 18:26... --> $DIR/regions-close-over-type-parameter-multiple.rs:18:26 | -LL | fn make_object_bad<'a,'b,'c,A:SomeTrait+'a+'b>(v: A) -> Box { +LL | fn make_object_bad<'a,'b,'c,A:SomeTrait+'a+'b>(v: A) -> Box { | ^^ = note: ...so that the expression is assignable: expected std::boxed::Box<(dyn SomeTrait + 'c)> diff --git a/src/test/ui/regions/regions-close-param-into-object.rs b/src/test/ui/regions/regions-close-param-into-object.rs index 86590748cb2d..2760e5eed959 100644 --- a/src/test/ui/regions/regions-close-param-into-object.rs +++ b/src/test/ui/regions/regions-close-param-into-object.rs @@ -1,24 +1,24 @@ trait X { fn foo(&self) {} } -fn p1(v: T) -> Box +fn p1(v: T) -> Box where T : X { Box::new(v) //~ ERROR parameter type `T` may not live long enough } -fn p2(v: Box) -> Box +fn p2(v: Box) -> Box where Box : X { Box::new(v) //~ ERROR parameter type `T` may not live long enough } -fn p3<'a,T>(v: T) -> Box +fn p3<'a,T>(v: T) -> Box where T : X { Box::new(v) //~ ERROR parameter type `T` may not live long enough } -fn p4<'a,T>(v: Box) -> Box +fn p4<'a,T>(v: Box) -> Box where Box : X { Box::new(v) //~ ERROR parameter type `T` may not live long enough diff --git a/src/test/ui/regions/regions-close-param-into-object.stderr b/src/test/ui/regions/regions-close-param-into-object.stderr index ef226073de6d..7f2c646c1219 100644 --- a/src/test/ui/regions/regions-close-param-into-object.stderr +++ b/src/test/ui/regions/regions-close-param-into-object.stderr @@ -1,7 +1,7 @@ error[E0310]: the parameter type `T` may not live long enough --> $DIR/regions-close-param-into-object.rs:6:5 | -LL | fn p1(v: T) -> Box +LL | fn p1(v: T) -> Box | - help: consider adding an explicit lifetime bound `T: 'static`... ... LL | Box::new(v) @@ -16,7 +16,7 @@ LL | Box::new(v) error[E0310]: the parameter type `T` may not live long enough --> $DIR/regions-close-param-into-object.rs:12:5 | -LL | fn p2(v: Box) -> Box +LL | fn p2(v: Box) -> Box | - help: consider adding an explicit lifetime bound `T: 'static`... ... LL | Box::new(v) @@ -31,7 +31,7 @@ LL | Box::new(v) error[E0309]: the parameter type `T` may not live long enough --> $DIR/regions-close-param-into-object.rs:18:5 | -LL | fn p3<'a,T>(v: T) -> Box +LL | fn p3<'a,T>(v: T) -> Box | - help: consider adding an explicit lifetime bound `T: 'a`... ... LL | Box::new(v) @@ -46,7 +46,7 @@ LL | Box::new(v) error[E0309]: the parameter type `T` may not live long enough --> $DIR/regions-close-param-into-object.rs:24:5 | -LL | fn p4<'a,T>(v: Box) -> Box +LL | fn p4<'a,T>(v: Box) -> Box | - help: consider adding an explicit lifetime bound `T: 'a`... ... LL | Box::new(v) diff --git a/src/test/ui/regions/regions-implied-bounds-projection-gap-hr-1.rs b/src/test/ui/regions/regions-implied-bounds-projection-gap-hr-1.rs index 7e04b6782eba..a4272802af54 100644 --- a/src/test/ui/regions/regions-implied-bounds-projection-gap-hr-1.rs +++ b/src/test/ui/regions/regions-implied-bounds-projection-gap-hr-1.rs @@ -18,7 +18,7 @@ trait Trait2<'a, 'b> { // this argument `t` is not automatically considered well-formed, // since for it to be WF, we would need to know that `'y: 'x`, but we // do not infer that. -fn callee<'x, 'y, T>(t: &'x for<'z> Trait1< >::Foo >) +fn callee<'x, 'y, T>(t: &'x dyn for<'z> Trait1< >::Foo >) //~^ ERROR reference has a longer lifetime than the data it references { } diff --git a/src/test/ui/regions/regions-implied-bounds-projection-gap-hr-1.stderr b/src/test/ui/regions/regions-implied-bounds-projection-gap-hr-1.stderr index ca86eb7edae1..b3390bcc4d50 100644 --- a/src/test/ui/regions/regions-implied-bounds-projection-gap-hr-1.stderr +++ b/src/test/ui/regions/regions-implied-bounds-projection-gap-hr-1.stderr @@ -1,7 +1,7 @@ error[E0491]: in type `&'x (dyn for<'z> Trait1<>::Foo> + 'x)`, reference has a longer lifetime than the data it references --> $DIR/regions-implied-bounds-projection-gap-hr-1.rs:21:1 | -LL | / fn callee<'x, 'y, T>(t: &'x for<'z> Trait1< >::Foo >) +LL | / fn callee<'x, 'y, T>(t: &'x dyn for<'z> Trait1< >::Foo >) LL | | LL | | { LL | | } @@ -10,12 +10,12 @@ LL | | } note: the pointer is valid for the lifetime 'x as defined on the function body at 21:11 --> $DIR/regions-implied-bounds-projection-gap-hr-1.rs:21:11 | -LL | fn callee<'x, 'y, T>(t: &'x for<'z> Trait1< >::Foo >) +LL | fn callee<'x, 'y, T>(t: &'x dyn for<'z> Trait1< >::Foo >) | ^^ note: but the referenced data is only valid for the lifetime 'y as defined on the function body at 21:15 --> $DIR/regions-implied-bounds-projection-gap-hr-1.rs:21:15 | -LL | fn callee<'x, 'y, T>(t: &'x for<'z> Trait1< >::Foo >) +LL | fn callee<'x, 'y, T>(t: &'x dyn for<'z> Trait1< >::Foo >) | ^^ error: aborting due to previous error diff --git a/src/test/ui/regions/regions-infer-at-fn-not-param.rs b/src/test/ui/regions/regions-infer-at-fn-not-param.rs index 0fd734d57b5c..fb9c5d5c210c 100644 --- a/src/test/ui/regions/regions-infer-at-fn-not-param.rs +++ b/src/test/ui/regions/regions-infer-at-fn-not-param.rs @@ -1,13 +1,13 @@ struct Parameterized1<'a> { - g: Box + g: Box } struct NotParameterized1 { - g: Box + g: Box } struct NotParameterized2 { - g: Box + g: Box } fn take1<'a>(p: Parameterized1) -> Parameterized1<'a> { p } diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.rs b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.rs index 168bf0284a18..5843598ab48e 100644 --- a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.rs +++ b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.rs @@ -1,5 +1,5 @@ struct Invariant<'a> { - f: Box, + f: Box, } fn to_same_lifetime<'r>(b_isize: Invariant<'r>) { diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.rs b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.rs index 90c86cebce38..f0af18cf6180 100644 --- a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.rs +++ b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.rs @@ -1,5 +1,5 @@ struct Invariant<'a> { - f: Box *mut &'a isize + 'static>, + f: Box *mut &'a isize + 'static>, } fn to_same_lifetime<'r>(b_isize: Invariant<'r>) { diff --git a/src/test/ui/regions/regions-infer-not-param.rs b/src/test/ui/regions/regions-infer-not-param.rs index 214402952a3d..d1744f8a51ee 100644 --- a/src/test/ui/regions/regions-infer-not-param.rs +++ b/src/test/ui/regions/regions-infer-not-param.rs @@ -4,12 +4,12 @@ struct Direct<'a> { struct Indirect1 { // Here the lifetime parameter of direct is bound by the fn() - g: Box + g: Box } struct Indirect2<'a> { // But here it is set to 'a - g: Box) + 'static> + g: Box) + 'static> } fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p } //~ ERROR mismatched types diff --git a/src/test/ui/regions/regions-name-undeclared.rs b/src/test/ui/regions/regions-name-undeclared.rs index 230a97a04b62..044c68897726 100644 --- a/src/test/ui/regions/regions-name-undeclared.rs +++ b/src/test/ui/regions/regions-name-undeclared.rs @@ -33,14 +33,14 @@ fn bar<'a>(x: &'a isize) { // &'a CAN be declared on functions and used then: fn g<'a>(a: &'a isize) { } // OK - fn h(a: Box FnOnce(&'a isize)>) { } // OK + fn h(a: Box FnOnce(&'a isize)>) { } // OK } // Test nesting of lifetimes in fn type declarations fn fn_types(a: &'a isize, //~ ERROR undeclared lifetime - b: Box FnOnce(&'a isize, + b: Box FnOnce(&'a isize, &'b isize, //~ ERROR undeclared lifetime - Box FnOnce(&'a isize, + Box FnOnce(&'a isize, &'b isize)>, &'b isize)>, //~ ERROR undeclared lifetime c: &'a isize) //~ ERROR undeclared lifetime diff --git a/src/test/ui/regions/regions-nested-fns.nll.stderr b/src/test/ui/regions/regions-nested-fns.nll.stderr index c11c09b6d0d5..97650636cb67 100644 --- a/src/test/ui/regions/regions-nested-fns.nll.stderr +++ b/src/test/ui/regions/regions-nested-fns.nll.stderr @@ -4,8 +4,8 @@ error[E0521]: borrowed data escapes outside of closure LL | let mut ay = &y; | ------ `ay` is declared here, outside of the closure body LL | -LL | ignore:: FnMut(&'z isize)>>(Box::new(|z| { - | - `z` is a reference that is only valid in the closure body +LL | ignore:: FnMut(&'z isize)>>(Box::new(|z| { + | - `z` is a reference that is only valid in the closure body ... LL | ay = z; | ^^^^^^ `z` escapes the closure body here @@ -25,8 +25,8 @@ LL | } error[E0597]: `y` does not live long enough --> $DIR/regions-nested-fns.rs:9:15 | -LL | ignore:: FnMut(&'z isize)>>(Box::new(|z| { - | --- value captured here +LL | ignore:: FnMut(&'z isize)>>(Box::new(|z| { + | --- value captured here LL | ay = x; LL | ay = &y; | ^ borrowed value does not live long enough diff --git a/src/test/ui/regions/regions-nested-fns.rs b/src/test/ui/regions/regions-nested-fns.rs index 161d812f016a..c02d4e0ce453 100644 --- a/src/test/ui/regions/regions-nested-fns.rs +++ b/src/test/ui/regions/regions-nested-fns.rs @@ -4,13 +4,13 @@ fn nested<'x>(x: &'x isize) { let y = 3; let mut ay = &y; //~ ERROR E0495 - ignore:: FnMut(&'z isize)>>(Box::new(|z| { + ignore:: FnMut(&'z isize)>>(Box::new(|z| { ay = x; ay = &y; ay = z; })); - ignore::< Box FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { + ignore::< Box FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { if false { return x; } //~ ERROR E0312 if false { return ay; } return z; diff --git a/src/test/ui/regions/regions-nested-fns.stderr b/src/test/ui/regions/regions-nested-fns.stderr index 702254a0ac42..15c9c9ca4ddb 100644 --- a/src/test/ui/regions/regions-nested-fns.stderr +++ b/src/test/ui/regions/regions-nested-fns.stderr @@ -4,11 +4,11 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requiremen LL | let mut ay = &y; | ^^ | -note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the body at 7:54... - --> $DIR/regions-nested-fns.rs:7:54 +note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the body at 7:58... + --> $DIR/regions-nested-fns.rs:7:58 | -LL | ignore:: FnMut(&'z isize)>>(Box::new(|z| { - | ______________________________________________________^ +LL | ignore:: FnMut(&'z isize)>>(Box::new(|z| { + | __________________________________________________________^ LL | | ay = x; LL | | ay = &y; LL | | ay = z; @@ -19,11 +19,11 @@ note: ...so that reference does not outlive borrowed content | LL | ay = z; | ^ -note: but, the lifetime must be valid for the anonymous lifetime #2 defined on the body at 13:68... - --> $DIR/regions-nested-fns.rs:13:68 +note: but, the lifetime must be valid for the anonymous lifetime #2 defined on the body at 13:72... + --> $DIR/regions-nested-fns.rs:13:72 | -LL | ignore::< Box FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { - | ____________________________________________________________________^ +LL | ignore::< Box FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { + | ________________________________________________________________________^ LL | | if false { return x; } LL | | if false { return ay; } LL | | return z; @@ -39,11 +39,11 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content... LL | if false { return x; } | ^ | -note: ...the reference is valid for the anonymous lifetime #2 defined on the body at 13:68... - --> $DIR/regions-nested-fns.rs:13:68 +note: ...the reference is valid for the anonymous lifetime #2 defined on the body at 13:72... + --> $DIR/regions-nested-fns.rs:13:72 | -LL | ignore::< Box FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { - | ____________________________________________________________________^ +LL | ignore::< Box FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { + | ________________________________________________________________________^ LL | | if false { return x; } LL | | if false { return ay; } LL | | return z; diff --git a/src/test/ui/regions/regions-proc-bound-capture.rs b/src/test/ui/regions/regions-proc-bound-capture.rs index f2010dbe62d8..0c903b738499 100644 --- a/src/test/ui/regions/regions-proc-bound-capture.rs +++ b/src/test/ui/regions/regions-proc-bound-capture.rs @@ -1,10 +1,10 @@ -fn borrowed_proc<'a>(x: &'a isize) -> Box(isize) + 'a> { +fn borrowed_proc<'a>(x: &'a isize) -> Box(isize) + 'a> { // This is legal, because the region bound on `proc` // states that it captures `x`. Box::new(move|| { *x }) } -fn static_proc(x: &isize) -> Box(isize) + 'static> { +fn static_proc(x: &isize) -> Box(isize) + 'static> { // This is illegal, because the region bound on `proc` is 'static. Box::new(move|| { *x }) //~ ERROR explicit lifetime required in the type of `x` [E0621] } diff --git a/src/test/ui/regions/regions-proc-bound-capture.stderr b/src/test/ui/regions/regions-proc-bound-capture.stderr index aea7347d53c2..c53af34456ef 100644 --- a/src/test/ui/regions/regions-proc-bound-capture.stderr +++ b/src/test/ui/regions/regions-proc-bound-capture.stderr @@ -1,7 +1,7 @@ error[E0621]: explicit lifetime required in the type of `x` --> $DIR/regions-proc-bound-capture.rs:9:5 | -LL | fn static_proc(x: &isize) -> Box(isize) + 'static> { +LL | fn static_proc(x: &isize) -> Box(isize) + 'static> { | ------ help: add explicit lifetime `'static` to the type of `x`: `&'static isize` LL | // This is illegal, because the region bound on `proc` is 'static. LL | Box::new(move|| { *x }) diff --git a/src/test/ui/regions/regions-steal-closure.rs b/src/test/ui/regions/regions-steal-closure.rs index e6b34510bb56..83e93522c948 100644 --- a/src/test/ui/regions/regions-steal-closure.rs +++ b/src/test/ui/regions/regions-steal-closure.rs @@ -1,10 +1,10 @@ #![feature(fn_traits)] struct ClosureBox<'a> { - cl: Box, + cl: Box, } -fn box_it<'r>(x: Box) -> ClosureBox<'r> { +fn box_it<'r>(x: Box) -> ClosureBox<'r> { ClosureBox {cl: x} } diff --git a/src/test/ui/regions/regions-trait-1.rs b/src/test/ui/regions/regions-trait-1.rs index 727388719362..0da8ac53695e 100644 --- a/src/test/ui/regions/regions-trait-1.rs +++ b/src/test/ui/regions/regions-trait-1.rs @@ -19,12 +19,12 @@ impl<'a> GetCtxt for HasCtxt<'a> { } -fn get_v(gc: Box) -> usize { +fn get_v(gc: Box) -> usize { gc.get_ctxt().v } fn main() { let ctxt = Ctxt { v: 22 }; let hc = HasCtxt { c: &ctxt }; - assert_eq!(get_v(box hc as Box), 22); + assert_eq!(get_v(box hc as Box), 22); } diff --git a/src/test/ui/regions/regions-trait-object-subtyping.nll.stderr b/src/test/ui/regions/regions-trait-object-subtyping.nll.stderr index eccf1b5e8cf7..f4b1a89db9a7 100644 --- a/src/test/ui/regions/regions-trait-object-subtyping.nll.stderr +++ b/src/test/ui/regions/regions-trait-object-subtyping.nll.stderr @@ -1,7 +1,7 @@ error: lifetime may not live long enough --> $DIR/regions-trait-object-subtyping.rs:15:5 | -LL | fn foo3<'a,'b>(x: &'a mut Dummy) -> &'b mut Dummy { +LL | fn foo3<'a,'b>(x: &'a mut dyn Dummy) -> &'b mut dyn Dummy { | -- -- lifetime `'b` defined here | | | lifetime `'a` defined here @@ -12,7 +12,7 @@ LL | x error: lifetime may not live long enough --> $DIR/regions-trait-object-subtyping.rs:22:5 | -LL | fn foo4<'a:'b,'b>(x: Wrapper<&'a mut Dummy>) -> Wrapper<&'b mut Dummy> { +LL | fn foo4<'a:'b,'b>(x: Wrapper<&'a mut dyn Dummy>) -> Wrapper<&'b mut dyn Dummy> { | -- -- lifetime `'b` defined here | | | lifetime `'a` defined here diff --git a/src/test/ui/regions/regions-trait-object-subtyping.rs b/src/test/ui/regions/regions-trait-object-subtyping.rs index eb2623544563..5b36194870ef 100644 --- a/src/test/ui/regions/regions-trait-object-subtyping.rs +++ b/src/test/ui/regions/regions-trait-object-subtyping.rs @@ -1,23 +1,23 @@ trait Dummy { fn dummy(&self); } -fn foo1<'a:'b,'b>(x: &'a mut (Dummy+'a)) -> &'b mut (Dummy+'b) { +fn foo1<'a:'b,'b>(x: &'a mut (dyn Dummy+'a)) -> &'b mut (dyn Dummy+'b) { // Here, we are able to coerce x } -fn foo2<'a:'b,'b>(x: &'b mut (Dummy+'a)) -> &'b mut (Dummy+'b) { +fn foo2<'a:'b,'b>(x: &'b mut (dyn Dummy+'a)) -> &'b mut (dyn Dummy+'b) { // Here, we are able to coerce x } -fn foo3<'a,'b>(x: &'a mut Dummy) -> &'b mut Dummy { +fn foo3<'a,'b>(x: &'a mut dyn Dummy) -> &'b mut dyn Dummy { // Without knowing 'a:'b, we can't coerce x //~ ERROR lifetime bound not satisfied //~^ ERROR cannot infer an appropriate lifetime } struct Wrapper(T); -fn foo4<'a:'b,'b>(x: Wrapper<&'a mut Dummy>) -> Wrapper<&'b mut Dummy> { +fn foo4<'a:'b,'b>(x: Wrapper<&'a mut dyn Dummy>) -> Wrapper<&'b mut dyn Dummy> { // We can't coerce because it is packed in `Wrapper` x //~ ERROR mismatched types } diff --git a/src/test/ui/regions/regions-trait-object-subtyping.stderr b/src/test/ui/regions/regions-trait-object-subtyping.stderr index f2d2b37d9072..6de92f13840b 100644 --- a/src/test/ui/regions/regions-trait-object-subtyping.stderr +++ b/src/test/ui/regions/regions-trait-object-subtyping.stderr @@ -7,12 +7,12 @@ LL | x note: lifetime parameter instantiated with the lifetime 'a as defined on the function body at 13:9 --> $DIR/regions-trait-object-subtyping.rs:13:9 | -LL | fn foo3<'a,'b>(x: &'a mut Dummy) -> &'b mut Dummy { +LL | fn foo3<'a,'b>(x: &'a mut dyn Dummy) -> &'b mut dyn Dummy { | ^^ note: but lifetime parameter must outlive the lifetime 'b as defined on the function body at 13:12 --> $DIR/regions-trait-object-subtyping.rs:13:12 | -LL | fn foo3<'a,'b>(x: &'a mut Dummy) -> &'b mut Dummy { +LL | fn foo3<'a,'b>(x: &'a mut dyn Dummy) -> &'b mut dyn Dummy { | ^^ error[E0495]: cannot infer an appropriate lifetime for automatic coercion due to conflicting requirements @@ -24,7 +24,7 @@ LL | x note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 13:9... --> $DIR/regions-trait-object-subtyping.rs:13:9 | -LL | fn foo3<'a,'b>(x: &'a mut Dummy) -> &'b mut Dummy { +LL | fn foo3<'a,'b>(x: &'a mut dyn Dummy) -> &'b mut dyn Dummy { | ^^ note: ...so that reference does not outlive borrowed content --> $DIR/regions-trait-object-subtyping.rs:15:5 @@ -34,7 +34,7 @@ LL | x note: but, the lifetime must be valid for the lifetime 'b as defined on the function body at 13:12... --> $DIR/regions-trait-object-subtyping.rs:13:12 | -LL | fn foo3<'a,'b>(x: &'a mut Dummy) -> &'b mut Dummy { +LL | fn foo3<'a,'b>(x: &'a mut dyn Dummy) -> &'b mut dyn Dummy { | ^^ = note: ...so that the expression is assignable: expected &'b mut (dyn Dummy + 'b) @@ -51,12 +51,12 @@ LL | x note: the lifetime 'b as defined on the function body at 20:15... --> $DIR/regions-trait-object-subtyping.rs:20:15 | -LL | fn foo4<'a:'b,'b>(x: Wrapper<&'a mut Dummy>) -> Wrapper<&'b mut Dummy> { +LL | fn foo4<'a:'b,'b>(x: Wrapper<&'a mut dyn Dummy>) -> Wrapper<&'b mut dyn Dummy> { | ^^ note: ...does not necessarily outlive the lifetime 'a as defined on the function body at 20:9 --> $DIR/regions-trait-object-subtyping.rs:20:9 | -LL | fn foo4<'a:'b,'b>(x: Wrapper<&'a mut Dummy>) -> Wrapper<&'b mut Dummy> { +LL | fn foo4<'a:'b,'b>(x: Wrapper<&'a mut dyn Dummy>) -> Wrapper<&'b mut dyn Dummy> { | ^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/regions/regions-trait-variance.rs b/src/test/ui/regions/regions-trait-variance.rs index 73baa84ec904..9169d457d405 100644 --- a/src/test/ui/regions/regions-trait-variance.rs +++ b/src/test/ui/regions/regions-trait-variance.rs @@ -23,10 +23,10 @@ impl Drop for B { } struct A<'r> { - p: &'r (X+'r) + p: &'r (dyn X + 'r) } -fn make_a(p:&X) -> A { +fn make_a(p: &dyn X) -> A { A{p:p} } diff --git a/src/test/ui/regions/regions-wf-trait-object.rs b/src/test/ui/regions/regions-wf-trait-object.rs index 61bab359f9a0..d0053b202344 100644 --- a/src/test/ui/regions/regions-wf-trait-object.rs +++ b/src/test/ui/regions/regions-wf-trait-object.rs @@ -4,7 +4,7 @@ trait TheTrait<'t>: 't { } struct Foo<'a,'b> { - x: Box+'b> //~ ERROR E0478 + x: Box+'b> //~ ERROR E0478 } fn main() { } diff --git a/src/test/ui/regions/regions-wf-trait-object.stderr b/src/test/ui/regions/regions-wf-trait-object.stderr index 3dc1c4dcd22d..4e12478c36da 100644 --- a/src/test/ui/regions/regions-wf-trait-object.stderr +++ b/src/test/ui/regions/regions-wf-trait-object.stderr @@ -1,8 +1,8 @@ error[E0478]: lifetime bound not satisfied --> $DIR/regions-wf-trait-object.rs:7:5 | -LL | x: Box+'b> - | ^^^^^^^^^^^^^^^^^^^^^^^ +LL | x: Box+'b> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: lifetime parameter instantiated with the lifetime 'b as defined on the struct at 6:15 --> $DIR/regions-wf-trait-object.rs:6:15 diff --git a/src/test/ui/resolve/issue-23305.rs b/src/test/ui/resolve/issue-23305.rs index af335acd41bc..95635e12a63b 100644 --- a/src/test/ui/resolve/issue-23305.rs +++ b/src/test/ui/resolve/issue-23305.rs @@ -2,7 +2,7 @@ pub trait ToNbt { fn new(val: T) -> Self; } -impl ToNbt {} +impl dyn ToNbt {} //~^ ERROR cycle detected fn main() {} diff --git a/src/test/ui/resolve/issue-23305.stderr b/src/test/ui/resolve/issue-23305.stderr index 1da56ad05d28..0ed3af81d566 100644 --- a/src/test/ui/resolve/issue-23305.stderr +++ b/src/test/ui/resolve/issue-23305.stderr @@ -1,10 +1,10 @@ -error[E0391]: cycle detected when processing `` - --> $DIR/issue-23305.rs:5:12 +error[E0391]: cycle detected when processing `` + --> $DIR/issue-23305.rs:5:16 | -LL | impl ToNbt {} - | ^^^^ +LL | impl dyn ToNbt {} + | ^^^^ | - = note: ...which again requires processing ``, completing the cycle + = note: ...which again requires processing ``, completing the cycle note: cycle used when collecting item types in top-level module --> $DIR/issue-23305.rs:1:1 | diff --git a/src/test/ui/resolve/issue-33876.rs b/src/test/ui/resolve/issue-33876.rs index dd31fc231cfb..e233ec631cc1 100644 --- a/src/test/ui/resolve/issue-33876.rs +++ b/src/test/ui/resolve/issue-33876.rs @@ -7,6 +7,6 @@ trait Bar {} impl Bar for Foo {} fn main() { - let any: &Any = &Bar; //~ ERROR expected value, found trait `Bar` + let any: &dyn Any = &Bar; //~ ERROR expected value, found trait `Bar` if any.is::() { println!("u32"); } } diff --git a/src/test/ui/resolve/issue-33876.stderr b/src/test/ui/resolve/issue-33876.stderr index 29a63fdd11fe..52308f2a7f02 100644 --- a/src/test/ui/resolve/issue-33876.stderr +++ b/src/test/ui/resolve/issue-33876.stderr @@ -1,8 +1,8 @@ error[E0423]: expected value, found trait `Bar` - --> $DIR/issue-33876.rs:10:22 + --> $DIR/issue-33876.rs:10:26 | -LL | let any: &Any = &Bar; - | ^^^ not a value +LL | let any: &dyn Any = &Bar; + | ^^^ not a value error: aborting due to previous error diff --git a/src/test/ui/resolve/issue-3907-2.rs b/src/test/ui/resolve/issue-3907-2.rs index dc9624698dfd..46f145e63e15 100644 --- a/src/test/ui/resolve/issue-3907-2.rs +++ b/src/test/ui/resolve/issue-3907-2.rs @@ -2,7 +2,7 @@ extern crate issue_3907; -type Foo = issue_3907::Foo+'static; +type Foo = dyn issue_3907::Foo + 'static; struct S { name: isize diff --git a/src/test/ui/resolve/issue-3907.rs b/src/test/ui/resolve/issue-3907.rs index 87e465489a48..6211de427178 100644 --- a/src/test/ui/resolve/issue-3907.rs +++ b/src/test/ui/resolve/issue-3907.rs @@ -2,7 +2,7 @@ extern crate issue_3907; -type Foo = issue_3907::Foo; +type Foo = dyn issue_3907::Foo; struct S { name: isize diff --git a/src/test/ui/resolve/issue-5035-2.rs b/src/test/ui/resolve/issue-5035-2.rs index f88a2375a431..b831bb4be348 100644 --- a/src/test/ui/resolve/issue-5035-2.rs +++ b/src/test/ui/resolve/issue-5035-2.rs @@ -1,5 +1,5 @@ trait I {} -type K = I+'static; +type K = dyn I + 'static; fn foo(_x: K) {} //~^ ERROR the size for values of type diff --git a/src/test/ui/resolve/issue-5035.rs b/src/test/ui/resolve/issue-5035.rs index c00567a75b7a..49fa312f9d25 100644 --- a/src/test/ui/resolve/issue-5035.rs +++ b/src/test/ui/resolve/issue-5035.rs @@ -1,5 +1,5 @@ trait I {} -type K = I; +type K = dyn I; impl K for isize {} //~ ERROR expected trait, found type alias `K` use ImportError; //~ ERROR unresolved import `ImportError` [E0432] diff --git a/src/test/ui/rfc-2093-infer-outlives/self-structs.rs b/src/test/ui/rfc-2093-infer-outlives/self-structs.rs index d2550a99e814..8f2d29d6f17c 100644 --- a/src/test/ui/rfc-2093-infer-outlives/self-structs.rs +++ b/src/test/ui/rfc-2093-infer-outlives/self-structs.rs @@ -2,7 +2,7 @@ #[rustc_outlives] struct Foo<'a, 'b, T> { //~ ERROR rustc_outlives - field1: Bar<'a, 'b, T> + field1: dyn Bar<'a, 'b, T> } trait Bar<'x, 's, U> diff --git a/src/test/ui/rfc-2093-infer-outlives/self-structs.stderr b/src/test/ui/rfc-2093-infer-outlives/self-structs.stderr index 9ae05dab74d5..b32c9743e9ed 100644 --- a/src/test/ui/rfc-2093-infer-outlives/self-structs.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/self-structs.stderr @@ -2,7 +2,7 @@ error: rustc_outlives --> $DIR/self-structs.rs:4:1 | LL | / struct Foo<'a, 'b, T> { -LL | | field1: Bar<'a, 'b, T> +LL | | field1: dyn Bar<'a, 'b, T> LL | | } | |_^ | diff --git a/src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.rs b/src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.rs index b0d1fa1a74fb..01daf307c006 100644 --- a/src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.rs +++ b/src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.rs @@ -9,7 +9,7 @@ trait Foo { type Assoc where Self: Sized; type Assoc2 where T: Display; type Assoc3; - type WithDefault where T: Debug = Iterator; + type WithDefault where T: Debug = dyn Iterator; type NoGenerics; } @@ -19,7 +19,7 @@ impl Foo for Bar { type Assoc = usize; type Assoc2 = Vec; type Assoc3 where T: Iterator = Vec; - type WithDefault<'a, T> = &'a Iterator; + type WithDefault<'a, T> = &'a dyn Iterator; type NoGenerics = ::std::cell::Cell; } diff --git a/src/test/ui/rfc1623.rs b/src/test/ui/rfc1623.rs index 5920446dbc2e..ebb4d56af9ee 100644 --- a/src/test/ui/rfc1623.rs +++ b/src/test/ui/rfc1623.rs @@ -13,7 +13,7 @@ static NON_ELIDABLE_FN: &fn(&u8, &u8) -> &u8 = struct SomeStruct<'x, 'y, 'z: 'x> { foo: &'x Foo<'z>, bar: &'x Bar<'z>, - f: &'y for<'a, 'b> Fn(&'a Foo<'b>) -> &'a Bar<'b>, + f: &'y dyn for<'a, 'b> Fn(&'a Foo<'b>) -> &'a Bar<'b>, } fn id(t: T) -> T { diff --git a/src/test/ui/save-analysis/issue-59134-0.rs b/src/test/ui/save-analysis/issue-59134-0.rs index 3158328b3ff1..a0871ca18094 100644 --- a/src/test/ui/save-analysis/issue-59134-0.rs +++ b/src/test/ui/save-analysis/issue-59134-0.rs @@ -4,7 +4,7 @@ pub fn f() { trait Trait {} - impl Trait { + impl dyn Trait { const FLAG: u32 = bogus.field; //~ ERROR cannot find value `bogus` } } diff --git a/src/test/ui/self/arbitrary-self-types-not-object-safe.rs b/src/test/ui/self/arbitrary-self-types-not-object-safe.rs index 2c1fd937a65a..7443d888c9ec 100644 --- a/src/test/ui/self/arbitrary-self-types-not-object-safe.rs +++ b/src/test/ui/self/arbitrary-self-types-not-object-safe.rs @@ -28,13 +28,13 @@ impl Bar for usize { } fn make_foo() { - let x = Rc::new(5usize) as Rc; + let x = Rc::new(5usize) as Rc; //~^ ERROR E0038 //~| ERROR E0038 } fn make_bar() { - let x = Rc::new(5usize) as Rc; + let x = Rc::new(5usize) as Rc; x.bar(); } diff --git a/src/test/ui/self/arbitrary-self-types-not-object-safe.stderr b/src/test/ui/self/arbitrary-self-types-not-object-safe.stderr index dacab1222aba..e45bc2657f1e 100644 --- a/src/test/ui/self/arbitrary-self-types-not-object-safe.stderr +++ b/src/test/ui/self/arbitrary-self-types-not-object-safe.stderr @@ -1,15 +1,15 @@ error[E0038]: the trait `Foo` cannot be made into an object --> $DIR/arbitrary-self-types-not-object-safe.rs:31:32 | -LL | let x = Rc::new(5usize) as Rc; - | ^^^^^^^ the trait `Foo` cannot be made into an object +LL | let x = Rc::new(5usize) as Rc; + | ^^^^^^^^^^^ the trait `Foo` cannot be made into an object | = note: method `foo`'s receiver cannot be dispatched on error[E0038]: the trait `Foo` cannot be made into an object --> $DIR/arbitrary-self-types-not-object-safe.rs:31:13 | -LL | let x = Rc::new(5usize) as Rc; +LL | let x = Rc::new(5usize) as Rc; | ^^^^^^^^^^^^^^^ the trait `Foo` cannot be made into an object | = note: method `foo`'s receiver cannot be dispatched on diff --git a/src/test/ui/self/arbitrary_self_types_raw_pointer_trait.rs b/src/test/ui/self/arbitrary_self_types_raw_pointer_trait.rs index acbe896eebe7..0a9370e6f5ac 100644 --- a/src/test/ui/self/arbitrary_self_types_raw_pointer_trait.rs +++ b/src/test/ui/self/arbitrary_self_types_raw_pointer_trait.rs @@ -34,8 +34,8 @@ impl Foo for u32 { } fn main() { - let null_i32 = ptr::null::() as *const Foo; - let null_u32 = ptr::null::() as *const Foo; + let null_i32 = ptr::null::() as *const dyn Foo; + let null_u32 = ptr::null::() as *const dyn Foo; assert_eq!("I'm an i32!", null_i32.foo()); assert_eq!("I'm a u32!", null_u32.foo()); @@ -45,7 +45,7 @@ fn main() { assert_eq!("I'm an i32!", valid_i32_thin.foo()); assert_eq!(5, unsafe { valid_i32_thin.bar() }); assert_eq!(5, unsafe { (&valid_i32_thin as *const *const i32).complicated() }); - let valid_i32_fat = valid_i32_thin as *const Foo; + let valid_i32_fat = valid_i32_thin as *const dyn Foo; assert_eq!("I'm an i32!", valid_i32_fat.foo()); assert_eq!(5, unsafe { valid_i32_fat.bar() }); @@ -54,7 +54,7 @@ fn main() { assert_eq!("I'm a u32!", valid_u32_thin.foo()); assert_eq!(18, unsafe { valid_u32_thin.bar() }); assert_eq!(18, unsafe { (&valid_u32_thin as *const *const u32).complicated() }); - let valid_u32_fat = valid_u32_thin as *const Foo; + let valid_u32_fat = valid_u32_thin as *const dyn Foo; assert_eq!("I'm a u32!", valid_u32_fat.foo()); assert_eq!(18, unsafe { valid_u32_fat.bar() }); diff --git a/src/test/ui/self/explicit-self-objects-uniq.rs b/src/test/ui/self/explicit-self-objects-uniq.rs index f95686cf1123..0050bc7124d7 100644 --- a/src/test/ui/self/explicit-self-objects-uniq.rs +++ b/src/test/ui/self/explicit-self-objects-uniq.rs @@ -17,6 +17,6 @@ impl Foo for S { pub fn main() { let x = box S { x: 3 }; - let y = x as Box; + let y = x as Box; y.f(); } diff --git a/src/test/ui/self/object-safety-sized-self-by-value-self.rs b/src/test/ui/self/object-safety-sized-self-by-value-self.rs index ae0512666ce0..43b1d8b9149a 100644 --- a/src/test/ui/self/object-safety-sized-self-by-value-self.rs +++ b/src/test/ui/self/object-safety-sized-self-by-value-self.rs @@ -23,7 +23,7 @@ fn tick1(mut c: C) -> u32 { c.get() } -fn tick2(c: &mut Counter) { +fn tick2(c: &mut dyn Counter) { tick3(c); } diff --git a/src/test/ui/self/object-safety-sized-self-generic-method.rs b/src/test/ui/self/object-safety-sized-self-generic-method.rs index 0b3f66337378..e0b0526a3338 100644 --- a/src/test/ui/self/object-safety-sized-self-generic-method.rs +++ b/src/test/ui/self/object-safety-sized-self-generic-method.rs @@ -23,7 +23,7 @@ fn tick1(c: &mut C) { c.with(|i| ()); } -fn tick2(c: &mut Counter) { +fn tick2(c: &mut dyn Counter) { tick3(c); } diff --git a/src/test/ui/self/object-safety-sized-self-return-Self.rs b/src/test/ui/self/object-safety-sized-self-return-Self.rs index e88dba0a4e8a..222c75439456 100644 --- a/src/test/ui/self/object-safety-sized-self-return-Self.rs +++ b/src/test/ui/self/object-safety-sized-self-return-Self.rs @@ -23,7 +23,7 @@ fn preticked() -> C { c } -fn tick(c: &mut Counter) { +fn tick(c: &mut dyn Counter) { tick_generic(c); } diff --git a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.rs b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.rs index db48bdf4c01b..6099263ccd0e 100644 --- a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.rs +++ b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.rs @@ -2,10 +2,10 @@ // Ensure that invoking a closure counts as a unique immutable borrow -type Fn<'a> = Box; +type Fn<'a> = Box; struct Test<'a> { - f: Box + f: Box } fn call(mut f: F) where F: FnMut(Fn) { @@ -47,9 +47,9 @@ fn test6() { } fn test7() { - fn foo(_: F) where F: FnMut(Box, isize) {} + fn foo(_: F) where F: FnMut(Box, isize) {} let s = String::new(); // Capture to make f !Copy - let mut f = move |g: Box, b: isize| { + let mut f = move |g: Box, b: isize| { let _ = s.len(); }; f(Box::new(|a| { diff --git a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.stderr b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.stderr index 847f6865624b..72f979e8d3c3 100644 --- a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.stderr +++ b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.stderr @@ -29,7 +29,7 @@ LL | f.f.call_mut(()) error[E0507]: cannot move out of captured variable in an `FnMut` closure --> $DIR/borrowck-call-is-borrow-issue-12224.rs:57:13 | -LL | let mut f = move |g: Box, b: isize| { +LL | let mut f = move |g: Box, b: isize| { | ----- captured outer variable ... LL | foo(f); diff --git a/src/test/ui/span/borrowck-object-mutability.rs b/src/test/ui/span/borrowck-object-mutability.rs index e672c4645358..f5adc2cc1413 100644 --- a/src/test/ui/span/borrowck-object-mutability.rs +++ b/src/test/ui/span/borrowck-object-mutability.rs @@ -3,22 +3,22 @@ trait Foo { fn borrowed_mut(&mut self); } -fn borrowed_receiver(x: &Foo) { +fn borrowed_receiver(x: &dyn Foo) { x.borrowed(); x.borrowed_mut(); //~ ERROR cannot borrow } -fn borrowed_mut_receiver(x: &mut Foo) { +fn borrowed_mut_receiver(x: &mut dyn Foo) { x.borrowed(); x.borrowed_mut(); } -fn owned_receiver(x: Box) { +fn owned_receiver(x: Box) { x.borrowed(); x.borrowed_mut(); //~ ERROR cannot borrow } -fn mut_owned_receiver(mut x: Box) { +fn mut_owned_receiver(mut x: Box) { x.borrowed(); x.borrowed_mut(); } diff --git a/src/test/ui/span/borrowck-object-mutability.stderr b/src/test/ui/span/borrowck-object-mutability.stderr index fe6014cd5ad8..fe6d05c588f7 100644 --- a/src/test/ui/span/borrowck-object-mutability.stderr +++ b/src/test/ui/span/borrowck-object-mutability.stderr @@ -1,8 +1,8 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference --> $DIR/borrowck-object-mutability.rs:8:5 | -LL | fn borrowed_receiver(x: &Foo) { - | ---- help: consider changing this to be a mutable reference: `&mut dyn Foo` +LL | fn borrowed_receiver(x: &dyn Foo) { + | -------- help: consider changing this to be a mutable reference: `&mut dyn Foo` LL | x.borrowed(); LL | x.borrowed_mut(); | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable @@ -10,7 +10,7 @@ LL | x.borrowed_mut(); error[E0596]: cannot borrow `*x` as mutable, as `x` is not declared as mutable --> $DIR/borrowck-object-mutability.rs:18:5 | -LL | fn owned_receiver(x: Box) { +LL | fn owned_receiver(x: Box) { | - help: consider changing this to be mutable: `mut x` LL | x.borrowed(); LL | x.borrowed_mut(); diff --git a/src/test/ui/span/dropck-object-cycle.rs b/src/test/ui/span/dropck-object-cycle.rs index 8dc70ea252b2..a26123d5246f 100644 --- a/src/test/ui/span/dropck-object-cycle.rs +++ b/src/test/ui/span/dropck-object-cycle.rs @@ -8,7 +8,7 @@ trait Trait<'a> { fn short<'b>(&'b self) -> isize; } -fn object_invoke1<'d>(x: &'d Trait<'d>) -> (isize, isize) { loop { } } +fn object_invoke1<'d>(x: &'d dyn Trait<'d>) -> (isize, isize) { loop { } } trait MakerTrait { fn mk() -> Self; @@ -18,12 +18,12 @@ fn make_val() -> T { MakerTrait::mk() } -impl<'t> MakerTrait for Box+'static> { - fn mk() -> Box+'static> { loop { } } +impl<'t> MakerTrait for Box+'static> { + fn mk() -> Box+'static> { loop { } } } pub fn main() { - let m : Box = make_val(); + let m : Box = make_val(); assert_eq!(object_invoke1(&*m), (4,5)); //~^ ERROR `*m` does not live long enough diff --git a/src/test/ui/span/issue-25199.rs b/src/test/ui/span/issue-25199.rs index ed690443d4dd..dbc3b190068e 100644 --- a/src/test/ui/span/issue-25199.rs +++ b/src/test/ui/span/issue-25199.rs @@ -34,7 +34,7 @@ impl Drop for VecHolder { struct Container<'a> { v: VecHolder, - d: RefCell>>, + d: RefCell>>, } impl<'a> Container<'a> { diff --git a/src/test/ui/span/issue-26656.rs b/src/test/ui/span/issue-26656.rs index c5a70c87ed87..cde68da18973 100644 --- a/src/test/ui/span/issue-26656.rs +++ b/src/test/ui/span/issue-26656.rs @@ -10,7 +10,7 @@ impl Trigger for () { // Still unsound Zook trait Button { fn push(&self); } -struct Zook { button: B, trigger: Box+'static> } +struct Zook { button: B, trigger: Box+'static> } impl Drop for Zook { fn drop(&mut self) { diff --git a/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.rs b/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.rs index 13e651fa56b8..e34f84683bbc 100644 --- a/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.rs +++ b/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.rs @@ -11,6 +11,6 @@ fn main() { { let ss: &isize = &id(1); //~^ ERROR temporary value dropped while borrowed - blah = box ss as Box; + blah = box ss as Box; } } diff --git a/src/test/ui/span/regions-close-over-type-parameter-2.rs b/src/test/ui/span/regions-close-over-type-parameter-2.rs index 11187b74c429..29083154b899 100644 --- a/src/test/ui/span/regions-close-over-type-parameter-2.rs +++ b/src/test/ui/span/regions-close-over-type-parameter-2.rs @@ -10,8 +10,8 @@ impl Foo for A { fn get(&self) { } } -fn repeater3<'a,A:'a>(v: A) -> Box { - box v as Box +fn repeater3<'a,A:'a>(v: A) -> Box { + box v as Box } fn main() { diff --git a/src/test/ui/span/send-is-not-static-ensures-scoping.rs b/src/test/ui/span/send-is-not-static-ensures-scoping.rs index ac07420ee362..2aecc2a7e0d9 100644 --- a/src/test/ui/span/send-is-not-static-ensures-scoping.rs +++ b/src/test/ui/span/send-is-not-static-ensures-scoping.rs @@ -1,5 +1,5 @@ struct Guard<'a> { - f: Box, + f: Box, } fn scoped<'a, F: Fn() + Send + 'a>(f: F) -> Guard<'a> { diff --git a/src/test/ui/suggestions/use-type-argument-instead-of-assoc-type.rs b/src/test/ui/suggestions/use-type-argument-instead-of-assoc-type.rs index a3cc53e69e20..78487bd7bb58 100644 --- a/src/test/ui/suggestions/use-type-argument-instead-of-assoc-type.rs +++ b/src/test/ui/suggestions/use-type-argument-instead-of-assoc-type.rs @@ -4,7 +4,7 @@ pub trait T { type C; } pub struct Foo { - i: Box>, + i: Box>, //~^ ERROR must be specified //~| ERROR wrong number of type arguments } diff --git a/src/test/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr b/src/test/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr index 5e333187e3d3..d273ec3fca59 100644 --- a/src/test/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr +++ b/src/test/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr @@ -1,10 +1,10 @@ error[E0107]: wrong number of type arguments: expected 2, found 4 - --> $DIR/use-type-argument-instead-of-assoc-type.rs:7:28 + --> $DIR/use-type-argument-instead-of-assoc-type.rs:7:32 | -LL | i: Box>, - | ^^^^^ ^^^^^ unexpected type argument - | | - | unexpected type argument +LL | i: Box>, + | ^^^^^ ^^^^^ unexpected type argument + | | + | unexpected type argument error[E0191]: the value of the associated types `A` (from the trait `T`), `C` (from the trait `T`) must be specified --> $DIR/use-type-argument-instead-of-assoc-type.rs:7:12 @@ -15,15 +15,15 @@ LL | type B; LL | type C; | ------- `C` defined here ... -LL | i: Box>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | i: Box>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | associated type `A` must be specified | associated type `C` must be specified help: if you meant to specify the associated types, write | -LL | i: Box>, - | ^^^^^^^^^ ^^^^^^^^^ +LL | i: Box>, + | ^^^^^^^^^ ^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/traits/trait-alias/trait-alias-bounds.rs b/src/test/ui/traits/trait-alias/trait-alias-bounds.rs index 428ce5102bad..b97eb38c5af8 100644 --- a/src/test/ui/traits/trait-alias/trait-alias-bounds.rs +++ b/src/test/ui/traits/trait-alias/trait-alias-bounds.rs @@ -17,7 +17,7 @@ struct Foo(PhantomData); #[allow(dead_code)] struct Bar(PhantomData) where T: SendSyncAlias; -impl EmptyAlias {} +impl dyn EmptyAlias {} impl Empty for T {} diff --git a/src/test/ui/traits/trait-alias/trait-alias-no-duplicates.rs b/src/test/ui/traits/trait-alias/trait-alias-no-duplicates.rs index afd8400e2305..88feb89170dd 100644 --- a/src/test/ui/traits/trait-alias/trait-alias-no-duplicates.rs +++ b/src/test/ui/traits/trait-alias/trait-alias-no-duplicates.rs @@ -114,13 +114,13 @@ type _T44 = dyn _4 + Send + Sync + _8; trait ObjL<'l> {} trait _9 = for<'a> ObjL<'a>; trait _10 = for<'b> ObjL<'b>; -type _T50 = _9 + _10; +type _T50 = dyn _9 + _10; //~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] trait ObjT {} trait _11 = ObjT fn(&'a u8)>; trait _12 = ObjT fn(&'b u8)>; -type _T60 = _11 + _12; +type _T60 = dyn _11 + _12; //~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] fn main() {} diff --git a/src/test/ui/traits/trait-alias/trait-alias-no-duplicates.stderr b/src/test/ui/traits/trait-alias/trait-alias-no-duplicates.stderr index eb667c9522ce..6df1df86508e 100644 --- a/src/test/ui/traits/trait-alias/trait-alias-no-duplicates.stderr +++ b/src/test/ui/traits/trait-alias/trait-alias-no-duplicates.stderr @@ -430,28 +430,28 @@ LL | type _T44 = dyn _4 + Send + Sync + _8; | trait alias used in trait object type (first use) error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/trait-alias-no-duplicates.rs:117:18 + --> $DIR/trait-alias-no-duplicates.rs:117:22 | LL | trait _9 = for<'a> ObjL<'a>; | ---------------- first non-auto trait LL | trait _10 = for<'b> ObjL<'b>; | ---------------- additional non-auto trait -LL | type _T50 = _9 + _10; - | -- ^^^ trait alias used in trait object type (additional use) - | | - | trait alias used in trait object type (first use) +LL | type _T50 = dyn _9 + _10; + | -- ^^^ trait alias used in trait object type (additional use) + | | + | trait alias used in trait object type (first use) error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/trait-alias-no-duplicates.rs:123:19 + --> $DIR/trait-alias-no-duplicates.rs:123:23 | LL | trait _11 = ObjT fn(&'a u8)>; | ------------------------ first non-auto trait LL | trait _12 = ObjT fn(&'b u8)>; | ------------------------ additional non-auto trait -LL | type _T60 = _11 + _12; - | --- ^^^ trait alias used in trait object type (additional use) - | | - | trait alias used in trait object type (first use) +LL | type _T60 = dyn _11 + _12; + | --- ^^^ trait alias used in trait object type (additional use) + | | + | trait alias used in trait object type (first use) error: aborting due to 27 previous errors diff --git a/src/test/ui/traits/trait-bounds-not-on-bare-trait.rs b/src/test/ui/traits/trait-bounds-not-on-bare-trait.rs index fd3af6f3a9aa..33c9f2f00cfe 100644 --- a/src/test/ui/traits/trait-bounds-not-on-bare-trait.rs +++ b/src/test/ui/traits/trait-bounds-not-on-bare-trait.rs @@ -6,6 +6,7 @@ trait Foo { fn foo(_x: Foo + Send) { //~^ ERROR the size for values of type + //~| WARN trait objects without an explicit `dyn` are deprecated } fn main() { } diff --git a/src/test/ui/traits/trait-bounds-not-on-bare-trait.stderr b/src/test/ui/traits/trait-bounds-not-on-bare-trait.stderr index 5aee1e7e982a..250ea4b1c320 100644 --- a/src/test/ui/traits/trait-bounds-not-on-bare-trait.stderr +++ b/src/test/ui/traits/trait-bounds-not-on-bare-trait.stderr @@ -1,3 +1,11 @@ +warning: trait objects without an explicit `dyn` are deprecated + --> $DIR/trait-bounds-not-on-bare-trait.rs:7:12 + | +LL | fn foo(_x: Foo + Send) { + | ^^^^^^^^^^ help: use `dyn`: `dyn Foo + Send` + | + = note: #[warn(bare_trait_objects)] on by default + error[E0277]: the size for values of type `(dyn Foo + std::marker::Send + 'static)` cannot be known at compilation time --> $DIR/trait-bounds-not-on-bare-trait.rs:7:8 | diff --git a/src/test/ui/traits/trait-bounds-sugar.rs b/src/test/ui/traits/trait-bounds-sugar.rs index 0892153c0cf8..65b6f6faa425 100644 --- a/src/test/ui/traits/trait-bounds-sugar.rs +++ b/src/test/ui/traits/trait-bounds-sugar.rs @@ -2,17 +2,17 @@ trait Foo {} -fn a(_x: Box) { +fn a(_x: Box) { } -fn b(_x: &'static (Foo+'static)) { +fn b(_x: &'static (dyn Foo + 'static)) { } -fn c(x: Box) { +fn c(x: Box) { a(x); //~ ERROR mismatched types } -fn d(x: &'static (Foo+Sync)) { +fn d(x: &'static (dyn Foo + Sync)) { b(x); } diff --git a/src/test/ui/traits/trait-coercion-generic-bad.rs b/src/test/ui/traits/trait-coercion-generic-bad.rs index 5aa218341482..2e115c732b9d 100644 --- a/src/test/ui/traits/trait-coercion-generic-bad.rs +++ b/src/test/ui/traits/trait-coercion-generic-bad.rs @@ -13,7 +13,7 @@ impl Trait<&'static str> for Struct { } fn main() { - let s: Box> = Box::new(Struct { person: "Fred" }); + let s: Box> = Box::new(Struct { person: "Fred" }); //~^ ERROR `Struct: Trait` is not satisfied s.f(1); } diff --git a/src/test/ui/traits/trait-coercion-generic-bad.stderr b/src/test/ui/traits/trait-coercion-generic-bad.stderr index 7f3b46b8ae52..f2710dea0952 100644 --- a/src/test/ui/traits/trait-coercion-generic-bad.stderr +++ b/src/test/ui/traits/trait-coercion-generic-bad.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `Struct: Trait` is not satisfied - --> $DIR/trait-coercion-generic-bad.rs:16:32 + --> $DIR/trait-coercion-generic-bad.rs:16:36 | -LL | let s: Box> = Box::new(Struct { person: "Fred" }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `Struct` +LL | let s: Box> = Box::new(Struct { person: "Fred" }); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `Struct` | = help: the following implementations were found: > diff --git a/src/test/ui/traits/trait-coercion-generic-regions.rs b/src/test/ui/traits/trait-coercion-generic-regions.rs index 148b7dd5c43d..af478df6dfa9 100644 --- a/src/test/ui/traits/trait-coercion-generic-regions.rs +++ b/src/test/ui/traits/trait-coercion-generic-regions.rs @@ -15,5 +15,5 @@ impl Trait<&'static str> for Struct { fn main() { let person = "Fred".to_string(); let person: &str = &person; //~ ERROR `person` does not live long enough - let s: Box> = Box::new(Struct { person: person }); + let s: Box> = Box::new(Struct { person: person }); } diff --git a/src/test/ui/traits/trait-coercion-generic-regions.stderr b/src/test/ui/traits/trait-coercion-generic-regions.stderr index 4ee3e4cacc37..d21b48e571df 100644 --- a/src/test/ui/traits/trait-coercion-generic-regions.stderr +++ b/src/test/ui/traits/trait-coercion-generic-regions.stderr @@ -6,7 +6,7 @@ LL | let person: &str = &person; | | | borrowed value does not live long enough | assignment requires that `person` is borrowed for `'static` -LL | let s: Box> = Box::new(Struct { person: person }); +LL | let s: Box> = Box::new(Struct { person: person }); LL | } | - `person` dropped here while still borrowed diff --git a/src/test/ui/traits/trait-impl-1.rs b/src/test/ui/traits/trait-impl-1.rs index 29f58a6a9cbc..43b822218354 100644 --- a/src/test/ui/traits/trait-impl-1.rs +++ b/src/test/ui/traits/trait-impl-1.rs @@ -4,7 +4,7 @@ trait T {} -impl<'a> T+'a { +impl<'a> dyn T + 'a { fn foo(&self) {} } diff --git a/src/test/ui/traits/trait-item-privacy.rs b/src/test/ui/traits/trait-item-privacy.rs index dfc8c8f4f6cc..d58bbef38c49 100644 --- a/src/test/ui/traits/trait-item-privacy.rs +++ b/src/test/ui/traits/trait-item-privacy.rs @@ -68,7 +68,7 @@ fn check_method() { S.b(); //~ ERROR no method named `b` found for type `S` in the current scope S.c(); // OK // a, b, c are resolved as inherent items, their traits don't need to be in scope - let c = &S as &C; + let c = &S as &dyn C; c.a(); //~ ERROR method `a` is private c.b(); // OK c.c(); // OK @@ -121,10 +121,10 @@ fn check_assoc_ty() { let _: T::C; // OK // Associated types, bindings - let _: assoc_ty::B< + let _: dyn assoc_ty::B< B = u8, // OK >; - let _: C< + let _: dyn C< A = u8, //~ ERROR associated type `A` is private B = u8, // OK C = u8, // OK diff --git a/src/test/ui/traits/trait-object-auto-dedup-in-impl.rs b/src/test/ui/traits/trait-object-auto-dedup-in-impl.rs index 6ba5d28a6c4c..85698f194890 100644 --- a/src/test/ui/traits/trait-object-auto-dedup-in-impl.rs +++ b/src/test/ui/traits/trait-object-auto-dedup-in-impl.rs @@ -5,15 +5,15 @@ struct Struct; impl Trait for Struct {} trait Trait {} -type Send1 = Trait + Send; -type Send2 = Trait + Send + Send; +type Send1 = dyn Trait + Send; +type Send2 = dyn Trait + Send + Send; fn main () {} -impl Trait + Send { +impl dyn Trait + Send { fn test(&self) { println!("one"); } //~ ERROR duplicate definitions with name `test` } -impl Trait + Send + Send { +impl dyn Trait + Send + Send { fn test(&self) { println!("two"); } } diff --git a/src/test/ui/traits/trait-object-macro-matcher.rs b/src/test/ui/traits/trait-object-macro-matcher.rs index 0f55e2dc4f21..5ec157275a62 100644 --- a/src/test/ui/traits/trait-object-macro-matcher.rs +++ b/src/test/ui/traits/trait-object-macro-matcher.rs @@ -5,7 +5,8 @@ macro_rules! m { } fn main() { - m!(Copy + Send + 'static); //~ ERROR the trait `std::marker::Copy` cannot be made into an object - m!('static + Send); - m!('static +); //~ ERROR at least one non-builtin trait is required for an object type + m!(dyn Copy + Send + 'static); + //~^ ERROR the trait `std::marker::Copy` cannot be made into an object + m!(dyn 'static + Send); + m!(dyn 'static +); //~ ERROR at least one non-builtin trait is required for an object type } diff --git a/src/test/ui/traits/trait-object-macro-matcher.stderr b/src/test/ui/traits/trait-object-macro-matcher.stderr index 57a529ebc576..0b84c3dfcb05 100644 --- a/src/test/ui/traits/trait-object-macro-matcher.stderr +++ b/src/test/ui/traits/trait-object-macro-matcher.stderr @@ -1,14 +1,14 @@ error[E0224]: at least one non-builtin trait is required for an object type - --> $DIR/trait-object-macro-matcher.rs:10:8 + --> $DIR/trait-object-macro-matcher.rs:11:8 | -LL | m!('static +); - | ^^^^^^^^^ +LL | m!(dyn 'static +); + | ^^^^^^^^^^^^^ error[E0038]: the trait `std::marker::Copy` cannot be made into an object --> $DIR/trait-object-macro-matcher.rs:8:8 | -LL | m!(Copy + Send + 'static); - | ^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` cannot be made into an object +LL | m!(dyn Copy + Send + 'static); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` cannot be made into an object | = note: the trait cannot require that `Self : Sized` diff --git a/src/test/ui/traits/trait-object-safety.rs b/src/test/ui/traits/trait-object-safety.rs index e333bf6bfe53..f43d332d6963 100644 --- a/src/test/ui/traits/trait-object-safety.rs +++ b/src/test/ui/traits/trait-object-safety.rs @@ -12,6 +12,6 @@ impl Tr for St { } fn main() { - let _: &Tr = &St; //~ ERROR E0038 + let _: &dyn Tr = &St; //~ ERROR E0038 //~^ ERROR E0038 } diff --git a/src/test/ui/traits/trait-object-safety.stderr b/src/test/ui/traits/trait-object-safety.stderr index a7fe83cb7564..68edc1787053 100644 --- a/src/test/ui/traits/trait-object-safety.stderr +++ b/src/test/ui/traits/trait-object-safety.stderr @@ -1,8 +1,8 @@ error[E0038]: the trait `Tr` cannot be made into an object - --> $DIR/trait-object-safety.rs:15:18 + --> $DIR/trait-object-safety.rs:15:22 | -LL | let _: &Tr = &St; - | ^^^ the trait `Tr` cannot be made into an object +LL | let _: &dyn Tr = &St; + | ^^^ the trait `Tr` cannot be made into an object | = note: method `foo` has no receiver = note: required because of the requirements on the impl of `std::ops::CoerceUnsized<&dyn Tr>` for `&St` @@ -10,8 +10,8 @@ LL | let _: &Tr = &St; error[E0038]: the trait `Tr` cannot be made into an object --> $DIR/trait-object-safety.rs:15:12 | -LL | let _: &Tr = &St; - | ^^^ the trait `Tr` cannot be made into an object +LL | let _: &dyn Tr = &St; + | ^^^^^^^ the trait `Tr` cannot be made into an object | = note: method `foo` has no receiver diff --git a/src/test/ui/traits/trait-object-vs-lifetime-2.rs b/src/test/ui/traits/trait-object-vs-lifetime-2.rs index 2579a0056f14..4d56fcf11e39 100644 --- a/src/test/ui/traits/trait-object-vs-lifetime-2.rs +++ b/src/test/ui/traits/trait-object-vs-lifetime-2.rs @@ -6,7 +6,7 @@ // `'static` is a lifetime, `'static +` is a type, `'a` is a type fn g() where 'static: 'static, - 'static +: 'static + Copy, + dyn 'static +: 'static + Copy, //~^ ERROR at least one non-builtin trait is required for an object type {} diff --git a/src/test/ui/traits/trait-object-vs-lifetime-2.stderr b/src/test/ui/traits/trait-object-vs-lifetime-2.stderr index 057f587a7b63..24162c920be3 100644 --- a/src/test/ui/traits/trait-object-vs-lifetime-2.stderr +++ b/src/test/ui/traits/trait-object-vs-lifetime-2.stderr @@ -1,8 +1,8 @@ error[E0224]: at least one non-builtin trait is required for an object type --> $DIR/trait-object-vs-lifetime-2.rs:9:5 | -LL | 'static +: 'static + Copy, - | ^^^^^^^^^ +LL | dyn 'static +: 'static + Copy, + | ^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/traits/trait-object-vs-lifetime.rs b/src/test/ui/traits/trait-object-vs-lifetime.rs index 36dec21be052..803b29367c8a 100644 --- a/src/test/ui/traits/trait-object-vs-lifetime.rs +++ b/src/test/ui/traits/trait-object-vs-lifetime.rs @@ -6,12 +6,12 @@ struct S<'a, T>(&'a u8, T); fn main() { // `'static` is a lifetime argument, `'static +` is a type argument let _: S<'static, u8>; - let _: S<'static, 'static +>; + let _: S<'static, dyn 'static +>; //~^ at least one non-builtin trait is required for an object type let _: S<'static, 'static>; //~^ ERROR wrong number of lifetime arguments: expected 1, found 2 //~| ERROR wrong number of type arguments: expected 1, found 0 - let _: S<'static +, 'static>; + let _: S; //~^ ERROR lifetime arguments must be declared prior to type arguments //~| ERROR at least one non-builtin trait is required for an object type } diff --git a/src/test/ui/traits/trait-object-vs-lifetime.stderr b/src/test/ui/traits/trait-object-vs-lifetime.stderr index c13d0e3f2937..be1af59ed4f5 100644 --- a/src/test/ui/traits/trait-object-vs-lifetime.stderr +++ b/src/test/ui/traits/trait-object-vs-lifetime.stderr @@ -1,14 +1,14 @@ error: lifetime arguments must be declared prior to type arguments - --> $DIR/trait-object-vs-lifetime.rs:14:25 + --> $DIR/trait-object-vs-lifetime.rs:14:29 | -LL | let _: S<'static +, 'static>; - | ^^^^^^^ +LL | let _: S; + | ^^^^^^^ error[E0224]: at least one non-builtin trait is required for an object type --> $DIR/trait-object-vs-lifetime.rs:9:23 | -LL | let _: S<'static, 'static +>; - | ^^^^^^^^^ +LL | let _: S<'static, dyn 'static +>; + | ^^^^^^^^^^^^^ error[E0107]: wrong number of lifetime arguments: expected 1, found 2 --> $DIR/trait-object-vs-lifetime.rs:11:23 @@ -25,8 +25,8 @@ LL | let _: S<'static, 'static>; error[E0224]: at least one non-builtin trait is required for an object type --> $DIR/trait-object-vs-lifetime.rs:14:14 | -LL | let _: S<'static +, 'static>; - | ^^^^^^^^^ +LL | let _: S; + | ^^^^^^^^^^^^^ error: aborting due to 5 previous errors diff --git a/src/test/ui/traits/trait-test-2.rs b/src/test/ui/traits/trait-test-2.rs index 20d979df4bf4..86570f1152e1 100644 --- a/src/test/ui/traits/trait-test-2.rs +++ b/src/test/ui/traits/trait-test-2.rs @@ -8,7 +8,7 @@ impl bar for u32 { fn dup(&self) -> u32 { *self } fn blah(&self) {} } fn main() { 10.dup::(); //~ ERROR wrong number of type arguments: expected 0, found 1 10.blah::(); //~ ERROR wrong number of type arguments: expected 1, found 2 - (box 10 as Box).dup(); + (box 10 as Box).dup(); //~^ ERROR E0038 //~| ERROR E0038 } diff --git a/src/test/ui/traits/trait-test-2.stderr b/src/test/ui/traits/trait-test-2.stderr index 0e3446e0d231..5d5251925a1a 100644 --- a/src/test/ui/traits/trait-test-2.stderr +++ b/src/test/ui/traits/trait-test-2.stderr @@ -13,8 +13,8 @@ LL | 10.blah::(); error[E0038]: the trait `bar` cannot be made into an object --> $DIR/trait-test-2.rs:11:16 | -LL | (box 10 as Box).dup(); - | ^^^^^^^^ the trait `bar` cannot be made into an object +LL | (box 10 as Box).dup(); + | ^^^^^^^^^^^^ the trait `bar` cannot be made into an object | = note: method `dup` references the `Self` type in its arguments or return type = note: method `blah` has generic type parameters @@ -22,7 +22,7 @@ LL | (box 10 as Box).dup(); error[E0038]: the trait `bar` cannot be made into an object --> $DIR/trait-test-2.rs:11:6 | -LL | (box 10 as Box).dup(); +LL | (box 10 as Box).dup(); | ^^^^^^ the trait `bar` cannot be made into an object | = note: method `dup` references the `Self` type in its arguments or return type diff --git a/src/test/ui/traits/traits-repeated-supertrait-ambig.rs b/src/test/ui/traits/traits-repeated-supertrait-ambig.rs index 5fa7e87aa4b9..6aaef8a305bc 100644 --- a/src/test/ui/traits/traits-repeated-supertrait-ambig.rs +++ b/src/test/ui/traits/traits-repeated-supertrait-ambig.rs @@ -22,7 +22,7 @@ impl CompareTo for i64 { impl CompareToInts for i64 { } -fn with_obj(c: &CompareToInts) -> bool { +fn with_obj(c: &dyn CompareToInts) -> bool { c.same_as(22) //~ ERROR `dyn CompareToInts: CompareTo` is not satisfied } diff --git a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-sized.rs b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-sized.rs index a5d5b9377265..d411807673c6 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-sized.rs +++ b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-sized.rs @@ -13,8 +13,8 @@ struct T { struct S(str, str) where str: Sized; -fn unsized_local() where for<'a> T: Sized { - let x: T = *(Box::new(T { x: 1 }) as Box>); +fn unsized_local() where for<'a> T: Sized { + let x: T = *(Box::new(T { x: 1 }) as Box>); } fn return_str() -> str where str: Sized { diff --git a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-sized.stderr b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-sized.stderr index a9d2634c1ad7..fda1d6d70ac5 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-sized.stderr +++ b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-sized.stderr @@ -7,10 +7,10 @@ LL | struct S(str, str) where str: Sized; = note: #[warn(trivial_bounds)] on by default warning: Trait bound for<'a> T<(dyn A + 'a)>: std::marker::Sized does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-inconsistent-sized.rs:16:45 + --> $DIR/trivial-bounds-inconsistent-sized.rs:16:49 | -LL | fn unsized_local() where for<'a> T: Sized { - | ^^^^^ +LL | fn unsized_local() where for<'a> T: Sized { + | ^^^^^ warning: Trait bound str: std::marker::Sized does not depend on any type or lifetime parameters --> $DIR/trivial-bounds-inconsistent-sized.rs:20:35 diff --git a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent.rs b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent.rs index fdbaec9a5c7f..f6538b14d171 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent.rs +++ b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent.rs @@ -52,8 +52,8 @@ struct Dst { struct TwoStrs(str, str) where str: Sized; -fn unsized_local() where for<'a> Dst: Sized { - let x: Dst = *(Box::new(Dst { x: 1 }) as Box>); +fn unsized_local() where for<'a> Dst: Sized { + let x: Dst = *(Box::new(Dst { x: 1 }) as Box>); } fn return_str() -> str where str: Sized { diff --git a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent.stderr b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent.stderr index 744e146f8300..a0d638f17147 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent.stderr +++ b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent.stderr @@ -64,10 +64,10 @@ LL | struct TwoStrs(str, str) where str: Sized; | ^^^^^ warning: Trait bound for<'a> Dst<(dyn A + 'a)>: std::marker::Sized does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-inconsistent.rs:55:47 + --> $DIR/trivial-bounds-inconsistent.rs:55:51 | -LL | fn unsized_local() where for<'a> Dst: Sized { - | ^^^^^ +LL | fn unsized_local() where for<'a> Dst: Sized { + | ^^^^^ warning: Trait bound str: std::marker::Sized does not depend on any type or lifetime parameters --> $DIR/trivial-bounds-inconsistent.rs:59:35 diff --git a/src/test/ui/trivial_casts.rs b/src/test/ui/trivial_casts.rs index c1f5441a36b0..dd578e074fda 100644 --- a/src/test/ui/trivial_casts.rs +++ b/src/test/ui/trivial_casts.rs @@ -49,29 +49,29 @@ pub fn main() { // unsize trait let x: &Bar = &Bar; - let _ = x as &Foo; //~ERROR trivial cast: `&Bar` as `&dyn Foo` - let _ = x as *const Foo; //~ERROR trivial cast: `&Bar` as `*const dyn Foo` - let _: &Foo = x; - let _: *const Foo = x; + let _ = x as &dyn Foo; //~ERROR trivial cast: `&Bar` as `&dyn Foo` + let _ = x as *const dyn Foo; //~ERROR trivial cast: `&Bar` as `*const dyn Foo` + let _: &dyn Foo = x; + let _: *const dyn Foo = x; let x: &mut Bar = &mut Bar; - let _ = x as &mut Foo; //~ERROR trivial cast: `&mut Bar` as `&mut dyn Foo` - let _ = x as *mut Foo; //~ERROR trivial cast: `&mut Bar` as `*mut dyn Foo` - let _: &mut Foo = x; - let _: *mut Foo = x; + let _ = x as &mut dyn Foo; //~ERROR trivial cast: `&mut Bar` as `&mut dyn Foo` + let _ = x as *mut dyn Foo; //~ERROR trivial cast: `&mut Bar` as `*mut dyn Foo` + let _: &mut dyn Foo = x; + let _: *mut dyn Foo = x; let x: Box = Box::new(Bar); - let _ = x as Box; //~ERROR `std::boxed::Box` as `std::boxed::Box` + let _ = x as Box; //~ERROR `std::boxed::Box` as `std::boxed::Box` let x: Box = Box::new(Bar); - let _: Box = x; + let _: Box = x; // functions fn baz(_x: i32) {} - let _ = &baz as &Fn(i32); //~ERROR `&fn(i32) {main::baz}` as `&dyn std::ops::Fn(i32)` - let _: &Fn(i32) = &baz; + let _ = &baz as &dyn Fn(i32); //~ERROR `&fn(i32) {main::baz}` as `&dyn std::ops::Fn(i32)` + let _: &dyn Fn(i32) = &baz; let x = |_x: i32| {}; - let _ = &x as &Fn(i32); //~ERROR trivial cast - let _: &Fn(i32) = &x; + let _ = &x as &dyn Fn(i32); //~ERROR trivial cast + let _: &dyn Fn(i32) = &x; } // subtyping diff --git a/src/test/ui/trivial_casts.stderr b/src/test/ui/trivial_casts.stderr index 524eb7feaafb..8fa44372f0b4 100644 --- a/src/test/ui/trivial_casts.stderr +++ b/src/test/ui/trivial_casts.stderr @@ -83,56 +83,56 @@ LL | let _ = x as Box<[u32]>; error: trivial cast: `&Bar` as `&dyn Foo` --> $DIR/trivial_casts.rs:52:13 | -LL | let _ = x as &Foo; - | ^^^^^^^^^ +LL | let _ = x as &dyn Foo; + | ^^^^^^^^^^^^^ | = help: cast can be replaced by coercion; this might require a temporary variable error: trivial cast: `&Bar` as `*const dyn Foo` --> $DIR/trivial_casts.rs:53:13 | -LL | let _ = x as *const Foo; - | ^^^^^^^^^^^^^^^ +LL | let _ = x as *const dyn Foo; + | ^^^^^^^^^^^^^^^^^^^ | = help: cast can be replaced by coercion; this might require a temporary variable error: trivial cast: `&mut Bar` as `&mut dyn Foo` --> $DIR/trivial_casts.rs:58:13 | -LL | let _ = x as &mut Foo; - | ^^^^^^^^^^^^^ +LL | let _ = x as &mut dyn Foo; + | ^^^^^^^^^^^^^^^^^ | = help: cast can be replaced by coercion; this might require a temporary variable error: trivial cast: `&mut Bar` as `*mut dyn Foo` --> $DIR/trivial_casts.rs:59:13 | -LL | let _ = x as *mut Foo; - | ^^^^^^^^^^^^^ +LL | let _ = x as *mut dyn Foo; + | ^^^^^^^^^^^^^^^^^ | = help: cast can be replaced by coercion; this might require a temporary variable error: trivial cast: `std::boxed::Box` as `std::boxed::Box` --> $DIR/trivial_casts.rs:64:13 | -LL | let _ = x as Box; - | ^^^^^^^^^^^^^ +LL | let _ = x as Box; + | ^^^^^^^^^^^^^^^^^ | = help: cast can be replaced by coercion; this might require a temporary variable error: trivial cast: `&fn(i32) {main::baz}` as `&dyn std::ops::Fn(i32)` --> $DIR/trivial_casts.rs:70:13 | -LL | let _ = &baz as &Fn(i32); - | ^^^^^^^^^^^^^^^^ +LL | let _ = &baz as &dyn Fn(i32); + | ^^^^^^^^^^^^^^^^^^^^ | = help: cast can be replaced by coercion; this might require a temporary variable error: trivial cast: `&[closure@$DIR/trivial_casts.rs:72:13: 72:25]` as `&dyn std::ops::Fn(i32)` --> $DIR/trivial_casts.rs:73:13 | -LL | let _ = &x as &Fn(i32); - | ^^^^^^^^^^^^^^ +LL | let _ = &x as &dyn Fn(i32); + | ^^^^^^^^^^^^^^^^^^ | = help: cast can be replaced by coercion; this might require a temporary variable diff --git a/src/test/ui/type/type-arg-out-of-scope.rs b/src/test/ui/type/type-arg-out-of-scope.rs index d5b815f6a95e..02aad0077079 100644 --- a/src/test/ui/type/type-arg-out-of-scope.rs +++ b/src/test/ui/type/type-arg-out-of-scope.rs @@ -1,5 +1,5 @@ // error-pattern:can't use generic parameters from outer function fn foo(x: T) { - fn bar(f: Box T>) { } + fn bar(f: Box T>) { } } fn main() { foo(1); } diff --git a/src/test/ui/type/type-arg-out-of-scope.stderr b/src/test/ui/type/type-arg-out-of-scope.stderr index ea991069c08d..0b6283fbc51e 100644 --- a/src/test/ui/type/type-arg-out-of-scope.stderr +++ b/src/test/ui/type/type-arg-out-of-scope.stderr @@ -1,20 +1,20 @@ error[E0401]: can't use generic parameters from outer function - --> $DIR/type-arg-out-of-scope.rs:3:25 + --> $DIR/type-arg-out-of-scope.rs:3:29 | LL | fn foo(x: T) { | - type parameter from outer function -LL | fn bar(f: Box T>) { } - | --- ^ use of generic parameter from outer function +LL | fn bar(f: Box T>) { } + | --- ^ use of generic parameter from outer function | | | help: try using a local generic parameter instead: `bar` error[E0401]: can't use generic parameters from outer function - --> $DIR/type-arg-out-of-scope.rs:3:31 + --> $DIR/type-arg-out-of-scope.rs:3:35 | LL | fn foo(x: T) { | - type parameter from outer function -LL | fn bar(f: Box T>) { } - | --- ^ use of generic parameter from outer function +LL | fn bar(f: Box T>) { } + | --- ^ use of generic parameter from outer function | | | help: try using a local generic parameter instead: `bar` diff --git a/src/test/ui/type/type-parameter-defaults-referencing-Self-ppaux.rs b/src/test/ui/type/type-parameter-defaults-referencing-Self-ppaux.rs index 3e1c876c76ba..444453dc6943 100644 --- a/src/test/ui/type/type-parameter-defaults-referencing-Self-ppaux.rs +++ b/src/test/ui/type/type-parameter-defaults-referencing-Self-ppaux.rs @@ -11,7 +11,7 @@ impl MyAdd for i32 { fn main() { let x: i32 = 5; - let y = x as MyAdd; + let y = x as dyn MyAdd; //~^ ERROR E0038 //~| ERROR cast to unsized type: `i32` as `dyn MyAdd` } diff --git a/src/test/ui/type/type-parameter-defaults-referencing-Self-ppaux.stderr b/src/test/ui/type/type-parameter-defaults-referencing-Self-ppaux.stderr index 0beb9e9eb4b0..58727ea0fef9 100644 --- a/src/test/ui/type/type-parameter-defaults-referencing-Self-ppaux.stderr +++ b/src/test/ui/type/type-parameter-defaults-referencing-Self-ppaux.stderr @@ -1,20 +1,20 @@ error[E0620]: cast to unsized type: `i32` as `dyn MyAdd` --> $DIR/type-parameter-defaults-referencing-Self-ppaux.rs:14:13 | -LL | let y = x as MyAdd; - | ^^^^^^^^^^^^^^^ +LL | let y = x as dyn MyAdd; + | ^^^^^^^^^^^^^^^^^^^ | help: consider using a box or reference as appropriate --> $DIR/type-parameter-defaults-referencing-Self-ppaux.rs:14:13 | -LL | let y = x as MyAdd; +LL | let y = x as dyn MyAdd; | ^ error[E0038]: the trait `MyAdd` cannot be made into an object --> $DIR/type-parameter-defaults-referencing-Self-ppaux.rs:14:18 | -LL | let y = x as MyAdd; - | ^^^^^^^^^^ the trait `MyAdd` cannot be made into an object +LL | let y = x as dyn MyAdd; + | ^^^^^^^^^^^^^^ the trait `MyAdd` cannot be made into an object | = note: method `add` references the `Self` type in its arguments or return type diff --git a/src/test/ui/type/type-parameter-defaults-referencing-Self.rs b/src/test/ui/type/type-parameter-defaults-referencing-Self.rs index 721bf960a55c..a4c59dced029 100644 --- a/src/test/ui/type/type-parameter-defaults-referencing-Self.rs +++ b/src/test/ui/type/type-parameter-defaults-referencing-Self.rs @@ -7,7 +7,7 @@ trait Foo { fn method(&self); } -fn foo(x: &Foo) { } +fn foo(x: &dyn Foo) { } //~^ ERROR the type parameter `T` must be explicitly specified fn main() { } diff --git a/src/test/ui/type/type-parameter-defaults-referencing-Self.stderr b/src/test/ui/type/type-parameter-defaults-referencing-Self.stderr index 70093b61f251..0d6ca9d9dcd9 100644 --- a/src/test/ui/type/type-parameter-defaults-referencing-Self.stderr +++ b/src/test/ui/type/type-parameter-defaults-referencing-Self.stderr @@ -1,8 +1,8 @@ error[E0393]: the type parameter `T` must be explicitly specified - --> $DIR/type-parameter-defaults-referencing-Self.rs:10:12 + --> $DIR/type-parameter-defaults-referencing-Self.rs:10:16 | -LL | fn foo(x: &Foo) { } - | ^^^ missing reference to `T` +LL | fn foo(x: &dyn Foo) { } + | ^^^ missing reference to `T` | = note: because of the default `Self` reference, type parameters must be specified on object types diff --git a/src/test/ui/typeck/typeck-builtin-bound-type-parameters.rs b/src/test/ui/typeck/typeck-builtin-bound-type-parameters.rs index 776086643621..f466c19e051e 100644 --- a/src/test/ui/typeck/typeck-builtin-bound-type-parameters.rs +++ b/src/test/ui/typeck/typeck-builtin-bound-type-parameters.rs @@ -1,7 +1,7 @@ fn foo1, U>(x: T) {} //~^ ERROR wrong number of type arguments: expected 0, found 1 [E0107] -trait Trait: Copy {} +trait Trait: Copy {} //~^ ERROR wrong number of type arguments: expected 0, found 1 [E0107] struct MyStruct1>; diff --git a/src/test/ui/typeck/typeck-builtin-bound-type-parameters.stderr b/src/test/ui/typeck/typeck-builtin-bound-type-parameters.stderr index 0242287a3e5e..0be1c8ef3bc1 100644 --- a/src/test/ui/typeck/typeck-builtin-bound-type-parameters.stderr +++ b/src/test/ui/typeck/typeck-builtin-bound-type-parameters.stderr @@ -7,8 +7,8 @@ LL | fn foo1, U>(x: T) {} error[E0107]: wrong number of type arguments: expected 0, found 1 --> $DIR/typeck-builtin-bound-type-parameters.rs:4:19 | -LL | trait Trait: Copy {} - | ^^^^ unexpected type argument +LL | trait Trait: Copy {} + | ^^^^^^^^ unexpected type argument error[E0107]: wrong number of type arguments: expected 0, found 1 --> $DIR/typeck-builtin-bound-type-parameters.rs:7:26 diff --git a/src/test/ui/unboxed-closures/unboxed-closure-feature-gate.rs b/src/test/ui/unboxed-closures/unboxed-closure-feature-gate.rs index 1eb9de778e82..d8b201bf82d3 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-feature-gate.rs +++ b/src/test/ui/unboxed-closures/unboxed-closure-feature-gate.rs @@ -10,11 +10,11 @@ trait Foo { } fn main() { - let x: Box; + let x: Box; //~^ ERROR parenthetical notation is only stable when used with `Fn`-family // No errors with these: - let x: Box; - let x: Box; - let x: Box; + let x: Box; + let x: Box; + let x: Box; } diff --git a/src/test/ui/unboxed-closures/unboxed-closure-feature-gate.stderr b/src/test/ui/unboxed-closures/unboxed-closure-feature-gate.stderr index 1604aa4a0f70..c23acbcb311d 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-feature-gate.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-feature-gate.stderr @@ -1,8 +1,8 @@ error[E0658]: parenthetical notation is only stable when used with `Fn`-family traits - --> $DIR/unboxed-closure-feature-gate.rs:13:16 + --> $DIR/unboxed-closure-feature-gate.rs:13:20 | -LL | let x: Box; - | ^^^^^^^^^^ +LL | let x: Box; + | ^^^^^^^^^^ | = note: for more information, see https://github.com/rust-lang/rust/issues/29625 = help: add #![feature(unboxed_closures)] to the crate attributes to enable diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-default.rs b/src/test/ui/unboxed-closures/unboxed-closure-sugar-default.rs index 044859de6a4a..f1c83f0606fa 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-default.rs +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-default.rs @@ -15,14 +15,14 @@ fn eq() where A : Eq { } fn test<'a,'b>() { // Parens are equivalent to omitting default in angle. - eq::< Foo<(isize,),Output=()>, Foo(isize) >(); + eq::, dyn Foo(isize)>(); // In angle version, we supply something other than the default - eq::< Foo<(isize,),isize,Output=()>, Foo(isize) >(); + eq::, dyn Foo(isize)>(); //~^ ERROR E0277 // Supply default explicitly. - eq::< Foo<(isize,),(isize,),Output=()>, Foo(isize) >(); + eq::, dyn Foo(isize)>(); } fn main() { } diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-default.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-default.stderr index ce90f5b9d248..fd5ef4b9df15 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-default.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-default.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `dyn Foo<(isize,), isize, Output = ()>: Eq>` is not satisfied --> $DIR/unboxed-closure-sugar-default.rs:21:5 | -LL | eq::< Foo<(isize,),isize,Output=()>, Foo(isize) >(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Eq>` is not implemented for `dyn Foo<(isize,), isize, Output = ()>` +LL | eq::, dyn Foo(isize)>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Eq>` is not implemented for `dyn Foo<(isize,), isize, Output = ()>` | note: required by `eq` --> $DIR/unboxed-closure-sugar-default.rs:14:1 diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-equiv.rs b/src/test/ui/unboxed-closures/unboxed-closure-sugar-equiv.rs index 95bd391f251b..0fc3e23ec73e 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-equiv.rs +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-equiv.rs @@ -17,31 +17,31 @@ fn eq>() { } fn test<'a,'b>() { // No errors expected: - eq::< Foo<(),Output=()>, Foo() >(); - eq::< Foo<(isize,),Output=()>, Foo(isize) >(); - eq::< Foo<(isize,usize),Output=()>, Foo(isize,usize) >(); - eq::< Foo<(isize,usize),Output=usize>, Foo(isize,usize) -> usize >(); - eq::< Foo<(&'a isize,&'b usize),Output=usize>, Foo(&'a isize,&'b usize) -> usize >(); + eq::< dyn Foo<(),Output=()>, dyn Foo() >(); + eq::< dyn Foo<(isize,),Output=()>, dyn Foo(isize) >(); + eq::< dyn Foo<(isize,usize),Output=()>, dyn Foo(isize,usize) >(); + eq::< dyn Foo<(isize,usize),Output=usize>, dyn Foo(isize,usize) -> usize >(); + eq::< dyn Foo<(&'a isize,&'b usize),Output=usize>, dyn Foo(&'a isize,&'b usize) -> usize >(); // Test that anonymous regions in `()` form are equivalent // to fresh bound regions, and that we can intermingle // named and anonymous as we choose: - eq::< for<'x,'y> Foo<(&'x isize,&'y usize),Output=usize>, - for<'x,'y> Foo(&'x isize,&'y usize) -> usize >(); - eq::< for<'x,'y> Foo<(&'x isize,&'y usize),Output=usize>, - for<'x> Foo(&'x isize,&usize) -> usize >(); - eq::< for<'x,'y> Foo<(&'x isize,&'y usize),Output=usize>, - for<'y> Foo(&isize,&'y usize) -> usize >(); - eq::< for<'x,'y> Foo<(&'x isize,&'y usize),Output=usize>, - Foo(&isize,&usize) -> usize >(); + eq::< dyn for<'x,'y> Foo<(&'x isize,&'y usize),Output=usize>, + dyn for<'x,'y> Foo(&'x isize,&'y usize) -> usize >(); + eq::< dyn for<'x,'y> Foo<(&'x isize,&'y usize),Output=usize>, + dyn for<'x> Foo(&'x isize,&usize) -> usize >(); + eq::< dyn for<'x,'y> Foo<(&'x isize,&'y usize),Output=usize>, + dyn for<'y> Foo(&isize,&'y usize) -> usize >(); + eq::< dyn for<'x,'y> Foo<(&'x isize,&'y usize),Output=usize>, + dyn Foo(&isize,&usize) -> usize >(); // lifetime elision - eq::< for<'x> Foo<(&'x isize,), Output=&'x isize>, - Foo(&isize) -> &isize >(); + eq::< dyn for<'x> Foo<(&'x isize,), Output=&'x isize>, + dyn Foo(&isize) -> &isize >(); // Errors expected: - eq::< Foo<(),Output=()>, - Foo(char) >(); + eq::< dyn Foo<(),Output=()>, + dyn Foo(char) >(); //~^^ ERROR E0277 } diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-equiv.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-equiv.stderr index 857a32ca69e7..005a86bc2178 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-equiv.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-equiv.stderr @@ -1,9 +1,9 @@ error[E0277]: the trait bound `dyn Foo<(char,), Output = ()>: Eq>` is not satisfied --> $DIR/unboxed-closure-sugar-equiv.rs:43:5 | -LL | / eq::< Foo<(),Output=()>, -LL | | Foo(char) >(); - | |___________________________________________________________________^ the trait `Eq>` is not implemented for `dyn Foo<(char,), Output = ()>` +LL | / eq::< dyn Foo<(),Output=()>, +LL | | dyn Foo(char) >(); + | |_______________________________________________________________________^ the trait `Eq>` is not implemented for `dyn Foo<(char,), Output = ()>` | note: required by `eq` --> $DIR/unboxed-closure-sugar-equiv.rs:16:1 diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.rs b/src/test/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.rs index b61d8b8c8c79..d11d663f1726 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.rs +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.rs @@ -18,10 +18,10 @@ impl Eq for X { } fn eq>() { } fn main() { - eq::< for<'a> Foo<(&'a isize,), Output=&'a isize>, - Foo(&isize) -> &isize >(); - eq::< for<'a> Foo<(&'a isize,), Output=(&'a isize, &'a isize)>, - Foo(&isize) -> (&isize, &isize) >(); + eq::< dyn for<'a> Foo<(&'a isize,), Output=&'a isize>, + dyn Foo(&isize) -> &isize >(); + eq::< dyn for<'a> Foo<(&'a isize,), Output=(&'a isize, &'a isize)>, + dyn Foo(&isize) -> (&isize, &isize) >(); - let _: Foo(&isize, &usize) -> &usize; //~ ERROR missing lifetime specifier + let _: dyn Foo(&isize, &usize) -> &usize; //~ ERROR missing lifetime specifier } diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.stderr index 8c3480744fe3..9fb9a07166f8 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.stderr @@ -1,8 +1,8 @@ error[E0106]: missing lifetime specifier - --> $DIR/unboxed-closure-sugar-lifetime-elision.rs:26:35 + --> $DIR/unboxed-closure-sugar-lifetime-elision.rs:26:39 | -LL | let _: Foo(&isize, &usize) -> &usize; - | ^ expected lifetime parameter +LL | let _: dyn Foo(&isize, &usize) -> &usize; + | ^ expected lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from argument 1 or argument 2 diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-not-used-on-fn.rs b/src/test/ui/unboxed-closures/unboxed-closure-sugar-not-used-on-fn.rs index 09927a940192..6d6ed4b568f0 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-not-used-on-fn.rs +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-not-used-on-fn.rs @@ -1,6 +1,6 @@ // Test that the `Fn` traits require `()` form without a feature gate. -fn bar1(x: &Fn<(), Output=()>) { +fn bar1(x: &dyn Fn<(), Output=()>) { //~^ ERROR of `Fn`-family traits' type parameters is subject to change } diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-not-used-on-fn.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-not-used-on-fn.stderr index 0901126a3fec..e1ed85d4f467 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-not-used-on-fn.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-not-used-on-fn.stderr @@ -1,8 +1,8 @@ error[E0658]: the precise format of `Fn`-family traits' type parameters is subject to change. Use parenthetical notation (Fn(Foo, Bar) -> Baz) instead - --> $DIR/unboxed-closure-sugar-not-used-on-fn.rs:3:13 + --> $DIR/unboxed-closure-sugar-not-used-on-fn.rs:3:17 | -LL | fn bar1(x: &Fn<(), Output=()>) { - | ^^^^^^^^^^^^^^^^^ +LL | fn bar1(x: &dyn Fn<(), Output=()>) { + | ^^^^^^^^^^^^^^^^^ | = note: for more information, see https://github.com/rust-lang/rust/issues/29625 = help: add #![feature(unboxed_closures)] to the crate attributes to enable diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-region.rs b/src/test/ui/unboxed-closures/unboxed-closure-sugar-region.rs index 799d9f33e2e9..76c928d7b6ab 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-region.rs +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-region.rs @@ -20,14 +20,14 @@ fn same_type>(a: A, b: B) { } fn test<'a,'b>() { // Parens are equivalent to omitting default in angle. - eq::< Foo<(isize,),Output=()>, Foo(isize) >(); + eq::< dyn Foo<(isize,),Output=()>, dyn Foo(isize) >(); // Here we specify 'static explicitly in angle-bracket version. // Parenthesized winds up getting inferred. - eq::< Foo<'static, (isize,),Output=()>, Foo(isize) >(); + eq::< dyn Foo<'static, (isize,),Output=()>, dyn Foo(isize) >(); } -fn test2(x: &Foo<(isize,),Output=()>, y: &Foo(isize)) { +fn test2(x: &dyn Foo<(isize,),Output=()>, y: &dyn Foo(isize)) { //~^ ERROR wrong number of lifetime arguments: expected 1, found 0 // Here, the omitted lifetimes are expanded to distinct things. same_type(x, y) diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-region.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-region.stderr index 8eed7d58c466..e9d51983a7a4 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-region.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-region.stderr @@ -1,8 +1,8 @@ error[E0107]: wrong number of lifetime arguments: expected 1, found 0 - --> $DIR/unboxed-closure-sugar-region.rs:30:43 + --> $DIR/unboxed-closure-sugar-region.rs:30:51 | -LL | fn test2(x: &Foo<(isize,),Output=()>, y: &Foo(isize)) { - | ^^^^^^^^^^ expected 1 lifetime argument +LL | fn test2(x: &dyn Foo<(isize,),Output=()>, y: &dyn Foo(isize)) { + | ^^^^^^^^^^ expected 1 lifetime argument error: aborting due to previous error diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-1.rs b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-1.rs index df0c495a11cc..a6c86311b377 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-1.rs +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-1.rs @@ -2,7 +2,7 @@ trait One { fn foo(&self) -> A; } -fn foo(_: &One()) //~ ERROR associated type `Output` not found for `One<()>` +fn foo(_: &dyn One()) //~ ERROR associated type `Output` not found for `One<()>` {} fn main() { } diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-1.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-1.stderr index 304339c89e64..c59082932ddf 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-1.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-1.stderr @@ -1,8 +1,8 @@ error[E0220]: associated type `Output` not found for `One<()>` - --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters-1.rs:5:15 + --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters-1.rs:5:19 | -LL | fn foo(_: &One()) - | ^^ associated type `Output` not found +LL | fn foo(_: &dyn One()) + | ^^ associated type `Output` not found error: aborting due to previous error diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs index 5f5ad7902aa3..01c76d64c6ba 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs @@ -2,7 +2,7 @@ trait Three { fn dummy(&self) -> (A,B,C); } -fn foo(_: &Three()) +fn foo(_: &dyn Three()) //~^ ERROR wrong number of type arguments //~| ERROR associated type `Output` not found {} diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-3.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-3.stderr index 62b3a2544305..6c61e74584a5 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-3.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-3.stderr @@ -1,14 +1,14 @@ error[E0107]: wrong number of type arguments: expected 3, found 1 - --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs:5:12 + --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs:5:16 | -LL | fn foo(_: &Three()) - | ^^^^^^^ expected 3 type arguments +LL | fn foo(_: &dyn Three()) + | ^^^^^^^ expected 3 type arguments error[E0220]: associated type `Output` not found for `Three<(), [type error], [type error]>` - --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs:5:17 + --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs:5:21 | -LL | fn foo(_: &Three()) - | ^^ associated type `Output` not found +LL | fn foo(_: &dyn Three()) + | ^^ associated type `Output` not found error: aborting due to 2 previous errors diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.rs b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.rs index 2e87d91f8bdc..bc9901c795b3 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.rs +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.rs @@ -2,7 +2,7 @@ trait Zero { fn dummy(&self); } -fn foo(_: Zero()) +fn foo(_: dyn Zero()) //~^ ERROR wrong number of type arguments //~| ERROR associated type `Output` not found for `Zero` {} diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.stderr index b64fc61cc856..b96e2cbc36bb 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.stderr @@ -1,14 +1,14 @@ error[E0107]: wrong number of type arguments: expected 0, found 1 - --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:5:15 + --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:5:19 | -LL | fn foo(_: Zero()) - | ^^ unexpected type argument +LL | fn foo(_: dyn Zero()) + | ^^ unexpected type argument error[E0220]: associated type `Output` not found for `Zero` - --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:5:15 + --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:5:19 | -LL | fn foo(_: Zero()) - | ^^ associated type `Output` not found +LL | fn foo(_: dyn Zero()) + | ^^ associated type `Output` not found error: aborting due to 2 previous errors diff --git a/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.rs b/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.rs index 82dc536bb569..1358ba0f953e 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.rs +++ b/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.rs @@ -9,7 +9,7 @@ fn a() { // iteration, but it still doesn't work. The weird structure with // the `Option` is to avoid giving any useful hints about the `Fn` // kind via the expected type. - let mut factorial: Option u32>> = None; + let mut factorial: Option u32>> = None; let f = |x: u32| -> u32 { let g = factorial.as_ref().unwrap(); @@ -22,7 +22,7 @@ fn a() { } fn b() { - let mut factorial: Option u32 + 'static>> = None; + let mut factorial: Option u32 + 'static>> = None; let f = |x: u32| -> u32 { let g = factorial.as_ref().unwrap(); diff --git a/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.stderr b/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.stderr index 8d39fb026b3d..0466887e371e 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.stderr @@ -29,8 +29,8 @@ LL | factorial = Some(Box::new(f)); error[E0597]: `factorial` does not live long enough --> $DIR/unboxed-closures-failed-recursive-fn-1.rs:28:17 | -LL | let mut factorial: Option u32 + 'static>> = None; - | ------------------------------------- type annotation requires that `factorial` is borrowed for `'static` +LL | let mut factorial: Option u32 + 'static>> = None; + | ----------------------------------------- type annotation requires that `factorial` is borrowed for `'static` LL | LL | let f = |x: u32| -> u32 { | --------------- value captured here @@ -43,8 +43,8 @@ LL | } error[E0506]: cannot assign to `factorial` because it is borrowed --> $DIR/unboxed-closures-failed-recursive-fn-1.rs:33:5 | -LL | let mut factorial: Option u32 + 'static>> = None; - | ------------------------------------- type annotation requires that `factorial` is borrowed for `'static` +LL | let mut factorial: Option u32 + 'static>> = None; + | ----------------------------------------- type annotation requires that `factorial` is borrowed for `'static` LL | LL | let f = |x: u32| -> u32 { | --------------- borrow of `factorial` occurs here diff --git a/src/test/ui/unboxed-closures/unboxed-closures-recursive-fn-using-fn-mut.rs b/src/test/ui/unboxed-closures/unboxed-closures-recursive-fn-using-fn-mut.rs index 0beead1ad92c..6a707b2096d4 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-recursive-fn-using-fn-mut.rs +++ b/src/test/ui/unboxed-closures/unboxed-closures-recursive-fn-using-fn-mut.rs @@ -17,14 +17,14 @@ impl YCombinator { } } -impl R, A) -> R> FnMut<(A,)> for YCombinator { +impl R, A) -> R> FnMut<(A,)> for YCombinator { extern "rust-call" fn call_mut(&mut self, (arg,): (A,)) -> R { (self.func)(self, arg) //~^ ERROR cannot borrow `*self` as mutable more than once at a time } } -impl R, A) -> R> FnOnce<(A,)> for YCombinator { +impl R, A) -> R> FnOnce<(A,)> for YCombinator { type Output = R; extern "rust-call" fn call_once(mut self, args: (A,)) -> R { self.call_mut(args) @@ -33,7 +33,7 @@ impl R, A) -> R> FnOnce<(A,)> for YCombinator u32, arg: u32| -> u32 { + let factorial = |recur: &mut dyn FnMut(u32) -> u32, arg: u32| -> u32 { counter += 1; if arg == 0 {1} else {arg * recur(arg-1)} }; diff --git a/src/test/ui/underscore-lifetime/underscore-lifetime-binders.rs b/src/test/ui/underscore-lifetime/underscore-lifetime-binders.rs index 614f7e49f875..3d049cc5639c 100644 --- a/src/test/ui/underscore-lifetime/underscore-lifetime-binders.rs +++ b/src/test/ui/underscore-lifetime/underscore-lifetime-binders.rs @@ -7,7 +7,7 @@ fn foo<'_> //~ ERROR cannot be used here trait Meh<'a> {} impl<'a> Meh<'a> for u8 {} -fn meh() -> Box Meh<'_>> //~ ERROR cannot be used here +fn meh() -> Box Meh<'_>> //~ ERROR cannot be used here //~^ ERROR missing lifetime specifier { Box::new(5u8) diff --git a/src/test/ui/underscore-lifetime/underscore-lifetime-binders.stderr b/src/test/ui/underscore-lifetime/underscore-lifetime-binders.stderr index 936e3ba55fea..654f4285f655 100644 --- a/src/test/ui/underscore-lifetime/underscore-lifetime-binders.stderr +++ b/src/test/ui/underscore-lifetime/underscore-lifetime-binders.stderr @@ -5,10 +5,10 @@ LL | fn foo<'_> | ^^ `'_` is a reserved lifetime name error[E0637]: `'_` cannot be used here - --> $DIR/underscore-lifetime-binders.rs:10:21 + --> $DIR/underscore-lifetime-binders.rs:10:25 | -LL | fn meh() -> Box Meh<'_>> - | ^^ `'_` is a reserved lifetime name +LL | fn meh() -> Box Meh<'_>> + | ^^ `'_` is a reserved lifetime name error[E0106]: missing lifetime specifier --> $DIR/underscore-lifetime-binders.rs:2:17 @@ -17,10 +17,10 @@ LL | struct Baz<'a>(&'_ &'a u8); | ^^ expected lifetime parameter error[E0106]: missing lifetime specifier - --> $DIR/underscore-lifetime-binders.rs:10:29 + --> $DIR/underscore-lifetime-binders.rs:10:33 | -LL | fn meh() -> Box Meh<'_>> - | ^^ help: consider giving it a 'static lifetime: `'static` +LL | fn meh() -> Box Meh<'_>> + | ^^ help: consider giving it a 'static lifetime: `'static` | = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from diff --git a/src/test/ui/unique-object-noncopyable.rs b/src/test/ui/unique-object-noncopyable.rs index 1c467a2421a2..dd38a7190aa0 100644 --- a/src/test/ui/unique-object-noncopyable.rs +++ b/src/test/ui/unique-object-noncopyable.rs @@ -20,6 +20,6 @@ impl Foo for Bar { fn main() { let x = box Bar { x: 10 }; - let y: Box = x as Box; + let y: Box = x as Box; let _z = y.clone(); //~ ERROR no method named `clone` found } diff --git a/src/test/ui/unsized/unsized-enum2.rs b/src/test/ui/unsized/unsized-enum2.rs index 60bfb5cb6402..d589f5ae582c 100644 --- a/src/test/ui/unsized/unsized-enum2.rs +++ b/src/test/ui/unsized/unsized-enum2.rs @@ -13,10 +13,10 @@ trait PathHelper2 {} trait PathHelper3 {} trait PathHelper4 {} -struct Path1(PathHelper1); -struct Path2(PathHelper2); -struct Path3(PathHelper3); -struct Path4(PathHelper4); +struct Path1(dyn PathHelper1); +struct Path2(dyn PathHelper2); +struct Path3(dyn PathHelper3); +struct Path4(dyn PathHelper4); enum E { // parameter @@ -50,13 +50,13 @@ enum E { //~^ ERROR the size for values of type // plain trait - VM(Foo), + VM(dyn Foo), //~^ ERROR the size for values of type - VN{x: Bar}, + VN{x: dyn Bar}, //~^ ERROR the size for values of type - VO(isize, FooBar), + VO(isize, dyn FooBar), //~^ ERROR the size for values of type - VP{u: isize, x: BarFoo}, + VP{u: isize, x: dyn BarFoo}, //~^ ERROR the size for values of type // projected diff --git a/src/test/ui/unsized/unsized-enum2.stderr b/src/test/ui/unsized/unsized-enum2.stderr index 9109366e4fcf..cdd5747d86b0 100644 --- a/src/test/ui/unsized/unsized-enum2.stderr +++ b/src/test/ui/unsized/unsized-enum2.stderr @@ -85,8 +85,8 @@ LL | VH{u: isize, x: [u32]}, error[E0277]: the size for values of type `(dyn Foo + 'static)` cannot be known at compilation time --> $DIR/unsized-enum2.rs:53:8 | -LL | VM(Foo), - | ^^^ doesn't have a size known at compile-time +LL | VM(dyn Foo), + | ^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn Foo + 'static)` = note: to learn more, visit @@ -95,8 +95,8 @@ LL | VM(Foo), error[E0277]: the size for values of type `(dyn Bar + 'static)` cannot be known at compilation time --> $DIR/unsized-enum2.rs:55:8 | -LL | VN{x: Bar}, - | ^^^^^^ doesn't have a size known at compile-time +LL | VN{x: dyn Bar}, + | ^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn Bar + 'static)` = note: to learn more, visit @@ -105,8 +105,8 @@ LL | VN{x: Bar}, error[E0277]: the size for values of type `(dyn FooBar + 'static)` cannot be known at compilation time --> $DIR/unsized-enum2.rs:57:15 | -LL | VO(isize, FooBar), - | ^^^^^^ doesn't have a size known at compile-time +LL | VO(isize, dyn FooBar), + | ^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn FooBar + 'static)` = note: to learn more, visit @@ -115,8 +115,8 @@ LL | VO(isize, FooBar), error[E0277]: the size for values of type `(dyn BarFoo + 'static)` cannot be known at compilation time --> $DIR/unsized-enum2.rs:59:18 | -LL | VP{u: isize, x: BarFoo}, - | ^^^^^^^^^ doesn't have a size known at compile-time +LL | VP{u: isize, x: dyn BarFoo}, + | ^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn BarFoo + 'static)` = note: to learn more, visit diff --git a/src/test/ui/use/use-after-move-implicity-coerced-object.rs b/src/test/ui/use/use-after-move-implicity-coerced-object.rs index 2e465ee89626..76487ef1c140 100644 --- a/src/test/ui/use/use-after-move-implicity-coerced-object.rs +++ b/src/test/ui/use/use-after-move-implicity-coerced-object.rs @@ -13,10 +13,10 @@ impl fmt::Display for Number { } struct List { - list: Vec> } + list: Vec> } impl List { - fn push(&mut self, n: Box) { + fn push(&mut self, n: Box) { self.list.push(n); } } diff --git a/src/test/ui/variance/variance-contravariant-arg-object.nll.stderr b/src/test/ui/variance/variance-contravariant-arg-object.nll.stderr index 8b5ecbe56ff2..69818aedd154 100644 --- a/src/test/ui/variance/variance-contravariant-arg-object.nll.stderr +++ b/src/test/ui/variance/variance-contravariant-arg-object.nll.stderr @@ -1,7 +1,7 @@ error: lifetime may not live long enough --> $DIR/variance-contravariant-arg-object.rs:14:5 | -LL | fn get_min_from_max<'min, 'max>(v: Box>) +LL | fn get_min_from_max<'min, 'max>(v: Box>) | ---- ---- lifetime `'max` defined here | | | lifetime `'min` defined here @@ -12,7 +12,7 @@ LL | v error: lifetime may not live long enough --> $DIR/variance-contravariant-arg-object.rs:22:5 | -LL | fn get_max_from_min<'min, 'max, G>(v: Box>) +LL | fn get_max_from_min<'min, 'max, G>(v: Box>) | ---- ---- lifetime `'max` defined here | | | lifetime `'min` defined here diff --git a/src/test/ui/variance/variance-contravariant-arg-object.rs b/src/test/ui/variance/variance-contravariant-arg-object.rs index 27e5675dcde8..947f4cd8b8f4 100644 --- a/src/test/ui/variance/variance-contravariant-arg-object.rs +++ b/src/test/ui/variance/variance-contravariant-arg-object.rs @@ -7,15 +7,15 @@ trait Get : 'static { fn get(&self, t: T); } -fn get_min_from_max<'min, 'max>(v: Box>) - -> Box> +fn get_min_from_max<'min, 'max>(v: Box>) + -> Box> where 'max : 'min { v //~ ERROR mismatched types } -fn get_max_from_min<'min, 'max, G>(v: Box>) - -> Box> +fn get_max_from_min<'min, 'max, G>(v: Box>) + -> Box> where 'max : 'min { // Previously OK: diff --git a/src/test/ui/variance/variance-contravariant-arg-object.stderr b/src/test/ui/variance/variance-contravariant-arg-object.stderr index beac05e04a8e..263c849e1998 100644 --- a/src/test/ui/variance/variance-contravariant-arg-object.stderr +++ b/src/test/ui/variance/variance-contravariant-arg-object.stderr @@ -9,12 +9,12 @@ LL | v note: the lifetime 'min as defined on the function body at 10:21... --> $DIR/variance-contravariant-arg-object.rs:10:21 | -LL | fn get_min_from_max<'min, 'max>(v: Box>) +LL | fn get_min_from_max<'min, 'max>(v: Box>) | ^^^^ note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 10:27 --> $DIR/variance-contravariant-arg-object.rs:10:27 | -LL | fn get_min_from_max<'min, 'max>(v: Box>) +LL | fn get_min_from_max<'min, 'max>(v: Box>) | ^^^^ error[E0308]: mismatched types @@ -28,12 +28,12 @@ LL | v note: the lifetime 'min as defined on the function body at 17:21... --> $DIR/variance-contravariant-arg-object.rs:17:21 | -LL | fn get_max_from_min<'min, 'max, G>(v: Box>) +LL | fn get_max_from_min<'min, 'max, G>(v: Box>) | ^^^^ note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 17:27 --> $DIR/variance-contravariant-arg-object.rs:17:27 | -LL | fn get_max_from_min<'min, 'max, G>(v: Box>) +LL | fn get_max_from_min<'min, 'max, G>(v: Box>) | ^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/variance/variance-covariant-arg-object.nll.stderr b/src/test/ui/variance/variance-covariant-arg-object.nll.stderr index acf9f2e060ce..63ab7fe96512 100644 --- a/src/test/ui/variance/variance-covariant-arg-object.nll.stderr +++ b/src/test/ui/variance/variance-covariant-arg-object.nll.stderr @@ -1,7 +1,7 @@ error: lifetime may not live long enough --> $DIR/variance-covariant-arg-object.rs:15:5 | -LL | fn get_min_from_max<'min, 'max>(v: Box>) +LL | fn get_min_from_max<'min, 'max>(v: Box>) | ---- ---- lifetime `'max` defined here | | | lifetime `'min` defined here @@ -12,7 +12,7 @@ LL | v error: lifetime may not live long enough --> $DIR/variance-covariant-arg-object.rs:22:5 | -LL | fn get_max_from_min<'min, 'max, G>(v: Box>) +LL | fn get_max_from_min<'min, 'max, G>(v: Box>) | ---- ---- lifetime `'max` defined here | | | lifetime `'min` defined here diff --git a/src/test/ui/variance/variance-covariant-arg-object.rs b/src/test/ui/variance/variance-covariant-arg-object.rs index 4b371841654f..7cbf65ae3d92 100644 --- a/src/test/ui/variance/variance-covariant-arg-object.rs +++ b/src/test/ui/variance/variance-covariant-arg-object.rs @@ -7,16 +7,16 @@ trait Get : 'static { fn get(&self) -> T; } -fn get_min_from_max<'min, 'max>(v: Box>) - -> Box> +fn get_min_from_max<'min, 'max>(v: Box>) + -> Box> where 'max : 'min { // Previously OK, now an error as traits are invariant. v //~ ERROR mismatched types } -fn get_max_from_min<'min, 'max, G>(v: Box>) - -> Box> +fn get_max_from_min<'min, 'max, G>(v: Box>) + -> Box> where 'max : 'min { v //~ ERROR mismatched types diff --git a/src/test/ui/variance/variance-covariant-arg-object.stderr b/src/test/ui/variance/variance-covariant-arg-object.stderr index cdcc7a6fd55a..94f80c2b657f 100644 --- a/src/test/ui/variance/variance-covariant-arg-object.stderr +++ b/src/test/ui/variance/variance-covariant-arg-object.stderr @@ -9,12 +9,12 @@ LL | v note: the lifetime 'min as defined on the function body at 10:21... --> $DIR/variance-covariant-arg-object.rs:10:21 | -LL | fn get_min_from_max<'min, 'max>(v: Box>) +LL | fn get_min_from_max<'min, 'max>(v: Box>) | ^^^^ note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 10:27 --> $DIR/variance-covariant-arg-object.rs:10:27 | -LL | fn get_min_from_max<'min, 'max>(v: Box>) +LL | fn get_min_from_max<'min, 'max>(v: Box>) | ^^^^ error[E0308]: mismatched types @@ -28,12 +28,12 @@ LL | v note: the lifetime 'min as defined on the function body at 18:21... --> $DIR/variance-covariant-arg-object.rs:18:21 | -LL | fn get_max_from_min<'min, 'max, G>(v: Box>) +LL | fn get_max_from_min<'min, 'max, G>(v: Box>) | ^^^^ note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 18:27 --> $DIR/variance-covariant-arg-object.rs:18:27 | -LL | fn get_max_from_min<'min, 'max, G>(v: Box>) +LL | fn get_max_from_min<'min, 'max, G>(v: Box>) | ^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/variance/variance-invariant-arg-object.nll.stderr b/src/test/ui/variance/variance-invariant-arg-object.nll.stderr index 3c1ee7fc707f..fe2f35b63b57 100644 --- a/src/test/ui/variance/variance-invariant-arg-object.nll.stderr +++ b/src/test/ui/variance/variance-invariant-arg-object.nll.stderr @@ -1,7 +1,7 @@ error: lifetime may not live long enough --> $DIR/variance-invariant-arg-object.rs:11:5 | -LL | fn get_min_from_max<'min, 'max>(v: Box>) +LL | fn get_min_from_max<'min, 'max>(v: Box>) | ---- ---- lifetime `'max` defined here | | | lifetime `'min` defined here @@ -12,7 +12,7 @@ LL | v error: lifetime may not live long enough --> $DIR/variance-invariant-arg-object.rs:18:5 | -LL | fn get_max_from_min<'min, 'max, G>(v: Box>) +LL | fn get_max_from_min<'min, 'max, G>(v: Box>) | ---- ---- lifetime `'max` defined here | | | lifetime `'min` defined here diff --git a/src/test/ui/variance/variance-invariant-arg-object.rs b/src/test/ui/variance/variance-invariant-arg-object.rs index 91f5982e5339..886d263c4576 100644 --- a/src/test/ui/variance/variance-invariant-arg-object.rs +++ b/src/test/ui/variance/variance-invariant-arg-object.rs @@ -4,15 +4,15 @@ trait Get : 'static { fn get(&self, t: T) -> T; } -fn get_min_from_max<'min, 'max>(v: Box>) - -> Box> +fn get_min_from_max<'min, 'max>(v: Box>) + -> Box> where 'max : 'min { v //~ ERROR mismatched types } -fn get_max_from_min<'min, 'max, G>(v: Box>) - -> Box> +fn get_max_from_min<'min, 'max, G>(v: Box>) + -> Box> where 'max : 'min { v //~ ERROR mismatched types diff --git a/src/test/ui/variance/variance-invariant-arg-object.stderr b/src/test/ui/variance/variance-invariant-arg-object.stderr index e2ee35de1a27..50a8697d4392 100644 --- a/src/test/ui/variance/variance-invariant-arg-object.stderr +++ b/src/test/ui/variance/variance-invariant-arg-object.stderr @@ -9,12 +9,12 @@ LL | v note: the lifetime 'min as defined on the function body at 7:21... --> $DIR/variance-invariant-arg-object.rs:7:21 | -LL | fn get_min_from_max<'min, 'max>(v: Box>) +LL | fn get_min_from_max<'min, 'max>(v: Box>) | ^^^^ note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 7:27 --> $DIR/variance-invariant-arg-object.rs:7:27 | -LL | fn get_min_from_max<'min, 'max>(v: Box>) +LL | fn get_min_from_max<'min, 'max>(v: Box>) | ^^^^ error[E0308]: mismatched types @@ -28,12 +28,12 @@ LL | v note: the lifetime 'min as defined on the function body at 14:21... --> $DIR/variance-invariant-arg-object.rs:14:21 | -LL | fn get_max_from_min<'min, 'max, G>(v: Box>) +LL | fn get_max_from_min<'min, 'max, G>(v: Box>) | ^^^^ note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 14:27 --> $DIR/variance-invariant-arg-object.rs:14:27 | -LL | fn get_max_from_min<'min, 'max, G>(v: Box>) +LL | fn get_max_from_min<'min, 'max, G>(v: Box>) | ^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/variance/variance-object-types.rs b/src/test/ui/variance/variance-object-types.rs index 12af7ae8c5b8..14e11f681b10 100644 --- a/src/test/ui/variance/variance-object-types.rs +++ b/src/test/ui/variance/variance-object-types.rs @@ -9,7 +9,7 @@ use std::cell::Cell; // get an invariant result for `'a`. #[rustc_variance] struct Foo<'a> { //~ ERROR [o] - x: Box &'a i32 + 'static> + x: Box &'a i32 + 'static> } fn main() { diff --git a/src/test/ui/variance/variance-object-types.stderr b/src/test/ui/variance/variance-object-types.stderr index be94a727a8d1..d97d222e711a 100644 --- a/src/test/ui/variance/variance-object-types.stderr +++ b/src/test/ui/variance/variance-object-types.stderr @@ -2,7 +2,7 @@ error[E0208]: [o] --> $DIR/variance-object-types.rs:11:1 | LL | / struct Foo<'a> { -LL | | x: Box &'a i32 + 'static> +LL | | x: Box &'a i32 + 'static> LL | | } | |_^ diff --git a/src/test/ui/variance/variance-trait-object-bound.rs b/src/test/ui/variance/variance-trait-object-bound.rs index ada93b7f6efc..ec3c973bc763 100644 --- a/src/test/ui/variance/variance-trait-object-bound.rs +++ b/src/test/ui/variance/variance-trait-object-bound.rs @@ -12,7 +12,7 @@ trait T { fn foo(&self); } #[rustc_variance] struct TOption<'a> { //~ ERROR [-] - v: Option>, + v: Option>, } fn main() { } diff --git a/src/test/ui/variance/variance-trait-object-bound.stderr b/src/test/ui/variance/variance-trait-object-bound.stderr index 503c087fb4d3..fb0fab1950ce 100644 --- a/src/test/ui/variance/variance-trait-object-bound.stderr +++ b/src/test/ui/variance/variance-trait-object-bound.stderr @@ -2,7 +2,7 @@ error[E0208]: [-] --> $DIR/variance-trait-object-bound.rs:14:1 | LL | / struct TOption<'a> { -LL | | v: Option>, +LL | | v: Option>, LL | | } | |_^ diff --git a/src/test/ui/variance/variance-types-bounds.rs b/src/test/ui/variance/variance-types-bounds.rs index 5cbda10fbded..d1814dd97a0a 100644 --- a/src/test/ui/variance/variance-types-bounds.rs +++ b/src/test/ui/variance/variance-types-bounds.rs @@ -36,8 +36,8 @@ trait Setter { #[rustc_variance] struct TestObject { //~ ERROR [o, o] - n: Box+Send>, - m: Box+Send>, + n: Box+Send>, + m: Box+Send>, } fn main() {} diff --git a/src/test/ui/variance/variance-types-bounds.stderr b/src/test/ui/variance/variance-types-bounds.stderr index 8e3e0515aec0..5cffdffc7f2d 100644 --- a/src/test/ui/variance/variance-types-bounds.stderr +++ b/src/test/ui/variance/variance-types-bounds.stderr @@ -37,8 +37,8 @@ error[E0208]: [o, o] --> $DIR/variance-types-bounds.rs:38:1 | LL | / struct TestObject { -LL | | n: Box+Send>, -LL | | m: Box+Send>, +LL | | n: Box+Send>, +LL | | m: Box+Send>, LL | | } | |_^ diff --git a/src/test/ui/wf/wf-in-obj-type-static.rs b/src/test/ui/wf/wf-in-obj-type-static.rs index 858a75ab1ab5..1ad2fd1edb3b 100644 --- a/src/test/ui/wf/wf-in-obj-type-static.rs +++ b/src/test/ui/wf/wf-in-obj-type-static.rs @@ -11,7 +11,7 @@ struct MustBeCopy { struct Foo { // needs T: 'static - x: Object<&'static T> //~ ERROR E0310 + x: dyn Object<&'static T> //~ ERROR E0310 } diff --git a/src/test/ui/wf/wf-in-obj-type-static.stderr b/src/test/ui/wf/wf-in-obj-type-static.stderr index cc06b9243f70..c461da76a257 100644 --- a/src/test/ui/wf/wf-in-obj-type-static.stderr +++ b/src/test/ui/wf/wf-in-obj-type-static.stderr @@ -4,14 +4,14 @@ error[E0310]: the parameter type `T` may not live long enough LL | struct Foo { | - help: consider adding an explicit lifetime bound `T: 'static`... LL | // needs T: 'static -LL | x: Object<&'static T> - | ^^^^^^^^^^^^^^^^^^^^^ +LL | x: dyn Object<&'static T> + | ^^^^^^^^^^^^^^^^^^^^^^^^^ | note: ...so that the reference type `&'static T` does not outlive the data it points at --> $DIR/wf-in-obj-type-static.rs:14:5 | -LL | x: Object<&'static T> - | ^^^^^^^^^^^^^^^^^^^^^ +LL | x: dyn Object<&'static T> + | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-in-obj-type-trait.rs b/src/test/ui/wf/wf-in-obj-type-trait.rs index fad1da199ea9..170fad55f8f6 100644 --- a/src/test/ui/wf/wf-in-obj-type-trait.rs +++ b/src/test/ui/wf/wf-in-obj-type-trait.rs @@ -8,7 +8,7 @@ struct MustBeCopy { struct Bar { // needs T: Copy - x: Object> //~ ERROR E0277 + x: dyn Object> //~ ERROR E0277 } fn main() { } diff --git a/src/test/ui/wf/wf-in-obj-type-trait.stderr b/src/test/ui/wf/wf-in-obj-type-trait.stderr index 94b3de78898a..2c85dd042e7b 100644 --- a/src/test/ui/wf/wf-in-obj-type-trait.stderr +++ b/src/test/ui/wf/wf-in-obj-type-trait.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied --> $DIR/wf-in-obj-type-trait.rs:11:5 | -LL | x: Object> - | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` +LL | x: dyn Object> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | = help: consider adding a `where T: std::marker::Copy` bound note: required by `MustBeCopy` diff --git a/src/test/ui/wf/wf-object-safe.rs b/src/test/ui/wf/wf-object-safe.rs index 08f68f6c004f..42e6917551fd 100644 --- a/src/test/ui/wf/wf-object-safe.rs +++ b/src/test/ui/wf/wf-object-safe.rs @@ -6,5 +6,5 @@ trait A { } fn main() { - let _x: &A; //~ ERROR E0038 + let _x: &dyn A; //~ ERROR E0038 } diff --git a/src/test/ui/wf/wf-object-safe.stderr b/src/test/ui/wf/wf-object-safe.stderr index 87e8105d4aff..3b264ecd580e 100644 --- a/src/test/ui/wf/wf-object-safe.stderr +++ b/src/test/ui/wf/wf-object-safe.stderr @@ -1,8 +1,8 @@ error[E0038]: the trait `A` cannot be made into an object --> $DIR/wf-object-safe.rs:9:13 | -LL | let _x: &A; - | ^^ the trait `A` cannot be made into an object +LL | let _x: &dyn A; + | ^^^^^^ the trait `A` cannot be made into an object | = note: method `foo` references the `Self` type in its arguments or return type diff --git a/src/test/ui/wf/wf-outlives-ty-in-fn-or-trait.rs b/src/test/ui/wf/wf-outlives-ty-in-fn-or-trait.rs index ac95cbab1f73..85a332e244ff 100644 --- a/src/test/ui/wf/wf-outlives-ty-in-fn-or-trait.rs +++ b/src/test/ui/wf/wf-outlives-ty-in-fn-or-trait.rs @@ -16,7 +16,7 @@ struct Foo<'a,T> { trait Baz { } impl<'a, T> Trait<'a, T> for u32 { - type Out = &'a Baz; //~ ERROR `T` may not live long enough + type Out = &'a dyn Baz; //~ ERROR `T` may not live long enough } fn main() { } diff --git a/src/test/ui/wf/wf-outlives-ty-in-fn-or-trait.stderr b/src/test/ui/wf/wf-outlives-ty-in-fn-or-trait.stderr index 8649506c870d..f1cf514e6b29 100644 --- a/src/test/ui/wf/wf-outlives-ty-in-fn-or-trait.stderr +++ b/src/test/ui/wf/wf-outlives-ty-in-fn-or-trait.stderr @@ -17,14 +17,14 @@ error[E0309]: the parameter type `T` may not live long enough | LL | impl<'a, T> Trait<'a, T> for u32 { | - help: consider adding an explicit lifetime bound `T: 'a`... -LL | type Out = &'a Baz; - | ^^^^^^^^^^^^^^^^^^^^^^ +LL | type Out = &'a dyn Baz; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: ...so that the reference type `&'a (dyn Baz + 'a)` does not outlive the data it points at --> $DIR/wf-outlives-ty-in-fn-or-trait.rs:19:5 | -LL | type Out = &'a Baz; - | ^^^^^^^^^^^^^^^^^^^^^^ +LL | type Out = &'a dyn Baz; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/where-clauses/where-lifetime-resolution.rs b/src/test/ui/where-clauses/where-lifetime-resolution.rs index 4c46a77ae291..0d426386768c 100644 --- a/src/test/ui/where-clauses/where-lifetime-resolution.rs +++ b/src/test/ui/where-clauses/where-lifetime-resolution.rs @@ -2,10 +2,10 @@ trait Trait1<'a> {} trait Trait2<'a, 'b> {} fn f() where - for<'a> Trait1<'a>: Trait1<'a>, // OK - (for<'a> Trait1<'a>): Trait1<'a>, + for<'a> dyn Trait1<'a>: Trait1<'a>, // OK + (dyn for<'a> Trait1<'a>): Trait1<'a>, //~^ ERROR use of undeclared lifetime name `'a` - for<'a> for<'b> Trait2<'a, 'b>: Trait2<'a, 'b>, + for<'a> dyn for<'b> Trait2<'a, 'b>: Trait2<'a, 'b>, //~^ ERROR use of undeclared lifetime name `'b` //~| ERROR nested quantification of lifetimes {} diff --git a/src/test/ui/where-clauses/where-lifetime-resolution.stderr b/src/test/ui/where-clauses/where-lifetime-resolution.stderr index babf8efc23f3..0081ae07163b 100644 --- a/src/test/ui/where-clauses/where-lifetime-resolution.stderr +++ b/src/test/ui/where-clauses/where-lifetime-resolution.stderr @@ -1,20 +1,20 @@ error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/where-lifetime-resolution.rs:6:34 + --> $DIR/where-lifetime-resolution.rs:6:38 | -LL | (for<'a> Trait1<'a>): Trait1<'a>, - | ^^ undeclared lifetime +LL | (dyn for<'a> Trait1<'a>): Trait1<'a>, + | ^^ undeclared lifetime error[E0316]: nested quantification of lifetimes - --> $DIR/where-lifetime-resolution.rs:8:13 + --> $DIR/where-lifetime-resolution.rs:8:17 | -LL | for<'a> for<'b> Trait2<'a, 'b>: Trait2<'a, 'b>, - | ^^^^^^^^^^^^^^^^^^^^^^ +LL | for<'a> dyn for<'b> Trait2<'a, 'b>: Trait2<'a, 'b>, + | ^^^^^^^^^^^^^^^^^^^^^^ error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/where-lifetime-resolution.rs:8:48 + --> $DIR/where-lifetime-resolution.rs:8:52 | -LL | for<'a> for<'b> Trait2<'a, 'b>: Trait2<'a, 'b>, - | ^^ undeclared lifetime +LL | for<'a> dyn for<'b> Trait2<'a, 'b>: Trait2<'a, 'b>, + | ^^ undeclared lifetime error: aborting due to 3 previous errors