Skip to content

Commit

Permalink
Update ui test suite to use dyn
Browse files Browse the repository at this point in the history
  • Loading branch information
memoryruins committed May 29, 2019
1 parent a1d1d7a commit eb4580a
Show file tree
Hide file tree
Showing 529 changed files with 1,620 additions and 1,605 deletions.
8 changes: 4 additions & 4 deletions src/test/ui/anonymous-higher-ranked-lifetime.rs
Expand Up @@ -31,11 +31,11 @@ fn f4<F>(_: F) where F: for<'r> Fn(&(), &'r ()) {}
fn f5<F>(_: F) where F: for<'r> Fn(&'r (), &'r ()) {}

// Nested
fn g1<F>(_: F) where F: Fn(&(), Box<Fn(&())>) {}
fn g1<F>(_: F) where F: Fn(&(), Box<dyn Fn(&())>) {}
fn g2<F>(_: F) where F: Fn(&(), fn(&())) {}
fn g3<F>(_: F) where F: for<'s> Fn(&'s (), Box<Fn(&())>) {}
fn g3<F>(_: F) where F: for<'s> Fn(&'s (), Box<dyn Fn(&())>) {}
fn g4<F>(_: F) where F: Fn(&(), for<'r> fn(&'r ())) {}

// Mixed
fn h1<F>(_: F) where F: Fn(&(), Box<Fn(&())>, &(), fn(&(), &())) {}
fn h2<F>(_: F) where F: for<'t0> Fn(&(), Box<Fn(&())>, &'t0 (), fn(&(), &())) {}
fn h1<F>(_: F) where F: Fn(&(), Box<dyn Fn(&())>, &(), fn(&(), &())) {}
fn h2<F>(_: F) where F: for<'t0> Fn(&(), Box<dyn Fn(&())>, &'t0 (), fn(&(), &())) {}
32 changes: 16 additions & 16 deletions src/test/ui/anonymous-higher-ranked-lifetime.stderr
Expand Up @@ -149,8 +149,8 @@ LL | g1(|_: (), _: ()| {});
note: required by `g1`
--> $DIR/anonymous-higher-ranked-lifetime.rs:34:1
|
LL | fn g1<F>(_: F) where F: Fn(&(), Box<Fn(&())>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | fn g1<F>(_: F) where F: Fn(&(), Box<dyn Fn(&())>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0631]: type mismatch in closure arguments
--> $DIR/anonymous-higher-ranked-lifetime.rs:12:5
Expand All @@ -163,8 +163,8 @@ LL | g1(|_: (), _: ()| {});
note: required by `g1`
--> $DIR/anonymous-higher-ranked-lifetime.rs:34:1
|
LL | fn g1<F>(_: F) where F: Fn(&(), Box<Fn(&())>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | fn g1<F>(_: F) where F: Fn(&(), Box<dyn Fn(&())>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0631]: type mismatch in closure arguments
--> $DIR/anonymous-higher-ranked-lifetime.rs:14:5
Expand Down Expand Up @@ -205,8 +205,8 @@ LL | g3(|_: (), _: ()| {});
note: required by `g3`
--> $DIR/anonymous-higher-ranked-lifetime.rs:36:1
|
LL | fn g3<F>(_: F) where F: for<'s> Fn(&'s (), Box<Fn(&())>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | fn g3<F>(_: F) where F: for<'s> Fn(&'s (), Box<dyn Fn(&())>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0631]: type mismatch in closure arguments
--> $DIR/anonymous-higher-ranked-lifetime.rs:16:5
Expand All @@ -219,8 +219,8 @@ LL | g3(|_: (), _: ()| {});
note: required by `g3`
--> $DIR/anonymous-higher-ranked-lifetime.rs:36:1
|
LL | fn g3<F>(_: F) where F: for<'s> Fn(&'s (), Box<Fn(&())>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | fn g3<F>(_: F) where F: for<'s> Fn(&'s (), Box<dyn Fn(&())>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0631]: type mismatch in closure arguments
--> $DIR/anonymous-higher-ranked-lifetime.rs:18:5
Expand Down Expand Up @@ -261,8 +261,8 @@ LL | h1(|_: (), _: (), _: (), _: ()| {});
note: required by `h1`
--> $DIR/anonymous-higher-ranked-lifetime.rs:40:1
|
LL | fn h1<F>(_: F) where F: Fn(&(), Box<Fn(&())>, &(), fn(&(), &())) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | fn h1<F>(_: F) where F: Fn(&(), Box<dyn Fn(&())>, &(), fn(&(), &())) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0631]: type mismatch in closure arguments
--> $DIR/anonymous-higher-ranked-lifetime.rs:20:5
Expand All @@ -275,8 +275,8 @@ LL | h1(|_: (), _: (), _: (), _: ()| {});
note: required by `h1`
--> $DIR/anonymous-higher-ranked-lifetime.rs:40:1
|
LL | fn h1<F>(_: F) where F: Fn(&(), Box<Fn(&())>, &(), fn(&(), &())) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | fn h1<F>(_: F) where F: Fn(&(), Box<dyn Fn(&())>, &(), fn(&(), &())) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0631]: type mismatch in closure arguments
--> $DIR/anonymous-higher-ranked-lifetime.rs:22:5
Expand All @@ -289,8 +289,8 @@ LL | h2(|_: (), _: (), _: (), _: ()| {});
note: required by `h2`
--> $DIR/anonymous-higher-ranked-lifetime.rs:41:1
|
LL | fn h2<F>(_: F) where F: for<'t0> Fn(&(), Box<Fn(&())>, &'t0 (), fn(&(), &())) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | fn h2<F>(_: F) where F: for<'t0> Fn(&(), Box<dyn Fn(&())>, &'t0 (), fn(&(), &())) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0631]: type mismatch in closure arguments
--> $DIR/anonymous-higher-ranked-lifetime.rs:22:5
Expand All @@ -303,8 +303,8 @@ LL | h2(|_: (), _: (), _: (), _: ()| {});
note: required by `h2`
--> $DIR/anonymous-higher-ranked-lifetime.rs:41:1
|
LL | fn h2<F>(_: F) where F: for<'t0> Fn(&(), Box<Fn(&())>, &'t0 (), fn(&(), &())) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | fn h2<F>(_: F) where F: for<'t0> Fn(&(), Box<dyn Fn(&())>, &'t0 (), fn(&(), &())) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 22 previous errors

2 changes: 1 addition & 1 deletion src/test/ui/associated-const/associated-const-in-trait.rs
Expand Up @@ -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 }
}
Expand Down
4 changes: 2 additions & 2 deletions 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`

Expand Down
Expand Up @@ -20,7 +20,7 @@ fn dent<C:BoxCar>(c: C, color: C::Color) {
//~^ ERROR ambiguous associated type `Color` in bounds of `C`
}

fn dent_object<COLOR>(c: BoxCar<Color=COLOR>) {
fn dent_object<COLOR>(c: dyn BoxCar<Color=COLOR>) {
//~^ ERROR ambiguous associated type
//~| ERROR the value of the associated type `Color` (from the trait `Vehicle`) must be specified
}
Expand Down
Expand Up @@ -11,25 +11,25 @@ LL | fn dent<C:BoxCar>(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`
...
LL | type Color;
| ----------- ambiguous `Color` from `Box`
...
LL | fn dent_object<COLOR>(c: BoxCar<Color=COLOR>) {
| ^^^^^^^^^^^ ambiguous associated type `Color`
LL | fn dent_object<COLOR>(c: dyn BoxCar<Color=COLOR>) {
| ^^^^^^^^^^^ 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
|
LL | type Color;
| ----------- `Color` defined here
...
LL | fn dent_object<COLOR>(c: BoxCar<Color=COLOR>) {
| ^^^^^^^^^^^^^^^^^^^ associated type `Color` must be specified
LL | fn dent_object<COLOR>(c: dyn BoxCar<Color=COLOR>) {
| ^^^^^^^^^^^^^^^^^^^^^^^ 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
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/associated-types/associated-types-eq-3.rs
Expand Up @@ -28,7 +28,7 @@ fn foo2<I: Foo>(x: I) {
}


pub fn baz(x: &Foo<A=Bar>) {
pub fn baz(x: &dyn Foo<A=Bar>) {
let _: Bar = x.boo();
}

Expand Down
Expand Up @@ -18,14 +18,14 @@ impl Foo for isize {
}

pub fn main() {
let a = &42isize as &Foo<A=usize, B=char>;
let a = &42isize as &dyn Foo<A=usize, B=char>;

let b = &42isize as &Foo<A=usize>;
let b = &42isize as &dyn Foo<A=usize>;
//~^ ERROR the value of the associated type `B` (from the trait `Foo`) must be specified

let c = &42isize as &Foo<B=char>;
let c = &42isize as &dyn Foo<B=char>;
//~^ 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
}
Expand Up @@ -4,17 +4,17 @@ 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<A=usize>;
| ^^^^^^^^^^^^ associated type `B` must be specified
LL | let b = &42isize as &dyn Foo<A=usize>;
| ^^^^^^^^^^^^^^^^ 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
|
LL | type A;
| ------- `A` defined here
...
LL | let c = &42isize as &Foo<B=char>;
| ^^^^^^^^^^^ associated type `A` must be specified
LL | let c = &42isize as &dyn Foo<B=char>;
| ^^^^^^^^^^^^^^^ 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
Expand All @@ -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
Expand Down
Expand Up @@ -3,6 +3,6 @@
trait I32Iterator = Iterator<Item = i32>;

fn main() {
let _: &I32Iterator<Item = u32> = &vec![42].into_iter();
let _: &dyn I32Iterator<Item = u32> = &vec![42].into_iter();
//~^ ERROR type mismatch
}
@@ -1,8 +1,8 @@
error[E0271]: type mismatch resolving `<std::vec::IntoIter<u32> 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<Item = u32> = &vec![42].into_iter();
| ^^^^^^^^^^^^^^^^^^^^^ expected u32, found i32
LL | let _: &dyn I32Iterator<Item = u32> = &vec![42].into_iter();
| ^^^^^^^^^^^^^^^^^^^^^ expected u32, found i32
|
= note: expected type `u32`
found type `i32`
Expand Down
Expand Up @@ -7,5 +7,5 @@ trait I32Iterator = Iterator<Item = i32>;
trait U32Iterator = I32Iterator<Item = u32>;

fn main() {
let _: &I32Iterator<Item = u32>;
let _: &dyn I32Iterator<Item = u32>;
}
@@ -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<for<'a> Fn(<() as Foo<'a>>::Item) -> &'a i32>) {
| ^^^^^^^
LL | fn object1(_: Box<dyn for<'a> 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<for<'a> Fn() -> <() as Foo<'a>>::Item>) {
| ^^^^^^^^^^^^^^^^^^^^^
LL | fn object2(_: Box<dyn for<'a> Fn() -> <() as Foo<'a>>::Item>) {
| ^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 2 previous errors

Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/associated-types/bound-lifetime-constrained.rs
Expand Up @@ -25,12 +25,12 @@ fn func2(_: for<'a> fn() -> <() as Foo<'a>>::Item) {
}

#[cfg(object)]
fn object1(_: Box<for<'a> Fn(<() as Foo<'a>>::Item) -> &'a i32>) {
fn object1(_: Box<dyn for<'a> Fn(<() as Foo<'a>>::Item) -> &'a i32>) {
//[object]~^ ERROR E0582
}

#[cfg(object)]
fn object2(_: Box<for<'a> Fn() -> <() as Foo<'a>>::Item>) {
fn object2(_: Box<dyn for<'a> Fn() -> <() as Foo<'a>>::Item>) {
//[object]~^ ERROR E0582
}

Expand Down
Expand Up @@ -17,10 +17,10 @@ LL | fn angle2<T>() where for<'a> T: Foo<Item=&'a i32> {
| ^^^^^^^^^^^^

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<Item=&'a i32>) {
| ^^^^^^^^^^^^
LL | fn angle3(_: &dyn for<'a> Foo<Item=&'a i32>) {
| ^^^^^^^^^^^^

error: aborting due to 4 previous errors

Expand Down
Expand Up @@ -17,10 +17,10 @@ LL | fn paren2<T>() 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

Expand Down
Expand Up @@ -24,7 +24,7 @@ fn angle2<T>() where for<'a> T: Foo<Item=&'a i32> {
}

#[cfg(angle)]
fn angle3(_: &for<'a> Foo<Item=&'a i32>) {
fn angle3(_: &dyn for<'a> Foo<Item=&'a i32>) {
//[angle]~^ ERROR binding for associated type `Item` references lifetime `'a`
}

Expand All @@ -44,7 +44,7 @@ fn paren2<T>() 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`
}

Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/associated-types/bound-lifetime-in-return-only.rs
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/async-await/async-with-closure.rs
Expand Up @@ -19,7 +19,7 @@ struct MyStream<C: ?Sized + MyClosure> {
async fn get_future<C: ?Sized + MyClosure>(_stream: MyStream<C>) {}

async fn f() {
let messages: MyStream<FnMut()> = unimplemented!();
let messages: MyStream<dyn FnMut()> = unimplemented!();
await!(get_future(messages));
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/async-await/issues/issue-53249.rs
Expand Up @@ -35,7 +35,7 @@ impl<R, F> Future for Lazy<F>
}

async fn __receive<WantFn, Fut>(want: WantFn) -> ()
where Fut: Future<Output = ()>, WantFn: Fn(&Box<Send + 'static>) -> Fut,
where Fut: Future<Output = ()>, WantFn: Fn(&Box<dyn Send + 'static>) -> Fut,
{
await!(lazy(|_| ()));
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/async-await/issues/issue-54974.rs
Expand Up @@ -9,7 +9,7 @@ trait SomeTrait: Send + Sync + 'static {
fn do_something(&self);
}

async fn my_task(obj: Arc<SomeTrait>) {
async fn my_task(obj: Arc<dyn SomeTrait>) {
unimplemented!()
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/bad/bad-sized.rs
@@ -1,7 +1,7 @@
trait Trait {}

pub fn main() {
let x: Vec<Trait + Sized> = Vec::new();
let x: Vec<dyn Trait + Sized> = 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
Expand Down

0 comments on commit eb4580a

Please sign in to comment.